amber-cli.js 2.2 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865658666586765868658696587065871658726587365874658756587665877658786587965880658816588265883658846588565886658876588865889658906589165892658936589465895658966589765898658996590065901659026590365904659056590665907659086590965910659116591265913659146591565916659176591865919659206592165922659236592465925659266592765928659296593065931659326593365934659356593665937659386593965940659416594265943659446594565946659476594865949659506595165952659536595465955659566595765958659596596065961659626596365964659656596665967659686596965970659716597265973659746597565976659776597865979659806598165982659836598465985659866598765988659896599065991659926599365994659956599665997659986599966000660016600266003660046600566006660076600866009660106601166012660136601466015660166601766018660196602066021660226602366024660256602666027660286602966030660316603266033660346603566036660376603866039660406604166042660436604466045660466604766048660496605066051660526605366054660556605666057660586605966060660616606266063660646606566066660676606866069660706607166072660736607466075660766607766078660796608066081660826608366084660856608666087660886608966090660916609266093660946609566096660976609866099661006610166102661036610466105661066610766108661096611066111661126611366114661156611666117661186611966120661216612266123661246612566126661276612866129661306613166132661336613466135661366613766138661396614066141661426614366144661456614666147661486614966150661516615266153661546615566156661576615866159661606616166162661636616466165661666616766168661696617066171661726617366174661756617666177661786617966180661816618266183661846618566186661876618866189661906619166192661936619466195661966619766198661996620066201662026620366204662056620666207662086620966210662116621266213662146621566216662176621866219662206622166222662236622466225662266622766228662296623066231662326623366234662356623666237662386623966240662416624266243662446624566246662476624866249662506625166252662536625466255662566625766258662596626066261662626626366264662656626666267662686626966270662716627266273662746627566276662776627866279662806628166282662836628466285662866628766288662896629066291662926629366294662956629666297662986629966300663016630266303663046630566306663076630866309663106631166312663136631466315663166631766318663196632066321663226632366324663256632666327663286632966330663316633266333663346633566336663376633866339663406634166342663436634466345663466634766348663496635066351663526635366354663556635666357663586635966360663616636266363663646636566366663676636866369663706637166372663736637466375663766637766378663796638066381663826638366384663856638666387663886638966390663916639266393663946639566396663976639866399664006640166402664036640466405664066640766408664096641066411664126641366414664156641666417664186641966420664216642266423664246642566426664276642866429664306643166432664336643466435664366643766438664396644066441664426644366444664456644666447664486644966450664516645266453664546645566456664576645866459664606646166462664636646466465664666646766468664696647066471664726647366474664756647666477664786647966480664816648266483664846648566486664876648866489664906649166492664936649466495664966649766498664996650066501665026650366504665056650666507665086650966510665116651266513665146651566516665176651866519665206652166522665236652466525665266652766528665296653066531665326653366534665356653666537665386653966540665416654266543665446654566546665476654866549665506655166552665536655466555665566655766558665596656066561665626656366564665656656666567665686656966570665716657266573665746657566576665776657866579665806658166582665836658466585665866658766588665896659066591665926659366594665956659666597665986659966600666016660266603666046660566606666076660866609666106661166612666136661466615666166661766618666196662066621666226662366624666256662666627666286662966630666316663266633666346663566636666376663866639666406664166642666436664466645666466664766648666496665066651666526665366654666556665666657666586665966660666616666266663666646666566666666676666866669666706667166672666736667466675666766667766678666796668066681666826668366684666856668666687666886668966690666916669266693666946669566696666976669866699667006670166702667036670466705667066670766708667096671066711667126671366714667156671666717667186671966720667216672266723667246672566726667276672866729667306673166732667336673466735667366673766738667396674066741667426674366744667456674666747667486674966750667516675266753667546675566756667576675866759667606676166762667636676466765667666676766768667696677066771667726677366774667756677666777667786677966780667816678266783667846678566786667876678866789667906679166792667936679466795667966679766798667996680066801668026680366804668056680666807668086680966810668116681266813668146681566816668176681866819668206682166822668236682466825668266682766828668296683066831668326683366834668356683666837668386683966840668416684266843668446684566846668476684866849668506685166852668536685466855668566685766858668596686066861668626686366864668656686666867668686686966870668716687266873668746687566876668776687866879668806688166882668836688466885668866688766888668896689066891668926689366894668956689666897668986689966900669016690266903669046690566906669076690866909669106691166912669136691466915669166691766918669196692066921669226692366924669256692666927669286692966930669316693266933669346693566936669376693866939669406694166942669436694466945669466694766948669496695066951669526695366954669556695666957669586695966960669616696266963669646696566966669676696866969669706697166972669736697466975669766697766978669796698066981669826698366984669856698666987669886698966990669916699266993669946699566996669976699866999670006700167002670036700467005670066700767008670096701067011670126701367014670156701667017670186701967020670216702267023670246702567026670276702867029670306703167032670336703467035670366703767038670396704067041670426704367044670456704667047670486704967050670516705267053670546705567056670576705867059670606706167062670636706467065670666706767068670696707067071670726707367074670756707667077670786707967080670816708267083670846708567086670876708867089670906709167092670936709467095670966709767098670996710067101671026710367104671056710667107671086710967110671116711267113671146711567116671176711867119671206712167122671236712467125671266712767128671296713067131671326713367134671356713667137671386713967140671416714267143671446714567146671476714867149671506715167152671536715467155671566715767158671596716067161671626716367164671656716667167671686716967170671716717267173671746717567176671776717867179671806718167182671836718467185671866718767188671896719067191671926719367194671956719667197671986719967200672016720267203672046720567206672076720867209672106721167212672136721467215672166721767218672196722067221672226722367224672256722667227672286722967230672316723267233672346723567236672376723867239672406724167242672436724467245672466724767248672496725067251672526725367254672556725667257672586725967260672616726267263672646726567266672676726867269672706727167272672736727467275672766727767278672796728067281672826728367284672856728667287672886728967290672916729267293672946729567296672976729867299673006730167302673036730467305673066730767308673096731067311673126731367314673156731667317673186731967320673216732267323673246732567326673276732867329673306733167332673336733467335673366733767338673396734067341673426734367344673456734667347673486734967350673516735267353673546735567356673576735867359673606736167362673636736467365673666736767368673696737067371673726737367374673756737667377673786737967380673816738267383673846738567386673876738867389673906739167392673936739467395673966739767398673996740067401674026740367404674056740667407674086740967410674116741267413674146741567416674176741867419674206742167422674236742467425674266742767428674296743067431674326743367434674356743667437674386743967440674416744267443674446744567446674476744867449674506745167452674536745467455674566745767458674596746067461674626746367464674656746667467674686746967470674716747267473674746747567476674776747867479674806748167482674836748467485674866748767488674896749067491674926749367494674956749667497674986749967500675016750267503675046750567506675076750867509675106751167512675136751467515675166751767518675196752067521675226752367524675256752667527675286752967530675316753267533675346753567536675376753867539675406754167542675436754467545675466754767548675496755067551675526755367554675556755667557675586755967560675616756267563675646756567566675676756867569675706757167572675736757467575675766757767578675796758067581675826758367584675856758667587675886758967590675916759267593675946759567596675976759867599676006760167602676036760467605676066760767608676096761067611676126761367614676156761667617676186761967620676216762267623676246762567626676276762867629676306763167632676336763467635676366763767638676396764067641676426764367644676456764667647676486764967650676516765267653676546765567656676576765867659676606766167662676636766467665676666766767668676696767067671676726767367674676756767667677676786767967680676816768267683676846768567686676876768867689676906769167692676936769467695676966769767698676996770067701677026770367704677056770667707677086770967710677116771267713677146771567716677176771867719677206772167722677236772467725677266772767728677296773067731677326773367734677356773667737677386773967740677416774267743677446774567746677476774867749677506775167752677536775467755677566775767758677596776067761677626776367764677656776667767677686776967770677716777267773677746777567776677776777867779677806778167782677836778467785677866778767788677896779067791677926779367794677956779667797677986779967800678016780267803678046780567806678076780867809678106781167812678136781467815678166781767818678196782067821678226782367824678256782667827678286782967830678316783267833678346783567836678376783867839678406784167842678436784467845678466784767848678496785067851678526785367854678556785667857678586785967860678616786267863678646786567866678676786867869678706787167872678736787467875678766787767878678796788067881678826788367884678856788667887678886788967890678916789267893678946789567896678976789867899679006790167902679036790467905679066790767908679096791067911679126791367914679156791667917679186791967920679216792267923679246792567926679276792867929679306793167932679336793467935679366793767938679396794067941679426794367944679456794667947679486794967950679516795267953679546795567956679576795867959679606796167962679636796467965679666796767968679696797067971679726797367974679756797667977679786797967980679816798267983679846798567986679876798867989679906799167992679936799467995679966799767998679996800068001680026800368004680056800668007680086800968010680116801268013680146801568016680176801868019680206802168022680236802468025680266802768028680296803068031680326803368034680356803668037680386803968040680416804268043680446804568046680476804868049680506805168052680536805468055680566805768058680596806068061680626806368064680656806668067680686806968070680716807268073680746807568076680776807868079680806808168082680836808468085680866808768088680896809068091680926809368094680956809668097680986809968100681016810268103681046810568106681076810868109681106811168112681136811468115681166811768118681196812068121681226812368124681256812668127681286812968130681316813268133681346813568136681376813868139681406814168142681436814468145681466814768148681496815068151681526815368154681556815668157681586815968160681616816268163681646816568166681676816868169681706817168172681736817468175681766817768178681796818068181681826818368184681856818668187681886818968190681916819268193681946819568196681976819868199682006820168202682036820468205682066820768208682096821068211682126821368214682156821668217682186821968220682216822268223682246822568226682276822868229682306823168232682336823468235682366823768238682396824068241682426824368244682456824668247682486824968250682516825268253682546825568256682576825868259682606826168262682636826468265682666826768268682696827068271682726827368274682756827668277682786827968280682816828268283682846828568286682876828868289682906829168292682936829468295682966829768298682996830068301683026830368304683056830668307683086830968310683116831268313683146831568316683176831868319683206832168322683236832468325683266832768328683296833068331683326833368334683356833668337683386833968340683416834268343683446834568346683476834868349683506835168352683536835468355683566835768358683596836068361683626836368364683656836668367683686836968370683716837268373683746837568376683776837868379683806838168382683836838468385683866838768388683896839068391683926839368394683956839668397683986839968400684016840268403684046840568406684076840868409684106841168412684136841468415684166841768418684196842068421684226842368424684256842668427684286842968430684316843268433684346843568436684376843868439684406844168442684436844468445684466844768448684496845068451684526845368454684556845668457684586845968460684616846268463684646846568466684676846868469684706847168472684736847468475684766847768478684796848068481684826848368484684856848668487684886848968490684916849268493684946849568496684976849868499685006850168502685036850468505685066850768508685096851068511685126851368514685156851668517685186851968520685216852268523685246852568526685276852868529685306853168532685336853468535685366853768538685396854068541685426854368544685456854668547685486854968550685516855268553685546855568556685576855868559685606856168562685636856468565685666856768568685696857068571685726857368574685756857668577685786857968580685816858268583685846858568586685876858868589685906859168592685936859468595685966859768598685996860068601686026860368604686056860668607686086860968610686116861268613686146861568616686176861868619686206862168622686236862468625686266862768628686296863068631686326863368634686356863668637686386863968640686416864268643686446864568646686476864868649686506865168652686536865468655686566865768658686596866068661686626866368664686656866668667686686866968670686716867268673686746867568676686776867868679686806868168682686836868468685686866868768688686896869068691686926869368694686956869668697686986869968700687016870268703687046870568706687076870868709687106871168712687136871468715687166871768718687196872068721687226872368724687256872668727687286872968730687316873268733687346873568736687376873868739687406874168742687436874468745687466874768748687496875068751687526875368754687556875668757687586875968760687616876268763687646876568766687676876868769687706877168772687736877468775687766877768778687796878068781687826878368784687856878668787687886878968790687916879268793687946879568796687976879868799688006880168802688036880468805688066880768808688096881068811688126881368814688156881668817688186881968820688216882268823688246882568826688276882868829688306883168832688336883468835688366883768838688396884068841688426884368844688456884668847688486884968850688516885268853688546885568856688576885868859688606886168862688636886468865688666886768868688696887068871688726887368874688756887668877688786887968880688816888268883688846888568886688876888868889688906889168892688936889468895688966889768898688996890068901689026890368904689056890668907689086890968910689116891268913689146891568916689176891868919689206892168922689236892468925689266892768928689296893068931689326893368934689356893668937689386893968940689416894268943689446894568946689476894868949689506895168952689536895468955689566895768958689596896068961689626896368964689656896668967689686896968970689716897268973689746897568976689776897868979689806898168982689836898468985689866898768988689896899068991689926899368994689956899668997689986899969000690016900269003690046900569006690076900869009690106901169012690136901469015690166901769018690196902069021690226902369024690256902669027690286902969030690316903269033690346903569036690376903869039690406904169042690436904469045690466904769048690496905069051690526905369054690556905669057690586905969060690616906269063690646906569066690676906869069690706907169072690736907469075690766907769078690796908069081690826908369084690856908669087690886908969090690916909269093690946909569096690976909869099691006910169102691036910469105691066910769108691096911069111691126911369114691156911669117691186911969120691216912269123691246912569126691276912869129691306913169132691336913469135691366913769138691396914069141691426914369144691456914669147691486914969150691516915269153691546915569156691576915869159691606916169162691636916469165691666916769168691696917069171691726917369174691756917669177691786917969180691816918269183691846918569186691876918869189691906919169192691936919469195691966919769198691996920069201692026920369204692056920669207692086920969210692116921269213692146921569216692176921869219692206922169222692236922469225692266922769228692296923069231692326923369234692356923669237692386923969240692416924269243692446924569246692476924869249692506925169252692536925469255692566925769258692596926069261692626926369264692656926669267692686926969270692716927269273692746927569276692776927869279692806928169282692836928469285692866928769288692896929069291692926929369294692956929669297692986929969300693016930269303693046930569306693076930869309693106931169312693136931469315693166931769318693196932069321693226932369324693256932669327693286932969330693316933269333693346933569336693376933869339693406934169342693436934469345693466934769348693496935069351693526935369354693556935669357693586935969360693616936269363693646936569366693676936869369693706937169372693736937469375693766937769378693796938069381693826938369384693856938669387693886938969390693916939269393693946939569396693976939869399694006940169402694036940469405694066940769408694096941069411694126941369414694156941669417694186941969420694216942269423694246942569426694276942869429694306943169432694336943469435694366943769438694396944069441694426944369444694456944669447694486944969450694516945269453694546945569456694576945869459694606946169462694636946469465694666946769468694696947069471694726947369474694756947669477694786947969480694816948269483694846948569486694876948869489694906949169492694936949469495694966949769498694996950069501695026950369504695056950669507695086950969510695116951269513695146951569516695176951869519695206952169522695236952469525695266952769528695296953069531695326953369534695356953669537695386953969540695416954269543695446954569546695476954869549695506955169552695536955469555695566955769558695596956069561695626956369564695656956669567695686956969570695716957269573695746957569576695776957869579695806958169582695836958469585695866958769588695896959069591695926959369594695956959669597695986959969600696016960269603696046960569606696076960869609696106961169612696136961469615696166961769618696196962069621696226962369624696256962669627696286962969630696316963269633696346963569636696376963869639696406964169642696436964469645696466964769648696496965069651696526965369654696556965669657696586965969660696616966269663696646966569666696676966869669696706967169672696736967469675696766967769678696796968069681696826968369684696856968669687696886968969690696916969269693696946969569696696976969869699697006970169702697036970469705697066970769708697096971069711697126971369714697156971669717697186971969720697216972269723697246972569726697276972869729697306973169732697336973469735697366973769738697396974069741697426974369744697456974669747697486974969750697516975269753697546975569756697576975869759697606976169762697636976469765697666976769768697696977069771697726977369774697756977669777697786977969780697816978269783697846978569786697876978869789697906979169792697936979469795697966979769798697996980069801698026980369804698056980669807698086980969810698116981269813698146981569816698176981869819698206982169822698236982469825698266982769828698296983069831698326983369834698356983669837698386983969840698416984269843698446984569846698476984869849698506985169852698536985469855698566985769858698596986069861698626986369864698656986669867698686986969870698716987269873698746987569876698776987869879698806988169882698836988469885698866988769888698896989069891698926989369894698956989669897698986989969900699016990269903699046990569906699076990869909699106991169912699136991469915699166991769918699196992069921699226992369924699256992669927699286992969930699316993269933699346993569936699376993869939699406994169942699436994469945699466994769948699496995069951699526995369954699556995669957699586995969960699616996269963699646996569966699676996869969699706997169972699736997469975699766997769978699796998069981699826998369984699856998669987699886998969990699916999269993699946999569996699976999869999700007000170002700037000470005700067000770008700097001070011700127001370014700157001670017700187001970020700217002270023700247002570026700277002870029700307003170032700337003470035700367003770038700397004070041700427004370044700457004670047700487004970050700517005270053700547005570056700577005870059700607006170062700637006470065700667006770068700697007070071700727007370074700757007670077700787007970080700817008270083700847008570086700877008870089700907009170092700937009470095700967009770098700997010070101701027010370104701057010670107701087010970110701117011270113701147011570116701177011870119701207012170122701237012470125701267012770128701297013070131701327013370134701357013670137701387013970140701417014270143701447014570146701477014870149701507015170152701537015470155701567015770158701597016070161701627016370164701657016670167701687016970170701717017270173701747017570176701777017870179701807018170182701837018470185701867018770188701897019070191701927019370194701957019670197701987019970200702017020270203702047020570206702077020870209702107021170212702137021470215702167021770218702197022070221702227022370224702257022670227702287022970230702317023270233702347023570236702377023870239702407024170242702437024470245702467024770248702497025070251702527025370254702557025670257702587025970260702617026270263702647026570266702677026870269702707027170272702737027470275702767027770278702797028070281702827028370284702857028670287702887028970290702917029270293702947029570296702977029870299703007030170302703037030470305703067030770308703097031070311703127031370314703157031670317703187031970320703217032270323703247032570326703277032870329703307033170332703337033470335703367033770338703397034070341703427034370344703457034670347703487034970350703517035270353703547035570356703577035870359703607036170362703637036470365703667036770368703697037070371703727037370374703757037670377703787037970380703817038270383703847038570386703877038870389703907039170392703937039470395703967039770398703997040070401704027040370404704057040670407704087040970410704117041270413704147041570416704177041870419704207042170422704237042470425704267042770428704297043070431704327043370434704357043670437704387043970440704417044270443704447044570446704477044870449704507045170452704537045470455704567045770458704597046070461704627046370464704657046670467704687046970470704717047270473704747047570476704777047870479704807048170482704837048470485704867048770488704897049070491704927049370494704957049670497704987049970500705017050270503705047050570506705077050870509705107051170512705137051470515705167051770518705197052070521705227052370524705257052670527705287052970530705317053270533705347053570536705377053870539705407054170542705437054470545705467054770548705497055070551705527055370554705557055670557705587055970560705617056270563705647056570566705677056870569705707057170572705737057470575705767057770578705797058070581705827058370584705857058670587705887058970590705917059270593705947059570596705977059870599706007060170602706037060470605706067060770608706097061070611706127061370614706157061670617706187061970620706217062270623706247062570626706277062870629706307063170632706337063470635706367063770638706397064070641706427064370644706457064670647706487064970650706517065270653706547065570656706577065870659706607066170662706637066470665706667066770668706697067070671706727067370674706757067670677706787067970680706817068270683706847068570686706877068870689706907069170692706937069470695706967069770698706997070070701707027070370704707057070670707707087070970710707117071270713707147071570716707177071870719707207072170722707237072470725707267072770728707297073070731707327073370734707357073670737707387073970740707417074270743707447074570746707477074870749707507075170752707537075470755707567075770758707597076070761707627076370764707657076670767707687076970770707717077270773707747077570776707777077870779707807078170782707837078470785707867078770788707897079070791707927079370794707957079670797707987079970800708017080270803708047080570806708077080870809708107081170812708137081470815708167081770818708197082070821708227082370824708257082670827708287082970830708317083270833708347083570836708377083870839708407084170842708437084470845708467084770848708497085070851708527085370854708557085670857708587085970860708617086270863708647086570866708677086870869708707087170872708737087470875708767087770878708797088070881708827088370884708857088670887708887088970890708917089270893708947089570896708977089870899709007090170902709037090470905709067090770908709097091070911709127091370914709157091670917709187091970920709217092270923709247092570926709277092870929709307093170932709337093470935709367093770938709397094070941709427094370944709457094670947709487094970950709517095270953709547095570956709577095870959709607096170962709637096470965709667096770968709697097070971709727097370974709757097670977709787097970980709817098270983709847098570986709877098870989709907099170992709937099470995709967099770998709997100071001710027100371004710057100671007710087100971010710117101271013710147101571016710177101871019710207102171022710237102471025710267102771028710297103071031710327103371034710357103671037710387103971040710417104271043710447104571046710477104871049710507105171052710537105471055710567105771058710597106071061710627106371064710657106671067710687106971070710717107271073710747107571076710777107871079710807108171082710837108471085710867108771088710897109071091710927109371094710957109671097710987109971100711017110271103711047110571106711077110871109711107111171112711137111471115711167111771118711197112071121711227112371124711257112671127711287112971130711317113271133711347113571136711377113871139711407114171142711437114471145711467114771148711497115071151711527115371154711557115671157711587115971160711617116271163711647116571166711677116871169711707117171172711737117471175711767117771178711797118071181711827118371184711857118671187711887118971190711917119271193711947119571196711977119871199712007120171202712037120471205712067120771208712097121071211712127121371214712157121671217712187121971220712217122271223712247122571226712277122871229712307123171232712337123471235712367123771238712397124071241712427124371244712457124671247712487124971250712517125271253712547125571256712577125871259712607126171262712637126471265712667126771268712697127071271712727127371274712757127671277712787127971280712817128271283712847128571286712877128871289712907129171292712937129471295712967129771298712997130071301713027130371304713057130671307713087130971310713117131271313713147131571316713177131871319713207132171322713237132471325713267132771328713297133071331713327133371334713357133671337713387133971340713417134271343713447134571346713477134871349713507135171352713537135471355713567135771358713597136071361713627136371364713657136671367713687136971370713717137271373713747137571376713777137871379713807138171382713837138471385713867138771388713897139071391713927139371394713957139671397713987139971400714017140271403714047140571406714077140871409714107141171412714137141471415714167141771418714197142071421714227142371424714257142671427714287142971430714317143271433714347143571436714377143871439714407144171442714437144471445714467144771448714497145071451714527145371454714557145671457714587145971460714617146271463714647146571466714677146871469714707147171472714737147471475714767147771478714797148071481714827148371484714857148671487714887148971490714917149271493714947149571496714977149871499715007150171502715037150471505715067150771508715097151071511715127151371514715157151671517715187151971520715217152271523715247152571526715277152871529715307153171532715337153471535715367153771538715397154071541715427154371544715457154671547715487154971550715517155271553715547155571556715577155871559715607156171562715637156471565715667156771568715697157071571715727157371574715757157671577715787157971580715817158271583715847158571586715877158871589715907159171592715937159471595715967159771598715997160071601716027160371604716057160671607716087160971610716117161271613716147161571616716177161871619716207162171622716237162471625716267162771628716297163071631716327163371634716357163671637716387163971640716417164271643716447164571646716477164871649716507165171652716537165471655716567165771658716597166071661716627166371664716657166671667716687166971670716717167271673716747167571676716777167871679716807168171682716837168471685716867168771688716897169071691716927169371694716957169671697716987169971700717017170271703717047170571706717077170871709717107171171712717137171471715717167171771718717197172071721717227172371724717257172671727717287172971730717317173271733717347173571736717377173871739717407174171742717437174471745717467174771748717497175071751717527175371754717557175671757717587175971760717617176271763717647176571766717677176871769717707177171772717737177471775717767177771778717797178071781717827178371784717857178671787717887178971790717917179271793717947179571796717977179871799718007180171802718037180471805718067180771808718097181071811718127181371814718157181671817718187181971820718217182271823718247182571826718277182871829718307183171832718337183471835718367183771838718397184071841718427184371844718457184671847718487184971850718517185271853718547185571856718577185871859718607186171862718637186471865718667186771868718697187071871718727187371874718757187671877718787187971880718817188271883718847188571886718877188871889718907189171892718937189471895718967189771898718997190071901719027190371904719057190671907719087190971910719117191271913719147191571916719177191871919719207192171922719237192471925719267192771928719297193071931719327193371934719357193671937719387193971940719417194271943719447194571946719477194871949719507195171952719537195471955719567195771958719597196071961719627196371964719657196671967719687196971970719717197271973719747197571976719777197871979719807198171982719837198471985719867198771988719897199071991719927199371994719957199671997719987199972000720017200272003720047200572006720077200872009720107201172012720137201472015720167201772018720197202072021720227202372024720257202672027720287202972030720317203272033720347203572036720377203872039720407204172042720437204472045720467204772048720497205072051720527205372054720557205672057720587205972060720617206272063720647206572066720677206872069720707207172072720737207472075720767207772078720797208072081720827208372084720857208672087720887208972090720917209272093720947209572096720977209872099721007210172102721037210472105721067210772108721097211072111721127211372114721157211672117721187211972120721217212272123721247212572126721277212872129721307213172132721337213472135721367213772138721397214072141721427214372144721457214672147721487214972150721517215272153721547215572156721577215872159721607216172162721637216472165721667216772168721697217072171721727217372174721757217672177721787217972180721817218272183721847218572186721877218872189721907219172192721937219472195721967219772198721997220072201722027220372204722057220672207722087220972210722117221272213722147221572216722177221872219722207222172222722237222472225722267222772228722297223072231722327223372234722357223672237722387223972240722417224272243722447224572246722477224872249722507225172252722537225472255722567225772258722597226072261722627226372264722657226672267722687226972270722717227272273722747227572276722777227872279722807228172282722837228472285722867228772288722897229072291722927229372294722957229672297722987229972300723017230272303723047230572306723077230872309723107231172312723137231472315723167231772318723197232072321723227232372324723257232672327723287232972330723317233272333723347233572336723377233872339723407234172342723437234472345723467234772348723497235072351723527235372354723557235672357723587235972360723617236272363723647236572366723677236872369723707237172372723737237472375723767237772378723797238072381723827238372384723857238672387723887238972390723917239272393723947239572396723977239872399724007240172402724037240472405724067240772408724097241072411724127241372414724157241672417724187241972420724217242272423724247242572426724277242872429724307243172432724337243472435724367243772438724397244072441724427244372444724457244672447724487244972450724517245272453724547245572456724577245872459724607246172462724637246472465724667246772468724697247072471724727247372474724757247672477724787247972480724817248272483724847248572486724877248872489724907249172492724937249472495724967249772498724997250072501725027250372504725057250672507725087250972510725117251272513725147251572516725177251872519725207252172522725237252472525725267252772528725297253072531725327253372534725357253672537725387253972540725417254272543725447254572546725477254872549725507255172552725537255472555725567255772558725597256072561725627256372564725657256672567725687256972570725717257272573725747257572576725777257872579725807258172582725837258472585725867258772588725897259072591725927259372594725957259672597725987259972600726017260272603726047260572606726077260872609726107261172612726137261472615726167261772618726197262072621726227262372624726257262672627726287262972630726317263272633726347263572636726377263872639726407264172642726437264472645726467264772648726497265072651726527265372654726557265672657726587265972660726617266272663726647266572666726677266872669726707267172672726737267472675726767267772678726797268072681726827268372684726857268672687726887268972690726917269272693726947269572696726977269872699727007270172702727037270472705727067270772708727097271072711727127271372714727157271672717727187271972720727217272272723727247272572726727277272872729727307273172732727337273472735727367273772738727397274072741727427274372744727457274672747
  1. #!/usr/bin/env node
  2. (function(define, require){
  3. define('__wrap__', function (requirejs) {
  4. var module = void 0; // Bad UMDs workaround
  5. requirejs.resolve = require.resolve;
  6. require = requirejs;
  7. /*!
  8. * @overview es6-promise - a tiny implementation of Promises/A+.
  9. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
  10. * @license Licensed under MIT license
  11. * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
  12. * @version v4.2.6+9869a4bc
  13. */
  14. (function (global, factory) {
  15. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  16. typeof define === 'function' && define.amd ? define('amber/es6-promise',factory) :
  17. (global.ES6Promise = factory());
  18. }(this, (function () { 'use strict';
  19. function objectOrFunction(x) {
  20. var type = typeof x;
  21. return x !== null && (type === 'object' || type === 'function');
  22. }
  23. function isFunction(x) {
  24. return typeof x === 'function';
  25. }
  26. var _isArray = void 0;
  27. if (Array.isArray) {
  28. _isArray = Array.isArray;
  29. } else {
  30. _isArray = function (x) {
  31. return Object.prototype.toString.call(x) === '[object Array]';
  32. };
  33. }
  34. var isArray = _isArray;
  35. var len = 0;
  36. var vertxNext = void 0;
  37. var customSchedulerFn = void 0;
  38. var asap = function asap(callback, arg) {
  39. queue[len] = callback;
  40. queue[len + 1] = arg;
  41. len += 2;
  42. if (len === 2) {
  43. // If len is 2, that means that we need to schedule an async flush.
  44. // If additional callbacks are queued before the queue is flushed, they
  45. // will be processed by this flush that we are scheduling.
  46. if (customSchedulerFn) {
  47. customSchedulerFn(flush);
  48. } else {
  49. scheduleFlush();
  50. }
  51. }
  52. };
  53. function setScheduler(scheduleFn) {
  54. customSchedulerFn = scheduleFn;
  55. }
  56. function setAsap(asapFn) {
  57. asap = asapFn;
  58. }
  59. var browserWindow = typeof window !== 'undefined' ? window : undefined;
  60. var browserGlobal = browserWindow || {};
  61. var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
  62. var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';
  63. // test for web worker but not in IE10
  64. var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined';
  65. // node
  66. function useNextTick() {
  67. // node version 0.10.x displays a deprecation warning when nextTick is used recursively
  68. // see https://github.com/cujojs/when/issues/410 for details
  69. return function () {
  70. return process.nextTick(flush);
  71. };
  72. }
  73. // vertx
  74. function useVertxTimer() {
  75. if (typeof vertxNext !== 'undefined') {
  76. return function () {
  77. vertxNext(flush);
  78. };
  79. }
  80. return useSetTimeout();
  81. }
  82. function useMutationObserver() {
  83. var iterations = 0;
  84. var observer = new BrowserMutationObserver(flush);
  85. var node = document.createTextNode('');
  86. observer.observe(node, { characterData: true });
  87. return function () {
  88. node.data = iterations = ++iterations % 2;
  89. };
  90. }
  91. // web worker
  92. function useMessageChannel() {
  93. var channel = new MessageChannel();
  94. channel.port1.onmessage = flush;
  95. return function () {
  96. return channel.port2.postMessage(0);
  97. };
  98. }
  99. function useSetTimeout() {
  100. // Store setTimeout reference so es6-promise will be unaffected by
  101. // other code modifying setTimeout (like sinon.useFakeTimers())
  102. var globalSetTimeout = setTimeout;
  103. return function () {
  104. return globalSetTimeout(flush, 1);
  105. };
  106. }
  107. var queue = new Array(1000);
  108. function flush() {
  109. for (var i = 0; i < len; i += 2) {
  110. var callback = queue[i];
  111. var arg = queue[i + 1];
  112. callback(arg);
  113. queue[i] = undefined;
  114. queue[i + 1] = undefined;
  115. }
  116. len = 0;
  117. }
  118. function attemptVertx() {
  119. try {
  120. var vertx = Function('return this')().require('vertx');
  121. vertxNext = vertx.runOnLoop || vertx.runOnContext;
  122. return useVertxTimer();
  123. } catch (e) {
  124. return useSetTimeout();
  125. }
  126. }
  127. var scheduleFlush = void 0;
  128. // Decide what async method to use to triggering processing of queued callbacks:
  129. if (isNode) {
  130. scheduleFlush = useNextTick();
  131. } else if (BrowserMutationObserver) {
  132. scheduleFlush = useMutationObserver();
  133. } else if (isWorker) {
  134. scheduleFlush = useMessageChannel();
  135. } else if (browserWindow === undefined && typeof require === 'function') {
  136. scheduleFlush = attemptVertx();
  137. } else {
  138. scheduleFlush = useSetTimeout();
  139. }
  140. function then(onFulfillment, onRejection) {
  141. var parent = this;
  142. var child = new this.constructor(noop);
  143. if (child[PROMISE_ID] === undefined) {
  144. makePromise(child);
  145. }
  146. var _state = parent._state;
  147. if (_state) {
  148. var callback = arguments[_state - 1];
  149. asap(function () {
  150. return invokeCallback(_state, child, callback, parent._result);
  151. });
  152. } else {
  153. subscribe(parent, child, onFulfillment, onRejection);
  154. }
  155. return child;
  156. }
  157. /**
  158. `Promise.resolve` returns a promise that will become resolved with the
  159. passed `value`. It is shorthand for the following:
  160. ```javascript
  161. let promise = new Promise(function(resolve, reject){
  162. resolve(1);
  163. });
  164. promise.then(function(value){
  165. // value === 1
  166. });
  167. ```
  168. Instead of writing the above, your code now simply becomes the following:
  169. ```javascript
  170. let promise = Promise.resolve(1);
  171. promise.then(function(value){
  172. // value === 1
  173. });
  174. ```
  175. @method resolve
  176. @static
  177. @param {Any} value value that the returned promise will be resolved with
  178. Useful for tooling.
  179. @return {Promise} a promise that will become fulfilled with the given
  180. `value`
  181. */
  182. function resolve$1(object) {
  183. /*jshint validthis:true */
  184. var Constructor = this;
  185. if (object && typeof object === 'object' && object.constructor === Constructor) {
  186. return object;
  187. }
  188. var promise = new Constructor(noop);
  189. resolve(promise, object);
  190. return promise;
  191. }
  192. var PROMISE_ID = Math.random().toString(36).substring(2);
  193. function noop() {}
  194. var PENDING = void 0;
  195. var FULFILLED = 1;
  196. var REJECTED = 2;
  197. var TRY_CATCH_ERROR = { error: null };
  198. function selfFulfillment() {
  199. return new TypeError("You cannot resolve a promise with itself");
  200. }
  201. function cannotReturnOwn() {
  202. return new TypeError('A promises callback cannot return that same promise.');
  203. }
  204. function getThen(promise) {
  205. try {
  206. return promise.then;
  207. } catch (error) {
  208. TRY_CATCH_ERROR.error = error;
  209. return TRY_CATCH_ERROR;
  210. }
  211. }
  212. function tryThen(then$$1, value, fulfillmentHandler, rejectionHandler) {
  213. try {
  214. then$$1.call(value, fulfillmentHandler, rejectionHandler);
  215. } catch (e) {
  216. return e;
  217. }
  218. }
  219. function handleForeignThenable(promise, thenable, then$$1) {
  220. asap(function (promise) {
  221. var sealed = false;
  222. var error = tryThen(then$$1, thenable, function (value) {
  223. if (sealed) {
  224. return;
  225. }
  226. sealed = true;
  227. if (thenable !== value) {
  228. resolve(promise, value);
  229. } else {
  230. fulfill(promise, value);
  231. }
  232. }, function (reason) {
  233. if (sealed) {
  234. return;
  235. }
  236. sealed = true;
  237. reject(promise, reason);
  238. }, 'Settle: ' + (promise._label || ' unknown promise'));
  239. if (!sealed && error) {
  240. sealed = true;
  241. reject(promise, error);
  242. }
  243. }, promise);
  244. }
  245. function handleOwnThenable(promise, thenable) {
  246. if (thenable._state === FULFILLED) {
  247. fulfill(promise, thenable._result);
  248. } else if (thenable._state === REJECTED) {
  249. reject(promise, thenable._result);
  250. } else {
  251. subscribe(thenable, undefined, function (value) {
  252. return resolve(promise, value);
  253. }, function (reason) {
  254. return reject(promise, reason);
  255. });
  256. }
  257. }
  258. function handleMaybeThenable(promise, maybeThenable, then$$1) {
  259. if (maybeThenable.constructor === promise.constructor && then$$1 === then && maybeThenable.constructor.resolve === resolve$1) {
  260. handleOwnThenable(promise, maybeThenable);
  261. } else {
  262. if (then$$1 === TRY_CATCH_ERROR) {
  263. reject(promise, TRY_CATCH_ERROR.error);
  264. TRY_CATCH_ERROR.error = null;
  265. } else if (then$$1 === undefined) {
  266. fulfill(promise, maybeThenable);
  267. } else if (isFunction(then$$1)) {
  268. handleForeignThenable(promise, maybeThenable, then$$1);
  269. } else {
  270. fulfill(promise, maybeThenable);
  271. }
  272. }
  273. }
  274. function resolve(promise, value) {
  275. if (promise === value) {
  276. reject(promise, selfFulfillment());
  277. } else if (objectOrFunction(value)) {
  278. handleMaybeThenable(promise, value, getThen(value));
  279. } else {
  280. fulfill(promise, value);
  281. }
  282. }
  283. function publishRejection(promise) {
  284. if (promise._onerror) {
  285. promise._onerror(promise._result);
  286. }
  287. publish(promise);
  288. }
  289. function fulfill(promise, value) {
  290. if (promise._state !== PENDING) {
  291. return;
  292. }
  293. promise._result = value;
  294. promise._state = FULFILLED;
  295. if (promise._subscribers.length !== 0) {
  296. asap(publish, promise);
  297. }
  298. }
  299. function reject(promise, reason) {
  300. if (promise._state !== PENDING) {
  301. return;
  302. }
  303. promise._state = REJECTED;
  304. promise._result = reason;
  305. asap(publishRejection, promise);
  306. }
  307. function subscribe(parent, child, onFulfillment, onRejection) {
  308. var _subscribers = parent._subscribers;
  309. var length = _subscribers.length;
  310. parent._onerror = null;
  311. _subscribers[length] = child;
  312. _subscribers[length + FULFILLED] = onFulfillment;
  313. _subscribers[length + REJECTED] = onRejection;
  314. if (length === 0 && parent._state) {
  315. asap(publish, parent);
  316. }
  317. }
  318. function publish(promise) {
  319. var subscribers = promise._subscribers;
  320. var settled = promise._state;
  321. if (subscribers.length === 0) {
  322. return;
  323. }
  324. var child = void 0,
  325. callback = void 0,
  326. detail = promise._result;
  327. for (var i = 0; i < subscribers.length; i += 3) {
  328. child = subscribers[i];
  329. callback = subscribers[i + settled];
  330. if (child) {
  331. invokeCallback(settled, child, callback, detail);
  332. } else {
  333. callback(detail);
  334. }
  335. }
  336. promise._subscribers.length = 0;
  337. }
  338. function tryCatch(callback, detail) {
  339. try {
  340. return callback(detail);
  341. } catch (e) {
  342. TRY_CATCH_ERROR.error = e;
  343. return TRY_CATCH_ERROR;
  344. }
  345. }
  346. function invokeCallback(settled, promise, callback, detail) {
  347. var hasCallback = isFunction(callback),
  348. value = void 0,
  349. error = void 0,
  350. succeeded = void 0,
  351. failed = void 0;
  352. if (hasCallback) {
  353. value = tryCatch(callback, detail);
  354. if (value === TRY_CATCH_ERROR) {
  355. failed = true;
  356. error = value.error;
  357. value.error = null;
  358. } else {
  359. succeeded = true;
  360. }
  361. if (promise === value) {
  362. reject(promise, cannotReturnOwn());
  363. return;
  364. }
  365. } else {
  366. value = detail;
  367. succeeded = true;
  368. }
  369. if (promise._state !== PENDING) {
  370. // noop
  371. } else if (hasCallback && succeeded) {
  372. resolve(promise, value);
  373. } else if (failed) {
  374. reject(promise, error);
  375. } else if (settled === FULFILLED) {
  376. fulfill(promise, value);
  377. } else if (settled === REJECTED) {
  378. reject(promise, value);
  379. }
  380. }
  381. function initializePromise(promise, resolver) {
  382. try {
  383. resolver(function resolvePromise(value) {
  384. resolve(promise, value);
  385. }, function rejectPromise(reason) {
  386. reject(promise, reason);
  387. });
  388. } catch (e) {
  389. reject(promise, e);
  390. }
  391. }
  392. var id = 0;
  393. function nextId() {
  394. return id++;
  395. }
  396. function makePromise(promise) {
  397. promise[PROMISE_ID] = id++;
  398. promise._state = undefined;
  399. promise._result = undefined;
  400. promise._subscribers = [];
  401. }
  402. function validationError() {
  403. return new Error('Array Methods must be provided an Array');
  404. }
  405. var Enumerator = function () {
  406. function Enumerator(Constructor, input) {
  407. this._instanceConstructor = Constructor;
  408. this.promise = new Constructor(noop);
  409. if (!this.promise[PROMISE_ID]) {
  410. makePromise(this.promise);
  411. }
  412. if (isArray(input)) {
  413. this.length = input.length;
  414. this._remaining = input.length;
  415. this._result = new Array(this.length);
  416. if (this.length === 0) {
  417. fulfill(this.promise, this._result);
  418. } else {
  419. this.length = this.length || 0;
  420. this._enumerate(input);
  421. if (this._remaining === 0) {
  422. fulfill(this.promise, this._result);
  423. }
  424. }
  425. } else {
  426. reject(this.promise, validationError());
  427. }
  428. }
  429. Enumerator.prototype._enumerate = function _enumerate(input) {
  430. for (var i = 0; this._state === PENDING && i < input.length; i++) {
  431. this._eachEntry(input[i], i);
  432. }
  433. };
  434. Enumerator.prototype._eachEntry = function _eachEntry(entry, i) {
  435. var c = this._instanceConstructor;
  436. var resolve$$1 = c.resolve;
  437. if (resolve$$1 === resolve$1) {
  438. var _then = getThen(entry);
  439. if (_then === then && entry._state !== PENDING) {
  440. this._settledAt(entry._state, i, entry._result);
  441. } else if (typeof _then !== 'function') {
  442. this._remaining--;
  443. this._result[i] = entry;
  444. } else if (c === Promise$1) {
  445. var promise = new c(noop);
  446. handleMaybeThenable(promise, entry, _then);
  447. this._willSettleAt(promise, i);
  448. } else {
  449. this._willSettleAt(new c(function (resolve$$1) {
  450. return resolve$$1(entry);
  451. }), i);
  452. }
  453. } else {
  454. this._willSettleAt(resolve$$1(entry), i);
  455. }
  456. };
  457. Enumerator.prototype._settledAt = function _settledAt(state, i, value) {
  458. var promise = this.promise;
  459. if (promise._state === PENDING) {
  460. this._remaining--;
  461. if (state === REJECTED) {
  462. reject(promise, value);
  463. } else {
  464. this._result[i] = value;
  465. }
  466. }
  467. if (this._remaining === 0) {
  468. fulfill(promise, this._result);
  469. }
  470. };
  471. Enumerator.prototype._willSettleAt = function _willSettleAt(promise, i) {
  472. var enumerator = this;
  473. subscribe(promise, undefined, function (value) {
  474. return enumerator._settledAt(FULFILLED, i, value);
  475. }, function (reason) {
  476. return enumerator._settledAt(REJECTED, i, reason);
  477. });
  478. };
  479. return Enumerator;
  480. }();
  481. /**
  482. `Promise.all` accepts an array of promises, and returns a new promise which
  483. is fulfilled with an array of fulfillment values for the passed promises, or
  484. rejected with the reason of the first passed promise to be rejected. It casts all
  485. elements of the passed iterable to promises as it runs this algorithm.
  486. Example:
  487. ```javascript
  488. let promise1 = resolve(1);
  489. let promise2 = resolve(2);
  490. let promise3 = resolve(3);
  491. let promises = [ promise1, promise2, promise3 ];
  492. Promise.all(promises).then(function(array){
  493. // The array here would be [ 1, 2, 3 ];
  494. });
  495. ```
  496. If any of the `promises` given to `all` are rejected, the first promise
  497. that is rejected will be given as an argument to the returned promises's
  498. rejection handler. For example:
  499. Example:
  500. ```javascript
  501. let promise1 = resolve(1);
  502. let promise2 = reject(new Error("2"));
  503. let promise3 = reject(new Error("3"));
  504. let promises = [ promise1, promise2, promise3 ];
  505. Promise.all(promises).then(function(array){
  506. // Code here never runs because there are rejected promises!
  507. }, function(error) {
  508. // error.message === "2"
  509. });
  510. ```
  511. @method all
  512. @static
  513. @param {Array} entries array of promises
  514. @param {String} label optional string for labeling the promise.
  515. Useful for tooling.
  516. @return {Promise} promise that is fulfilled when all `promises` have been
  517. fulfilled, or rejected if any of them become rejected.
  518. @static
  519. */
  520. function all(entries) {
  521. return new Enumerator(this, entries).promise;
  522. }
  523. /**
  524. `Promise.race` returns a new promise which is settled in the same way as the
  525. first passed promise to settle.
  526. Example:
  527. ```javascript
  528. let promise1 = new Promise(function(resolve, reject){
  529. setTimeout(function(){
  530. resolve('promise 1');
  531. }, 200);
  532. });
  533. let promise2 = new Promise(function(resolve, reject){
  534. setTimeout(function(){
  535. resolve('promise 2');
  536. }, 100);
  537. });
  538. Promise.race([promise1, promise2]).then(function(result){
  539. // result === 'promise 2' because it was resolved before promise1
  540. // was resolved.
  541. });
  542. ```
  543. `Promise.race` is deterministic in that only the state of the first
  544. settled promise matters. For example, even if other promises given to the
  545. `promises` array argument are resolved, but the first settled promise has
  546. become rejected before the other promises became fulfilled, the returned
  547. promise will become rejected:
  548. ```javascript
  549. let promise1 = new Promise(function(resolve, reject){
  550. setTimeout(function(){
  551. resolve('promise 1');
  552. }, 200);
  553. });
  554. let promise2 = new Promise(function(resolve, reject){
  555. setTimeout(function(){
  556. reject(new Error('promise 2'));
  557. }, 100);
  558. });
  559. Promise.race([promise1, promise2]).then(function(result){
  560. // Code here never runs
  561. }, function(reason){
  562. // reason.message === 'promise 2' because promise 2 became rejected before
  563. // promise 1 became fulfilled
  564. });
  565. ```
  566. An example real-world use case is implementing timeouts:
  567. ```javascript
  568. Promise.race([ajax('foo.json'), timeout(5000)])
  569. ```
  570. @method race
  571. @static
  572. @param {Array} promises array of promises to observe
  573. Useful for tooling.
  574. @return {Promise} a promise which settles in the same way as the first passed
  575. promise to settle.
  576. */
  577. function race(entries) {
  578. /*jshint validthis:true */
  579. var Constructor = this;
  580. if (!isArray(entries)) {
  581. return new Constructor(function (_, reject) {
  582. return reject(new TypeError('You must pass an array to race.'));
  583. });
  584. } else {
  585. return new Constructor(function (resolve, reject) {
  586. var length = entries.length;
  587. for (var i = 0; i < length; i++) {
  588. Constructor.resolve(entries[i]).then(resolve, reject);
  589. }
  590. });
  591. }
  592. }
  593. /**
  594. `Promise.reject` returns a promise rejected with the passed `reason`.
  595. It is shorthand for the following:
  596. ```javascript
  597. let promise = new Promise(function(resolve, reject){
  598. reject(new Error('WHOOPS'));
  599. });
  600. promise.then(function(value){
  601. // Code here doesn't run because the promise is rejected!
  602. }, function(reason){
  603. // reason.message === 'WHOOPS'
  604. });
  605. ```
  606. Instead of writing the above, your code now simply becomes the following:
  607. ```javascript
  608. let promise = Promise.reject(new Error('WHOOPS'));
  609. promise.then(function(value){
  610. // Code here doesn't run because the promise is rejected!
  611. }, function(reason){
  612. // reason.message === 'WHOOPS'
  613. });
  614. ```
  615. @method reject
  616. @static
  617. @param {Any} reason value that the returned promise will be rejected with.
  618. Useful for tooling.
  619. @return {Promise} a promise rejected with the given `reason`.
  620. */
  621. function reject$1(reason) {
  622. /*jshint validthis:true */
  623. var Constructor = this;
  624. var promise = new Constructor(noop);
  625. reject(promise, reason);
  626. return promise;
  627. }
  628. function needsResolver() {
  629. throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
  630. }
  631. function needsNew() {
  632. throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
  633. }
  634. /**
  635. Promise objects represent the eventual result of an asynchronous operation. The
  636. primary way of interacting with a promise is through its `then` method, which
  637. registers callbacks to receive either a promise's eventual value or the reason
  638. why the promise cannot be fulfilled.
  639. Terminology
  640. -----------
  641. - `promise` is an object or function with a `then` method whose behavior conforms to this specification.
  642. - `thenable` is an object or function that defines a `then` method.
  643. - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).
  644. - `exception` is a value that is thrown using the throw statement.
  645. - `reason` is a value that indicates why a promise was rejected.
  646. - `settled` the final resting state of a promise, fulfilled or rejected.
  647. A promise can be in one of three states: pending, fulfilled, or rejected.
  648. Promises that are fulfilled have a fulfillment value and are in the fulfilled
  649. state. Promises that are rejected have a rejection reason and are in the
  650. rejected state. A fulfillment value is never a thenable.
  651. Promises can also be said to *resolve* a value. If this value is also a
  652. promise, then the original promise's settled state will match the value's
  653. settled state. So a promise that *resolves* a promise that rejects will
  654. itself reject, and a promise that *resolves* a promise that fulfills will
  655. itself fulfill.
  656. Basic Usage:
  657. ------------
  658. ```js
  659. let promise = new Promise(function(resolve, reject) {
  660. // on success
  661. resolve(value);
  662. // on failure
  663. reject(reason);
  664. });
  665. promise.then(function(value) {
  666. // on fulfillment
  667. }, function(reason) {
  668. // on rejection
  669. });
  670. ```
  671. Advanced Usage:
  672. ---------------
  673. Promises shine when abstracting away asynchronous interactions such as
  674. `XMLHttpRequest`s.
  675. ```js
  676. function getJSON(url) {
  677. return new Promise(function(resolve, reject){
  678. let xhr = new XMLHttpRequest();
  679. xhr.open('GET', url);
  680. xhr.onreadystatechange = handler;
  681. xhr.responseType = 'json';
  682. xhr.setRequestHeader('Accept', 'application/json');
  683. xhr.send();
  684. function handler() {
  685. if (this.readyState === this.DONE) {
  686. if (this.status === 200) {
  687. resolve(this.response);
  688. } else {
  689. reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));
  690. }
  691. }
  692. };
  693. });
  694. }
  695. getJSON('/posts.json').then(function(json) {
  696. // on fulfillment
  697. }, function(reason) {
  698. // on rejection
  699. });
  700. ```
  701. Unlike callbacks, promises are great composable primitives.
  702. ```js
  703. Promise.all([
  704. getJSON('/posts'),
  705. getJSON('/comments')
  706. ]).then(function(values){
  707. values[0] // => postsJSON
  708. values[1] // => commentsJSON
  709. return values;
  710. });
  711. ```
  712. @class Promise
  713. @param {Function} resolver
  714. Useful for tooling.
  715. @constructor
  716. */
  717. var Promise$1 = function () {
  718. function Promise(resolver) {
  719. this[PROMISE_ID] = nextId();
  720. this._result = this._state = undefined;
  721. this._subscribers = [];
  722. if (noop !== resolver) {
  723. typeof resolver !== 'function' && needsResolver();
  724. this instanceof Promise ? initializePromise(this, resolver) : needsNew();
  725. }
  726. }
  727. /**
  728. The primary way of interacting with a promise is through its `then` method,
  729. which registers callbacks to receive either a promise's eventual value or the
  730. reason why the promise cannot be fulfilled.
  731. ```js
  732. findUser().then(function(user){
  733. // user is available
  734. }, function(reason){
  735. // user is unavailable, and you are given the reason why
  736. });
  737. ```
  738. Chaining
  739. --------
  740. The return value of `then` is itself a promise. This second, 'downstream'
  741. promise is resolved with the return value of the first promise's fulfillment
  742. or rejection handler, or rejected if the handler throws an exception.
  743. ```js
  744. findUser().then(function (user) {
  745. return user.name;
  746. }, function (reason) {
  747. return 'default name';
  748. }).then(function (userName) {
  749. // If `findUser` fulfilled, `userName` will be the user's name, otherwise it
  750. // will be `'default name'`
  751. });
  752. findUser().then(function (user) {
  753. throw new Error('Found user, but still unhappy');
  754. }, function (reason) {
  755. throw new Error('`findUser` rejected and we're unhappy');
  756. }).then(function (value) {
  757. // never reached
  758. }, function (reason) {
  759. // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
  760. // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.
  761. });
  762. ```
  763. If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
  764. ```js
  765. findUser().then(function (user) {
  766. throw new PedagogicalException('Upstream error');
  767. }).then(function (value) {
  768. // never reached
  769. }).then(function (value) {
  770. // never reached
  771. }, function (reason) {
  772. // The `PedgagocialException` is propagated all the way down to here
  773. });
  774. ```
  775. Assimilation
  776. ------------
  777. Sometimes the value you want to propagate to a downstream promise can only be
  778. retrieved asynchronously. This can be achieved by returning a promise in the
  779. fulfillment or rejection handler. The downstream promise will then be pending
  780. until the returned promise is settled. This is called *assimilation*.
  781. ```js
  782. findUser().then(function (user) {
  783. return findCommentsByAuthor(user);
  784. }).then(function (comments) {
  785. // The user's comments are now available
  786. });
  787. ```
  788. If the assimliated promise rejects, then the downstream promise will also reject.
  789. ```js
  790. findUser().then(function (user) {
  791. return findCommentsByAuthor(user);
  792. }).then(function (comments) {
  793. // If `findCommentsByAuthor` fulfills, we'll have the value here
  794. }, function (reason) {
  795. // If `findCommentsByAuthor` rejects, we'll have the reason here
  796. });
  797. ```
  798. Simple Example
  799. --------------
  800. Synchronous Example
  801. ```javascript
  802. let result;
  803. try {
  804. result = findResult();
  805. // success
  806. } catch(reason) {
  807. // failure
  808. }
  809. ```
  810. Errback Example
  811. ```js
  812. findResult(function(result, err){
  813. if (err) {
  814. // failure
  815. } else {
  816. // success
  817. }
  818. });
  819. ```
  820. Promise Example;
  821. ```javascript
  822. findResult().then(function(result){
  823. // success
  824. }, function(reason){
  825. // failure
  826. });
  827. ```
  828. Advanced Example
  829. --------------
  830. Synchronous Example
  831. ```javascript
  832. let author, books;
  833. try {
  834. author = findAuthor();
  835. books = findBooksByAuthor(author);
  836. // success
  837. } catch(reason) {
  838. // failure
  839. }
  840. ```
  841. Errback Example
  842. ```js
  843. function foundBooks(books) {
  844. }
  845. function failure(reason) {
  846. }
  847. findAuthor(function(author, err){
  848. if (err) {
  849. failure(err);
  850. // failure
  851. } else {
  852. try {
  853. findBoooksByAuthor(author, function(books, err) {
  854. if (err) {
  855. failure(err);
  856. } else {
  857. try {
  858. foundBooks(books);
  859. } catch(reason) {
  860. failure(reason);
  861. }
  862. }
  863. });
  864. } catch(error) {
  865. failure(err);
  866. }
  867. // success
  868. }
  869. });
  870. ```
  871. Promise Example;
  872. ```javascript
  873. findAuthor().
  874. then(findBooksByAuthor).
  875. then(function(books){
  876. // found books
  877. }).catch(function(reason){
  878. // something went wrong
  879. });
  880. ```
  881. @method then
  882. @param {Function} onFulfilled
  883. @param {Function} onRejected
  884. Useful for tooling.
  885. @return {Promise}
  886. */
  887. /**
  888. `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
  889. as the catch block of a try/catch statement.
  890. ```js
  891. function findAuthor(){
  892. throw new Error('couldn't find that author');
  893. }
  894. // synchronous
  895. try {
  896. findAuthor();
  897. } catch(reason) {
  898. // something went wrong
  899. }
  900. // async with promises
  901. findAuthor().catch(function(reason){
  902. // something went wrong
  903. });
  904. ```
  905. @method catch
  906. @param {Function} onRejection
  907. Useful for tooling.
  908. @return {Promise}
  909. */
  910. Promise.prototype.catch = function _catch(onRejection) {
  911. return this.then(null, onRejection);
  912. };
  913. /**
  914. `finally` will be invoked regardless of the promise's fate just as native
  915. try/catch/finally behaves
  916. Synchronous example:
  917. ```js
  918. findAuthor() {
  919. if (Math.random() > 0.5) {
  920. throw new Error();
  921. }
  922. return new Author();
  923. }
  924. try {
  925. return findAuthor(); // succeed or fail
  926. } catch(error) {
  927. return findOtherAuther();
  928. } finally {
  929. // always runs
  930. // doesn't affect the return value
  931. }
  932. ```
  933. Asynchronous example:
  934. ```js
  935. findAuthor().catch(function(reason){
  936. return findOtherAuther();
  937. }).finally(function(){
  938. // author was either found, or not
  939. });
  940. ```
  941. @method finally
  942. @param {Function} callback
  943. @return {Promise}
  944. */
  945. Promise.prototype.finally = function _finally(callback) {
  946. var promise = this;
  947. var constructor = promise.constructor;
  948. if (isFunction(callback)) {
  949. return promise.then(function (value) {
  950. return constructor.resolve(callback()).then(function () {
  951. return value;
  952. });
  953. }, function (reason) {
  954. return constructor.resolve(callback()).then(function () {
  955. throw reason;
  956. });
  957. });
  958. }
  959. return promise.then(callback, callback);
  960. };
  961. return Promise;
  962. }();
  963. Promise$1.prototype.then = then;
  964. Promise$1.all = all;
  965. Promise$1.race = race;
  966. Promise$1.resolve = resolve$1;
  967. Promise$1.reject = reject$1;
  968. Promise$1._setScheduler = setScheduler;
  969. Promise$1._setAsap = setAsap;
  970. Promise$1._asap = asap;
  971. /*global self*/
  972. function polyfill() {
  973. var local = void 0;
  974. if (typeof global !== 'undefined') {
  975. local = global;
  976. } else if (typeof self !== 'undefined') {
  977. local = self;
  978. } else {
  979. try {
  980. local = Function('return this')();
  981. } catch (e) {
  982. throw new Error('polyfill failed because global object is unavailable in this environment');
  983. }
  984. }
  985. var P = local.Promise;
  986. if (P) {
  987. var promiseToString = null;
  988. try {
  989. promiseToString = Object.prototype.toString.call(P.resolve());
  990. } catch (e) {
  991. // silently ignored
  992. }
  993. if (promiseToString === '[object Promise]' && !P.cast) {
  994. return;
  995. }
  996. }
  997. local.Promise = Promise$1;
  998. }
  999. // Strange compat..
  1000. Promise$1.polyfill = polyfill;
  1001. Promise$1.Promise = Promise$1;
  1002. return Promise$1;
  1003. })));
  1004. //# sourceMappingURL=es6-promise.map
  1005. ;
  1006. //jshint eqnull:true
  1007. define('amber/kernel-checks',[],function () {
  1008. "use strict";
  1009. function assert (fn) {
  1010. try {
  1011. if (fn()) return;
  1012. } catch (ex) {
  1013. throw new Error("Error:\n" + ex + "in assertion:\n" + fn);
  1014. }
  1015. throw new Error("Assertion failed:\n" + fn);
  1016. }
  1017. assert(function () {
  1018. return !("hasOwnProperty" in Object.create(null));
  1019. });
  1020. assert(function () {
  1021. return Object.getPrototypeOf(Object.create(null)) === null;
  1022. });
  1023. assert(function () {
  1024. var p = {};
  1025. return Object.getPrototypeOf(Object.create(p)) === p;
  1026. });
  1027. // assert(function () {
  1028. // return new Function("return this")().Object === Object;
  1029. // });
  1030. // assert(function () {
  1031. // return Object.create(new Function("return this")()).Object === Object;
  1032. // });
  1033. assert(function () {
  1034. return typeof global !== "undefined";
  1035. });
  1036. assert(function () {
  1037. return global.Object === Object;
  1038. });
  1039. assert(function () {
  1040. return Object.create(global).Object === Object;
  1041. });
  1042. assert(function () {
  1043. return (function () {
  1044. return this;
  1045. }).apply(void 0) === void 0;
  1046. });
  1047. assert(function () {
  1048. return (function () {
  1049. return this;
  1050. }).apply(null) === null;
  1051. });
  1052. assert(function () {
  1053. return (function () {
  1054. return this;
  1055. }).apply(3) === 3;
  1056. });
  1057. assert(function () {
  1058. return (function () {
  1059. return this;
  1060. }).apply("foo") === "foo";
  1061. });
  1062. assert(function () {
  1063. return (function () {
  1064. return this;
  1065. }).apply(true) === true;
  1066. });
  1067. assert(function () {
  1068. var o = Object.freeze({});
  1069. try {
  1070. o.foo = "bar";
  1071. } catch (ex) {
  1072. }
  1073. return o.foo == null;
  1074. });
  1075. assert(function () {
  1076. return typeof Promise === "function";
  1077. });
  1078. assert(function () {
  1079. return typeof Promise.resolve === "function";
  1080. });
  1081. assert(function () {
  1082. return typeof Promise.reject === "function";
  1083. });
  1084. assert(function () {
  1085. return typeof new Promise(function () {
  1086. }).then === "function";
  1087. });
  1088. });
  1089. define('amber/brikz',[], function () {
  1090. return function Brikz(api, apiKey, initKey, backupKey) {
  1091. "use strict";
  1092. //jshint eqnull:true
  1093. var backup = {};
  1094. apiKey = apiKey || 'exports';
  1095. initKey = initKey || '__init__';
  1096. backupKey = backupKey || 'backup';
  1097. function mixin(src, target, what) {
  1098. for (var keys = Object.keys(what || src), l = keys.length, i = 0; i < l; ++i) {
  1099. if (src == null) {
  1100. target[keys[i]] = undefined;
  1101. } else {
  1102. var value = src[keys[i]];
  1103. if (typeof value !== "undefined") {
  1104. target[keys[i]] = value;
  1105. }
  1106. }
  1107. }
  1108. return target;
  1109. }
  1110. return function brikz() {
  1111. Object.keys(backup).forEach(function (key) {
  1112. mixin(null, api, (backup[key] || 0)[apiKey] || {});
  1113. });
  1114. var oapi = mixin(api, {}),
  1115. order = [],
  1116. chk = {};
  1117. function ensure(key) {
  1118. var b = brikz[key],
  1119. bak = backup[key];
  1120. while (typeof b === "function") {
  1121. (b.deps || []).forEach(ensure);
  1122. b[backupKey] = bak;
  1123. mixin(null, api, api);
  1124. b = new b(brikz, api);
  1125. }
  1126. brikz[key] = b;
  1127. if (b && !chk[key]) {
  1128. chk[key] = true;
  1129. order.push(b);
  1130. }
  1131. if (b && !b[apiKey]) {
  1132. b[apiKey] = mixin(api, {});
  1133. }
  1134. }
  1135. Object.keys(brikz).forEach(ensure);
  1136. mixin(oapi, mixin(null, api, api));
  1137. order.forEach(function (brik) {
  1138. mixin(brik[apiKey] || {}, api);
  1139. });
  1140. order.forEach(function (brik) {
  1141. if (brik[initKey]) {
  1142. brik[initKey]();
  1143. if (brik[initKey].once) {
  1144. delete brik[initKey];
  1145. }
  1146. }
  1147. });
  1148. backup = mixin(brikz, {});
  1149. };
  1150. };
  1151. });
  1152. //jshint eqnull:true
  1153. define('amber/kernel-fundamentals',[],function () {
  1154. "use strict";
  1155. function inherits (child, parent) {
  1156. child.prototype = Object.create(parent.prototype, {
  1157. constructor: {
  1158. value: child,
  1159. enumerable: false, configurable: true, writable: true
  1160. }
  1161. });
  1162. return child;
  1163. }
  1164. function SmalltalkGlobalsBrik (brikz, st) {
  1165. var globals = Object.create(global);
  1166. globals.SmalltalkSettings = {};
  1167. this.globals = globals;
  1168. }
  1169. function EventBrik (brikz, st) {
  1170. var emit = {};
  1171. this.emit = emit;
  1172. this.declareEvent = function (event) {
  1173. if (!emit[event]) emit[event] = function () {
  1174. };
  1175. }
  1176. }
  1177. function RootBrik (brikz, st) {
  1178. /* Smalltalk foundational objects */
  1179. var coreFns = this.coreFns = {};
  1180. /* SmalltalkRoot is the hidden root of the normal Amber hierarchy.
  1181. All objects including `ProtoObject` inherit from SmalltalkRoot.
  1182. Detached roots (eg. wrapped JS classes like Number or Date)
  1183. do not directly inherit from SmalltalkRoot, but employ a workaround.*/
  1184. function SmalltalkRoot () {
  1185. }
  1186. function SmalltalkProtoObject () {
  1187. }
  1188. function SmalltalkObject () {
  1189. }
  1190. coreFns.ProtoObject = inherits(SmalltalkProtoObject, SmalltalkRoot);
  1191. coreFns.Object = inherits(SmalltalkObject, SmalltalkProtoObject);
  1192. this.Root = SmalltalkRoot;
  1193. this.Object = SmalltalkObject;
  1194. }
  1195. function SelectorsBrik (brikz, st) {
  1196. var selectorSet = Object.create(null);
  1197. var selectors = this.selectors = [];
  1198. this.registerSelector = function (stSelector) {
  1199. if (selectorSet[stSelector]) return false;
  1200. selectors.push(stSelector);
  1201. return selectorSet[stSelector] = true;
  1202. };
  1203. st.allSelectors = function () {
  1204. return selectors;
  1205. };
  1206. }
  1207. function PackagesBrik (brikz, st) {
  1208. st.packageDescriptors = {};
  1209. /* Add a package load descriptor to the system */
  1210. st.addPackage = function (name, properties) {
  1211. if (!name) return null;
  1212. return st.packageDescriptors[name] = {properties: properties};
  1213. };
  1214. }
  1215. BehaviorsBrik.deps = ["root", "smalltalkGlobals", "arraySet"];
  1216. function BehaviorsBrik (brikz, st) {
  1217. var globals = brikz.smalltalkGlobals.globals;
  1218. var addElement = brikz.arraySet.addElement;
  1219. var removeElement = brikz.arraySet.removeElement;
  1220. /* Smalltalk classes and traits */
  1221. var traitsOrClasses = [];
  1222. this.buildTraitOrClass = function (category, builder) {
  1223. var traitOrClass = globals.hasOwnProperty(builder.name) && globals[builder.name];
  1224. if (traitOrClass) {
  1225. builder.updateExisting(traitOrClass);
  1226. } else {
  1227. traitOrClass = builder.make();
  1228. traitOrClass.category = category;
  1229. addTraitOrClass(traitOrClass);
  1230. }
  1231. return traitOrClass;
  1232. };
  1233. function addTraitOrClass (traitOrClass) {
  1234. globals[traitOrClass.name] = traitOrClass;
  1235. addElement(traitsOrClasses, traitOrClass);
  1236. traitOrClass.added();
  1237. }
  1238. function removeTraitOrClass (traitOrClass) {
  1239. traitOrClass.removed();
  1240. removeElement(traitsOrClasses, traitOrClass);
  1241. delete globals[traitOrClass.name];
  1242. }
  1243. this.removeTraitOrClass = removeTraitOrClass;
  1244. st.traitsOrClasses = this.traitsOrClasses = traitsOrClasses;
  1245. }
  1246. MethodsBrik.deps = ["event", "selectors", "root"];
  1247. function MethodsBrik (brikz, st) {
  1248. var registerSelector = brikz.selectors.registerSelector;
  1249. var SmalltalkObject = brikz.root.Object;
  1250. var coreFns = brikz.root.coreFns;
  1251. var emit = brikz.event.emit;
  1252. var declareEvent = brikz.event.declareEvent;
  1253. function SmalltalkMethod () {
  1254. }
  1255. coreFns.CompiledMethod = inherits(SmalltalkMethod, SmalltalkObject);
  1256. /* Smalltalk method object. To add a method to a class,
  1257. use api.addMethod() */
  1258. st.method = function (spec) {
  1259. var that = new SmalltalkMethod();
  1260. that.selector = spec.selector;
  1261. that.args = spec.args || [];
  1262. that.protocol = spec.protocol;
  1263. that.source = spec.source;
  1264. that.pragmas = spec.pragmas;
  1265. that.messageSends = spec.messageSends || [];
  1266. // TODO remove .referencedClasses, have .referencedGlobals
  1267. that.referencedClasses = spec.referencedClasses || [];
  1268. that.fn = spec.fn;
  1269. return that;
  1270. };
  1271. /* Add/remove a method to/from a class */
  1272. st.addMethod = function (method, traitOrBehavior) {
  1273. if (method.owner != null) {
  1274. throw new Error("addMethod: Method " + method.selector + " already bound to " + method.owner);
  1275. }
  1276. method.owner = traitOrBehavior;
  1277. registerNewSelectors(method);
  1278. traitOrBehavior.localMethods[method.selector] = method;
  1279. updateMethod(method.selector, traitOrBehavior);
  1280. };
  1281. declareEvent("selectorsAdded");
  1282. function registerNewSelectors (method) {
  1283. var newSelectors = [];
  1284. function selectorInUse (stSelector) {
  1285. if (registerSelector(stSelector)) {
  1286. newSelectors.push(stSelector);
  1287. }
  1288. }
  1289. selectorInUse(method.selector);
  1290. method.messageSends.forEach(selectorInUse);
  1291. emit.selectorsAdded(newSelectors);
  1292. }
  1293. st.removeMethod = function (method, traitOrBehavior) {
  1294. if (traitOrBehavior.localMethods[method.selector] !== method) return;
  1295. delete traitOrBehavior.localMethods[method.selector];
  1296. updateMethod(method.selector, traitOrBehavior);
  1297. };
  1298. this.setupMethods = function (traitOrBehavior) {
  1299. traitOrBehavior.localMethods = Object.create(null);
  1300. traitOrBehavior.methods = Object.create(null);
  1301. };
  1302. declareEvent("methodReplaced");
  1303. function updateMethod (selector, traitOrBehavior) {
  1304. var oldMethod = traitOrBehavior.methods[selector],
  1305. newMethod = traitOrBehavior.localMethods[selector];
  1306. if (oldMethod == null && newMethod == null) {
  1307. console.warn("Removal of nonexistent method " + traitOrBehavior + " >> " + selector);
  1308. return;
  1309. }
  1310. if (newMethod === oldMethod) return;
  1311. if (newMethod != null) {
  1312. if (newMethod.methodClass && newMethod.methodClass !== traitOrBehavior) {
  1313. console.warn("Resetting methodClass of " + newMethod.methodClass.name + " >> " + selector + " to " + traitOrBehavior.name);
  1314. }
  1315. newMethod.methodClass = traitOrBehavior;
  1316. traitOrBehavior.methods[selector] = newMethod;
  1317. traitOrBehavior.methodAdded(newMethod);
  1318. } else {
  1319. delete traitOrBehavior.methods[selector];
  1320. traitOrBehavior.methodRemoved(oldMethod);
  1321. }
  1322. emit.methodReplaced(newMethod, oldMethod, traitOrBehavior);
  1323. }
  1324. this.updateMethod = updateMethod;
  1325. }
  1326. function ArraySetBrik (brikz, st) {
  1327. st.addElement = this.addElement = function (array, el) {
  1328. if (typeof el === 'undefined') {
  1329. return;
  1330. }
  1331. if (array.indexOf(el) === -1) {
  1332. array.push(el);
  1333. }
  1334. };
  1335. st.removeElement = this.removeElement = function (array, el) {
  1336. var i = array.indexOf(el);
  1337. if (i !== -1) {
  1338. array.splice(i, 1);
  1339. }
  1340. };
  1341. }
  1342. NilBrik.deps = ["root"];
  1343. function NilBrik (brikz, st) {
  1344. var SmalltalkObject = brikz.root.Object;
  1345. var coreFns = brikz.root.coreFns;
  1346. function SmalltalkNil () {
  1347. }
  1348. coreFns.UndefinedObject = inherits(SmalltalkNil, SmalltalkObject);
  1349. this.nilAsReceiver = new SmalltalkNil();
  1350. this.nilAsValue = this.nilAsReceiver; // TODO null
  1351. // Adds an `a$nil` property to the `nil` object. When sending
  1352. // nil objects from one environment to another, doing
  1353. // `anObject == nil` (in JavaScript) does not always answer
  1354. // true as the referenced nil object might come from the other
  1355. // environment.
  1356. Object.defineProperty(this.nilAsReceiver, 'a$nil', {
  1357. value: true,
  1358. enumerable: false, configurable: false, writable: false
  1359. });
  1360. }
  1361. /* Making smalltalk that has basic building blocks */
  1362. function configureWithFundamentals (brikz) {
  1363. brikz.smalltalkGlobals = SmalltalkGlobalsBrik;
  1364. brikz.root = RootBrik;
  1365. brikz.nil = NilBrik;
  1366. brikz.event = EventBrik;
  1367. brikz.arraySet = ArraySetBrik;
  1368. brikz.selectors = SelectorsBrik;
  1369. brikz.packages = PackagesBrik;
  1370. brikz.behaviors = BehaviorsBrik;
  1371. brikz.methods = MethodsBrik;
  1372. brikz();
  1373. }
  1374. return configureWithFundamentals;
  1375. });
  1376. //jshint eqnull:true
  1377. define('amber/kernel-language',[],function () {
  1378. "use strict";
  1379. function inherits (child, parent) {
  1380. child.prototype = Object.create(parent.prototype, {
  1381. constructor: {
  1382. value: child,
  1383. enumerable: false, configurable: true, writable: true
  1384. }
  1385. });
  1386. return child;
  1387. }
  1388. function defineMethod (klass, name, method) {
  1389. Object.defineProperty(klass.prototype, name, {
  1390. value: method,
  1391. enumerable: false, configurable: true, writable: true
  1392. });
  1393. }
  1394. TraitsBrik.deps = ["event", "behaviors", "methods", "composition", "root"];
  1395. function TraitsBrik (brikz, st) {
  1396. var coreFns = brikz.root.coreFns;
  1397. var SmalltalkObject = brikz.root.Object;
  1398. var setupMethods = brikz.methods.setupMethods;
  1399. var traitMethodChanged = brikz.composition.traitMethodChanged;
  1400. var buildTraitOrClass = brikz.behaviors.buildTraitOrClass;
  1401. var emit = brikz.event.emit;
  1402. var declareEvent = brikz.event.declareEvent;
  1403. function SmalltalkTrait () {
  1404. }
  1405. coreFns.Trait = inherits(SmalltalkTrait, SmalltalkObject);
  1406. SmalltalkTrait.prototype.trait = true;
  1407. defineMethod(SmalltalkTrait, "toString", function () {
  1408. return 'Smalltalk Trait ' + this.name;
  1409. });
  1410. declareEvent("traitAdded");
  1411. defineMethod(SmalltalkTrait, "added", function () {
  1412. emit.traitAdded(this);
  1413. });
  1414. declareEvent("traitRemoved");
  1415. defineMethod(SmalltalkTrait, "removed", function () {
  1416. emit.traitRemoved(this);
  1417. });
  1418. declareEvent("traitMethodAdded");
  1419. defineMethod(SmalltalkTrait, "methodAdded", function (method) {
  1420. var self = this;
  1421. this.traitUsers.forEach(function (each) {
  1422. traitMethodChanged(method.selector, method, self, each);
  1423. });
  1424. emit.traitMethodAdded(method, this);
  1425. });
  1426. declareEvent("traitMethodRemoved");
  1427. defineMethod(SmalltalkTrait, "methodRemoved", function (method) {
  1428. var self = this;
  1429. this.traitUsers.forEach(function (each) {
  1430. traitMethodChanged(method.selector, null, self, each);
  1431. });
  1432. emit.traitMethodRemoved(method, this);
  1433. });
  1434. function traitBuilder (traitName) {
  1435. return {
  1436. name: traitName,
  1437. make: function () {
  1438. var that = new SmalltalkTrait();
  1439. that.name = traitName;
  1440. that.traitUsers = [];
  1441. setupMethods(that);
  1442. return that;
  1443. },
  1444. updateExisting: function (trait) {
  1445. }
  1446. };
  1447. }
  1448. st.addTrait = function (className, category) {
  1449. return buildTraitOrClass(category, traitBuilder(className));
  1450. };
  1451. }
  1452. MethodCompositionBrik.deps = ["methods", "arraySet"];
  1453. function MethodCompositionBrik (brikz, st) {
  1454. var updateMethod = brikz.methods.updateMethod;
  1455. var addElement = brikz.arraySet.addElement;
  1456. var removeElement = brikz.arraySet.removeElement;
  1457. function aliased (selector, method) {
  1458. var result = st.method(method);
  1459. if (method.selector !== selector) {
  1460. result.selector = selector;
  1461. result.source = '"Aliased as ' + selector + '"\n' + method.source;
  1462. }
  1463. result.owner = method.owner;
  1464. return result;
  1465. }
  1466. function deleteKeysFrom (keys, obj) {
  1467. keys.forEach(function (each) {
  1468. delete obj[each];
  1469. });
  1470. }
  1471. function fillTraitTransformation (traitTransformation, obj) {
  1472. // assert(Object.getOwnProperties(obj).length === 0)
  1473. var traitMethods = traitTransformation.trait.methods;
  1474. Object.keys(traitMethods).forEach(function (selector) {
  1475. obj[selector] = aliased(selector, traitMethods[selector]);
  1476. });
  1477. var traitAliases = traitTransformation.aliases;
  1478. if (traitAliases) {
  1479. Object.keys(traitAliases).forEach(function (aliasSelector) {
  1480. var aliasedMethod = traitMethods[traitAliases[aliasSelector]];
  1481. if (aliasedMethod) obj[aliasSelector] = aliased(aliasSelector, aliasedMethod);
  1482. // else delete obj[aliasSelector]; // semantically correct; optimized away
  1483. });
  1484. }
  1485. var traitExclusions = traitTransformation.exclusions;
  1486. if (traitExclusions) {
  1487. deleteKeysFrom(traitExclusions, obj);
  1488. }
  1489. return obj;
  1490. }
  1491. function buildCompositionChain (traitComposition) {
  1492. return traitComposition.reduce(function (soFar, each) {
  1493. return fillTraitTransformation(each, Object.create(soFar));
  1494. }, null);
  1495. }
  1496. st.setTraitComposition = function (traitComposition, traitOrBehavior) {
  1497. var oldLocalMethods = traitOrBehavior.localMethods,
  1498. newLocalMethods = Object.create(buildCompositionChain(traitComposition));
  1499. Object.keys(oldLocalMethods).forEach(function (selector) {
  1500. newLocalMethods[selector] = oldLocalMethods[selector];
  1501. });
  1502. var selector;
  1503. traitOrBehavior.localMethods = newLocalMethods;
  1504. for (selector in newLocalMethods) {
  1505. updateMethod(selector, traitOrBehavior);
  1506. }
  1507. for (selector in oldLocalMethods) {
  1508. updateMethod(selector, traitOrBehavior);
  1509. }
  1510. (traitOrBehavior.traitComposition || []).forEach(function (each) {
  1511. removeElement(each.trait.traitUsers, traitOrBehavior);
  1512. });
  1513. traitOrBehavior.traitComposition = traitComposition && traitComposition.length ? traitComposition : null;
  1514. (traitOrBehavior.traitComposition || []).forEach(function (each) {
  1515. addElement(each.trait.traitUsers, traitOrBehavior);
  1516. });
  1517. };
  1518. function aliasesOfSelector (selector, traitAliases) {
  1519. if (!traitAliases) return [selector];
  1520. var result = Object.keys(traitAliases).filter(function (aliasSelector) {
  1521. return traitAliases[aliasSelector] === selector
  1522. });
  1523. if (!traitAliases[selector]) result.push(selector);
  1524. return result;
  1525. }
  1526. function applyTraitMethodAddition (selector, method, traitTransformation, obj) {
  1527. var changes = aliasesOfSelector(selector, traitTransformation.aliases);
  1528. changes.forEach(function (aliasSelector) {
  1529. obj[aliasSelector] = aliased(aliasSelector, method);
  1530. });
  1531. var traitExclusions = traitTransformation.exclusions;
  1532. if (traitExclusions) {
  1533. deleteKeysFrom(traitExclusions, obj);
  1534. }
  1535. return changes;
  1536. }
  1537. function applyTraitMethodDeletion (selector, traitTransformation, obj) {
  1538. var changes = aliasesOfSelector(selector, traitTransformation.aliases);
  1539. deleteKeysFrom(changes, obj);
  1540. return changes;
  1541. }
  1542. function traitMethodChanged (selector, method, trait, traitOrBehavior) {
  1543. var traitComposition = traitOrBehavior.traitComposition,
  1544. chain = traitOrBehavior.localMethods,
  1545. changes = [];
  1546. for (var i = traitComposition.length - 1; i >= 0; --i) {
  1547. chain = Object.getPrototypeOf(chain);
  1548. var traitTransformation = traitComposition[i];
  1549. if (traitTransformation.trait !== trait) continue;
  1550. changes.push.apply(changes, method ?
  1551. applyTraitMethodAddition(selector, method, traitTransformation, chain) :
  1552. applyTraitMethodDeletion(selector, traitTransformation, chain));
  1553. }
  1554. // assert(chain === null);
  1555. changes.forEach(function (each) {
  1556. updateMethod(each, traitOrBehavior);
  1557. });
  1558. }
  1559. this.traitMethodChanged = traitMethodChanged;
  1560. }
  1561. ClassesBrik.deps = ["root", "event", "behaviors", "methods", "arraySet", "smalltalkGlobals"];
  1562. function ClassesBrik (brikz, st) {
  1563. var SmalltalkRoot = brikz.root.Root;
  1564. var coreFns = brikz.root.coreFns;
  1565. var globals = brikz.smalltalkGlobals.globals;
  1566. var SmalltalkObject = brikz.root.Object;
  1567. var buildTraitOrClass = brikz.behaviors.buildTraitOrClass;
  1568. var setupMethods = brikz.methods.setupMethods;
  1569. var removeTraitOrClass = brikz.behaviors.removeTraitOrClass;
  1570. var addElement = brikz.arraySet.addElement;
  1571. var removeElement = brikz.arraySet.removeElement;
  1572. var emit = brikz.event.emit;
  1573. var declareEvent = brikz.event.declareEvent;
  1574. function SmalltalkBehavior () {
  1575. }
  1576. function SmalltalkClass () {
  1577. }
  1578. function SmalltalkMetaclass () {
  1579. }
  1580. coreFns.Behavior = inherits(SmalltalkBehavior, SmalltalkObject);
  1581. coreFns.Class = inherits(SmalltalkClass, SmalltalkBehavior);
  1582. coreFns.Metaclass = inherits(SmalltalkMetaclass, SmalltalkBehavior);
  1583. // Fake root class of the system.
  1584. // Effective superclass of all classes created with `nil subclass: ...`.
  1585. var nilAsClass = this.nilAsClass = {
  1586. fn: SmalltalkRoot,
  1587. a$cls: {fn: SmalltalkClass}
  1588. };
  1589. SmalltalkMetaclass.prototype.meta = true;
  1590. defineMethod(SmalltalkClass, "toString", function () {
  1591. return 'Smalltalk ' + this.name;
  1592. });
  1593. defineMethod(SmalltalkMetaclass, "toString", function () {
  1594. return 'Smalltalk Metaclass ' + this.instanceClass.name;
  1595. });
  1596. declareEvent("classAdded");
  1597. defineMethod(SmalltalkClass, "added", function () {
  1598. addSubclass(this);
  1599. emit.classAdded(this);
  1600. });
  1601. declareEvent("classRemoved");
  1602. defineMethod(SmalltalkClass, "removed", function () {
  1603. emit.classRemoved(this);
  1604. removeSubclass(this);
  1605. });
  1606. declareEvent("behaviorMethodAdded");
  1607. defineMethod(SmalltalkBehavior, "methodAdded", function (method) {
  1608. emit.behaviorMethodAdded(method, this);
  1609. });
  1610. declareEvent("behaviorMethodRemove");
  1611. defineMethod(SmalltalkBehavior, "methodRemoved", function (method) {
  1612. emit.behaviorMethodRemoved(method, this);
  1613. });
  1614. // TODO remove, ["@foo"] backward compatibility
  1615. function installIvarCompat (klass) {
  1616. var ivars = klass.slots;
  1617. ivars.forEach(function (ivar) {
  1618. Object.defineProperty(klass.fn.prototype, "@" + ivar, {
  1619. get: function () {
  1620. return this[ivar];
  1621. },
  1622. set: function (value) {
  1623. return this[ivar] = value;
  1624. },
  1625. enumerable: false,
  1626. configurable: true
  1627. });
  1628. });
  1629. }
  1630. this.installIvarCompat = installIvarCompat;
  1631. function setSlots (klass, slots) {
  1632. slots.forEach(function (name) {
  1633. if (!name.match(/^[a-zA-Z][a-zA-Z0-9]*$/))
  1634. throw new Error("Wrong identifier name: " + name);
  1635. });
  1636. klass.slots = slots;
  1637. installIvarCompat(klass);
  1638. }
  1639. st.setSlots = setSlots;
  1640. // TODO remove, .iVarNames backward compatibility
  1641. Object.defineProperty(SmalltalkBehavior.prototype, "iVarNames", {
  1642. enumerable: true,
  1643. configurable: true,
  1644. get: function () {
  1645. return this.slots;
  1646. },
  1647. set: function (instanceVariableNames) {
  1648. setSlots(this, instanceVariableNames);
  1649. }
  1650. });
  1651. this.bootstrapHierarchy = function () {
  1652. var nilSubclasses = [globals.ProtoObject];
  1653. nilAsClass.a$cls = globals.Class;
  1654. nilSubclasses.forEach(function (each) {
  1655. each.a$cls.superclass = globals.Class;
  1656. addSubclass(each.a$cls);
  1657. });
  1658. };
  1659. /* Smalltalk class creation. A class is an instance of an automatically
  1660. created metaclass object. Newly created classes (not their metaclass)
  1661. should be added to the system, see smalltalk.addClass().
  1662. Superclass linking is *not* handled here, see api.initialize() */
  1663. function classBuilder (className, superclass, fn) {
  1664. var logicalSuperclass = superclass;
  1665. if (superclass == null || superclass.a$nil) {
  1666. superclass = nilAsClass;
  1667. logicalSuperclass = null;
  1668. }
  1669. function klass () {
  1670. var that = metaclass().instanceClass;
  1671. that.superclass = logicalSuperclass;
  1672. that.fn = fn || inherits(function () {
  1673. }, superclass.fn);
  1674. that.slots = [];
  1675. that.name = className;
  1676. that.subclasses = [];
  1677. setupMethods(that);
  1678. return that;
  1679. }
  1680. function metaclass () {
  1681. var that = new SmalltalkMetaclass();
  1682. that.superclass = superclass.a$cls;
  1683. that.fn = inherits(function () {
  1684. }, that.superclass.fn);
  1685. that.slots = [];
  1686. that.instanceClass = new that.fn();
  1687. wireKlass(that);
  1688. setupMethods(that);
  1689. return that;
  1690. }
  1691. return {
  1692. name: className,
  1693. make: klass,
  1694. updateExisting: function (klass) {
  1695. if (klass.superclass != logicalSuperclass || fn && fn !== klass.fn)
  1696. throw new Error("Incompatible change of class: " + klass.name);
  1697. }
  1698. };
  1699. }
  1700. function wireKlass (klass) {
  1701. Object.defineProperty(klass.fn.prototype, "a$cls", {
  1702. value: klass,
  1703. enumerable: false, configurable: true, writable: true
  1704. });
  1705. }
  1706. this.wireKlass = wireKlass;
  1707. /* Add a class to the system, creating a new one if needed.
  1708. A Package is lazily created if one with given name does not exist. */
  1709. st.addClass = function (className, superclass, category) {
  1710. // TODO remove, backward compatibility
  1711. if (arguments[3]) {
  1712. var added = st.addClass(className, superclass, arguments[3]);
  1713. setSlots(added, category);
  1714. return added;
  1715. }
  1716. // While subclassing nil is allowed, it might be an error, so
  1717. // warn about it.
  1718. if (typeof superclass === 'undefined' || superclass && superclass.a$nil) {
  1719. console.warn('Compiling ' + className + ' as a subclass of `nil`. A dependency might be missing.');
  1720. }
  1721. return buildTraitOrClass(category, classBuilder(className, superclass, coreFns[className]));
  1722. };
  1723. st.removeClass = removeTraitOrClass;
  1724. function addSubclass (klass) {
  1725. if (klass.superclass) {
  1726. addElement(klass.superclass.subclasses, klass);
  1727. }
  1728. }
  1729. function removeSubclass (klass) {
  1730. if (klass.superclass) {
  1731. removeElement(klass.superclass.subclasses, klass);
  1732. }
  1733. }
  1734. function metaSubclasses (metaclass) {
  1735. return metaclass.instanceClass.subclasses
  1736. .filter(function (each) {
  1737. return !each.meta;
  1738. })
  1739. .map(function (each) {
  1740. return each.a$cls;
  1741. });
  1742. }
  1743. st.metaSubclasses = metaSubclasses;
  1744. st.traverseClassTree = function (klass, fn) {
  1745. var queue = [klass], sentinel = {};
  1746. for (var i = 0; i < queue.length; ++i) {
  1747. var item = queue[i];
  1748. if (fn(item, sentinel) === sentinel) continue;
  1749. var subclasses = item.meta ? metaSubclasses(item) : item.subclasses;
  1750. queue.push.apply(queue, subclasses);
  1751. }
  1752. };
  1753. }
  1754. /* Making smalltalk that can load */
  1755. function configureWithHierarchy (brikz) {
  1756. brikz.traits = TraitsBrik;
  1757. brikz.composition = MethodCompositionBrik;
  1758. brikz.classes = ClassesBrik;
  1759. brikz();
  1760. }
  1761. return configureWithHierarchy;
  1762. });
  1763. //jshint eqnull:true
  1764. define('amber/kernel-runtime',[],function () {
  1765. "use strict";
  1766. function defineMethod (klass, name, method) {
  1767. Object.defineProperty(klass.prototype, name, {
  1768. value: method,
  1769. enumerable: false, configurable: true, writable: true
  1770. });
  1771. }
  1772. function installJSMethod (obj, jsSelector, fn) {
  1773. Object.defineProperty(obj, jsSelector, {
  1774. value: fn,
  1775. enumerable: false, configurable: true, writable: true
  1776. });
  1777. }
  1778. RuntimeSelectorsBrik.deps = ["selectors", "selectorConversion", "smalltalkGlobals", "classes"];
  1779. function RuntimeSelectorsBrik (brikz, st) {
  1780. var selectors = brikz.selectors.selectors;
  1781. var globals = brikz.smalltalkGlobals.globals;
  1782. var nilAsClass = brikz.classes.nilAsClass;
  1783. var st2js = brikz.selectorConversion.st2js;
  1784. var jsSelectors = this.jsSelectors = [];
  1785. /* Method not implemented handlers */
  1786. function installNewSelectors (newSelectors, targetClasses) {
  1787. newSelectors.forEach(function (selector) {
  1788. var jsSelector = st2js(selector);
  1789. jsSelectors.push(jsSelector);
  1790. var fn = createDnuHandler(selector);
  1791. installJSMethod(nilAsClass.fn.prototype, jsSelector, fn);
  1792. targetClasses.forEach(function (target) {
  1793. installJSMethod(target.fn.prototype, jsSelector, fn);
  1794. });
  1795. });
  1796. }
  1797. this.installNewSelectors = installNewSelectors;
  1798. /* Dnu handler method */
  1799. function createDnuHandler (stSelector) {
  1800. return function () {
  1801. return globals.Message._selector_arguments_notUnderstoodBy_(
  1802. stSelector, [].slice.call(arguments), this
  1803. );
  1804. };
  1805. }
  1806. installNewSelectors(selectors, []);
  1807. }
  1808. RuntimeClassesBrik.deps = ["event", "smalltalkGlobals", "runtimeSelectors", "behaviors", "classes", "runtimeMethods"];
  1809. function RuntimeClassesBrik (brikz, st) {
  1810. var globals = brikz.smalltalkGlobals.globals;
  1811. var jsSelectors = brikz.runtimeSelectors.jsSelectors;
  1812. var installNewSelectors = brikz.runtimeSelectors.installNewSelectors;
  1813. var installMethod = brikz.runtimeMethods.installMethod;
  1814. var traitsOrClasses = brikz.behaviors.traitsOrClasses;
  1815. var wireKlass = brikz.classes.wireKlass;
  1816. var installIvarCompat = brikz.classes.installIvarCompat;
  1817. var emit = brikz.event.emit;
  1818. var detachedRootClasses = [];
  1819. function markClassDetachedRoot (klass) {
  1820. klass.detachedRoot = true;
  1821. detachedRootClasses = traitsOrClasses.filter(function (klass) {
  1822. return klass.detachedRoot;
  1823. });
  1824. }
  1825. emit.selectorsAdded = function (newSelectors) {
  1826. installNewSelectors(newSelectors, detachedRootClasses);
  1827. };
  1828. /* Initialize a class in its class hierarchy. Handle both classes and
  1829. metaclasses. */
  1830. function initClassAndMetaclass (klass) {
  1831. initClass(klass);
  1832. if (klass.a$cls && !klass.meta) {
  1833. initClass(klass.a$cls);
  1834. }
  1835. }
  1836. traitsOrClasses.forEach(function (traitOrClass) {
  1837. if (!traitOrClass.trait) initClassAndMetaclass(traitOrClass);
  1838. });
  1839. emit.classAdded = function (klass) {
  1840. initClassAndMetaclass(klass);
  1841. klass._enterOrganization();
  1842. };
  1843. emit.traitAdded = function (trait) {
  1844. trait._enterOrganization();
  1845. };
  1846. emit.classRemoved = function (klass) {
  1847. klass._leaveOrganization();
  1848. };
  1849. emit.traitRemoved = function (trait) {
  1850. trait._leaveOrganization();
  1851. };
  1852. function initClass (klass) {
  1853. wireKlass(klass);
  1854. if (klass.detachedRoot) {
  1855. copySuperclass(klass);
  1856. }
  1857. installMethods(klass);
  1858. }
  1859. function copySuperclass (klass) {
  1860. var myproto = klass.fn.prototype,
  1861. superproto = klass.superclass.fn.prototype;
  1862. jsSelectors.forEach(function (jsSelector) {
  1863. installJSMethod(myproto, jsSelector, superproto[jsSelector]);
  1864. });
  1865. }
  1866. function installMethods (klass) {
  1867. var methods = klass.methods;
  1868. Object.keys(methods).forEach(function (selector) {
  1869. installMethod(methods[selector], klass);
  1870. });
  1871. }
  1872. /* Create an alias for an existing class */
  1873. st.alias = function (traitOrClass, alias) {
  1874. globals[alias] = traitOrClass;
  1875. };
  1876. /* Manually set the constructor of an existing Smalltalk klass, making it a detached root class. */
  1877. st.setClassConstructor = this.setClassConstructor = function (klass, constructor) {
  1878. markClassDetachedRoot(klass);
  1879. klass.fn = constructor;
  1880. installIvarCompat(klass);
  1881. initClass(klass);
  1882. };
  1883. }
  1884. FrameBindingBrik.deps = ["smalltalkGlobals", "runtimeClasses"];
  1885. function FrameBindingBrik (brikz, st) {
  1886. var globals = brikz.smalltalkGlobals.globals;
  1887. var setClassConstructor = brikz.runtimeClasses.setClassConstructor;
  1888. setClassConstructor(globals.Number, Number);
  1889. setClassConstructor(globals.BlockClosure, Function);
  1890. setClassConstructor(globals.Boolean, Boolean);
  1891. setClassConstructor(globals.Date, Date);
  1892. setClassConstructor(globals.String, String);
  1893. setClassConstructor(globals.Array, Array);
  1894. setClassConstructor(globals.RegularExpression, RegExp);
  1895. setClassConstructor(globals.Error, Error);
  1896. setClassConstructor(globals.Promise, Promise);
  1897. this.__init__ = function () {
  1898. st.alias(globals.Array, "OrderedCollection");
  1899. st.alias(globals.Date, "Time");
  1900. }
  1901. }
  1902. RuntimeMethodsBrik.deps = ["event", "selectorConversion"];
  1903. function RuntimeMethodsBrik (brikz, st) {
  1904. var st2js = brikz.selectorConversion.st2js;
  1905. var emit = brikz.event.emit;
  1906. function installMethod (method, klass) {
  1907. var jsSelector = method.jsSelector;
  1908. if (!jsSelector) {
  1909. jsSelector = method.jsSelector = st2js(method.selector);
  1910. }
  1911. installJSMethod(klass.fn.prototype, jsSelector, method.fn);
  1912. }
  1913. this.installMethod = installMethod;
  1914. emit.behaviorMethodAdded = function (method, klass) {
  1915. installMethod(method, klass);
  1916. propagateMethodChange(klass, method, klass);
  1917. };
  1918. emit.behaviorMethodRemoved = function (method, klass) {
  1919. delete klass.fn.prototype[method.jsSelector];
  1920. propagateMethodChange(klass, method, null);
  1921. };
  1922. emit.methodReplaced = function (newMethod, oldMethod, traitOrBehavior) {
  1923. traitOrBehavior._methodOrganizationEnter_andLeave_(newMethod, oldMethod);
  1924. };
  1925. function propagateMethodChange (klass, method, exclude) {
  1926. var selector = method.selector;
  1927. var jsSelector = method.jsSelector;
  1928. st.traverseClassTree(klass, function (subclass, sentinel) {
  1929. if (subclass === exclude) return;
  1930. if (subclass.methods[selector]) return sentinel;
  1931. if (subclass.detachedRoot) {
  1932. installJSMethod(subclass.fn.prototype, jsSelector, subclass.superclass.fn.prototype[jsSelector]);
  1933. }
  1934. });
  1935. }
  1936. }
  1937. PrimitivesBrik.deps = ["smalltalkGlobals"];
  1938. function PrimitivesBrik (brikz, st) {
  1939. var globals = brikz.smalltalkGlobals.globals;
  1940. /* Converts a JavaScript object to valid Smalltalk Object */
  1941. st.readJSObject = function (js) {
  1942. if (js == null) return null;
  1943. else if (Array.isArray(js)) return js.map(st.readJSObject);
  1944. else if (js.constructor !== Object) return js;
  1945. var pairs = [];
  1946. for (var i in js) {
  1947. pairs.push(i, st.readJSObject(js[i]));
  1948. }
  1949. return globals.Dictionary._newFromPairs_(pairs);
  1950. };
  1951. /* Boolean assertion */
  1952. st.assert = function (shouldBeBoolean) {
  1953. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  1954. else if (shouldBeBoolean != null && typeof shouldBeBoolean === "object") {
  1955. shouldBeBoolean = shouldBeBoolean.valueOf();
  1956. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  1957. }
  1958. globals.NonBooleanReceiver._signalOn_(shouldBeBoolean);
  1959. };
  1960. }
  1961. RuntimeBrik.deps = ["selectorConversion", "smalltalkGlobals", "runtimeClasses"];
  1962. function RuntimeBrik (brikz, st) {
  1963. var globals = brikz.smalltalkGlobals.globals;
  1964. var setClassConstructor = brikz.runtimeClasses.setClassConstructor;
  1965. function SmalltalkMethodContext (home, setup) {
  1966. // TODO lazy fill of .sendIdx
  1967. this.sendIdx = {};
  1968. // TODO very likely .senderContext, not .homeContext here
  1969. this.homeContext = home;
  1970. this.setup = setup;
  1971. }
  1972. // Fallbacks
  1973. SmalltalkMethodContext.prototype.supercall = false;
  1974. SmalltalkMethodContext.prototype.locals = Object.freeze({});
  1975. SmalltalkMethodContext.prototype.receiver = null;
  1976. SmalltalkMethodContext.prototype.selector = null;
  1977. SmalltalkMethodContext.prototype.outerContext = null;
  1978. SmalltalkMethodContext.prototype.index = 0;
  1979. defineMethod(SmalltalkMethodContext, "fill", function (receiver, selector, locals) {
  1980. this.receiver = receiver;
  1981. this.selector = selector;
  1982. if (locals != null) this.locals = locals;
  1983. if (this.homeContext) {
  1984. this.homeContext.evaluatedSelector = selector;
  1985. }
  1986. });
  1987. defineMethod(SmalltalkMethodContext, "fillBlock", function (locals, ctx, index) {
  1988. if (locals != null) this.locals = locals;
  1989. this.outerContext = ctx;
  1990. if (index) this.index = index;
  1991. });
  1992. setClassConstructor(globals.MethodContext, SmalltalkMethodContext);
  1993. /* This is the current call context object.
  1994. In Smalltalk code, it is accessible just by using 'thisContext' variable.
  1995. In JS code, use api.getThisContext() (see below).
  1996. */
  1997. var thisContext = null;
  1998. /*
  1999. Runs worker function so that error handler is not set up
  2000. if there isn't one. This is accomplished by unconditional
  2001. wrapping inside a context of a simulated `nil seamlessDoIt` call,
  2002. which then stops error handler setup (see st.withContext above).
  2003. The effect is, $core.seamless(fn)'s exceptions are not
  2004. handed into ST error handler and caller should process them.
  2005. */
  2006. st.seamless = function (worker) {
  2007. var oldContext = thisContext;
  2008. thisContext = new SmalltalkMethodContext(thisContext, function (ctx) {
  2009. ctx.fill(null, "seamlessDoIt", {}, globals.UndefinedObject);
  2010. });
  2011. var result = worker(thisContext);
  2012. thisContext = oldContext;
  2013. return result;
  2014. };
  2015. function resultWithErrorHandling (worker) {
  2016. try {
  2017. return worker(thisContext);
  2018. } catch (error) {
  2019. globals.ErrorHandler._handleError_(error);
  2020. thisContext = null;
  2021. // Rethrow the error in any case.
  2022. throw error;
  2023. }
  2024. }
  2025. /*
  2026. Standard way to run within context.
  2027. Sets up error handler if entering first ST context in a stack.
  2028. */
  2029. st.withContext = function (worker, setup) {
  2030. var oldContext = thisContext;
  2031. thisContext = new SmalltalkMethodContext(thisContext, setup);
  2032. var result = oldContext == null ? resultWithErrorHandling(worker) : worker(thisContext);
  2033. thisContext = oldContext;
  2034. return result;
  2035. };
  2036. /* Handle thisContext pseudo variable */
  2037. st.getThisContext = function () {
  2038. if (!thisContext) return null;
  2039. for (var frame = thisContext; frame; frame = frame.homeContext) {
  2040. frame.setup(frame);
  2041. }
  2042. return thisContext;
  2043. };
  2044. }
  2045. MessageSendBrik.deps = ["smalltalkGlobals", "selectorConversion", "root"];
  2046. function MessageSendBrik (brikz, st) {
  2047. var globals = brikz.smalltalkGlobals.globals;
  2048. var nilAsReceiver = brikz.root.nilAsReceiver;
  2049. /* Send message programmatically. Used to implement #perform: & Co. */
  2050. st.send2 = function (self, selector, args, klass) {
  2051. if (self == null) {
  2052. self = nilAsReceiver;
  2053. }
  2054. var method = klass ? klass.fn.prototype[st.st2js(selector)] : self.a$cls && self[st.st2js(selector)];
  2055. return method != null ?
  2056. method.apply(self, args || []) :
  2057. globals.Message._selector_arguments_notUnderstoodBy_(
  2058. selector, [].slice.call(args), self.a$cls ? self : wrapJavaScript(self)
  2059. );
  2060. };
  2061. function wrapJavaScript (o) {
  2062. return globals.JSObjectProxy._on_(o);
  2063. }
  2064. st.wrapJavaScript = wrapJavaScript;
  2065. /* If the object property is a function, then call it, except if it starts with
  2066. an uppercase character (we probably want to answer the function itself in this
  2067. case and send it #new from Amber).
  2068. */
  2069. st.accessJavaScript = function (self, propertyName, args) {
  2070. var propertyValue = self[propertyName];
  2071. if (typeof propertyValue === "function" && !(args.length === 0 && /^[A-Z]/.test(propertyName)))
  2072. return propertyValue.apply(self, args);
  2073. switch (args.length) {
  2074. case 0:
  2075. return propertyValue;
  2076. case 1:
  2077. self[propertyName] = args[0];
  2078. return self;
  2079. default:
  2080. throw new Error("Cannot interpret " + propertyName + " with " + args.length + " arguments; field is a " + typeof propertyValue + ", not a function")
  2081. }
  2082. };
  2083. }
  2084. function SelectorConversionBrik (brikz, st) {
  2085. var st2jsMemo = Object.create(null);
  2086. /* Convert a Smalltalk selector into a JS selector */
  2087. function st2js (string) {
  2088. return '_' + string
  2089. .replace(/:/g, '_')
  2090. .replace(/[\&]/g, '_and')
  2091. .replace(/[\|]/g, '_or')
  2092. .replace(/[+]/g, '_plus')
  2093. .replace(/-/g, '_minus')
  2094. .replace(/[*]/g, '_star')
  2095. .replace(/[\/]/g, '_slash')
  2096. .replace(/[\\]/g, '_backslash')
  2097. .replace(/[\~]/g, '_tild')
  2098. .replace(/%/g, '_percent')
  2099. .replace(/>/g, '_gt')
  2100. .replace(/</g, '_lt')
  2101. .replace(/=/g, '_eq')
  2102. .replace(/,/g, '_comma')
  2103. .replace(/[@]/g, '_at');
  2104. };
  2105. st.st2js = function (stSelector) {
  2106. return st2jsMemo[stSelector] || st2js(stSelector);
  2107. };
  2108. this.st2js = function (stSelector) {
  2109. return st2jsMemo[stSelector] || (st2jsMemo[stSelector] = st2js(stSelector));
  2110. };
  2111. /* Convert a string to a valid smalltalk selector.
  2112. if you modify the following functions, also change st2js
  2113. accordingly */
  2114. st.js2st = function (selector) {
  2115. if (selector.match(/^__/)) {
  2116. return binaryJsToSt(selector);
  2117. } else {
  2118. return keywordJsToSt(selector);
  2119. }
  2120. };
  2121. function keywordJsToSt (selector) {
  2122. return selector.replace(/^_/, '').replace(/_/g, ':');
  2123. }
  2124. function binaryJsToSt (selector) {
  2125. return selector
  2126. .replace(/^_/, '')
  2127. .replace(/_and/g, '&')
  2128. .replace(/_or/g, '|')
  2129. .replace(/_plus/g, '+')
  2130. .replace(/_minus/g, '-')
  2131. .replace(/_star/g, '*')
  2132. .replace(/_slash/g, '/')
  2133. .replace(/_backslash/g, '\\')
  2134. .replace(/_tild/g, '~')
  2135. .replace(/_percent/g, '%')
  2136. .replace(/_gt/g, '>')
  2137. .replace(/_lt/g, '<')
  2138. .replace(/_eq/g, '=')
  2139. .replace(/_comma/g, ',')
  2140. .replace(/_at/g, '@');
  2141. }
  2142. st.st2prop = function (stSelector) {
  2143. var colonPosition = stSelector.indexOf(':');
  2144. return colonPosition === -1 ? stSelector : stSelector.slice(0, colonPosition);
  2145. };
  2146. }
  2147. StartImageBrik.deps = ["smalltalkGlobals"];
  2148. function StartImageBrik (brikz, st) {
  2149. var globals = brikz.smalltalkGlobals.globals;
  2150. this.run = function () {
  2151. return globals.AmberBootstrapInitialization._run();
  2152. };
  2153. }
  2154. /* Making smalltalk that can run */
  2155. function configureWithRuntime (brikz) {
  2156. brikz.runtimeSelectors = RuntimeSelectorsBrik;
  2157. brikz.runtimeClasses = RuntimeClassesBrik;
  2158. brikz.frameBinding = FrameBindingBrik;
  2159. brikz.runtimeMethods = RuntimeMethodsBrik;
  2160. brikz.messageSend = MessageSendBrik;
  2161. brikz.runtime = RuntimeBrik;
  2162. brikz.primitives = PrimitivesBrik;
  2163. brikz.selectorConversion = SelectorConversionBrik;
  2164. brikz.startImage = StartImageBrik;
  2165. brikz();
  2166. }
  2167. return configureWithRuntime;
  2168. });
  2169. /* ====================================================================
  2170. |
  2171. | Amber Smalltalk
  2172. | http://amber-lang.net
  2173. |
  2174. ======================================================================
  2175. ======================================================================
  2176. |
  2177. | Copyright (c) 2010-2014
  2178. | Nicolas Petton <petton.nicolas@gmail.com>
  2179. |
  2180. | Copyright (c) 2012-2019
  2181. | The Amber team https://lolg.it/org/amber/members
  2182. | Amber contributors (see /CONTRIBUTORS)
  2183. |
  2184. | Amber is released under the MIT license
  2185. |
  2186. | Permission is hereby granted, free of charge, to any person obtaining
  2187. | a copy of this software and associated documentation files (the
  2188. | 'Software'), to deal in the Software without restriction, including
  2189. | without limitation the rights to use, copy, modify, merge, publish,
  2190. | distribute, sublicense, and/or sell copies of the Software, and to
  2191. | permit persons to whom the Software is furnished to do so, subject to
  2192. | the following conditions:
  2193. |
  2194. | The above copyright notice and this permission notice shall be
  2195. | included in all copies or substantial portions of the Software.
  2196. |
  2197. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  2198. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  2199. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  2200. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  2201. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  2202. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  2203. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  2204. |
  2205. ==================================================================== */
  2206. //jshint eqnull:true
  2207. define('amber/boot',[
  2208. 'require', './kernel-checks', './brikz', './kernel-fundamentals', './kernel-language'
  2209. ], function (require, _, Brikz, configureWithFundamentals, configureWithHierarchy) {
  2210. "use strict";
  2211. var runtimeLoadedPromise = new Promise(function (resolve, reject) {
  2212. require(['./kernel-runtime'], resolve, reject);
  2213. });
  2214. function SmalltalkInitBrik (brikz, st) {
  2215. var initialized = false;
  2216. /* Smalltalk initialization. Called on page load */
  2217. st.initialize = function () {
  2218. return runtimeLoadedPromise.then(function (configureWithRuntime) {
  2219. if (initialized) return;
  2220. brikz.classes.bootstrapHierarchy();
  2221. configureWithRuntime(brikz);
  2222. return Promise.resolve(brikz.startImage.run())
  2223. .then(function () {
  2224. initialized = true;
  2225. });
  2226. });
  2227. };
  2228. }
  2229. /* Adds AMD and requirejs related methods to the api */
  2230. function AMDBrik (brikz, st) {
  2231. st.amdRequire = require;
  2232. st.defaultTransportType = st.defaultTransportType || "amd";
  2233. st.defaultAmdNamespace = st.defaultAmdNamespace || "amber/core";
  2234. }
  2235. /* Defines asReceiver to be present at load time */
  2236. /* (logically it belongs more to PrimitiveBrik) */
  2237. AsReceiverBrik.deps = ["nil"];
  2238. function AsReceiverBrik (brikz, st) {
  2239. var nilAsReceiver = brikz.nil.nilAsReceiver;
  2240. /**
  2241. * This function is used all over the compiled amber code.
  2242. * It takes any value (JavaScript or Smalltalk)
  2243. * and returns a proper Amber Smalltalk receiver.
  2244. *
  2245. * null or undefined -> nilAsReceiver,
  2246. * object having Smalltalk signature -> unchanged,
  2247. * otherwise wrapped foreign (JS) object
  2248. */
  2249. this.asReceiver = function (o) {
  2250. if (o == null) return nilAsReceiver;
  2251. else if (o.a$cls != null) return o;
  2252. else return st.wrapJavaScript(o);
  2253. };
  2254. }
  2255. var api = {};
  2256. var brikz = Brikz(api);
  2257. configureWithFundamentals(brikz);
  2258. configureWithHierarchy(brikz);
  2259. brikz.asReceiver = AsReceiverBrik;
  2260. brikz.stInit = SmalltalkInitBrik;
  2261. brikz.amd = AMDBrik;
  2262. brikz();
  2263. // TODO deprecated, remove
  2264. Object.defineProperty(brikz.smalltalkGlobals.globals, "CharacterArray", {
  2265. enumerable: true,
  2266. configurable: true,
  2267. get: function () {
  2268. return this.String;
  2269. }
  2270. });
  2271. return {
  2272. api: api,
  2273. nilAsReceiver: brikz.nil.nilAsReceiver,
  2274. nilAsValue: brikz.nil.nilAsValue,
  2275. nilAsClass: brikz.classes.nilAsClass,
  2276. globals: brikz.smalltalkGlobals.globals,
  2277. asReceiver: brikz.asReceiver.asReceiver
  2278. };
  2279. });
  2280. define('amber/helpers',["amber/boot", "require"], function (boot, require) {
  2281. var globals = boot.globals,
  2282. exports = {},
  2283. api = boot.api,
  2284. nil = boot.nilAsReceiver;
  2285. // API
  2286. exports.popupHelios = function () {
  2287. require(['helios/index'], function (helios) {
  2288. helios.popup();
  2289. }, function (err) {
  2290. window.alert("Error loading helios.\nIf not present, you can install it with 'bower install helios --save-dev'.\nThe error follows:\n" + err);
  2291. });
  2292. };
  2293. Object.defineProperty(exports, "api", {
  2294. value: api,
  2295. enumerable: true, configurable: true, writable: false
  2296. });
  2297. Object.defineProperty(exports, "globals", {
  2298. value: globals,
  2299. enumerable: true, configurable: true, writable: false
  2300. });
  2301. Object.defineProperty(exports, "nil", {
  2302. value: nil,
  2303. enumerable: true, configurable: true, writable: false
  2304. });
  2305. function mixinToSettings (source) {
  2306. var settings = globals.SmalltalkSettings;
  2307. Object.keys(source).forEach(function (key) {
  2308. settings[key] = source[key];
  2309. });
  2310. }
  2311. function settingsInLocalStorage () {
  2312. //jshint evil:true
  2313. var storage = 'localStorage' in global && global.localStorage;
  2314. if (storage) {
  2315. var fromStorage;
  2316. try {
  2317. fromStorage = JSON.parse(storage.getItem('amber.SmalltalkSettings'));
  2318. } catch (ex) {
  2319. // pass
  2320. }
  2321. mixinToSettings(fromStorage || {});
  2322. if (typeof window !== "undefined") {
  2323. window.addEventListener('beforeunload', function () {
  2324. storage.setItem('amber.SmalltalkSettings', JSON.stringify(globals.SmalltalkSettings));
  2325. });
  2326. }
  2327. }
  2328. }
  2329. exports.initialize = function (options) {
  2330. return new Promise(function (resolve) {
  2331. globals.SmalltalkSettings['transport.defaultAmdNamespace'] = api.defaultAmdNamespace;
  2332. settingsInLocalStorage();
  2333. mixinToSettings(options || {});
  2334. resolve(api.initialize());
  2335. });
  2336. };
  2337. exports.loadPackages = function (modules) {
  2338. return new Promise(function (resolve, reject) {
  2339. require(modules, resolve, reject);
  2340. }).then(function () {
  2341. return globals.Smalltalk._postLoad();
  2342. });
  2343. };
  2344. exports.beClean = function () {
  2345. return globals.Smalltalk._beClean();
  2346. };
  2347. // Exports
  2348. return exports;
  2349. });
  2350. define('amber/core/Kernel-Helpers',["amber/boot", "require"], function($boot,requirejs){"use strict";
  2351. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  2352. var $pkg = $core.addPackage("Kernel-Helpers");
  2353. $pkg.innerEval = function (expr) { return eval(expr); };
  2354. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  2355. $core.addTrait("TPragmator", "Kernel-Helpers");
  2356. $core.addMethod(
  2357. $core.method({
  2358. selector: "canProcessPragma:",
  2359. protocol: "pragma processing",
  2360. fn: function (aMessage){
  2361. var self=this,$self=this;
  2362. var selector;
  2363. return $core.withContext(function($ctx1) {
  2364. selector=$recv(aMessage)._selector();
  2365. return $recv($self._respondsTo_(selector))._and_((function(){
  2366. return $core.withContext(function($ctx2) {
  2367. return $recv($recv($recv($self._class())._superclass())._canUnderstand_(selector))._not();
  2368. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2369. }));
  2370. }, function($ctx1) {$ctx1.fill(self,"canProcessPragma:",{aMessage:aMessage,selector:selector})});
  2371. },
  2372. args: ["aMessage"],
  2373. source: "canProcessPragma: aMessage\x0a\x09| selector |\x0a\x09selector := aMessage selector.\x0a\x09^ (self respondsTo: selector) and: [\x0a\x09\x09(self class superclass canUnderstand: selector) not]",
  2374. referencedClasses: [],
  2375. pragmas: [],
  2376. messageSends: ["selector", "and:", "respondsTo:", "not", "canUnderstand:", "superclass", "class"]
  2377. }),
  2378. $globals.TPragmator);
  2379. $core.addMethod(
  2380. $core.method({
  2381. selector: "processPragma:",
  2382. protocol: "pragma processing",
  2383. fn: function (aMessage){
  2384. var self=this,$self=this;
  2385. return $core.withContext(function($ctx1) {
  2386. var $1;
  2387. $1=$self._canProcessPragma_(aMessage);
  2388. if($core.assert($1)){
  2389. return $recv(aMessage)._sendTo_(self);
  2390. }
  2391. return self;
  2392. }, function($ctx1) {$ctx1.fill(self,"processPragma:",{aMessage:aMessage})});
  2393. },
  2394. args: ["aMessage"],
  2395. source: "processPragma: aMessage\x0a\x09(self canProcessPragma: aMessage) ifTrue: [\x0a\x09\x09^ aMessage sendTo: self ]",
  2396. referencedClasses: [],
  2397. pragmas: [],
  2398. messageSends: ["ifTrue:", "canProcessPragma:", "sendTo:"]
  2399. }),
  2400. $globals.TPragmator);
  2401. $core.addMethod(
  2402. $core.method({
  2403. selector: "processPragmas:",
  2404. protocol: "pragma processing",
  2405. fn: function (aCollection){
  2406. var self=this,$self=this;
  2407. return $core.withContext(function($ctx1) {
  2408. $recv(aCollection)._do_((function(each){
  2409. return $core.withContext(function($ctx2) {
  2410. return $self._processPragma_(each);
  2411. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2412. }));
  2413. return self;
  2414. }, function($ctx1) {$ctx1.fill(self,"processPragmas:",{aCollection:aCollection})});
  2415. },
  2416. args: ["aCollection"],
  2417. source: "processPragmas: aCollection\x0a\x09aCollection do: [ :each | self processPragma: each ]",
  2418. referencedClasses: [],
  2419. pragmas: [],
  2420. messageSends: ["do:", "processPragma:"]
  2421. }),
  2422. $globals.TPragmator);
  2423. $core.addTrait("TSubclassable", "Kernel-Helpers");
  2424. $core.addMethod(
  2425. $core.method({
  2426. selector: "subclass:",
  2427. protocol: "class creation",
  2428. fn: function (aString){
  2429. var self=this,$self=this;
  2430. return $core.withContext(function($ctx1) {
  2431. return $self._subclass_slots_package_(aString,[],nil);
  2432. }, function($ctx1) {$ctx1.fill(self,"subclass:",{aString:aString})});
  2433. },
  2434. args: ["aString"],
  2435. source: "subclass: aString \x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString slots: #() package: nil",
  2436. referencedClasses: [],
  2437. pragmas: [],
  2438. messageSends: ["subclass:slots:package:"]
  2439. }),
  2440. $globals.TSubclassable);
  2441. $core.addMethod(
  2442. $core.method({
  2443. selector: "subclass:instanceVariableNames:",
  2444. protocol: "class creation",
  2445. fn: function (aString,anotherString){
  2446. var self=this,$self=this;
  2447. return $core.withContext(function($ctx1) {
  2448. return $self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  2449. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString})});
  2450. },
  2451. args: ["aString", "anotherString"],
  2452. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  2453. referencedClasses: [],
  2454. pragmas: [],
  2455. messageSends: ["subclass:instanceVariableNames:package:"]
  2456. }),
  2457. $globals.TSubclassable);
  2458. $core.addMethod(
  2459. $core.method({
  2460. selector: "subclass:instanceVariableNames:category:",
  2461. protocol: "class creation",
  2462. fn: function (aString,aString2,aString3){
  2463. var self=this,$self=this;
  2464. return $core.withContext(function($ctx1) {
  2465. return $self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  2466. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3})});
  2467. },
  2468. args: ["aString", "aString2", "aString3"],
  2469. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  2470. referencedClasses: [],
  2471. pragmas: [],
  2472. messageSends: ["subclass:instanceVariableNames:package:"]
  2473. }),
  2474. $globals.TSubclassable);
  2475. $core.addMethod(
  2476. $core.method({
  2477. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  2478. protocol: "class creation",
  2479. fn: function (aString,aString2,classVars,pools,aString3){
  2480. var self=this,$self=this;
  2481. return $core.withContext(function($ctx1) {
  2482. return $self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  2483. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3})});
  2484. },
  2485. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  2486. 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",
  2487. referencedClasses: [],
  2488. pragmas: [],
  2489. messageSends: ["subclass:instanceVariableNames:package:"]
  2490. }),
  2491. $globals.TSubclassable);
  2492. $core.addMethod(
  2493. $core.method({
  2494. selector: "subclass:instanceVariableNames:package:",
  2495. protocol: "class creation",
  2496. fn: function (aString,aString2,aString3){
  2497. var self=this,$self=this;
  2498. return $core.withContext(function($ctx1) {
  2499. return $self._subclass_slots_package_(aString,$recv(aString2)._instanceVariablesStringAsSlotList(),aString3);
  2500. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3})});
  2501. },
  2502. args: ["aString", "aString2", "aString3"],
  2503. 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",
  2504. referencedClasses: [],
  2505. pragmas: [],
  2506. messageSends: ["subclass:slots:package:", "instanceVariablesStringAsSlotList"]
  2507. }),
  2508. $globals.TSubclassable);
  2509. $core.addMethod(
  2510. $core.method({
  2511. selector: "subclass:slots:",
  2512. protocol: "class creation",
  2513. fn: function (aString,aCollection){
  2514. var self=this,$self=this;
  2515. return $core.withContext(function($ctx1) {
  2516. return $self._subclass_slots_package_(aString,aCollection,nil);
  2517. }, function($ctx1) {$ctx1.fill(self,"subclass:slots:",{aString:aString,aCollection:aCollection})});
  2518. },
  2519. args: ["aString", "aCollection"],
  2520. source: "subclass: aString slots: aCollection\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString slots: aCollection package: nil",
  2521. referencedClasses: [],
  2522. pragmas: [],
  2523. messageSends: ["subclass:slots:package:"]
  2524. }),
  2525. $globals.TSubclassable);
  2526. $core.addMethod(
  2527. $core.method({
  2528. selector: "subclass:slots:classVariables:package:",
  2529. protocol: "class creation",
  2530. fn: function (aString,aCollection,anObject,anotherString){
  2531. var self=this,$self=this;
  2532. return $core.withContext(function($ctx1) {
  2533. return $recv($recv($globals.ClassBuilder)._new())._superclass_subclass_slots_package_(self,aString,aCollection,anotherString);
  2534. }, function($ctx1) {$ctx1.fill(self,"subclass:slots:classVariables:package:",{aString:aString,aCollection:aCollection,anObject:anObject,anotherString:anotherString})});
  2535. },
  2536. args: ["aString", "aCollection", "anObject", "anotherString"],
  2537. 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",
  2538. referencedClasses: ["ClassBuilder"],
  2539. pragmas: [],
  2540. messageSends: ["superclass:subclass:slots:package:", "new"]
  2541. }),
  2542. $globals.TSubclassable);
  2543. $core.addMethod(
  2544. $core.method({
  2545. selector: "subclass:slots:classVariables:poolDictionaries:package:",
  2546. protocol: "class creation",
  2547. fn: function (aString,aCollection,anObject,anotherObject,anotherString){
  2548. var self=this,$self=this;
  2549. return $core.withContext(function($ctx1) {
  2550. return $recv($recv($globals.ClassBuilder)._new())._superclass_subclass_slots_package_(self,aString,aCollection,anotherString);
  2551. }, function($ctx1) {$ctx1.fill(self,"subclass:slots:classVariables:poolDictionaries:package:",{aString:aString,aCollection:aCollection,anObject:anObject,anotherObject:anotherObject,anotherString:anotherString})});
  2552. },
  2553. args: ["aString", "aCollection", "anObject", "anotherObject", "anotherString"],
  2554. 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",
  2555. referencedClasses: ["ClassBuilder"],
  2556. pragmas: [],
  2557. messageSends: ["superclass:subclass:slots:package:", "new"]
  2558. }),
  2559. $globals.TSubclassable);
  2560. $core.addMethod(
  2561. $core.method({
  2562. selector: "subclass:slots:package:",
  2563. protocol: "class creation",
  2564. fn: function (aString,aCollection,anotherString){
  2565. var self=this,$self=this;
  2566. return $core.withContext(function($ctx1) {
  2567. return $recv($recv($globals.ClassBuilder)._new())._superclass_subclass_slots_package_(self,aString,aCollection,anotherString);
  2568. }, function($ctx1) {$ctx1.fill(self,"subclass:slots:package:",{aString:aString,aCollection:aCollection,anotherString:anotherString})});
  2569. },
  2570. args: ["aString", "aCollection", "anotherString"],
  2571. source: "subclass: aString slots: aCollection package: anotherString\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString slots: aCollection package: anotherString",
  2572. referencedClasses: ["ClassBuilder"],
  2573. pragmas: [],
  2574. messageSends: ["superclass:subclass:slots:package:", "new"]
  2575. }),
  2576. $globals.TSubclassable);
  2577. $core.addMethod(
  2578. $core.method({
  2579. selector: "subclass:uses:",
  2580. protocol: "class creation",
  2581. fn: function (aString,aTraitCompositionDescription){
  2582. var self=this,$self=this;
  2583. return $core.withContext(function($ctx1) {
  2584. return $self._subclass_uses_slots_package_(aString,aTraitCompositionDescription,[],nil);
  2585. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription})});
  2586. },
  2587. args: ["aString", "aTraitCompositionDescription"],
  2588. source: "subclass: aString uses: aTraitCompositionDescription \x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString uses: aTraitCompositionDescription slots: #() package: nil",
  2589. referencedClasses: [],
  2590. pragmas: [],
  2591. messageSends: ["subclass:uses:slots:package:"]
  2592. }),
  2593. $globals.TSubclassable);
  2594. $core.addMethod(
  2595. $core.method({
  2596. selector: "subclass:uses:instanceVariableNames:",
  2597. protocol: "class creation",
  2598. fn: function (aString,aTraitCompositionDescription,anotherString){
  2599. var self=this,$self=this;
  2600. return $core.withContext(function($ctx1) {
  2601. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,anotherString,nil);
  2602. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,anotherString:anotherString})});
  2603. },
  2604. args: ["aString", "aTraitCompositionDescription", "anotherString"],
  2605. 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",
  2606. referencedClasses: [],
  2607. pragmas: [],
  2608. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2609. }),
  2610. $globals.TSubclassable);
  2611. $core.addMethod(
  2612. $core.method({
  2613. selector: "subclass:uses:instanceVariableNames:category:",
  2614. protocol: "class creation",
  2615. fn: function (aString,aTraitCompositionDescription,aString2,aString3){
  2616. var self=this,$self=this;
  2617. return $core.withContext(function($ctx1) {
  2618. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,aString2,aString3);
  2619. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:category:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,aString3:aString3})});
  2620. },
  2621. args: ["aString", "aTraitCompositionDescription", "aString2", "aString3"],
  2622. 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",
  2623. referencedClasses: [],
  2624. pragmas: [],
  2625. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2626. }),
  2627. $globals.TSubclassable);
  2628. $core.addMethod(
  2629. $core.method({
  2630. selector: "subclass:uses:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  2631. protocol: "class creation",
  2632. fn: function (aString,aTraitCompositionDescription,aString2,classVars,pools,aString3){
  2633. var self=this,$self=this;
  2634. return $core.withContext(function($ctx1) {
  2635. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,aString2,aString3);
  2636. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3})});
  2637. },
  2638. args: ["aString", "aTraitCompositionDescription", "aString2", "classVars", "pools", "aString3"],
  2639. 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",
  2640. referencedClasses: [],
  2641. pragmas: [],
  2642. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2643. }),
  2644. $globals.TSubclassable);
  2645. $core.addMethod(
  2646. $core.method({
  2647. selector: "subclass:uses:instanceVariableNames:package:",
  2648. protocol: "class creation",
  2649. fn: function (aString,aTraitCompositionDescription,aString2,aString3){
  2650. var self=this,$self=this;
  2651. return $core.withContext(function($ctx1) {
  2652. return $self._subclass_uses_slots_package_(aString,aTraitCompositionDescription,$recv(aString2)._instanceVariablesStringAsSlotList(),aString3);
  2653. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:package:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,aString3:aString3})});
  2654. },
  2655. args: ["aString", "aTraitCompositionDescription", "aString2", "aString3"],
  2656. 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",
  2657. referencedClasses: [],
  2658. pragmas: [],
  2659. messageSends: ["subclass:uses:slots:package:", "instanceVariablesStringAsSlotList"]
  2660. }),
  2661. $globals.TSubclassable);
  2662. $core.addMethod(
  2663. $core.method({
  2664. selector: "subclass:uses:slots:",
  2665. protocol: "class creation",
  2666. fn: function (aString,aTraitCompositionDescription,aCollection){
  2667. var self=this,$self=this;
  2668. return $core.withContext(function($ctx1) {
  2669. return $self._subclass_uses_slots_package_(aString,aTraitCompositionDescription,aCollection,nil);
  2670. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:slots:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aCollection:aCollection})});
  2671. },
  2672. args: ["aString", "aTraitCompositionDescription", "aCollection"],
  2673. 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",
  2674. referencedClasses: [],
  2675. pragmas: [],
  2676. messageSends: ["subclass:uses:slots:package:"]
  2677. }),
  2678. $globals.TSubclassable);
  2679. $core.addMethod(
  2680. $core.method({
  2681. selector: "subclass:uses:slots:package:",
  2682. protocol: "class creation",
  2683. fn: function (aString,aTraitCompositionDescription,aCollection,aString3){
  2684. var self=this,$self=this;
  2685. var cls;
  2686. return $core.withContext(function($ctx1) {
  2687. cls=$self._subclass_slots_package_(aString,aCollection,aString3);
  2688. $recv(cls)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  2689. return cls;
  2690. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:slots:package:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aCollection:aCollection,aString3:aString3,cls:cls})});
  2691. },
  2692. args: ["aString", "aTraitCompositionDescription", "aCollection", "aString3"],
  2693. 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",
  2694. referencedClasses: [],
  2695. pragmas: [],
  2696. messageSends: ["subclass:slots:package:", "setTraitComposition:", "asTraitComposition"]
  2697. }),
  2698. $globals.TSubclassable);
  2699. });
  2700. define('amber/core/Kernel-Objects',["amber/boot", "require", "amber/core/Kernel-Helpers"], function($boot,requirejs){"use strict";
  2701. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  2702. var $pkg = $core.addPackage("Kernel-Objects");
  2703. $pkg.innerEval = function (expr) { return eval(expr); };
  2704. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  2705. $core.addClass("ProtoObject", null, [], "Kernel-Objects");
  2706. $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.";
  2707. $core.addMethod(
  2708. $core.method({
  2709. selector: "=",
  2710. protocol: "comparing",
  2711. fn: function (anObject){
  2712. var self=this,$self=this;
  2713. return $core.withContext(function($ctx1) {
  2714. return $self.__eq_eq(anObject);
  2715. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject})});
  2716. },
  2717. args: ["anObject"],
  2718. source: "= anObject\x0a\x09^ self == anObject",
  2719. referencedClasses: [],
  2720. pragmas: [],
  2721. messageSends: ["=="]
  2722. }),
  2723. $globals.ProtoObject);
  2724. $core.addMethod(
  2725. $core.method({
  2726. selector: "==",
  2727. protocol: "comparing",
  2728. fn: function (anObject){
  2729. var self=this,$self=this;
  2730. return $core.withContext(function($ctx1) {
  2731. return self === anObject;
  2732. return self;
  2733. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject})});
  2734. },
  2735. args: ["anObject"],
  2736. source: "== anObject\x0a<inlineJS: 'return self === anObject'>",
  2737. referencedClasses: [],
  2738. pragmas: [["inlineJS:", ["return self === anObject"]]],
  2739. messageSends: []
  2740. }),
  2741. $globals.ProtoObject);
  2742. $core.addMethod(
  2743. $core.method({
  2744. selector: "asString",
  2745. protocol: "converting",
  2746. fn: function (){
  2747. var self=this,$self=this;
  2748. return $core.withContext(function($ctx1) {
  2749. return $self._printString();
  2750. }, function($ctx1) {$ctx1.fill(self,"asString",{})});
  2751. },
  2752. args: [],
  2753. source: "asString\x0a\x09^ self printString",
  2754. referencedClasses: [],
  2755. pragmas: [],
  2756. messageSends: ["printString"]
  2757. }),
  2758. $globals.ProtoObject);
  2759. $core.addMethod(
  2760. $core.method({
  2761. selector: "class",
  2762. protocol: "accessing",
  2763. fn: function (){
  2764. var self=this,$self=this;
  2765. return $core.withContext(function($ctx1) {
  2766. return $self.a$cls;
  2767. return self;
  2768. }, function($ctx1) {$ctx1.fill(self,"class",{})});
  2769. },
  2770. args: [],
  2771. source: "class\x0a\x09<inlineJS: 'return $self.a$cls'>",
  2772. referencedClasses: [],
  2773. pragmas: [["inlineJS:", ["return $self.a$cls"]]],
  2774. messageSends: []
  2775. }),
  2776. $globals.ProtoObject);
  2777. $core.addMethod(
  2778. $core.method({
  2779. selector: "doesNotUnderstand:",
  2780. protocol: "error handling",
  2781. fn: function (aMessage){
  2782. var self=this,$self=this;
  2783. return $core.withContext(function($ctx1) {
  2784. var $1;
  2785. $1=$recv($globals.MessageNotUnderstood)._new();
  2786. $recv($1)._receiver_(self);
  2787. $recv($1)._message_(aMessage);
  2788. $recv($1)._signal();
  2789. return self;
  2790. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage})});
  2791. },
  2792. args: ["aMessage"],
  2793. source: "doesNotUnderstand: aMessage\x0a\x09MessageNotUnderstood new\x0a\x09\x09receiver: self;\x0a\x09\x09message: aMessage;\x0a\x09\x09signal",
  2794. referencedClasses: ["MessageNotUnderstood"],
  2795. pragmas: [],
  2796. messageSends: ["receiver:", "new", "message:", "signal"]
  2797. }),
  2798. $globals.ProtoObject);
  2799. $core.addMethod(
  2800. $core.method({
  2801. selector: "evaluate:on:",
  2802. protocol: "evaluating",
  2803. fn: function (aString,anEvaluator){
  2804. var self=this,$self=this;
  2805. return $core.withContext(function($ctx1) {
  2806. return $recv(anEvaluator)._evaluate_receiver_(aString,self);
  2807. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator})});
  2808. },
  2809. args: ["aString", "anEvaluator"],
  2810. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString receiver: self",
  2811. referencedClasses: [],
  2812. pragmas: [],
  2813. messageSends: ["evaluate:receiver:"]
  2814. }),
  2815. $globals.ProtoObject);
  2816. $core.addMethod(
  2817. $core.method({
  2818. selector: "identityHash",
  2819. protocol: "accessing",
  2820. fn: function (){
  2821. var self=this,$self=this;
  2822. return $core.withContext(function($ctx1) {
  2823. self._deprecatedAPI();
  2824. var hash=self.identityHash;
  2825. if (hash) return hash;
  2826. hash=$core.nextId();
  2827. Object.defineProperty(self, 'identityHash', {value:hash});
  2828. return hash;
  2829. ;
  2830. return self;
  2831. }, function($ctx1) {$ctx1.fill(self,"identityHash",{})});
  2832. },
  2833. args: [],
  2834. 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'>",
  2835. referencedClasses: [],
  2836. 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"]]],
  2837. messageSends: []
  2838. }),
  2839. $globals.ProtoObject);
  2840. $core.addMethod(
  2841. $core.method({
  2842. selector: "ifNil:",
  2843. protocol: "testing",
  2844. fn: function (aBlock){
  2845. var self=this,$self=this;
  2846. return self;
  2847. },
  2848. args: ["aBlock"],
  2849. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  2850. referencedClasses: [],
  2851. pragmas: [],
  2852. messageSends: []
  2853. }),
  2854. $globals.ProtoObject);
  2855. $core.addMethod(
  2856. $core.method({
  2857. selector: "ifNil:ifNotNil:",
  2858. protocol: "testing",
  2859. fn: function (aBlock,anotherBlock){
  2860. var self=this,$self=this;
  2861. return $core.withContext(function($ctx1) {
  2862. return $recv(anotherBlock)._value_(self);
  2863. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  2864. },
  2865. args: ["aBlock", "anotherBlock"],
  2866. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value: self",
  2867. referencedClasses: [],
  2868. pragmas: [],
  2869. messageSends: ["value:"]
  2870. }),
  2871. $globals.ProtoObject);
  2872. $core.addMethod(
  2873. $core.method({
  2874. selector: "ifNotNil:",
  2875. protocol: "testing",
  2876. fn: function (aBlock){
  2877. var self=this,$self=this;
  2878. return $core.withContext(function($ctx1) {
  2879. return $recv(aBlock)._value_(self);
  2880. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock})});
  2881. },
  2882. args: ["aBlock"],
  2883. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  2884. referencedClasses: [],
  2885. pragmas: [],
  2886. messageSends: ["value:"]
  2887. }),
  2888. $globals.ProtoObject);
  2889. $core.addMethod(
  2890. $core.method({
  2891. selector: "ifNotNil:ifNil:",
  2892. protocol: "testing",
  2893. fn: function (aBlock,anotherBlock){
  2894. var self=this,$self=this;
  2895. return $core.withContext(function($ctx1) {
  2896. return $recv(aBlock)._value_(self);
  2897. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  2898. },
  2899. args: ["aBlock", "anotherBlock"],
  2900. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  2901. referencedClasses: [],
  2902. pragmas: [],
  2903. messageSends: ["value:"]
  2904. }),
  2905. $globals.ProtoObject);
  2906. $core.addMethod(
  2907. $core.method({
  2908. selector: "initialize",
  2909. protocol: "initialization",
  2910. fn: function (){
  2911. var self=this,$self=this;
  2912. return self;
  2913. },
  2914. args: [],
  2915. source: "initialize",
  2916. referencedClasses: [],
  2917. pragmas: [],
  2918. messageSends: []
  2919. }),
  2920. $globals.ProtoObject);
  2921. $core.addMethod(
  2922. $core.method({
  2923. selector: "inspect",
  2924. protocol: "inspecting",
  2925. fn: function (){
  2926. var self=this,$self=this;
  2927. return $core.withContext(function($ctx1) {
  2928. $recv($globals.Inspector)._inspect_(self);
  2929. return self;
  2930. }, function($ctx1) {$ctx1.fill(self,"inspect",{})});
  2931. },
  2932. args: [],
  2933. source: "inspect\x0a\x09Inspector inspect: self",
  2934. referencedClasses: ["Inspector"],
  2935. pragmas: [],
  2936. messageSends: ["inspect:"]
  2937. }),
  2938. $globals.ProtoObject);
  2939. $core.addMethod(
  2940. $core.method({
  2941. selector: "inspectOn:",
  2942. protocol: "inspecting",
  2943. fn: function (anInspector){
  2944. var self=this,$self=this;
  2945. return self;
  2946. },
  2947. args: ["anInspector"],
  2948. source: "inspectOn: anInspector",
  2949. referencedClasses: [],
  2950. pragmas: [],
  2951. messageSends: []
  2952. }),
  2953. $globals.ProtoObject);
  2954. $core.addMethod(
  2955. $core.method({
  2956. selector: "instVarAt:",
  2957. protocol: "accessing",
  2958. fn: function (aString){
  2959. var self=this,$self=this;
  2960. return $core.withContext(function($ctx1) {
  2961. return $self[aString];
  2962. return self;
  2963. }, function($ctx1) {$ctx1.fill(self,"instVarAt:",{aString:aString})});
  2964. },
  2965. args: ["aString"],
  2966. source: "instVarAt: aString\x0a\x09<inlineJS: 'return $self[aString]'>",
  2967. referencedClasses: [],
  2968. pragmas: [["inlineJS:", ["return $self[aString]"]]],
  2969. messageSends: []
  2970. }),
  2971. $globals.ProtoObject);
  2972. $core.addMethod(
  2973. $core.method({
  2974. selector: "instVarAt:put:",
  2975. protocol: "accessing",
  2976. fn: function (aString,anObject){
  2977. var self=this,$self=this;
  2978. return $core.withContext(function($ctx1) {
  2979. $self[aString] = anObject;
  2980. return self;
  2981. }, function($ctx1) {$ctx1.fill(self,"instVarAt:put:",{aString:aString,anObject:anObject})});
  2982. },
  2983. args: ["aString", "anObject"],
  2984. source: "instVarAt: aString put: anObject\x0a\x09<inlineJS: '$self[aString] = anObject'>",
  2985. referencedClasses: [],
  2986. pragmas: [["inlineJS:", ["$self[aString] = anObject"]]],
  2987. messageSends: []
  2988. }),
  2989. $globals.ProtoObject);
  2990. $core.addMethod(
  2991. $core.method({
  2992. selector: "isKindOf:",
  2993. protocol: "testing",
  2994. fn: function (aClass){
  2995. var self=this,$self=this;
  2996. return $core.withContext(function($ctx1) {
  2997. var $1;
  2998. $1=$self._isMemberOf_(aClass);
  2999. if($core.assert($1)){
  3000. return true;
  3001. } else {
  3002. return $recv($self._class())._inheritsFrom_(aClass);
  3003. }
  3004. }, function($ctx1) {$ctx1.fill(self,"isKindOf:",{aClass:aClass})});
  3005. },
  3006. args: ["aClass"],
  3007. source: "isKindOf: aClass\x0a\x09^ (self isMemberOf: aClass)\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: [ self class inheritsFrom: aClass ]",
  3008. referencedClasses: [],
  3009. pragmas: [],
  3010. messageSends: ["ifTrue:ifFalse:", "isMemberOf:", "inheritsFrom:", "class"]
  3011. }),
  3012. $globals.ProtoObject);
  3013. $core.addMethod(
  3014. $core.method({
  3015. selector: "isNil",
  3016. protocol: "testing",
  3017. fn: function (){
  3018. var self=this,$self=this;
  3019. return false;
  3020. },
  3021. args: [],
  3022. source: "isNil\x0a\x09^ false",
  3023. referencedClasses: [],
  3024. pragmas: [],
  3025. messageSends: []
  3026. }),
  3027. $globals.ProtoObject);
  3028. $core.addMethod(
  3029. $core.method({
  3030. selector: "notNil",
  3031. protocol: "testing",
  3032. fn: function (){
  3033. var self=this,$self=this;
  3034. return true;
  3035. },
  3036. args: [],
  3037. source: "notNil\x0a\x09^ true",
  3038. referencedClasses: [],
  3039. pragmas: [],
  3040. messageSends: []
  3041. }),
  3042. $globals.ProtoObject);
  3043. $core.addMethod(
  3044. $core.method({
  3045. selector: "perform:",
  3046. protocol: "message handling",
  3047. fn: function (aString){
  3048. var self=this,$self=this;
  3049. return $core.withContext(function($ctx1) {
  3050. return $self._perform_withArguments_(aString,[]);
  3051. }, function($ctx1) {$ctx1.fill(self,"perform:",{aString:aString})});
  3052. },
  3053. args: ["aString"],
  3054. source: "perform: aString\x0a\x09^ self perform: aString withArguments: #()",
  3055. referencedClasses: [],
  3056. pragmas: [],
  3057. messageSends: ["perform:withArguments:"]
  3058. }),
  3059. $globals.ProtoObject);
  3060. $core.addMethod(
  3061. $core.method({
  3062. selector: "perform:withArguments:",
  3063. protocol: "message handling",
  3064. fn: function (aString,aCollection){
  3065. var self=this,$self=this;
  3066. return $core.withContext(function($ctx1) {
  3067. return $core.send2(self, aString, aCollection);
  3068. return self;
  3069. }, function($ctx1) {$ctx1.fill(self,"perform:withArguments:",{aString:aString,aCollection:aCollection})});
  3070. },
  3071. args: ["aString", "aCollection"],
  3072. source: "perform: aString withArguments: aCollection\x0a\x09<inlineJS: 'return $core.send2(self, aString, aCollection)'>",
  3073. referencedClasses: [],
  3074. pragmas: [["inlineJS:", ["return $core.send2(self, aString, aCollection)"]]],
  3075. messageSends: []
  3076. }),
  3077. $globals.ProtoObject);
  3078. $core.addMethod(
  3079. $core.method({
  3080. selector: "printOn:",
  3081. protocol: "printing",
  3082. fn: function (aStream){
  3083. var self=this,$self=this;
  3084. return $core.withContext(function($ctx1) {
  3085. var $5,$4,$3,$2,$1;
  3086. $5=$self._class();
  3087. $ctx1.sendIdx["class"]=1;
  3088. $4=$recv($5)._name();
  3089. $ctx1.sendIdx["name"]=1;
  3090. $3=$recv($4)._first();
  3091. $2=$recv($3)._isVowel();
  3092. if($core.assert($2)){
  3093. $1="an ";
  3094. } else {
  3095. $1="a ";
  3096. }
  3097. $recv(aStream)._nextPutAll_($1);
  3098. $ctx1.sendIdx["nextPutAll:"]=1;
  3099. $recv(aStream)._nextPutAll_($recv($self._class())._name());
  3100. return self;
  3101. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  3102. },
  3103. args: ["aStream"],
  3104. 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",
  3105. referencedClasses: [],
  3106. pragmas: [],
  3107. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isVowel", "first", "name", "class"]
  3108. }),
  3109. $globals.ProtoObject);
  3110. $core.addMethod(
  3111. $core.method({
  3112. selector: "printString",
  3113. protocol: "printing",
  3114. fn: function (){
  3115. var self=this,$self=this;
  3116. return $core.withContext(function($ctx1) {
  3117. return $recv($globals.String)._streamContents_((function(str){
  3118. return $core.withContext(function($ctx2) {
  3119. return $self._printOn_(str);
  3120. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  3121. }));
  3122. }, function($ctx1) {$ctx1.fill(self,"printString",{})});
  3123. },
  3124. args: [],
  3125. source: "printString\x0a\x09^ String streamContents: [ :str | \x0a\x09\x09self printOn: str ]",
  3126. referencedClasses: ["String"],
  3127. pragmas: [],
  3128. messageSends: ["streamContents:", "printOn:"]
  3129. }),
  3130. $globals.ProtoObject);
  3131. $core.addMethod(
  3132. $core.method({
  3133. selector: "yourself",
  3134. protocol: "accessing",
  3135. fn: function (){
  3136. var self=this,$self=this;
  3137. return self;
  3138. },
  3139. args: [],
  3140. source: "yourself\x0a\x09^ self",
  3141. referencedClasses: [],
  3142. pragmas: [],
  3143. messageSends: []
  3144. }),
  3145. $globals.ProtoObject);
  3146. $core.addMethod(
  3147. $core.method({
  3148. selector: "~=",
  3149. protocol: "comparing",
  3150. fn: function (anObject){
  3151. var self=this,$self=this;
  3152. return $core.withContext(function($ctx1) {
  3153. var $1;
  3154. $1=$recv($self.__eq(anObject)).__eq(false);
  3155. $ctx1.sendIdx["="]=1;
  3156. return $1;
  3157. }, function($ctx1) {$ctx1.fill(self,"~=",{anObject:anObject})});
  3158. },
  3159. args: ["anObject"],
  3160. source: "~= anObject\x0a\x09^ (self = anObject) = false",
  3161. referencedClasses: [],
  3162. pragmas: [],
  3163. messageSends: ["="]
  3164. }),
  3165. $globals.ProtoObject);
  3166. $core.addMethod(
  3167. $core.method({
  3168. selector: "~~",
  3169. protocol: "comparing",
  3170. fn: function (anObject){
  3171. var self=this,$self=this;
  3172. return $core.withContext(function($ctx1) {
  3173. return $recv($self.__eq_eq(anObject)).__eq(false);
  3174. }, function($ctx1) {$ctx1.fill(self,"~~",{anObject:anObject})});
  3175. },
  3176. args: ["anObject"],
  3177. source: "~~ anObject\x0a\x09^ (self == anObject) = false",
  3178. referencedClasses: [],
  3179. pragmas: [],
  3180. messageSends: ["=", "=="]
  3181. }),
  3182. $globals.ProtoObject);
  3183. $core.addMethod(
  3184. $core.method({
  3185. selector: "initialize",
  3186. protocol: "initialization",
  3187. fn: function (){
  3188. var self=this,$self=this;
  3189. return self;
  3190. },
  3191. args: [],
  3192. source: "initialize",
  3193. referencedClasses: [],
  3194. pragmas: [],
  3195. messageSends: []
  3196. }),
  3197. $globals.ProtoObject.a$cls);
  3198. $core.addClass("Object", $globals.ProtoObject, [], "Kernel-Objects");
  3199. $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.";
  3200. $core.addMethod(
  3201. $core.method({
  3202. selector: "->",
  3203. protocol: "converting",
  3204. fn: function (anObject){
  3205. var self=this,$self=this;
  3206. return $core.withContext(function($ctx1) {
  3207. return $recv($globals.Association)._key_value_(self,anObject);
  3208. }, function($ctx1) {$ctx1.fill(self,"->",{anObject:anObject})});
  3209. },
  3210. args: ["anObject"],
  3211. source: "-> anObject\x0a\x09^ Association key: self value: anObject",
  3212. referencedClasses: ["Association"],
  3213. pragmas: [],
  3214. messageSends: ["key:value:"]
  3215. }),
  3216. $globals.Object);
  3217. $core.addMethod(
  3218. $core.method({
  3219. selector: "asJSONString",
  3220. protocol: "converting",
  3221. fn: function (){
  3222. var self=this,$self=this;
  3223. return $core.withContext(function($ctx1) {
  3224. return $recv($globals.JSON)._stringify_($self._asJavaScriptObject());
  3225. }, function($ctx1) {$ctx1.fill(self,"asJSONString",{})});
  3226. },
  3227. args: [],
  3228. source: "asJSONString\x0a\x09^ JSON stringify: self asJavaScriptObject",
  3229. referencedClasses: ["JSON"],
  3230. pragmas: [],
  3231. messageSends: ["stringify:", "asJavaScriptObject"]
  3232. }),
  3233. $globals.Object);
  3234. $core.addMethod(
  3235. $core.method({
  3236. selector: "asJavaScriptObject",
  3237. protocol: "converting",
  3238. fn: function (){
  3239. var self=this,$self=this;
  3240. var variables;
  3241. return $core.withContext(function($ctx1) {
  3242. variables=$recv($globals.HashedCollection)._new();
  3243. $recv($recv($self._class())._allInstanceVariableNames())._do_((function(each){
  3244. return $core.withContext(function($ctx2) {
  3245. return $recv(variables)._at_put_(each,$recv($self._instVarAt_(each))._asJavaScriptObject());
  3246. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  3247. }));
  3248. return variables;
  3249. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{variables:variables})});
  3250. },
  3251. args: [],
  3252. source: "asJavaScriptObject\x0a\x09| variables |\x0a\x09variables := HashedCollection new.\x0a\x09self class allInstanceVariableNames do: [ :each |\x0a\x09\x09variables at: each put: (self instVarAt: each) asJavaScriptObject ].\x0a\x09^ variables",
  3253. referencedClasses: ["HashedCollection"],
  3254. pragmas: [],
  3255. messageSends: ["new", "do:", "allInstanceVariableNames", "class", "at:put:", "asJavaScriptObject", "instVarAt:"]
  3256. }),
  3257. $globals.Object);
  3258. $core.addMethod(
  3259. $core.method({
  3260. selector: "asJavaScriptSource",
  3261. protocol: "converting",
  3262. fn: function (){
  3263. var self=this,$self=this;
  3264. return $core.withContext(function($ctx1) {
  3265. return $self._asString();
  3266. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  3267. },
  3268. args: [],
  3269. source: "asJavaScriptSource\x0a\x09^ self asString",
  3270. referencedClasses: [],
  3271. pragmas: [],
  3272. messageSends: ["asString"]
  3273. }),
  3274. $globals.Object);
  3275. $core.addMethod(
  3276. $core.method({
  3277. selector: "basicAt:",
  3278. protocol: "accessing",
  3279. fn: function (aString){
  3280. var self=this,$self=this;
  3281. return $core.withContext(function($ctx1) {
  3282. return self[aString];
  3283. return self;
  3284. }, function($ctx1) {$ctx1.fill(self,"basicAt:",{aString:aString})});
  3285. },
  3286. args: ["aString"],
  3287. source: "basicAt: aString\x0a\x09<inlineJS: 'return self[aString]'>",
  3288. referencedClasses: [],
  3289. pragmas: [["inlineJS:", ["return self[aString]"]]],
  3290. messageSends: []
  3291. }),
  3292. $globals.Object);
  3293. $core.addMethod(
  3294. $core.method({
  3295. selector: "basicAt:put:",
  3296. protocol: "accessing",
  3297. fn: function (aString,anObject){
  3298. var self=this,$self=this;
  3299. return $core.withContext(function($ctx1) {
  3300. return self[aString] = anObject;
  3301. return self;
  3302. }, function($ctx1) {$ctx1.fill(self,"basicAt:put:",{aString:aString,anObject:anObject})});
  3303. },
  3304. args: ["aString", "anObject"],
  3305. source: "basicAt: aString put: anObject\x0a\x09<inlineJS: 'return self[aString] = anObject'>",
  3306. referencedClasses: [],
  3307. pragmas: [["inlineJS:", ["return self[aString] = anObject"]]],
  3308. messageSends: []
  3309. }),
  3310. $globals.Object);
  3311. $core.addMethod(
  3312. $core.method({
  3313. selector: "basicDelete:",
  3314. protocol: "accessing",
  3315. fn: function (aString){
  3316. var self=this,$self=this;
  3317. return $core.withContext(function($ctx1) {
  3318. delete self[aString]; return aString;
  3319. return self;
  3320. }, function($ctx1) {$ctx1.fill(self,"basicDelete:",{aString:aString})});
  3321. },
  3322. args: ["aString"],
  3323. source: "basicDelete: aString\x0a\x09<inlineJS: 'delete self[aString]; return aString'>",
  3324. referencedClasses: [],
  3325. pragmas: [["inlineJS:", ["delete self[aString]; return aString"]]],
  3326. messageSends: []
  3327. }),
  3328. $globals.Object);
  3329. $core.addMethod(
  3330. $core.method({
  3331. selector: "basicPerform:",
  3332. protocol: "message handling",
  3333. fn: function (aString){
  3334. var self=this,$self=this;
  3335. return $core.withContext(function($ctx1) {
  3336. return $self._basicPerform_withArguments_(aString,[]);
  3337. }, function($ctx1) {$ctx1.fill(self,"basicPerform:",{aString:aString})});
  3338. },
  3339. args: ["aString"],
  3340. source: "basicPerform: aString\x0a\x09^ self basicPerform: aString withArguments: #()",
  3341. referencedClasses: [],
  3342. pragmas: [],
  3343. messageSends: ["basicPerform:withArguments:"]
  3344. }),
  3345. $globals.Object);
  3346. $core.addMethod(
  3347. $core.method({
  3348. selector: "basicPerform:withArguments:",
  3349. protocol: "message handling",
  3350. fn: function (aString,aCollection){
  3351. var self=this,$self=this;
  3352. return $core.withContext(function($ctx1) {
  3353. return self[aString].apply(self, aCollection);;
  3354. return self;
  3355. }, function($ctx1) {$ctx1.fill(self,"basicPerform:withArguments:",{aString:aString,aCollection:aCollection})});
  3356. },
  3357. args: ["aString", "aCollection"],
  3358. source: "basicPerform: aString withArguments: aCollection\x0a\x09<inlineJS: 'return self[aString].apply(self, aCollection);'>",
  3359. referencedClasses: [],
  3360. pragmas: [["inlineJS:", ["return self[aString].apply(self, aCollection);"]]],
  3361. messageSends: []
  3362. }),
  3363. $globals.Object);
  3364. $core.addMethod(
  3365. $core.method({
  3366. selector: "browse",
  3367. protocol: "browsing",
  3368. fn: function (){
  3369. var self=this,$self=this;
  3370. return $core.withContext(function($ctx1) {
  3371. $recv($globals.Finder)._findClass_($self._class());
  3372. return self;
  3373. }, function($ctx1) {$ctx1.fill(self,"browse",{})});
  3374. },
  3375. args: [],
  3376. source: "browse\x0a\x09Finder findClass: self class",
  3377. referencedClasses: ["Finder"],
  3378. pragmas: [],
  3379. messageSends: ["findClass:", "class"]
  3380. }),
  3381. $globals.Object);
  3382. $core.addMethod(
  3383. $core.method({
  3384. selector: "copy",
  3385. protocol: "copying",
  3386. fn: function (){
  3387. var self=this,$self=this;
  3388. return $core.withContext(function($ctx1) {
  3389. return $recv($self._shallowCopy())._postCopy();
  3390. }, function($ctx1) {$ctx1.fill(self,"copy",{})});
  3391. },
  3392. args: [],
  3393. source: "copy\x0a\x09^ self shallowCopy postCopy",
  3394. referencedClasses: [],
  3395. pragmas: [],
  3396. messageSends: ["postCopy", "shallowCopy"]
  3397. }),
  3398. $globals.Object);
  3399. $core.addMethod(
  3400. $core.method({
  3401. selector: "deepCopy",
  3402. protocol: "copying",
  3403. fn: function (){
  3404. var self=this,$self=this;
  3405. return $core.withContext(function($ctx1) {
  3406. var copy = self.a$cls._new();
  3407. Object.keys(self).forEach(function (i) {
  3408. copy[i] = $recv(self[i])._deepCopy();
  3409. });
  3410. return copy;
  3411. ;
  3412. return self;
  3413. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{})});
  3414. },
  3415. args: [],
  3416. 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'>",
  3417. referencedClasses: [],
  3418. 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"]]],
  3419. messageSends: []
  3420. }),
  3421. $globals.Object);
  3422. $core.addMethod(
  3423. $core.method({
  3424. selector: "deprecatedAPI",
  3425. protocol: "error handling",
  3426. fn: function (){
  3427. var self=this,$self=this;
  3428. return $core.withContext(function($ctx1) {
  3429. var $1,$6,$5,$4,$8,$7,$3,$2;
  3430. $1=console;
  3431. $6=$core.getThisContext()._home();
  3432. $ctx1.sendIdx["home"]=1;
  3433. $5=$recv($6)._asString();
  3434. $ctx1.sendIdx["asString"]=1;
  3435. $4=$recv($5).__comma(" is deprecated! (in ");
  3436. $8=$recv($core.getThisContext()._home())._home();
  3437. $ctx1.sendIdx["home"]=2;
  3438. $7=$recv($8)._asString();
  3439. $3=$recv($4).__comma($7);
  3440. $ctx1.sendIdx[","]=2;
  3441. $2=$recv($3).__comma(")");
  3442. $ctx1.sendIdx[","]=1;
  3443. $recv($1)._warn_($2);
  3444. return self;
  3445. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI",{})});
  3446. },
  3447. args: [],
  3448. 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, ')'.",
  3449. referencedClasses: [],
  3450. pragmas: [],
  3451. messageSends: ["warn:", ",", "asString", "home"]
  3452. }),
  3453. $globals.Object);
  3454. $core.addMethod(
  3455. $core.method({
  3456. selector: "deprecatedAPI:",
  3457. protocol: "error handling",
  3458. fn: function (aString){
  3459. var self=this,$self=this;
  3460. return $core.withContext(function($ctx1) {
  3461. var $1,$6,$5,$4,$8,$7,$3,$2;
  3462. $1=console;
  3463. $6=$core.getThisContext()._home();
  3464. $ctx1.sendIdx["home"]=1;
  3465. $5=$recv($6)._asString();
  3466. $ctx1.sendIdx["asString"]=1;
  3467. $4=$recv($5).__comma(" is deprecated! (in ");
  3468. $8=$recv($core.getThisContext()._home())._home();
  3469. $ctx1.sendIdx["home"]=2;
  3470. $7=$recv($8)._asString();
  3471. $3=$recv($4).__comma($7);
  3472. $ctx1.sendIdx[","]=2;
  3473. $2=$recv($3).__comma(")");
  3474. $ctx1.sendIdx[","]=1;
  3475. $recv($1)._warn_($2);
  3476. $ctx1.sendIdx["warn:"]=1;
  3477. $recv(console)._warn_(aString);
  3478. return self;
  3479. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI:",{aString:aString})});
  3480. },
  3481. args: ["aString"],
  3482. 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",
  3483. referencedClasses: [],
  3484. pragmas: [],
  3485. messageSends: ["warn:", ",", "asString", "home"]
  3486. }),
  3487. $globals.Object);
  3488. $core.addMethod(
  3489. $core.method({
  3490. selector: "error:",
  3491. protocol: "error handling",
  3492. fn: function (aString){
  3493. var self=this,$self=this;
  3494. return $core.withContext(function($ctx1) {
  3495. $recv($globals.Error)._signal_(aString);
  3496. return self;
  3497. }, function($ctx1) {$ctx1.fill(self,"error:",{aString:aString})});
  3498. },
  3499. args: ["aString"],
  3500. source: "error: aString\x0a\x09Error signal: aString",
  3501. referencedClasses: ["Error"],
  3502. pragmas: [],
  3503. messageSends: ["signal:"]
  3504. }),
  3505. $globals.Object);
  3506. $core.addMethod(
  3507. $core.method({
  3508. selector: "halt",
  3509. protocol: "error handling",
  3510. fn: function (){
  3511. var self=this,$self=this;
  3512. return $core.withContext(function($ctx1) {
  3513. $recv($globals.Halt)._signal();
  3514. return self;
  3515. }, function($ctx1) {$ctx1.fill(self,"halt",{})});
  3516. },
  3517. args: [],
  3518. source: "halt\x0a\x09Halt signal",
  3519. referencedClasses: ["Halt"],
  3520. pragmas: [],
  3521. messageSends: ["signal"]
  3522. }),
  3523. $globals.Object);
  3524. $core.addMethod(
  3525. $core.method({
  3526. selector: "in:",
  3527. protocol: "evaluating",
  3528. fn: function (aValuable){
  3529. var self=this,$self=this;
  3530. return $core.withContext(function($ctx1) {
  3531. return $recv(aValuable)._value_(self);
  3532. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable})});
  3533. },
  3534. args: ["aValuable"],
  3535. source: "in: aValuable\x0a\x09^ aValuable value: self",
  3536. referencedClasses: [],
  3537. pragmas: [],
  3538. messageSends: ["value:"]
  3539. }),
  3540. $globals.Object);
  3541. $core.addMethod(
  3542. $core.method({
  3543. selector: "isBehavior",
  3544. protocol: "testing",
  3545. fn: function (){
  3546. var self=this,$self=this;
  3547. return false;
  3548. },
  3549. args: [],
  3550. source: "isBehavior\x0a\x09^ false",
  3551. referencedClasses: [],
  3552. pragmas: [],
  3553. messageSends: []
  3554. }),
  3555. $globals.Object);
  3556. $core.addMethod(
  3557. $core.method({
  3558. selector: "isBoolean",
  3559. protocol: "testing",
  3560. fn: function (){
  3561. var self=this,$self=this;
  3562. return false;
  3563. },
  3564. args: [],
  3565. source: "isBoolean\x0a\x09^ false",
  3566. referencedClasses: [],
  3567. pragmas: [],
  3568. messageSends: []
  3569. }),
  3570. $globals.Object);
  3571. $core.addMethod(
  3572. $core.method({
  3573. selector: "isClass",
  3574. protocol: "testing",
  3575. fn: function (){
  3576. var self=this,$self=this;
  3577. return false;
  3578. },
  3579. args: [],
  3580. source: "isClass\x0a\x09^ false",
  3581. referencedClasses: [],
  3582. pragmas: [],
  3583. messageSends: []
  3584. }),
  3585. $globals.Object);
  3586. $core.addMethod(
  3587. $core.method({
  3588. selector: "isCompiledMethod",
  3589. protocol: "testing",
  3590. fn: function (){
  3591. var self=this,$self=this;
  3592. return false;
  3593. },
  3594. args: [],
  3595. source: "isCompiledMethod\x0a\x09^ false",
  3596. referencedClasses: [],
  3597. pragmas: [],
  3598. messageSends: []
  3599. }),
  3600. $globals.Object);
  3601. $core.addMethod(
  3602. $core.method({
  3603. selector: "isImmutable",
  3604. protocol: "testing",
  3605. fn: function (){
  3606. var self=this,$self=this;
  3607. return false;
  3608. },
  3609. args: [],
  3610. source: "isImmutable\x0a\x09^ false",
  3611. referencedClasses: [],
  3612. pragmas: [],
  3613. messageSends: []
  3614. }),
  3615. $globals.Object);
  3616. $core.addMethod(
  3617. $core.method({
  3618. selector: "isMemberOf:",
  3619. protocol: "testing",
  3620. fn: 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. args: ["aClass"],
  3627. source: "isMemberOf: aClass\x0a\x09^ self class = aClass",
  3628. referencedClasses: [],
  3629. pragmas: [],
  3630. messageSends: ["=", "class"]
  3631. }),
  3632. $globals.Object);
  3633. $core.addMethod(
  3634. $core.method({
  3635. selector: "isMetaclass",
  3636. protocol: "testing",
  3637. fn: function (){
  3638. var self=this,$self=this;
  3639. return false;
  3640. },
  3641. args: [],
  3642. source: "isMetaclass\x0a\x09^ false",
  3643. referencedClasses: [],
  3644. pragmas: [],
  3645. messageSends: []
  3646. }),
  3647. $globals.Object);
  3648. $core.addMethod(
  3649. $core.method({
  3650. selector: "isNumber",
  3651. protocol: "testing",
  3652. fn: function (){
  3653. var self=this,$self=this;
  3654. return false;
  3655. },
  3656. args: [],
  3657. source: "isNumber\x0a\x09^ false",
  3658. referencedClasses: [],
  3659. pragmas: [],
  3660. messageSends: []
  3661. }),
  3662. $globals.Object);
  3663. $core.addMethod(
  3664. $core.method({
  3665. selector: "isPackage",
  3666. protocol: "testing",
  3667. fn: function (){
  3668. var self=this,$self=this;
  3669. return false;
  3670. },
  3671. args: [],
  3672. source: "isPackage\x0a\x09^ false",
  3673. referencedClasses: [],
  3674. pragmas: [],
  3675. messageSends: []
  3676. }),
  3677. $globals.Object);
  3678. $core.addMethod(
  3679. $core.method({
  3680. selector: "isParseFailure",
  3681. protocol: "testing",
  3682. fn: function (){
  3683. var self=this,$self=this;
  3684. return false;
  3685. },
  3686. args: [],
  3687. source: "isParseFailure\x0a\x09^ false",
  3688. referencedClasses: [],
  3689. pragmas: [],
  3690. messageSends: []
  3691. }),
  3692. $globals.Object);
  3693. $core.addMethod(
  3694. $core.method({
  3695. selector: "isString",
  3696. protocol: "testing",
  3697. fn: function (){
  3698. var self=this,$self=this;
  3699. return false;
  3700. },
  3701. args: [],
  3702. source: "isString\x0a\x09^ false",
  3703. referencedClasses: [],
  3704. pragmas: [],
  3705. messageSends: []
  3706. }),
  3707. $globals.Object);
  3708. $core.addMethod(
  3709. $core.method({
  3710. selector: "isSymbol",
  3711. protocol: "testing",
  3712. fn: function (){
  3713. var self=this,$self=this;
  3714. return false;
  3715. },
  3716. args: [],
  3717. source: "isSymbol\x0a\x09^ false",
  3718. referencedClasses: [],
  3719. pragmas: [],
  3720. messageSends: []
  3721. }),
  3722. $globals.Object);
  3723. $core.addMethod(
  3724. $core.method({
  3725. selector: "postCopy",
  3726. protocol: "copying",
  3727. fn: function (){
  3728. var self=this,$self=this;
  3729. return self;
  3730. },
  3731. args: [],
  3732. source: "postCopy",
  3733. referencedClasses: [],
  3734. pragmas: [],
  3735. messageSends: []
  3736. }),
  3737. $globals.Object);
  3738. $core.addMethod(
  3739. $core.method({
  3740. selector: "putOn:",
  3741. protocol: "streaming",
  3742. fn: function (aStream){
  3743. var self=this,$self=this;
  3744. return $core.withContext(function($ctx1) {
  3745. $recv(aStream)._nextPut_(self);
  3746. return self;
  3747. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream})});
  3748. },
  3749. args: ["aStream"],
  3750. source: "putOn: aStream\x0a\x09aStream nextPut: self",
  3751. referencedClasses: [],
  3752. pragmas: [],
  3753. messageSends: ["nextPut:"]
  3754. }),
  3755. $globals.Object);
  3756. $core.addMethod(
  3757. $core.method({
  3758. selector: "respondsTo:",
  3759. protocol: "testing",
  3760. fn: function (aSelector){
  3761. var self=this,$self=this;
  3762. return $core.withContext(function($ctx1) {
  3763. return $recv($self._class())._canUnderstand_(aSelector);
  3764. }, function($ctx1) {$ctx1.fill(self,"respondsTo:",{aSelector:aSelector})});
  3765. },
  3766. args: ["aSelector"],
  3767. source: "respondsTo: aSelector\x0a\x09^ self class canUnderstand: aSelector",
  3768. referencedClasses: [],
  3769. pragmas: [],
  3770. messageSends: ["canUnderstand:", "class"]
  3771. }),
  3772. $globals.Object);
  3773. $core.addMethod(
  3774. $core.method({
  3775. selector: "shallowCopy",
  3776. protocol: "copying",
  3777. fn: function (){
  3778. var self=this,$self=this;
  3779. return $core.withContext(function($ctx1) {
  3780. var copy = self.a$cls._new();
  3781. Object.keys(self).forEach(function(i) {
  3782. copy[i] = self[i];
  3783. });
  3784. return copy;
  3785. ;
  3786. return self;
  3787. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{})});
  3788. },
  3789. args: [],
  3790. 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'>",
  3791. referencedClasses: [],
  3792. 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"]]],
  3793. messageSends: []
  3794. }),
  3795. $globals.Object);
  3796. $core.addMethod(
  3797. $core.method({
  3798. selector: "shouldNotImplement",
  3799. protocol: "error handling",
  3800. fn: function (){
  3801. var self=this,$self=this;
  3802. return $core.withContext(function($ctx1) {
  3803. $self._error_("This method should not be implemented in ".__comma($recv($self._class())._name()));
  3804. return self;
  3805. }, function($ctx1) {$ctx1.fill(self,"shouldNotImplement",{})});
  3806. },
  3807. args: [],
  3808. source: "shouldNotImplement\x0a\x09self error: 'This method should not be implemented in ', self class name",
  3809. referencedClasses: [],
  3810. pragmas: [],
  3811. messageSends: ["error:", ",", "name", "class"]
  3812. }),
  3813. $globals.Object);
  3814. $core.addMethod(
  3815. $core.method({
  3816. selector: "size",
  3817. protocol: "accessing",
  3818. fn: function (){
  3819. var self=this,$self=this;
  3820. return $core.withContext(function($ctx1) {
  3821. $self._error_("Object not indexable");
  3822. return self;
  3823. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  3824. },
  3825. args: [],
  3826. source: "size\x0a\x09self error: 'Object not indexable'",
  3827. referencedClasses: [],
  3828. pragmas: [],
  3829. messageSends: ["error:"]
  3830. }),
  3831. $globals.Object);
  3832. $core.addMethod(
  3833. $core.method({
  3834. selector: "subclassResponsibility",
  3835. protocol: "error handling",
  3836. fn: function (){
  3837. var self=this,$self=this;
  3838. return $core.withContext(function($ctx1) {
  3839. $self._error_("This method is a responsibility of a subclass");
  3840. return self;
  3841. }, function($ctx1) {$ctx1.fill(self,"subclassResponsibility",{})});
  3842. },
  3843. args: [],
  3844. source: "subclassResponsibility\x0a\x09self error: 'This method is a responsibility of a subclass'",
  3845. referencedClasses: [],
  3846. pragmas: [],
  3847. messageSends: ["error:"]
  3848. }),
  3849. $globals.Object);
  3850. $core.addMethod(
  3851. $core.method({
  3852. selector: "value",
  3853. protocol: "evaluating",
  3854. fn: function (){
  3855. var self=this,$self=this;
  3856. return $core.withContext(function($ctx1) {
  3857. return self.valueOf();
  3858. return self;
  3859. }, function($ctx1) {$ctx1.fill(self,"value",{})});
  3860. },
  3861. args: [],
  3862. source: "value\x0a\x09<inlineJS: 'return self.valueOf()'>",
  3863. referencedClasses: [],
  3864. pragmas: [["inlineJS:", ["return self.valueOf()"]]],
  3865. messageSends: []
  3866. }),
  3867. $globals.Object);
  3868. $core.addMethod(
  3869. $core.method({
  3870. selector: "accessorProtocolWith:",
  3871. protocol: "helios",
  3872. fn: function (aGenerator){
  3873. var self=this,$self=this;
  3874. return $core.withContext(function($ctx1) {
  3875. $recv(aGenerator)._accessorProtocolForObject();
  3876. return self;
  3877. }, function($ctx1) {$ctx1.fill(self,"accessorProtocolWith:",{aGenerator:aGenerator})});
  3878. },
  3879. args: ["aGenerator"],
  3880. source: "accessorProtocolWith: aGenerator\x0a\x09aGenerator accessorProtocolForObject",
  3881. referencedClasses: [],
  3882. pragmas: [],
  3883. messageSends: ["accessorProtocolForObject"]
  3884. }),
  3885. $globals.Object.a$cls);
  3886. $core.addMethod(
  3887. $core.method({
  3888. selector: "accessorsSourceCodesWith:",
  3889. protocol: "helios",
  3890. fn: function (aGenerator){
  3891. var self=this,$self=this;
  3892. return $core.withContext(function($ctx1) {
  3893. $recv(aGenerator)._accessorsForObject();
  3894. return self;
  3895. }, function($ctx1) {$ctx1.fill(self,"accessorsSourceCodesWith:",{aGenerator:aGenerator})});
  3896. },
  3897. args: ["aGenerator"],
  3898. source: "accessorsSourceCodesWith: aGenerator\x0a\x09aGenerator accessorsForObject",
  3899. referencedClasses: [],
  3900. pragmas: [],
  3901. messageSends: ["accessorsForObject"]
  3902. }),
  3903. $globals.Object.a$cls);
  3904. $core.addMethod(
  3905. $core.method({
  3906. selector: "initialize",
  3907. protocol: "initialization",
  3908. fn: function (){
  3909. var self=this,$self=this;
  3910. return self;
  3911. },
  3912. args: [],
  3913. source: "initialize\x0a\x09\x22no op\x22",
  3914. referencedClasses: [],
  3915. pragmas: [],
  3916. messageSends: []
  3917. }),
  3918. $globals.Object.a$cls);
  3919. $core.addMethod(
  3920. $core.method({
  3921. selector: "initializeProtocolWith:",
  3922. protocol: "helios",
  3923. fn: function (aGenerator){
  3924. var self=this,$self=this;
  3925. return $core.withContext(function($ctx1) {
  3926. $recv(aGenerator)._initializeProtocolForObject();
  3927. return self;
  3928. }, function($ctx1) {$ctx1.fill(self,"initializeProtocolWith:",{aGenerator:aGenerator})});
  3929. },
  3930. args: ["aGenerator"],
  3931. source: "initializeProtocolWith: aGenerator\x0a\x09aGenerator initializeProtocolForObject",
  3932. referencedClasses: [],
  3933. pragmas: [],
  3934. messageSends: ["initializeProtocolForObject"]
  3935. }),
  3936. $globals.Object.a$cls);
  3937. $core.addMethod(
  3938. $core.method({
  3939. selector: "initializeSourceCodesWith:",
  3940. protocol: "helios",
  3941. fn: function (aGenerator){
  3942. var self=this,$self=this;
  3943. return $core.withContext(function($ctx1) {
  3944. $recv(aGenerator)._initializeForObject();
  3945. return self;
  3946. }, function($ctx1) {$ctx1.fill(self,"initializeSourceCodesWith:",{aGenerator:aGenerator})});
  3947. },
  3948. args: ["aGenerator"],
  3949. source: "initializeSourceCodesWith: aGenerator\x0a\x09aGenerator initializeForObject",
  3950. referencedClasses: [],
  3951. pragmas: [],
  3952. messageSends: ["initializeForObject"]
  3953. }),
  3954. $globals.Object.a$cls);
  3955. $core.addClass("Boolean", $globals.Object, [], "Kernel-Objects");
  3956. $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: [ ... ]";
  3957. $core.addMethod(
  3958. $core.method({
  3959. selector: "&",
  3960. protocol: "controlling",
  3961. fn: function (aBoolean){
  3962. var self=this,$self=this;
  3963. return $core.withContext(function($ctx1) {
  3964. if(self == true) {
  3965. return aBoolean;
  3966. } else {
  3967. return false;
  3968. }
  3969. ;
  3970. return self;
  3971. }, function($ctx1) {$ctx1.fill(self,"&",{aBoolean:aBoolean})});
  3972. },
  3973. args: ["aBoolean"],
  3974. 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'>",
  3975. referencedClasses: [],
  3976. pragmas: [["inlineJS:", ["\x0a\x09\x09if(self == true) {\x0a\x09\x09return aBoolean;\x0a\x09\x09} else {\x0a\x09\x09return false;\x0a\x09\x09}\x0a\x09"]]],
  3977. messageSends: []
  3978. }),
  3979. $globals.Boolean);
  3980. $core.addMethod(
  3981. $core.method({
  3982. selector: "==",
  3983. protocol: "comparing",
  3984. fn: function (aBoolean){
  3985. var self=this,$self=this;
  3986. return $core.withContext(function($ctx1) {
  3987. if (typeof aBoolean === "boolean") return (self == true) === aBoolean;
  3988. else if (aBoolean != null && typeof aBoolean === "object") return (self == true) === aBoolean.valueOf();
  3989. else return false;;
  3990. return self;
  3991. }, function($ctx1) {$ctx1.fill(self,"==",{aBoolean:aBoolean})});
  3992. },
  3993. args: ["aBoolean"],
  3994. 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'>",
  3995. referencedClasses: [],
  3996. 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;"]]],
  3997. messageSends: []
  3998. }),
  3999. $globals.Boolean);
  4000. $core.addMethod(
  4001. $core.method({
  4002. selector: "and:",
  4003. protocol: "controlling",
  4004. fn: function (aBlock){
  4005. var self=this,$self=this;
  4006. return $core.withContext(function($ctx1) {
  4007. if($core.assert(self)){
  4008. return $recv(aBlock)._value();
  4009. } else {
  4010. return false;
  4011. }
  4012. }, function($ctx1) {$ctx1.fill(self,"and:",{aBlock:aBlock})});
  4013. },
  4014. args: ["aBlock"],
  4015. source: "and: aBlock\x0a\x09^ self\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ false ]",
  4016. referencedClasses: [],
  4017. pragmas: [],
  4018. messageSends: ["ifTrue:ifFalse:", "value"]
  4019. }),
  4020. $globals.Boolean);
  4021. $core.addMethod(
  4022. $core.method({
  4023. selector: "asBit",
  4024. protocol: "converting",
  4025. fn: function (){
  4026. var self=this,$self=this;
  4027. return $core.withContext(function($ctx1) {
  4028. if($core.assert(self)){
  4029. return (1);
  4030. } else {
  4031. return (0);
  4032. }
  4033. }, function($ctx1) {$ctx1.fill(self,"asBit",{})});
  4034. },
  4035. args: [],
  4036. source: "asBit\x0a\x09^ self ifTrue: [ 1 ] ifFalse: [ 0 ]",
  4037. referencedClasses: [],
  4038. pragmas: [],
  4039. messageSends: ["ifTrue:ifFalse:"]
  4040. }),
  4041. $globals.Boolean);
  4042. $core.addMethod(
  4043. $core.method({
  4044. selector: "asJavaScriptObject",
  4045. protocol: "converting",
  4046. fn: function (){
  4047. var self=this,$self=this;
  4048. return self;
  4049. },
  4050. args: [],
  4051. source: "asJavaScriptObject\x0a\x09^ self",
  4052. referencedClasses: [],
  4053. pragmas: [],
  4054. messageSends: []
  4055. }),
  4056. $globals.Boolean);
  4057. $core.addMethod(
  4058. $core.method({
  4059. selector: "asString",
  4060. protocol: "converting",
  4061. fn: function (){
  4062. var self=this,$self=this;
  4063. return $core.withContext(function($ctx1) {
  4064. return self.toString();
  4065. return self;
  4066. }, function($ctx1) {$ctx1.fill(self,"asString",{})});
  4067. },
  4068. args: [],
  4069. source: "asString\x0a\x09<inlineJS: 'return self.toString()'>",
  4070. referencedClasses: [],
  4071. pragmas: [["inlineJS:", ["return self.toString()"]]],
  4072. messageSends: []
  4073. }),
  4074. $globals.Boolean);
  4075. $core.addMethod(
  4076. $core.method({
  4077. selector: "deepCopy",
  4078. protocol: "copying",
  4079. fn: function (){
  4080. var self=this,$self=this;
  4081. return self;
  4082. },
  4083. args: [],
  4084. source: "deepCopy\x0a\x09^ self",
  4085. referencedClasses: [],
  4086. pragmas: [],
  4087. messageSends: []
  4088. }),
  4089. $globals.Boolean);
  4090. $core.addMethod(
  4091. $core.method({
  4092. selector: "ifFalse:",
  4093. protocol: "controlling",
  4094. fn: function (aBlock){
  4095. var self=this,$self=this;
  4096. return $core.withContext(function($ctx1) {
  4097. return $self._ifTrue_ifFalse_((function(){
  4098. }),aBlock);
  4099. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{aBlock:aBlock})});
  4100. },
  4101. args: ["aBlock"],
  4102. source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: [] ifFalse: aBlock",
  4103. referencedClasses: [],
  4104. pragmas: [],
  4105. messageSends: ["ifTrue:ifFalse:"]
  4106. }),
  4107. $globals.Boolean);
  4108. $core.addMethod(
  4109. $core.method({
  4110. selector: "ifFalse:ifTrue:",
  4111. protocol: "controlling",
  4112. fn: function (aBlock,anotherBlock){
  4113. var self=this,$self=this;
  4114. return $core.withContext(function($ctx1) {
  4115. return $self._ifTrue_ifFalse_(anotherBlock,aBlock);
  4116. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  4117. },
  4118. args: ["aBlock", "anotherBlock"],
  4119. source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: anotherBlock ifFalse: aBlock",
  4120. referencedClasses: [],
  4121. pragmas: [],
  4122. messageSends: ["ifTrue:ifFalse:"]
  4123. }),
  4124. $globals.Boolean);
  4125. $core.addMethod(
  4126. $core.method({
  4127. selector: "ifTrue:",
  4128. protocol: "controlling",
  4129. fn: function (aBlock){
  4130. var self=this,$self=this;
  4131. return $core.withContext(function($ctx1) {
  4132. return $self._ifTrue_ifFalse_(aBlock,(function(){
  4133. }));
  4134. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{aBlock:aBlock})});
  4135. },
  4136. args: ["aBlock"],
  4137. source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: aBlock ifFalse: []",
  4138. referencedClasses: [],
  4139. pragmas: [],
  4140. messageSends: ["ifTrue:ifFalse:"]
  4141. }),
  4142. $globals.Boolean);
  4143. $core.addMethod(
  4144. $core.method({
  4145. selector: "ifTrue:ifFalse:",
  4146. protocol: "controlling",
  4147. fn: function (aBlock,anotherBlock){
  4148. var self=this,$self=this;
  4149. return $core.withContext(function($ctx1) {
  4150. if(self == true) {
  4151. return aBlock._value();
  4152. } else {
  4153. return anotherBlock._value();
  4154. }
  4155. ;
  4156. return self;
  4157. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  4158. },
  4159. args: ["aBlock", "anotherBlock"],
  4160. 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'>",
  4161. referencedClasses: [],
  4162. 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"]]],
  4163. messageSends: []
  4164. }),
  4165. $globals.Boolean);
  4166. $core.addMethod(
  4167. $core.method({
  4168. selector: "isBoolean",
  4169. protocol: "testing",
  4170. fn: function (){
  4171. var self=this,$self=this;
  4172. return true;
  4173. },
  4174. args: [],
  4175. source: "isBoolean\x0a\x09^ true",
  4176. referencedClasses: [],
  4177. pragmas: [],
  4178. messageSends: []
  4179. }),
  4180. $globals.Boolean);
  4181. $core.addMethod(
  4182. $core.method({
  4183. selector: "isImmutable",
  4184. protocol: "testing",
  4185. fn: function (){
  4186. var self=this,$self=this;
  4187. return true;
  4188. },
  4189. args: [],
  4190. source: "isImmutable\x0a\x09^ true",
  4191. referencedClasses: [],
  4192. pragmas: [],
  4193. messageSends: []
  4194. }),
  4195. $globals.Boolean);
  4196. $core.addMethod(
  4197. $core.method({
  4198. selector: "not",
  4199. protocol: "controlling",
  4200. fn: function (){
  4201. var self=this,$self=this;
  4202. return $core.withContext(function($ctx1) {
  4203. return $self.__eq(false);
  4204. }, function($ctx1) {$ctx1.fill(self,"not",{})});
  4205. },
  4206. args: [],
  4207. source: "not\x0a\x09^ self = false",
  4208. referencedClasses: [],
  4209. pragmas: [],
  4210. messageSends: ["="]
  4211. }),
  4212. $globals.Boolean);
  4213. $core.addMethod(
  4214. $core.method({
  4215. selector: "or:",
  4216. protocol: "controlling",
  4217. fn: function (aBlock){
  4218. var self=this,$self=this;
  4219. return $core.withContext(function($ctx1) {
  4220. if($core.assert(self)){
  4221. return true;
  4222. } else {
  4223. return $recv(aBlock)._value();
  4224. }
  4225. }, function($ctx1) {$ctx1.fill(self,"or:",{aBlock:aBlock})});
  4226. },
  4227. args: ["aBlock"],
  4228. source: "or: aBlock\x0a\x09^ self\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: \x22aBlock\x22 [ aBlock value ]",
  4229. referencedClasses: [],
  4230. pragmas: [],
  4231. messageSends: ["ifTrue:ifFalse:", "value"]
  4232. }),
  4233. $globals.Boolean);
  4234. $core.addMethod(
  4235. $core.method({
  4236. selector: "printOn:",
  4237. protocol: "printing",
  4238. fn: function (aStream){
  4239. var self=this,$self=this;
  4240. return $core.withContext(function($ctx1) {
  4241. $recv(aStream)._nextPutAll_($self._asString());
  4242. return self;
  4243. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  4244. },
  4245. args: ["aStream"],
  4246. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  4247. referencedClasses: [],
  4248. pragmas: [],
  4249. messageSends: ["nextPutAll:", "asString"]
  4250. }),
  4251. $globals.Boolean);
  4252. $core.addMethod(
  4253. $core.method({
  4254. selector: "shallowCopy",
  4255. protocol: "copying",
  4256. fn: function (){
  4257. var self=this,$self=this;
  4258. return self;
  4259. },
  4260. args: [],
  4261. source: "shallowCopy\x0a\x09^ self",
  4262. referencedClasses: [],
  4263. pragmas: [],
  4264. messageSends: []
  4265. }),
  4266. $globals.Boolean);
  4267. $core.addMethod(
  4268. $core.method({
  4269. selector: "|",
  4270. protocol: "controlling",
  4271. fn: function (aBoolean){
  4272. var self=this,$self=this;
  4273. return $core.withContext(function($ctx1) {
  4274. if(self == true) {
  4275. return true;
  4276. } else {
  4277. return aBoolean;
  4278. }
  4279. ;
  4280. return self;
  4281. }, function($ctx1) {$ctx1.fill(self,"|",{aBoolean:aBoolean})});
  4282. },
  4283. args: ["aBoolean"],
  4284. 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'>",
  4285. referencedClasses: [],
  4286. pragmas: [["inlineJS:", ["\x0a\x09\x09if(self == true) {\x0a\x09\x09return true;\x0a\x09\x09} else {\x0a\x09\x09return aBoolean;\x0a\x09\x09}\x0a\x09"]]],
  4287. messageSends: []
  4288. }),
  4289. $globals.Boolean);
  4290. $core.addClass("Date", $globals.Object, [], "Kernel-Objects");
  4291. $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.).";
  4292. $core.addMethod(
  4293. $core.method({
  4294. selector: "+",
  4295. protocol: "arithmetic",
  4296. fn: function (aNumber){
  4297. var self=this,$self=this;
  4298. return $core.withContext(function($ctx1) {
  4299. return new Date($self.getTime() + aNumber);
  4300. return self;
  4301. }, function($ctx1) {$ctx1.fill(self,"+",{aNumber:aNumber})});
  4302. },
  4303. args: ["aNumber"],
  4304. source: "+ aNumber\x0a\x09<inlineJS: 'return new Date($self.getTime() + aNumber)'>",
  4305. referencedClasses: [],
  4306. pragmas: [["inlineJS:", ["return new Date($self.getTime() + aNumber)"]]],
  4307. messageSends: []
  4308. }),
  4309. $globals.Date);
  4310. $core.addMethod(
  4311. $core.method({
  4312. selector: "-",
  4313. protocol: "arithmetic",
  4314. fn: function (aDate){
  4315. var self=this,$self=this;
  4316. return $core.withContext(function($ctx1) {
  4317. return self - aDate;
  4318. return self;
  4319. }, function($ctx1) {$ctx1.fill(self,"-",{aDate:aDate})});
  4320. },
  4321. args: ["aDate"],
  4322. source: "- aDate\x0a\x09<inlineJS: 'return self - aDate'>",
  4323. referencedClasses: [],
  4324. pragmas: [["inlineJS:", ["return self - aDate"]]],
  4325. messageSends: []
  4326. }),
  4327. $globals.Date);
  4328. $core.addMethod(
  4329. $core.method({
  4330. selector: "<",
  4331. protocol: "comparing",
  4332. fn: function (aDate){
  4333. var self=this,$self=this;
  4334. return $core.withContext(function($ctx1) {
  4335. return self < aDate;
  4336. return self;
  4337. }, function($ctx1) {$ctx1.fill(self,"<",{aDate:aDate})});
  4338. },
  4339. args: ["aDate"],
  4340. source: "< aDate\x0a\x09<inlineJS: 'return self < aDate'>",
  4341. referencedClasses: [],
  4342. pragmas: [["inlineJS:", ["return self < aDate"]]],
  4343. messageSends: []
  4344. }),
  4345. $globals.Date);
  4346. $core.addMethod(
  4347. $core.method({
  4348. selector: "<=",
  4349. protocol: "comparing",
  4350. fn: function (aDate){
  4351. var self=this,$self=this;
  4352. return $core.withContext(function($ctx1) {
  4353. return self <= aDate;
  4354. return self;
  4355. }, function($ctx1) {$ctx1.fill(self,"<=",{aDate:aDate})});
  4356. },
  4357. args: ["aDate"],
  4358. source: "<= aDate\x0a\x09<inlineJS: 'return self <= aDate'>",
  4359. referencedClasses: [],
  4360. pragmas: [["inlineJS:", ["return self <= aDate"]]],
  4361. messageSends: []
  4362. }),
  4363. $globals.Date);
  4364. $core.addMethod(
  4365. $core.method({
  4366. selector: "=",
  4367. protocol: "comparing",
  4368. fn: function (aDate){
  4369. var self=this,$self=this;
  4370. return $core.withContext(function($ctx1) {
  4371. var $2,$1,$3;
  4372. $2=$recv(aDate)._class();
  4373. $ctx1.sendIdx["class"]=1;
  4374. $1=$recv($2).__eq_eq($self._class());
  4375. $ctx1.sendIdx["=="]=1;
  4376. return $recv($1)._and_((function(){
  4377. return $core.withContext(function($ctx2) {
  4378. $3=$self._asMilliseconds();
  4379. $ctx2.sendIdx["asMilliseconds"]=1;
  4380. return $recv($3).__eq_eq($recv(aDate)._asMilliseconds());
  4381. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4382. }));
  4383. }, function($ctx1) {$ctx1.fill(self,"=",{aDate:aDate})});
  4384. },
  4385. args: ["aDate"],
  4386. source: "= aDate\x0a\x09^ (aDate class == self class) and: [ self asMilliseconds == aDate asMilliseconds ]",
  4387. referencedClasses: [],
  4388. pragmas: [],
  4389. messageSends: ["and:", "==", "class", "asMilliseconds"]
  4390. }),
  4391. $globals.Date);
  4392. $core.addMethod(
  4393. $core.method({
  4394. selector: ">",
  4395. protocol: "comparing",
  4396. fn: function (aDate){
  4397. var self=this,$self=this;
  4398. return $core.withContext(function($ctx1) {
  4399. return self > aDate;
  4400. return self;
  4401. }, function($ctx1) {$ctx1.fill(self,">",{aDate:aDate})});
  4402. },
  4403. args: ["aDate"],
  4404. source: "> aDate\x0a\x09<inlineJS: 'return self > aDate'>",
  4405. referencedClasses: [],
  4406. pragmas: [["inlineJS:", ["return self > aDate"]]],
  4407. messageSends: []
  4408. }),
  4409. $globals.Date);
  4410. $core.addMethod(
  4411. $core.method({
  4412. selector: ">=",
  4413. protocol: "comparing",
  4414. fn: function (aDate){
  4415. var self=this,$self=this;
  4416. return $core.withContext(function($ctx1) {
  4417. return self >= aDate;
  4418. return self;
  4419. }, function($ctx1) {$ctx1.fill(self,">=",{aDate:aDate})});
  4420. },
  4421. args: ["aDate"],
  4422. source: ">= aDate\x0a\x09<inlineJS: 'return self >= aDate'>",
  4423. referencedClasses: [],
  4424. pragmas: [["inlineJS:", ["return self >= aDate"]]],
  4425. messageSends: []
  4426. }),
  4427. $globals.Date);
  4428. $core.addMethod(
  4429. $core.method({
  4430. selector: "asDateString",
  4431. protocol: "converting",
  4432. fn: function (){
  4433. var self=this,$self=this;
  4434. return $core.withContext(function($ctx1) {
  4435. return self.toDateString();
  4436. return self;
  4437. }, function($ctx1) {$ctx1.fill(self,"asDateString",{})});
  4438. },
  4439. args: [],
  4440. source: "asDateString\x0a\x09<inlineJS: 'return self.toDateString()'>",
  4441. referencedClasses: [],
  4442. pragmas: [["inlineJS:", ["return self.toDateString()"]]],
  4443. messageSends: []
  4444. }),
  4445. $globals.Date);
  4446. $core.addMethod(
  4447. $core.method({
  4448. selector: "asLocaleString",
  4449. protocol: "converting",
  4450. fn: function (){
  4451. var self=this,$self=this;
  4452. return $core.withContext(function($ctx1) {
  4453. return self.toLocaleString();
  4454. return self;
  4455. }, function($ctx1) {$ctx1.fill(self,"asLocaleString",{})});
  4456. },
  4457. args: [],
  4458. source: "asLocaleString\x0a\x09<inlineJS: 'return self.toLocaleString()'>",
  4459. referencedClasses: [],
  4460. pragmas: [["inlineJS:", ["return self.toLocaleString()"]]],
  4461. messageSends: []
  4462. }),
  4463. $globals.Date);
  4464. $core.addMethod(
  4465. $core.method({
  4466. selector: "asMilliseconds",
  4467. protocol: "converting",
  4468. fn: function (){
  4469. var self=this,$self=this;
  4470. return $core.withContext(function($ctx1) {
  4471. return $self._time();
  4472. }, function($ctx1) {$ctx1.fill(self,"asMilliseconds",{})});
  4473. },
  4474. args: [],
  4475. source: "asMilliseconds\x0a\x09^ self time",
  4476. referencedClasses: [],
  4477. pragmas: [],
  4478. messageSends: ["time"]
  4479. }),
  4480. $globals.Date);
  4481. $core.addMethod(
  4482. $core.method({
  4483. selector: "asNumber",
  4484. protocol: "converting",
  4485. fn: function (){
  4486. var self=this,$self=this;
  4487. return $core.withContext(function($ctx1) {
  4488. return $self._asMilliseconds();
  4489. }, function($ctx1) {$ctx1.fill(self,"asNumber",{})});
  4490. },
  4491. args: [],
  4492. source: "asNumber\x0a\x09^ self asMilliseconds",
  4493. referencedClasses: [],
  4494. pragmas: [],
  4495. messageSends: ["asMilliseconds"]
  4496. }),
  4497. $globals.Date);
  4498. $core.addMethod(
  4499. $core.method({
  4500. selector: "asString",
  4501. protocol: "converting",
  4502. fn: function (){
  4503. var self=this,$self=this;
  4504. return $core.withContext(function($ctx1) {
  4505. return self.toString();
  4506. return self;
  4507. }, function($ctx1) {$ctx1.fill(self,"asString",{})});
  4508. },
  4509. args: [],
  4510. source: "asString\x0a\x09<inlineJS: 'return self.toString()'>",
  4511. referencedClasses: [],
  4512. pragmas: [["inlineJS:", ["return self.toString()"]]],
  4513. messageSends: []
  4514. }),
  4515. $globals.Date);
  4516. $core.addMethod(
  4517. $core.method({
  4518. selector: "asTimeString",
  4519. protocol: "converting",
  4520. fn: function (){
  4521. var self=this,$self=this;
  4522. return $core.withContext(function($ctx1) {
  4523. return self.toTimeString();
  4524. return self;
  4525. }, function($ctx1) {$ctx1.fill(self,"asTimeString",{})});
  4526. },
  4527. args: [],
  4528. source: "asTimeString\x0a\x09<inlineJS: 'return self.toTimeString()'>",
  4529. referencedClasses: [],
  4530. pragmas: [["inlineJS:", ["return self.toTimeString()"]]],
  4531. messageSends: []
  4532. }),
  4533. $globals.Date);
  4534. $core.addMethod(
  4535. $core.method({
  4536. selector: "day",
  4537. protocol: "accessing",
  4538. fn: function (){
  4539. var self=this,$self=this;
  4540. return $core.withContext(function($ctx1) {
  4541. return $self._dayOfWeek();
  4542. }, function($ctx1) {$ctx1.fill(self,"day",{})});
  4543. },
  4544. args: [],
  4545. source: "day\x0a\x09^ self dayOfWeek",
  4546. referencedClasses: [],
  4547. pragmas: [],
  4548. messageSends: ["dayOfWeek"]
  4549. }),
  4550. $globals.Date);
  4551. $core.addMethod(
  4552. $core.method({
  4553. selector: "day:",
  4554. protocol: "accessing",
  4555. fn: function (aNumber){
  4556. var self=this,$self=this;
  4557. return $core.withContext(function($ctx1) {
  4558. $self._dayOfWeek_(aNumber);
  4559. return self;
  4560. }, function($ctx1) {$ctx1.fill(self,"day:",{aNumber:aNumber})});
  4561. },
  4562. args: ["aNumber"],
  4563. source: "day: aNumber\x0a\x09self dayOfWeek: aNumber",
  4564. referencedClasses: [],
  4565. pragmas: [],
  4566. messageSends: ["dayOfWeek:"]
  4567. }),
  4568. $globals.Date);
  4569. $core.addMethod(
  4570. $core.method({
  4571. selector: "dayOfMonth",
  4572. protocol: "accessing",
  4573. fn: function (){
  4574. var self=this,$self=this;
  4575. return $core.withContext(function($ctx1) {
  4576. return self.getDate();
  4577. return self;
  4578. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth",{})});
  4579. },
  4580. args: [],
  4581. source: "dayOfMonth\x0a\x09<inlineJS: 'return self.getDate()'>",
  4582. referencedClasses: [],
  4583. pragmas: [["inlineJS:", ["return self.getDate()"]]],
  4584. messageSends: []
  4585. }),
  4586. $globals.Date);
  4587. $core.addMethod(
  4588. $core.method({
  4589. selector: "dayOfMonth:",
  4590. protocol: "accessing",
  4591. fn: function (aNumber){
  4592. var self=this,$self=this;
  4593. return $core.withContext(function($ctx1) {
  4594. self.setDate(aNumber);
  4595. return self;
  4596. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth:",{aNumber:aNumber})});
  4597. },
  4598. args: ["aNumber"],
  4599. source: "dayOfMonth: aNumber\x0a\x09<inlineJS: 'self.setDate(aNumber)'>",
  4600. referencedClasses: [],
  4601. pragmas: [["inlineJS:", ["self.setDate(aNumber)"]]],
  4602. messageSends: []
  4603. }),
  4604. $globals.Date);
  4605. $core.addMethod(
  4606. $core.method({
  4607. selector: "dayOfWeek",
  4608. protocol: "accessing",
  4609. fn: function (){
  4610. var self=this,$self=this;
  4611. return $core.withContext(function($ctx1) {
  4612. return self.getDay() + 1;
  4613. return self;
  4614. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek",{})});
  4615. },
  4616. args: [],
  4617. source: "dayOfWeek\x0a\x09<inlineJS: 'return self.getDay() + 1'>",
  4618. referencedClasses: [],
  4619. pragmas: [["inlineJS:", ["return self.getDay() + 1"]]],
  4620. messageSends: []
  4621. }),
  4622. $globals.Date);
  4623. $core.addMethod(
  4624. $core.method({
  4625. selector: "dayOfWeek:",
  4626. protocol: "accessing",
  4627. fn: function (aNumber){
  4628. var self=this,$self=this;
  4629. return $core.withContext(function($ctx1) {
  4630. return self.setDay(aNumber - 1);
  4631. return self;
  4632. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek:",{aNumber:aNumber})});
  4633. },
  4634. args: ["aNumber"],
  4635. source: "dayOfWeek: aNumber\x0a\x09<inlineJS: 'return self.setDay(aNumber - 1)'>",
  4636. referencedClasses: [],
  4637. pragmas: [["inlineJS:", ["return self.setDay(aNumber - 1)"]]],
  4638. messageSends: []
  4639. }),
  4640. $globals.Date);
  4641. $core.addMethod(
  4642. $core.method({
  4643. selector: "hours",
  4644. protocol: "accessing",
  4645. fn: function (){
  4646. var self=this,$self=this;
  4647. return $core.withContext(function($ctx1) {
  4648. return self.getHours();
  4649. return self;
  4650. }, function($ctx1) {$ctx1.fill(self,"hours",{})});
  4651. },
  4652. args: [],
  4653. source: "hours\x0a\x09<inlineJS: 'return self.getHours()'>",
  4654. referencedClasses: [],
  4655. pragmas: [["inlineJS:", ["return self.getHours()"]]],
  4656. messageSends: []
  4657. }),
  4658. $globals.Date);
  4659. $core.addMethod(
  4660. $core.method({
  4661. selector: "hours:",
  4662. protocol: "accessing",
  4663. fn: function (aNumber){
  4664. var self=this,$self=this;
  4665. return $core.withContext(function($ctx1) {
  4666. self.setHours(aNumber);
  4667. return self;
  4668. }, function($ctx1) {$ctx1.fill(self,"hours:",{aNumber:aNumber})});
  4669. },
  4670. args: ["aNumber"],
  4671. source: "hours: aNumber\x0a\x09<inlineJS: 'self.setHours(aNumber)'>",
  4672. referencedClasses: [],
  4673. pragmas: [["inlineJS:", ["self.setHours(aNumber)"]]],
  4674. messageSends: []
  4675. }),
  4676. $globals.Date);
  4677. $core.addMethod(
  4678. $core.method({
  4679. selector: "milliseconds",
  4680. protocol: "accessing",
  4681. fn: function (){
  4682. var self=this,$self=this;
  4683. return $core.withContext(function($ctx1) {
  4684. return self.getMilliseconds();
  4685. return self;
  4686. }, function($ctx1) {$ctx1.fill(self,"milliseconds",{})});
  4687. },
  4688. args: [],
  4689. source: "milliseconds\x0a\x09<inlineJS: 'return self.getMilliseconds()'>",
  4690. referencedClasses: [],
  4691. pragmas: [["inlineJS:", ["return self.getMilliseconds()"]]],
  4692. messageSends: []
  4693. }),
  4694. $globals.Date);
  4695. $core.addMethod(
  4696. $core.method({
  4697. selector: "milliseconds:",
  4698. protocol: "accessing",
  4699. fn: function (aNumber){
  4700. var self=this,$self=this;
  4701. return $core.withContext(function($ctx1) {
  4702. self.setMilliseconds(aNumber);
  4703. return self;
  4704. }, function($ctx1) {$ctx1.fill(self,"milliseconds:",{aNumber:aNumber})});
  4705. },
  4706. args: ["aNumber"],
  4707. source: "milliseconds: aNumber\x0a\x09<inlineJS: 'self.setMilliseconds(aNumber)'>",
  4708. referencedClasses: [],
  4709. pragmas: [["inlineJS:", ["self.setMilliseconds(aNumber)"]]],
  4710. messageSends: []
  4711. }),
  4712. $globals.Date);
  4713. $core.addMethod(
  4714. $core.method({
  4715. selector: "minutes",
  4716. protocol: "accessing",
  4717. fn: function (){
  4718. var self=this,$self=this;
  4719. return $core.withContext(function($ctx1) {
  4720. return self.getMinutes();
  4721. return self;
  4722. }, function($ctx1) {$ctx1.fill(self,"minutes",{})});
  4723. },
  4724. args: [],
  4725. source: "minutes\x0a\x09<inlineJS: 'return self.getMinutes()'>",
  4726. referencedClasses: [],
  4727. pragmas: [["inlineJS:", ["return self.getMinutes()"]]],
  4728. messageSends: []
  4729. }),
  4730. $globals.Date);
  4731. $core.addMethod(
  4732. $core.method({
  4733. selector: "minutes:",
  4734. protocol: "accessing",
  4735. fn: function (aNumber){
  4736. var self=this,$self=this;
  4737. return $core.withContext(function($ctx1) {
  4738. self.setMinutes(aNumber);
  4739. return self;
  4740. }, function($ctx1) {$ctx1.fill(self,"minutes:",{aNumber:aNumber})});
  4741. },
  4742. args: ["aNumber"],
  4743. source: "minutes: aNumber\x0a\x09<inlineJS: 'self.setMinutes(aNumber)'>",
  4744. referencedClasses: [],
  4745. pragmas: [["inlineJS:", ["self.setMinutes(aNumber)"]]],
  4746. messageSends: []
  4747. }),
  4748. $globals.Date);
  4749. $core.addMethod(
  4750. $core.method({
  4751. selector: "month",
  4752. protocol: "accessing",
  4753. fn: function (){
  4754. var self=this,$self=this;
  4755. return $core.withContext(function($ctx1) {
  4756. return self.getMonth() + 1;
  4757. return self;
  4758. }, function($ctx1) {$ctx1.fill(self,"month",{})});
  4759. },
  4760. args: [],
  4761. source: "month\x0a\x09<inlineJS: 'return self.getMonth() + 1'>",
  4762. referencedClasses: [],
  4763. pragmas: [["inlineJS:", ["return self.getMonth() + 1"]]],
  4764. messageSends: []
  4765. }),
  4766. $globals.Date);
  4767. $core.addMethod(
  4768. $core.method({
  4769. selector: "month:",
  4770. protocol: "accessing",
  4771. fn: function (aNumber){
  4772. var self=this,$self=this;
  4773. return $core.withContext(function($ctx1) {
  4774. self.setMonth(aNumber - 1);
  4775. return self;
  4776. }, function($ctx1) {$ctx1.fill(self,"month:",{aNumber:aNumber})});
  4777. },
  4778. args: ["aNumber"],
  4779. source: "month: aNumber\x0a\x09<inlineJS: 'self.setMonth(aNumber - 1)'>",
  4780. referencedClasses: [],
  4781. pragmas: [["inlineJS:", ["self.setMonth(aNumber - 1)"]]],
  4782. messageSends: []
  4783. }),
  4784. $globals.Date);
  4785. $core.addMethod(
  4786. $core.method({
  4787. selector: "printOn:",
  4788. protocol: "printing",
  4789. fn: function (aStream){
  4790. var self=this,$self=this;
  4791. return $core.withContext(function($ctx1) {
  4792. $recv(aStream)._nextPutAll_($self._asString());
  4793. return self;
  4794. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  4795. },
  4796. args: ["aStream"],
  4797. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  4798. referencedClasses: [],
  4799. pragmas: [],
  4800. messageSends: ["nextPutAll:", "asString"]
  4801. }),
  4802. $globals.Date);
  4803. $core.addMethod(
  4804. $core.method({
  4805. selector: "seconds",
  4806. protocol: "accessing",
  4807. fn: function (){
  4808. var self=this,$self=this;
  4809. return $core.withContext(function($ctx1) {
  4810. return self.getSeconds();
  4811. return self;
  4812. }, function($ctx1) {$ctx1.fill(self,"seconds",{})});
  4813. },
  4814. args: [],
  4815. source: "seconds\x0a\x09<inlineJS: 'return self.getSeconds()'>",
  4816. referencedClasses: [],
  4817. pragmas: [["inlineJS:", ["return self.getSeconds()"]]],
  4818. messageSends: []
  4819. }),
  4820. $globals.Date);
  4821. $core.addMethod(
  4822. $core.method({
  4823. selector: "seconds:",
  4824. protocol: "accessing",
  4825. fn: function (aNumber){
  4826. var self=this,$self=this;
  4827. return $core.withContext(function($ctx1) {
  4828. self.setSeconds(aNumber);
  4829. return self;
  4830. }, function($ctx1) {$ctx1.fill(self,"seconds:",{aNumber:aNumber})});
  4831. },
  4832. args: ["aNumber"],
  4833. source: "seconds: aNumber\x0a\x09<inlineJS: 'self.setSeconds(aNumber)'>",
  4834. referencedClasses: [],
  4835. pragmas: [["inlineJS:", ["self.setSeconds(aNumber)"]]],
  4836. messageSends: []
  4837. }),
  4838. $globals.Date);
  4839. $core.addMethod(
  4840. $core.method({
  4841. selector: "time",
  4842. protocol: "accessing",
  4843. fn: function (){
  4844. var self=this,$self=this;
  4845. return $core.withContext(function($ctx1) {
  4846. return self.getTime();
  4847. return self;
  4848. }, function($ctx1) {$ctx1.fill(self,"time",{})});
  4849. },
  4850. args: [],
  4851. source: "time\x0a\x09<inlineJS: 'return self.getTime()'>",
  4852. referencedClasses: [],
  4853. pragmas: [["inlineJS:", ["return self.getTime()"]]],
  4854. messageSends: []
  4855. }),
  4856. $globals.Date);
  4857. $core.addMethod(
  4858. $core.method({
  4859. selector: "time:",
  4860. protocol: "accessing",
  4861. fn: function (aNumber){
  4862. var self=this,$self=this;
  4863. return $core.withContext(function($ctx1) {
  4864. self.setTime(aNumber);
  4865. return self;
  4866. }, function($ctx1) {$ctx1.fill(self,"time:",{aNumber:aNumber})});
  4867. },
  4868. args: ["aNumber"],
  4869. source: "time: aNumber\x0a\x09<inlineJS: 'self.setTime(aNumber)'>",
  4870. referencedClasses: [],
  4871. pragmas: [["inlineJS:", ["self.setTime(aNumber)"]]],
  4872. messageSends: []
  4873. }),
  4874. $globals.Date);
  4875. $core.addMethod(
  4876. $core.method({
  4877. selector: "year",
  4878. protocol: "accessing",
  4879. fn: function (){
  4880. var self=this,$self=this;
  4881. return $core.withContext(function($ctx1) {
  4882. return self.getFullYear();
  4883. return self;
  4884. }, function($ctx1) {$ctx1.fill(self,"year",{})});
  4885. },
  4886. args: [],
  4887. source: "year\x0a\x09<inlineJS: 'return self.getFullYear()'>",
  4888. referencedClasses: [],
  4889. pragmas: [["inlineJS:", ["return self.getFullYear()"]]],
  4890. messageSends: []
  4891. }),
  4892. $globals.Date);
  4893. $core.addMethod(
  4894. $core.method({
  4895. selector: "year:",
  4896. protocol: "accessing",
  4897. fn: function (aNumber){
  4898. var self=this,$self=this;
  4899. return $core.withContext(function($ctx1) {
  4900. self.setFullYear(aNumber);
  4901. return self;
  4902. }, function($ctx1) {$ctx1.fill(self,"year:",{aNumber:aNumber})});
  4903. },
  4904. args: ["aNumber"],
  4905. source: "year: aNumber\x0a\x09<inlineJS: 'self.setFullYear(aNumber)'>",
  4906. referencedClasses: [],
  4907. pragmas: [["inlineJS:", ["self.setFullYear(aNumber)"]]],
  4908. messageSends: []
  4909. }),
  4910. $globals.Date);
  4911. $core.addMethod(
  4912. $core.method({
  4913. selector: "classTag",
  4914. protocol: "accessing",
  4915. fn: function (){
  4916. var self=this,$self=this;
  4917. return "magnitude";
  4918. },
  4919. args: [],
  4920. 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'",
  4921. referencedClasses: [],
  4922. pragmas: [],
  4923. messageSends: []
  4924. }),
  4925. $globals.Date.a$cls);
  4926. $core.addMethod(
  4927. $core.method({
  4928. selector: "fromMilliseconds:",
  4929. protocol: "instance creation",
  4930. fn: function (aNumber){
  4931. var self=this,$self=this;
  4932. return $core.withContext(function($ctx1) {
  4933. return $self._new_(aNumber);
  4934. }, function($ctx1) {$ctx1.fill(self,"fromMilliseconds:",{aNumber:aNumber})});
  4935. },
  4936. args: ["aNumber"],
  4937. source: "fromMilliseconds: aNumber\x0a\x09^ self new: aNumber",
  4938. referencedClasses: [],
  4939. pragmas: [],
  4940. messageSends: ["new:"]
  4941. }),
  4942. $globals.Date.a$cls);
  4943. $core.addMethod(
  4944. $core.method({
  4945. selector: "fromSeconds:",
  4946. protocol: "instance creation",
  4947. fn: function (aNumber){
  4948. var self=this,$self=this;
  4949. return $core.withContext(function($ctx1) {
  4950. return $self._fromMilliseconds_($recv(aNumber).__star((1000)));
  4951. }, function($ctx1) {$ctx1.fill(self,"fromSeconds:",{aNumber:aNumber})});
  4952. },
  4953. args: ["aNumber"],
  4954. source: "fromSeconds: aNumber\x0a\x09^ self fromMilliseconds: aNumber * 1000",
  4955. referencedClasses: [],
  4956. pragmas: [],
  4957. messageSends: ["fromMilliseconds:", "*"]
  4958. }),
  4959. $globals.Date.a$cls);
  4960. $core.addMethod(
  4961. $core.method({
  4962. selector: "fromString:",
  4963. protocol: "instance creation",
  4964. fn: function (aString){
  4965. var self=this,$self=this;
  4966. return $core.withContext(function($ctx1) {
  4967. return $self._new_(aString);
  4968. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString})});
  4969. },
  4970. args: ["aString"],
  4971. source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^ self new: aString",
  4972. referencedClasses: [],
  4973. pragmas: [],
  4974. messageSends: ["new:"]
  4975. }),
  4976. $globals.Date.a$cls);
  4977. $core.addMethod(
  4978. $core.method({
  4979. selector: "millisecondsToRun:",
  4980. protocol: "instance creation",
  4981. fn: function (aBlock){
  4982. var self=this,$self=this;
  4983. var t;
  4984. return $core.withContext(function($ctx1) {
  4985. t=$recv($globals.Date)._now();
  4986. $ctx1.sendIdx["now"]=1;
  4987. $recv(aBlock)._value();
  4988. return $recv($recv($globals.Date)._now()).__minus(t);
  4989. }, function($ctx1) {$ctx1.fill(self,"millisecondsToRun:",{aBlock:aBlock,t:t})});
  4990. },
  4991. args: ["aBlock"],
  4992. source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^ Date now - t",
  4993. referencedClasses: ["Date"],
  4994. pragmas: [],
  4995. messageSends: ["now", "value", "-"]
  4996. }),
  4997. $globals.Date.a$cls);
  4998. $core.addMethod(
  4999. $core.method({
  5000. selector: "new:",
  5001. protocol: "instance creation",
  5002. fn: function (anObject){
  5003. var self=this,$self=this;
  5004. return $core.withContext(function($ctx1) {
  5005. return new Date(anObject);
  5006. return self;
  5007. }, function($ctx1) {$ctx1.fill(self,"new:",{anObject:anObject})});
  5008. },
  5009. args: ["anObject"],
  5010. source: "new: anObject\x0a\x09<inlineJS: 'return new Date(anObject)'>",
  5011. referencedClasses: [],
  5012. pragmas: [["inlineJS:", ["return new Date(anObject)"]]],
  5013. messageSends: []
  5014. }),
  5015. $globals.Date.a$cls);
  5016. $core.addMethod(
  5017. $core.method({
  5018. selector: "now",
  5019. protocol: "instance creation",
  5020. fn: function (){
  5021. var self=this,$self=this;
  5022. return $core.withContext(function($ctx1) {
  5023. return $self._today();
  5024. }, function($ctx1) {$ctx1.fill(self,"now",{})});
  5025. },
  5026. args: [],
  5027. source: "now\x0a\x09^ self today",
  5028. referencedClasses: [],
  5029. pragmas: [],
  5030. messageSends: ["today"]
  5031. }),
  5032. $globals.Date.a$cls);
  5033. $core.addMethod(
  5034. $core.method({
  5035. selector: "today",
  5036. protocol: "instance creation",
  5037. fn: function (){
  5038. var self=this,$self=this;
  5039. return $core.withContext(function($ctx1) {
  5040. return $self._new();
  5041. }, function($ctx1) {$ctx1.fill(self,"today",{})});
  5042. },
  5043. args: [],
  5044. source: "today\x0a\x09^ self new",
  5045. referencedClasses: [],
  5046. pragmas: [],
  5047. messageSends: ["new"]
  5048. }),
  5049. $globals.Date.a$cls);
  5050. $core.addClass("Number", $globals.Object, [], "Kernel-Objects");
  5051. $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 ].";
  5052. $core.addMethod(
  5053. $core.method({
  5054. selector: "&",
  5055. protocol: "converting",
  5056. fn: function (aNumber){
  5057. var self=this,$self=this;
  5058. return $core.withContext(function($ctx1) {
  5059. return self & aNumber;
  5060. return self;
  5061. }, function($ctx1) {$ctx1.fill(self,"&",{aNumber:aNumber})});
  5062. },
  5063. args: ["aNumber"],
  5064. source: "& aNumber\x0a\x09<inlineJS: 'return self & aNumber'>",
  5065. referencedClasses: [],
  5066. pragmas: [["inlineJS:", ["return self & aNumber"]]],
  5067. messageSends: []
  5068. }),
  5069. $globals.Number);
  5070. $core.addMethod(
  5071. $core.method({
  5072. selector: "*",
  5073. protocol: "arithmetic",
  5074. fn: function (aNumber){
  5075. var self=this,$self=this;
  5076. return $core.withContext(function($ctx1) {
  5077. return self * aNumber;
  5078. return self;
  5079. }, function($ctx1) {$ctx1.fill(self,"*",{aNumber:aNumber})});
  5080. },
  5081. args: ["aNumber"],
  5082. source: "* aNumber\x0a\x09<inlineJS: 'return self * aNumber'>",
  5083. referencedClasses: [],
  5084. pragmas: [["inlineJS:", ["return self * aNumber"]]],
  5085. messageSends: []
  5086. }),
  5087. $globals.Number);
  5088. $core.addMethod(
  5089. $core.method({
  5090. selector: "**",
  5091. protocol: "mathematical functions",
  5092. fn: function (exponent){
  5093. var self=this,$self=this;
  5094. return $core.withContext(function($ctx1) {
  5095. return $self._raisedTo_(exponent);
  5096. }, function($ctx1) {$ctx1.fill(self,"**",{exponent:exponent})});
  5097. },
  5098. args: ["exponent"],
  5099. source: "** exponent\x0a\x09^ self raisedTo: exponent",
  5100. referencedClasses: [],
  5101. pragmas: [],
  5102. messageSends: ["raisedTo:"]
  5103. }),
  5104. $globals.Number);
  5105. $core.addMethod(
  5106. $core.method({
  5107. selector: "+",
  5108. protocol: "arithmetic",
  5109. fn: function (aNumber){
  5110. var self=this,$self=this;
  5111. return $core.withContext(function($ctx1) {
  5112. return self + aNumber;
  5113. return self;
  5114. }, function($ctx1) {$ctx1.fill(self,"+",{aNumber:aNumber})});
  5115. },
  5116. args: ["aNumber"],
  5117. source: "+ aNumber\x0a\x09<inlineJS: 'return self + aNumber'>",
  5118. referencedClasses: [],
  5119. pragmas: [["inlineJS:", ["return self + aNumber"]]],
  5120. messageSends: []
  5121. }),
  5122. $globals.Number);
  5123. $core.addMethod(
  5124. $core.method({
  5125. selector: "-",
  5126. protocol: "arithmetic",
  5127. fn: function (aNumber){
  5128. var self=this,$self=this;
  5129. return $core.withContext(function($ctx1) {
  5130. return self - aNumber;
  5131. return self;
  5132. }, function($ctx1) {$ctx1.fill(self,"-",{aNumber:aNumber})});
  5133. },
  5134. args: ["aNumber"],
  5135. source: "- aNumber\x0a\x09<inlineJS: 'return self - aNumber'>",
  5136. referencedClasses: [],
  5137. pragmas: [["inlineJS:", ["return self - aNumber"]]],
  5138. messageSends: []
  5139. }),
  5140. $globals.Number);
  5141. $core.addMethod(
  5142. $core.method({
  5143. selector: "/",
  5144. protocol: "arithmetic",
  5145. fn: function (aNumber){
  5146. var self=this,$self=this;
  5147. return $core.withContext(function($ctx1) {
  5148. return self / aNumber;
  5149. return self;
  5150. }, function($ctx1) {$ctx1.fill(self,"/",{aNumber:aNumber})});
  5151. },
  5152. args: ["aNumber"],
  5153. source: "/ aNumber\x0a\x09<inlineJS: 'return self / aNumber'>",
  5154. referencedClasses: [],
  5155. pragmas: [["inlineJS:", ["return self / aNumber"]]],
  5156. messageSends: []
  5157. }),
  5158. $globals.Number);
  5159. $core.addMethod(
  5160. $core.method({
  5161. selector: "//",
  5162. protocol: "arithmetic",
  5163. fn: function (aNumber){
  5164. var self=this,$self=this;
  5165. return $core.withContext(function($ctx1) {
  5166. return $recv($self.__slash(aNumber))._floor();
  5167. }, function($ctx1) {$ctx1.fill(self,"//",{aNumber:aNumber})});
  5168. },
  5169. args: ["aNumber"],
  5170. source: "// aNumber\x0a\x09^ (self / aNumber) floor",
  5171. referencedClasses: [],
  5172. pragmas: [],
  5173. messageSends: ["floor", "/"]
  5174. }),
  5175. $globals.Number);
  5176. $core.addMethod(
  5177. $core.method({
  5178. selector: "<",
  5179. protocol: "comparing",
  5180. fn: function (aNumber){
  5181. var self=this,$self=this;
  5182. return $core.withContext(function($ctx1) {
  5183. return self < aNumber;
  5184. return self;
  5185. }, function($ctx1) {$ctx1.fill(self,"<",{aNumber:aNumber})});
  5186. },
  5187. args: ["aNumber"],
  5188. source: "< aNumber\x0a\x09<inlineJS: 'return self < aNumber'>",
  5189. referencedClasses: [],
  5190. pragmas: [["inlineJS:", ["return self < aNumber"]]],
  5191. messageSends: []
  5192. }),
  5193. $globals.Number);
  5194. $core.addMethod(
  5195. $core.method({
  5196. selector: "<=",
  5197. protocol: "comparing",
  5198. fn: function (aNumber){
  5199. var self=this,$self=this;
  5200. return $core.withContext(function($ctx1) {
  5201. return self <= aNumber;
  5202. return self;
  5203. }, function($ctx1) {$ctx1.fill(self,"<=",{aNumber:aNumber})});
  5204. },
  5205. args: ["aNumber"],
  5206. source: "<= aNumber\x0a\x09<inlineJS: 'return self <= aNumber'>",
  5207. referencedClasses: [],
  5208. pragmas: [["inlineJS:", ["return self <= aNumber"]]],
  5209. messageSends: []
  5210. }),
  5211. $globals.Number);
  5212. $core.addMethod(
  5213. $core.method({
  5214. selector: "==",
  5215. protocol: "comparing",
  5216. fn: function (aNumber){
  5217. var self=this,$self=this;
  5218. return $core.withContext(function($ctx1) {
  5219. if (typeof aNumber === "number") return Number(self) === aNumber;
  5220. else if (aNumber != null && typeof aNumber === "object") return Number(self) === aNumber.valueOf();
  5221. else return false;;
  5222. return self;
  5223. }, function($ctx1) {$ctx1.fill(self,"==",{aNumber:aNumber})});
  5224. },
  5225. args: ["aNumber"],
  5226. 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'>",
  5227. referencedClasses: [],
  5228. 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;"]]],
  5229. messageSends: []
  5230. }),
  5231. $globals.Number);
  5232. $core.addMethod(
  5233. $core.method({
  5234. selector: ">",
  5235. protocol: "comparing",
  5236. fn: function (aNumber){
  5237. var self=this,$self=this;
  5238. return $core.withContext(function($ctx1) {
  5239. return self > aNumber;
  5240. return self;
  5241. }, function($ctx1) {$ctx1.fill(self,">",{aNumber:aNumber})});
  5242. },
  5243. args: ["aNumber"],
  5244. source: "> aNumber\x0a\x09<inlineJS: 'return self > aNumber'>",
  5245. referencedClasses: [],
  5246. pragmas: [["inlineJS:", ["return self > aNumber"]]],
  5247. messageSends: []
  5248. }),
  5249. $globals.Number);
  5250. $core.addMethod(
  5251. $core.method({
  5252. selector: ">=",
  5253. protocol: "comparing",
  5254. fn: function (aNumber){
  5255. var self=this,$self=this;
  5256. return $core.withContext(function($ctx1) {
  5257. return self >= aNumber;
  5258. return self;
  5259. }, function($ctx1) {$ctx1.fill(self,">=",{aNumber:aNumber})});
  5260. },
  5261. args: ["aNumber"],
  5262. source: ">= aNumber\x0a\x09<inlineJS: 'return self >= aNumber'>",
  5263. referencedClasses: [],
  5264. pragmas: [["inlineJS:", ["return self >= aNumber"]]],
  5265. messageSends: []
  5266. }),
  5267. $globals.Number);
  5268. $core.addMethod(
  5269. $core.method({
  5270. selector: "@",
  5271. protocol: "converting",
  5272. fn: function (aNumber){
  5273. var self=this,$self=this;
  5274. return $core.withContext(function($ctx1) {
  5275. return $recv($globals.Point)._x_y_(self,aNumber);
  5276. }, function($ctx1) {$ctx1.fill(self,"@",{aNumber:aNumber})});
  5277. },
  5278. args: ["aNumber"],
  5279. source: "@ aNumber\x0a\x09^ Point x: self y: aNumber",
  5280. referencedClasses: ["Point"],
  5281. pragmas: [],
  5282. messageSends: ["x:y:"]
  5283. }),
  5284. $globals.Number);
  5285. $core.addMethod(
  5286. $core.method({
  5287. selector: "\x5c\x5c",
  5288. protocol: "arithmetic",
  5289. fn: function (aNumber){
  5290. var self=this,$self=this;
  5291. return $core.withContext(function($ctx1) {
  5292. return self % aNumber;
  5293. return self;
  5294. }, function($ctx1) {$ctx1.fill(self,"\x5c\x5c",{aNumber:aNumber})});
  5295. },
  5296. args: ["aNumber"],
  5297. source: "\x5c\x5c aNumber\x0a\x09<inlineJS: 'return self % aNumber'>",
  5298. referencedClasses: [],
  5299. pragmas: [["inlineJS:", ["return self % aNumber"]]],
  5300. messageSends: []
  5301. }),
  5302. $globals.Number);
  5303. $core.addMethod(
  5304. $core.method({
  5305. selector: "abs",
  5306. protocol: "arithmetic",
  5307. fn: function (){
  5308. var self=this,$self=this;
  5309. return $core.withContext(function($ctx1) {
  5310. return Math.abs(self);;
  5311. return self;
  5312. }, function($ctx1) {$ctx1.fill(self,"abs",{})});
  5313. },
  5314. args: [],
  5315. source: "abs\x0a\x09<inlineJS: 'return Math.abs(self);'>",
  5316. referencedClasses: [],
  5317. pragmas: [["inlineJS:", ["return Math.abs(self);"]]],
  5318. messageSends: []
  5319. }),
  5320. $globals.Number);
  5321. $core.addMethod(
  5322. $core.method({
  5323. selector: "arcCos",
  5324. protocol: "mathematical functions",
  5325. fn: function (){
  5326. var self=this,$self=this;
  5327. return $core.withContext(function($ctx1) {
  5328. return Math.acos(self);;
  5329. return self;
  5330. }, function($ctx1) {$ctx1.fill(self,"arcCos",{})});
  5331. },
  5332. args: [],
  5333. source: "arcCos\x0a\x09<inlineJS: 'return Math.acos(self);'>",
  5334. referencedClasses: [],
  5335. pragmas: [["inlineJS:", ["return Math.acos(self);"]]],
  5336. messageSends: []
  5337. }),
  5338. $globals.Number);
  5339. $core.addMethod(
  5340. $core.method({
  5341. selector: "arcSin",
  5342. protocol: "mathematical functions",
  5343. fn: function (){
  5344. var self=this,$self=this;
  5345. return $core.withContext(function($ctx1) {
  5346. return Math.asin(self);;
  5347. return self;
  5348. }, function($ctx1) {$ctx1.fill(self,"arcSin",{})});
  5349. },
  5350. args: [],
  5351. source: "arcSin\x0a\x09<inlineJS: 'return Math.asin(self);'>",
  5352. referencedClasses: [],
  5353. pragmas: [["inlineJS:", ["return Math.asin(self);"]]],
  5354. messageSends: []
  5355. }),
  5356. $globals.Number);
  5357. $core.addMethod(
  5358. $core.method({
  5359. selector: "arcTan",
  5360. protocol: "mathematical functions",
  5361. fn: function (){
  5362. var self=this,$self=this;
  5363. return $core.withContext(function($ctx1) {
  5364. return Math.atan(self);;
  5365. return self;
  5366. }, function($ctx1) {$ctx1.fill(self,"arcTan",{})});
  5367. },
  5368. args: [],
  5369. source: "arcTan\x0a\x09<inlineJS: 'return Math.atan(self);'>",
  5370. referencedClasses: [],
  5371. pragmas: [["inlineJS:", ["return Math.atan(self);"]]],
  5372. messageSends: []
  5373. }),
  5374. $globals.Number);
  5375. $core.addMethod(
  5376. $core.method({
  5377. selector: "arcTan:",
  5378. protocol: "mathematical functions",
  5379. fn: function (aNumber){
  5380. var self=this,$self=this;
  5381. return $core.withContext(function($ctx1) {
  5382. return Math.atan2(self, aNumber);;
  5383. return self;
  5384. }, function($ctx1) {$ctx1.fill(self,"arcTan:",{aNumber:aNumber})});
  5385. },
  5386. args: ["aNumber"],
  5387. source: "arcTan: aNumber\x0a\x09<inlineJS: 'return Math.atan2(self, aNumber);'>",
  5388. referencedClasses: [],
  5389. pragmas: [["inlineJS:", ["return Math.atan2(self, aNumber);"]]],
  5390. messageSends: []
  5391. }),
  5392. $globals.Number);
  5393. $core.addMethod(
  5394. $core.method({
  5395. selector: "asJavaScriptObject",
  5396. protocol: "converting",
  5397. fn: function (){
  5398. var self=this,$self=this;
  5399. return self;
  5400. },
  5401. args: [],
  5402. source: "asJavaScriptObject\x0a\x09^ self",
  5403. referencedClasses: [],
  5404. pragmas: [],
  5405. messageSends: []
  5406. }),
  5407. $globals.Number);
  5408. $core.addMethod(
  5409. $core.method({
  5410. selector: "asJavaScriptSource",
  5411. protocol: "converting",
  5412. fn: function (){
  5413. var self=this,$self=this;
  5414. return $core.withContext(function($ctx1) {
  5415. var $1;
  5416. $1=$recv("(".__comma($self._printString())).__comma(")");
  5417. $ctx1.sendIdx[","]=1;
  5418. return $1;
  5419. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  5420. },
  5421. args: [],
  5422. source: "asJavaScriptSource\x0a\x09^ '(', self printString, ')'",
  5423. referencedClasses: [],
  5424. pragmas: [],
  5425. messageSends: [",", "printString"]
  5426. }),
  5427. $globals.Number);
  5428. $core.addMethod(
  5429. $core.method({
  5430. selector: "asNumber",
  5431. protocol: "converting",
  5432. fn: function (){
  5433. var self=this,$self=this;
  5434. return self;
  5435. },
  5436. args: [],
  5437. source: "asNumber\x0a\x09^ self",
  5438. referencedClasses: [],
  5439. pragmas: [],
  5440. messageSends: []
  5441. }),
  5442. $globals.Number);
  5443. $core.addMethod(
  5444. $core.method({
  5445. selector: "asPoint",
  5446. protocol: "converting",
  5447. fn: function (){
  5448. var self=this,$self=this;
  5449. return $core.withContext(function($ctx1) {
  5450. return $recv($globals.Point)._x_y_(self,self);
  5451. }, function($ctx1) {$ctx1.fill(self,"asPoint",{})});
  5452. },
  5453. args: [],
  5454. source: "asPoint\x0a\x09^ Point x: self y: self",
  5455. referencedClasses: ["Point"],
  5456. pragmas: [],
  5457. messageSends: ["x:y:"]
  5458. }),
  5459. $globals.Number);
  5460. $core.addMethod(
  5461. $core.method({
  5462. selector: "asString",
  5463. protocol: "converting",
  5464. fn: function (){
  5465. var self=this,$self=this;
  5466. return $core.withContext(function($ctx1) {
  5467. return String(self);
  5468. return self;
  5469. }, function($ctx1) {$ctx1.fill(self,"asString",{})});
  5470. },
  5471. args: [],
  5472. source: "asString\x0a\x09<inlineJS: 'return String(self)'>",
  5473. referencedClasses: [],
  5474. pragmas: [["inlineJS:", ["return String(self)"]]],
  5475. messageSends: []
  5476. }),
  5477. $globals.Number);
  5478. $core.addMethod(
  5479. $core.method({
  5480. selector: "atRandom",
  5481. protocol: "converting",
  5482. fn: function (){
  5483. var self=this,$self=this;
  5484. return $core.withContext(function($ctx1) {
  5485. return $recv($recv($recv($recv($recv($globals.Random)._new())._next()).__star(self))._truncated()).__plus((1));
  5486. }, function($ctx1) {$ctx1.fill(self,"atRandom",{})});
  5487. },
  5488. args: [],
  5489. source: "atRandom\x0a\x09^ (Random new next * self) truncated + 1",
  5490. referencedClasses: ["Random"],
  5491. pragmas: [],
  5492. messageSends: ["+", "truncated", "*", "next", "new"]
  5493. }),
  5494. $globals.Number);
  5495. $core.addMethod(
  5496. $core.method({
  5497. selector: "between:and:",
  5498. protocol: "testing",
  5499. fn: function (min,max){
  5500. var self=this,$self=this;
  5501. return $core.withContext(function($ctx1) {
  5502. return $recv($self.__gt_eq(min))._and_((function(){
  5503. return $core.withContext(function($ctx2) {
  5504. return $self.__lt_eq(max);
  5505. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5506. }));
  5507. }, function($ctx1) {$ctx1.fill(self,"between:and:",{min:min,max:max})});
  5508. },
  5509. args: ["min", "max"],
  5510. source: "between: min and: max\x0a ^ self >= min and: [ self <= max ]",
  5511. referencedClasses: [],
  5512. pragmas: [],
  5513. messageSends: ["and:", ">=", "<="]
  5514. }),
  5515. $globals.Number);
  5516. $core.addMethod(
  5517. $core.method({
  5518. selector: "bitAnd:",
  5519. protocol: "converting",
  5520. fn: function (aNumber){
  5521. var self=this,$self=this;
  5522. return $core.withContext(function($ctx1) {
  5523. return self & aNumber;
  5524. return self;
  5525. }, function($ctx1) {$ctx1.fill(self,"bitAnd:",{aNumber:aNumber})});
  5526. },
  5527. args: ["aNumber"],
  5528. source: "bitAnd: aNumber\x0a\x09<inlineJS: 'return self & aNumber'>",
  5529. referencedClasses: [],
  5530. pragmas: [["inlineJS:", ["return self & aNumber"]]],
  5531. messageSends: []
  5532. }),
  5533. $globals.Number);
  5534. $core.addMethod(
  5535. $core.method({
  5536. selector: "bitNot",
  5537. protocol: "converting",
  5538. fn: function (){
  5539. var self=this,$self=this;
  5540. return $core.withContext(function($ctx1) {
  5541. return ~self;
  5542. return self;
  5543. }, function($ctx1) {$ctx1.fill(self,"bitNot",{})});
  5544. },
  5545. args: [],
  5546. source: "bitNot\x0a\x09<inlineJS: 'return ~self'>",
  5547. referencedClasses: [],
  5548. pragmas: [["inlineJS:", ["return ~self"]]],
  5549. messageSends: []
  5550. }),
  5551. $globals.Number);
  5552. $core.addMethod(
  5553. $core.method({
  5554. selector: "bitOr:",
  5555. protocol: "converting",
  5556. fn: function (aNumber){
  5557. var self=this,$self=this;
  5558. return $core.withContext(function($ctx1) {
  5559. return self | aNumber;
  5560. return self;
  5561. }, function($ctx1) {$ctx1.fill(self,"bitOr:",{aNumber:aNumber})});
  5562. },
  5563. args: ["aNumber"],
  5564. source: "bitOr: aNumber\x0a\x09<inlineJS: 'return self | aNumber'>",
  5565. referencedClasses: [],
  5566. pragmas: [["inlineJS:", ["return self | aNumber"]]],
  5567. messageSends: []
  5568. }),
  5569. $globals.Number);
  5570. $core.addMethod(
  5571. $core.method({
  5572. selector: "bitXor:",
  5573. protocol: "converting",
  5574. fn: function (aNumber){
  5575. var self=this,$self=this;
  5576. return $core.withContext(function($ctx1) {
  5577. return self ^ aNumber;
  5578. return self;
  5579. }, function($ctx1) {$ctx1.fill(self,"bitXor:",{aNumber:aNumber})});
  5580. },
  5581. args: ["aNumber"],
  5582. source: "bitXor: aNumber\x0a\x09<inlineJS: 'return self ^ aNumber'>",
  5583. referencedClasses: [],
  5584. pragmas: [["inlineJS:", ["return self ^ aNumber"]]],
  5585. messageSends: []
  5586. }),
  5587. $globals.Number);
  5588. $core.addMethod(
  5589. $core.method({
  5590. selector: "ceiling",
  5591. protocol: "converting",
  5592. fn: function (){
  5593. var self=this,$self=this;
  5594. return $core.withContext(function($ctx1) {
  5595. return Math.ceil(self);;
  5596. return self;
  5597. }, function($ctx1) {$ctx1.fill(self,"ceiling",{})});
  5598. },
  5599. args: [],
  5600. source: "ceiling\x0a\x09<inlineJS: 'return Math.ceil(self);'>",
  5601. referencedClasses: [],
  5602. pragmas: [["inlineJS:", ["return Math.ceil(self);"]]],
  5603. messageSends: []
  5604. }),
  5605. $globals.Number);
  5606. $core.addMethod(
  5607. $core.method({
  5608. selector: "copy",
  5609. protocol: "copying",
  5610. fn: function (){
  5611. var self=this,$self=this;
  5612. return self;
  5613. },
  5614. args: [],
  5615. source: "copy\x0a\x09^ self",
  5616. referencedClasses: [],
  5617. pragmas: [],
  5618. messageSends: []
  5619. }),
  5620. $globals.Number);
  5621. $core.addMethod(
  5622. $core.method({
  5623. selector: "cos",
  5624. protocol: "mathematical functions",
  5625. fn: function (){
  5626. var self=this,$self=this;
  5627. return $core.withContext(function($ctx1) {
  5628. return Math.cos(self);;
  5629. return self;
  5630. }, function($ctx1) {$ctx1.fill(self,"cos",{})});
  5631. },
  5632. args: [],
  5633. source: "cos\x0a\x09<inlineJS: 'return Math.cos(self);'>",
  5634. referencedClasses: [],
  5635. pragmas: [["inlineJS:", ["return Math.cos(self);"]]],
  5636. messageSends: []
  5637. }),
  5638. $globals.Number);
  5639. $core.addMethod(
  5640. $core.method({
  5641. selector: "deepCopy",
  5642. protocol: "copying",
  5643. fn: function (){
  5644. var self=this,$self=this;
  5645. return $core.withContext(function($ctx1) {
  5646. return $self._copy();
  5647. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{})});
  5648. },
  5649. args: [],
  5650. source: "deepCopy\x0a\x09^ self copy",
  5651. referencedClasses: [],
  5652. pragmas: [],
  5653. messageSends: ["copy"]
  5654. }),
  5655. $globals.Number);
  5656. $core.addMethod(
  5657. $core.method({
  5658. selector: "degreesToRadians",
  5659. protocol: "converting",
  5660. fn: function (){
  5661. var self=this,$self=this;
  5662. return $core.withContext(function($ctx1) {
  5663. return $self.__star($recv($globals.Number)._radiansPerDegree());
  5664. }, function($ctx1) {$ctx1.fill(self,"degreesToRadians",{})});
  5665. },
  5666. args: [],
  5667. source: "degreesToRadians\x0a\x09^ self * Number radiansPerDegree",
  5668. referencedClasses: ["Number"],
  5669. pragmas: [],
  5670. messageSends: ["*", "radiansPerDegree"]
  5671. }),
  5672. $globals.Number);
  5673. $core.addMethod(
  5674. $core.method({
  5675. selector: "even",
  5676. protocol: "testing",
  5677. fn: function (){
  5678. var self=this,$self=this;
  5679. return $core.withContext(function($ctx1) {
  5680. return (0).__eq($self.__backslash_backslash((2)));
  5681. }, function($ctx1) {$ctx1.fill(self,"even",{})});
  5682. },
  5683. args: [],
  5684. source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)",
  5685. referencedClasses: [],
  5686. pragmas: [],
  5687. messageSends: ["=", "\x5c\x5c"]
  5688. }),
  5689. $globals.Number);
  5690. $core.addMethod(
  5691. $core.method({
  5692. selector: "floor",
  5693. protocol: "converting",
  5694. fn: function (){
  5695. var self=this,$self=this;
  5696. return $core.withContext(function($ctx1) {
  5697. return Math.floor(self);;
  5698. return self;
  5699. }, function($ctx1) {$ctx1.fill(self,"floor",{})});
  5700. },
  5701. args: [],
  5702. source: "floor\x0a\x09<inlineJS: 'return Math.floor(self);'>",
  5703. referencedClasses: [],
  5704. pragmas: [["inlineJS:", ["return Math.floor(self);"]]],
  5705. messageSends: []
  5706. }),
  5707. $globals.Number);
  5708. $core.addMethod(
  5709. $core.method({
  5710. selector: "isImmutable",
  5711. protocol: "testing",
  5712. fn: function (){
  5713. var self=this,$self=this;
  5714. return true;
  5715. },
  5716. args: [],
  5717. source: "isImmutable\x0a\x09^ true",
  5718. referencedClasses: [],
  5719. pragmas: [],
  5720. messageSends: []
  5721. }),
  5722. $globals.Number);
  5723. $core.addMethod(
  5724. $core.method({
  5725. selector: "isNumber",
  5726. protocol: "testing",
  5727. fn: function (){
  5728. var self=this,$self=this;
  5729. return true;
  5730. },
  5731. args: [],
  5732. source: "isNumber\x0a\x09^ true",
  5733. referencedClasses: [],
  5734. pragmas: [],
  5735. messageSends: []
  5736. }),
  5737. $globals.Number);
  5738. $core.addMethod(
  5739. $core.method({
  5740. selector: "isZero",
  5741. protocol: "testing",
  5742. fn: function (){
  5743. var self=this,$self=this;
  5744. return $core.withContext(function($ctx1) {
  5745. return $self.__eq((0));
  5746. }, function($ctx1) {$ctx1.fill(self,"isZero",{})});
  5747. },
  5748. args: [],
  5749. source: "isZero\x0a\x09^ self = 0",
  5750. referencedClasses: [],
  5751. pragmas: [],
  5752. messageSends: ["="]
  5753. }),
  5754. $globals.Number);
  5755. $core.addMethod(
  5756. $core.method({
  5757. selector: "ln",
  5758. protocol: "mathematical functions",
  5759. fn: function (){
  5760. var self=this,$self=this;
  5761. return $core.withContext(function($ctx1) {
  5762. return Math.log(self);;
  5763. return self;
  5764. }, function($ctx1) {$ctx1.fill(self,"ln",{})});
  5765. },
  5766. args: [],
  5767. source: "ln\x0a\x09<inlineJS: 'return Math.log(self);'>",
  5768. referencedClasses: [],
  5769. pragmas: [["inlineJS:", ["return Math.log(self);"]]],
  5770. messageSends: []
  5771. }),
  5772. $globals.Number);
  5773. $core.addMethod(
  5774. $core.method({
  5775. selector: "ln1p",
  5776. protocol: "mathematical functions",
  5777. fn: function (){
  5778. var self=this,$self=this;
  5779. return $core.withContext(function($ctx1) {
  5780. return Math.log1p(self);;
  5781. return self;
  5782. }, function($ctx1) {$ctx1.fill(self,"ln1p",{})});
  5783. },
  5784. args: [],
  5785. source: "ln1p\x0a\x09<inlineJS: 'return Math.log1p(self);'>",
  5786. referencedClasses: [],
  5787. pragmas: [["inlineJS:", ["return Math.log1p(self);"]]],
  5788. messageSends: []
  5789. }),
  5790. $globals.Number);
  5791. $core.addMethod(
  5792. $core.method({
  5793. selector: "log",
  5794. protocol: "mathematical functions",
  5795. fn: function (){
  5796. var self=this,$self=this;
  5797. return $core.withContext(function($ctx1) {
  5798. return Math.log(self) / Math.LN10;;
  5799. return self;
  5800. }, function($ctx1) {$ctx1.fill(self,"log",{})});
  5801. },
  5802. args: [],
  5803. source: "log\x0a\x09<inlineJS: 'return Math.log(self) / Math.LN10;'>",
  5804. referencedClasses: [],
  5805. pragmas: [["inlineJS:", ["return Math.log(self) / Math.LN10;"]]],
  5806. messageSends: []
  5807. }),
  5808. $globals.Number);
  5809. $core.addMethod(
  5810. $core.method({
  5811. selector: "log:",
  5812. protocol: "mathematical functions",
  5813. fn: function (aNumber){
  5814. var self=this,$self=this;
  5815. return $core.withContext(function($ctx1) {
  5816. return Math.log(self) / Math.log(aNumber);;
  5817. return self;
  5818. }, function($ctx1) {$ctx1.fill(self,"log:",{aNumber:aNumber})});
  5819. },
  5820. args: ["aNumber"],
  5821. source: "log: aNumber\x0a\x09<inlineJS: 'return Math.log(self) / Math.log(aNumber);'>",
  5822. referencedClasses: [],
  5823. pragmas: [["inlineJS:", ["return Math.log(self) / Math.log(aNumber);"]]],
  5824. messageSends: []
  5825. }),
  5826. $globals.Number);
  5827. $core.addMethod(
  5828. $core.method({
  5829. selector: "max:",
  5830. protocol: "arithmetic",
  5831. fn: function (aNumber){
  5832. var self=this,$self=this;
  5833. return $core.withContext(function($ctx1) {
  5834. return Math.max(self, aNumber);;
  5835. return self;
  5836. }, function($ctx1) {$ctx1.fill(self,"max:",{aNumber:aNumber})});
  5837. },
  5838. args: ["aNumber"],
  5839. source: "max: aNumber\x0a\x09<inlineJS: 'return Math.max(self, aNumber);'>",
  5840. referencedClasses: [],
  5841. pragmas: [["inlineJS:", ["return Math.max(self, aNumber);"]]],
  5842. messageSends: []
  5843. }),
  5844. $globals.Number);
  5845. $core.addMethod(
  5846. $core.method({
  5847. selector: "min:",
  5848. protocol: "arithmetic",
  5849. fn: function (aNumber){
  5850. var self=this,$self=this;
  5851. return $core.withContext(function($ctx1) {
  5852. return Math.min(self, aNumber);;
  5853. return self;
  5854. }, function($ctx1) {$ctx1.fill(self,"min:",{aNumber:aNumber})});
  5855. },
  5856. args: ["aNumber"],
  5857. source: "min: aNumber\x0a\x09<inlineJS: 'return Math.min(self, aNumber);'>",
  5858. referencedClasses: [],
  5859. pragmas: [["inlineJS:", ["return Math.min(self, aNumber);"]]],
  5860. messageSends: []
  5861. }),
  5862. $globals.Number);
  5863. $core.addMethod(
  5864. $core.method({
  5865. selector: "min:max:",
  5866. protocol: "arithmetic",
  5867. fn: function (aMin,aMax){
  5868. var self=this,$self=this;
  5869. return $core.withContext(function($ctx1) {
  5870. return $recv($self._min_(aMin))._max_(aMax);
  5871. }, function($ctx1) {$ctx1.fill(self,"min:max:",{aMin:aMin,aMax:aMax})});
  5872. },
  5873. args: ["aMin", "aMax"],
  5874. source: "min: aMin max: aMax\x0a\x09^ (self min: aMin) max: aMax",
  5875. referencedClasses: [],
  5876. pragmas: [],
  5877. messageSends: ["max:", "min:"]
  5878. }),
  5879. $globals.Number);
  5880. $core.addMethod(
  5881. $core.method({
  5882. selector: "negated",
  5883. protocol: "arithmetic",
  5884. fn: function (){
  5885. var self=this,$self=this;
  5886. return $core.withContext(function($ctx1) {
  5887. return (0).__minus(self);
  5888. }, function($ctx1) {$ctx1.fill(self,"negated",{})});
  5889. },
  5890. args: [],
  5891. source: "negated\x0a\x09^ 0 - self",
  5892. referencedClasses: [],
  5893. pragmas: [],
  5894. messageSends: ["-"]
  5895. }),
  5896. $globals.Number);
  5897. $core.addMethod(
  5898. $core.method({
  5899. selector: "negative",
  5900. protocol: "testing",
  5901. fn: function (){
  5902. var self=this,$self=this;
  5903. return $core.withContext(function($ctx1) {
  5904. return $self.__lt((0));
  5905. }, function($ctx1) {$ctx1.fill(self,"negative",{})});
  5906. },
  5907. args: [],
  5908. source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0",
  5909. referencedClasses: [],
  5910. pragmas: [],
  5911. messageSends: ["<"]
  5912. }),
  5913. $globals.Number);
  5914. $core.addMethod(
  5915. $core.method({
  5916. selector: "odd",
  5917. protocol: "testing",
  5918. fn: function (){
  5919. var self=this,$self=this;
  5920. return $core.withContext(function($ctx1) {
  5921. return $recv($self._even())._not();
  5922. }, function($ctx1) {$ctx1.fill(self,"odd",{})});
  5923. },
  5924. args: [],
  5925. source: "odd\x0a\x09^ self even not",
  5926. referencedClasses: [],
  5927. pragmas: [],
  5928. messageSends: ["not", "even"]
  5929. }),
  5930. $globals.Number);
  5931. $core.addMethod(
  5932. $core.method({
  5933. selector: "positive",
  5934. protocol: "testing",
  5935. fn: function (){
  5936. var self=this,$self=this;
  5937. return $core.withContext(function($ctx1) {
  5938. return $self.__gt_eq((0));
  5939. }, function($ctx1) {$ctx1.fill(self,"positive",{})});
  5940. },
  5941. args: [],
  5942. source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0",
  5943. referencedClasses: [],
  5944. pragmas: [],
  5945. messageSends: [">="]
  5946. }),
  5947. $globals.Number);
  5948. $core.addMethod(
  5949. $core.method({
  5950. selector: "printOn:",
  5951. protocol: "printing",
  5952. fn: function (aStream){
  5953. var self=this,$self=this;
  5954. return $core.withContext(function($ctx1) {
  5955. $recv(aStream)._nextPutAll_($self._asString());
  5956. return self;
  5957. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  5958. },
  5959. args: ["aStream"],
  5960. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  5961. referencedClasses: [],
  5962. pragmas: [],
  5963. messageSends: ["nextPutAll:", "asString"]
  5964. }),
  5965. $globals.Number);
  5966. $core.addMethod(
  5967. $core.method({
  5968. selector: "printShowingDecimalPlaces:",
  5969. protocol: "printing",
  5970. fn: function (placesDesired){
  5971. var self=this,$self=this;
  5972. return $core.withContext(function($ctx1) {
  5973. return self.toFixed(placesDesired);
  5974. return self;
  5975. }, function($ctx1) {$ctx1.fill(self,"printShowingDecimalPlaces:",{placesDesired:placesDesired})});
  5976. },
  5977. args: ["placesDesired"],
  5978. source: "printShowingDecimalPlaces: placesDesired\x0a\x09<inlineJS: 'return self.toFixed(placesDesired)'>",
  5979. referencedClasses: [],
  5980. pragmas: [["inlineJS:", ["return self.toFixed(placesDesired)"]]],
  5981. messageSends: []
  5982. }),
  5983. $globals.Number);
  5984. $core.addMethod(
  5985. $core.method({
  5986. selector: "printStringBase:",
  5987. protocol: "converting",
  5988. fn: function (aBase){
  5989. var self=this,$self=this;
  5990. return $core.withContext(function($ctx1) {
  5991. return self.toString(aBase);
  5992. return self;
  5993. }, function($ctx1) {$ctx1.fill(self,"printStringBase:",{aBase:aBase})});
  5994. },
  5995. args: ["aBase"],
  5996. source: "printStringBase: aBase\x0a\x09<inlineJS: 'return self.toString(aBase)'>",
  5997. referencedClasses: [],
  5998. pragmas: [["inlineJS:", ["return self.toString(aBase)"]]],
  5999. messageSends: []
  6000. }),
  6001. $globals.Number);
  6002. $core.addMethod(
  6003. $core.method({
  6004. selector: "radiansToDegrees",
  6005. protocol: "converting",
  6006. fn: function (){
  6007. var self=this,$self=this;
  6008. return $core.withContext(function($ctx1) {
  6009. return $self.__slash($recv($globals.Number)._radiansPerDegree());
  6010. }, function($ctx1) {$ctx1.fill(self,"radiansToDegrees",{})});
  6011. },
  6012. args: [],
  6013. source: "radiansToDegrees\x0a\x09^ self / Number radiansPerDegree",
  6014. referencedClasses: ["Number"],
  6015. pragmas: [],
  6016. messageSends: ["/", "radiansPerDegree"]
  6017. }),
  6018. $globals.Number);
  6019. $core.addMethod(
  6020. $core.method({
  6021. selector: "raisedTo:",
  6022. protocol: "mathematical functions",
  6023. fn: function (exponent){
  6024. var self=this,$self=this;
  6025. return $core.withContext(function($ctx1) {
  6026. return Math.pow(self, exponent);;
  6027. return self;
  6028. }, function($ctx1) {$ctx1.fill(self,"raisedTo:",{exponent:exponent})});
  6029. },
  6030. args: ["exponent"],
  6031. source: "raisedTo: exponent\x0a\x09<inlineJS: 'return Math.pow(self, exponent);'>",
  6032. referencedClasses: [],
  6033. pragmas: [["inlineJS:", ["return Math.pow(self, exponent);"]]],
  6034. messageSends: []
  6035. }),
  6036. $globals.Number);
  6037. $core.addMethod(
  6038. $core.method({
  6039. selector: "rounded",
  6040. protocol: "converting",
  6041. fn: function (){
  6042. var self=this,$self=this;
  6043. return $core.withContext(function($ctx1) {
  6044. return Math.round(self);;
  6045. return self;
  6046. }, function($ctx1) {$ctx1.fill(self,"rounded",{})});
  6047. },
  6048. args: [],
  6049. source: "rounded\x0a\x09<inlineJS: 'return Math.round(self);'>",
  6050. referencedClasses: [],
  6051. pragmas: [["inlineJS:", ["return Math.round(self);"]]],
  6052. messageSends: []
  6053. }),
  6054. $globals.Number);
  6055. $core.addMethod(
  6056. $core.method({
  6057. selector: "sign",
  6058. protocol: "mathematical functions",
  6059. fn: function (){
  6060. var self=this,$self=this;
  6061. return $core.withContext(function($ctx1) {
  6062. var $1,$2;
  6063. $1=$self._isZero();
  6064. if($core.assert($1)){
  6065. return (0);
  6066. }
  6067. $2=$self._positive();
  6068. if($core.assert($2)){
  6069. return (1);
  6070. } else {
  6071. return (-1);
  6072. }
  6073. return self;
  6074. }, function($ctx1) {$ctx1.fill(self,"sign",{})});
  6075. },
  6076. args: [],
  6077. source: "sign\x0a\x09self isZero \x0a\x09\x09ifTrue: [ ^ 0 ].\x0a\x09self positive\x0a\x09\x09ifTrue: [ ^ 1 ]\x0a\x09\x09ifFalse: [ ^ -1 ].",
  6078. referencedClasses: [],
  6079. pragmas: [],
  6080. messageSends: ["ifTrue:", "isZero", "ifTrue:ifFalse:", "positive"]
  6081. }),
  6082. $globals.Number);
  6083. $core.addMethod(
  6084. $core.method({
  6085. selector: "sin",
  6086. protocol: "mathematical functions",
  6087. fn: function (){
  6088. var self=this,$self=this;
  6089. return $core.withContext(function($ctx1) {
  6090. return Math.sin(self);;
  6091. return self;
  6092. }, function($ctx1) {$ctx1.fill(self,"sin",{})});
  6093. },
  6094. args: [],
  6095. source: "sin\x0a\x09<inlineJS: 'return Math.sin(self);'>",
  6096. referencedClasses: [],
  6097. pragmas: [["inlineJS:", ["return Math.sin(self);"]]],
  6098. messageSends: []
  6099. }),
  6100. $globals.Number);
  6101. $core.addMethod(
  6102. $core.method({
  6103. selector: "sqrt",
  6104. protocol: "mathematical functions",
  6105. fn: function (){
  6106. var self=this,$self=this;
  6107. return $core.withContext(function($ctx1) {
  6108. return Math.sqrt(self);
  6109. return self;
  6110. }, function($ctx1) {$ctx1.fill(self,"sqrt",{})});
  6111. },
  6112. args: [],
  6113. source: "sqrt\x0a\x09<inlineJS: 'return Math.sqrt(self)'>",
  6114. referencedClasses: [],
  6115. pragmas: [["inlineJS:", ["return Math.sqrt(self)"]]],
  6116. messageSends: []
  6117. }),
  6118. $globals.Number);
  6119. $core.addMethod(
  6120. $core.method({
  6121. selector: "squared",
  6122. protocol: "mathematical functions",
  6123. fn: function (){
  6124. var self=this,$self=this;
  6125. return $core.withContext(function($ctx1) {
  6126. return $self.__star(self);
  6127. }, function($ctx1) {$ctx1.fill(self,"squared",{})});
  6128. },
  6129. args: [],
  6130. source: "squared\x0a\x09^ self * self",
  6131. referencedClasses: [],
  6132. pragmas: [],
  6133. messageSends: ["*"]
  6134. }),
  6135. $globals.Number);
  6136. $core.addMethod(
  6137. $core.method({
  6138. selector: "tan",
  6139. protocol: "mathematical functions",
  6140. fn: function (){
  6141. var self=this,$self=this;
  6142. return $core.withContext(function($ctx1) {
  6143. return Math.tan(self);;
  6144. return self;
  6145. }, function($ctx1) {$ctx1.fill(self,"tan",{})});
  6146. },
  6147. args: [],
  6148. source: "tan\x0a\x09<inlineJS: 'return Math.tan(self);'>",
  6149. referencedClasses: [],
  6150. pragmas: [["inlineJS:", ["return Math.tan(self);"]]],
  6151. messageSends: []
  6152. }),
  6153. $globals.Number);
  6154. $core.addMethod(
  6155. $core.method({
  6156. selector: "timesRepeat:",
  6157. protocol: "enumerating",
  6158. fn: function (aBlock){
  6159. var self=this,$self=this;
  6160. var count;
  6161. return $core.withContext(function($ctx1) {
  6162. count=(1);
  6163. $recv((function(){
  6164. return $core.withContext(function($ctx2) {
  6165. return $recv(count).__gt(self);
  6166. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6167. }))._whileFalse_((function(){
  6168. return $core.withContext(function($ctx2) {
  6169. $recv(aBlock)._value();
  6170. count=$recv(count).__plus((1));
  6171. return count;
  6172. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6173. }));
  6174. return self;
  6175. }, function($ctx1) {$ctx1.fill(self,"timesRepeat:",{aBlock:aBlock,count:count})});
  6176. },
  6177. args: ["aBlock"],
  6178. source: "timesRepeat: aBlock\x0a\x09| count |\x0a\x09count := 1.\x0a\x09[ count > self ] whileFalse: [\x0a\x09\x09aBlock value.\x0a\x09\x09count := count + 1 ]",
  6179. referencedClasses: [],
  6180. pragmas: [],
  6181. messageSends: ["whileFalse:", ">", "value", "+"]
  6182. }),
  6183. $globals.Number);
  6184. $core.addMethod(
  6185. $core.method({
  6186. selector: "to:",
  6187. protocol: "converting",
  6188. fn: function (aNumber){
  6189. var self=this,$self=this;
  6190. var array,first,last,count;
  6191. return $core.withContext(function($ctx1) {
  6192. first=$self._truncated();
  6193. $ctx1.sendIdx["truncated"]=1;
  6194. last=$recv($recv(aNumber)._truncated()).__plus((1));
  6195. $ctx1.sendIdx["+"]=1;
  6196. count=(1);
  6197. array=$recv($globals.Array)._new();
  6198. $recv($recv(last).__minus(first))._timesRepeat_((function(){
  6199. return $core.withContext(function($ctx2) {
  6200. $recv(array)._at_put_(count,first);
  6201. count=$recv(count).__plus((1));
  6202. $ctx2.sendIdx["+"]=2;
  6203. first=$recv(first).__plus((1));
  6204. return first;
  6205. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6206. }));
  6207. return array;
  6208. }, function($ctx1) {$ctx1.fill(self,"to:",{aNumber:aNumber,array:array,first:first,last:last,count:count})});
  6209. },
  6210. args: ["aNumber"],
  6211. 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",
  6212. referencedClasses: ["Array"],
  6213. pragmas: [],
  6214. messageSends: ["truncated", "+", "new", "timesRepeat:", "-", "at:put:"]
  6215. }),
  6216. $globals.Number);
  6217. $core.addMethod(
  6218. $core.method({
  6219. selector: "to:by:",
  6220. protocol: "converting",
  6221. fn: function (stop,step){
  6222. var self=this,$self=this;
  6223. var array,value,pos;
  6224. return $core.withContext(function($ctx1) {
  6225. var $1,$2;
  6226. value=self;
  6227. array=$recv($globals.Array)._new();
  6228. pos=(1);
  6229. $1=$recv(step).__eq((0));
  6230. if($core.assert($1)){
  6231. $self._error_("step must be non-zero");
  6232. }
  6233. $2=$recv(step).__lt((0));
  6234. if($core.assert($2)){
  6235. $recv((function(){
  6236. return $core.withContext(function($ctx2) {
  6237. return $recv(value).__gt_eq(stop);
  6238. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  6239. }))._whileTrue_((function(){
  6240. return $core.withContext(function($ctx2) {
  6241. $recv(array)._at_put_(pos,value);
  6242. $ctx2.sendIdx["at:put:"]=1;
  6243. pos=$recv(pos).__plus((1));
  6244. $ctx2.sendIdx["+"]=1;
  6245. value=$recv(value).__plus(step);
  6246. $ctx2.sendIdx["+"]=2;
  6247. return value;
  6248. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  6249. }));
  6250. $ctx1.sendIdx["whileTrue:"]=1;
  6251. } else {
  6252. $recv((function(){
  6253. return $core.withContext(function($ctx2) {
  6254. return $recv(value).__lt_eq(stop);
  6255. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  6256. }))._whileTrue_((function(){
  6257. return $core.withContext(function($ctx2) {
  6258. $recv(array)._at_put_(pos,value);
  6259. pos=$recv(pos).__plus((1));
  6260. $ctx2.sendIdx["+"]=3;
  6261. value=$recv(value).__plus(step);
  6262. return value;
  6263. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  6264. }));
  6265. }
  6266. return array;
  6267. }, function($ctx1) {$ctx1.fill(self,"to:by:",{stop:stop,step:step,array:array,value:value,pos:pos})});
  6268. },
  6269. args: ["stop", "step"],
  6270. 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",
  6271. referencedClasses: ["Array"],
  6272. pragmas: [],
  6273. messageSends: ["new", "ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "at:put:", "+", "<="]
  6274. }),
  6275. $globals.Number);
  6276. $core.addMethod(
  6277. $core.method({
  6278. selector: "to:by:do:",
  6279. protocol: "enumerating",
  6280. fn: function (stop,step,aBlock){
  6281. var self=this,$self=this;
  6282. var value;
  6283. return $core.withContext(function($ctx1) {
  6284. var $1,$2;
  6285. value=self;
  6286. $1=$recv(step).__eq((0));
  6287. if($core.assert($1)){
  6288. $self._error_("step must be non-zero");
  6289. }
  6290. $2=$recv(step).__lt((0));
  6291. if($core.assert($2)){
  6292. $recv((function(){
  6293. return $core.withContext(function($ctx2) {
  6294. return $recv(value).__gt_eq(stop);
  6295. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  6296. }))._whileTrue_((function(){
  6297. return $core.withContext(function($ctx2) {
  6298. $recv(aBlock)._value_(value);
  6299. $ctx2.sendIdx["value:"]=1;
  6300. value=$recv(value).__plus(step);
  6301. $ctx2.sendIdx["+"]=1;
  6302. return value;
  6303. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  6304. }));
  6305. $ctx1.sendIdx["whileTrue:"]=1;
  6306. } else {
  6307. $recv((function(){
  6308. return $core.withContext(function($ctx2) {
  6309. return $recv(value).__lt_eq(stop);
  6310. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  6311. }))._whileTrue_((function(){
  6312. return $core.withContext(function($ctx2) {
  6313. $recv(aBlock)._value_(value);
  6314. value=$recv(value).__plus(step);
  6315. return value;
  6316. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  6317. }));
  6318. }
  6319. return self;
  6320. }, function($ctx1) {$ctx1.fill(self,"to:by:do:",{stop:stop,step:step,aBlock:aBlock,value:value})});
  6321. },
  6322. args: ["stop", "step", "aBlock"],
  6323. 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 ]]",
  6324. referencedClasses: [],
  6325. pragmas: [],
  6326. messageSends: ["ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "value:", "+", "<="]
  6327. }),
  6328. $globals.Number);
  6329. $core.addMethod(
  6330. $core.method({
  6331. selector: "to:do:",
  6332. protocol: "enumerating",
  6333. fn: function (stop,aBlock){
  6334. var self=this,$self=this;
  6335. var nextValue;
  6336. return $core.withContext(function($ctx1) {
  6337. nextValue=self;
  6338. $recv((function(){
  6339. return $core.withContext(function($ctx2) {
  6340. return $recv(nextValue).__lt_eq(stop);
  6341. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6342. }))._whileTrue_((function(){
  6343. return $core.withContext(function($ctx2) {
  6344. $recv(aBlock)._value_(nextValue);
  6345. nextValue=$recv(nextValue).__plus((1));
  6346. return nextValue;
  6347. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6348. }));
  6349. return self;
  6350. }, function($ctx1) {$ctx1.fill(self,"to:do:",{stop:stop,aBlock:aBlock,nextValue:nextValue})});
  6351. },
  6352. args: ["stop", "aBlock"],
  6353. 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 ]",
  6354. referencedClasses: [],
  6355. pragmas: [],
  6356. messageSends: ["whileTrue:", "<=", "value:", "+"]
  6357. }),
  6358. $globals.Number);
  6359. $core.addMethod(
  6360. $core.method({
  6361. selector: "truncated",
  6362. protocol: "converting",
  6363. fn: function (){
  6364. var self=this,$self=this;
  6365. return $core.withContext(function($ctx1) {
  6366. if(self >= 0) {
  6367. return Math.floor(self);
  6368. } else {
  6369. return Math.floor(self * (-1)) * (-1);
  6370. };
  6371. ;
  6372. return self;
  6373. }, function($ctx1) {$ctx1.fill(self,"truncated",{})});
  6374. },
  6375. args: [],
  6376. 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'>",
  6377. referencedClasses: [],
  6378. 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"]]],
  6379. messageSends: []
  6380. }),
  6381. $globals.Number);
  6382. $core.addMethod(
  6383. $core.method({
  6384. selector: "|",
  6385. protocol: "converting",
  6386. fn: function (aNumber){
  6387. var self=this,$self=this;
  6388. return $core.withContext(function($ctx1) {
  6389. return self | aNumber;
  6390. return self;
  6391. }, function($ctx1) {$ctx1.fill(self,"|",{aNumber:aNumber})});
  6392. },
  6393. args: ["aNumber"],
  6394. source: "| aNumber\x0a\x09<inlineJS: 'return self | aNumber'>",
  6395. referencedClasses: [],
  6396. pragmas: [["inlineJS:", ["return self | aNumber"]]],
  6397. messageSends: []
  6398. }),
  6399. $globals.Number);
  6400. $core.addMethod(
  6401. $core.method({
  6402. selector: "classTag",
  6403. protocol: "accessing",
  6404. fn: function (){
  6405. var self=this,$self=this;
  6406. return "magnitude";
  6407. },
  6408. args: [],
  6409. 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'",
  6410. referencedClasses: [],
  6411. pragmas: [],
  6412. messageSends: []
  6413. }),
  6414. $globals.Number.a$cls);
  6415. $core.addMethod(
  6416. $core.method({
  6417. selector: "e",
  6418. protocol: "instance creation",
  6419. fn: function (){
  6420. var self=this,$self=this;
  6421. return $core.withContext(function($ctx1) {
  6422. return Math.E;;
  6423. return self;
  6424. }, function($ctx1) {$ctx1.fill(self,"e",{})});
  6425. },
  6426. args: [],
  6427. source: "e\x0a\x09<inlineJS: 'return Math.E;'>",
  6428. referencedClasses: [],
  6429. pragmas: [["inlineJS:", ["return Math.E;"]]],
  6430. messageSends: []
  6431. }),
  6432. $globals.Number.a$cls);
  6433. $core.addMethod(
  6434. $core.method({
  6435. selector: "pi",
  6436. protocol: "instance creation",
  6437. fn: function (){
  6438. var self=this,$self=this;
  6439. return $core.withContext(function($ctx1) {
  6440. return Math.PI;
  6441. return self;
  6442. }, function($ctx1) {$ctx1.fill(self,"pi",{})});
  6443. },
  6444. args: [],
  6445. source: "pi\x0a\x09<inlineJS: 'return Math.PI'>",
  6446. referencedClasses: [],
  6447. pragmas: [["inlineJS:", ["return Math.PI"]]],
  6448. messageSends: []
  6449. }),
  6450. $globals.Number.a$cls);
  6451. $core.addMethod(
  6452. $core.method({
  6453. selector: "radiansPerDegree",
  6454. protocol: "instance creation",
  6455. fn: function (){
  6456. var self=this,$self=this;
  6457. return $core.withContext(function($ctx1) {
  6458. return $recv($self._pi()).__slash((180));
  6459. }, function($ctx1) {$ctx1.fill(self,"radiansPerDegree",{})});
  6460. },
  6461. args: [],
  6462. source: "radiansPerDegree\x0a\x09^ (self pi) / 180",
  6463. referencedClasses: [],
  6464. pragmas: [],
  6465. messageSends: ["/", "pi"]
  6466. }),
  6467. $globals.Number.a$cls);
  6468. $core.addClass("Point", $globals.Object, ["x", "y"], "Kernel-Objects");
  6469. $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";
  6470. $core.addMethod(
  6471. $core.method({
  6472. selector: "*",
  6473. protocol: "arithmetic",
  6474. fn: function (aPoint){
  6475. var self=this,$self=this;
  6476. return $core.withContext(function($ctx1) {
  6477. var $2,$4,$3,$1,$6,$5;
  6478. $2=$self._x();
  6479. $ctx1.sendIdx["x"]=1;
  6480. $4=$recv(aPoint)._asPoint();
  6481. $ctx1.sendIdx["asPoint"]=1;
  6482. $3=$recv($4)._x();
  6483. $1=$recv($2).__star($3);
  6484. $ctx1.sendIdx["*"]=1;
  6485. $6=$self._y();
  6486. $ctx1.sendIdx["y"]=1;
  6487. $5=$recv($6).__star($recv($recv(aPoint)._asPoint())._y());
  6488. return $recv($globals.Point)._x_y_($1,$5);
  6489. }, function($ctx1) {$ctx1.fill(self,"*",{aPoint:aPoint})});
  6490. },
  6491. args: ["aPoint"],
  6492. source: "* aPoint\x0a\x09^ Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y",
  6493. referencedClasses: ["Point"],
  6494. pragmas: [],
  6495. messageSends: ["x:y:", "*", "x", "asPoint", "y"]
  6496. }),
  6497. $globals.Point);
  6498. $core.addMethod(
  6499. $core.method({
  6500. selector: "+",
  6501. protocol: "arithmetic",
  6502. fn: function (aPoint){
  6503. var self=this,$self=this;
  6504. return $core.withContext(function($ctx1) {
  6505. var $2,$4,$3,$1,$6,$5;
  6506. $2=$self._x();
  6507. $ctx1.sendIdx["x"]=1;
  6508. $4=$recv(aPoint)._asPoint();
  6509. $ctx1.sendIdx["asPoint"]=1;
  6510. $3=$recv($4)._x();
  6511. $1=$recv($2).__plus($3);
  6512. $ctx1.sendIdx["+"]=1;
  6513. $6=$self._y();
  6514. $ctx1.sendIdx["y"]=1;
  6515. $5=$recv($6).__plus($recv($recv(aPoint)._asPoint())._y());
  6516. return $recv($globals.Point)._x_y_($1,$5);
  6517. }, function($ctx1) {$ctx1.fill(self,"+",{aPoint:aPoint})});
  6518. },
  6519. args: ["aPoint"],
  6520. source: "+ aPoint\x0a\x09^ Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y",
  6521. referencedClasses: ["Point"],
  6522. pragmas: [],
  6523. messageSends: ["x:y:", "+", "x", "asPoint", "y"]
  6524. }),
  6525. $globals.Point);
  6526. $core.addMethod(
  6527. $core.method({
  6528. selector: "-",
  6529. protocol: "arithmetic",
  6530. fn: function (aPoint){
  6531. var self=this,$self=this;
  6532. return $core.withContext(function($ctx1) {
  6533. var $2,$4,$3,$1,$6,$5;
  6534. $2=$self._x();
  6535. $ctx1.sendIdx["x"]=1;
  6536. $4=$recv(aPoint)._asPoint();
  6537. $ctx1.sendIdx["asPoint"]=1;
  6538. $3=$recv($4)._x();
  6539. $1=$recv($2).__minus($3);
  6540. $ctx1.sendIdx["-"]=1;
  6541. $6=$self._y();
  6542. $ctx1.sendIdx["y"]=1;
  6543. $5=$recv($6).__minus($recv($recv(aPoint)._asPoint())._y());
  6544. return $recv($globals.Point)._x_y_($1,$5);
  6545. }, function($ctx1) {$ctx1.fill(self,"-",{aPoint:aPoint})});
  6546. },
  6547. args: ["aPoint"],
  6548. source: "- aPoint\x0a\x09^ Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y",
  6549. referencedClasses: ["Point"],
  6550. pragmas: [],
  6551. messageSends: ["x:y:", "-", "x", "asPoint", "y"]
  6552. }),
  6553. $globals.Point);
  6554. $core.addMethod(
  6555. $core.method({
  6556. selector: "/",
  6557. protocol: "arithmetic",
  6558. fn: function (aPoint){
  6559. var self=this,$self=this;
  6560. return $core.withContext(function($ctx1) {
  6561. var $2,$4,$3,$1,$6,$5;
  6562. $2=$self._x();
  6563. $ctx1.sendIdx["x"]=1;
  6564. $4=$recv(aPoint)._asPoint();
  6565. $ctx1.sendIdx["asPoint"]=1;
  6566. $3=$recv($4)._x();
  6567. $1=$recv($2).__slash($3);
  6568. $ctx1.sendIdx["/"]=1;
  6569. $6=$self._y();
  6570. $ctx1.sendIdx["y"]=1;
  6571. $5=$recv($6).__slash($recv($recv(aPoint)._asPoint())._y());
  6572. return $recv($globals.Point)._x_y_($1,$5);
  6573. }, function($ctx1) {$ctx1.fill(self,"/",{aPoint:aPoint})});
  6574. },
  6575. args: ["aPoint"],
  6576. source: "/ aPoint\x0a\x09^ Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
  6577. referencedClasses: ["Point"],
  6578. pragmas: [],
  6579. messageSends: ["x:y:", "/", "x", "asPoint", "y"]
  6580. }),
  6581. $globals.Point);
  6582. $core.addMethod(
  6583. $core.method({
  6584. selector: "<",
  6585. protocol: "comparing",
  6586. fn: function (aPoint){
  6587. var self=this,$self=this;
  6588. return $core.withContext(function($ctx1) {
  6589. var $2,$1,$3;
  6590. $2=$self._x();
  6591. $ctx1.sendIdx["x"]=1;
  6592. $1=$recv($2).__lt($recv(aPoint)._x());
  6593. $ctx1.sendIdx["<"]=1;
  6594. return $recv($1)._and_((function(){
  6595. return $core.withContext(function($ctx2) {
  6596. $3=$self._y();
  6597. $ctx2.sendIdx["y"]=1;
  6598. return $recv($3).__lt($recv(aPoint)._y());
  6599. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6600. }));
  6601. }, function($ctx1) {$ctx1.fill(self,"<",{aPoint:aPoint})});
  6602. },
  6603. args: ["aPoint"],
  6604. source: "< aPoint\x0a\x09^ self x < aPoint x and: [\x0a\x09\x09self y < aPoint y ]",
  6605. referencedClasses: [],
  6606. pragmas: [],
  6607. messageSends: ["and:", "<", "x", "y"]
  6608. }),
  6609. $globals.Point);
  6610. $core.addMethod(
  6611. $core.method({
  6612. selector: "<=",
  6613. protocol: "comparing",
  6614. fn: function (aPoint){
  6615. var self=this,$self=this;
  6616. return $core.withContext(function($ctx1) {
  6617. var $2,$1,$3;
  6618. $2=$self._x();
  6619. $ctx1.sendIdx["x"]=1;
  6620. $1=$recv($2).__lt_eq($recv(aPoint)._x());
  6621. $ctx1.sendIdx["<="]=1;
  6622. return $recv($1)._and_((function(){
  6623. return $core.withContext(function($ctx2) {
  6624. $3=$self._y();
  6625. $ctx2.sendIdx["y"]=1;
  6626. return $recv($3).__lt_eq($recv(aPoint)._y());
  6627. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6628. }));
  6629. }, function($ctx1) {$ctx1.fill(self,"<=",{aPoint:aPoint})});
  6630. },
  6631. args: ["aPoint"],
  6632. source: "<= aPoint\x0a\x09^ self x <= aPoint x and: [\x0a\x09\x09self y <= aPoint y ]",
  6633. referencedClasses: [],
  6634. pragmas: [],
  6635. messageSends: ["and:", "<=", "x", "y"]
  6636. }),
  6637. $globals.Point);
  6638. $core.addMethod(
  6639. $core.method({
  6640. selector: "=",
  6641. protocol: "comparing",
  6642. fn: function (aPoint){
  6643. var self=this,$self=this;
  6644. return $core.withContext(function($ctx1) {
  6645. var $2,$1,$4,$3,$6,$5;
  6646. $2=$recv(aPoint)._class();
  6647. $ctx1.sendIdx["class"]=1;
  6648. $1=$recv($2).__eq($self._class());
  6649. $ctx1.sendIdx["="]=1;
  6650. return $recv($1)._and_((function(){
  6651. return $core.withContext(function($ctx2) {
  6652. $4=$recv(aPoint)._x();
  6653. $ctx2.sendIdx["x"]=1;
  6654. $3=$recv($4).__eq($self._x());
  6655. $ctx2.sendIdx["="]=2;
  6656. $6=$recv(aPoint)._y();
  6657. $ctx2.sendIdx["y"]=1;
  6658. $5=$recv($6).__eq($self._y());
  6659. return $recv($3).__and($5);
  6660. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6661. }));
  6662. }, function($ctx1) {$ctx1.fill(self,"=",{aPoint:aPoint})});
  6663. },
  6664. args: ["aPoint"],
  6665. source: "= aPoint\x0a\x09^ aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y) ]",
  6666. referencedClasses: [],
  6667. pragmas: [],
  6668. messageSends: ["and:", "=", "class", "&", "x", "y"]
  6669. }),
  6670. $globals.Point);
  6671. $core.addMethod(
  6672. $core.method({
  6673. selector: ">",
  6674. protocol: "comparing",
  6675. fn: function (aPoint){
  6676. var self=this,$self=this;
  6677. return $core.withContext(function($ctx1) {
  6678. var $2,$1,$3;
  6679. $2=$self._x();
  6680. $ctx1.sendIdx["x"]=1;
  6681. $1=$recv($2).__gt($recv(aPoint)._x());
  6682. $ctx1.sendIdx[">"]=1;
  6683. return $recv($1)._and_((function(){
  6684. return $core.withContext(function($ctx2) {
  6685. $3=$self._y();
  6686. $ctx2.sendIdx["y"]=1;
  6687. return $recv($3).__gt($recv(aPoint)._y());
  6688. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6689. }));
  6690. }, function($ctx1) {$ctx1.fill(self,">",{aPoint:aPoint})});
  6691. },
  6692. args: ["aPoint"],
  6693. source: "> aPoint\x0a\x09^ self x > aPoint x and: [\x0a\x09\x09self y > aPoint y ]",
  6694. referencedClasses: [],
  6695. pragmas: [],
  6696. messageSends: ["and:", ">", "x", "y"]
  6697. }),
  6698. $globals.Point);
  6699. $core.addMethod(
  6700. $core.method({
  6701. selector: ">=",
  6702. protocol: "comparing",
  6703. fn: function (aPoint){
  6704. var self=this,$self=this;
  6705. return $core.withContext(function($ctx1) {
  6706. var $2,$1,$3;
  6707. $2=$self._x();
  6708. $ctx1.sendIdx["x"]=1;
  6709. $1=$recv($2).__gt_eq($recv(aPoint)._x());
  6710. $ctx1.sendIdx[">="]=1;
  6711. return $recv($1)._and_((function(){
  6712. return $core.withContext(function($ctx2) {
  6713. $3=$self._y();
  6714. $ctx2.sendIdx["y"]=1;
  6715. return $recv($3).__gt_eq($recv(aPoint)._y());
  6716. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6717. }));
  6718. }, function($ctx1) {$ctx1.fill(self,">=",{aPoint:aPoint})});
  6719. },
  6720. args: ["aPoint"],
  6721. source: ">= aPoint\x0a\x09^ self x >= aPoint x and: [\x0a\x09\x09self y >= aPoint y ]",
  6722. referencedClasses: [],
  6723. pragmas: [],
  6724. messageSends: ["and:", ">=", "x", "y"]
  6725. }),
  6726. $globals.Point);
  6727. $core.addMethod(
  6728. $core.method({
  6729. selector: "angle",
  6730. protocol: "geometry",
  6731. fn: function (){
  6732. var self=this,$self=this;
  6733. return $core.withContext(function($ctx1) {
  6734. return $recv($self._y())._arcTan_($self._x());
  6735. }, function($ctx1) {$ctx1.fill(self,"angle",{})});
  6736. },
  6737. args: [],
  6738. source: "angle\x0a\x09^ self y arcTan: self x",
  6739. referencedClasses: [],
  6740. pragmas: [],
  6741. messageSends: ["arcTan:", "y", "x"]
  6742. }),
  6743. $globals.Point);
  6744. $core.addMethod(
  6745. $core.method({
  6746. selector: "asPoint",
  6747. protocol: "converting",
  6748. fn: function (){
  6749. var self=this,$self=this;
  6750. return self;
  6751. },
  6752. args: [],
  6753. source: "asPoint\x0a\x09^ self",
  6754. referencedClasses: [],
  6755. pragmas: [],
  6756. messageSends: []
  6757. }),
  6758. $globals.Point);
  6759. $core.addMethod(
  6760. $core.method({
  6761. selector: "corner:",
  6762. protocol: "rectangle creation",
  6763. fn: function (aPoint){
  6764. var self=this,$self=this;
  6765. return $core.withContext(function($ctx1) {
  6766. return $recv($globals.Rectangle)._origin_corner_(self,aPoint);
  6767. }, function($ctx1) {$ctx1.fill(self,"corner:",{aPoint:aPoint})});
  6768. },
  6769. args: ["aPoint"],
  6770. source: "corner: aPoint\x0a\x09^ Rectangle origin: self corner: aPoint",
  6771. referencedClasses: ["Rectangle"],
  6772. pragmas: [],
  6773. messageSends: ["origin:corner:"]
  6774. }),
  6775. $globals.Point);
  6776. $core.addMethod(
  6777. $core.method({
  6778. selector: "dist:",
  6779. protocol: "transforming",
  6780. fn: function (aPoint){
  6781. var self=this,$self=this;
  6782. var dx,dy;
  6783. return $core.withContext(function($ctx1) {
  6784. var $2,$1;
  6785. dx=$recv($recv(aPoint)._x()).__minus($self.x);
  6786. $ctx1.sendIdx["-"]=1;
  6787. dy=$recv($recv(aPoint)._y()).__minus($self.y);
  6788. $2=$recv(dx).__star(dx);
  6789. $ctx1.sendIdx["*"]=1;
  6790. $1=$recv($2).__plus($recv(dy).__star(dy));
  6791. return $recv($1)._sqrt();
  6792. }, function($ctx1) {$ctx1.fill(self,"dist:",{aPoint:aPoint,dx:dx,dy:dy})});
  6793. },
  6794. args: ["aPoint"],
  6795. 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",
  6796. referencedClasses: [],
  6797. pragmas: [],
  6798. messageSends: ["-", "x", "y", "sqrt", "+", "*"]
  6799. }),
  6800. $globals.Point);
  6801. $core.addMethod(
  6802. $core.method({
  6803. selector: "dotProduct:",
  6804. protocol: "point functions",
  6805. fn: function (aPoint){
  6806. var self=this,$self=this;
  6807. return $core.withContext(function($ctx1) {
  6808. var $1;
  6809. $1=$recv($self.x).__star($recv(aPoint)._x());
  6810. $ctx1.sendIdx["*"]=1;
  6811. return $recv($1).__plus($recv($self.y).__star($recv(aPoint)._y()));
  6812. }, function($ctx1) {$ctx1.fill(self,"dotProduct:",{aPoint:aPoint})});
  6813. },
  6814. args: ["aPoint"],
  6815. source: "dotProduct: aPoint\x0a\x09^ (x * aPoint x) + (y * aPoint y)",
  6816. referencedClasses: [],
  6817. pragmas: [],
  6818. messageSends: ["+", "*", "x", "y"]
  6819. }),
  6820. $globals.Point);
  6821. $core.addMethod(
  6822. $core.method({
  6823. selector: "extent:",
  6824. protocol: "rectangle creation",
  6825. fn: function (aPoint){
  6826. var self=this,$self=this;
  6827. return $core.withContext(function($ctx1) {
  6828. return $recv($globals.Rectangle)._origin_extent_(self,aPoint);
  6829. }, function($ctx1) {$ctx1.fill(self,"extent:",{aPoint:aPoint})});
  6830. },
  6831. args: ["aPoint"],
  6832. source: "extent: aPoint\x0a\x09^ Rectangle origin: self extent: aPoint",
  6833. referencedClasses: ["Rectangle"],
  6834. pragmas: [],
  6835. messageSends: ["origin:extent:"]
  6836. }),
  6837. $globals.Point);
  6838. $core.addMethod(
  6839. $core.method({
  6840. selector: "normal",
  6841. protocol: "point functions",
  6842. fn: function (){
  6843. var self=this,$self=this;
  6844. var n,d;
  6845. return $core.withContext(function($ctx1) {
  6846. var $4,$3,$6,$5,$2,$1;
  6847. n=$recv($recv($self.y)._negated()).__at($self.x);
  6848. $ctx1.sendIdx["@"]=1;
  6849. $4=$recv(n)._x();
  6850. $ctx1.sendIdx["x"]=1;
  6851. $3=$recv($4).__star($recv(n)._x());
  6852. $ctx1.sendIdx["*"]=1;
  6853. $6=$recv(n)._y();
  6854. $ctx1.sendIdx["y"]=1;
  6855. $5=$recv($6).__star($recv(n)._y());
  6856. d=$recv($3).__plus($5);
  6857. $2=d;
  6858. $1=$recv($2).__eq((0));
  6859. if($core.assert($1)){
  6860. return (-1).__at((0));
  6861. }
  6862. return $recv(n).__slash($recv(d)._sqrt());
  6863. }, function($ctx1) {$ctx1.fill(self,"normal",{n:n,d:d})});
  6864. },
  6865. args: [],
  6866. 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",
  6867. referencedClasses: [],
  6868. pragmas: [],
  6869. messageSends: ["@", "negated", "ifTrue:", "=", "+", "*", "x", "y", "/", "sqrt"]
  6870. }),
  6871. $globals.Point);
  6872. $core.addMethod(
  6873. $core.method({
  6874. selector: "normalized",
  6875. protocol: "point functions",
  6876. fn: function (){
  6877. var self=this,$self=this;
  6878. var r;
  6879. return $core.withContext(function($ctx1) {
  6880. var $1,$2,$3;
  6881. r=$self._r();
  6882. $1=$recv(r).__eq((0));
  6883. if($core.assert($1)){
  6884. $2=$recv($globals.Point)._x_y_((0),(0));
  6885. $ctx1.sendIdx["x:y:"]=1;
  6886. return $2;
  6887. } else {
  6888. $3=$recv($self.x).__slash(r);
  6889. $ctx1.sendIdx["/"]=1;
  6890. return $recv($globals.Point)._x_y_($3,$recv($self.y).__slash(r));
  6891. }
  6892. return self;
  6893. }, function($ctx1) {$ctx1.fill(self,"normalized",{r:r})});
  6894. },
  6895. args: [],
  6896. 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 ]",
  6897. referencedClasses: ["Point"],
  6898. pragmas: [],
  6899. messageSends: ["r", "ifTrue:ifFalse:", "=", "x:y:", "/"]
  6900. }),
  6901. $globals.Point);
  6902. $core.addMethod(
  6903. $core.method({
  6904. selector: "printOn:",
  6905. protocol: "printing",
  6906. fn: function (aStream){
  6907. var self=this,$self=this;
  6908. return $core.withContext(function($ctx1) {
  6909. var $1;
  6910. $recv($self.x)._printOn_(aStream);
  6911. $ctx1.sendIdx["printOn:"]=1;
  6912. $recv(aStream)._nextPutAll_("@");
  6913. $1=$recv($recv($self.y)._notNil())._and_((function(){
  6914. return $core.withContext(function($ctx2) {
  6915. return $recv($self.y)._negative();
  6916. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6917. }));
  6918. if($core.assert($1)){
  6919. $recv(aStream)._space();
  6920. }
  6921. $recv($self.y)._printOn_(aStream);
  6922. return self;
  6923. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  6924. },
  6925. args: ["aStream"],
  6926. 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",
  6927. referencedClasses: [],
  6928. pragmas: [],
  6929. messageSends: ["printOn:", "nextPutAll:", "ifTrue:", "and:", "notNil", "negative", "space"]
  6930. }),
  6931. $globals.Point);
  6932. $core.addMethod(
  6933. $core.method({
  6934. selector: "r",
  6935. protocol: "polar coordinates",
  6936. fn: function (){
  6937. var self=this,$self=this;
  6938. return $core.withContext(function($ctx1) {
  6939. var $2,$1;
  6940. $2=$recv($self.x).__star($self.x);
  6941. $ctx1.sendIdx["*"]=1;
  6942. $1=$recv($2).__plus($recv($self.y).__star($self.y));
  6943. return $recv($1)._sqrt();
  6944. }, function($ctx1) {$ctx1.fill(self,"r",{})});
  6945. },
  6946. args: [],
  6947. source: "r\x0a\x09^ ((x * x) + (y * y)) sqrt",
  6948. referencedClasses: [],
  6949. pragmas: [],
  6950. messageSends: ["sqrt", "+", "*"]
  6951. }),
  6952. $globals.Point);
  6953. $core.addMethod(
  6954. $core.method({
  6955. selector: "rectangle:",
  6956. protocol: "rectangle creation",
  6957. fn: function (aPoint){
  6958. var self=this,$self=this;
  6959. return $core.withContext(function($ctx1) {
  6960. return $recv($globals.Rectangle)._point_point_(self,aPoint);
  6961. }, function($ctx1) {$ctx1.fill(self,"rectangle:",{aPoint:aPoint})});
  6962. },
  6963. args: ["aPoint"],
  6964. source: "rectangle: aPoint\x0a\x09^ Rectangle point: self point: aPoint",
  6965. referencedClasses: ["Rectangle"],
  6966. pragmas: [],
  6967. messageSends: ["point:point:"]
  6968. }),
  6969. $globals.Point);
  6970. $core.addMethod(
  6971. $core.method({
  6972. selector: "translateBy:",
  6973. protocol: "transforming",
  6974. fn: function (delta){
  6975. var self=this,$self=this;
  6976. return $core.withContext(function($ctx1) {
  6977. var $1;
  6978. $1=$recv($recv(delta)._x()).__plus($self.x);
  6979. $ctx1.sendIdx["+"]=1;
  6980. return $recv($1).__at($recv($recv(delta)._y()).__plus($self.y));
  6981. }, function($ctx1) {$ctx1.fill(self,"translateBy:",{delta:delta})});
  6982. },
  6983. args: ["delta"],
  6984. source: "translateBy: delta\x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^ (delta x + x) @ (delta y + y)",
  6985. referencedClasses: [],
  6986. pragmas: [],
  6987. messageSends: ["@", "+", "x", "y"]
  6988. }),
  6989. $globals.Point);
  6990. $core.addMethod(
  6991. $core.method({
  6992. selector: "x",
  6993. protocol: "accessing",
  6994. fn: function (){
  6995. var self=this,$self=this;
  6996. return $self.x;
  6997. },
  6998. args: [],
  6999. source: "x\x0a\x09^ x",
  7000. referencedClasses: [],
  7001. pragmas: [],
  7002. messageSends: []
  7003. }),
  7004. $globals.Point);
  7005. $core.addMethod(
  7006. $core.method({
  7007. selector: "x:",
  7008. protocol: "accessing",
  7009. fn: function (aNumber){
  7010. var self=this,$self=this;
  7011. $self.x=aNumber;
  7012. return self;
  7013. },
  7014. args: ["aNumber"],
  7015. source: "x: aNumber\x0a\x09x := aNumber",
  7016. referencedClasses: [],
  7017. pragmas: [],
  7018. messageSends: []
  7019. }),
  7020. $globals.Point);
  7021. $core.addMethod(
  7022. $core.method({
  7023. selector: "y",
  7024. protocol: "accessing",
  7025. fn: function (){
  7026. var self=this,$self=this;
  7027. return $self.y;
  7028. },
  7029. args: [],
  7030. source: "y\x0a\x09^ y",
  7031. referencedClasses: [],
  7032. pragmas: [],
  7033. messageSends: []
  7034. }),
  7035. $globals.Point);
  7036. $core.addMethod(
  7037. $core.method({
  7038. selector: "y:",
  7039. protocol: "accessing",
  7040. fn: function (aNumber){
  7041. var self=this,$self=this;
  7042. $self.y=aNumber;
  7043. return self;
  7044. },
  7045. args: ["aNumber"],
  7046. source: "y: aNumber\x0a\x09y := aNumber",
  7047. referencedClasses: [],
  7048. pragmas: [],
  7049. messageSends: []
  7050. }),
  7051. $globals.Point);
  7052. $core.addMethod(
  7053. $core.method({
  7054. selector: "classTag",
  7055. protocol: "accessing",
  7056. fn: function (){
  7057. var self=this,$self=this;
  7058. return "magnitude";
  7059. },
  7060. args: [],
  7061. 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'",
  7062. referencedClasses: [],
  7063. pragmas: [],
  7064. messageSends: []
  7065. }),
  7066. $globals.Point.a$cls);
  7067. $core.addMethod(
  7068. $core.method({
  7069. selector: "x:y:",
  7070. protocol: "instance creation",
  7071. fn: function (aNumber,anotherNumber){
  7072. var self=this,$self=this;
  7073. return $core.withContext(function($ctx1) {
  7074. var $1;
  7075. $1=$self._new();
  7076. $recv($1)._x_(aNumber);
  7077. $recv($1)._y_(anotherNumber);
  7078. return $recv($1)._yourself();
  7079. }, function($ctx1) {$ctx1.fill(self,"x:y:",{aNumber:aNumber,anotherNumber:anotherNumber})});
  7080. },
  7081. args: ["aNumber", "anotherNumber"],
  7082. source: "x: aNumber y: anotherNumber\x0a\x09^ self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself",
  7083. referencedClasses: [],
  7084. pragmas: [],
  7085. messageSends: ["x:", "new", "y:", "yourself"]
  7086. }),
  7087. $globals.Point.a$cls);
  7088. $core.addClass("Random", $globals.Object, [], "Kernel-Objects");
  7089. $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'`.";
  7090. $core.addMethod(
  7091. $core.method({
  7092. selector: "next",
  7093. protocol: "accessing",
  7094. fn: function (){
  7095. var self=this,$self=this;
  7096. return $core.withContext(function($ctx1) {
  7097. return Math.random();
  7098. return self;
  7099. }, function($ctx1) {$ctx1.fill(self,"next",{})});
  7100. },
  7101. args: [],
  7102. source: "next\x0a\x09<inlineJS: 'return Math.random()'>",
  7103. referencedClasses: [],
  7104. pragmas: [["inlineJS:", ["return Math.random()"]]],
  7105. messageSends: []
  7106. }),
  7107. $globals.Random);
  7108. $core.addMethod(
  7109. $core.method({
  7110. selector: "next:",
  7111. protocol: "accessing",
  7112. fn: function (anInteger){
  7113. var self=this,$self=this;
  7114. return $core.withContext(function($ctx1) {
  7115. return $recv((1)._to_(anInteger))._collect_((function(each){
  7116. return $core.withContext(function($ctx2) {
  7117. return $self._next();
  7118. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7119. }));
  7120. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger})});
  7121. },
  7122. args: ["anInteger"],
  7123. source: "next: anInteger\x0a\x09^ (1 to: anInteger) collect: [ :each | self next ]",
  7124. referencedClasses: [],
  7125. pragmas: [],
  7126. messageSends: ["collect:", "to:", "next"]
  7127. }),
  7128. $globals.Random);
  7129. $core.addClass("Rectangle", $globals.Object, ["origin", "corner"], "Kernel-Objects");
  7130. $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.";
  7131. $core.addMethod(
  7132. $core.method({
  7133. selector: "=",
  7134. protocol: "testing",
  7135. fn: function (aRectangle){
  7136. var self=this,$self=this;
  7137. return $core.withContext(function($ctx1) {
  7138. var $1;
  7139. $1=$recv($self.origin).__eq($recv(aRectangle)._origin());
  7140. $ctx1.sendIdx["="]=1;
  7141. return $recv($1)._and_((function(){
  7142. return $core.withContext(function($ctx2) {
  7143. return $recv($self.corner).__eq($recv(aRectangle)._corner());
  7144. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7145. }));
  7146. }, function($ctx1) {$ctx1.fill(self,"=",{aRectangle:aRectangle})});
  7147. },
  7148. args: ["aRectangle"],
  7149. source: "= aRectangle\x0a\x09^ origin = aRectangle origin and: [ corner = aRectangle corner ]",
  7150. referencedClasses: [],
  7151. pragmas: [],
  7152. messageSends: ["and:", "=", "origin", "corner"]
  7153. }),
  7154. $globals.Rectangle);
  7155. $core.addMethod(
  7156. $core.method({
  7157. selector: "containsPoint:",
  7158. protocol: "testing",
  7159. fn: function (aPoint){
  7160. var self=this,$self=this;
  7161. return $core.withContext(function($ctx1) {
  7162. return $recv($recv($self.origin).__lt_eq(aPoint))._and_((function(){
  7163. return $core.withContext(function($ctx2) {
  7164. return $recv($self.corner).__gt_eq(aPoint);
  7165. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7166. }));
  7167. }, function($ctx1) {$ctx1.fill(self,"containsPoint:",{aPoint:aPoint})});
  7168. },
  7169. args: ["aPoint"],
  7170. source: "containsPoint: aPoint\x0a\x09^ origin <= aPoint and: [ corner >= aPoint ]",
  7171. referencedClasses: [],
  7172. pragmas: [],
  7173. messageSends: ["and:", "<=", ">="]
  7174. }),
  7175. $globals.Rectangle);
  7176. $core.addMethod(
  7177. $core.method({
  7178. selector: "containsRect:",
  7179. protocol: "testing",
  7180. fn: function (aRect){
  7181. var self=this,$self=this;
  7182. return $core.withContext(function($ctx1) {
  7183. return $recv($recv($recv(aRect)._origin()).__gt_eq($self.origin))._and_((function(){
  7184. return $core.withContext(function($ctx2) {
  7185. return $recv($recv(aRect)._corner()).__lt_eq($self.corner);
  7186. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7187. }));
  7188. }, function($ctx1) {$ctx1.fill(self,"containsRect:",{aRect:aRect})});
  7189. },
  7190. args: ["aRect"],
  7191. source: "containsRect: aRect\x0a\x09^ aRect origin >= origin and: [ aRect corner <= corner ]",
  7192. referencedClasses: [],
  7193. pragmas: [],
  7194. messageSends: ["and:", ">=", "origin", "<=", "corner"]
  7195. }),
  7196. $globals.Rectangle);
  7197. $core.addMethod(
  7198. $core.method({
  7199. selector: "corner",
  7200. protocol: "accessing",
  7201. fn: function (){
  7202. var self=this,$self=this;
  7203. return $self.corner;
  7204. },
  7205. args: [],
  7206. source: "corner\x0a\x09^ corner",
  7207. referencedClasses: [],
  7208. pragmas: [],
  7209. messageSends: []
  7210. }),
  7211. $globals.Rectangle);
  7212. $core.addMethod(
  7213. $core.method({
  7214. selector: "origin",
  7215. protocol: "accessing",
  7216. fn: function (){
  7217. var self=this,$self=this;
  7218. return $self.origin;
  7219. },
  7220. args: [],
  7221. source: "origin\x0a\x09^ origin",
  7222. referencedClasses: [],
  7223. pragmas: [],
  7224. messageSends: []
  7225. }),
  7226. $globals.Rectangle);
  7227. $core.addMethod(
  7228. $core.method({
  7229. selector: "printOn:",
  7230. protocol: "testing",
  7231. fn: function (aStream){
  7232. var self=this,$self=this;
  7233. return $core.withContext(function($ctx1) {
  7234. $recv($self.origin)._printOn_(aStream);
  7235. $ctx1.sendIdx["printOn:"]=1;
  7236. $recv(aStream)._nextPutAll_(" corner: ");
  7237. $recv($self.corner)._printOn_(aStream);
  7238. return self;
  7239. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  7240. },
  7241. args: ["aStream"],
  7242. source: "printOn: aStream\x0a\x09origin printOn: aStream.\x0a\x09aStream nextPutAll: ' corner: '.\x0a\x09corner printOn: aStream.",
  7243. referencedClasses: [],
  7244. pragmas: [],
  7245. messageSends: ["printOn:", "nextPutAll:"]
  7246. }),
  7247. $globals.Rectangle);
  7248. $core.addMethod(
  7249. $core.method({
  7250. selector: "setPoint:point:",
  7251. protocol: "private",
  7252. fn: function (pt1,pt2){
  7253. var self=this,$self=this;
  7254. return $core.withContext(function($ctx1) {
  7255. var $2,$3,$1,$5,$6,$4,$8,$7,$10,$9;
  7256. $2=$recv(pt1)._x();
  7257. $ctx1.sendIdx["x"]=1;
  7258. $3=$recv(pt2)._x();
  7259. $ctx1.sendIdx["x"]=2;
  7260. $1=$recv($2)._min_($3);
  7261. $ctx1.sendIdx["min:"]=1;
  7262. $5=$recv(pt1)._y();
  7263. $ctx1.sendIdx["y"]=1;
  7264. $6=$recv(pt2)._y();
  7265. $ctx1.sendIdx["y"]=2;
  7266. $4=$recv($5)._min_($6);
  7267. $self.origin=$recv($1).__at($4);
  7268. $ctx1.sendIdx["@"]=1;
  7269. $8=$recv(pt1)._x();
  7270. $ctx1.sendIdx["x"]=3;
  7271. $7=$recv($8)._max_($recv(pt2)._x());
  7272. $ctx1.sendIdx["max:"]=1;
  7273. $10=$recv(pt1)._y();
  7274. $ctx1.sendIdx["y"]=3;
  7275. $9=$recv($10)._max_($recv(pt2)._y());
  7276. $self.corner=$recv($7).__at($9);
  7277. return self;
  7278. }, function($ctx1) {$ctx1.fill(self,"setPoint:point:",{pt1:pt1,pt2:pt2})});
  7279. },
  7280. args: ["pt1", "pt2"],
  7281. 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).",
  7282. referencedClasses: [],
  7283. pragmas: [],
  7284. messageSends: ["@", "min:", "x", "y", "max:"]
  7285. }),
  7286. $globals.Rectangle);
  7287. $core.addMethod(
  7288. $core.method({
  7289. selector: "origin:corner:",
  7290. protocol: "instance creation",
  7291. fn: function (anOrigin,aCorner){
  7292. var self=this,$self=this;
  7293. return $core.withContext(function($ctx1) {
  7294. return $recv($self._basicNew())._setPoint_point_(anOrigin,aCorner);
  7295. }, function($ctx1) {$ctx1.fill(self,"origin:corner:",{anOrigin:anOrigin,aCorner:aCorner})});
  7296. },
  7297. args: ["anOrigin", "aCorner"],
  7298. source: "origin: anOrigin corner: aCorner\x0a\x09^ self basicNew setPoint: anOrigin point: aCorner.",
  7299. referencedClasses: [],
  7300. pragmas: [],
  7301. messageSends: ["setPoint:point:", "basicNew"]
  7302. }),
  7303. $globals.Rectangle.a$cls);
  7304. $core.addMethod(
  7305. $core.method({
  7306. selector: "origin:extent:",
  7307. protocol: "instance creation",
  7308. fn: function (anOrigin,anExtent){
  7309. var self=this,$self=this;
  7310. return $core.withContext(function($ctx1) {
  7311. return $recv($self._basicNew())._setPoint_point_(anOrigin,$recv(anOrigin).__plus(anExtent));
  7312. }, function($ctx1) {$ctx1.fill(self,"origin:extent:",{anOrigin:anOrigin,anExtent:anExtent})});
  7313. },
  7314. args: ["anOrigin", "anExtent"],
  7315. source: "origin: anOrigin extent: anExtent\x0a\x09^ self basicNew setPoint: anOrigin point: anOrigin + anExtent.",
  7316. referencedClasses: [],
  7317. pragmas: [],
  7318. messageSends: ["setPoint:point:", "basicNew", "+"]
  7319. }),
  7320. $globals.Rectangle.a$cls);
  7321. $core.addMethod(
  7322. $core.method({
  7323. selector: "point:point:",
  7324. protocol: "instance creation",
  7325. fn: function (anOrigin,aCorner){
  7326. var self=this,$self=this;
  7327. return $core.withContext(function($ctx1) {
  7328. return $recv($self._basicNew())._setPoint_point_(anOrigin,aCorner);
  7329. }, function($ctx1) {$ctx1.fill(self,"point:point:",{anOrigin:anOrigin,aCorner:aCorner})});
  7330. },
  7331. args: ["anOrigin", "aCorner"],
  7332. source: "point: anOrigin point: aCorner\x0a\x09^ self basicNew setPoint: anOrigin point: aCorner.",
  7333. referencedClasses: [],
  7334. pragmas: [],
  7335. messageSends: ["setPoint:point:", "basicNew"]
  7336. }),
  7337. $globals.Rectangle.a$cls);
  7338. $core.addClass("UndefinedObject", $globals.Object, [], "Kernel-Objects");
  7339. $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`.";
  7340. $core.addMethod(
  7341. $core.method({
  7342. selector: "==",
  7343. protocol: "testing",
  7344. fn: function (anObject){
  7345. var self=this,$self=this;
  7346. return $core.withContext(function($ctx1) {
  7347. return $recv(anObject)._isNil();
  7348. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject})});
  7349. },
  7350. args: ["anObject"],
  7351. source: "== anObject\x0a\x09^ anObject isNil",
  7352. referencedClasses: [],
  7353. pragmas: [],
  7354. messageSends: ["isNil"]
  7355. }),
  7356. $globals.UndefinedObject);
  7357. $core.addMethod(
  7358. $core.method({
  7359. selector: "asJavaScriptObject",
  7360. protocol: "converting",
  7361. fn: function (){
  7362. var self=this,$self=this;
  7363. return null;
  7364. },
  7365. args: [],
  7366. source: "asJavaScriptObject\x0a\x09^ null",
  7367. referencedClasses: [],
  7368. pragmas: [],
  7369. messageSends: []
  7370. }),
  7371. $globals.UndefinedObject);
  7372. $core.addMethod(
  7373. $core.method({
  7374. selector: "deepCopy",
  7375. protocol: "copying",
  7376. fn: function (){
  7377. var self=this,$self=this;
  7378. return self;
  7379. },
  7380. args: [],
  7381. source: "deepCopy\x0a\x09^ self",
  7382. referencedClasses: [],
  7383. pragmas: [],
  7384. messageSends: []
  7385. }),
  7386. $globals.UndefinedObject);
  7387. $core.addMethod(
  7388. $core.method({
  7389. selector: "identityHash",
  7390. protocol: "accessing",
  7391. fn: function (){
  7392. var self=this,$self=this;
  7393. return "NIL";
  7394. },
  7395. args: [],
  7396. source: "identityHash\x0a\x09^ 'NIL'",
  7397. referencedClasses: [],
  7398. pragmas: [],
  7399. messageSends: []
  7400. }),
  7401. $globals.UndefinedObject);
  7402. $core.addMethod(
  7403. $core.method({
  7404. selector: "ifNil:",
  7405. protocol: "testing",
  7406. fn: function (aBlock){
  7407. var self=this,$self=this;
  7408. return $core.withContext(function($ctx1) {
  7409. return $self._ifNil_ifNotNil_(aBlock,(function(){
  7410. }));
  7411. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock})});
  7412. },
  7413. args: ["aBlock"],
  7414. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifNil: aBlock ifNotNil: []",
  7415. referencedClasses: [],
  7416. pragmas: [],
  7417. messageSends: ["ifNil:ifNotNil:"]
  7418. }),
  7419. $globals.UndefinedObject);
  7420. $core.addMethod(
  7421. $core.method({
  7422. selector: "ifNil:ifNotNil:",
  7423. protocol: "testing",
  7424. fn: function (aBlock,anotherBlock){
  7425. var self=this,$self=this;
  7426. return $core.withContext(function($ctx1) {
  7427. return $recv(aBlock)._value();
  7428. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  7429. },
  7430. args: ["aBlock", "anotherBlock"],
  7431. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value",
  7432. referencedClasses: [],
  7433. pragmas: [],
  7434. messageSends: ["value"]
  7435. }),
  7436. $globals.UndefinedObject);
  7437. $core.addMethod(
  7438. $core.method({
  7439. selector: "ifNotNil:",
  7440. protocol: "testing",
  7441. fn: function (aBlock){
  7442. var self=this,$self=this;
  7443. return self;
  7444. },
  7445. args: ["aBlock"],
  7446. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  7447. referencedClasses: [],
  7448. pragmas: [],
  7449. messageSends: []
  7450. }),
  7451. $globals.UndefinedObject);
  7452. $core.addMethod(
  7453. $core.method({
  7454. selector: "ifNotNil:ifNil:",
  7455. protocol: "testing",
  7456. fn: function (aBlock,anotherBlock){
  7457. var self=this,$self=this;
  7458. return $core.withContext(function($ctx1) {
  7459. return $recv(anotherBlock)._value();
  7460. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  7461. },
  7462. args: ["aBlock", "anotherBlock"],
  7463. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value",
  7464. referencedClasses: [],
  7465. pragmas: [],
  7466. messageSends: ["value"]
  7467. }),
  7468. $globals.UndefinedObject);
  7469. $core.addMethod(
  7470. $core.method({
  7471. selector: "isImmutable",
  7472. protocol: "testing",
  7473. fn: function (){
  7474. var self=this,$self=this;
  7475. return true;
  7476. },
  7477. args: [],
  7478. source: "isImmutable\x0a\x09^ true",
  7479. referencedClasses: [],
  7480. pragmas: [],
  7481. messageSends: []
  7482. }),
  7483. $globals.UndefinedObject);
  7484. $core.addMethod(
  7485. $core.method({
  7486. selector: "isNil",
  7487. protocol: "testing",
  7488. fn: function (){
  7489. var self=this,$self=this;
  7490. return true;
  7491. },
  7492. args: [],
  7493. source: "isNil\x0a\x09^ true",
  7494. referencedClasses: [],
  7495. pragmas: [],
  7496. messageSends: []
  7497. }),
  7498. $globals.UndefinedObject);
  7499. $core.addMethod(
  7500. $core.method({
  7501. selector: "notNil",
  7502. protocol: "testing",
  7503. fn: function (){
  7504. var self=this,$self=this;
  7505. return false;
  7506. },
  7507. args: [],
  7508. source: "notNil\x0a\x09^ false",
  7509. referencedClasses: [],
  7510. pragmas: [],
  7511. messageSends: []
  7512. }),
  7513. $globals.UndefinedObject);
  7514. $core.addMethod(
  7515. $core.method({
  7516. selector: "printOn:",
  7517. protocol: "printing",
  7518. fn: function (aStream){
  7519. var self=this,$self=this;
  7520. return $core.withContext(function($ctx1) {
  7521. $recv(aStream)._nextPutAll_("nil");
  7522. return self;
  7523. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  7524. },
  7525. args: ["aStream"],
  7526. source: "printOn: aStream\x0a\x09aStream nextPutAll: 'nil'",
  7527. referencedClasses: [],
  7528. pragmas: [],
  7529. messageSends: ["nextPutAll:"]
  7530. }),
  7531. $globals.UndefinedObject);
  7532. $core.addMethod(
  7533. $core.method({
  7534. selector: "shallowCopy",
  7535. protocol: "copying",
  7536. fn: function (){
  7537. var self=this,$self=this;
  7538. return self;
  7539. },
  7540. args: [],
  7541. source: "shallowCopy\x0a\x09^ self",
  7542. referencedClasses: [],
  7543. pragmas: [],
  7544. messageSends: []
  7545. }),
  7546. $globals.UndefinedObject);
  7547. $core.addMethod(
  7548. $core.method({
  7549. selector: "value",
  7550. protocol: "evaluating",
  7551. fn: function (){
  7552. var self=this,$self=this;
  7553. return $core.withContext(function($ctx1) {
  7554. return null;
  7555. return self;
  7556. }, function($ctx1) {$ctx1.fill(self,"value",{})});
  7557. },
  7558. args: [],
  7559. source: "value\x0a\x09<inlineJS: 'return null'>",
  7560. referencedClasses: [],
  7561. pragmas: [["inlineJS:", ["return null"]]],
  7562. messageSends: []
  7563. }),
  7564. $globals.UndefinedObject);
  7565. $core.addMethod(
  7566. $core.method({
  7567. selector: "new",
  7568. protocol: "instance creation",
  7569. fn: function (){
  7570. var self=this,$self=this;
  7571. return $core.withContext(function($ctx1) {
  7572. $self._error_("You cannot create new instances of UndefinedObject. Use nil");
  7573. return self;
  7574. }, function($ctx1) {$ctx1.fill(self,"new",{})});
  7575. },
  7576. args: [],
  7577. source: "new\x0a\x09\x09self error: 'You cannot create new instances of UndefinedObject. Use nil'",
  7578. referencedClasses: [],
  7579. pragmas: [],
  7580. messageSends: ["error:"]
  7581. }),
  7582. $globals.UndefinedObject.a$cls);
  7583. $core.setTraitComposition([{trait: $globals.TSubclassable}], $globals.UndefinedObject);
  7584. });
  7585. define('amber/core/Kernel-Collections',["amber/boot", "require", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  7586. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  7587. var $pkg = $core.addPackage("Kernel-Collections");
  7588. $pkg.innerEval = function (expr) { return eval(expr); };
  7589. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  7590. $core.addClass("Association", $globals.Object, ["key", "value"], "Kernel-Collections");
  7591. $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:`";
  7592. $core.addMethod(
  7593. $core.method({
  7594. selector: "=",
  7595. protocol: "comparing",
  7596. fn: function (anAssociation){
  7597. var self=this,$self=this;
  7598. return $core.withContext(function($ctx1) {
  7599. var $3,$2,$5,$4,$6,$1;
  7600. $3=$self._class();
  7601. $ctx1.sendIdx["class"]=1;
  7602. $2=$recv($3).__eq($recv(anAssociation)._class());
  7603. $ctx1.sendIdx["="]=1;
  7604. $1=$recv($2)._and_((function(){
  7605. return $core.withContext(function($ctx2) {
  7606. $5=$self._key();
  7607. $ctx2.sendIdx["key"]=1;
  7608. $4=$recv($5).__eq($recv(anAssociation)._key());
  7609. $ctx2.sendIdx["="]=2;
  7610. return $recv($4)._and_((function(){
  7611. return $core.withContext(function($ctx3) {
  7612. $6=$self._value();
  7613. $ctx3.sendIdx["value"]=1;
  7614. return $recv($6).__eq($recv(anAssociation)._value());
  7615. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  7616. }));
  7617. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7618. }));
  7619. $ctx1.sendIdx["and:"]=1;
  7620. return $1;
  7621. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation})});
  7622. },
  7623. args: ["anAssociation"],
  7624. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  7625. referencedClasses: [],
  7626. pragmas: [],
  7627. messageSends: ["and:", "=", "class", "key", "value"]
  7628. }),
  7629. $globals.Association);
  7630. $core.addMethod(
  7631. $core.method({
  7632. selector: "key",
  7633. protocol: "accessing",
  7634. fn: function (){
  7635. var self=this,$self=this;
  7636. return $self.key;
  7637. },
  7638. args: [],
  7639. source: "key\x0a\x09^ key",
  7640. referencedClasses: [],
  7641. pragmas: [],
  7642. messageSends: []
  7643. }),
  7644. $globals.Association);
  7645. $core.addMethod(
  7646. $core.method({
  7647. selector: "key:",
  7648. protocol: "accessing",
  7649. fn: function (aKey){
  7650. var self=this,$self=this;
  7651. $self.key=aKey;
  7652. return self;
  7653. },
  7654. args: ["aKey"],
  7655. source: "key: aKey\x0a\x09key := aKey",
  7656. referencedClasses: [],
  7657. pragmas: [],
  7658. messageSends: []
  7659. }),
  7660. $globals.Association);
  7661. $core.addMethod(
  7662. $core.method({
  7663. selector: "printOn:",
  7664. protocol: "printing",
  7665. fn: function (aStream){
  7666. var self=this,$self=this;
  7667. return $core.withContext(function($ctx1) {
  7668. $recv($self._key())._printOn_(aStream);
  7669. $ctx1.sendIdx["printOn:"]=1;
  7670. $recv(aStream)._nextPutAll_(" -> ");
  7671. $recv($self._value())._printOn_(aStream);
  7672. return self;
  7673. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  7674. },
  7675. args: ["aStream"],
  7676. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  7677. referencedClasses: [],
  7678. pragmas: [],
  7679. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  7680. }),
  7681. $globals.Association);
  7682. $core.addMethod(
  7683. $core.method({
  7684. selector: "value",
  7685. protocol: "accessing",
  7686. fn: function (){
  7687. var self=this,$self=this;
  7688. return $self.value;
  7689. },
  7690. args: [],
  7691. source: "value\x0a\x09^ value",
  7692. referencedClasses: [],
  7693. pragmas: [],
  7694. messageSends: []
  7695. }),
  7696. $globals.Association);
  7697. $core.addMethod(
  7698. $core.method({
  7699. selector: "value:",
  7700. protocol: "accessing",
  7701. fn: function (aValue){
  7702. var self=this,$self=this;
  7703. $self.value=aValue;
  7704. return self;
  7705. },
  7706. args: ["aValue"],
  7707. source: "value: aValue\x0a\x09value := aValue",
  7708. referencedClasses: [],
  7709. pragmas: [],
  7710. messageSends: []
  7711. }),
  7712. $globals.Association);
  7713. $core.addMethod(
  7714. $core.method({
  7715. selector: "key:value:",
  7716. protocol: "instance creation",
  7717. fn: function (aKey,aValue){
  7718. var self=this,$self=this;
  7719. return $core.withContext(function($ctx1) {
  7720. var $1;
  7721. $1=$self._new();
  7722. $recv($1)._key_(aKey);
  7723. $recv($1)._value_(aValue);
  7724. return $recv($1)._yourself();
  7725. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue})});
  7726. },
  7727. args: ["aKey", "aValue"],
  7728. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  7729. referencedClasses: [],
  7730. pragmas: [],
  7731. messageSends: ["key:", "new", "value:", "yourself"]
  7732. }),
  7733. $globals.Association.a$cls);
  7734. $core.addClass("BucketStore", $globals.Object, ["buckets", "hashBlock"], "Kernel-Collections");
  7735. $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`.";
  7736. $core.addMethod(
  7737. $core.method({
  7738. selector: "bucketOfElement:",
  7739. protocol: "accessing",
  7740. fn: function (anObject){
  7741. var self=this,$self=this;
  7742. return $core.withContext(function($ctx1) {
  7743. var hash = $self.hashBlock(anObject);
  7744. if (!hash) return null;
  7745. var buckets = $self.buckets,
  7746. bucket = buckets[hash];
  7747. if (!bucket) { bucket = buckets[hash] = $self._newBucket(); }
  7748. return bucket;
  7749. ;
  7750. return self;
  7751. }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject})});
  7752. },
  7753. args: ["anObject"],
  7754. 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'>",
  7755. referencedClasses: [],
  7756. 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"]]],
  7757. messageSends: []
  7758. }),
  7759. $globals.BucketStore);
  7760. $core.addMethod(
  7761. $core.method({
  7762. selector: "do:",
  7763. protocol: "enumerating",
  7764. fn: function (aBlock){
  7765. var self=this,$self=this;
  7766. return $core.withContext(function($ctx1) {
  7767. var buckets = $self.buckets;
  7768. var keys = Object.keys(buckets);
  7769. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  7770. ;
  7771. return self;
  7772. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  7773. },
  7774. args: ["aBlock"],
  7775. 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'>",
  7776. referencedClasses: [],
  7777. 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"]]],
  7778. messageSends: []
  7779. }),
  7780. $globals.BucketStore);
  7781. $core.addMethod(
  7782. $core.method({
  7783. selector: "hashBlock:",
  7784. protocol: "accessing",
  7785. fn: function (aBlock){
  7786. var self=this,$self=this;
  7787. $self.hashBlock=aBlock;
  7788. return self;
  7789. },
  7790. args: ["aBlock"],
  7791. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  7792. referencedClasses: [],
  7793. pragmas: [],
  7794. messageSends: []
  7795. }),
  7796. $globals.BucketStore);
  7797. $core.addMethod(
  7798. $core.method({
  7799. selector: "initialize",
  7800. protocol: "initialization",
  7801. fn: function (){
  7802. var self=this,$self=this;
  7803. return $core.withContext(function($ctx1) {
  7804. (
  7805. $ctx1.supercall = true,
  7806. ($globals.BucketStore.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  7807. $ctx1.supercall = false;
  7808. $self._removeAll();
  7809. return self;
  7810. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  7811. },
  7812. args: [],
  7813. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  7814. referencedClasses: [],
  7815. pragmas: [],
  7816. messageSends: ["initialize", "removeAll"]
  7817. }),
  7818. $globals.BucketStore);
  7819. $core.addMethod(
  7820. $core.method({
  7821. selector: "newBucket",
  7822. protocol: "private",
  7823. fn: function (){
  7824. var self=this,$self=this;
  7825. return $core.withContext(function($ctx1) {
  7826. $self._subclassResponsibility();
  7827. return self;
  7828. }, function($ctx1) {$ctx1.fill(self,"newBucket",{})});
  7829. },
  7830. args: [],
  7831. source: "newBucket\x0a\x09self subclassResponsibility",
  7832. referencedClasses: [],
  7833. pragmas: [],
  7834. messageSends: ["subclassResponsibility"]
  7835. }),
  7836. $globals.BucketStore);
  7837. $core.addMethod(
  7838. $core.method({
  7839. selector: "removeAll",
  7840. protocol: "adding/removing",
  7841. fn: function (){
  7842. var self=this,$self=this;
  7843. return $core.withContext(function($ctx1) {
  7844. $self.buckets = Object.create(null);;
  7845. return self;
  7846. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  7847. },
  7848. args: [],
  7849. source: "removeAll\x0a\x09<inlineJS: '$self.buckets = Object.create(null);'>",
  7850. referencedClasses: [],
  7851. pragmas: [["inlineJS:", ["$self.buckets = Object.create(null);"]]],
  7852. messageSends: []
  7853. }),
  7854. $globals.BucketStore);
  7855. $core.addMethod(
  7856. $core.method({
  7857. selector: "hashBlock:",
  7858. protocol: "instance creation",
  7859. fn: function (aBlock){
  7860. var self=this,$self=this;
  7861. return $core.withContext(function($ctx1) {
  7862. var $1;
  7863. $1=$self._new();
  7864. $recv($1)._hashBlock_(aBlock);
  7865. return $recv($1)._yourself();
  7866. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock})});
  7867. },
  7868. args: ["aBlock"],
  7869. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  7870. referencedClasses: [],
  7871. pragmas: [],
  7872. messageSends: ["hashBlock:", "new", "yourself"]
  7873. }),
  7874. $globals.BucketStore.a$cls);
  7875. $core.addClass("ArrayBucketStore", $globals.BucketStore, [], "Kernel-Collections");
  7876. $globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  7877. $core.addMethod(
  7878. $core.method({
  7879. selector: "newBucket",
  7880. protocol: "private",
  7881. fn: function (){
  7882. var self=this,$self=this;
  7883. return [];
  7884. },
  7885. args: [],
  7886. source: "newBucket\x0a\x09^ #()",
  7887. referencedClasses: [],
  7888. pragmas: [],
  7889. messageSends: []
  7890. }),
  7891. $globals.ArrayBucketStore);
  7892. $core.addClass("Collection", $globals.Object, [], "Kernel-Collections");
  7893. $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.";
  7894. $core.addMethod(
  7895. $core.method({
  7896. selector: ",",
  7897. protocol: "copying",
  7898. fn: function (aCollection){
  7899. var self=this,$self=this;
  7900. return $core.withContext(function($ctx1) {
  7901. var $1;
  7902. $1=$self._copy();
  7903. $recv($1)._addAll_(aCollection);
  7904. return $recv($1)._yourself();
  7905. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection})});
  7906. },
  7907. args: ["aCollection"],
  7908. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  7909. referencedClasses: [],
  7910. pragmas: [],
  7911. messageSends: ["addAll:", "copy", "yourself"]
  7912. }),
  7913. $globals.Collection);
  7914. $core.addMethod(
  7915. $core.method({
  7916. selector: "add:",
  7917. protocol: "adding/removing",
  7918. fn: function (anObject){
  7919. var self=this,$self=this;
  7920. return $core.withContext(function($ctx1) {
  7921. $self._subclassResponsibility();
  7922. return self;
  7923. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject})});
  7924. },
  7925. args: ["anObject"],
  7926. source: "add: anObject\x0a\x09self subclassResponsibility",
  7927. referencedClasses: [],
  7928. pragmas: [],
  7929. messageSends: ["subclassResponsibility"]
  7930. }),
  7931. $globals.Collection);
  7932. $core.addMethod(
  7933. $core.method({
  7934. selector: "addAll:",
  7935. protocol: "adding/removing",
  7936. fn: function (aCollection){
  7937. var self=this,$self=this;
  7938. return $core.withContext(function($ctx1) {
  7939. $recv(aCollection)._do_((function(each){
  7940. return $core.withContext(function($ctx2) {
  7941. return $self._add_(each);
  7942. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7943. }));
  7944. return aCollection;
  7945. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection})});
  7946. },
  7947. args: ["aCollection"],
  7948. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  7949. referencedClasses: [],
  7950. pragmas: [],
  7951. messageSends: ["do:", "add:"]
  7952. }),
  7953. $globals.Collection);
  7954. $core.addMethod(
  7955. $core.method({
  7956. selector: "allSatisfy:",
  7957. protocol: "enumerating",
  7958. fn: function (aBlock){
  7959. var self=this,$self=this;
  7960. return $core.withContext(function($ctx1) {
  7961. var $1;
  7962. var $early={};
  7963. try {
  7964. $self._do_((function(each){
  7965. return $core.withContext(function($ctx2) {
  7966. $1=$recv(aBlock)._value_(each);
  7967. if(!$core.assert($1)){
  7968. throw $early=[false];
  7969. }
  7970. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7971. }));
  7972. return true;
  7973. }
  7974. catch(e) {if(e===$early)return e[0]; throw e}
  7975. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock})});
  7976. },
  7977. args: ["aBlock"],
  7978. 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",
  7979. referencedClasses: [],
  7980. pragmas: [],
  7981. messageSends: ["do:", "ifFalse:", "value:"]
  7982. }),
  7983. $globals.Collection);
  7984. $core.addMethod(
  7985. $core.method({
  7986. selector: "anyOne",
  7987. protocol: "accessing",
  7988. fn: function (){
  7989. var self=this,$self=this;
  7990. return $core.withContext(function($ctx1) {
  7991. var $early={};
  7992. try {
  7993. $self._ifEmpty_((function(){
  7994. return $core.withContext(function($ctx2) {
  7995. return $self._error_("Collection is empty");
  7996. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7997. }));
  7998. $self._do_((function(each){
  7999. throw $early=[each];
  8000. }));
  8001. return self;
  8002. }
  8003. catch(e) {if(e===$early)return e[0]; throw e}
  8004. }, function($ctx1) {$ctx1.fill(self,"anyOne",{})});
  8005. },
  8006. args: [],
  8007. 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 ]",
  8008. referencedClasses: [],
  8009. pragmas: [],
  8010. messageSends: ["ifEmpty:", "error:", "do:"]
  8011. }),
  8012. $globals.Collection);
  8013. $core.addMethod(
  8014. $core.method({
  8015. selector: "anySatisfy:",
  8016. protocol: "enumerating",
  8017. fn: function (aBlock){
  8018. var self=this,$self=this;
  8019. return $core.withContext(function($ctx1) {
  8020. var $1;
  8021. var $early={};
  8022. try {
  8023. $self._do_((function(each){
  8024. return $core.withContext(function($ctx2) {
  8025. $1=$recv(aBlock)._value_(each);
  8026. if($core.assert($1)){
  8027. throw $early=[true];
  8028. }
  8029. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8030. }));
  8031. return false;
  8032. }
  8033. catch(e) {if(e===$early)return e[0]; throw e}
  8034. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock})});
  8035. },
  8036. args: ["aBlock"],
  8037. 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",
  8038. referencedClasses: [],
  8039. pragmas: [],
  8040. messageSends: ["do:", "ifTrue:", "value:"]
  8041. }),
  8042. $globals.Collection);
  8043. $core.addMethod(
  8044. $core.method({
  8045. selector: "asArray",
  8046. protocol: "converting",
  8047. fn: function (){
  8048. var self=this,$self=this;
  8049. return $core.withContext(function($ctx1) {
  8050. return $recv($globals.Array)._withAll_(self);
  8051. }, function($ctx1) {$ctx1.fill(self,"asArray",{})});
  8052. },
  8053. args: [],
  8054. source: "asArray\x0a\x09^ Array withAll: self",
  8055. referencedClasses: ["Array"],
  8056. pragmas: [],
  8057. messageSends: ["withAll:"]
  8058. }),
  8059. $globals.Collection);
  8060. $core.addMethod(
  8061. $core.method({
  8062. selector: "asJavaScriptObject",
  8063. protocol: "converting",
  8064. fn: function (){
  8065. var self=this,$self=this;
  8066. return $core.withContext(function($ctx1) {
  8067. return $recv($self._asArray())._collect_((function(each){
  8068. return $core.withContext(function($ctx2) {
  8069. return $recv(each)._asJavaScriptObject();
  8070. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8071. }));
  8072. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{})});
  8073. },
  8074. args: [],
  8075. source: "asJavaScriptObject\x0a\x09^ self asArray collect: [ :each | each asJavaScriptObject ]",
  8076. referencedClasses: [],
  8077. pragmas: [],
  8078. messageSends: ["collect:", "asArray", "asJavaScriptObject"]
  8079. }),
  8080. $globals.Collection);
  8081. $core.addMethod(
  8082. $core.method({
  8083. selector: "asOrderedCollection",
  8084. protocol: "converting",
  8085. fn: function (){
  8086. var self=this,$self=this;
  8087. return $core.withContext(function($ctx1) {
  8088. return $self._asArray();
  8089. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{})});
  8090. },
  8091. args: [],
  8092. source: "asOrderedCollection\x0a\x09^ self asArray",
  8093. referencedClasses: [],
  8094. pragmas: [],
  8095. messageSends: ["asArray"]
  8096. }),
  8097. $globals.Collection);
  8098. $core.addMethod(
  8099. $core.method({
  8100. selector: "asSet",
  8101. protocol: "converting",
  8102. fn: function (){
  8103. var self=this,$self=this;
  8104. return $core.withContext(function($ctx1) {
  8105. return $recv($globals.Set)._withAll_(self);
  8106. }, function($ctx1) {$ctx1.fill(self,"asSet",{})});
  8107. },
  8108. args: [],
  8109. source: "asSet\x0a\x09^ Set withAll: self",
  8110. referencedClasses: ["Set"],
  8111. pragmas: [],
  8112. messageSends: ["withAll:"]
  8113. }),
  8114. $globals.Collection);
  8115. $core.addMethod(
  8116. $core.method({
  8117. selector: "collect:",
  8118. protocol: "enumerating",
  8119. fn: function (aBlock){
  8120. var self=this,$self=this;
  8121. var stream;
  8122. return $core.withContext(function($ctx1) {
  8123. stream=$recv($recv($self._class())._new())._writeStream();
  8124. $self._do_((function(each){
  8125. return $core.withContext(function($ctx2) {
  8126. return $recv(stream)._nextPut_($recv(aBlock)._value_(each));
  8127. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8128. }));
  8129. return $recv(stream)._contents();
  8130. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream})});
  8131. },
  8132. args: ["aBlock"],
  8133. 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",
  8134. referencedClasses: [],
  8135. pragmas: [],
  8136. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  8137. }),
  8138. $globals.Collection);
  8139. $core.addMethod(
  8140. $core.method({
  8141. selector: "copyWith:",
  8142. protocol: "copying",
  8143. fn: function (anObject){
  8144. var self=this,$self=this;
  8145. return $core.withContext(function($ctx1) {
  8146. var $1;
  8147. $1=$self._copy();
  8148. $recv($1)._add_(anObject);
  8149. return $recv($1)._yourself();
  8150. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject})});
  8151. },
  8152. args: ["anObject"],
  8153. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  8154. referencedClasses: [],
  8155. pragmas: [],
  8156. messageSends: ["add:", "copy", "yourself"]
  8157. }),
  8158. $globals.Collection);
  8159. $core.addMethod(
  8160. $core.method({
  8161. selector: "copyWithAll:",
  8162. protocol: "copying",
  8163. fn: function (aCollection){
  8164. var self=this,$self=this;
  8165. return $core.withContext(function($ctx1) {
  8166. $self._deprecatedAPI_("Use #, instead.");
  8167. return $self.__comma(aCollection);
  8168. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection})});
  8169. },
  8170. args: ["aCollection"],
  8171. source: "copyWithAll: aCollection\x0a\x09self deprecatedAPI: 'Use #, instead.'.\x0a\x09^ self, aCollection",
  8172. referencedClasses: [],
  8173. pragmas: [],
  8174. messageSends: ["deprecatedAPI:", ","]
  8175. }),
  8176. $globals.Collection);
  8177. $core.addMethod(
  8178. $core.method({
  8179. selector: "copyWithout:",
  8180. protocol: "copying",
  8181. fn: function (anObject){
  8182. var self=this,$self=this;
  8183. return $core.withContext(function($ctx1) {
  8184. return $self._reject_((function(each){
  8185. return $core.withContext(function($ctx2) {
  8186. return $recv(each).__eq(anObject);
  8187. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8188. }));
  8189. }, function($ctx1) {$ctx1.fill(self,"copyWithout:",{anObject:anObject})});
  8190. },
  8191. args: ["anObject"],
  8192. 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 ]",
  8193. referencedClasses: [],
  8194. pragmas: [],
  8195. messageSends: ["reject:", "="]
  8196. }),
  8197. $globals.Collection);
  8198. $core.addMethod(
  8199. $core.method({
  8200. selector: "copyWithoutAll:",
  8201. protocol: "copying",
  8202. fn: function (aCollection){
  8203. var self=this,$self=this;
  8204. return $core.withContext(function($ctx1) {
  8205. return $self._reject_((function(each){
  8206. return $core.withContext(function($ctx2) {
  8207. return $recv(aCollection)._includes_(each);
  8208. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8209. }));
  8210. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection})});
  8211. },
  8212. args: ["aCollection"],
  8213. 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 ]",
  8214. referencedClasses: [],
  8215. pragmas: [],
  8216. messageSends: ["reject:", "includes:"]
  8217. }),
  8218. $globals.Collection);
  8219. $core.addMethod(
  8220. $core.method({
  8221. selector: "deepCopy",
  8222. protocol: "copying",
  8223. fn: function (){
  8224. var self=this,$self=this;
  8225. return $core.withContext(function($ctx1) {
  8226. return $self._collect_((function(each){
  8227. return $core.withContext(function($ctx2) {
  8228. return $recv(each)._deepCopy();
  8229. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8230. }));
  8231. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{})});
  8232. },
  8233. args: [],
  8234. source: "deepCopy\x0a\x09^ self collect: [ :each | each deepCopy ]",
  8235. referencedClasses: [],
  8236. pragmas: [],
  8237. messageSends: ["collect:", "deepCopy"]
  8238. }),
  8239. $globals.Collection);
  8240. $core.addMethod(
  8241. $core.method({
  8242. selector: "detect:",
  8243. protocol: "enumerating",
  8244. fn: function (aBlock){
  8245. var self=this,$self=this;
  8246. return $core.withContext(function($ctx1) {
  8247. return $self._detect_ifNone_(aBlock,(function(){
  8248. return $core.withContext(function($ctx2) {
  8249. return $self._errorNotFound();
  8250. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8251. }));
  8252. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock})});
  8253. },
  8254. args: ["aBlock"],
  8255. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  8256. referencedClasses: [],
  8257. pragmas: [],
  8258. messageSends: ["detect:ifNone:", "errorNotFound"]
  8259. }),
  8260. $globals.Collection);
  8261. $core.addMethod(
  8262. $core.method({
  8263. selector: "detect:ifNone:",
  8264. protocol: "enumerating",
  8265. fn: function (aBlock,anotherBlock){
  8266. var self=this,$self=this;
  8267. return $core.withContext(function($ctx1) {
  8268. var $1;
  8269. var $early={};
  8270. try {
  8271. $self._do_((function(each){
  8272. return $core.withContext(function($ctx2) {
  8273. $1=$recv(aBlock)._value_(each);
  8274. if($core.assert($1)){
  8275. throw $early=[each];
  8276. }
  8277. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8278. }));
  8279. return $recv(anotherBlock)._value();
  8280. }
  8281. catch(e) {if(e===$early)return e[0]; throw e}
  8282. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  8283. },
  8284. args: ["aBlock", "anotherBlock"],
  8285. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  8286. referencedClasses: [],
  8287. pragmas: [],
  8288. messageSends: ["do:", "ifTrue:", "value:", "value"]
  8289. }),
  8290. $globals.Collection);
  8291. $core.addMethod(
  8292. $core.method({
  8293. selector: "do:",
  8294. protocol: "enumerating",
  8295. fn: function (aBlock){
  8296. var self=this,$self=this;
  8297. return $core.withContext(function($ctx1) {
  8298. $self._subclassResponsibility();
  8299. return self;
  8300. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  8301. },
  8302. args: ["aBlock"],
  8303. source: "do: aBlock\x0a\x09self subclassResponsibility",
  8304. referencedClasses: [],
  8305. pragmas: [],
  8306. messageSends: ["subclassResponsibility"]
  8307. }),
  8308. $globals.Collection);
  8309. $core.addMethod(
  8310. $core.method({
  8311. selector: "do:separatedBy:",
  8312. protocol: "enumerating",
  8313. fn: function (aBlock,anotherBlock){
  8314. var self=this,$self=this;
  8315. var actionBeforeElement;
  8316. return $core.withContext(function($ctx1) {
  8317. actionBeforeElement=(function(){
  8318. actionBeforeElement=anotherBlock;
  8319. return actionBeforeElement;
  8320. });
  8321. $self._do_((function(each){
  8322. return $core.withContext(function($ctx2) {
  8323. $recv(actionBeforeElement)._value();
  8324. return $recv(aBlock)._value_(each);
  8325. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  8326. }));
  8327. return self;
  8328. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement})});
  8329. },
  8330. args: ["aBlock", "anotherBlock"],
  8331. 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 ]",
  8332. referencedClasses: [],
  8333. pragmas: [],
  8334. messageSends: ["do:", "value", "value:"]
  8335. }),
  8336. $globals.Collection);
  8337. $core.addMethod(
  8338. $core.method({
  8339. selector: "errorNotFound",
  8340. protocol: "error handling",
  8341. fn: function (){
  8342. var self=this,$self=this;
  8343. return $core.withContext(function($ctx1) {
  8344. $self._error_("Object is not in the collection");
  8345. return self;
  8346. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{})});
  8347. },
  8348. args: [],
  8349. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  8350. referencedClasses: [],
  8351. pragmas: [],
  8352. messageSends: ["error:"]
  8353. }),
  8354. $globals.Collection);
  8355. $core.addMethod(
  8356. $core.method({
  8357. selector: "ifEmpty:",
  8358. protocol: "testing",
  8359. fn: function (aBlock){
  8360. var self=this,$self=this;
  8361. return $core.withContext(function($ctx1) {
  8362. var $1;
  8363. $1=$self._isEmpty();
  8364. if($core.assert($1)){
  8365. return $recv(aBlock)._value();
  8366. } else {
  8367. return self;
  8368. }
  8369. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock})});
  8370. },
  8371. args: ["aBlock"],
  8372. 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 ]",
  8373. referencedClasses: [],
  8374. pragmas: [],
  8375. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value"]
  8376. }),
  8377. $globals.Collection);
  8378. $core.addMethod(
  8379. $core.method({
  8380. selector: "ifEmpty:ifNotEmpty:",
  8381. protocol: "testing",
  8382. fn: function (aBlock,anotherBlock){
  8383. var self=this,$self=this;
  8384. return $core.withContext(function($ctx1) {
  8385. var $1;
  8386. $1=$self._isEmpty();
  8387. if($core.assert($1)){
  8388. return $recv(aBlock)._value();
  8389. } else {
  8390. return $recv(anotherBlock)._value_(self);
  8391. }
  8392. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  8393. },
  8394. args: ["aBlock", "anotherBlock"],
  8395. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  8396. referencedClasses: [],
  8397. pragmas: [],
  8398. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value", "value:"]
  8399. }),
  8400. $globals.Collection);
  8401. $core.addMethod(
  8402. $core.method({
  8403. selector: "ifNotEmpty:",
  8404. protocol: "testing",
  8405. fn: function (aBlock){
  8406. var self=this,$self=this;
  8407. return $core.withContext(function($ctx1) {
  8408. var $1;
  8409. $1=$self._notEmpty();
  8410. if($core.assert($1)){
  8411. return $recv(aBlock)._value_(self);
  8412. } else {
  8413. return self;
  8414. }
  8415. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock})});
  8416. },
  8417. args: ["aBlock"],
  8418. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  8419. referencedClasses: [],
  8420. pragmas: [],
  8421. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  8422. }),
  8423. $globals.Collection);
  8424. $core.addMethod(
  8425. $core.method({
  8426. selector: "ifNotEmpty:ifEmpty:",
  8427. protocol: "testing",
  8428. fn: function (aBlock,anotherBlock){
  8429. var self=this,$self=this;
  8430. return $core.withContext(function($ctx1) {
  8431. var $1;
  8432. $1=$self._notEmpty();
  8433. if($core.assert($1)){
  8434. return $recv(aBlock)._value_(self);
  8435. } else {
  8436. return $recv(anotherBlock)._value();
  8437. }
  8438. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  8439. },
  8440. args: ["aBlock", "anotherBlock"],
  8441. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: \x22anotherBlock\x22 [ anotherBlock value ]",
  8442. referencedClasses: [],
  8443. pragmas: [],
  8444. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:", "value"]
  8445. }),
  8446. $globals.Collection);
  8447. $core.addMethod(
  8448. $core.method({
  8449. selector: "includes:",
  8450. protocol: "testing",
  8451. fn: function (anObject){
  8452. var self=this,$self=this;
  8453. return $core.withContext(function($ctx1) {
  8454. return $self._anySatisfy_((function(each){
  8455. return $core.withContext(function($ctx2) {
  8456. return $recv(each).__eq(anObject);
  8457. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8458. }));
  8459. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject})});
  8460. },
  8461. args: ["anObject"],
  8462. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  8463. referencedClasses: [],
  8464. pragmas: [],
  8465. messageSends: ["anySatisfy:", "="]
  8466. }),
  8467. $globals.Collection);
  8468. $core.addMethod(
  8469. $core.method({
  8470. selector: "inject:into:",
  8471. protocol: "enumerating",
  8472. fn: function (anObject,aBlock){
  8473. var self=this,$self=this;
  8474. var result;
  8475. return $core.withContext(function($ctx1) {
  8476. result=anObject;
  8477. $self._do_((function(each){
  8478. return $core.withContext(function($ctx2) {
  8479. result=$recv(aBlock)._value_value_(result,each);
  8480. return result;
  8481. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8482. }));
  8483. return result;
  8484. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result})});
  8485. },
  8486. args: ["anObject", "aBlock"],
  8487. 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",
  8488. referencedClasses: [],
  8489. pragmas: [],
  8490. messageSends: ["do:", "value:value:"]
  8491. }),
  8492. $globals.Collection);
  8493. $core.addMethod(
  8494. $core.method({
  8495. selector: "intersection:",
  8496. protocol: "enumerating",
  8497. fn: function (aCollection){
  8498. var self=this,$self=this;
  8499. var set,outputSet;
  8500. return $core.withContext(function($ctx1) {
  8501. var $2,$1;
  8502. set=$self._asSet();
  8503. outputSet=$recv($globals.Set)._new();
  8504. $recv(aCollection)._do_((function(each){
  8505. return $core.withContext(function($ctx2) {
  8506. $2=$recv(set)._includes_(each);
  8507. $ctx2.sendIdx["includes:"]=1;
  8508. $1=$recv($2)._and_((function(){
  8509. return $core.withContext(function($ctx3) {
  8510. return $recv($recv(outputSet)._includes_(each))._not();
  8511. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  8512. }));
  8513. if($core.assert($1)){
  8514. return $recv(outputSet)._add_(each);
  8515. }
  8516. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8517. }));
  8518. return $recv($self._class())._withAll_($recv(outputSet)._asArray());
  8519. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet})});
  8520. },
  8521. args: ["aCollection"],
  8522. 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",
  8523. referencedClasses: ["Set"],
  8524. pragmas: [],
  8525. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  8526. }),
  8527. $globals.Collection);
  8528. $core.addMethod(
  8529. $core.method({
  8530. selector: "isEmpty",
  8531. protocol: "testing",
  8532. fn: function (){
  8533. var self=this,$self=this;
  8534. return $core.withContext(function($ctx1) {
  8535. return $recv($self._size()).__eq((0));
  8536. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{})});
  8537. },
  8538. args: [],
  8539. source: "isEmpty\x0a\x09^ self size = 0",
  8540. referencedClasses: [],
  8541. pragmas: [],
  8542. messageSends: ["=", "size"]
  8543. }),
  8544. $globals.Collection);
  8545. $core.addMethod(
  8546. $core.method({
  8547. selector: "noneSatisfy:",
  8548. protocol: "enumerating",
  8549. fn: function (aBlock){
  8550. var self=this,$self=this;
  8551. return $core.withContext(function($ctx1) {
  8552. var $1;
  8553. var $early={};
  8554. try {
  8555. $self._do_((function(item){
  8556. return $core.withContext(function($ctx2) {
  8557. $1=$recv(aBlock)._value_(item);
  8558. if($core.assert($1)){
  8559. throw $early=[false];
  8560. }
  8561. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  8562. }));
  8563. return true;
  8564. }
  8565. catch(e) {if(e===$early)return e[0]; throw e}
  8566. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock})});
  8567. },
  8568. args: ["aBlock"],
  8569. 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",
  8570. referencedClasses: [],
  8571. pragmas: [],
  8572. messageSends: ["do:", "ifTrue:", "value:"]
  8573. }),
  8574. $globals.Collection);
  8575. $core.addMethod(
  8576. $core.method({
  8577. selector: "notEmpty",
  8578. protocol: "testing",
  8579. fn: function (){
  8580. var self=this,$self=this;
  8581. return $core.withContext(function($ctx1) {
  8582. return $recv($self._isEmpty())._not();
  8583. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{})});
  8584. },
  8585. args: [],
  8586. source: "notEmpty\x0a\x09^ self isEmpty not",
  8587. referencedClasses: [],
  8588. pragmas: [],
  8589. messageSends: ["not", "isEmpty"]
  8590. }),
  8591. $globals.Collection);
  8592. $core.addMethod(
  8593. $core.method({
  8594. selector: "occurrencesOf:",
  8595. protocol: "accessing",
  8596. fn: function (anObject){
  8597. var self=this,$self=this;
  8598. var tally;
  8599. return $core.withContext(function($ctx1) {
  8600. var $1;
  8601. tally=(0);
  8602. $self._do_((function(each){
  8603. return $core.withContext(function($ctx2) {
  8604. $1=$recv(anObject).__eq(each);
  8605. if($core.assert($1)){
  8606. tally=$recv(tally).__plus((1));
  8607. return tally;
  8608. }
  8609. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8610. }));
  8611. return tally;
  8612. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally})});
  8613. },
  8614. args: ["anObject"],
  8615. 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",
  8616. referencedClasses: [],
  8617. pragmas: [],
  8618. messageSends: ["do:", "ifTrue:", "=", "+"]
  8619. }),
  8620. $globals.Collection);
  8621. $core.addMethod(
  8622. $core.method({
  8623. selector: "putOn:",
  8624. protocol: "streaming",
  8625. fn: function (aStream){
  8626. var self=this,$self=this;
  8627. return $core.withContext(function($ctx1) {
  8628. $self._do_((function(each){
  8629. return $core.withContext(function($ctx2) {
  8630. return $recv(each)._putOn_(aStream);
  8631. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8632. }));
  8633. return self;
  8634. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream})});
  8635. },
  8636. args: ["aStream"],
  8637. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  8638. referencedClasses: [],
  8639. pragmas: [],
  8640. messageSends: ["do:", "putOn:"]
  8641. }),
  8642. $globals.Collection);
  8643. $core.addMethod(
  8644. $core.method({
  8645. selector: "reject:",
  8646. protocol: "enumerating",
  8647. fn: function (aBlock){
  8648. var self=this,$self=this;
  8649. return $core.withContext(function($ctx1) {
  8650. return $self._select_((function(each){
  8651. return $core.withContext(function($ctx2) {
  8652. return $recv($recv(aBlock)._value_(each)).__eq(false);
  8653. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8654. }));
  8655. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock})});
  8656. },
  8657. args: ["aBlock"],
  8658. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  8659. referencedClasses: [],
  8660. pragmas: [],
  8661. messageSends: ["select:", "=", "value:"]
  8662. }),
  8663. $globals.Collection);
  8664. $core.addMethod(
  8665. $core.method({
  8666. selector: "remove:",
  8667. protocol: "adding/removing",
  8668. fn: function (anObject){
  8669. var self=this,$self=this;
  8670. return $core.withContext(function($ctx1) {
  8671. return $self._remove_ifAbsent_(anObject,(function(){
  8672. return $core.withContext(function($ctx2) {
  8673. return $self._errorNotFound();
  8674. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8675. }));
  8676. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject})});
  8677. },
  8678. args: ["anObject"],
  8679. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  8680. referencedClasses: [],
  8681. pragmas: [],
  8682. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  8683. }),
  8684. $globals.Collection);
  8685. $core.addMethod(
  8686. $core.method({
  8687. selector: "remove:ifAbsent:",
  8688. protocol: "adding/removing",
  8689. fn: function (anObject,aBlock){
  8690. var self=this,$self=this;
  8691. return $core.withContext(function($ctx1) {
  8692. $self._subclassResponsibility();
  8693. return self;
  8694. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  8695. },
  8696. args: ["anObject", "aBlock"],
  8697. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  8698. referencedClasses: [],
  8699. pragmas: [],
  8700. messageSends: ["subclassResponsibility"]
  8701. }),
  8702. $globals.Collection);
  8703. $core.addMethod(
  8704. $core.method({
  8705. selector: "removeAll",
  8706. protocol: "adding/removing",
  8707. fn: function (){
  8708. var self=this,$self=this;
  8709. return $core.withContext(function($ctx1) {
  8710. $self._subclassResponsibility();
  8711. return self;
  8712. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  8713. },
  8714. args: [],
  8715. source: "removeAll\x0a\x09self subclassResponsibility",
  8716. referencedClasses: [],
  8717. pragmas: [],
  8718. messageSends: ["subclassResponsibility"]
  8719. }),
  8720. $globals.Collection);
  8721. $core.addMethod(
  8722. $core.method({
  8723. selector: "select:",
  8724. protocol: "enumerating",
  8725. fn: function (aBlock){
  8726. var self=this,$self=this;
  8727. var stream;
  8728. return $core.withContext(function($ctx1) {
  8729. var $1;
  8730. stream=$recv($recv($self._class())._new())._writeStream();
  8731. $self._do_((function(each){
  8732. return $core.withContext(function($ctx2) {
  8733. $1=$recv(aBlock)._value_(each);
  8734. if($core.assert($1)){
  8735. return $recv(stream)._nextPut_(each);
  8736. }
  8737. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8738. }));
  8739. return $recv(stream)._contents();
  8740. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream})});
  8741. },
  8742. args: ["aBlock"],
  8743. 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",
  8744. referencedClasses: [],
  8745. pragmas: [],
  8746. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  8747. }),
  8748. $globals.Collection);
  8749. $core.addMethod(
  8750. $core.method({
  8751. selector: "select:thenCollect:",
  8752. protocol: "enumerating",
  8753. fn: function (selectBlock,collectBlock){
  8754. var self=this,$self=this;
  8755. var stream;
  8756. return $core.withContext(function($ctx1) {
  8757. var $1;
  8758. stream=$recv($recv($self._class())._new())._writeStream();
  8759. $self._do_((function(each){
  8760. return $core.withContext(function($ctx2) {
  8761. $1=$recv(selectBlock)._value_(each);
  8762. $ctx2.sendIdx["value:"]=1;
  8763. if($core.assert($1)){
  8764. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  8765. }
  8766. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8767. }));
  8768. return $recv(stream)._contents();
  8769. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream})});
  8770. },
  8771. args: ["selectBlock", "collectBlock"],
  8772. 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",
  8773. referencedClasses: [],
  8774. pragmas: [],
  8775. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  8776. }),
  8777. $globals.Collection);
  8778. $core.addMethod(
  8779. $core.method({
  8780. selector: "shallowCopy",
  8781. protocol: "copying",
  8782. fn: function (){
  8783. var self=this,$self=this;
  8784. return $core.withContext(function($ctx1) {
  8785. return $self._collect_((function(each){
  8786. return each;
  8787. }));
  8788. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{})});
  8789. },
  8790. args: [],
  8791. source: "shallowCopy\x0a\x09^ self collect: [ :each | each ]",
  8792. referencedClasses: [],
  8793. pragmas: [],
  8794. messageSends: ["collect:"]
  8795. }),
  8796. $globals.Collection);
  8797. $core.addMethod(
  8798. $core.method({
  8799. selector: "single",
  8800. protocol: "accessing",
  8801. fn: function (){
  8802. var self=this,$self=this;
  8803. return $core.withContext(function($ctx1) {
  8804. var $1;
  8805. $self._ifEmpty_((function(){
  8806. return $core.withContext(function($ctx2) {
  8807. return $self._error_("Collection is empty");
  8808. $ctx2.sendIdx["error:"]=1;
  8809. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8810. }));
  8811. $1=$recv($self._size()).__gt((1));
  8812. if($core.assert($1)){
  8813. $self._error_("Collection holds more than one element");
  8814. }
  8815. return $self._anyOne();
  8816. }, function($ctx1) {$ctx1.fill(self,"single",{})});
  8817. },
  8818. args: [],
  8819. 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",
  8820. referencedClasses: [],
  8821. pragmas: [],
  8822. messageSends: ["ifEmpty:", "error:", "ifTrue:", ">", "size", "anyOne"]
  8823. }),
  8824. $globals.Collection);
  8825. $core.addMethod(
  8826. $core.method({
  8827. selector: "size",
  8828. protocol: "accessing",
  8829. fn: function (){
  8830. var self=this,$self=this;
  8831. return $core.withContext(function($ctx1) {
  8832. $self._subclassResponsibility();
  8833. return self;
  8834. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  8835. },
  8836. args: [],
  8837. source: "size\x0a\x09self subclassResponsibility",
  8838. referencedClasses: [],
  8839. pragmas: [],
  8840. messageSends: ["subclassResponsibility"]
  8841. }),
  8842. $globals.Collection);
  8843. $core.addMethod(
  8844. $core.method({
  8845. selector: "classTag",
  8846. protocol: "accessing",
  8847. fn: function (){
  8848. var self=this,$self=this;
  8849. return "collection";
  8850. },
  8851. args: [],
  8852. 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'",
  8853. referencedClasses: [],
  8854. pragmas: [],
  8855. messageSends: []
  8856. }),
  8857. $globals.Collection.a$cls);
  8858. $core.addMethod(
  8859. $core.method({
  8860. selector: "new:",
  8861. protocol: "instance creation",
  8862. fn: function (anInteger){
  8863. var self=this,$self=this;
  8864. return $core.withContext(function($ctx1) {
  8865. return $self._new();
  8866. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger})});
  8867. },
  8868. args: ["anInteger"],
  8869. source: "new: anInteger\x0a\x09^ self new",
  8870. referencedClasses: [],
  8871. pragmas: [],
  8872. messageSends: ["new"]
  8873. }),
  8874. $globals.Collection.a$cls);
  8875. $core.addMethod(
  8876. $core.method({
  8877. selector: "with:",
  8878. protocol: "instance creation",
  8879. fn: function (anObject){
  8880. var self=this,$self=this;
  8881. return $core.withContext(function($ctx1) {
  8882. var $1;
  8883. $1=$self._new();
  8884. $recv($1)._add_(anObject);
  8885. return $recv($1)._yourself();
  8886. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject})});
  8887. },
  8888. args: ["anObject"],
  8889. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  8890. referencedClasses: [],
  8891. pragmas: [],
  8892. messageSends: ["add:", "new", "yourself"]
  8893. }),
  8894. $globals.Collection.a$cls);
  8895. $core.addMethod(
  8896. $core.method({
  8897. selector: "with:with:",
  8898. protocol: "instance creation",
  8899. fn: function (anObject,anotherObject){
  8900. var self=this,$self=this;
  8901. return $core.withContext(function($ctx1) {
  8902. var $1;
  8903. $1=$self._new();
  8904. $recv($1)._add_(anObject);
  8905. $ctx1.sendIdx["add:"]=1;
  8906. $recv($1)._add_(anotherObject);
  8907. return $recv($1)._yourself();
  8908. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject})});
  8909. },
  8910. args: ["anObject", "anotherObject"],
  8911. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  8912. referencedClasses: [],
  8913. pragmas: [],
  8914. messageSends: ["add:", "new", "yourself"]
  8915. }),
  8916. $globals.Collection.a$cls);
  8917. $core.addMethod(
  8918. $core.method({
  8919. selector: "with:with:with:",
  8920. protocol: "instance creation",
  8921. fn: function (firstObject,secondObject,thirdObject){
  8922. var self=this,$self=this;
  8923. return $core.withContext(function($ctx1) {
  8924. var $1;
  8925. $1=$self._new();
  8926. $recv($1)._add_(firstObject);
  8927. $ctx1.sendIdx["add:"]=1;
  8928. $recv($1)._add_(secondObject);
  8929. $ctx1.sendIdx["add:"]=2;
  8930. $recv($1)._add_(thirdObject);
  8931. return $recv($1)._yourself();
  8932. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject})});
  8933. },
  8934. args: ["firstObject", "secondObject", "thirdObject"],
  8935. 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",
  8936. referencedClasses: [],
  8937. pragmas: [],
  8938. messageSends: ["add:", "new", "yourself"]
  8939. }),
  8940. $globals.Collection.a$cls);
  8941. $core.addMethod(
  8942. $core.method({
  8943. selector: "withAll:",
  8944. protocol: "instance creation",
  8945. fn: function (aCollection){
  8946. var self=this,$self=this;
  8947. return $core.withContext(function($ctx1) {
  8948. var $1;
  8949. $1=$self._new();
  8950. $recv($1)._addAll_(aCollection);
  8951. return $recv($1)._yourself();
  8952. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection})});
  8953. },
  8954. args: ["aCollection"],
  8955. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  8956. referencedClasses: [],
  8957. pragmas: [],
  8958. messageSends: ["addAll:", "new", "yourself"]
  8959. }),
  8960. $globals.Collection.a$cls);
  8961. $core.addClass("AssociativeCollection", $globals.Collection, [], "Kernel-Collections");
  8962. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  8963. $core.addMethod(
  8964. $core.method({
  8965. selector: "=",
  8966. protocol: "comparing",
  8967. fn: function (anAssocitativeCollection){
  8968. var self=this,$self=this;
  8969. return $core.withContext(function($ctx1) {
  8970. var $2,$1,$4,$3,$5;
  8971. $2=$self._class();
  8972. $ctx1.sendIdx["class"]=1;
  8973. $1=$recv($2).__eq($recv(anAssocitativeCollection)._class());
  8974. $ctx1.sendIdx["="]=1;
  8975. if(!$core.assert($1)){
  8976. return false;
  8977. }
  8978. $4=$self._size();
  8979. $ctx1.sendIdx["size"]=1;
  8980. $3=$recv($4).__eq($recv(anAssocitativeCollection)._size());
  8981. $ctx1.sendIdx["="]=2;
  8982. if(!$core.assert($3)){
  8983. return false;
  8984. }
  8985. $5=$self._associations();
  8986. $ctx1.sendIdx["associations"]=1;
  8987. return $recv($5).__eq($recv(anAssocitativeCollection)._associations());
  8988. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection})});
  8989. },
  8990. args: ["anAssocitativeCollection"],
  8991. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  8992. referencedClasses: [],
  8993. pragmas: [],
  8994. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  8995. }),
  8996. $globals.AssociativeCollection);
  8997. $core.addMethod(
  8998. $core.method({
  8999. selector: "add:",
  9000. protocol: "adding/removing",
  9001. fn: function (anAssociation){
  9002. var self=this,$self=this;
  9003. return $core.withContext(function($ctx1) {
  9004. $self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  9005. return self;
  9006. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation})});
  9007. },
  9008. args: ["anAssociation"],
  9009. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  9010. referencedClasses: [],
  9011. pragmas: [],
  9012. messageSends: ["at:put:", "key", "value"]
  9013. }),
  9014. $globals.AssociativeCollection);
  9015. $core.addMethod(
  9016. $core.method({
  9017. selector: "addAll:",
  9018. protocol: "adding/removing",
  9019. fn: function (anAssociativeCollection){
  9020. var self=this,$self=this;
  9021. return $core.withContext(function($ctx1) {
  9022. (
  9023. $ctx1.supercall = true,
  9024. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._addAll_.apply($self, [$recv(anAssociativeCollection)._associations()]));
  9025. $ctx1.supercall = false;
  9026. return anAssociativeCollection;
  9027. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection})});
  9028. },
  9029. args: ["anAssociativeCollection"],
  9030. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  9031. referencedClasses: [],
  9032. pragmas: [],
  9033. messageSends: ["addAll:", "associations"]
  9034. }),
  9035. $globals.AssociativeCollection);
  9036. $core.addMethod(
  9037. $core.method({
  9038. selector: "asDictionary",
  9039. protocol: "converting",
  9040. fn: function (){
  9041. var self=this,$self=this;
  9042. return $core.withContext(function($ctx1) {
  9043. return $recv($globals.Dictionary)._from_($self._associations());
  9044. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{})});
  9045. },
  9046. args: [],
  9047. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  9048. referencedClasses: ["Dictionary"],
  9049. pragmas: [],
  9050. messageSends: ["from:", "associations"]
  9051. }),
  9052. $globals.AssociativeCollection);
  9053. $core.addMethod(
  9054. $core.method({
  9055. selector: "asHashedCollection",
  9056. protocol: "converting",
  9057. fn: function (){
  9058. var self=this,$self=this;
  9059. return $core.withContext(function($ctx1) {
  9060. return $recv($globals.HashedCollection)._from_($self._associations());
  9061. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{})});
  9062. },
  9063. args: [],
  9064. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  9065. referencedClasses: ["HashedCollection"],
  9066. pragmas: [],
  9067. messageSends: ["from:", "associations"]
  9068. }),
  9069. $globals.AssociativeCollection);
  9070. $core.addMethod(
  9071. $core.method({
  9072. selector: "asJavaScriptObject",
  9073. protocol: "converting",
  9074. fn: function (){
  9075. var self=this,$self=this;
  9076. var hash;
  9077. return $core.withContext(function($ctx1) {
  9078. hash=$recv($globals.HashedCollection)._new();
  9079. $self._keysAndValuesDo_((function(key,value){
  9080. return $core.withContext(function($ctx2) {
  9081. return $recv(hash)._at_put_(key,$recv(value)._asJavaScriptObject());
  9082. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9083. }));
  9084. return hash;
  9085. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{hash:hash})});
  9086. },
  9087. args: [],
  9088. 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",
  9089. referencedClasses: ["HashedCollection"],
  9090. pragmas: [],
  9091. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJavaScriptObject"]
  9092. }),
  9093. $globals.AssociativeCollection);
  9094. $core.addMethod(
  9095. $core.method({
  9096. selector: "associations",
  9097. protocol: "accessing",
  9098. fn: function (){
  9099. var self=this,$self=this;
  9100. var associations;
  9101. return $core.withContext(function($ctx1) {
  9102. associations=[];
  9103. $self._associationsDo_((function(each){
  9104. return $core.withContext(function($ctx2) {
  9105. return $recv(associations)._add_(each);
  9106. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9107. }));
  9108. return associations;
  9109. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations})});
  9110. },
  9111. args: [],
  9112. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  9113. referencedClasses: [],
  9114. pragmas: [],
  9115. messageSends: ["associationsDo:", "add:"]
  9116. }),
  9117. $globals.AssociativeCollection);
  9118. $core.addMethod(
  9119. $core.method({
  9120. selector: "associationsDo:",
  9121. protocol: "enumerating",
  9122. fn: function (aBlock){
  9123. var self=this,$self=this;
  9124. return $core.withContext(function($ctx1) {
  9125. $self._keysAndValuesDo_((function(key,value){
  9126. return $core.withContext(function($ctx2) {
  9127. return $recv(aBlock)._value_($recv($globals.Association)._key_value_(key,value));
  9128. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9129. }));
  9130. return self;
  9131. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock})});
  9132. },
  9133. args: ["aBlock"],
  9134. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  9135. referencedClasses: ["Association"],
  9136. pragmas: [],
  9137. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  9138. }),
  9139. $globals.AssociativeCollection);
  9140. $core.addMethod(
  9141. $core.method({
  9142. selector: "at:ifPresent:ifAbsent:",
  9143. protocol: "accessing",
  9144. fn: function (aKey,aBlock,anotherBlock){
  9145. var self=this,$self=this;
  9146. return $core.withContext(function($ctx1) {
  9147. var $1;
  9148. $1=$self._includesKey_(aKey);
  9149. if($core.assert($1)){
  9150. return $recv(aBlock)._value_($self._at_(aKey));
  9151. } else {
  9152. return $recv(anotherBlock)._value();
  9153. }
  9154. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock})});
  9155. },
  9156. args: ["aKey", "aBlock", "anotherBlock"],
  9157. 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 ]",
  9158. referencedClasses: [],
  9159. pragmas: [],
  9160. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  9161. }),
  9162. $globals.AssociativeCollection);
  9163. $core.addMethod(
  9164. $core.method({
  9165. selector: "collect:",
  9166. protocol: "enumerating",
  9167. fn: function (aBlock){
  9168. var self=this,$self=this;
  9169. var newDict;
  9170. return $core.withContext(function($ctx1) {
  9171. newDict=$recv($self._class())._new();
  9172. $self._keysAndValuesDo_((function(key,value){
  9173. return $core.withContext(function($ctx2) {
  9174. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  9175. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9176. }));
  9177. return newDict;
  9178. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict})});
  9179. },
  9180. args: ["aBlock"],
  9181. 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",
  9182. referencedClasses: [],
  9183. pragmas: [],
  9184. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  9185. }),
  9186. $globals.AssociativeCollection);
  9187. $core.addMethod(
  9188. $core.method({
  9189. selector: "deepCopy",
  9190. protocol: "copying",
  9191. fn: function (){
  9192. var self=this,$self=this;
  9193. var copy;
  9194. return $core.withContext(function($ctx1) {
  9195. copy=$recv($self._class())._new();
  9196. $self._keysAndValuesDo_((function(key,value){
  9197. return $core.withContext(function($ctx2) {
  9198. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  9199. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9200. }));
  9201. return copy;
  9202. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy})});
  9203. },
  9204. args: [],
  9205. 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",
  9206. referencedClasses: [],
  9207. pragmas: [],
  9208. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  9209. }),
  9210. $globals.AssociativeCollection);
  9211. $core.addMethod(
  9212. $core.method({
  9213. selector: "detect:ifNone:",
  9214. protocol: "enumerating",
  9215. fn: function (aBlock,anotherBlock){
  9216. var self=this,$self=this;
  9217. return $core.withContext(function($ctx1) {
  9218. return $recv($self._values())._detect_ifNone_(aBlock,anotherBlock);
  9219. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  9220. },
  9221. args: ["aBlock", "anotherBlock"],
  9222. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  9223. referencedClasses: [],
  9224. pragmas: [],
  9225. messageSends: ["detect:ifNone:", "values"]
  9226. }),
  9227. $globals.AssociativeCollection);
  9228. $core.addMethod(
  9229. $core.method({
  9230. selector: "do:",
  9231. protocol: "enumerating",
  9232. fn: function (aBlock){
  9233. var self=this,$self=this;
  9234. return $core.withContext(function($ctx1) {
  9235. $self._valuesDo_(aBlock);
  9236. return self;
  9237. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  9238. },
  9239. args: ["aBlock"],
  9240. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  9241. referencedClasses: [],
  9242. pragmas: [],
  9243. messageSends: ["valuesDo:"]
  9244. }),
  9245. $globals.AssociativeCollection);
  9246. $core.addMethod(
  9247. $core.method({
  9248. selector: "includes:",
  9249. protocol: "enumerating",
  9250. fn: function (anObject){
  9251. var self=this,$self=this;
  9252. return $core.withContext(function($ctx1) {
  9253. return $recv($self._values())._includes_(anObject);
  9254. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject})});
  9255. },
  9256. args: ["anObject"],
  9257. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  9258. referencedClasses: [],
  9259. pragmas: [],
  9260. messageSends: ["includes:", "values"]
  9261. }),
  9262. $globals.AssociativeCollection);
  9263. $core.addMethod(
  9264. $core.method({
  9265. selector: "includesKey:",
  9266. protocol: "testing",
  9267. fn: function (aKey){
  9268. var self=this,$self=this;
  9269. return $core.withContext(function($ctx1) {
  9270. $self._subclassResponsibility();
  9271. return self;
  9272. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey})});
  9273. },
  9274. args: ["aKey"],
  9275. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  9276. referencedClasses: [],
  9277. pragmas: [],
  9278. messageSends: ["subclassResponsibility"]
  9279. }),
  9280. $globals.AssociativeCollection);
  9281. $core.addMethod(
  9282. $core.method({
  9283. selector: "indexOf:ifAbsent:",
  9284. protocol: "accessing",
  9285. fn: function (anObject,aBlock){
  9286. var self=this,$self=this;
  9287. return $core.withContext(function($ctx1) {
  9288. return $recv($self._keys())._detect_ifNone_((function(each){
  9289. return $core.withContext(function($ctx2) {
  9290. return $recv($self._at_(each)).__eq(anObject);
  9291. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9292. }),aBlock);
  9293. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  9294. },
  9295. args: ["anObject", "aBlock"],
  9296. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  9297. referencedClasses: [],
  9298. pragmas: [],
  9299. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  9300. }),
  9301. $globals.AssociativeCollection);
  9302. $core.addMethod(
  9303. $core.method({
  9304. selector: "keyAtValue:",
  9305. protocol: "accessing",
  9306. fn: function (anObject){
  9307. var self=this,$self=this;
  9308. return $core.withContext(function($ctx1) {
  9309. return $self._keyAtValue_ifAbsent_(anObject,(function(){
  9310. return $core.withContext(function($ctx2) {
  9311. return $self._errorNotFound();
  9312. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9313. }));
  9314. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject})});
  9315. },
  9316. args: ["anObject"],
  9317. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  9318. referencedClasses: [],
  9319. pragmas: [],
  9320. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  9321. }),
  9322. $globals.AssociativeCollection);
  9323. $core.addMethod(
  9324. $core.method({
  9325. selector: "keyAtValue:ifAbsent:",
  9326. protocol: "accessing",
  9327. fn: function (anObject,aBlock){
  9328. var self=this,$self=this;
  9329. return $core.withContext(function($ctx1) {
  9330. return $self._indexOf_ifAbsent_(anObject,aBlock);
  9331. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  9332. },
  9333. args: ["anObject", "aBlock"],
  9334. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  9335. referencedClasses: [],
  9336. pragmas: [],
  9337. messageSends: ["indexOf:ifAbsent:"]
  9338. }),
  9339. $globals.AssociativeCollection);
  9340. $core.addMethod(
  9341. $core.method({
  9342. selector: "keys",
  9343. protocol: "accessing",
  9344. fn: function (){
  9345. var self=this,$self=this;
  9346. return $core.withContext(function($ctx1) {
  9347. $self._subclassResponsibility();
  9348. return self;
  9349. }, function($ctx1) {$ctx1.fill(self,"keys",{})});
  9350. },
  9351. args: [],
  9352. source: "keys\x0a\x09self subclassResponsibility",
  9353. referencedClasses: [],
  9354. pragmas: [],
  9355. messageSends: ["subclassResponsibility"]
  9356. }),
  9357. $globals.AssociativeCollection);
  9358. $core.addMethod(
  9359. $core.method({
  9360. selector: "keysAndValuesDo:",
  9361. protocol: "enumerating",
  9362. fn: function (aBlock){
  9363. var self=this,$self=this;
  9364. return $core.withContext(function($ctx1) {
  9365. $self._keysDo_((function(each){
  9366. return $core.withContext(function($ctx2) {
  9367. return $recv(aBlock)._value_value_(each,$self._at_(each));
  9368. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9369. }));
  9370. return self;
  9371. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock})});
  9372. },
  9373. args: ["aBlock"],
  9374. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  9375. referencedClasses: [],
  9376. pragmas: [],
  9377. messageSends: ["keysDo:", "value:value:", "at:"]
  9378. }),
  9379. $globals.AssociativeCollection);
  9380. $core.addMethod(
  9381. $core.method({
  9382. selector: "keysDo:",
  9383. protocol: "enumerating",
  9384. fn: function (aBlock){
  9385. var self=this,$self=this;
  9386. return $core.withContext(function($ctx1) {
  9387. $self._subclassResponsibility();
  9388. return self;
  9389. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock})});
  9390. },
  9391. args: ["aBlock"],
  9392. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  9393. referencedClasses: [],
  9394. pragmas: [],
  9395. messageSends: ["subclassResponsibility"]
  9396. }),
  9397. $globals.AssociativeCollection);
  9398. $core.addMethod(
  9399. $core.method({
  9400. selector: "printOn:",
  9401. protocol: "printing",
  9402. fn: function (aStream){
  9403. var self=this,$self=this;
  9404. return $core.withContext(function($ctx1) {
  9405. (
  9406. $ctx1.supercall = true,
  9407. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  9408. $ctx1.supercall = false;
  9409. $ctx1.sendIdx["printOn:"]=1;
  9410. $recv(aStream)._nextPutAll_(" (");
  9411. $ctx1.sendIdx["nextPutAll:"]=1;
  9412. $recv($self._associations())._do_separatedBy_((function(each){
  9413. return $core.withContext(function($ctx2) {
  9414. return $recv(each)._printOn_(aStream);
  9415. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9416. }),(function(){
  9417. return $core.withContext(function($ctx2) {
  9418. return $recv(aStream)._nextPutAll_(" , ");
  9419. $ctx2.sendIdx["nextPutAll:"]=2;
  9420. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  9421. }));
  9422. $recv(aStream)._nextPutAll_(")");
  9423. return self;
  9424. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  9425. },
  9426. args: ["aStream"],
  9427. 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: ')'",
  9428. referencedClasses: [],
  9429. pragmas: [],
  9430. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  9431. }),
  9432. $globals.AssociativeCollection);
  9433. $core.addMethod(
  9434. $core.method({
  9435. selector: "remove:ifAbsent:",
  9436. protocol: "adding/removing",
  9437. fn: function (aKey,aBlock){
  9438. var self=this,$self=this;
  9439. return $core.withContext(function($ctx1) {
  9440. return $self._removeKey_ifAbsent_(aKey,aBlock);
  9441. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  9442. },
  9443. args: ["aKey", "aBlock"],
  9444. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  9445. referencedClasses: [],
  9446. pragmas: [],
  9447. messageSends: ["removeKey:ifAbsent:"]
  9448. }),
  9449. $globals.AssociativeCollection);
  9450. $core.addMethod(
  9451. $core.method({
  9452. selector: "removeAll",
  9453. protocol: "adding/removing",
  9454. fn: function (){
  9455. var self=this,$self=this;
  9456. return $core.withContext(function($ctx1) {
  9457. return $recv($self._keys())._do_((function(each){
  9458. return $core.withContext(function($ctx2) {
  9459. return $self._removeKey_(each);
  9460. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9461. }));
  9462. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  9463. },
  9464. args: [],
  9465. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  9466. referencedClasses: [],
  9467. pragmas: [],
  9468. messageSends: ["do:", "keys", "removeKey:"]
  9469. }),
  9470. $globals.AssociativeCollection);
  9471. $core.addMethod(
  9472. $core.method({
  9473. selector: "removeKey:",
  9474. protocol: "adding/removing",
  9475. fn: function (aKey){
  9476. var self=this,$self=this;
  9477. return $core.withContext(function($ctx1) {
  9478. return $self._remove_(aKey);
  9479. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey})});
  9480. },
  9481. args: ["aKey"],
  9482. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  9483. referencedClasses: [],
  9484. pragmas: [],
  9485. messageSends: ["remove:"]
  9486. }),
  9487. $globals.AssociativeCollection);
  9488. $core.addMethod(
  9489. $core.method({
  9490. selector: "removeKey:ifAbsent:",
  9491. protocol: "adding/removing",
  9492. fn: function (aKey,aBlock){
  9493. var self=this,$self=this;
  9494. return $core.withContext(function($ctx1) {
  9495. $self._subclassResponsibility();
  9496. return self;
  9497. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  9498. },
  9499. args: ["aKey", "aBlock"],
  9500. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  9501. referencedClasses: [],
  9502. pragmas: [],
  9503. messageSends: ["subclassResponsibility"]
  9504. }),
  9505. $globals.AssociativeCollection);
  9506. $core.addMethod(
  9507. $core.method({
  9508. selector: "select:",
  9509. protocol: "enumerating",
  9510. fn: function (aBlock){
  9511. var self=this,$self=this;
  9512. var newDict;
  9513. return $core.withContext(function($ctx1) {
  9514. var $1;
  9515. newDict=$recv($self._class())._new();
  9516. $self._keysAndValuesDo_((function(key,value){
  9517. return $core.withContext(function($ctx2) {
  9518. $1=$recv(aBlock)._value_(value);
  9519. if($core.assert($1)){
  9520. return $recv(newDict)._at_put_(key,value);
  9521. }
  9522. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9523. }));
  9524. return newDict;
  9525. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict})});
  9526. },
  9527. args: ["aBlock"],
  9528. 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",
  9529. referencedClasses: [],
  9530. pragmas: [],
  9531. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  9532. }),
  9533. $globals.AssociativeCollection);
  9534. $core.addMethod(
  9535. $core.method({
  9536. selector: "select:thenCollect:",
  9537. protocol: "enumerating",
  9538. fn: function (selectBlock,collectBlock){
  9539. var self=this,$self=this;
  9540. var newDict;
  9541. return $core.withContext(function($ctx1) {
  9542. var $1;
  9543. newDict=$recv($self._class())._new();
  9544. $self._keysAndValuesDo_((function(key,value){
  9545. return $core.withContext(function($ctx2) {
  9546. $1=$recv(selectBlock)._value_(value);
  9547. $ctx2.sendIdx["value:"]=1;
  9548. if($core.assert($1)){
  9549. return $recv(newDict)._at_put_(key,$recv(collectBlock)._value_(value));
  9550. }
  9551. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9552. }));
  9553. return newDict;
  9554. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,newDict:newDict})});
  9555. },
  9556. args: ["selectBlock", "collectBlock"],
  9557. 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",
  9558. referencedClasses: [],
  9559. pragmas: [],
  9560. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  9561. }),
  9562. $globals.AssociativeCollection);
  9563. $core.addMethod(
  9564. $core.method({
  9565. selector: "shallowCopy",
  9566. protocol: "copying",
  9567. fn: function (){
  9568. var self=this,$self=this;
  9569. var copy;
  9570. return $core.withContext(function($ctx1) {
  9571. copy=$recv($self._class())._new();
  9572. $self._keysAndValuesDo_((function(key,value){
  9573. return $core.withContext(function($ctx2) {
  9574. return $recv(copy)._at_put_(key,value);
  9575. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9576. }));
  9577. return copy;
  9578. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy})});
  9579. },
  9580. args: [],
  9581. 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",
  9582. referencedClasses: [],
  9583. pragmas: [],
  9584. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  9585. }),
  9586. $globals.AssociativeCollection);
  9587. $core.addMethod(
  9588. $core.method({
  9589. selector: "size",
  9590. protocol: "accessing",
  9591. fn: function (){
  9592. var self=this,$self=this;
  9593. return $core.withContext(function($ctx1) {
  9594. return $recv($self._keys())._size();
  9595. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  9596. },
  9597. args: [],
  9598. source: "size\x0a\x09^ self keys size",
  9599. referencedClasses: [],
  9600. pragmas: [],
  9601. messageSends: ["size", "keys"]
  9602. }),
  9603. $globals.AssociativeCollection);
  9604. $core.addMethod(
  9605. $core.method({
  9606. selector: "values",
  9607. protocol: "accessing",
  9608. fn: function (){
  9609. var self=this,$self=this;
  9610. return $core.withContext(function($ctx1) {
  9611. $self._subclassResponsibility();
  9612. return self;
  9613. }, function($ctx1) {$ctx1.fill(self,"values",{})});
  9614. },
  9615. args: [],
  9616. source: "values\x0a\x09self subclassResponsibility",
  9617. referencedClasses: [],
  9618. pragmas: [],
  9619. messageSends: ["subclassResponsibility"]
  9620. }),
  9621. $globals.AssociativeCollection);
  9622. $core.addMethod(
  9623. $core.method({
  9624. selector: "valuesDo:",
  9625. protocol: "enumerating",
  9626. fn: function (aBlock){
  9627. var self=this,$self=this;
  9628. return $core.withContext(function($ctx1) {
  9629. $self._subclassResponsibility();
  9630. return self;
  9631. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock})});
  9632. },
  9633. args: ["aBlock"],
  9634. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  9635. referencedClasses: [],
  9636. pragmas: [],
  9637. messageSends: ["subclassResponsibility"]
  9638. }),
  9639. $globals.AssociativeCollection);
  9640. $core.addMethod(
  9641. $core.method({
  9642. selector: "withIndexDo:",
  9643. protocol: "enumerating",
  9644. fn: function (aBlock){
  9645. var self=this,$self=this;
  9646. return $core.withContext(function($ctx1) {
  9647. $self._keysAndValuesDo_((function(key,value){
  9648. return $core.withContext(function($ctx2) {
  9649. return $recv(aBlock)._value_value_(value,key);
  9650. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9651. }));
  9652. return self;
  9653. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock})});
  9654. },
  9655. args: ["aBlock"],
  9656. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  9657. referencedClasses: [],
  9658. pragmas: [],
  9659. messageSends: ["keysAndValuesDo:", "value:value:"]
  9660. }),
  9661. $globals.AssociativeCollection);
  9662. $core.addMethod(
  9663. $core.method({
  9664. selector: "from:",
  9665. protocol: "instance creation",
  9666. fn: function (aCollection){
  9667. var self=this,$self=this;
  9668. var newCollection;
  9669. return $core.withContext(function($ctx1) {
  9670. newCollection=$self._new();
  9671. $recv(aCollection)._do_((function(each){
  9672. return $core.withContext(function($ctx2) {
  9673. return $recv(newCollection)._add_(each);
  9674. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9675. }));
  9676. return newCollection;
  9677. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection})});
  9678. },
  9679. args: ["aCollection"],
  9680. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  9681. referencedClasses: [],
  9682. pragmas: [],
  9683. messageSends: ["new", "do:", "add:"]
  9684. }),
  9685. $globals.AssociativeCollection.a$cls);
  9686. $core.addMethod(
  9687. $core.method({
  9688. selector: "fromPairs:",
  9689. protocol: "instance creation",
  9690. fn: function (aCollection){
  9691. var self=this,$self=this;
  9692. return $core.withContext(function($ctx1) {
  9693. return $self._from_(aCollection);
  9694. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection})});
  9695. },
  9696. args: ["aCollection"],
  9697. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  9698. referencedClasses: [],
  9699. pragmas: [],
  9700. messageSends: ["from:"]
  9701. }),
  9702. $globals.AssociativeCollection.a$cls);
  9703. $core.addMethod(
  9704. $core.method({
  9705. selector: "newFromPairs:",
  9706. protocol: "instance creation",
  9707. fn: function (aCollection){
  9708. var self=this,$self=this;
  9709. var newCollection;
  9710. return $core.withContext(function($ctx1) {
  9711. var $2,$1,$3,$4;
  9712. $2=$recv(aCollection)._size();
  9713. $ctx1.sendIdx["size"]=1;
  9714. $1=$recv($2)._even();
  9715. if(!$core.assert($1)){
  9716. $self._error_("#newFromPairs only accepts arrays of an even length");
  9717. }
  9718. newCollection=$self._new();
  9719. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  9720. return $core.withContext(function($ctx2) {
  9721. $3=newCollection;
  9722. $4=$recv(aCollection)._at_(each);
  9723. $ctx2.sendIdx["at:"]=1;
  9724. return $recv($3)._at_put_($4,$recv(aCollection)._at_($recv(each).__plus((1))));
  9725. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  9726. }));
  9727. return newCollection;
  9728. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection})});
  9729. },
  9730. args: ["aCollection"],
  9731. 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",
  9732. referencedClasses: [],
  9733. pragmas: [],
  9734. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  9735. }),
  9736. $globals.AssociativeCollection.a$cls);
  9737. $core.addClass("Dictionary", $globals.AssociativeCollection, ["keys", "values"], "Kernel-Collections");
  9738. $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.";
  9739. $core.addMethod(
  9740. $core.method({
  9741. selector: "at:ifAbsent:",
  9742. protocol: "accessing",
  9743. fn: function (aKey,aBlock){
  9744. var self=this,$self=this;
  9745. return $core.withContext(function($ctx1) {
  9746. var index = $self._positionOfKey_(aKey);
  9747. return index >=0 ? $self.values[index] : aBlock._value();
  9748. ;
  9749. return self;
  9750. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  9751. },
  9752. args: ["aKey", "aBlock"],
  9753. 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'>",
  9754. referencedClasses: [],
  9755. pragmas: [["inlineJS:", ["\x0a\x09\x09var index = $self._positionOfKey_(aKey);\x0a\x09\x09return index >=0 ? $self.values[index] : aBlock._value();\x0a\x09"]]],
  9756. messageSends: []
  9757. }),
  9758. $globals.Dictionary);
  9759. $core.addMethod(
  9760. $core.method({
  9761. selector: "at:put:",
  9762. protocol: "accessing",
  9763. fn: function (aKey,aValue){
  9764. var self=this,$self=this;
  9765. return $core.withContext(function($ctx1) {
  9766. var index = $self._positionOfKey_(aKey);
  9767. if(index === -1) {
  9768. var keys = $self.keys;
  9769. index = keys.length;
  9770. keys.push(aKey);
  9771. }
  9772. return $self.values[index] = aValue;
  9773. ;
  9774. return self;
  9775. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue})});
  9776. },
  9777. args: ["aKey", "aValue"],
  9778. 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'>",
  9779. referencedClasses: [],
  9780. 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"]]],
  9781. messageSends: []
  9782. }),
  9783. $globals.Dictionary);
  9784. $core.addMethod(
  9785. $core.method({
  9786. selector: "includesKey:",
  9787. protocol: "testing",
  9788. fn: function (aKey){
  9789. var self=this,$self=this;
  9790. return $core.withContext(function($ctx1) {
  9791. return $self._positionOfKey_(aKey) >= 0;;
  9792. return self;
  9793. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey})});
  9794. },
  9795. args: ["aKey"],
  9796. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $self._positionOfKey_(aKey) >= 0;'>",
  9797. referencedClasses: [],
  9798. pragmas: [["inlineJS:", ["return $self._positionOfKey_(aKey) >= 0;"]]],
  9799. messageSends: []
  9800. }),
  9801. $globals.Dictionary);
  9802. $core.addMethod(
  9803. $core.method({
  9804. selector: "indexOf:ifAbsent:",
  9805. protocol: "accessing",
  9806. fn: function (anObject,aBlock){
  9807. var self=this,$self=this;
  9808. var index;
  9809. return $core.withContext(function($ctx1) {
  9810. var $1;
  9811. index=$recv($self.values)._indexOf_ifAbsent_(anObject,(function(){
  9812. return (0);
  9813. }));
  9814. $1=$recv(index).__eq((0));
  9815. if($core.assert($1)){
  9816. return $recv(aBlock)._value();
  9817. } else {
  9818. return $recv($self.keys)._at_(index);
  9819. }
  9820. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index})});
  9821. },
  9822. args: ["anObject", "aBlock"],
  9823. 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 ]",
  9824. referencedClasses: [],
  9825. pragmas: [],
  9826. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  9827. }),
  9828. $globals.Dictionary);
  9829. $core.addMethod(
  9830. $core.method({
  9831. selector: "initialize",
  9832. protocol: "initialization",
  9833. fn: function (){
  9834. var self=this,$self=this;
  9835. return $core.withContext(function($ctx1) {
  9836. (
  9837. $ctx1.supercall = true,
  9838. ($globals.Dictionary.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  9839. $ctx1.supercall = false;
  9840. $self.keys=[];
  9841. $self.values=[];
  9842. return self;
  9843. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  9844. },
  9845. args: [],
  9846. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  9847. referencedClasses: [],
  9848. pragmas: [],
  9849. messageSends: ["initialize"]
  9850. }),
  9851. $globals.Dictionary);
  9852. $core.addMethod(
  9853. $core.method({
  9854. selector: "keys",
  9855. protocol: "accessing",
  9856. fn: function (){
  9857. var self=this,$self=this;
  9858. return $core.withContext(function($ctx1) {
  9859. return $recv($self.keys)._copy();
  9860. }, function($ctx1) {$ctx1.fill(self,"keys",{})});
  9861. },
  9862. args: [],
  9863. source: "keys\x0a\x09^ keys copy",
  9864. referencedClasses: [],
  9865. pragmas: [],
  9866. messageSends: ["copy"]
  9867. }),
  9868. $globals.Dictionary);
  9869. $core.addMethod(
  9870. $core.method({
  9871. selector: "keysAndValuesDo:",
  9872. protocol: "enumerating",
  9873. fn: function (aBlock){
  9874. var self=this,$self=this;
  9875. return $core.withContext(function($ctx1) {
  9876. return $recv($self.keys)._with_do_($self.values,aBlock);
  9877. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock})});
  9878. },
  9879. args: ["aBlock"],
  9880. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  9881. referencedClasses: [],
  9882. pragmas: [],
  9883. messageSends: ["with:do:"]
  9884. }),
  9885. $globals.Dictionary);
  9886. $core.addMethod(
  9887. $core.method({
  9888. selector: "keysDo:",
  9889. protocol: "enumerating",
  9890. fn: function (aBlock){
  9891. var self=this,$self=this;
  9892. return $core.withContext(function($ctx1) {
  9893. return $recv($self.keys)._do_(aBlock);
  9894. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock})});
  9895. },
  9896. args: ["aBlock"],
  9897. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  9898. referencedClasses: [],
  9899. pragmas: [],
  9900. messageSends: ["do:"]
  9901. }),
  9902. $globals.Dictionary);
  9903. $core.addMethod(
  9904. $core.method({
  9905. selector: "positionOfKey:",
  9906. protocol: "private",
  9907. fn: function (anObject){
  9908. var self=this,$self=this;
  9909. return $core.withContext(function($ctx1) {
  9910. var keys = $self.keys;
  9911. for(var i=0;i<keys.length;i++){
  9912. if(keys[i].__eq(anObject)) { return i;}
  9913. }
  9914. return -1;
  9915. ;
  9916. return self;
  9917. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject})});
  9918. },
  9919. args: ["anObject"],
  9920. 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'>",
  9921. referencedClasses: [],
  9922. 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"]]],
  9923. messageSends: []
  9924. }),
  9925. $globals.Dictionary);
  9926. $core.addMethod(
  9927. $core.method({
  9928. selector: "removeAll",
  9929. protocol: "adding/removing",
  9930. fn: function (){
  9931. var self=this,$self=this;
  9932. return $core.withContext(function($ctx1) {
  9933. $recv($self.keys)._removeAll();
  9934. $ctx1.sendIdx["removeAll"]=1;
  9935. $recv($self.values)._removeAll();
  9936. return self;
  9937. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  9938. },
  9939. args: [],
  9940. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  9941. referencedClasses: [],
  9942. pragmas: [],
  9943. messageSends: ["removeAll"]
  9944. }),
  9945. $globals.Dictionary);
  9946. $core.addMethod(
  9947. $core.method({
  9948. selector: "removeKey:ifAbsent:",
  9949. protocol: "adding/removing",
  9950. fn: function (aKey,aBlock){
  9951. var self=this,$self=this;
  9952. return $core.withContext(function($ctx1) {
  9953. var index = $self._positionOfKey_(aKey);
  9954. if(index === -1) {
  9955. return aBlock._value()
  9956. } else {
  9957. var keys = $self.keys, values = $self.values;
  9958. var value = values[index], l = keys.length;
  9959. keys[index] = keys[l-1];
  9960. keys.pop();
  9961. values[index] = values[l-1];
  9962. values.pop();
  9963. return value;
  9964. }
  9965. ;
  9966. return self;
  9967. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  9968. },
  9969. args: ["aKey", "aBlock"],
  9970. 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'>",
  9971. referencedClasses: [],
  9972. 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"]]],
  9973. messageSends: []
  9974. }),
  9975. $globals.Dictionary);
  9976. $core.addMethod(
  9977. $core.method({
  9978. selector: "values",
  9979. protocol: "accessing",
  9980. fn: function (){
  9981. var self=this,$self=this;
  9982. return $self.values;
  9983. },
  9984. args: [],
  9985. source: "values\x0a\x09^ values",
  9986. referencedClasses: [],
  9987. pragmas: [],
  9988. messageSends: []
  9989. }),
  9990. $globals.Dictionary);
  9991. $core.addMethod(
  9992. $core.method({
  9993. selector: "valuesDo:",
  9994. protocol: "enumerating",
  9995. fn: function (aBlock){
  9996. var self=this,$self=this;
  9997. return $core.withContext(function($ctx1) {
  9998. return $recv($self.values)._do_(aBlock);
  9999. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock})});
  10000. },
  10001. args: ["aBlock"],
  10002. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  10003. referencedClasses: [],
  10004. pragmas: [],
  10005. messageSends: ["do:"]
  10006. }),
  10007. $globals.Dictionary);
  10008. $core.addClass("HashedCollection", $globals.AssociativeCollection, [], "Kernel-Collections");
  10009. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  10010. $core.addMethod(
  10011. $core.method({
  10012. selector: "at:ifAbsent:",
  10013. protocol: "accessing",
  10014. fn: function (aKey,aBlock){
  10015. var self=this,$self=this;
  10016. return $core.withContext(function($ctx1) {
  10017. var $1;
  10018. $1=$self._includesKey_(aKey);
  10019. if($core.assert($1)){
  10020. return $self._basicAt_(aKey);
  10021. } else {
  10022. return $recv(aBlock)._value();
  10023. }
  10024. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  10025. },
  10026. args: ["aKey", "aBlock"],
  10027. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  10028. referencedClasses: [],
  10029. pragmas: [],
  10030. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  10031. }),
  10032. $globals.HashedCollection);
  10033. $core.addMethod(
  10034. $core.method({
  10035. selector: "at:put:",
  10036. protocol: "accessing",
  10037. fn: function (aKey,aValue){
  10038. var self=this,$self=this;
  10039. return $core.withContext(function($ctx1) {
  10040. return $self._basicAt_put_(aKey,aValue);
  10041. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue})});
  10042. },
  10043. args: ["aKey", "aValue"],
  10044. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  10045. referencedClasses: [],
  10046. pragmas: [],
  10047. messageSends: ["basicAt:put:"]
  10048. }),
  10049. $globals.HashedCollection);
  10050. $core.addMethod(
  10051. $core.method({
  10052. selector: "includesKey:",
  10053. protocol: "testing",
  10054. fn: function (aKey){
  10055. var self=this,$self=this;
  10056. return $core.withContext(function($ctx1) {
  10057. return self.hasOwnProperty(aKey);
  10058. return self;
  10059. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey})});
  10060. },
  10061. args: ["aKey"],
  10062. source: "includesKey: aKey\x0a\x09<inlineJS: 'return self.hasOwnProperty(aKey)'>",
  10063. referencedClasses: [],
  10064. pragmas: [["inlineJS:", ["return self.hasOwnProperty(aKey)"]]],
  10065. messageSends: []
  10066. }),
  10067. $globals.HashedCollection);
  10068. $core.addMethod(
  10069. $core.method({
  10070. selector: "keys",
  10071. protocol: "accessing",
  10072. fn: function (){
  10073. var self=this,$self=this;
  10074. return $core.withContext(function($ctx1) {
  10075. return Object.keys(self);
  10076. return self;
  10077. }, function($ctx1) {$ctx1.fill(self,"keys",{})});
  10078. },
  10079. args: [],
  10080. source: "keys\x0a\x09<inlineJS: 'return Object.keys(self)'>",
  10081. referencedClasses: [],
  10082. pragmas: [["inlineJS:", ["return Object.keys(self)"]]],
  10083. messageSends: []
  10084. }),
  10085. $globals.HashedCollection);
  10086. $core.addMethod(
  10087. $core.method({
  10088. selector: "keysDo:",
  10089. protocol: "enumerating",
  10090. fn: function (aBlock){
  10091. var self=this,$self=this;
  10092. return $core.withContext(function($ctx1) {
  10093. $recv($self._keys())._do_(aBlock);
  10094. return self;
  10095. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock})});
  10096. },
  10097. args: ["aBlock"],
  10098. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  10099. referencedClasses: [],
  10100. pragmas: [],
  10101. messageSends: ["do:", "keys"]
  10102. }),
  10103. $globals.HashedCollection);
  10104. $core.addMethod(
  10105. $core.method({
  10106. selector: "removeKey:ifAbsent:",
  10107. protocol: "adding/removing",
  10108. fn: function (aKey,aBlock){
  10109. var self=this,$self=this;
  10110. return $core.withContext(function($ctx1) {
  10111. return $self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  10112. return $core.withContext(function($ctx2) {
  10113. $self._basicDelete_(aKey);
  10114. return removed;
  10115. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  10116. }),(function(){
  10117. return $core.withContext(function($ctx2) {
  10118. return $recv(aBlock)._value();
  10119. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  10120. }));
  10121. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  10122. },
  10123. args: ["aKey", "aBlock"],
  10124. 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 ]",
  10125. referencedClasses: [],
  10126. pragmas: [],
  10127. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  10128. }),
  10129. $globals.HashedCollection);
  10130. $core.addMethod(
  10131. $core.method({
  10132. selector: "values",
  10133. protocol: "accessing",
  10134. fn: function (){
  10135. var self=this,$self=this;
  10136. return $core.withContext(function($ctx1) {
  10137. return $self._keys().map(function(key){
  10138. return $self._at_(key);
  10139. });
  10140. ;
  10141. return self;
  10142. }, function($ctx1) {$ctx1.fill(self,"values",{})});
  10143. },
  10144. args: [],
  10145. 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'>",
  10146. referencedClasses: [],
  10147. pragmas: [["inlineJS:", ["\x0a\x09\x09return $self._keys().map(function(key){\x0a\x09\x09\x09return $self._at_(key);\x0a\x09\x09});\x0a\x09"]]],
  10148. messageSends: []
  10149. }),
  10150. $globals.HashedCollection);
  10151. $core.addMethod(
  10152. $core.method({
  10153. selector: "valuesDo:",
  10154. protocol: "enumerating",
  10155. fn: function (aBlock){
  10156. var self=this,$self=this;
  10157. return $core.withContext(function($ctx1) {
  10158. $recv($self._values())._do_(aBlock);
  10159. return self;
  10160. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock})});
  10161. },
  10162. args: ["aBlock"],
  10163. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  10164. referencedClasses: [],
  10165. pragmas: [],
  10166. messageSends: ["do:", "values"]
  10167. }),
  10168. $globals.HashedCollection);
  10169. $core.addClass("SequenceableCollection", $globals.Collection, [], "Kernel-Collections");
  10170. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  10171. $core.addMethod(
  10172. $core.method({
  10173. selector: "=",
  10174. protocol: "comparing",
  10175. fn: function (aCollection){
  10176. var self=this,$self=this;
  10177. return $core.withContext(function($ctx1) {
  10178. var $3,$2,$4,$1,$5;
  10179. var $early={};
  10180. try {
  10181. $3=$self._class();
  10182. $ctx1.sendIdx["class"]=1;
  10183. $2=$recv($3).__eq($recv(aCollection)._class());
  10184. $ctx1.sendIdx["="]=1;
  10185. $1=$recv($2)._and_((function(){
  10186. return $core.withContext(function($ctx2) {
  10187. $4=$self._size();
  10188. $ctx2.sendIdx["size"]=1;
  10189. return $recv($4).__eq($recv(aCollection)._size());
  10190. $ctx2.sendIdx["="]=2;
  10191. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10192. }));
  10193. if(!$core.assert($1)){
  10194. return false;
  10195. }
  10196. $self._withIndexDo_((function(each,i){
  10197. return $core.withContext(function($ctx2) {
  10198. $5=$recv($recv(aCollection)._at_(i)).__eq(each);
  10199. if(!$core.assert($5)){
  10200. throw $early=[false];
  10201. }
  10202. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  10203. }));
  10204. return true;
  10205. }
  10206. catch(e) {if(e===$early)return e[0]; throw e}
  10207. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection})});
  10208. },
  10209. args: ["aCollection"],
  10210. 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",
  10211. referencedClasses: [],
  10212. pragmas: [],
  10213. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  10214. }),
  10215. $globals.SequenceableCollection);
  10216. $core.addMethod(
  10217. $core.method({
  10218. selector: "addLast:",
  10219. protocol: "adding/removing",
  10220. fn: function (anObject){
  10221. var self=this,$self=this;
  10222. return $core.withContext(function($ctx1) {
  10223. $self._add_(anObject);
  10224. return self;
  10225. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject})});
  10226. },
  10227. args: ["anObject"],
  10228. source: "addLast: anObject\x0a\x09self add: anObject",
  10229. referencedClasses: [],
  10230. pragmas: [],
  10231. messageSends: ["add:"]
  10232. }),
  10233. $globals.SequenceableCollection);
  10234. $core.addMethod(
  10235. $core.method({
  10236. selector: "allButFirst",
  10237. protocol: "accessing",
  10238. fn: function (){
  10239. var self=this,$self=this;
  10240. return $core.withContext(function($ctx1) {
  10241. return $self._copyFrom_to_((2),$self._size());
  10242. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{})});
  10243. },
  10244. args: [],
  10245. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  10246. referencedClasses: [],
  10247. pragmas: [],
  10248. messageSends: ["copyFrom:to:", "size"]
  10249. }),
  10250. $globals.SequenceableCollection);
  10251. $core.addMethod(
  10252. $core.method({
  10253. selector: "allButLast",
  10254. protocol: "accessing",
  10255. fn: function (){
  10256. var self=this,$self=this;
  10257. return $core.withContext(function($ctx1) {
  10258. return $self._copyFrom_to_((1),$recv($self._size()).__minus((1)));
  10259. }, function($ctx1) {$ctx1.fill(self,"allButLast",{})});
  10260. },
  10261. args: [],
  10262. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  10263. referencedClasses: [],
  10264. pragmas: [],
  10265. messageSends: ["copyFrom:to:", "-", "size"]
  10266. }),
  10267. $globals.SequenceableCollection);
  10268. $core.addMethod(
  10269. $core.method({
  10270. selector: "anyOne",
  10271. protocol: "accessing",
  10272. fn: function (){
  10273. var self=this,$self=this;
  10274. return $core.withContext(function($ctx1) {
  10275. return $self._at_((1));
  10276. }, function($ctx1) {$ctx1.fill(self,"anyOne",{})});
  10277. },
  10278. args: [],
  10279. source: "anyOne\x0a\x09^ self at: 1",
  10280. referencedClasses: [],
  10281. pragmas: [],
  10282. messageSends: ["at:"]
  10283. }),
  10284. $globals.SequenceableCollection);
  10285. $core.addMethod(
  10286. $core.method({
  10287. selector: "atRandom",
  10288. protocol: "accessing",
  10289. fn: function (){
  10290. var self=this,$self=this;
  10291. return $core.withContext(function($ctx1) {
  10292. return $self._at_($recv($self._size())._atRandom());
  10293. }, function($ctx1) {$ctx1.fill(self,"atRandom",{})});
  10294. },
  10295. args: [],
  10296. source: "atRandom\x0a\x09^ self at: self size atRandom",
  10297. referencedClasses: [],
  10298. pragmas: [],
  10299. messageSends: ["at:", "atRandom", "size"]
  10300. }),
  10301. $globals.SequenceableCollection);
  10302. $core.addMethod(
  10303. $core.method({
  10304. selector: "beginsWith:",
  10305. protocol: "testing",
  10306. fn: function (prefix){
  10307. var self=this,$self=this;
  10308. return $core.withContext(function($ctx1) {
  10309. var $2,$3,$1;
  10310. $2=$self._size();
  10311. $ctx1.sendIdx["size"]=1;
  10312. $3=$recv(prefix)._size();
  10313. $ctx1.sendIdx["size"]=2;
  10314. $1=$recv($2).__lt($3);
  10315. if($core.assert($1)){
  10316. return false;
  10317. }
  10318. return $recv($self._first_($recv(prefix)._size())).__eq(prefix);
  10319. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix})});
  10320. },
  10321. args: ["prefix"],
  10322. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  10323. referencedClasses: [],
  10324. pragmas: [],
  10325. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  10326. }),
  10327. $globals.SequenceableCollection);
  10328. $core.addMethod(
  10329. $core.method({
  10330. selector: "copyFrom:to:",
  10331. protocol: "copying",
  10332. fn: function (anIndex,anotherIndex){
  10333. var self=this,$self=this;
  10334. return $core.withContext(function($ctx1) {
  10335. $self._subclassResponsibility();
  10336. return self;
  10337. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex})});
  10338. },
  10339. args: ["anIndex", "anotherIndex"],
  10340. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self subclassResponsibility",
  10341. referencedClasses: [],
  10342. pragmas: [],
  10343. messageSends: ["subclassResponsibility"]
  10344. }),
  10345. $globals.SequenceableCollection);
  10346. $core.addMethod(
  10347. $core.method({
  10348. selector: "endsWith:",
  10349. protocol: "testing",
  10350. fn: function (suffix){
  10351. var self=this,$self=this;
  10352. return $core.withContext(function($ctx1) {
  10353. var $2,$3,$1;
  10354. $2=$self._size();
  10355. $ctx1.sendIdx["size"]=1;
  10356. $3=$recv(suffix)._size();
  10357. $ctx1.sendIdx["size"]=2;
  10358. $1=$recv($2).__lt($3);
  10359. if($core.assert($1)){
  10360. return false;
  10361. }
  10362. return $recv($self._last_($recv(suffix)._size())).__eq(suffix);
  10363. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix})});
  10364. },
  10365. args: ["suffix"],
  10366. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  10367. referencedClasses: [],
  10368. pragmas: [],
  10369. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  10370. }),
  10371. $globals.SequenceableCollection);
  10372. $core.addMethod(
  10373. $core.method({
  10374. selector: "first",
  10375. protocol: "accessing",
  10376. fn: function (){
  10377. var self=this,$self=this;
  10378. return $core.withContext(function($ctx1) {
  10379. return $self._at_((1));
  10380. }, function($ctx1) {$ctx1.fill(self,"first",{})});
  10381. },
  10382. args: [],
  10383. source: "first\x0a\x09^ self at: 1",
  10384. referencedClasses: [],
  10385. pragmas: [],
  10386. messageSends: ["at:"]
  10387. }),
  10388. $globals.SequenceableCollection);
  10389. $core.addMethod(
  10390. $core.method({
  10391. selector: "first:",
  10392. protocol: "accessing",
  10393. fn: function (aNumber){
  10394. var self=this,$self=this;
  10395. return $core.withContext(function($ctx1) {
  10396. var $1;
  10397. $1=$recv($self._size()).__lt(aNumber);
  10398. if($core.assert($1)){
  10399. $self._error_("Invalid number of elements");
  10400. }
  10401. return $self._copyFrom_to_((1),aNumber);
  10402. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber})});
  10403. },
  10404. args: ["aNumber"],
  10405. 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",
  10406. referencedClasses: [],
  10407. pragmas: [],
  10408. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  10409. }),
  10410. $globals.SequenceableCollection);
  10411. $core.addMethod(
  10412. $core.method({
  10413. selector: "fourth",
  10414. protocol: "accessing",
  10415. fn: function (){
  10416. var self=this,$self=this;
  10417. return $core.withContext(function($ctx1) {
  10418. return $self._at_((4));
  10419. }, function($ctx1) {$ctx1.fill(self,"fourth",{})});
  10420. },
  10421. args: [],
  10422. source: "fourth\x0a\x09^ self at: 4",
  10423. referencedClasses: [],
  10424. pragmas: [],
  10425. messageSends: ["at:"]
  10426. }),
  10427. $globals.SequenceableCollection);
  10428. $core.addMethod(
  10429. $core.method({
  10430. selector: "includes:",
  10431. protocol: "testing",
  10432. fn: function (anObject){
  10433. var self=this,$self=this;
  10434. return $core.withContext(function($ctx1) {
  10435. return $recv($self._indexOf_ifAbsent_(anObject,(function(){
  10436. return nil;
  10437. })))._notNil();
  10438. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject})});
  10439. },
  10440. args: ["anObject"],
  10441. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  10442. referencedClasses: [],
  10443. pragmas: [],
  10444. messageSends: ["notNil", "indexOf:ifAbsent:"]
  10445. }),
  10446. $globals.SequenceableCollection);
  10447. $core.addMethod(
  10448. $core.method({
  10449. selector: "indexOf:startingAt:",
  10450. protocol: "accessing",
  10451. fn: function (anObject,start){
  10452. var self=this,$self=this;
  10453. return $core.withContext(function($ctx1) {
  10454. return $self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  10455. return (0);
  10456. }));
  10457. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start})});
  10458. },
  10459. args: ["anObject", "start"],
  10460. 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 ]",
  10461. referencedClasses: [],
  10462. pragmas: [],
  10463. messageSends: ["indexOf:startingAt:ifAbsent:"]
  10464. }),
  10465. $globals.SequenceableCollection);
  10466. $core.addMethod(
  10467. $core.method({
  10468. selector: "indexOf:startingAt:ifAbsent:",
  10469. protocol: "accessing",
  10470. fn: function (anObject,start,aBlock){
  10471. var self=this,$self=this;
  10472. return $core.withContext(function($ctx1) {
  10473. $self._subclassResponsibility();
  10474. return self;
  10475. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock})});
  10476. },
  10477. args: ["anObject", "start", "aBlock"],
  10478. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  10479. referencedClasses: [],
  10480. pragmas: [],
  10481. messageSends: ["subclassResponsibility"]
  10482. }),
  10483. $globals.SequenceableCollection);
  10484. $core.addMethod(
  10485. $core.method({
  10486. selector: "last",
  10487. protocol: "accessing",
  10488. fn: function (){
  10489. var self=this,$self=this;
  10490. return $core.withContext(function($ctx1) {
  10491. return $self._at_($self._size());
  10492. }, function($ctx1) {$ctx1.fill(self,"last",{})});
  10493. },
  10494. args: [],
  10495. source: "last\x0a\x09^ self at: self size",
  10496. referencedClasses: [],
  10497. pragmas: [],
  10498. messageSends: ["at:", "size"]
  10499. }),
  10500. $globals.SequenceableCollection);
  10501. $core.addMethod(
  10502. $core.method({
  10503. selector: "last:",
  10504. protocol: "accessing",
  10505. fn: function (aNumber){
  10506. var self=this,$self=this;
  10507. return $core.withContext(function($ctx1) {
  10508. var $2,$1,$5,$4,$3;
  10509. $2=$self._size();
  10510. $ctx1.sendIdx["size"]=1;
  10511. $1=$recv($2).__lt(aNumber);
  10512. if($core.assert($1)){
  10513. $self._error_("Invalid number of elements");
  10514. }
  10515. $5=$self._size();
  10516. $ctx1.sendIdx["size"]=2;
  10517. $4=$recv($5).__minus(aNumber);
  10518. $3=$recv($4).__plus((1));
  10519. return $self._copyFrom_to_($3,$self._size());
  10520. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber})});
  10521. },
  10522. args: ["aNumber"],
  10523. 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",
  10524. referencedClasses: [],
  10525. pragmas: [],
  10526. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  10527. }),
  10528. $globals.SequenceableCollection);
  10529. $core.addMethod(
  10530. $core.method({
  10531. selector: "newStream",
  10532. protocol: "streaming",
  10533. fn: function (){
  10534. var self=this,$self=this;
  10535. return $core.withContext(function($ctx1) {
  10536. return $recv($self._streamClass())._on_(self);
  10537. }, function($ctx1) {$ctx1.fill(self,"newStream",{})});
  10538. },
  10539. args: [],
  10540. source: "newStream\x0a\x09^ self streamClass on: self",
  10541. referencedClasses: [],
  10542. pragmas: [],
  10543. messageSends: ["on:", "streamClass"]
  10544. }),
  10545. $globals.SequenceableCollection);
  10546. $core.addMethod(
  10547. $core.method({
  10548. selector: "readStream",
  10549. protocol: "streaming",
  10550. fn: function (){
  10551. var self=this,$self=this;
  10552. return $core.withContext(function($ctx1) {
  10553. return $self._stream();
  10554. }, function($ctx1) {$ctx1.fill(self,"readStream",{})});
  10555. },
  10556. args: [],
  10557. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  10558. referencedClasses: [],
  10559. pragmas: [],
  10560. messageSends: ["stream"]
  10561. }),
  10562. $globals.SequenceableCollection);
  10563. $core.addMethod(
  10564. $core.method({
  10565. selector: "removeLast",
  10566. protocol: "adding/removing",
  10567. fn: function (){
  10568. var self=this,$self=this;
  10569. return $core.withContext(function($ctx1) {
  10570. return $self._remove_($self._last());
  10571. }, function($ctx1) {$ctx1.fill(self,"removeLast",{})});
  10572. },
  10573. args: [],
  10574. source: "removeLast\x0a\x09^ self remove: self last",
  10575. referencedClasses: [],
  10576. pragmas: [],
  10577. messageSends: ["remove:", "last"]
  10578. }),
  10579. $globals.SequenceableCollection);
  10580. $core.addMethod(
  10581. $core.method({
  10582. selector: "reverseDo:",
  10583. protocol: "enumerating",
  10584. fn: function (aBlock){
  10585. var self=this,$self=this;
  10586. return $core.withContext(function($ctx1) {
  10587. $recv($self._reversed())._do_(aBlock);
  10588. return self;
  10589. }, function($ctx1) {$ctx1.fill(self,"reverseDo:",{aBlock:aBlock})});
  10590. },
  10591. args: ["aBlock"],
  10592. source: "reverseDo: aBlock\x0a\x09self reversed do: aBlock",
  10593. referencedClasses: [],
  10594. pragmas: [],
  10595. messageSends: ["do:", "reversed"]
  10596. }),
  10597. $globals.SequenceableCollection);
  10598. $core.addMethod(
  10599. $core.method({
  10600. selector: "reversed",
  10601. protocol: "converting",
  10602. fn: function (){
  10603. var self=this,$self=this;
  10604. return $core.withContext(function($ctx1) {
  10605. $self._subclassResponsibility();
  10606. return self;
  10607. }, function($ctx1) {$ctx1.fill(self,"reversed",{})});
  10608. },
  10609. args: [],
  10610. source: "reversed\x0a\x09self subclassResponsibility",
  10611. referencedClasses: [],
  10612. pragmas: [],
  10613. messageSends: ["subclassResponsibility"]
  10614. }),
  10615. $globals.SequenceableCollection);
  10616. $core.addMethod(
  10617. $core.method({
  10618. selector: "second",
  10619. protocol: "accessing",
  10620. fn: function (){
  10621. var self=this,$self=this;
  10622. return $core.withContext(function($ctx1) {
  10623. return $self._at_((2));
  10624. }, function($ctx1) {$ctx1.fill(self,"second",{})});
  10625. },
  10626. args: [],
  10627. source: "second\x0a\x09^ self at: 2",
  10628. referencedClasses: [],
  10629. pragmas: [],
  10630. messageSends: ["at:"]
  10631. }),
  10632. $globals.SequenceableCollection);
  10633. $core.addMethod(
  10634. $core.method({
  10635. selector: "stream",
  10636. protocol: "streaming",
  10637. fn: function (){
  10638. var self=this,$self=this;
  10639. return $core.withContext(function($ctx1) {
  10640. return $self._newStream();
  10641. }, function($ctx1) {$ctx1.fill(self,"stream",{})});
  10642. },
  10643. args: [],
  10644. source: "stream\x0a\x09^ self newStream",
  10645. referencedClasses: [],
  10646. pragmas: [],
  10647. messageSends: ["newStream"]
  10648. }),
  10649. $globals.SequenceableCollection);
  10650. $core.addMethod(
  10651. $core.method({
  10652. selector: "streamClass",
  10653. protocol: "streaming",
  10654. fn: function (){
  10655. var self=this,$self=this;
  10656. return $core.withContext(function($ctx1) {
  10657. return $recv($self._class())._streamClass();
  10658. }, function($ctx1) {$ctx1.fill(self,"streamClass",{})});
  10659. },
  10660. args: [],
  10661. source: "streamClass\x0a\x09^ self class streamClass",
  10662. referencedClasses: [],
  10663. pragmas: [],
  10664. messageSends: ["streamClass", "class"]
  10665. }),
  10666. $globals.SequenceableCollection);
  10667. $core.addMethod(
  10668. $core.method({
  10669. selector: "third",
  10670. protocol: "accessing",
  10671. fn: function (){
  10672. var self=this,$self=this;
  10673. return $core.withContext(function($ctx1) {
  10674. return $self._at_((3));
  10675. }, function($ctx1) {$ctx1.fill(self,"third",{})});
  10676. },
  10677. args: [],
  10678. source: "third\x0a\x09^ self at: 3",
  10679. referencedClasses: [],
  10680. pragmas: [],
  10681. messageSends: ["at:"]
  10682. }),
  10683. $globals.SequenceableCollection);
  10684. $core.addMethod(
  10685. $core.method({
  10686. selector: "writeStream",
  10687. protocol: "streaming",
  10688. fn: function (){
  10689. var self=this,$self=this;
  10690. return $core.withContext(function($ctx1) {
  10691. return $self._stream();
  10692. }, function($ctx1) {$ctx1.fill(self,"writeStream",{})});
  10693. },
  10694. args: [],
  10695. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  10696. referencedClasses: [],
  10697. pragmas: [],
  10698. messageSends: ["stream"]
  10699. }),
  10700. $globals.SequenceableCollection);
  10701. $core.addMethod(
  10702. $core.method({
  10703. selector: "streamClass",
  10704. protocol: "accessing",
  10705. fn: function (){
  10706. var self=this,$self=this;
  10707. return $globals.Stream;
  10708. },
  10709. args: [],
  10710. source: "streamClass\x0a\x09\x09^ Stream",
  10711. referencedClasses: ["Stream"],
  10712. pragmas: [],
  10713. messageSends: []
  10714. }),
  10715. $globals.SequenceableCollection.a$cls);
  10716. $core.addMethod(
  10717. $core.method({
  10718. selector: "streamContents:",
  10719. protocol: "streaming",
  10720. fn: function (aBlock){
  10721. var self=this,$self=this;
  10722. var stream;
  10723. return $core.withContext(function($ctx1) {
  10724. stream=$recv($self._streamClass())._on_($self._new());
  10725. $recv(aBlock)._value_(stream);
  10726. return $recv(stream)._contents();
  10727. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream})});
  10728. },
  10729. args: ["aBlock"],
  10730. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  10731. referencedClasses: [],
  10732. pragmas: [],
  10733. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  10734. }),
  10735. $globals.SequenceableCollection.a$cls);
  10736. $core.addClass("Array", $globals.SequenceableCollection, [], "Kernel-Collections");
  10737. $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`.";
  10738. $core.addMethod(
  10739. $core.method({
  10740. selector: "add:",
  10741. protocol: "adding/removing",
  10742. fn: function (anObject){
  10743. var self=this,$self=this;
  10744. return $core.withContext(function($ctx1) {
  10745. self.push(anObject); return anObject;;
  10746. return self;
  10747. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject})});
  10748. },
  10749. args: ["anObject"],
  10750. source: "add: anObject\x0a\x09<inlineJS: 'self.push(anObject); return anObject;'>",
  10751. referencedClasses: [],
  10752. pragmas: [["inlineJS:", ["self.push(anObject); return anObject;"]]],
  10753. messageSends: []
  10754. }),
  10755. $globals.Array);
  10756. $core.addMethod(
  10757. $core.method({
  10758. selector: "addAll:",
  10759. protocol: "adding/removing",
  10760. fn: function (aCollection){
  10761. var self=this,$self=this;
  10762. return $core.withContext(function($ctx1) {
  10763. if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);
  10764. else $globals.Array.superclass.fn.prototype._addAll_.call($self, aCollection);
  10765. return aCollection;;
  10766. return self;
  10767. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection})});
  10768. },
  10769. args: ["aCollection"],
  10770. 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'>",
  10771. referencedClasses: [],
  10772. 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;"]]],
  10773. messageSends: []
  10774. }),
  10775. $globals.Array);
  10776. $core.addMethod(
  10777. $core.method({
  10778. selector: "addFirst:",
  10779. protocol: "adding/removing",
  10780. fn: function (anObject){
  10781. var self=this,$self=this;
  10782. return $core.withContext(function($ctx1) {
  10783. self.unshift(anObject); return anObject;;
  10784. return self;
  10785. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject})});
  10786. },
  10787. args: ["anObject"],
  10788. source: "addFirst: anObject\x0a\x09<inlineJS: 'self.unshift(anObject); return anObject;'>",
  10789. referencedClasses: [],
  10790. pragmas: [["inlineJS:", ["self.unshift(anObject); return anObject;"]]],
  10791. messageSends: []
  10792. }),
  10793. $globals.Array);
  10794. $core.addMethod(
  10795. $core.method({
  10796. selector: "asJavaScriptSource",
  10797. protocol: "converting",
  10798. fn: function (){
  10799. var self=this,$self=this;
  10800. return $core.withContext(function($ctx1) {
  10801. var $1;
  10802. $1=$recv("[".__comma($recv($self._collect_((function(each){
  10803. return $core.withContext(function($ctx2) {
  10804. return $recv(each)._asJavaScriptSource();
  10805. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10806. })))._join_(", "))).__comma("]");
  10807. $ctx1.sendIdx[","]=1;
  10808. return $1;
  10809. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  10810. },
  10811. args: [],
  10812. source: "asJavaScriptSource\x0a\x09^ '[', ((self collect: [:each | each asJavaScriptSource ]) join: ', '), ']'",
  10813. referencedClasses: [],
  10814. pragmas: [],
  10815. messageSends: [",", "join:", "collect:", "asJavaScriptSource"]
  10816. }),
  10817. $globals.Array);
  10818. $core.addMethod(
  10819. $core.method({
  10820. selector: "at:put:",
  10821. protocol: "accessing",
  10822. fn: function (anIndex,anObject){
  10823. var self=this,$self=this;
  10824. return $core.withContext(function($ctx1) {
  10825. return self[anIndex - 1] = anObject;
  10826. return self;
  10827. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject})});
  10828. },
  10829. args: ["anIndex", "anObject"],
  10830. source: "at: anIndex put: anObject\x0a\x09<inlineJS: 'return self[anIndex - 1] = anObject'>",
  10831. referencedClasses: [],
  10832. pragmas: [["inlineJS:", ["return self[anIndex - 1] = anObject"]]],
  10833. messageSends: []
  10834. }),
  10835. $globals.Array);
  10836. $core.addMethod(
  10837. $core.method({
  10838. selector: "collect:",
  10839. protocol: "enumerating",
  10840. fn: function (aBlock){
  10841. var self=this,$self=this;
  10842. return $core.withContext(function($ctx1) {
  10843. return self.map(function(each) {return aBlock._value_(each)});
  10844. return self;
  10845. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock})});
  10846. },
  10847. args: ["aBlock"],
  10848. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.map(function(each) {return aBlock._value_(each)})'>",
  10849. referencedClasses: [],
  10850. pragmas: [["inlineJS:", ["return self.map(function(each) {return aBlock._value_(each)})"]]],
  10851. messageSends: []
  10852. }),
  10853. $globals.Array);
  10854. $core.addMethod(
  10855. $core.method({
  10856. selector: "copyFrom:to:",
  10857. protocol: "copying",
  10858. fn: function (anIndex,anotherIndex){
  10859. var self=this,$self=this;
  10860. return $core.withContext(function($ctx1) {
  10861. if (anIndex >= 1 && anotherIndex <= self.length) {
  10862. return self.slice(anIndex - 1, anotherIndex);
  10863. } else {
  10864. self._at_(anIndex);
  10865. self._at_(self.length + 1);
  10866. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  10867. };
  10868. return self;
  10869. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex})});
  10870. },
  10871. args: ["anIndex", "anotherIndex"],
  10872. 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'>",
  10873. referencedClasses: [],
  10874. 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}"]]],
  10875. messageSends: []
  10876. }),
  10877. $globals.Array);
  10878. $core.addMethod(
  10879. $core.method({
  10880. selector: "join:",
  10881. protocol: "enumerating",
  10882. fn: function (aString){
  10883. var self=this,$self=this;
  10884. return $core.withContext(function($ctx1) {
  10885. return self.join(aString);
  10886. return self;
  10887. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString})});
  10888. },
  10889. args: ["aString"],
  10890. source: "join: aString\x0a\x09<inlineJS: 'return self.join(aString)'>",
  10891. referencedClasses: [],
  10892. pragmas: [["inlineJS:", ["return self.join(aString)"]]],
  10893. messageSends: []
  10894. }),
  10895. $globals.Array);
  10896. $core.addMethod(
  10897. $core.method({
  10898. selector: "printOn:",
  10899. protocol: "printing",
  10900. fn: function (aStream){
  10901. var self=this,$self=this;
  10902. return $core.withContext(function($ctx1) {
  10903. (
  10904. $ctx1.supercall = true,
  10905. ($globals.Array.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  10906. $ctx1.supercall = false;
  10907. $ctx1.sendIdx["printOn:"]=1;
  10908. $recv(aStream)._nextPutAll_(" (");
  10909. $ctx1.sendIdx["nextPutAll:"]=1;
  10910. $self._do_separatedBy_((function(each){
  10911. return $core.withContext(function($ctx2) {
  10912. return $recv(each)._printOn_(aStream);
  10913. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10914. }),(function(){
  10915. return $core.withContext(function($ctx2) {
  10916. return $recv(aStream)._nextPutAll_(" ");
  10917. $ctx2.sendIdx["nextPutAll:"]=2;
  10918. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  10919. }));
  10920. $recv(aStream)._nextPutAll_(")");
  10921. return self;
  10922. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  10923. },
  10924. args: ["aStream"],
  10925. 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: ')'",
  10926. referencedClasses: [],
  10927. pragmas: [],
  10928. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  10929. }),
  10930. $globals.Array);
  10931. $core.addMethod(
  10932. $core.method({
  10933. selector: "remove:ifAbsent:",
  10934. protocol: "adding/removing",
  10935. fn: function (anObject,aBlock){
  10936. var self=this,$self=this;
  10937. var index;
  10938. return $core.withContext(function($ctx1) {
  10939. var $1;
  10940. index=$self._indexOf_ifAbsent_(anObject,(function(){
  10941. return (0);
  10942. }));
  10943. $1=$recv(index).__eq((0));
  10944. if($core.assert($1)){
  10945. return $recv(aBlock)._value();
  10946. } else {
  10947. $self._removeIndex_(index);
  10948. return anObject;
  10949. }
  10950. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index})});
  10951. },
  10952. args: ["anObject", "aBlock"],
  10953. 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 ]",
  10954. referencedClasses: [],
  10955. pragmas: [],
  10956. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  10957. }),
  10958. $globals.Array);
  10959. $core.addMethod(
  10960. $core.method({
  10961. selector: "removeAll",
  10962. protocol: "adding/removing",
  10963. fn: function (){
  10964. var self=this,$self=this;
  10965. return $core.withContext(function($ctx1) {
  10966. self.length = 0;
  10967. return self;
  10968. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  10969. },
  10970. args: [],
  10971. source: "removeAll\x0a\x09<inlineJS: 'self.length = 0'>",
  10972. referencedClasses: [],
  10973. pragmas: [["inlineJS:", ["self.length = 0"]]],
  10974. messageSends: []
  10975. }),
  10976. $globals.Array);
  10977. $core.addMethod(
  10978. $core.method({
  10979. selector: "removeFrom:to:",
  10980. protocol: "adding/removing",
  10981. fn: function (aNumber,anotherNumber){
  10982. var self=this,$self=this;
  10983. return $core.withContext(function($ctx1) {
  10984. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  10985. return self;
  10986. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber})});
  10987. },
  10988. args: ["aNumber", "anotherNumber"],
  10989. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<inlineJS: 'self.splice(aNumber -1, anotherNumber - aNumber + 1)'>",
  10990. referencedClasses: [],
  10991. pragmas: [["inlineJS:", ["self.splice(aNumber -1, anotherNumber - aNumber + 1)"]]],
  10992. messageSends: []
  10993. }),
  10994. $globals.Array);
  10995. $core.addMethod(
  10996. $core.method({
  10997. selector: "removeIndex:",
  10998. protocol: "adding/removing",
  10999. fn: function (anInteger){
  11000. var self=this,$self=this;
  11001. return $core.withContext(function($ctx1) {
  11002. self.splice(anInteger - 1, 1);
  11003. return self;
  11004. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger})});
  11005. },
  11006. args: ["anInteger"],
  11007. source: "removeIndex: anInteger\x0a\x09<inlineJS: 'self.splice(anInteger - 1, 1)'>",
  11008. referencedClasses: [],
  11009. pragmas: [["inlineJS:", ["self.splice(anInteger - 1, 1)"]]],
  11010. messageSends: []
  11011. }),
  11012. $globals.Array);
  11013. $core.addMethod(
  11014. $core.method({
  11015. selector: "removeLast",
  11016. protocol: "adding/removing",
  11017. fn: function (){
  11018. var self=this,$self=this;
  11019. return $core.withContext(function($ctx1) {
  11020. return self.pop();;
  11021. return self;
  11022. }, function($ctx1) {$ctx1.fill(self,"removeLast",{})});
  11023. },
  11024. args: [],
  11025. source: "removeLast\x0a\x09<inlineJS: 'return self.pop();'>",
  11026. referencedClasses: [],
  11027. pragmas: [["inlineJS:", ["return self.pop();"]]],
  11028. messageSends: []
  11029. }),
  11030. $globals.Array);
  11031. $core.addMethod(
  11032. $core.method({
  11033. selector: "reversed",
  11034. protocol: "converting",
  11035. fn: function (){
  11036. var self=this,$self=this;
  11037. return $core.withContext(function($ctx1) {
  11038. return self.slice().reverse();
  11039. return self;
  11040. }, function($ctx1) {$ctx1.fill(self,"reversed",{})});
  11041. },
  11042. args: [],
  11043. source: "reversed\x0a\x09<inlineJS: 'return self.slice().reverse()'>",
  11044. referencedClasses: [],
  11045. pragmas: [["inlineJS:", ["return self.slice().reverse()"]]],
  11046. messageSends: []
  11047. }),
  11048. $globals.Array);
  11049. $core.addMethod(
  11050. $core.method({
  11051. selector: "select:",
  11052. protocol: "enumerating",
  11053. fn: function (aBlock){
  11054. var self=this,$self=this;
  11055. return $core.withContext(function($ctx1) {
  11056. return self.filter(function(each) {return aBlock._value_(each)});
  11057. return self;
  11058. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock})});
  11059. },
  11060. args: ["aBlock"],
  11061. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.filter(function(each) {return aBlock._value_(each)})'>",
  11062. referencedClasses: [],
  11063. pragmas: [["inlineJS:", ["return self.filter(function(each) {return aBlock._value_(each)})"]]],
  11064. messageSends: []
  11065. }),
  11066. $globals.Array);
  11067. $core.addMethod(
  11068. $core.method({
  11069. selector: "shallowCopy",
  11070. protocol: "copying",
  11071. fn: function (){
  11072. var self=this,$self=this;
  11073. return $core.withContext(function($ctx1) {
  11074. return self.slice();
  11075. return self;
  11076. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{})});
  11077. },
  11078. args: [],
  11079. source: "shallowCopy\x0a\x09<inlineJS: 'return self.slice()'>",
  11080. referencedClasses: [],
  11081. pragmas: [["inlineJS:", ["return self.slice()"]]],
  11082. messageSends: []
  11083. }),
  11084. $globals.Array);
  11085. $core.addMethod(
  11086. $core.method({
  11087. selector: "sort",
  11088. protocol: "enumerating",
  11089. fn: function (){
  11090. var self=this,$self=this;
  11091. return $core.withContext(function($ctx1) {
  11092. return $self._sort_((function(a,b){
  11093. return $core.withContext(function($ctx2) {
  11094. return $recv(a).__lt(b);
  11095. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  11096. }));
  11097. }, function($ctx1) {$ctx1.fill(self,"sort",{})});
  11098. },
  11099. args: [],
  11100. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  11101. referencedClasses: [],
  11102. pragmas: [],
  11103. messageSends: ["sort:", "<"]
  11104. }),
  11105. $globals.Array);
  11106. $core.addMethod(
  11107. $core.method({
  11108. selector: "sort:",
  11109. protocol: "enumerating",
  11110. fn: function (aBlock){
  11111. var self=this,$self=this;
  11112. return $core.withContext(function($ctx1) {
  11113. return self.sort(function(a, b) {
  11114. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  11115. })
  11116. ;
  11117. return self;
  11118. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock})});
  11119. },
  11120. args: ["aBlock"],
  11121. 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'>",
  11122. referencedClasses: [],
  11123. 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"]]],
  11124. messageSends: []
  11125. }),
  11126. $globals.Array);
  11127. $core.addMethod(
  11128. $core.method({
  11129. selector: "sorted",
  11130. protocol: "enumerating",
  11131. fn: function (){
  11132. var self=this,$self=this;
  11133. return $core.withContext(function($ctx1) {
  11134. return $recv($self._copy())._sort();
  11135. }, function($ctx1) {$ctx1.fill(self,"sorted",{})});
  11136. },
  11137. args: [],
  11138. source: "sorted\x0a\x09^ self copy sort",
  11139. referencedClasses: [],
  11140. pragmas: [],
  11141. messageSends: ["sort", "copy"]
  11142. }),
  11143. $globals.Array);
  11144. $core.addMethod(
  11145. $core.method({
  11146. selector: "sorted:",
  11147. protocol: "enumerating",
  11148. fn: function (aBlock){
  11149. var self=this,$self=this;
  11150. return $core.withContext(function($ctx1) {
  11151. return $recv($self._copy())._sort_(aBlock);
  11152. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock})});
  11153. },
  11154. args: ["aBlock"],
  11155. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  11156. referencedClasses: [],
  11157. pragmas: [],
  11158. messageSends: ["sort:", "copy"]
  11159. }),
  11160. $globals.Array);
  11161. $core.addMethod(
  11162. $core.method({
  11163. selector: "new:",
  11164. protocol: "instance creation",
  11165. fn: function (anInteger){
  11166. var self=this,$self=this;
  11167. return $core.withContext(function($ctx1) {
  11168. return new Array(anInteger);
  11169. return self;
  11170. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger})});
  11171. },
  11172. args: ["anInteger"],
  11173. source: "new: anInteger\x0a\x09<inlineJS: 'return new Array(anInteger)'>",
  11174. referencedClasses: [],
  11175. pragmas: [["inlineJS:", ["return new Array(anInteger)"]]],
  11176. messageSends: []
  11177. }),
  11178. $globals.Array.a$cls);
  11179. $core.addMethod(
  11180. $core.method({
  11181. selector: "with:",
  11182. protocol: "instance creation",
  11183. fn: function (anObject){
  11184. var self=this,$self=this;
  11185. return $core.withContext(function($ctx1) {
  11186. var $1;
  11187. $1=$self._new_((1));
  11188. $recv($1)._at_put_((1),anObject);
  11189. return $recv($1)._yourself();
  11190. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject})});
  11191. },
  11192. args: ["anObject"],
  11193. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  11194. referencedClasses: [],
  11195. pragmas: [],
  11196. messageSends: ["at:put:", "new:", "yourself"]
  11197. }),
  11198. $globals.Array.a$cls);
  11199. $core.addMethod(
  11200. $core.method({
  11201. selector: "with:with:",
  11202. protocol: "instance creation",
  11203. fn: function (anObject,anObject2){
  11204. var self=this,$self=this;
  11205. return $core.withContext(function($ctx1) {
  11206. var $1;
  11207. $1=$self._new_((2));
  11208. $recv($1)._at_put_((1),anObject);
  11209. $ctx1.sendIdx["at:put:"]=1;
  11210. $recv($1)._at_put_((2),anObject2);
  11211. return $recv($1)._yourself();
  11212. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2})});
  11213. },
  11214. args: ["anObject", "anObject2"],
  11215. 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",
  11216. referencedClasses: [],
  11217. pragmas: [],
  11218. messageSends: ["at:put:", "new:", "yourself"]
  11219. }),
  11220. $globals.Array.a$cls);
  11221. $core.addMethod(
  11222. $core.method({
  11223. selector: "with:with:with:",
  11224. protocol: "instance creation",
  11225. fn: function (anObject,anObject2,anObject3){
  11226. var self=this,$self=this;
  11227. return $core.withContext(function($ctx1) {
  11228. var $1;
  11229. $1=$self._new_((3));
  11230. $recv($1)._at_put_((1),anObject);
  11231. $ctx1.sendIdx["at:put:"]=1;
  11232. $recv($1)._at_put_((2),anObject2);
  11233. $ctx1.sendIdx["at:put:"]=2;
  11234. $recv($1)._at_put_((3),anObject3);
  11235. return $recv($1)._yourself();
  11236. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3})});
  11237. },
  11238. args: ["anObject", "anObject2", "anObject3"],
  11239. 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",
  11240. referencedClasses: [],
  11241. pragmas: [],
  11242. messageSends: ["at:put:", "new:", "yourself"]
  11243. }),
  11244. $globals.Array.a$cls);
  11245. $core.addMethod(
  11246. $core.method({
  11247. selector: "withAll:",
  11248. protocol: "instance creation",
  11249. fn: function (aCollection){
  11250. var self=this,$self=this;
  11251. var instance,index;
  11252. return $core.withContext(function($ctx1) {
  11253. index=(1);
  11254. instance=$self._new_($recv(aCollection)._size());
  11255. $recv(aCollection)._do_((function(each){
  11256. return $core.withContext(function($ctx2) {
  11257. $recv(instance)._at_put_(index,each);
  11258. index=$recv(index).__plus((1));
  11259. return index;
  11260. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11261. }));
  11262. return instance;
  11263. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index})});
  11264. },
  11265. args: ["aCollection"],
  11266. 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",
  11267. referencedClasses: [],
  11268. pragmas: [],
  11269. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  11270. }),
  11271. $globals.Array.a$cls);
  11272. $core.addClass("String", $globals.SequenceableCollection, [], "Kernel-Collections");
  11273. $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 >> #,`";
  11274. $core.addMethod(
  11275. $core.method({
  11276. selector: ",",
  11277. protocol: "copying",
  11278. fn: function (aString){
  11279. var self=this,$self=this;
  11280. return $core.withContext(function($ctx1) {
  11281. return String(self) + aString;
  11282. return self;
  11283. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString})});
  11284. },
  11285. args: ["aString"],
  11286. source: ", aString\x0a\x09<inlineJS: 'return String(self) + aString'>",
  11287. referencedClasses: [],
  11288. pragmas: [["inlineJS:", ["return String(self) + aString"]]],
  11289. messageSends: []
  11290. }),
  11291. $globals.String);
  11292. $core.addMethod(
  11293. $core.method({
  11294. selector: "<",
  11295. protocol: "comparing",
  11296. fn: function (aString){
  11297. var self=this,$self=this;
  11298. return $core.withContext(function($ctx1) {
  11299. return String(self) < aString._asString();
  11300. return self;
  11301. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString})});
  11302. },
  11303. args: ["aString"],
  11304. source: "< aString\x0a\x09<inlineJS: 'return String(self) < aString._asString()'>",
  11305. referencedClasses: [],
  11306. pragmas: [["inlineJS:", ["return String(self) < aString._asString()"]]],
  11307. messageSends: []
  11308. }),
  11309. $globals.String);
  11310. $core.addMethod(
  11311. $core.method({
  11312. selector: "<=",
  11313. protocol: "comparing",
  11314. fn: function (aString){
  11315. var self=this,$self=this;
  11316. return $core.withContext(function($ctx1) {
  11317. return String(self) <= aString._asString();
  11318. return self;
  11319. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString})});
  11320. },
  11321. args: ["aString"],
  11322. source: "<= aString\x0a\x09<inlineJS: 'return String(self) <= aString._asString()'>",
  11323. referencedClasses: [],
  11324. pragmas: [["inlineJS:", ["return String(self) <= aString._asString()"]]],
  11325. messageSends: []
  11326. }),
  11327. $globals.String);
  11328. $core.addMethod(
  11329. $core.method({
  11330. selector: "=",
  11331. protocol: "comparing",
  11332. fn: function (aString){
  11333. var self=this,$self=this;
  11334. return $core.withContext(function($ctx1) {
  11335. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  11336. return self;
  11337. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString})});
  11338. },
  11339. args: ["aString"],
  11340. source: "= aString\x0a<inlineJS:\x0a\x09'return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())'>",
  11341. referencedClasses: [],
  11342. pragmas: [["inlineJS:", ["return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())"]]],
  11343. messageSends: []
  11344. }),
  11345. $globals.String);
  11346. $core.addMethod(
  11347. $core.method({
  11348. selector: "==",
  11349. protocol: "comparing",
  11350. fn: function (aString){
  11351. var self=this,$self=this;
  11352. return $core.withContext(function($ctx1) {
  11353. if (typeof aString === "string") return String(self) === aString;
  11354. else if (aString != null && typeof aString === "object") return String(self) === aString.valueOf();
  11355. else return false;;
  11356. return self;
  11357. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString})});
  11358. },
  11359. args: ["aString"],
  11360. 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'>",
  11361. referencedClasses: [],
  11362. 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;"]]],
  11363. messageSends: []
  11364. }),
  11365. $globals.String);
  11366. $core.addMethod(
  11367. $core.method({
  11368. selector: ">",
  11369. protocol: "comparing",
  11370. fn: function (aString){
  11371. var self=this,$self=this;
  11372. return $core.withContext(function($ctx1) {
  11373. return String(self) > aString._asString();
  11374. return self;
  11375. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString})});
  11376. },
  11377. args: ["aString"],
  11378. source: "> aString\x0a\x09<inlineJS: 'return String(self) > aString._asString()'>",
  11379. referencedClasses: [],
  11380. pragmas: [["inlineJS:", ["return String(self) > aString._asString()"]]],
  11381. messageSends: []
  11382. }),
  11383. $globals.String);
  11384. $core.addMethod(
  11385. $core.method({
  11386. selector: ">=",
  11387. protocol: "comparing",
  11388. fn: function (aString){
  11389. var self=this,$self=this;
  11390. return $core.withContext(function($ctx1) {
  11391. return String(self) >= aString._asString();
  11392. return self;
  11393. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString})});
  11394. },
  11395. args: ["aString"],
  11396. source: ">= aString\x0a\x09<inlineJS: 'return String(self) >= aString._asString()'>",
  11397. referencedClasses: [],
  11398. pragmas: [["inlineJS:", ["return String(self) >= aString._asString()"]]],
  11399. messageSends: []
  11400. }),
  11401. $globals.String);
  11402. $core.addMethod(
  11403. $core.method({
  11404. selector: "add:",
  11405. protocol: "adding/removing",
  11406. fn: function (anObject){
  11407. var self=this,$self=this;
  11408. return $core.withContext(function($ctx1) {
  11409. $self._errorReadOnly();
  11410. return self;
  11411. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject})});
  11412. },
  11413. args: ["anObject"],
  11414. source: "add: anObject\x0a\x09self errorReadOnly",
  11415. referencedClasses: [],
  11416. pragmas: [],
  11417. messageSends: ["errorReadOnly"]
  11418. }),
  11419. $globals.String);
  11420. $core.addMethod(
  11421. $core.method({
  11422. selector: "asJavaScriptMethodName",
  11423. protocol: "converting",
  11424. fn: function (){
  11425. var self=this,$self=this;
  11426. return $core.withContext(function($ctx1) {
  11427. return $core.st2js(self);
  11428. return self;
  11429. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{})});
  11430. },
  11431. args: [],
  11432. source: "asJavaScriptMethodName\x0a\x09<inlineJS: 'return $core.st2js(self)'>",
  11433. referencedClasses: [],
  11434. pragmas: [["inlineJS:", ["return $core.st2js(self)"]]],
  11435. messageSends: []
  11436. }),
  11437. $globals.String);
  11438. $core.addMethod(
  11439. $core.method({
  11440. selector: "asJavaScriptObject",
  11441. protocol: "converting",
  11442. fn: function (){
  11443. var self=this,$self=this;
  11444. return self;
  11445. },
  11446. args: [],
  11447. source: "asJavaScriptObject\x0a\x09^ self",
  11448. referencedClasses: [],
  11449. pragmas: [],
  11450. messageSends: []
  11451. }),
  11452. $globals.String);
  11453. $core.addMethod(
  11454. $core.method({
  11455. selector: "asJavaScriptSource",
  11456. protocol: "converting",
  11457. fn: function (){
  11458. var self=this,$self=this;
  11459. return $core.withContext(function($ctx1) {
  11460. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  11461. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  11462. else
  11463. return "\"" + self + "\"";
  11464. ;
  11465. return self;
  11466. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  11467. },
  11468. args: [],
  11469. 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'>",
  11470. referencedClasses: [],
  11471. 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"]]],
  11472. messageSends: []
  11473. }),
  11474. $globals.String);
  11475. $core.addMethod(
  11476. $core.method({
  11477. selector: "asLowercase",
  11478. protocol: "converting",
  11479. fn: function (){
  11480. var self=this,$self=this;
  11481. return $core.withContext(function($ctx1) {
  11482. return self.toLowerCase();
  11483. return self;
  11484. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{})});
  11485. },
  11486. args: [],
  11487. source: "asLowercase\x0a\x09<inlineJS: 'return self.toLowerCase()'>",
  11488. referencedClasses: [],
  11489. pragmas: [["inlineJS:", ["return self.toLowerCase()"]]],
  11490. messageSends: []
  11491. }),
  11492. $globals.String);
  11493. $core.addMethod(
  11494. $core.method({
  11495. selector: "asMutator",
  11496. protocol: "converting",
  11497. fn: function (){
  11498. var self=this,$self=this;
  11499. return $core.withContext(function($ctx1) {
  11500. var $1;
  11501. $1=$recv($self._last()).__eq(":");
  11502. if(!$core.assert($1)){
  11503. return $self.__comma(":");
  11504. }
  11505. return self;
  11506. }, function($ctx1) {$ctx1.fill(self,"asMutator",{})});
  11507. },
  11508. args: [],
  11509. 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",
  11510. referencedClasses: [],
  11511. pragmas: [],
  11512. messageSends: ["ifFalse:", "=", "last", ","]
  11513. }),
  11514. $globals.String);
  11515. $core.addMethod(
  11516. $core.method({
  11517. selector: "asNumber",
  11518. protocol: "converting",
  11519. fn: function (){
  11520. var self=this,$self=this;
  11521. return $core.withContext(function($ctx1) {
  11522. return Number(self);
  11523. return self;
  11524. }, function($ctx1) {$ctx1.fill(self,"asNumber",{})});
  11525. },
  11526. args: [],
  11527. source: "asNumber\x0a\x09<inlineJS: 'return Number(self)'>",
  11528. referencedClasses: [],
  11529. pragmas: [["inlineJS:", ["return Number(self)"]]],
  11530. messageSends: []
  11531. }),
  11532. $globals.String);
  11533. $core.addMethod(
  11534. $core.method({
  11535. selector: "asRegexp",
  11536. protocol: "converting",
  11537. fn: function (){
  11538. var self=this,$self=this;
  11539. return $core.withContext(function($ctx1) {
  11540. return $recv($globals.RegularExpression)._fromString_(self);
  11541. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{})});
  11542. },
  11543. args: [],
  11544. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  11545. referencedClasses: ["RegularExpression"],
  11546. pragmas: [],
  11547. messageSends: ["fromString:"]
  11548. }),
  11549. $globals.String);
  11550. $core.addMethod(
  11551. $core.method({
  11552. selector: "asString",
  11553. protocol: "converting",
  11554. fn: function (){
  11555. var self=this,$self=this;
  11556. return self;
  11557. },
  11558. args: [],
  11559. source: "asString\x0a\x09^ self",
  11560. referencedClasses: [],
  11561. pragmas: [],
  11562. messageSends: []
  11563. }),
  11564. $globals.String);
  11565. $core.addMethod(
  11566. $core.method({
  11567. selector: "asSymbol",
  11568. protocol: "converting",
  11569. fn: function (){
  11570. var self=this,$self=this;
  11571. return self;
  11572. },
  11573. args: [],
  11574. source: "asSymbol\x0a\x09^ self",
  11575. referencedClasses: [],
  11576. pragmas: [],
  11577. messageSends: []
  11578. }),
  11579. $globals.String);
  11580. $core.addMethod(
  11581. $core.method({
  11582. selector: "asSymbolPrintOn:",
  11583. protocol: "printing",
  11584. fn: function (aStream){
  11585. var self=this,$self=this;
  11586. return $core.withContext(function($ctx1) {
  11587. var $1;
  11588. $recv(aStream)._nextPutAll_("#");
  11589. $1=$recv($self._asString())._isSelector();
  11590. if($core.assert($1)){
  11591. $recv(aStream)._nextPut_(self);
  11592. } else {
  11593. $self._printOn_(aStream);
  11594. }
  11595. return self;
  11596. }, function($ctx1) {$ctx1.fill(self,"asSymbolPrintOn:",{aStream:aStream})});
  11597. },
  11598. args: ["aStream"],
  11599. source: "asSymbolPrintOn: aStream\x0a\x09aStream nextPutAll: '#'.\x0a\x09self asString isSelector\x0a\x09\x09ifTrue: [ aStream nextPut: self ]\x0a\x09\x09ifFalse: [ self printOn: aStream ]",
  11600. referencedClasses: [],
  11601. pragmas: [],
  11602. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isSelector", "asString", "nextPut:", "printOn:"]
  11603. }),
  11604. $globals.String);
  11605. $core.addMethod(
  11606. $core.method({
  11607. selector: "asUppercase",
  11608. protocol: "converting",
  11609. fn: function (){
  11610. var self=this,$self=this;
  11611. return $core.withContext(function($ctx1) {
  11612. return self.toUpperCase();
  11613. return self;
  11614. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{})});
  11615. },
  11616. args: [],
  11617. source: "asUppercase\x0a\x09<inlineJS: 'return self.toUpperCase()'>",
  11618. referencedClasses: [],
  11619. pragmas: [["inlineJS:", ["return self.toUpperCase()"]]],
  11620. messageSends: []
  11621. }),
  11622. $globals.String);
  11623. $core.addMethod(
  11624. $core.method({
  11625. selector: "asciiValue",
  11626. protocol: "accessing",
  11627. fn: function (){
  11628. var self=this,$self=this;
  11629. return $core.withContext(function($ctx1) {
  11630. return self.charCodeAt(0);;
  11631. return self;
  11632. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{})});
  11633. },
  11634. args: [],
  11635. source: "asciiValue\x0a\x09<inlineJS: 'return self.charCodeAt(0);'>",
  11636. referencedClasses: [],
  11637. pragmas: [["inlineJS:", ["return self.charCodeAt(0);"]]],
  11638. messageSends: []
  11639. }),
  11640. $globals.String);
  11641. $core.addMethod(
  11642. $core.method({
  11643. selector: "at:ifAbsent:",
  11644. protocol: "accessing",
  11645. fn: function (anIndex,aBlock){
  11646. var self=this,$self=this;
  11647. return $core.withContext(function($ctx1) {
  11648. return String(self)[anIndex - 1] || aBlock._value();
  11649. return self;
  11650. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock})});
  11651. },
  11652. args: ["anIndex", "aBlock"],
  11653. source: "at: anIndex ifAbsent: aBlock\x0a\x09<inlineJS: 'return String(self)[anIndex - 1] || aBlock._value()'>",
  11654. referencedClasses: [],
  11655. pragmas: [["inlineJS:", ["return String(self)[anIndex - 1] || aBlock._value()"]]],
  11656. messageSends: []
  11657. }),
  11658. $globals.String);
  11659. $core.addMethod(
  11660. $core.method({
  11661. selector: "at:ifPresent:ifAbsent:",
  11662. protocol: "accessing",
  11663. fn: function (anIndex,aBlock,anotherBlock){
  11664. var self=this,$self=this;
  11665. return $core.withContext(function($ctx1) {
  11666. var result = String(self)[anIndex - 1];
  11667. return result ? aBlock._value_(result) : anotherBlock._value();
  11668. ;
  11669. return self;
  11670. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock})});
  11671. },
  11672. args: ["anIndex", "aBlock", "anotherBlock"],
  11673. 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'>",
  11674. referencedClasses: [],
  11675. pragmas: [["inlineJS:", ["\x0a\x09\x09var result = String(self)[anIndex - 1];\x0a\x09\x09return result ? aBlock._value_(result) : anotherBlock._value();\x0a\x09"]]],
  11676. messageSends: []
  11677. }),
  11678. $globals.String);
  11679. $core.addMethod(
  11680. $core.method({
  11681. selector: "at:put:",
  11682. protocol: "accessing",
  11683. fn: function (anIndex,anObject){
  11684. var self=this,$self=this;
  11685. return $core.withContext(function($ctx1) {
  11686. $self._errorReadOnly();
  11687. return self;
  11688. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject})});
  11689. },
  11690. args: ["anIndex", "anObject"],
  11691. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  11692. referencedClasses: [],
  11693. pragmas: [],
  11694. messageSends: ["errorReadOnly"]
  11695. }),
  11696. $globals.String);
  11697. $core.addMethod(
  11698. $core.method({
  11699. selector: "capitalized",
  11700. protocol: "converting",
  11701. fn: function (){
  11702. var self=this,$self=this;
  11703. return $core.withContext(function($ctx1) {
  11704. return $self._ifNotEmpty_((function(){
  11705. return $core.withContext(function($ctx2) {
  11706. return $recv($recv($self._first())._asUppercase()).__comma($self._allButFirst());
  11707. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11708. }));
  11709. }, function($ctx1) {$ctx1.fill(self,"capitalized",{})});
  11710. },
  11711. args: [],
  11712. source: "capitalized\x0a\x09^ self ifNotEmpty: [ self first asUppercase, self allButFirst ]",
  11713. referencedClasses: [],
  11714. pragmas: [],
  11715. messageSends: ["ifNotEmpty:", ",", "asUppercase", "first", "allButFirst"]
  11716. }),
  11717. $globals.String);
  11718. $core.addMethod(
  11719. $core.method({
  11720. selector: "charCodeAt:",
  11721. protocol: "accessing",
  11722. fn: function (anInteger){
  11723. var self=this,$self=this;
  11724. return $core.withContext(function($ctx1) {
  11725. return self.charCodeAt(anInteger - 1);
  11726. return self;
  11727. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger})});
  11728. },
  11729. args: ["anInteger"],
  11730. source: "charCodeAt: anInteger\x0a\x09<inlineJS: 'return self.charCodeAt(anInteger - 1)'>",
  11731. referencedClasses: [],
  11732. pragmas: [["inlineJS:", ["return self.charCodeAt(anInteger - 1)"]]],
  11733. messageSends: []
  11734. }),
  11735. $globals.String);
  11736. $core.addMethod(
  11737. $core.method({
  11738. selector: "copyFrom:to:",
  11739. protocol: "copying",
  11740. fn: function (anIndex,anotherIndex){
  11741. var self=this,$self=this;
  11742. return $core.withContext(function($ctx1) {
  11743. return self.substring(anIndex - 1, anotherIndex);
  11744. return self;
  11745. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex})});
  11746. },
  11747. args: ["anIndex", "anotherIndex"],
  11748. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<inlineJS: 'return self.substring(anIndex - 1, anotherIndex)'>",
  11749. referencedClasses: [],
  11750. pragmas: [["inlineJS:", ["return self.substring(anIndex - 1, anotherIndex)"]]],
  11751. messageSends: []
  11752. }),
  11753. $globals.String);
  11754. $core.addMethod(
  11755. $core.method({
  11756. selector: "crlfSanitized",
  11757. protocol: "converting",
  11758. fn: function (){
  11759. var self=this,$self=this;
  11760. return $core.withContext(function($ctx1) {
  11761. return $recv($self._lines())._join_($recv($globals.String)._lf());
  11762. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{})});
  11763. },
  11764. args: [],
  11765. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  11766. referencedClasses: ["String"],
  11767. pragmas: [],
  11768. messageSends: ["join:", "lines", "lf"]
  11769. }),
  11770. $globals.String);
  11771. $core.addMethod(
  11772. $core.method({
  11773. selector: "deepCopy",
  11774. protocol: "copying",
  11775. fn: function (){
  11776. var self=this,$self=this;
  11777. return $core.withContext(function($ctx1) {
  11778. return $self._shallowCopy();
  11779. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{})});
  11780. },
  11781. args: [],
  11782. source: "deepCopy\x0a\x09^ self shallowCopy",
  11783. referencedClasses: [],
  11784. pragmas: [],
  11785. messageSends: ["shallowCopy"]
  11786. }),
  11787. $globals.String);
  11788. $core.addMethod(
  11789. $core.method({
  11790. selector: "errorReadOnly",
  11791. protocol: "error handling",
  11792. fn: function (){
  11793. var self=this,$self=this;
  11794. return $core.withContext(function($ctx1) {
  11795. $self._error_("Object is read-only");
  11796. return self;
  11797. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{})});
  11798. },
  11799. args: [],
  11800. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  11801. referencedClasses: [],
  11802. pragmas: [],
  11803. messageSends: ["error:"]
  11804. }),
  11805. $globals.String);
  11806. $core.addMethod(
  11807. $core.method({
  11808. selector: "escaped",
  11809. protocol: "converting",
  11810. fn: function (){
  11811. var self=this,$self=this;
  11812. return $core.withContext(function($ctx1) {
  11813. return escape(self);
  11814. return self;
  11815. }, function($ctx1) {$ctx1.fill(self,"escaped",{})});
  11816. },
  11817. args: [],
  11818. source: "escaped\x0a\x09<inlineJS: 'return escape(self)'>",
  11819. referencedClasses: [],
  11820. pragmas: [["inlineJS:", ["return escape(self)"]]],
  11821. messageSends: []
  11822. }),
  11823. $globals.String);
  11824. $core.addMethod(
  11825. $core.method({
  11826. selector: "includesSubString:",
  11827. protocol: "testing",
  11828. fn: function (subString){
  11829. var self=this,$self=this;
  11830. return $core.withContext(function($ctx1) {
  11831. return self.indexOf(subString) != -1;
  11832. return self;
  11833. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString})});
  11834. },
  11835. args: ["subString"],
  11836. source: "includesSubString: subString\x0a\x09<inlineJS: 'return self.indexOf(subString) != -1'>",
  11837. referencedClasses: [],
  11838. pragmas: [["inlineJS:", ["return self.indexOf(subString) != -1"]]],
  11839. messageSends: []
  11840. }),
  11841. $globals.String);
  11842. $core.addMethod(
  11843. $core.method({
  11844. selector: "isCapitalized",
  11845. protocol: "testing",
  11846. fn: function (){
  11847. var self=this,$self=this;
  11848. return $core.withContext(function($ctx1) {
  11849. var $2,$1;
  11850. $2=$self._first();
  11851. $ctx1.sendIdx["first"]=1;
  11852. $1=$recv($2)._asUppercase();
  11853. return $recv($1).__eq_eq($self._first());
  11854. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{})});
  11855. },
  11856. args: [],
  11857. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  11858. referencedClasses: [],
  11859. pragmas: [],
  11860. messageSends: ["==", "asUppercase", "first"]
  11861. }),
  11862. $globals.String);
  11863. $core.addMethod(
  11864. $core.method({
  11865. selector: "isImmutable",
  11866. protocol: "testing",
  11867. fn: function (){
  11868. var self=this,$self=this;
  11869. return true;
  11870. },
  11871. args: [],
  11872. source: "isImmutable\x0a\x09^ true",
  11873. referencedClasses: [],
  11874. pragmas: [],
  11875. messageSends: []
  11876. }),
  11877. $globals.String);
  11878. $core.addMethod(
  11879. $core.method({
  11880. selector: "isSelector",
  11881. protocol: "testing",
  11882. fn: function (){
  11883. var self=this,$self=this;
  11884. return $core.withContext(function($ctx1) {
  11885. return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\\+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\:)+)$/);
  11886. return self;
  11887. }, function($ctx1) {$ctx1.fill(self,"isSelector",{})});
  11888. },
  11889. args: [],
  11890. 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>",
  11891. referencedClasses: [],
  11892. pragmas: [["inlineJS:", ["return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\x5c\x5c+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\x5c:)+)$/)"]]],
  11893. messageSends: []
  11894. }),
  11895. $globals.String);
  11896. $core.addMethod(
  11897. $core.method({
  11898. selector: "isString",
  11899. protocol: "testing",
  11900. fn: function (){
  11901. var self=this,$self=this;
  11902. return true;
  11903. },
  11904. args: [],
  11905. source: "isString\x0a\x09^ true",
  11906. referencedClasses: [],
  11907. pragmas: [],
  11908. messageSends: []
  11909. }),
  11910. $globals.String);
  11911. $core.addMethod(
  11912. $core.method({
  11913. selector: "isVowel",
  11914. protocol: "testing",
  11915. fn: function (){
  11916. var self=this,$self=this;
  11917. return $core.withContext(function($ctx1) {
  11918. return $recv($recv($self._size()).__eq((1)))._and_((function(){
  11919. return $core.withContext(function($ctx2) {
  11920. return "aeiou"._includes_($self._asLowercase());
  11921. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11922. }));
  11923. }, function($ctx1) {$ctx1.fill(self,"isVowel",{})});
  11924. },
  11925. args: [],
  11926. 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 ]",
  11927. referencedClasses: [],
  11928. pragmas: [],
  11929. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  11930. }),
  11931. $globals.String);
  11932. $core.addMethod(
  11933. $core.method({
  11934. selector: "join:",
  11935. protocol: "split join",
  11936. fn: function (aCollection){
  11937. var self=this,$self=this;
  11938. return $core.withContext(function($ctx1) {
  11939. return $recv($globals.String)._streamContents_((function(stream){
  11940. return $core.withContext(function($ctx2) {
  11941. return $recv(aCollection)._do_separatedBy_((function(each){
  11942. return $core.withContext(function($ctx3) {
  11943. return $recv(stream)._nextPutAll_($recv(each)._asString());
  11944. $ctx3.sendIdx["nextPutAll:"]=1;
  11945. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  11946. }),(function(){
  11947. return $core.withContext(function($ctx3) {
  11948. return $recv(stream)._nextPutAll_(self);
  11949. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  11950. }));
  11951. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  11952. }));
  11953. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection})});
  11954. },
  11955. args: ["aCollection"],
  11956. 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 ]]",
  11957. referencedClasses: ["String"],
  11958. pragmas: [],
  11959. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  11960. }),
  11961. $globals.String);
  11962. $core.addMethod(
  11963. $core.method({
  11964. selector: "lineIndicesDo:",
  11965. protocol: "split join",
  11966. fn: function (aBlock){
  11967. var self=this,$self=this;
  11968. var cr,lf,start,sz,nextLF,nextCR;
  11969. return $core.withContext(function($ctx1) {
  11970. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  11971. var $early={};
  11972. try {
  11973. start=(1);
  11974. sz=$self._size();
  11975. cr=$recv($globals.String)._cr();
  11976. nextCR=$self._indexOf_startingAt_(cr,(1));
  11977. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  11978. lf=$recv($globals.String)._lf();
  11979. nextLF=$self._indexOf_startingAt_(lf,(1));
  11980. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  11981. $recv((function(){
  11982. return $core.withContext(function($ctx2) {
  11983. return $recv(start).__lt_eq(sz);
  11984. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11985. }))._whileTrue_((function(){
  11986. return $core.withContext(function($ctx2) {
  11987. $2=$recv(nextLF).__eq((0));
  11988. $ctx2.sendIdx["="]=1;
  11989. $1=$recv($2)._and_((function(){
  11990. return $core.withContext(function($ctx3) {
  11991. return $recv(nextCR).__eq((0));
  11992. $ctx3.sendIdx["="]=2;
  11993. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  11994. }));
  11995. $ctx2.sendIdx["and:"]=1;
  11996. if($core.assert($1)){
  11997. $recv(aBlock)._value_value_value_(start,sz,sz);
  11998. $ctx2.sendIdx["value:value:value:"]=1;
  11999. throw $early=[self];
  12000. }
  12001. $4=$recv(nextCR).__eq((0));
  12002. $ctx2.sendIdx["="]=3;
  12003. $3=$recv($4)._or_((function(){
  12004. return $core.withContext(function($ctx3) {
  12005. $5=(0).__lt(nextLF);
  12006. $ctx3.sendIdx["<"]=1;
  12007. return $recv($5)._and_((function(){
  12008. return $core.withContext(function($ctx4) {
  12009. return $recv(nextLF).__lt(nextCR);
  12010. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  12011. }));
  12012. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  12013. }));
  12014. if($core.assert($3)){
  12015. $6=start;
  12016. $7=$recv(nextLF).__minus((1));
  12017. $ctx2.sendIdx["-"]=1;
  12018. $recv(aBlock)._value_value_value_($6,$7,nextLF);
  12019. $ctx2.sendIdx["value:value:value:"]=2;
  12020. start=(1).__plus(nextLF);
  12021. $ctx2.sendIdx["+"]=1;
  12022. nextLF=$self._indexOf_startingAt_(lf,start);
  12023. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  12024. return nextLF;
  12025. } else {
  12026. $9=(1).__plus(nextCR);
  12027. $ctx2.sendIdx["+"]=2;
  12028. $8=$recv($9).__eq(nextLF);
  12029. if($core.assert($8)){
  12030. $10=start;
  12031. $11=$recv(nextCR).__minus((1));
  12032. $ctx2.sendIdx["-"]=2;
  12033. $recv(aBlock)._value_value_value_($10,$11,nextLF);
  12034. $ctx2.sendIdx["value:value:value:"]=3;
  12035. start=(1).__plus(nextLF);
  12036. $ctx2.sendIdx["+"]=3;
  12037. nextCR=$self._indexOf_startingAt_(cr,start);
  12038. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  12039. nextLF=$self._indexOf_startingAt_(lf,start);
  12040. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  12041. return nextLF;
  12042. } else {
  12043. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  12044. start=(1).__plus(nextCR);
  12045. nextCR=$self._indexOf_startingAt_(cr,start);
  12046. return nextCR;
  12047. }
  12048. }
  12049. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12050. }));
  12051. return self;
  12052. }
  12053. catch(e) {if(e===$early)return e[0]; throw e}
  12054. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR})});
  12055. },
  12056. args: ["aBlock"],
  12057. 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 ] ]]",
  12058. referencedClasses: ["String"],
  12059. pragmas: [],
  12060. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  12061. }),
  12062. $globals.String);
  12063. $core.addMethod(
  12064. $core.method({
  12065. selector: "lineNumber:",
  12066. protocol: "split join",
  12067. fn: function (anIndex){
  12068. var self=this,$self=this;
  12069. var lineCount;
  12070. return $core.withContext(function($ctx1) {
  12071. var $2,$1;
  12072. var $early={};
  12073. try {
  12074. lineCount=(0);
  12075. $self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  12076. return $core.withContext(function($ctx2) {
  12077. lineCount=$recv(lineCount).__plus((1));
  12078. $2=lineCount;
  12079. $1=$recv($2).__eq(anIndex);
  12080. if($core.assert($1)){
  12081. throw $early=[$self._copyFrom_to_(start,endWithoutDelimiters)];
  12082. }
  12083. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  12084. }));
  12085. return nil;
  12086. }
  12087. catch(e) {if(e===$early)return e[0]; throw e}
  12088. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount})});
  12089. },
  12090. args: ["anIndex"],
  12091. 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",
  12092. referencedClasses: [],
  12093. pragmas: [],
  12094. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  12095. }),
  12096. $globals.String);
  12097. $core.addMethod(
  12098. $core.method({
  12099. selector: "lines",
  12100. protocol: "split join",
  12101. fn: function (){
  12102. var self=this,$self=this;
  12103. return $core.withContext(function($ctx1) {
  12104. var result = self.split(/\r\n|\r|\n/);
  12105. if (!result[result.length-1]) result.pop();
  12106. return result;;
  12107. return self;
  12108. }, function($ctx1) {$ctx1.fill(self,"lines",{})});
  12109. },
  12110. args: [],
  12111. 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'>",
  12112. referencedClasses: [],
  12113. pragmas: [["inlineJS:", ["\x0a\x09var result = self.split(/\x5cr\x5cn|\x5cr|\x5cn/);\x0a\x09if (!result[result.length-1]) result.pop();\x0a\x09return result;"]]],
  12114. messageSends: []
  12115. }),
  12116. $globals.String);
  12117. $core.addMethod(
  12118. $core.method({
  12119. selector: "linesDo:",
  12120. protocol: "split join",
  12121. fn: function (aBlock){
  12122. var self=this,$self=this;
  12123. return $core.withContext(function($ctx1) {
  12124. $recv($self._lines())._do_(aBlock);
  12125. return self;
  12126. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock})});
  12127. },
  12128. args: ["aBlock"],
  12129. 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",
  12130. referencedClasses: [],
  12131. pragmas: [],
  12132. messageSends: ["do:", "lines"]
  12133. }),
  12134. $globals.String);
  12135. $core.addMethod(
  12136. $core.method({
  12137. selector: "match:",
  12138. protocol: "regular expressions",
  12139. fn: function (aRegexp){
  12140. var self=this,$self=this;
  12141. return $core.withContext(function($ctx1) {
  12142. return self.search(aRegexp) != -1;
  12143. return self;
  12144. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp})});
  12145. },
  12146. args: ["aRegexp"],
  12147. source: "match: aRegexp\x0a\x09<inlineJS: 'return self.search(aRegexp) != -1'>",
  12148. referencedClasses: [],
  12149. pragmas: [["inlineJS:", ["return self.search(aRegexp) != -1"]]],
  12150. messageSends: []
  12151. }),
  12152. $globals.String);
  12153. $core.addMethod(
  12154. $core.method({
  12155. selector: "matchesOf:",
  12156. protocol: "regular expressions",
  12157. fn: function (aRegularExpression){
  12158. var self=this,$self=this;
  12159. return $core.withContext(function($ctx1) {
  12160. return self.match(aRegularExpression);
  12161. return self;
  12162. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression})});
  12163. },
  12164. args: ["aRegularExpression"],
  12165. source: "matchesOf: aRegularExpression\x0a\x09<inlineJS: 'return self.match(aRegularExpression)'>",
  12166. referencedClasses: [],
  12167. pragmas: [["inlineJS:", ["return self.match(aRegularExpression)"]]],
  12168. messageSends: []
  12169. }),
  12170. $globals.String);
  12171. $core.addMethod(
  12172. $core.method({
  12173. selector: "printNl",
  12174. protocol: "printing",
  12175. fn: function (){
  12176. var self=this,$self=this;
  12177. return $core.withContext(function($ctx1) {
  12178. console.log(self);
  12179. return self;
  12180. }, function($ctx1) {$ctx1.fill(self,"printNl",{})});
  12181. },
  12182. args: [],
  12183. source: "printNl\x0a\x09<inlineJS: 'console.log(self)'>",
  12184. referencedClasses: [],
  12185. pragmas: [["inlineJS:", ["console.log(self)"]]],
  12186. messageSends: []
  12187. }),
  12188. $globals.String);
  12189. $core.addMethod(
  12190. $core.method({
  12191. selector: "printOn:",
  12192. protocol: "printing",
  12193. fn: function (aStream){
  12194. var self=this,$self=this;
  12195. return $core.withContext(function($ctx1) {
  12196. $recv(aStream)._nextPutAll_("'");
  12197. $ctx1.sendIdx["nextPutAll:"]=1;
  12198. $recv(aStream)._nextPutAll_($self._replace_with_("'","''"));
  12199. $ctx1.sendIdx["nextPutAll:"]=2;
  12200. $recv(aStream)._nextPutAll_("'");
  12201. return self;
  12202. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  12203. },
  12204. args: ["aStream"],
  12205. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: (self replace: '''' with: '''''');\x0a\x09\x09nextPutAll: ''''",
  12206. referencedClasses: [],
  12207. pragmas: [],
  12208. messageSends: ["nextPutAll:", "replace:with:"]
  12209. }),
  12210. $globals.String);
  12211. $core.addMethod(
  12212. $core.method({
  12213. selector: "putOn:",
  12214. protocol: "streaming",
  12215. fn: function (aStream){
  12216. var self=this,$self=this;
  12217. return $core.withContext(function($ctx1) {
  12218. $recv(aStream)._nextPutString_(self);
  12219. return self;
  12220. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream})});
  12221. },
  12222. args: ["aStream"],
  12223. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  12224. referencedClasses: [],
  12225. pragmas: [],
  12226. messageSends: ["nextPutString:"]
  12227. }),
  12228. $globals.String);
  12229. $core.addMethod(
  12230. $core.method({
  12231. selector: "remove:",
  12232. protocol: "adding/removing",
  12233. fn: function (anObject){
  12234. var self=this,$self=this;
  12235. return $core.withContext(function($ctx1) {
  12236. $self._errorReadOnly();
  12237. return self;
  12238. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject})});
  12239. },
  12240. args: ["anObject"],
  12241. source: "remove: anObject\x0a\x09self errorReadOnly",
  12242. referencedClasses: [],
  12243. pragmas: [],
  12244. messageSends: ["errorReadOnly"]
  12245. }),
  12246. $globals.String);
  12247. $core.addMethod(
  12248. $core.method({
  12249. selector: "remove:ifAbsent:",
  12250. protocol: "adding/removing",
  12251. fn: function (anObject,aBlock){
  12252. var self=this,$self=this;
  12253. return $core.withContext(function($ctx1) {
  12254. $self._errorReadOnly();
  12255. return self;
  12256. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  12257. },
  12258. args: ["anObject", "aBlock"],
  12259. source: "remove: anObject ifAbsent: aBlock\x0a\x09self errorReadOnly",
  12260. referencedClasses: [],
  12261. pragmas: [],
  12262. messageSends: ["errorReadOnly"]
  12263. }),
  12264. $globals.String);
  12265. $core.addMethod(
  12266. $core.method({
  12267. selector: "replace:with:",
  12268. protocol: "regular expressions",
  12269. fn: function (aString,anotherString){
  12270. var self=this,$self=this;
  12271. return $core.withContext(function($ctx1) {
  12272. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_(aString,"g"),anotherString);
  12273. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString})});
  12274. },
  12275. args: ["aString", "anotherString"],
  12276. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  12277. referencedClasses: ["RegularExpression"],
  12278. pragmas: [],
  12279. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  12280. }),
  12281. $globals.String);
  12282. $core.addMethod(
  12283. $core.method({
  12284. selector: "replaceRegexp:with:",
  12285. protocol: "regular expressions",
  12286. fn: function (aRegexp,aString){
  12287. var self=this,$self=this;
  12288. return $core.withContext(function($ctx1) {
  12289. return self.replace(aRegexp, aString);
  12290. return self;
  12291. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString})});
  12292. },
  12293. args: ["aRegexp", "aString"],
  12294. source: "replaceRegexp: aRegexp with: aString\x0a\x09<inlineJS: 'return self.replace(aRegexp, aString)'>",
  12295. referencedClasses: [],
  12296. pragmas: [["inlineJS:", ["return self.replace(aRegexp, aString)"]]],
  12297. messageSends: []
  12298. }),
  12299. $globals.String);
  12300. $core.addMethod(
  12301. $core.method({
  12302. selector: "reversed",
  12303. protocol: "converting",
  12304. fn: function (){
  12305. var self=this,$self=this;
  12306. return $core.withContext(function($ctx1) {
  12307. return self.split("").reverse().join("");
  12308. return self;
  12309. }, function($ctx1) {$ctx1.fill(self,"reversed",{})});
  12310. },
  12311. args: [],
  12312. source: "reversed\x0a\x09<inlineJS: 'return self.split(\x22\x22).reverse().join(\x22\x22)'>",
  12313. referencedClasses: [],
  12314. pragmas: [["inlineJS:", ["return self.split(\x22\x22).reverse().join(\x22\x22)"]]],
  12315. messageSends: []
  12316. }),
  12317. $globals.String);
  12318. $core.addMethod(
  12319. $core.method({
  12320. selector: "shallowCopy",
  12321. protocol: "copying",
  12322. fn: function (){
  12323. var self=this,$self=this;
  12324. return self;
  12325. },
  12326. args: [],
  12327. source: "shallowCopy\x0a\x09^ self",
  12328. referencedClasses: [],
  12329. pragmas: [],
  12330. messageSends: []
  12331. }),
  12332. $globals.String);
  12333. $core.addMethod(
  12334. $core.method({
  12335. selector: "subStrings:",
  12336. protocol: "split join",
  12337. fn: function (aString){
  12338. var self=this,$self=this;
  12339. return $core.withContext(function($ctx1) {
  12340. return $self._tokenize_(aString);
  12341. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString})});
  12342. },
  12343. args: ["aString"],
  12344. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  12345. referencedClasses: [],
  12346. pragmas: [],
  12347. messageSends: ["tokenize:"]
  12348. }),
  12349. $globals.String);
  12350. $core.addMethod(
  12351. $core.method({
  12352. selector: "symbolPrintString",
  12353. protocol: "printing",
  12354. fn: function (){
  12355. var self=this,$self=this;
  12356. return $core.withContext(function($ctx1) {
  12357. return $recv($globals.String)._streamContents_((function(str){
  12358. return $core.withContext(function($ctx2) {
  12359. return $self._asSymbolPrintOn_(str);
  12360. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  12361. }));
  12362. }, function($ctx1) {$ctx1.fill(self,"symbolPrintString",{})});
  12363. },
  12364. args: [],
  12365. source: "symbolPrintString\x0a\x09^ String streamContents: [ :str | self asSymbolPrintOn: str ]",
  12366. referencedClasses: ["String"],
  12367. pragmas: [],
  12368. messageSends: ["streamContents:", "asSymbolPrintOn:"]
  12369. }),
  12370. $globals.String);
  12371. $core.addMethod(
  12372. $core.method({
  12373. selector: "tokenize:",
  12374. protocol: "split join",
  12375. fn: function (aString){
  12376. var self=this,$self=this;
  12377. return $core.withContext(function($ctx1) {
  12378. return self.split(aString);
  12379. return self;
  12380. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString})});
  12381. },
  12382. args: ["aString"],
  12383. source: "tokenize: aString\x0a\x09<inlineJS: 'return self.split(aString)'>",
  12384. referencedClasses: [],
  12385. pragmas: [["inlineJS:", ["return self.split(aString)"]]],
  12386. messageSends: []
  12387. }),
  12388. $globals.String);
  12389. $core.addMethod(
  12390. $core.method({
  12391. selector: "trimBoth",
  12392. protocol: "regular expressions",
  12393. fn: function (){
  12394. var self=this,$self=this;
  12395. return $core.withContext(function($ctx1) {
  12396. return $self._trimBoth_("\x5cs");
  12397. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{})});
  12398. },
  12399. args: [],
  12400. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  12401. referencedClasses: [],
  12402. pragmas: [],
  12403. messageSends: ["trimBoth:"]
  12404. }),
  12405. $globals.String);
  12406. $core.addMethod(
  12407. $core.method({
  12408. selector: "trimBoth:",
  12409. protocol: "regular expressions",
  12410. fn: function (separators){
  12411. var self=this,$self=this;
  12412. return $core.withContext(function($ctx1) {
  12413. return $recv($self._trimLeft_(separators))._trimRight_(separators);
  12414. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators})});
  12415. },
  12416. args: ["separators"],
  12417. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  12418. referencedClasses: [],
  12419. pragmas: [],
  12420. messageSends: ["trimRight:", "trimLeft:"]
  12421. }),
  12422. $globals.String);
  12423. $core.addMethod(
  12424. $core.method({
  12425. selector: "trimLeft",
  12426. protocol: "regular expressions",
  12427. fn: function (){
  12428. var self=this,$self=this;
  12429. return $core.withContext(function($ctx1) {
  12430. return $self._trimLeft_("\x5cs");
  12431. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{})});
  12432. },
  12433. args: [],
  12434. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  12435. referencedClasses: [],
  12436. pragmas: [],
  12437. messageSends: ["trimLeft:"]
  12438. }),
  12439. $globals.String);
  12440. $core.addMethod(
  12441. $core.method({
  12442. selector: "trimLeft:",
  12443. protocol: "regular expressions",
  12444. fn: function (separators){
  12445. var self=this,$self=this;
  12446. return $core.withContext(function($ctx1) {
  12447. var $2,$1;
  12448. $2=$recv("^[".__comma(separators)).__comma("]+");
  12449. $ctx1.sendIdx[","]=1;
  12450. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  12451. return $self._replaceRegexp_with_($1,"");
  12452. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators})});
  12453. },
  12454. args: ["separators"],
  12455. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  12456. referencedClasses: ["RegularExpression"],
  12457. pragmas: [],
  12458. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  12459. }),
  12460. $globals.String);
  12461. $core.addMethod(
  12462. $core.method({
  12463. selector: "trimRight",
  12464. protocol: "regular expressions",
  12465. fn: function (){
  12466. var self=this,$self=this;
  12467. return $core.withContext(function($ctx1) {
  12468. return $self._trimRight_("\x5cs");
  12469. }, function($ctx1) {$ctx1.fill(self,"trimRight",{})});
  12470. },
  12471. args: [],
  12472. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  12473. referencedClasses: [],
  12474. pragmas: [],
  12475. messageSends: ["trimRight:"]
  12476. }),
  12477. $globals.String);
  12478. $core.addMethod(
  12479. $core.method({
  12480. selector: "trimRight:",
  12481. protocol: "regular expressions",
  12482. fn: function (separators){
  12483. var self=this,$self=this;
  12484. return $core.withContext(function($ctx1) {
  12485. var $2,$1;
  12486. $2=$recv("[".__comma(separators)).__comma("]+$");
  12487. $ctx1.sendIdx[","]=1;
  12488. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  12489. return $self._replaceRegexp_with_($1,"");
  12490. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators})});
  12491. },
  12492. args: ["separators"],
  12493. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  12494. referencedClasses: ["RegularExpression"],
  12495. pragmas: [],
  12496. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  12497. }),
  12498. $globals.String);
  12499. $core.addMethod(
  12500. $core.method({
  12501. selector: "unescaped",
  12502. protocol: "converting",
  12503. fn: function (){
  12504. var self=this,$self=this;
  12505. return $core.withContext(function($ctx1) {
  12506. return unescape(self);
  12507. return self;
  12508. }, function($ctx1) {$ctx1.fill(self,"unescaped",{})});
  12509. },
  12510. args: [],
  12511. source: "unescaped\x0a\x09<inlineJS: 'return unescape(self)'>",
  12512. referencedClasses: [],
  12513. pragmas: [["inlineJS:", ["return unescape(self)"]]],
  12514. messageSends: []
  12515. }),
  12516. $globals.String);
  12517. $core.addMethod(
  12518. $core.method({
  12519. selector: "uriComponentDecoded",
  12520. protocol: "converting",
  12521. fn: function (){
  12522. var self=this,$self=this;
  12523. return $core.withContext(function($ctx1) {
  12524. return decodeURIComponent(self);
  12525. return self;
  12526. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{})});
  12527. },
  12528. args: [],
  12529. source: "uriComponentDecoded\x0a\x09<inlineJS: 'return decodeURIComponent(self)'>",
  12530. referencedClasses: [],
  12531. pragmas: [["inlineJS:", ["return decodeURIComponent(self)"]]],
  12532. messageSends: []
  12533. }),
  12534. $globals.String);
  12535. $core.addMethod(
  12536. $core.method({
  12537. selector: "uriComponentEncoded",
  12538. protocol: "converting",
  12539. fn: function (){
  12540. var self=this,$self=this;
  12541. return $core.withContext(function($ctx1) {
  12542. return encodeURIComponent(self);
  12543. return self;
  12544. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{})});
  12545. },
  12546. args: [],
  12547. source: "uriComponentEncoded\x0a\x09<inlineJS: 'return encodeURIComponent(self)'>",
  12548. referencedClasses: [],
  12549. pragmas: [["inlineJS:", ["return encodeURIComponent(self)"]]],
  12550. messageSends: []
  12551. }),
  12552. $globals.String);
  12553. $core.addMethod(
  12554. $core.method({
  12555. selector: "uriDecoded",
  12556. protocol: "converting",
  12557. fn: function (){
  12558. var self=this,$self=this;
  12559. return $core.withContext(function($ctx1) {
  12560. return decodeURI(self);
  12561. return self;
  12562. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{})});
  12563. },
  12564. args: [],
  12565. source: "uriDecoded\x0a\x09<inlineJS: 'return decodeURI(self)'>",
  12566. referencedClasses: [],
  12567. pragmas: [["inlineJS:", ["return decodeURI(self)"]]],
  12568. messageSends: []
  12569. }),
  12570. $globals.String);
  12571. $core.addMethod(
  12572. $core.method({
  12573. selector: "uriEncoded",
  12574. protocol: "converting",
  12575. fn: function (){
  12576. var self=this,$self=this;
  12577. return $core.withContext(function($ctx1) {
  12578. return encodeURI(self);
  12579. return self;
  12580. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{})});
  12581. },
  12582. args: [],
  12583. source: "uriEncoded\x0a\x09<inlineJS: 'return encodeURI(self)'>",
  12584. referencedClasses: [],
  12585. pragmas: [["inlineJS:", ["return encodeURI(self)"]]],
  12586. messageSends: []
  12587. }),
  12588. $globals.String);
  12589. $core.addMethod(
  12590. $core.method({
  12591. selector: "value:",
  12592. protocol: "evaluating",
  12593. fn: function (anObject){
  12594. var self=this,$self=this;
  12595. return $core.withContext(function($ctx1) {
  12596. return $recv(anObject)._perform_(self);
  12597. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject})});
  12598. },
  12599. args: ["anObject"],
  12600. source: "value: anObject \x0a\x09^ anObject perform: self",
  12601. referencedClasses: [],
  12602. pragmas: [],
  12603. messageSends: ["perform:"]
  12604. }),
  12605. $globals.String);
  12606. $core.addMethod(
  12607. $core.method({
  12608. selector: "cr",
  12609. protocol: "accessing",
  12610. fn: function (){
  12611. var self=this,$self=this;
  12612. return $core.withContext(function($ctx1) {
  12613. return "\r";
  12614. return self;
  12615. }, function($ctx1) {$ctx1.fill(self,"cr",{})});
  12616. },
  12617. args: [],
  12618. source: "cr\x0a\x09<inlineJS: 'return \x22\x5cr\x22'>",
  12619. referencedClasses: [],
  12620. pragmas: [["inlineJS:", ["return \x22\x5cr\x22"]]],
  12621. messageSends: []
  12622. }),
  12623. $globals.String.a$cls);
  12624. $core.addMethod(
  12625. $core.method({
  12626. selector: "crlf",
  12627. protocol: "accessing",
  12628. fn: function (){
  12629. var self=this,$self=this;
  12630. return $core.withContext(function($ctx1) {
  12631. return "\r\n";
  12632. return self;
  12633. }, function($ctx1) {$ctx1.fill(self,"crlf",{})});
  12634. },
  12635. args: [],
  12636. source: "crlf\x0a\x09<inlineJS: 'return \x22\x5cr\x5cn\x22'>",
  12637. referencedClasses: [],
  12638. pragmas: [["inlineJS:", ["return \x22\x5cr\x5cn\x22"]]],
  12639. messageSends: []
  12640. }),
  12641. $globals.String.a$cls);
  12642. $core.addMethod(
  12643. $core.method({
  12644. selector: "esc",
  12645. protocol: "accessing",
  12646. fn: function (){
  12647. var self=this,$self=this;
  12648. return $core.withContext(function($ctx1) {
  12649. return $self._fromCharCode_((27));
  12650. }, function($ctx1) {$ctx1.fill(self,"esc",{})});
  12651. },
  12652. args: [],
  12653. source: "esc\x0a\x09^ self fromCharCode: 27",
  12654. referencedClasses: [],
  12655. pragmas: [],
  12656. messageSends: ["fromCharCode:"]
  12657. }),
  12658. $globals.String.a$cls);
  12659. $core.addMethod(
  12660. $core.method({
  12661. selector: "fromCharCode:",
  12662. protocol: "instance creation",
  12663. fn: function (anInteger){
  12664. var self=this,$self=this;
  12665. return $core.withContext(function($ctx1) {
  12666. return String.fromCharCode(anInteger);
  12667. return self;
  12668. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger})});
  12669. },
  12670. args: ["anInteger"],
  12671. source: "fromCharCode: anInteger\x0a\x09<inlineJS: 'return String.fromCharCode(anInteger)'>",
  12672. referencedClasses: [],
  12673. pragmas: [["inlineJS:", ["return String.fromCharCode(anInteger)"]]],
  12674. messageSends: []
  12675. }),
  12676. $globals.String.a$cls);
  12677. $core.addMethod(
  12678. $core.method({
  12679. selector: "fromString:",
  12680. protocol: "instance creation",
  12681. fn: function (aString){
  12682. var self=this,$self=this;
  12683. return $core.withContext(function($ctx1) {
  12684. return String(aString);
  12685. return self;
  12686. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString})});
  12687. },
  12688. args: ["aString"],
  12689. source: "fromString: aString\x0a\x09\x09<inlineJS: 'return String(aString)'>",
  12690. referencedClasses: [],
  12691. pragmas: [["inlineJS:", ["return String(aString)"]]],
  12692. messageSends: []
  12693. }),
  12694. $globals.String.a$cls);
  12695. $core.addMethod(
  12696. $core.method({
  12697. selector: "lf",
  12698. protocol: "accessing",
  12699. fn: function (){
  12700. var self=this,$self=this;
  12701. return $core.withContext(function($ctx1) {
  12702. return "\n";
  12703. return self;
  12704. }, function($ctx1) {$ctx1.fill(self,"lf",{})});
  12705. },
  12706. args: [],
  12707. source: "lf\x0a\x09<inlineJS: 'return \x22\x5cn\x22'>",
  12708. referencedClasses: [],
  12709. pragmas: [["inlineJS:", ["return \x22\x5cn\x22"]]],
  12710. messageSends: []
  12711. }),
  12712. $globals.String.a$cls);
  12713. $core.addMethod(
  12714. $core.method({
  12715. selector: "random",
  12716. protocol: "random",
  12717. fn: function (){
  12718. var self=this,$self=this;
  12719. return $core.withContext(function($ctx1) {
  12720. return ((10+22*Math.random())/32).toString(32).slice(2);;
  12721. return self;
  12722. }, function($ctx1) {$ctx1.fill(self,"random",{})});
  12723. },
  12724. args: [],
  12725. 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);'>",
  12726. referencedClasses: [],
  12727. pragmas: [["inlineJS:", ["return ((10+22*Math.random())/32).toString(32).slice(2);"]]],
  12728. messageSends: []
  12729. }),
  12730. $globals.String.a$cls);
  12731. $core.addMethod(
  12732. $core.method({
  12733. selector: "randomNotIn:",
  12734. protocol: "random",
  12735. fn: function (aString){
  12736. var self=this,$self=this;
  12737. var result;
  12738. return $core.withContext(function($ctx1) {
  12739. $recv((function(){
  12740. return $core.withContext(function($ctx2) {
  12741. result=$self._random();
  12742. return $recv(aString)._includesSubString_(result);
  12743. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12744. }))._whileTrue();
  12745. return result;
  12746. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result})});
  12747. },
  12748. args: ["aString"],
  12749. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  12750. referencedClasses: [],
  12751. pragmas: [],
  12752. messageSends: ["whileTrue", "random", "includesSubString:"]
  12753. }),
  12754. $globals.String.a$cls);
  12755. $core.addMethod(
  12756. $core.method({
  12757. selector: "space",
  12758. protocol: "accessing",
  12759. fn: function (){
  12760. var self=this,$self=this;
  12761. return $core.withContext(function($ctx1) {
  12762. return " ";
  12763. return self;
  12764. }, function($ctx1) {$ctx1.fill(self,"space",{})});
  12765. },
  12766. args: [],
  12767. source: "space\x0a\x09<inlineJS: 'return \x22 \x22'>",
  12768. referencedClasses: [],
  12769. pragmas: [["inlineJS:", ["return \x22 \x22"]]],
  12770. messageSends: []
  12771. }),
  12772. $globals.String.a$cls);
  12773. $core.addMethod(
  12774. $core.method({
  12775. selector: "streamClass",
  12776. protocol: "accessing",
  12777. fn: function (){
  12778. var self=this,$self=this;
  12779. return $globals.StringStream;
  12780. },
  12781. args: [],
  12782. source: "streamClass\x0a\x09\x09^ StringStream",
  12783. referencedClasses: ["StringStream"],
  12784. pragmas: [],
  12785. messageSends: []
  12786. }),
  12787. $globals.String.a$cls);
  12788. $core.addMethod(
  12789. $core.method({
  12790. selector: "tab",
  12791. protocol: "accessing",
  12792. fn: function (){
  12793. var self=this,$self=this;
  12794. return $core.withContext(function($ctx1) {
  12795. return "\t";
  12796. return self;
  12797. }, function($ctx1) {$ctx1.fill(self,"tab",{})});
  12798. },
  12799. args: [],
  12800. source: "tab\x0a\x09<inlineJS: 'return \x22\x5ct\x22'>",
  12801. referencedClasses: [],
  12802. pragmas: [["inlineJS:", ["return \x22\x5ct\x22"]]],
  12803. messageSends: []
  12804. }),
  12805. $globals.String.a$cls);
  12806. $core.addMethod(
  12807. $core.method({
  12808. selector: "value:",
  12809. protocol: "instance creation",
  12810. fn: function (aUTFCharCode){
  12811. var self=this,$self=this;
  12812. return $core.withContext(function($ctx1) {
  12813. return String.fromCharCode(aUTFCharCode);;
  12814. return self;
  12815. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode})});
  12816. },
  12817. args: ["aUTFCharCode"],
  12818. source: "value: aUTFCharCode\x0a\x0a\x09<inlineJS: 'return String.fromCharCode(aUTFCharCode);'>",
  12819. referencedClasses: [],
  12820. pragmas: [["inlineJS:", ["return String.fromCharCode(aUTFCharCode);"]]],
  12821. messageSends: []
  12822. }),
  12823. $globals.String.a$cls);
  12824. $core.addClass("Set", $globals.Collection, ["defaultBucket", "slowBucketStores", "fastBuckets", "size"], "Kernel-Collections");
  12825. $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`.";
  12826. $core.addMethod(
  12827. $core.method({
  12828. selector: "=",
  12829. protocol: "comparing",
  12830. fn: function (aCollection){
  12831. var self=this,$self=this;
  12832. return $core.withContext(function($ctx1) {
  12833. var $2,$1,$4,$3,$5;
  12834. var $early={};
  12835. try {
  12836. $2=$self._class();
  12837. $ctx1.sendIdx["class"]=1;
  12838. $1=$recv($2).__eq($recv(aCollection)._class());
  12839. $ctx1.sendIdx["="]=1;
  12840. if(!$core.assert($1)){
  12841. return false;
  12842. }
  12843. $4=$self._size();
  12844. $ctx1.sendIdx["size"]=1;
  12845. $3=$recv($4).__eq($recv(aCollection)._size());
  12846. if(!$core.assert($3)){
  12847. return false;
  12848. }
  12849. $self._do_((function(each){
  12850. return $core.withContext(function($ctx2) {
  12851. $5=$recv(aCollection)._includes_(each);
  12852. if(!$core.assert($5)){
  12853. throw $early=[false];
  12854. }
  12855. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  12856. }));
  12857. return true;
  12858. }
  12859. catch(e) {if(e===$early)return e[0]; throw e}
  12860. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection})});
  12861. },
  12862. args: ["aCollection"],
  12863. 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",
  12864. referencedClasses: [],
  12865. pragmas: [],
  12866. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  12867. }),
  12868. $globals.Set);
  12869. $core.addMethod(
  12870. $core.method({
  12871. selector: "add:",
  12872. protocol: "adding/removing",
  12873. fn: function (anObject){
  12874. var self=this,$self=this;
  12875. var bucket;
  12876. return $core.withContext(function($ctx1) {
  12877. var $1,$receiver;
  12878. bucket=$self._bucketsOfElement_(anObject);
  12879. $1=$recv(bucket)._second();
  12880. if(($receiver = $1) == null || $receiver.a$nil){
  12881. var object,slowBucket;
  12882. object=$recv(bucket)._first();
  12883. $ctx1.sendIdx["first"]=1;
  12884. slowBucket=$recv(bucket)._third();
  12885. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  12886. return $core.withContext(function($ctx2) {
  12887. $recv(slowBucket)._add_(object);
  12888. $self.size=$recv($self.size).__plus((1));
  12889. return $self.size;
  12890. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12891. }));
  12892. return object;
  12893. } else {
  12894. var primitiveBucket;
  12895. primitiveBucket=$receiver;
  12896. return $self._add_in_($recv(bucket)._first(),primitiveBucket);
  12897. }
  12898. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket})});
  12899. },
  12900. args: ["anObject"],
  12901. 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 ]",
  12902. referencedClasses: [],
  12903. pragmas: [],
  12904. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  12905. }),
  12906. $globals.Set);
  12907. $core.addMethod(
  12908. $core.method({
  12909. selector: "add:in:",
  12910. protocol: "private",
  12911. fn: function (anObject,anotherObject){
  12912. var self=this,$self=this;
  12913. return $core.withContext(function($ctx1) {
  12914. if (anObject in anotherObject.store) { return anObject; }
  12915. $self.size++;
  12916. anotherObject.store[anObject] = true;
  12917. return anObject;
  12918. ;
  12919. return self;
  12920. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject})});
  12921. },
  12922. args: ["anObject", "anotherObject"],
  12923. 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'>",
  12924. referencedClasses: [],
  12925. 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"]]],
  12926. messageSends: []
  12927. }),
  12928. $globals.Set);
  12929. $core.addMethod(
  12930. $core.method({
  12931. selector: "bucketsOfElement:",
  12932. protocol: "private",
  12933. fn: function (anObject){
  12934. var self=this,$self=this;
  12935. return $core.withContext(function($ctx1) {
  12936. // include nil to well-known objects under "boolean" fastBucket
  12937. if (anObject == null || anObject.a$nil) return [ null, $self.fastBuckets.boolean ];
  12938. var prim = anObject.valueOf();
  12939. if (typeof prim === "object" || typeof prim === "function" || !$self.fastBuckets[typeof prim]) {
  12940. var bucket = null;
  12941. $self.slowBucketStores.some(function (store) {
  12942. return bucket = store._bucketOfElement_(anObject);
  12943. });
  12944. return [ anObject, null, bucket || $self.defaultBucket ];
  12945. }
  12946. return [ prim, $self.fastBuckets[typeof prim] ];
  12947. ;
  12948. return self;
  12949. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject})});
  12950. },
  12951. args: ["anObject"],
  12952. 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'>",
  12953. referencedClasses: [],
  12954. 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"]]],
  12955. messageSends: []
  12956. }),
  12957. $globals.Set);
  12958. $core.addMethod(
  12959. $core.method({
  12960. selector: "classNameOf:",
  12961. protocol: "private",
  12962. fn: function (anObject){
  12963. var self=this,$self=this;
  12964. return $core.withContext(function($ctx1) {
  12965. return anObject.a$cls != null && anObject.a$cls.name;
  12966. return self;
  12967. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject})});
  12968. },
  12969. args: ["anObject"],
  12970. 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'>",
  12971. referencedClasses: [],
  12972. pragmas: [["inlineJS:", ["return anObject.a$cls != null && anObject.a$cls.name"]]],
  12973. messageSends: []
  12974. }),
  12975. $globals.Set);
  12976. $core.addMethod(
  12977. $core.method({
  12978. selector: "collect:",
  12979. protocol: "enumerating",
  12980. fn: function (aBlock){
  12981. var self=this,$self=this;
  12982. var collection;
  12983. return $core.withContext(function($ctx1) {
  12984. collection=$recv($self._class())._new();
  12985. $self._do_((function(each){
  12986. return $core.withContext(function($ctx2) {
  12987. return $recv(collection)._add_($recv(aBlock)._value_(each));
  12988. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12989. }));
  12990. return collection;
  12991. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection})});
  12992. },
  12993. args: ["aBlock"],
  12994. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  12995. referencedClasses: [],
  12996. pragmas: [],
  12997. messageSends: ["new", "class", "do:", "add:", "value:"]
  12998. }),
  12999. $globals.Set);
  13000. $core.addMethod(
  13001. $core.method({
  13002. selector: "do:",
  13003. protocol: "enumerating",
  13004. fn: function (aBlock){
  13005. var self=this,$self=this;
  13006. return $core.withContext(function($ctx1) {
  13007. var el, keys, i;
  13008. el = $self.fastBuckets;
  13009. keys = Object.keys(el);
  13010. for (i = 0; i < keys.length; ++i) {
  13011. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  13012. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  13013. else { store._do_(aBlock); }
  13014. }
  13015. el = $self.slowBucketStores;
  13016. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  13017. $self.defaultBucket._do_(aBlock);
  13018. ;
  13019. return self;
  13020. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  13021. },
  13022. args: ["aBlock"],
  13023. 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'>",
  13024. referencedClasses: [],
  13025. 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"]]],
  13026. messageSends: []
  13027. }),
  13028. $globals.Set);
  13029. $core.addMethod(
  13030. $core.method({
  13031. selector: "includes:",
  13032. protocol: "testing",
  13033. fn: function (anObject){
  13034. var self=this,$self=this;
  13035. var bucket;
  13036. return $core.withContext(function($ctx1) {
  13037. var $1,$2,$3,$receiver;
  13038. bucket=$self._bucketsOfElement_(anObject);
  13039. $1=$recv(bucket)._second();
  13040. if(($receiver = $1) == null || $receiver.a$nil){
  13041. $2=$recv(bucket)._third();
  13042. $3=$recv(bucket)._first();
  13043. $ctx1.sendIdx["first"]=1;
  13044. return $recv($2)._includes_($3);
  13045. } else {
  13046. var primitiveBucket;
  13047. primitiveBucket=$receiver;
  13048. return $self._includes_in_($recv(bucket)._first(),primitiveBucket);
  13049. }
  13050. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket})});
  13051. },
  13052. args: ["anObject"],
  13053. 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 ]",
  13054. referencedClasses: [],
  13055. pragmas: [],
  13056. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  13057. }),
  13058. $globals.Set);
  13059. $core.addMethod(
  13060. $core.method({
  13061. selector: "includes:in:",
  13062. protocol: "private",
  13063. fn: function (anObject,anotherObject){
  13064. var self=this,$self=this;
  13065. return $core.withContext(function($ctx1) {
  13066. return anObject in anotherObject.store;
  13067. return self;
  13068. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject})});
  13069. },
  13070. args: ["anObject", "anotherObject"],
  13071. source: "includes: anObject in: anotherObject\x0a\x09<inlineJS: 'return anObject in anotherObject.store'>",
  13072. referencedClasses: [],
  13073. pragmas: [["inlineJS:", ["return anObject in anotherObject.store"]]],
  13074. messageSends: []
  13075. }),
  13076. $globals.Set);
  13077. $core.addMethod(
  13078. $core.method({
  13079. selector: "initialize",
  13080. protocol: "initialization",
  13081. fn: function (){
  13082. var self=this,$self=this;
  13083. return $core.withContext(function($ctx1) {
  13084. (
  13085. $ctx1.supercall = true,
  13086. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  13087. $ctx1.supercall = false;
  13088. $self.defaultBucket=[];
  13089. $self._initializeSlowBucketStores();
  13090. $self._removeAll();
  13091. return self;
  13092. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  13093. },
  13094. args: [],
  13095. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  13096. referencedClasses: [],
  13097. pragmas: [],
  13098. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  13099. }),
  13100. $globals.Set);
  13101. $core.addMethod(
  13102. $core.method({
  13103. selector: "initializeSlowBucketStores",
  13104. protocol: "initialization",
  13105. fn: function (){
  13106. var self=this,$self=this;
  13107. return $core.withContext(function($ctx1) {
  13108. var $1;
  13109. $1=$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  13110. return $core.withContext(function($ctx2) {
  13111. return $self._classNameOf_(x);
  13112. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  13113. }));
  13114. $ctx1.sendIdx["hashBlock:"]=1;
  13115. $self.slowBucketStores=[$1,$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  13116. return $core.withContext(function($ctx2) {
  13117. return $self._jsConstructorNameOf_(x);
  13118. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  13119. }))];
  13120. return self;
  13121. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{})});
  13122. },
  13123. args: [],
  13124. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  13125. referencedClasses: ["ArrayBucketStore"],
  13126. pragmas: [],
  13127. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  13128. }),
  13129. $globals.Set);
  13130. $core.addMethod(
  13131. $core.method({
  13132. selector: "jsConstructorNameOf:",
  13133. protocol: "private",
  13134. fn: function (anObject){
  13135. var self=this,$self=this;
  13136. return $core.withContext(function($ctx1) {
  13137. return anObject.constructor && anObject.constructor.name;
  13138. return self;
  13139. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject})});
  13140. },
  13141. args: ["anObject"],
  13142. source: "jsConstructorNameOf: anObject\x0a\x09<inlineJS: 'return anObject.constructor && anObject.constructor.name'>",
  13143. referencedClasses: [],
  13144. pragmas: [["inlineJS:", ["return anObject.constructor && anObject.constructor.name"]]],
  13145. messageSends: []
  13146. }),
  13147. $globals.Set);
  13148. $core.addMethod(
  13149. $core.method({
  13150. selector: "printOn:",
  13151. protocol: "printing",
  13152. fn: function (aStream){
  13153. var self=this,$self=this;
  13154. return $core.withContext(function($ctx1) {
  13155. (
  13156. $ctx1.supercall = true,
  13157. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  13158. $ctx1.supercall = false;
  13159. $ctx1.sendIdx["printOn:"]=1;
  13160. $recv(aStream)._nextPutAll_(" (");
  13161. $ctx1.sendIdx["nextPutAll:"]=1;
  13162. $self._do_separatedBy_((function(each){
  13163. return $core.withContext(function($ctx2) {
  13164. return $recv(each)._printOn_(aStream);
  13165. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13166. }),(function(){
  13167. return $core.withContext(function($ctx2) {
  13168. return $recv(aStream)._nextPutAll_(" ");
  13169. $ctx2.sendIdx["nextPutAll:"]=2;
  13170. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  13171. }));
  13172. $recv(aStream)._nextPutAll_(")");
  13173. return self;
  13174. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  13175. },
  13176. args: ["aStream"],
  13177. 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: ')'",
  13178. referencedClasses: [],
  13179. pragmas: [],
  13180. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  13181. }),
  13182. $globals.Set);
  13183. $core.addMethod(
  13184. $core.method({
  13185. selector: "remove:ifAbsent:",
  13186. protocol: "adding/removing",
  13187. fn: function (anObject,aBlock){
  13188. var self=this,$self=this;
  13189. var bucket;
  13190. return $core.withContext(function($ctx1) {
  13191. var $1,$2,$3,$receiver;
  13192. var $early={};
  13193. try {
  13194. bucket=$self._bucketsOfElement_(anObject);
  13195. $1=$recv(bucket)._second();
  13196. if(($receiver = $1) == null || $receiver.a$nil){
  13197. $2=$recv(bucket)._third();
  13198. $3=$recv(bucket)._first();
  13199. $ctx1.sendIdx["first"]=1;
  13200. $recv($2)._remove_ifAbsent_($3,(function(){
  13201. return $core.withContext(function($ctx2) {
  13202. throw $early=[$recv(aBlock)._value()];
  13203. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  13204. }));
  13205. $self.size=$recv($self.size).__minus((1));
  13206. return $self.size;
  13207. } else {
  13208. var primitiveBucket;
  13209. primitiveBucket=$receiver;
  13210. return $self._remove_in_ifAbsent_($recv(bucket)._first(),primitiveBucket,aBlock);
  13211. }
  13212. }
  13213. catch(e) {if(e===$early)return e[0]; throw e}
  13214. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket})});
  13215. },
  13216. args: ["anObject", "aBlock"],
  13217. source: "remove: anObject ifAbsent: aBlock\x0a\x09| bucket |\x0a\x09bucket := self bucketsOfElement: anObject.\x0a\x09^ bucket second\x0a\x09\x09ifNil: [ bucket third remove: bucket first ifAbsent: [ ^aBlock value ]. size := size - 1 ]\x0a\x09\x09ifNotNil: [ :primitiveBucket | self remove: bucket first in: primitiveBucket ifAbsent: aBlock ]",
  13218. referencedClasses: [],
  13219. pragmas: [],
  13220. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:ifAbsent:"]
  13221. }),
  13222. $globals.Set);
  13223. $core.addMethod(
  13224. $core.method({
  13225. selector: "remove:in:ifAbsent:",
  13226. protocol: "private",
  13227. fn: function (anObject,anotherObject,aBlock){
  13228. var self=this,$self=this;
  13229. return $core.withContext(function($ctx1) {
  13230. if (anObject in anotherObject.store) {
  13231. delete anotherObject.store[anObject];
  13232. $self.size--;
  13233. return anObject;
  13234. } else {
  13235. return aBlock._value();
  13236. };
  13237. return self;
  13238. }, function($ctx1) {$ctx1.fill(self,"remove:in:ifAbsent:",{anObject:anObject,anotherObject:anotherObject,aBlock:aBlock})});
  13239. },
  13240. args: ["anObject", "anotherObject", "aBlock"],
  13241. 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}'>",
  13242. referencedClasses: [],
  13243. 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}"]]],
  13244. messageSends: []
  13245. }),
  13246. $globals.Set);
  13247. $core.addMethod(
  13248. $core.method({
  13249. selector: "removeAll",
  13250. protocol: "adding/removing",
  13251. fn: function (){
  13252. var self=this,$self=this;
  13253. return $core.withContext(function($ctx1) {
  13254. $self.fastBuckets = {
  13255. "boolean": { store: Object.create(null), fn: function (x) { return {"true": true, "false": false, "null": null}[x]; } },
  13256. "number": { store: Object.create(null), fn: Number },
  13257. "string": { store: Object.create(null) }
  13258. };
  13259. $self.slowBucketStores.forEach(function (x) { x._removeAll(); });
  13260. $self.defaultBucket._removeAll();
  13261. $self.size = 0;
  13262. ;
  13263. return self;
  13264. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  13265. },
  13266. args: [],
  13267. 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'>",
  13268. referencedClasses: [],
  13269. 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"]]],
  13270. messageSends: []
  13271. }),
  13272. $globals.Set);
  13273. $core.addMethod(
  13274. $core.method({
  13275. selector: "select:",
  13276. protocol: "enumerating",
  13277. fn: function (aBlock){
  13278. var self=this,$self=this;
  13279. var collection;
  13280. return $core.withContext(function($ctx1) {
  13281. var $1;
  13282. collection=$recv($self._class())._new();
  13283. $self._do_((function(each){
  13284. return $core.withContext(function($ctx2) {
  13285. $1=$recv(aBlock)._value_(each);
  13286. if($core.assert($1)){
  13287. return $recv(collection)._add_(each);
  13288. }
  13289. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13290. }));
  13291. return collection;
  13292. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection})});
  13293. },
  13294. args: ["aBlock"],
  13295. 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",
  13296. referencedClasses: [],
  13297. pragmas: [],
  13298. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  13299. }),
  13300. $globals.Set);
  13301. $core.addMethod(
  13302. $core.method({
  13303. selector: "select:thenCollect:",
  13304. protocol: "enumerating",
  13305. fn: function (selectBlock,collectBlock){
  13306. var self=this,$self=this;
  13307. var collection;
  13308. return $core.withContext(function($ctx1) {
  13309. var $1;
  13310. collection=$recv($self._class())._new();
  13311. $self._do_((function(each){
  13312. return $core.withContext(function($ctx2) {
  13313. $1=$recv(selectBlock)._value_(each);
  13314. $ctx2.sendIdx["value:"]=1;
  13315. if($core.assert($1)){
  13316. return $recv(collection)._add_($recv(collectBlock)._value_(each));
  13317. }
  13318. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13319. }));
  13320. return collection;
  13321. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,collection:collection})});
  13322. },
  13323. args: ["selectBlock", "collectBlock"],
  13324. 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",
  13325. referencedClasses: [],
  13326. pragmas: [],
  13327. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  13328. }),
  13329. $globals.Set);
  13330. $core.addMethod(
  13331. $core.method({
  13332. selector: "size",
  13333. protocol: "accessing",
  13334. fn: function (){
  13335. var self=this,$self=this;
  13336. return $self.size;
  13337. },
  13338. args: [],
  13339. source: "size\x0a\x09^ size",
  13340. referencedClasses: [],
  13341. pragmas: [],
  13342. messageSends: []
  13343. }),
  13344. $globals.Set);
  13345. $core.addClass("ProtoStream", $globals.Object, [], "Kernel-Collections");
  13346. $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.";
  13347. $core.addMethod(
  13348. $core.method({
  13349. selector: "<<",
  13350. protocol: "writing",
  13351. fn: function (anObject){
  13352. var self=this,$self=this;
  13353. return $core.withContext(function($ctx1) {
  13354. $self._write_(anObject);
  13355. return self;
  13356. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject})});
  13357. },
  13358. args: ["anObject"],
  13359. source: "<< anObject\x0a\x09self write: anObject",
  13360. referencedClasses: [],
  13361. pragmas: [],
  13362. messageSends: ["write:"]
  13363. }),
  13364. $globals.ProtoStream);
  13365. $core.addMethod(
  13366. $core.method({
  13367. selector: "atEnd",
  13368. protocol: "testing",
  13369. fn: function (){
  13370. var self=this,$self=this;
  13371. return $core.withContext(function($ctx1) {
  13372. $self._subclassResponsibility();
  13373. return self;
  13374. }, function($ctx1) {$ctx1.fill(self,"atEnd",{})});
  13375. },
  13376. args: [],
  13377. source: "atEnd\x0a\x09self subclassResponsibility",
  13378. referencedClasses: [],
  13379. pragmas: [],
  13380. messageSends: ["subclassResponsibility"]
  13381. }),
  13382. $globals.ProtoStream);
  13383. $core.addMethod(
  13384. $core.method({
  13385. selector: "atStart",
  13386. protocol: "testing",
  13387. fn: function (){
  13388. var self=this,$self=this;
  13389. return $core.withContext(function($ctx1) {
  13390. $self._subclassResponsibility();
  13391. return self;
  13392. }, function($ctx1) {$ctx1.fill(self,"atStart",{})});
  13393. },
  13394. args: [],
  13395. source: "atStart\x0a\x09self subclassResponsibility",
  13396. referencedClasses: [],
  13397. pragmas: [],
  13398. messageSends: ["subclassResponsibility"]
  13399. }),
  13400. $globals.ProtoStream);
  13401. $core.addMethod(
  13402. $core.method({
  13403. selector: "contents",
  13404. protocol: "accessing",
  13405. fn: function (){
  13406. var self=this,$self=this;
  13407. return $core.withContext(function($ctx1) {
  13408. $self._subclassResponsibility();
  13409. return self;
  13410. }, function($ctx1) {$ctx1.fill(self,"contents",{})});
  13411. },
  13412. args: [],
  13413. source: "contents\x0a\x09self subclassResponsibility",
  13414. referencedClasses: [],
  13415. pragmas: [],
  13416. messageSends: ["subclassResponsibility"]
  13417. }),
  13418. $globals.ProtoStream);
  13419. $core.addMethod(
  13420. $core.method({
  13421. selector: "do:",
  13422. protocol: "enumerating",
  13423. fn: function (aBlock){
  13424. var self=this,$self=this;
  13425. return $core.withContext(function($ctx1) {
  13426. $recv((function(){
  13427. return $core.withContext(function($ctx2) {
  13428. return $self._atEnd();
  13429. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13430. }))._whileFalse_((function(){
  13431. return $core.withContext(function($ctx2) {
  13432. return $recv(aBlock)._value_($self._next());
  13433. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  13434. }));
  13435. return self;
  13436. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  13437. },
  13438. args: ["aBlock"],
  13439. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  13440. referencedClasses: [],
  13441. pragmas: [],
  13442. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  13443. }),
  13444. $globals.ProtoStream);
  13445. $core.addMethod(
  13446. $core.method({
  13447. selector: "isEmpty",
  13448. protocol: "testing",
  13449. fn: function (){
  13450. var self=this,$self=this;
  13451. return $core.withContext(function($ctx1) {
  13452. return $recv($self._atStart())._and_((function(){
  13453. return $core.withContext(function($ctx2) {
  13454. return $self._atEnd();
  13455. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13456. }));
  13457. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{})});
  13458. },
  13459. args: [],
  13460. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  13461. referencedClasses: [],
  13462. pragmas: [],
  13463. messageSends: ["and:", "atStart", "atEnd"]
  13464. }),
  13465. $globals.ProtoStream);
  13466. $core.addMethod(
  13467. $core.method({
  13468. selector: "next",
  13469. protocol: "reading",
  13470. fn: function (){
  13471. var self=this,$self=this;
  13472. return $core.withContext(function($ctx1) {
  13473. var $1;
  13474. $1=$self._atEnd();
  13475. if($core.assert($1)){
  13476. return nil;
  13477. } else {
  13478. return $self._subclassResponsibility();
  13479. }
  13480. }, function($ctx1) {$ctx1.fill(self,"next",{})});
  13481. },
  13482. args: [],
  13483. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  13484. referencedClasses: [],
  13485. pragmas: [],
  13486. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  13487. }),
  13488. $globals.ProtoStream);
  13489. $core.addMethod(
  13490. $core.method({
  13491. selector: "nextPut:",
  13492. protocol: "writing",
  13493. fn: function (anObject){
  13494. var self=this,$self=this;
  13495. return $core.withContext(function($ctx1) {
  13496. $self._subclassResponsibility();
  13497. return self;
  13498. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject})});
  13499. },
  13500. args: ["anObject"],
  13501. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  13502. referencedClasses: [],
  13503. pragmas: [],
  13504. messageSends: ["subclassResponsibility"]
  13505. }),
  13506. $globals.ProtoStream);
  13507. $core.addMethod(
  13508. $core.method({
  13509. selector: "nextPutAll:",
  13510. protocol: "writing",
  13511. fn: function (aCollection){
  13512. var self=this,$self=this;
  13513. return $core.withContext(function($ctx1) {
  13514. $recv(aCollection)._do_((function(each){
  13515. return $core.withContext(function($ctx2) {
  13516. return $self._nextPut_(each);
  13517. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13518. }));
  13519. return self;
  13520. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection})});
  13521. },
  13522. args: ["aCollection"],
  13523. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  13524. referencedClasses: [],
  13525. pragmas: [],
  13526. messageSends: ["do:", "nextPut:"]
  13527. }),
  13528. $globals.ProtoStream);
  13529. $core.addMethod(
  13530. $core.method({
  13531. selector: "nextPutString:",
  13532. protocol: "writing",
  13533. fn: function (aString){
  13534. var self=this,$self=this;
  13535. return $core.withContext(function($ctx1) {
  13536. $self._nextPut_(aString);
  13537. return self;
  13538. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString})});
  13539. },
  13540. args: ["aString"],
  13541. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  13542. referencedClasses: [],
  13543. pragmas: [],
  13544. messageSends: ["nextPut:"]
  13545. }),
  13546. $globals.ProtoStream);
  13547. $core.addMethod(
  13548. $core.method({
  13549. selector: "peek",
  13550. protocol: "reading",
  13551. fn: function (){
  13552. var self=this,$self=this;
  13553. return $core.withContext(function($ctx1) {
  13554. var $1;
  13555. $1=$self._atEnd();
  13556. if($core.assert($1)){
  13557. return nil;
  13558. } else {
  13559. return $self._subclassResponsibility();
  13560. }
  13561. }, function($ctx1) {$ctx1.fill(self,"peek",{})});
  13562. },
  13563. args: [],
  13564. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  13565. referencedClasses: [],
  13566. pragmas: [],
  13567. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  13568. }),
  13569. $globals.ProtoStream);
  13570. $core.addMethod(
  13571. $core.method({
  13572. selector: "reset",
  13573. protocol: "actions",
  13574. fn: function (){
  13575. var self=this,$self=this;
  13576. return $core.withContext(function($ctx1) {
  13577. $self._subclassResponsibility();
  13578. return self;
  13579. }, function($ctx1) {$ctx1.fill(self,"reset",{})});
  13580. },
  13581. args: [],
  13582. source: "reset\x0a\x09self subclassResponsibility",
  13583. referencedClasses: [],
  13584. pragmas: [],
  13585. messageSends: ["subclassResponsibility"]
  13586. }),
  13587. $globals.ProtoStream);
  13588. $core.addMethod(
  13589. $core.method({
  13590. selector: "resetContents",
  13591. protocol: "actions",
  13592. fn: function (){
  13593. var self=this,$self=this;
  13594. return $core.withContext(function($ctx1) {
  13595. $self._subclassResponsibility();
  13596. return self;
  13597. }, function($ctx1) {$ctx1.fill(self,"resetContents",{})});
  13598. },
  13599. args: [],
  13600. source: "resetContents\x0a\x09self subclassResponsibility",
  13601. referencedClasses: [],
  13602. pragmas: [],
  13603. messageSends: ["subclassResponsibility"]
  13604. }),
  13605. $globals.ProtoStream);
  13606. $core.addMethod(
  13607. $core.method({
  13608. selector: "setToEnd",
  13609. protocol: "positioning",
  13610. fn: function (){
  13611. var self=this,$self=this;
  13612. return $core.withContext(function($ctx1) {
  13613. $self._subclassResponsibility();
  13614. return self;
  13615. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{})});
  13616. },
  13617. args: [],
  13618. source: "setToEnd\x0a\x09self subclassResponsibility",
  13619. referencedClasses: [],
  13620. pragmas: [],
  13621. messageSends: ["subclassResponsibility"]
  13622. }),
  13623. $globals.ProtoStream);
  13624. $core.addMethod(
  13625. $core.method({
  13626. selector: "setToStart",
  13627. protocol: "positioning",
  13628. fn: function (){
  13629. var self=this,$self=this;
  13630. return $core.withContext(function($ctx1) {
  13631. $self._reset();
  13632. return self;
  13633. }, function($ctx1) {$ctx1.fill(self,"setToStart",{})});
  13634. },
  13635. args: [],
  13636. source: "setToStart\x0a\x09self reset",
  13637. referencedClasses: [],
  13638. pragmas: [],
  13639. messageSends: ["reset"]
  13640. }),
  13641. $globals.ProtoStream);
  13642. $core.addMethod(
  13643. $core.method({
  13644. selector: "write:",
  13645. protocol: "writing",
  13646. fn: function (anObject){
  13647. var self=this,$self=this;
  13648. return $core.withContext(function($ctx1) {
  13649. $recv(anObject)._putOn_(self);
  13650. return self;
  13651. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject})});
  13652. },
  13653. args: ["anObject"],
  13654. source: "write: anObject\x0a\x09anObject putOn: self",
  13655. referencedClasses: [],
  13656. pragmas: [],
  13657. messageSends: ["putOn:"]
  13658. }),
  13659. $globals.ProtoStream);
  13660. $core.addMethod(
  13661. $core.method({
  13662. selector: "on:",
  13663. protocol: "instance creation",
  13664. fn: function (aCollection){
  13665. var self=this,$self=this;
  13666. return $core.withContext(function($ctx1) {
  13667. var $1;
  13668. $1=$self._new();
  13669. $recv($1)._setCollection_(aCollection);
  13670. $recv($1)._setStreamSize_($recv(aCollection)._size());
  13671. return $recv($1)._yourself();
  13672. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection})});
  13673. },
  13674. args: ["aCollection"],
  13675. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  13676. referencedClasses: [],
  13677. pragmas: [],
  13678. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  13679. }),
  13680. $globals.ProtoStream.a$cls);
  13681. $core.addClass("Stream", $globals.ProtoStream, ["collection", "position", "streamSize"], "Kernel-Collections");
  13682. $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.";
  13683. $core.addMethod(
  13684. $core.method({
  13685. selector: "atEnd",
  13686. protocol: "testing",
  13687. fn: function (){
  13688. var self=this,$self=this;
  13689. return $core.withContext(function($ctx1) {
  13690. return $recv($self._position()).__eq($self._size());
  13691. }, function($ctx1) {$ctx1.fill(self,"atEnd",{})});
  13692. },
  13693. args: [],
  13694. source: "atEnd\x0a\x09^ self position = self size",
  13695. referencedClasses: [],
  13696. pragmas: [],
  13697. messageSends: ["=", "position", "size"]
  13698. }),
  13699. $globals.Stream);
  13700. $core.addMethod(
  13701. $core.method({
  13702. selector: "atStart",
  13703. protocol: "testing",
  13704. fn: function (){
  13705. var self=this,$self=this;
  13706. return $core.withContext(function($ctx1) {
  13707. return $recv($self._position()).__eq((0));
  13708. }, function($ctx1) {$ctx1.fill(self,"atStart",{})});
  13709. },
  13710. args: [],
  13711. source: "atStart\x0a\x09^ self position = 0",
  13712. referencedClasses: [],
  13713. pragmas: [],
  13714. messageSends: ["=", "position"]
  13715. }),
  13716. $globals.Stream);
  13717. $core.addMethod(
  13718. $core.method({
  13719. selector: "close",
  13720. protocol: "actions",
  13721. fn: function (){
  13722. var self=this,$self=this;
  13723. return self;
  13724. },
  13725. args: [],
  13726. source: "close",
  13727. referencedClasses: [],
  13728. pragmas: [],
  13729. messageSends: []
  13730. }),
  13731. $globals.Stream);
  13732. $core.addMethod(
  13733. $core.method({
  13734. selector: "collection",
  13735. protocol: "accessing",
  13736. fn: function (){
  13737. var self=this,$self=this;
  13738. return $self.collection;
  13739. },
  13740. args: [],
  13741. source: "collection\x0a\x09^ collection",
  13742. referencedClasses: [],
  13743. pragmas: [],
  13744. messageSends: []
  13745. }),
  13746. $globals.Stream);
  13747. $core.addMethod(
  13748. $core.method({
  13749. selector: "contents",
  13750. protocol: "accessing",
  13751. fn: function (){
  13752. var self=this,$self=this;
  13753. return $core.withContext(function($ctx1) {
  13754. return $recv($self._collection())._copyFrom_to_((1),$self._streamSize());
  13755. }, function($ctx1) {$ctx1.fill(self,"contents",{})});
  13756. },
  13757. args: [],
  13758. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  13759. referencedClasses: [],
  13760. pragmas: [],
  13761. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  13762. }),
  13763. $globals.Stream);
  13764. $core.addMethod(
  13765. $core.method({
  13766. selector: "flush",
  13767. protocol: "actions",
  13768. fn: function (){
  13769. var self=this,$self=this;
  13770. return self;
  13771. },
  13772. args: [],
  13773. source: "flush",
  13774. referencedClasses: [],
  13775. pragmas: [],
  13776. messageSends: []
  13777. }),
  13778. $globals.Stream);
  13779. $core.addMethod(
  13780. $core.method({
  13781. selector: "isEmpty",
  13782. protocol: "testing",
  13783. fn: function (){
  13784. var self=this,$self=this;
  13785. return $core.withContext(function($ctx1) {
  13786. return $recv($self._size()).__eq((0));
  13787. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{})});
  13788. },
  13789. args: [],
  13790. source: "isEmpty\x0a\x09^ self size = 0",
  13791. referencedClasses: [],
  13792. pragmas: [],
  13793. messageSends: ["=", "size"]
  13794. }),
  13795. $globals.Stream);
  13796. $core.addMethod(
  13797. $core.method({
  13798. selector: "next",
  13799. protocol: "reading",
  13800. fn: function (){
  13801. var self=this,$self=this;
  13802. return $core.withContext(function($ctx1) {
  13803. var $1,$3,$2;
  13804. $1=$self._atEnd();
  13805. if($core.assert($1)){
  13806. return nil;
  13807. } else {
  13808. $3=$self._position();
  13809. $ctx1.sendIdx["position"]=1;
  13810. $2=$recv($3).__plus((1));
  13811. $self._position_($2);
  13812. return $recv($self.collection)._at_($self._position());
  13813. }
  13814. }, function($ctx1) {$ctx1.fill(self,"next",{})});
  13815. },
  13816. args: [],
  13817. 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 ]",
  13818. referencedClasses: [],
  13819. pragmas: [],
  13820. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  13821. }),
  13822. $globals.Stream);
  13823. $core.addMethod(
  13824. $core.method({
  13825. selector: "next:",
  13826. protocol: "reading",
  13827. fn: function (anInteger){
  13828. var self=this,$self=this;
  13829. var tempCollection;
  13830. return $core.withContext(function($ctx1) {
  13831. var $1;
  13832. tempCollection=$recv($recv($self._collection())._class())._new();
  13833. $recv(anInteger)._timesRepeat_((function(){
  13834. return $core.withContext(function($ctx2) {
  13835. $1=$self._atEnd();
  13836. if(!$core.assert($1)){
  13837. return $recv(tempCollection)._add_($self._next());
  13838. }
  13839. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13840. }));
  13841. return tempCollection;
  13842. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection})});
  13843. },
  13844. args: ["anInteger"],
  13845. 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",
  13846. referencedClasses: [],
  13847. pragmas: [],
  13848. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  13849. }),
  13850. $globals.Stream);
  13851. $core.addMethod(
  13852. $core.method({
  13853. selector: "nextPut:",
  13854. protocol: "writing",
  13855. fn: function (anObject){
  13856. var self=this,$self=this;
  13857. return $core.withContext(function($ctx1) {
  13858. var $2,$1,$3,$4;
  13859. $2=$self._position();
  13860. $ctx1.sendIdx["position"]=1;
  13861. $1=$recv($2).__plus((1));
  13862. $self._position_($1);
  13863. $3=$self._collection();
  13864. $4=$self._position();
  13865. $ctx1.sendIdx["position"]=2;
  13866. $recv($3)._at_put_($4,anObject);
  13867. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  13868. return self;
  13869. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject})});
  13870. },
  13871. args: ["anObject"],
  13872. 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)",
  13873. referencedClasses: [],
  13874. pragmas: [],
  13875. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  13876. }),
  13877. $globals.Stream);
  13878. $core.addMethod(
  13879. $core.method({
  13880. selector: "peek",
  13881. protocol: "reading",
  13882. fn: function (){
  13883. var self=this,$self=this;
  13884. return $core.withContext(function($ctx1) {
  13885. var $1;
  13886. $1=$self._atEnd();
  13887. if(!$core.assert($1)){
  13888. return $recv($self._collection())._at_($recv($self._position()).__plus((1)));
  13889. }
  13890. }, function($ctx1) {$ctx1.fill(self,"peek",{})});
  13891. },
  13892. args: [],
  13893. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  13894. referencedClasses: [],
  13895. pragmas: [],
  13896. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  13897. }),
  13898. $globals.Stream);
  13899. $core.addMethod(
  13900. $core.method({
  13901. selector: "position",
  13902. protocol: "accessing",
  13903. fn: function (){
  13904. var self=this,$self=this;
  13905. return $core.withContext(function($ctx1) {
  13906. var $1,$receiver;
  13907. $1=$self.position;
  13908. if(($receiver = $1) == null || $receiver.a$nil){
  13909. $self.position=(0);
  13910. return $self.position;
  13911. } else {
  13912. return $1;
  13913. }
  13914. }, function($ctx1) {$ctx1.fill(self,"position",{})});
  13915. },
  13916. args: [],
  13917. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  13918. referencedClasses: [],
  13919. pragmas: [],
  13920. messageSends: ["ifNil:"]
  13921. }),
  13922. $globals.Stream);
  13923. $core.addMethod(
  13924. $core.method({
  13925. selector: "position:",
  13926. protocol: "accessing",
  13927. fn: function (anInteger){
  13928. var self=this,$self=this;
  13929. $self.position=anInteger;
  13930. return self;
  13931. },
  13932. args: ["anInteger"],
  13933. source: "position: anInteger\x0a\x09position := anInteger",
  13934. referencedClasses: [],
  13935. pragmas: [],
  13936. messageSends: []
  13937. }),
  13938. $globals.Stream);
  13939. $core.addMethod(
  13940. $core.method({
  13941. selector: "reset",
  13942. protocol: "actions",
  13943. fn: function (){
  13944. var self=this,$self=this;
  13945. return $core.withContext(function($ctx1) {
  13946. $self._position_((0));
  13947. return self;
  13948. }, function($ctx1) {$ctx1.fill(self,"reset",{})});
  13949. },
  13950. args: [],
  13951. source: "reset\x0a\x09self position: 0",
  13952. referencedClasses: [],
  13953. pragmas: [],
  13954. messageSends: ["position:"]
  13955. }),
  13956. $globals.Stream);
  13957. $core.addMethod(
  13958. $core.method({
  13959. selector: "resetContents",
  13960. protocol: "actions",
  13961. fn: function (){
  13962. var self=this,$self=this;
  13963. return $core.withContext(function($ctx1) {
  13964. $self._reset();
  13965. $self._setStreamSize_((0));
  13966. return self;
  13967. }, function($ctx1) {$ctx1.fill(self,"resetContents",{})});
  13968. },
  13969. args: [],
  13970. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  13971. referencedClasses: [],
  13972. pragmas: [],
  13973. messageSends: ["reset", "setStreamSize:"]
  13974. }),
  13975. $globals.Stream);
  13976. $core.addMethod(
  13977. $core.method({
  13978. selector: "setCollection:",
  13979. protocol: "accessing",
  13980. fn: function (aCollection){
  13981. var self=this,$self=this;
  13982. $self.collection=aCollection;
  13983. return self;
  13984. },
  13985. args: ["aCollection"],
  13986. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  13987. referencedClasses: [],
  13988. pragmas: [],
  13989. messageSends: []
  13990. }),
  13991. $globals.Stream);
  13992. $core.addMethod(
  13993. $core.method({
  13994. selector: "setStreamSize:",
  13995. protocol: "accessing",
  13996. fn: function (anInteger){
  13997. var self=this,$self=this;
  13998. $self.streamSize=anInteger;
  13999. return self;
  14000. },
  14001. args: ["anInteger"],
  14002. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  14003. referencedClasses: [],
  14004. pragmas: [],
  14005. messageSends: []
  14006. }),
  14007. $globals.Stream);
  14008. $core.addMethod(
  14009. $core.method({
  14010. selector: "setToEnd",
  14011. protocol: "positioning",
  14012. fn: function (){
  14013. var self=this,$self=this;
  14014. return $core.withContext(function($ctx1) {
  14015. $self._position_($self._size());
  14016. return self;
  14017. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{})});
  14018. },
  14019. args: [],
  14020. source: "setToEnd\x0a\x09self position: self size",
  14021. referencedClasses: [],
  14022. pragmas: [],
  14023. messageSends: ["position:", "size"]
  14024. }),
  14025. $globals.Stream);
  14026. $core.addMethod(
  14027. $core.method({
  14028. selector: "size",
  14029. protocol: "accessing",
  14030. fn: function (){
  14031. var self=this,$self=this;
  14032. return $core.withContext(function($ctx1) {
  14033. return $self._streamSize();
  14034. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  14035. },
  14036. args: [],
  14037. source: "size\x0a\x09^ self streamSize",
  14038. referencedClasses: [],
  14039. pragmas: [],
  14040. messageSends: ["streamSize"]
  14041. }),
  14042. $globals.Stream);
  14043. $core.addMethod(
  14044. $core.method({
  14045. selector: "skip:",
  14046. protocol: "positioning",
  14047. fn: function (anInteger){
  14048. var self=this,$self=this;
  14049. return $core.withContext(function($ctx1) {
  14050. $self._position_($recv($recv($self._position()).__plus(anInteger))._min_max_($self._size(),(0)));
  14051. return self;
  14052. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger})});
  14053. },
  14054. args: ["anInteger"],
  14055. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  14056. referencedClasses: [],
  14057. pragmas: [],
  14058. messageSends: ["position:", "min:max:", "+", "position", "size"]
  14059. }),
  14060. $globals.Stream);
  14061. $core.addMethod(
  14062. $core.method({
  14063. selector: "streamSize",
  14064. protocol: "accessing",
  14065. fn: function (){
  14066. var self=this,$self=this;
  14067. return $self.streamSize;
  14068. },
  14069. args: [],
  14070. source: "streamSize\x0a\x09^ streamSize",
  14071. referencedClasses: [],
  14072. pragmas: [],
  14073. messageSends: []
  14074. }),
  14075. $globals.Stream);
  14076. $core.addMethod(
  14077. $core.method({
  14078. selector: "on:",
  14079. protocol: "instance creation",
  14080. fn: function (aCollection){
  14081. var self=this,$self=this;
  14082. return $core.withContext(function($ctx1) {
  14083. var $1;
  14084. $1=$self._new();
  14085. $recv($1)._setCollection_(aCollection);
  14086. $recv($1)._setStreamSize_($recv(aCollection)._size());
  14087. return $recv($1)._yourself();
  14088. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection})});
  14089. },
  14090. args: ["aCollection"],
  14091. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  14092. referencedClasses: [],
  14093. pragmas: [],
  14094. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  14095. }),
  14096. $globals.Stream.a$cls);
  14097. $core.addClass("StringStream", $globals.Stream, [], "Kernel-Collections");
  14098. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  14099. $core.addMethod(
  14100. $core.method({
  14101. selector: "cr",
  14102. protocol: "writing",
  14103. fn: function (){
  14104. var self=this,$self=this;
  14105. return $core.withContext(function($ctx1) {
  14106. return $self._nextPutAll_($recv($globals.String)._cr());
  14107. }, function($ctx1) {$ctx1.fill(self,"cr",{})});
  14108. },
  14109. args: [],
  14110. source: "cr\x0a\x09^ self nextPutAll: String cr",
  14111. referencedClasses: ["String"],
  14112. pragmas: [],
  14113. messageSends: ["nextPutAll:", "cr"]
  14114. }),
  14115. $globals.StringStream);
  14116. $core.addMethod(
  14117. $core.method({
  14118. selector: "crlf",
  14119. protocol: "writing",
  14120. fn: function (){
  14121. var self=this,$self=this;
  14122. return $core.withContext(function($ctx1) {
  14123. return $self._nextPutAll_($recv($globals.String)._crlf());
  14124. }, function($ctx1) {$ctx1.fill(self,"crlf",{})});
  14125. },
  14126. args: [],
  14127. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  14128. referencedClasses: ["String"],
  14129. pragmas: [],
  14130. messageSends: ["nextPutAll:", "crlf"]
  14131. }),
  14132. $globals.StringStream);
  14133. $core.addMethod(
  14134. $core.method({
  14135. selector: "lf",
  14136. protocol: "writing",
  14137. fn: function (){
  14138. var self=this,$self=this;
  14139. return $core.withContext(function($ctx1) {
  14140. return $self._nextPutAll_($recv($globals.String)._lf());
  14141. }, function($ctx1) {$ctx1.fill(self,"lf",{})});
  14142. },
  14143. args: [],
  14144. source: "lf\x0a\x09^ self nextPutAll: String lf",
  14145. referencedClasses: ["String"],
  14146. pragmas: [],
  14147. messageSends: ["nextPutAll:", "lf"]
  14148. }),
  14149. $globals.StringStream);
  14150. $core.addMethod(
  14151. $core.method({
  14152. selector: "next:",
  14153. protocol: "reading",
  14154. fn: function (anInteger){
  14155. var self=this,$self=this;
  14156. var tempCollection;
  14157. return $core.withContext(function($ctx1) {
  14158. var $1;
  14159. tempCollection=$recv($recv($self._collection())._class())._new();
  14160. $recv(anInteger)._timesRepeat_((function(){
  14161. return $core.withContext(function($ctx2) {
  14162. $1=$self._atEnd();
  14163. if(!$core.assert($1)){
  14164. tempCollection=$recv(tempCollection).__comma($self._next());
  14165. return tempCollection;
  14166. }
  14167. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14168. }));
  14169. return tempCollection;
  14170. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection})});
  14171. },
  14172. args: ["anInteger"],
  14173. 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",
  14174. referencedClasses: [],
  14175. pragmas: [],
  14176. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  14177. }),
  14178. $globals.StringStream);
  14179. $core.addMethod(
  14180. $core.method({
  14181. selector: "nextPut:",
  14182. protocol: "writing",
  14183. fn: function (aString){
  14184. var self=this,$self=this;
  14185. return $core.withContext(function($ctx1) {
  14186. $self._nextPutAll_(aString);
  14187. return self;
  14188. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString})});
  14189. },
  14190. args: ["aString"],
  14191. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  14192. referencedClasses: [],
  14193. pragmas: [],
  14194. messageSends: ["nextPutAll:"]
  14195. }),
  14196. $globals.StringStream);
  14197. $core.addMethod(
  14198. $core.method({
  14199. selector: "nextPutAll:",
  14200. protocol: "writing",
  14201. fn: function (aString){
  14202. var self=this,$self=this;
  14203. var pre,post;
  14204. return $core.withContext(function($ctx1) {
  14205. var $2,$4,$3,$1,$6,$5,$7,$8,$9,$12,$11,$13,$10,$14,$15,$17,$16;
  14206. $2=$self._position();
  14207. $ctx1.sendIdx["position"]=1;
  14208. $4=$self._collection();
  14209. $ctx1.sendIdx["collection"]=1;
  14210. $3=$recv($4)._size();
  14211. $ctx1.sendIdx["size"]=1;
  14212. $1=$recv($2).__eq($3);
  14213. if($core.assert($1)){
  14214. $6=$self._collection();
  14215. $ctx1.sendIdx["collection"]=2;
  14216. $5=$recv($6).__comma(aString);
  14217. $ctx1.sendIdx[","]=1;
  14218. $self._setCollection_($5);
  14219. $ctx1.sendIdx["setCollection:"]=1;
  14220. } else {
  14221. $7=$self._collection();
  14222. $ctx1.sendIdx["collection"]=3;
  14223. $8=$self._position();
  14224. $ctx1.sendIdx["position"]=2;
  14225. pre=$recv($7)._copyFrom_to_((1),$8);
  14226. $ctx1.sendIdx["copyFrom:to:"]=1;
  14227. $9=$self._collection();
  14228. $ctx1.sendIdx["collection"]=4;
  14229. $12=$self._position();
  14230. $ctx1.sendIdx["position"]=3;
  14231. $11=$recv($12).__plus((1));
  14232. $ctx1.sendIdx["+"]=2;
  14233. $13=$recv(aString)._size();
  14234. $ctx1.sendIdx["size"]=2;
  14235. $10=$recv($11).__plus($13);
  14236. $ctx1.sendIdx["+"]=1;
  14237. $14=$recv($self._collection())._size();
  14238. $ctx1.sendIdx["size"]=3;
  14239. post=$recv($9)._copyFrom_to_($10,$14);
  14240. $15=$recv($recv(pre).__comma(aString)).__comma(post);
  14241. $ctx1.sendIdx[","]=2;
  14242. $self._setCollection_($15);
  14243. }
  14244. $17=$self._position();
  14245. $ctx1.sendIdx["position"]=4;
  14246. $16=$recv($17).__plus($recv(aString)._size());
  14247. $self._position_($16);
  14248. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  14249. return self;
  14250. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post})});
  14251. },
  14252. args: ["aString"],
  14253. 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)",
  14254. referencedClasses: [],
  14255. pragmas: [],
  14256. messageSends: ["ifTrue:ifFalse:", "=", "position", "size", "collection", "setCollection:", ",", "copyFrom:to:", "+", "position:", "setStreamSize:", "max:", "streamSize"]
  14257. }),
  14258. $globals.StringStream);
  14259. $core.addMethod(
  14260. $core.method({
  14261. selector: "nextPutString:",
  14262. protocol: "writing",
  14263. fn: function (aString){
  14264. var self=this,$self=this;
  14265. return $core.withContext(function($ctx1) {
  14266. $self._nextPutAll_(aString);
  14267. return self;
  14268. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString})});
  14269. },
  14270. args: ["aString"],
  14271. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  14272. referencedClasses: [],
  14273. pragmas: [],
  14274. messageSends: ["nextPutAll:"]
  14275. }),
  14276. $globals.StringStream);
  14277. $core.addMethod(
  14278. $core.method({
  14279. selector: "print:",
  14280. protocol: "writing",
  14281. fn: function (anObject){
  14282. var self=this,$self=this;
  14283. return $core.withContext(function($ctx1) {
  14284. $recv(anObject)._printOn_(self);
  14285. return self;
  14286. }, function($ctx1) {$ctx1.fill(self,"print:",{anObject:anObject})});
  14287. },
  14288. args: ["anObject"],
  14289. source: "print: anObject\x0a\x09anObject printOn: self",
  14290. referencedClasses: [],
  14291. pragmas: [],
  14292. messageSends: ["printOn:"]
  14293. }),
  14294. $globals.StringStream);
  14295. $core.addMethod(
  14296. $core.method({
  14297. selector: "printSymbol:",
  14298. protocol: "writing",
  14299. fn: function (anObject){
  14300. var self=this,$self=this;
  14301. return $core.withContext(function($ctx1) {
  14302. $recv(anObject)._asSymbolPrintOn_(self);
  14303. return self;
  14304. }, function($ctx1) {$ctx1.fill(self,"printSymbol:",{anObject:anObject})});
  14305. },
  14306. args: ["anObject"],
  14307. source: "printSymbol: anObject\x0a\x09anObject asSymbolPrintOn: self",
  14308. referencedClasses: [],
  14309. pragmas: [],
  14310. messageSends: ["asSymbolPrintOn:"]
  14311. }),
  14312. $globals.StringStream);
  14313. $core.addMethod(
  14314. $core.method({
  14315. selector: "space",
  14316. protocol: "writing",
  14317. fn: function (){
  14318. var self=this,$self=this;
  14319. return $core.withContext(function($ctx1) {
  14320. $self._nextPut_(" ");
  14321. return self;
  14322. }, function($ctx1) {$ctx1.fill(self,"space",{})});
  14323. },
  14324. args: [],
  14325. source: "space\x0a\x09self nextPut: ' '",
  14326. referencedClasses: [],
  14327. pragmas: [],
  14328. messageSends: ["nextPut:"]
  14329. }),
  14330. $globals.StringStream);
  14331. $core.addMethod(
  14332. $core.method({
  14333. selector: "tab",
  14334. protocol: "writing",
  14335. fn: function (){
  14336. var self=this,$self=this;
  14337. return $core.withContext(function($ctx1) {
  14338. return $self._nextPutAll_($recv($globals.String)._tab());
  14339. }, function($ctx1) {$ctx1.fill(self,"tab",{})});
  14340. },
  14341. args: [],
  14342. source: "tab\x0a\x09^ self nextPutAll: String tab",
  14343. referencedClasses: ["String"],
  14344. pragmas: [],
  14345. messageSends: ["nextPutAll:", "tab"]
  14346. }),
  14347. $globals.StringStream);
  14348. $core.addClass("Queue", $globals.Object, ["read", "readIndex", "write"], "Kernel-Collections");
  14349. $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.";
  14350. $core.addMethod(
  14351. $core.method({
  14352. selector: "initialize",
  14353. protocol: "initialization",
  14354. fn: function (){
  14355. var self=this,$self=this;
  14356. return $core.withContext(function($ctx1) {
  14357. (
  14358. $ctx1.supercall = true,
  14359. ($globals.Queue.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  14360. $ctx1.supercall = false;
  14361. $self.read=$recv($globals.OrderedCollection)._new();
  14362. $ctx1.sendIdx["new"]=1;
  14363. $self.write=$recv($globals.OrderedCollection)._new();
  14364. $self.readIndex=(1);
  14365. return self;
  14366. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  14367. },
  14368. args: [],
  14369. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  14370. referencedClasses: ["OrderedCollection"],
  14371. pragmas: [],
  14372. messageSends: ["initialize", "new"]
  14373. }),
  14374. $globals.Queue);
  14375. $core.addMethod(
  14376. $core.method({
  14377. selector: "next",
  14378. protocol: "accessing",
  14379. fn: function (){
  14380. var self=this,$self=this;
  14381. return $core.withContext(function($ctx1) {
  14382. return $self._nextIfAbsent_((function(){
  14383. return $core.withContext(function($ctx2) {
  14384. return $self._error_("Cannot read from empty Queue.");
  14385. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14386. }));
  14387. }, function($ctx1) {$ctx1.fill(self,"next",{})});
  14388. },
  14389. args: [],
  14390. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  14391. referencedClasses: [],
  14392. pragmas: [],
  14393. messageSends: ["nextIfAbsent:", "error:"]
  14394. }),
  14395. $globals.Queue);
  14396. $core.addMethod(
  14397. $core.method({
  14398. selector: "nextIfAbsent:",
  14399. protocol: "accessing",
  14400. fn: function (aBlock){
  14401. var self=this,$self=this;
  14402. var result;
  14403. return $core.withContext(function($ctx1) {
  14404. var $1;
  14405. var $early={};
  14406. try {
  14407. result=$recv($self.read)._at_ifAbsent_($self.readIndex,(function(){
  14408. return $core.withContext(function($ctx2) {
  14409. $recv($self.write)._ifEmpty_((function(){
  14410. return $core.withContext(function($ctx3) {
  14411. $1=$recv($self.readIndex).__gt((1));
  14412. if($core.assert($1)){
  14413. $self.read=[];
  14414. $self.readIndex=(1);
  14415. $self.readIndex;
  14416. }
  14417. throw $early=[$recv(aBlock)._value()];
  14418. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  14419. }));
  14420. $self.read=$self.write;
  14421. $self.readIndex=(1);
  14422. $self.write=$recv($globals.OrderedCollection)._new();
  14423. return $recv($self.read)._first();
  14424. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14425. }));
  14426. $recv($self.read)._at_put_($self.readIndex,nil);
  14427. $self.readIndex=$recv($self.readIndex).__plus((1));
  14428. return result;
  14429. }
  14430. catch(e) {if(e===$early)return e[0]; throw e}
  14431. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result})});
  14432. },
  14433. args: ["aBlock"],
  14434. 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",
  14435. referencedClasses: ["OrderedCollection"],
  14436. pragmas: [],
  14437. messageSends: ["at:ifAbsent:", "ifEmpty:", "ifTrue:", ">", "value", "new", "first", "at:put:", "+"]
  14438. }),
  14439. $globals.Queue);
  14440. $core.addMethod(
  14441. $core.method({
  14442. selector: "nextPut:",
  14443. protocol: "accessing",
  14444. fn: function (anObject){
  14445. var self=this,$self=this;
  14446. return $core.withContext(function($ctx1) {
  14447. $recv($self.write)._add_(anObject);
  14448. return self;
  14449. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject})});
  14450. },
  14451. args: ["anObject"],
  14452. source: "nextPut: anObject\x0a\x09write add: anObject",
  14453. referencedClasses: [],
  14454. pragmas: [],
  14455. messageSends: ["add:"]
  14456. }),
  14457. $globals.Queue);
  14458. $core.addClass("RegularExpression", $globals.Object, [], "Kernel-Collections");
  14459. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  14460. $core.addMethod(
  14461. $core.method({
  14462. selector: "compile:",
  14463. protocol: "evaluating",
  14464. fn: function (aString){
  14465. var self=this,$self=this;
  14466. return $core.withContext(function($ctx1) {
  14467. return self.compile(aString);
  14468. return self;
  14469. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString})});
  14470. },
  14471. args: ["aString"],
  14472. source: "compile: aString\x0a\x09<inlineJS: 'return self.compile(aString)'>",
  14473. referencedClasses: [],
  14474. pragmas: [["inlineJS:", ["return self.compile(aString)"]]],
  14475. messageSends: []
  14476. }),
  14477. $globals.RegularExpression);
  14478. $core.addMethod(
  14479. $core.method({
  14480. selector: "exec:",
  14481. protocol: "evaluating",
  14482. fn: function (aString){
  14483. var self=this,$self=this;
  14484. return $core.withContext(function($ctx1) {
  14485. return self.exec(aString) || nil;
  14486. return self;
  14487. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString})});
  14488. },
  14489. args: ["aString"],
  14490. source: "exec: aString\x0a\x09<inlineJS: 'return self.exec(aString) || nil'>",
  14491. referencedClasses: [],
  14492. pragmas: [["inlineJS:", ["return self.exec(aString) || nil"]]],
  14493. messageSends: []
  14494. }),
  14495. $globals.RegularExpression);
  14496. $core.addMethod(
  14497. $core.method({
  14498. selector: "test:",
  14499. protocol: "evaluating",
  14500. fn: function (aString){
  14501. var self=this,$self=this;
  14502. return $core.withContext(function($ctx1) {
  14503. return self.test(aString);
  14504. return self;
  14505. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString})});
  14506. },
  14507. args: ["aString"],
  14508. source: "test: aString\x0a\x09<inlineJS: 'return self.test(aString)'>",
  14509. referencedClasses: [],
  14510. pragmas: [["inlineJS:", ["return self.test(aString)"]]],
  14511. messageSends: []
  14512. }),
  14513. $globals.RegularExpression);
  14514. $core.addMethod(
  14515. $core.method({
  14516. selector: "fromString:",
  14517. protocol: "instance creation",
  14518. fn: function (aString){
  14519. var self=this,$self=this;
  14520. return $core.withContext(function($ctx1) {
  14521. return $self._fromString_flag_(aString,"");
  14522. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString})});
  14523. },
  14524. args: ["aString"],
  14525. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  14526. referencedClasses: [],
  14527. pragmas: [],
  14528. messageSends: ["fromString:flag:"]
  14529. }),
  14530. $globals.RegularExpression.a$cls);
  14531. $core.addMethod(
  14532. $core.method({
  14533. selector: "fromString:flag:",
  14534. protocol: "instance creation",
  14535. fn: function (aString,anotherString){
  14536. var self=this,$self=this;
  14537. return $core.withContext(function($ctx1) {
  14538. return new RegExp(aString, anotherString);
  14539. return self;
  14540. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString})});
  14541. },
  14542. args: ["aString", "anotherString"],
  14543. source: "fromString: aString flag: anotherString\x0a\x09<inlineJS: 'return new RegExp(aString, anotherString)'>",
  14544. referencedClasses: [],
  14545. pragmas: [["inlineJS:", ["return new RegExp(aString, anotherString)"]]],
  14546. messageSends: []
  14547. }),
  14548. $globals.RegularExpression.a$cls);
  14549. $core.addTrait("TKeyValueCollection", "Kernel-Collections");
  14550. $core.addMethod(
  14551. $core.method({
  14552. selector: "at:",
  14553. protocol: "accessing",
  14554. fn: function (anIndex){
  14555. var self=this,$self=this;
  14556. return $core.withContext(function($ctx1) {
  14557. return $self._at_ifAbsent_(anIndex,(function(){
  14558. return $core.withContext(function($ctx2) {
  14559. return $self._errorNotFound();
  14560. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14561. }));
  14562. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex})});
  14563. },
  14564. args: ["anIndex"],
  14565. 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 ]",
  14566. referencedClasses: [],
  14567. pragmas: [],
  14568. messageSends: ["at:ifAbsent:", "errorNotFound"]
  14569. }),
  14570. $globals.TKeyValueCollection);
  14571. $core.addMethod(
  14572. $core.method({
  14573. selector: "at:ifAbsent:",
  14574. protocol: "accessing",
  14575. fn: function (anIndex,aBlock){
  14576. var self=this,$self=this;
  14577. return $core.withContext(function($ctx1) {
  14578. $self._subclassResponsibility();
  14579. return self;
  14580. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock})});
  14581. },
  14582. args: ["anIndex", "aBlock"],
  14583. 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",
  14584. referencedClasses: [],
  14585. pragmas: [],
  14586. messageSends: ["subclassResponsibility"]
  14587. }),
  14588. $globals.TKeyValueCollection);
  14589. $core.addMethod(
  14590. $core.method({
  14591. selector: "at:ifAbsentPut:",
  14592. protocol: "accessing",
  14593. fn: function (aKey,aBlock){
  14594. var self=this,$self=this;
  14595. return $core.withContext(function($ctx1) {
  14596. return $self._at_ifAbsent_(aKey,(function(){
  14597. return $core.withContext(function($ctx2) {
  14598. return $self._at_put_(aKey,$recv(aBlock)._value());
  14599. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14600. }));
  14601. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock})});
  14602. },
  14603. args: ["aKey", "aBlock"],
  14604. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  14605. referencedClasses: [],
  14606. pragmas: [],
  14607. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  14608. }),
  14609. $globals.TKeyValueCollection);
  14610. $core.addMethod(
  14611. $core.method({
  14612. selector: "at:ifPresent:",
  14613. protocol: "accessing",
  14614. fn: function (anIndex,aBlock){
  14615. var self=this,$self=this;
  14616. return $core.withContext(function($ctx1) {
  14617. return $self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  14618. return nil;
  14619. }));
  14620. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock})});
  14621. },
  14622. args: ["anIndex", "aBlock"],
  14623. 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 ]",
  14624. referencedClasses: [],
  14625. pragmas: [],
  14626. messageSends: ["at:ifPresent:ifAbsent:"]
  14627. }),
  14628. $globals.TKeyValueCollection);
  14629. $core.addMethod(
  14630. $core.method({
  14631. selector: "at:ifPresent:ifAbsent:",
  14632. protocol: "accessing",
  14633. fn: function (anIndex,aBlock,anotherBlock){
  14634. var self=this,$self=this;
  14635. return $core.withContext(function($ctx1) {
  14636. $self._subclassResponsibility();
  14637. return self;
  14638. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock})});
  14639. },
  14640. args: ["anIndex", "aBlock", "anotherBlock"],
  14641. 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",
  14642. referencedClasses: [],
  14643. pragmas: [],
  14644. messageSends: ["subclassResponsibility"]
  14645. }),
  14646. $globals.TKeyValueCollection);
  14647. $core.addMethod(
  14648. $core.method({
  14649. selector: "at:put:",
  14650. protocol: "accessing",
  14651. fn: function (anIndex,anObject){
  14652. var self=this,$self=this;
  14653. return $core.withContext(function($ctx1) {
  14654. $self._subclassResponsibility();
  14655. return self;
  14656. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject})});
  14657. },
  14658. args: ["anIndex", "anObject"],
  14659. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  14660. referencedClasses: [],
  14661. pragmas: [],
  14662. messageSends: ["subclassResponsibility"]
  14663. }),
  14664. $globals.TKeyValueCollection);
  14665. $core.addMethod(
  14666. $core.method({
  14667. selector: "indexOf:",
  14668. protocol: "accessing",
  14669. fn: function (anObject){
  14670. var self=this,$self=this;
  14671. return $core.withContext(function($ctx1) {
  14672. return $self._indexOf_ifAbsent_(anObject,(function(){
  14673. return $core.withContext(function($ctx2) {
  14674. return $self._errorNotFound();
  14675. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14676. }));
  14677. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject})});
  14678. },
  14679. args: ["anObject"],
  14680. 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 ]",
  14681. referencedClasses: [],
  14682. pragmas: [],
  14683. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  14684. }),
  14685. $globals.TKeyValueCollection);
  14686. $core.addMethod(
  14687. $core.method({
  14688. selector: "indexOf:ifAbsent:",
  14689. protocol: "accessing",
  14690. fn: function (anObject,aBlock){
  14691. var self=this,$self=this;
  14692. return $core.withContext(function($ctx1) {
  14693. $self._subclassResponsibility();
  14694. return self;
  14695. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  14696. },
  14697. args: ["anObject", "aBlock"],
  14698. 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",
  14699. referencedClasses: [],
  14700. pragmas: [],
  14701. messageSends: ["subclassResponsibility"]
  14702. }),
  14703. $globals.TKeyValueCollection);
  14704. $core.addMethod(
  14705. $core.method({
  14706. selector: "with:do:",
  14707. protocol: "enumerating",
  14708. fn: function (anotherCollection,aBlock){
  14709. var self=this,$self=this;
  14710. return $core.withContext(function($ctx1) {
  14711. $self._withIndexDo_((function(each,index){
  14712. return $core.withContext(function($ctx2) {
  14713. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  14714. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  14715. }));
  14716. return self;
  14717. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock})});
  14718. },
  14719. args: ["anotherCollection", "aBlock"],
  14720. 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) ]",
  14721. referencedClasses: [],
  14722. pragmas: [],
  14723. messageSends: ["withIndexDo:", "value:value:", "at:"]
  14724. }),
  14725. $globals.TKeyValueCollection);
  14726. $core.addMethod(
  14727. $core.method({
  14728. selector: "withIndexDo:",
  14729. protocol: "enumerating",
  14730. fn: function (aBlock){
  14731. var self=this,$self=this;
  14732. return $core.withContext(function($ctx1) {
  14733. $self._subclassResponsibility();
  14734. return self;
  14735. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock})});
  14736. },
  14737. args: ["aBlock"],
  14738. 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",
  14739. referencedClasses: [],
  14740. pragmas: [],
  14741. messageSends: ["subclassResponsibility"]
  14742. }),
  14743. $globals.TKeyValueCollection);
  14744. $core.addTrait("TNativeZeroBasedCollection", "Kernel-Collections");
  14745. $core.addMethod(
  14746. $core.method({
  14747. selector: "at:ifAbsent:",
  14748. protocol: "accessing",
  14749. fn: function (anIndex,aBlock){
  14750. var self=this,$self=this;
  14751. return $core.withContext(function($ctx1) {
  14752. return anIndex >= 1 && anIndex <= self.length
  14753. ? self[anIndex - 1]
  14754. : aBlock._value()
  14755. ;
  14756. return self;
  14757. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock})});
  14758. },
  14759. args: ["anIndex", "aBlock"],
  14760. 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'>",
  14761. referencedClasses: [],
  14762. 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"]]],
  14763. messageSends: []
  14764. }),
  14765. $globals.TNativeZeroBasedCollection);
  14766. $core.addMethod(
  14767. $core.method({
  14768. selector: "at:ifPresent:ifAbsent:",
  14769. protocol: "accessing",
  14770. fn: function (anIndex,aBlock,anotherBlock){
  14771. var self=this,$self=this;
  14772. return $core.withContext(function($ctx1) {
  14773. return anIndex >= 1 && anIndex <= self.length
  14774. ? aBlock._value_(self[anIndex - 1])
  14775. : anotherBlock._value()
  14776. ;
  14777. return self;
  14778. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock})});
  14779. },
  14780. args: ["anIndex", "aBlock", "anotherBlock"],
  14781. 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'>",
  14782. referencedClasses: [],
  14783. 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"]]],
  14784. messageSends: []
  14785. }),
  14786. $globals.TNativeZeroBasedCollection);
  14787. $core.addMethod(
  14788. $core.method({
  14789. selector: "detect:ifNone:",
  14790. protocol: "enumerating",
  14791. fn: function (aBlock,anotherBlock){
  14792. var self=this,$self=this;
  14793. return $core.withContext(function($ctx1) {
  14794. for(var i = 0; i < self.length; i++)
  14795. if(aBlock._value_(self[i]))
  14796. return self[i];
  14797. return anotherBlock._value();
  14798. ;
  14799. return self;
  14800. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  14801. },
  14802. args: ["aBlock", "anotherBlock"],
  14803. 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'>",
  14804. referencedClasses: [],
  14805. 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"]]],
  14806. messageSends: []
  14807. }),
  14808. $globals.TNativeZeroBasedCollection);
  14809. $core.addMethod(
  14810. $core.method({
  14811. selector: "do:",
  14812. protocol: "enumerating",
  14813. fn: function (aBlock){
  14814. var self=this,$self=this;
  14815. return $core.withContext(function($ctx1) {
  14816. for(var i=0; i < self.length; i++) {
  14817. aBlock._value_(self[i]);
  14818. }
  14819. ;
  14820. return self;
  14821. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  14822. },
  14823. args: ["aBlock"],
  14824. 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'>",
  14825. referencedClasses: [],
  14826. pragmas: [["inlineJS:", ["\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_(self[i]);\x0a\x09\x09}\x0a\x09"]]],
  14827. messageSends: []
  14828. }),
  14829. $globals.TNativeZeroBasedCollection);
  14830. $core.addMethod(
  14831. $core.method({
  14832. selector: "indexOf:ifAbsent:",
  14833. protocol: "accessing",
  14834. fn: function (anObject,aBlock){
  14835. var self=this,$self=this;
  14836. return $core.withContext(function($ctx1) {
  14837. for(var i=0; i < self.length; i++) {
  14838. if($recv(self[i]).__eq(anObject)) {return i+1}
  14839. };
  14840. return aBlock._value();
  14841. ;
  14842. return self;
  14843. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  14844. },
  14845. args: ["anObject", "aBlock"],
  14846. 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'>",
  14847. referencedClasses: [],
  14848. 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"]]],
  14849. messageSends: []
  14850. }),
  14851. $globals.TNativeZeroBasedCollection);
  14852. $core.addMethod(
  14853. $core.method({
  14854. selector: "indexOf:startingAt:ifAbsent:",
  14855. protocol: "accessing",
  14856. fn: function (anObject,start,aBlock){
  14857. var self=this,$self=this;
  14858. return $core.withContext(function($ctx1) {
  14859. for(var i=start - 1; i < self.length; i++){
  14860. if($recv(self[i]).__eq(anObject)) {return i+1}
  14861. }
  14862. return aBlock._value();
  14863. ;
  14864. return self;
  14865. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock})});
  14866. },
  14867. args: ["anObject", "start", "aBlock"],
  14868. 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'>",
  14869. referencedClasses: [],
  14870. 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"]]],
  14871. messageSends: []
  14872. }),
  14873. $globals.TNativeZeroBasedCollection);
  14874. $core.addMethod(
  14875. $core.method({
  14876. selector: "single",
  14877. protocol: "accessing",
  14878. fn: function (){
  14879. var self=this,$self=this;
  14880. return $core.withContext(function($ctx1) {
  14881. if (self.length == 0) throw new Error("Collection is empty");
  14882. if (self.length > 1) throw new Error("Collection holds more than one element.");
  14883. return self[0];;
  14884. return self;
  14885. }, function($ctx1) {$ctx1.fill(self,"single",{})});
  14886. },
  14887. args: [],
  14888. 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'>",
  14889. referencedClasses: [],
  14890. 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];"]]],
  14891. messageSends: []
  14892. }),
  14893. $globals.TNativeZeroBasedCollection);
  14894. $core.addMethod(
  14895. $core.method({
  14896. selector: "size",
  14897. protocol: "accessing",
  14898. fn: function (){
  14899. var self=this,$self=this;
  14900. return $core.withContext(function($ctx1) {
  14901. return self.length;
  14902. return self;
  14903. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  14904. },
  14905. args: [],
  14906. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  14907. referencedClasses: [],
  14908. pragmas: [["inlineJS:", ["return self.length"]]],
  14909. messageSends: []
  14910. }),
  14911. $globals.TNativeZeroBasedCollection);
  14912. $core.addMethod(
  14913. $core.method({
  14914. selector: "with:do:",
  14915. protocol: "enumerating",
  14916. fn: function (anotherCollection,aBlock){
  14917. var self=this,$self=this;
  14918. return $core.withContext(function($ctx1) {
  14919. $recv(anotherCollection)._first_(0); // #guardSequenceableCollection
  14920. for(var i=0; i<self.length; i++) {
  14921. aBlock._value_value_(self[i], anotherCollection[i]);
  14922. }
  14923. ;
  14924. return self;
  14925. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock})});
  14926. },
  14927. args: ["anotherCollection", "aBlock"],
  14928. 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'>",
  14929. referencedClasses: [],
  14930. 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"]]],
  14931. messageSends: []
  14932. }),
  14933. $globals.TNativeZeroBasedCollection);
  14934. $core.addMethod(
  14935. $core.method({
  14936. selector: "withIndexDo:",
  14937. protocol: "enumerating",
  14938. fn: function (aBlock){
  14939. var self=this,$self=this;
  14940. return $core.withContext(function($ctx1) {
  14941. for(var i=0; i < self.length; i++) {
  14942. aBlock._value_value_(self[i], i+1);
  14943. }
  14944. ;
  14945. return self;
  14946. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock})});
  14947. },
  14948. args: ["aBlock"],
  14949. 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'>",
  14950. referencedClasses: [],
  14951. 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"]]],
  14952. messageSends: []
  14953. }),
  14954. $globals.TNativeZeroBasedCollection);
  14955. $core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.AssociativeCollection);
  14956. $core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.SequenceableCollection);
  14957. $core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.Array);
  14958. $core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.String);
  14959. });
  14960. 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";
  14961. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  14962. var $pkg = $core.addPackage("Kernel-Classes");
  14963. $pkg.innerEval = function (expr) { return eval(expr); };
  14964. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  14965. $core.addClass("Behavior", $globals.Object, ["organization", "slots", "fn", "superclass"], "Kernel-Classes");
  14966. $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.";
  14967. $core.addMethod(
  14968. $core.method({
  14969. selector: "allInstanceVariableNames",
  14970. protocol: "accessing",
  14971. fn: function (){
  14972. var self=this,$self=this;
  14973. var result;
  14974. return $core.withContext(function($ctx1) {
  14975. var $1,$receiver;
  14976. result=$recv($self._instanceVariableNames())._copy();
  14977. $1=$self._superclass();
  14978. $ctx1.sendIdx["superclass"]=1;
  14979. if(($receiver = $1) == null || $receiver.a$nil){
  14980. $1;
  14981. } else {
  14982. $recv(result)._addAll_($recv($self._superclass())._allInstanceVariableNames());
  14983. }
  14984. return result;
  14985. }, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result})});
  14986. },
  14987. args: [],
  14988. source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09\x09result addAll: self superclass allInstanceVariableNames ].\x0a\x09^ result",
  14989. referencedClasses: [],
  14990. pragmas: [],
  14991. messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "superclass", "addAll:", "allInstanceVariableNames"]
  14992. }),
  14993. $globals.Behavior);
  14994. $core.addMethod(
  14995. $core.method({
  14996. selector: "allSelectors",
  14997. protocol: "accessing",
  14998. fn: function (){
  14999. var self=this,$self=this;
  15000. return $core.withContext(function($ctx1) {
  15001. var $1,$2;
  15002. $1=$self._allSuperclasses();
  15003. $2=$self._selectors();
  15004. $ctx1.sendIdx["selectors"]=1;
  15005. return $recv($1)._inject_into_($2,(function(acc,each){
  15006. return $core.withContext(function($ctx2) {
  15007. $recv(acc)._addAll_($recv(each)._selectors());
  15008. return $recv(acc)._yourself();
  15009. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  15010. }));
  15011. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{})});
  15012. },
  15013. args: [],
  15014. source: "allSelectors\x0a\x09^ self allSuperclasses\x0a\x09\x09inject: self selectors\x0a\x09\x09into: [ :acc :each | acc addAll: each selectors; yourself ]",
  15015. referencedClasses: [],
  15016. pragmas: [],
  15017. messageSends: ["inject:into:", "allSuperclasses", "selectors", "addAll:", "yourself"]
  15018. }),
  15019. $globals.Behavior);
  15020. $core.addMethod(
  15021. $core.method({
  15022. selector: "allSubclasses",
  15023. protocol: "accessing",
  15024. fn: function (){
  15025. var self=this,$self=this;
  15026. return $core.withContext(function($ctx1) {
  15027. return $recv($globals.Array)._streamContents_((function(str){
  15028. return $core.withContext(function($ctx2) {
  15029. return $self._allSubclassesDo_((function(each){
  15030. return $core.withContext(function($ctx3) {
  15031. return $recv(str)._nextPut_(each);
  15032. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  15033. }));
  15034. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  15035. }));
  15036. }, function($ctx1) {$ctx1.fill(self,"allSubclasses",{})});
  15037. },
  15038. args: [],
  15039. 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 ] ]",
  15040. referencedClasses: ["Array"],
  15041. pragmas: [],
  15042. messageSends: ["streamContents:", "allSubclassesDo:", "nextPut:"]
  15043. }),
  15044. $globals.Behavior);
  15045. $core.addMethod(
  15046. $core.method({
  15047. selector: "allSubclassesDo:",
  15048. protocol: "enumerating",
  15049. fn: function (aBlock){
  15050. var self=this,$self=this;
  15051. return $core.withContext(function($ctx1) {
  15052. $core.traverseClassTree(self, function(subclass) {
  15053. if (subclass !== self) aBlock._value_(subclass);
  15054. });
  15055. return self;
  15056. }, function($ctx1) {$ctx1.fill(self,"allSubclassesDo:",{aBlock:aBlock})});
  15057. },
  15058. args: ["aBlock"],
  15059. 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})'>",
  15060. referencedClasses: [],
  15061. pragmas: [["inlineJS:", ["$core.traverseClassTree(self, function(subclass) {\x0a\x09if (subclass !== self) aBlock._value_(subclass);\x0a})"]]],
  15062. messageSends: []
  15063. }),
  15064. $globals.Behavior);
  15065. $core.addMethod(
  15066. $core.method({
  15067. selector: "allSuperclasses",
  15068. protocol: "accessing",
  15069. fn: function (){
  15070. var self=this,$self=this;
  15071. return $core.withContext(function($ctx1) {
  15072. var $1,$3,$2,$receiver;
  15073. $1=$self._superclass();
  15074. $ctx1.sendIdx["superclass"]=1;
  15075. if(($receiver = $1) == null || $receiver.a$nil){
  15076. return [];
  15077. } else {
  15078. $1;
  15079. }
  15080. $3=$self._superclass();
  15081. $ctx1.sendIdx["superclass"]=2;
  15082. $2=$recv($globals.OrderedCollection)._with_($3);
  15083. $recv($2)._addAll_($recv($self._superclass())._allSuperclasses());
  15084. return $recv($2)._yourself();
  15085. }, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{})});
  15086. },
  15087. args: [],
  15088. source: "allSuperclasses\x0a\x09\x0a\x09self superclass ifNil: [ ^ #() ].\x0a\x09\x0a\x09^ (OrderedCollection with: self superclass)\x0a\x09\x09addAll: self superclass allSuperclasses;\x0a\x09\x09yourself",
  15089. referencedClasses: ["OrderedCollection"],
  15090. pragmas: [],
  15091. messageSends: ["ifNil:", "superclass", "addAll:", "with:", "allSuperclasses", "yourself"]
  15092. }),
  15093. $globals.Behavior);
  15094. $core.addMethod(
  15095. $core.method({
  15096. selector: "basicNew",
  15097. protocol: "instance creation",
  15098. fn: function (){
  15099. var self=this,$self=this;
  15100. return $core.withContext(function($ctx1) {
  15101. return new self.fn();
  15102. return self;
  15103. }, function($ctx1) {$ctx1.fill(self,"basicNew",{})});
  15104. },
  15105. args: [],
  15106. source: "basicNew\x0a\x09<inlineJS: 'return new self.fn()'>",
  15107. referencedClasses: [],
  15108. pragmas: [["inlineJS:", ["return new self.fn()"]]],
  15109. messageSends: []
  15110. }),
  15111. $globals.Behavior);
  15112. $core.addMethod(
  15113. $core.method({
  15114. selector: "basicOrganization",
  15115. protocol: "accessing",
  15116. fn: function (){
  15117. var self=this,$self=this;
  15118. return $self.organization;
  15119. },
  15120. args: [],
  15121. source: "basicOrganization\x0a\x09^ organization",
  15122. referencedClasses: [],
  15123. pragmas: [],
  15124. messageSends: []
  15125. }),
  15126. $globals.Behavior);
  15127. $core.addMethod(
  15128. $core.method({
  15129. selector: "basicOrganization:",
  15130. protocol: "accessing",
  15131. fn: function (aClassOrganizer){
  15132. var self=this,$self=this;
  15133. $self.organization=aClassOrganizer;
  15134. return self;
  15135. },
  15136. args: ["aClassOrganizer"],
  15137. source: "basicOrganization: aClassOrganizer\x0a\x09organization := aClassOrganizer",
  15138. referencedClasses: [],
  15139. pragmas: [],
  15140. messageSends: []
  15141. }),
  15142. $globals.Behavior);
  15143. $core.addMethod(
  15144. $core.method({
  15145. selector: "canUnderstand:",
  15146. protocol: "testing",
  15147. fn: function (aSelector){
  15148. var self=this,$self=this;
  15149. return $core.withContext(function($ctx1) {
  15150. var $2,$1;
  15151. return $recv($self._includesSelector_($recv(aSelector)._asString()))._or_((function(){
  15152. return $core.withContext(function($ctx2) {
  15153. $2=$self._superclass();
  15154. $ctx2.sendIdx["superclass"]=1;
  15155. $1=$recv($2)._notNil();
  15156. return $recv($1)._and_((function(){
  15157. return $core.withContext(function($ctx3) {
  15158. return $recv($self._superclass())._canUnderstand_(aSelector);
  15159. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  15160. }));
  15161. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  15162. }));
  15163. }, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector})});
  15164. },
  15165. args: ["aSelector"],
  15166. source: "canUnderstand: aSelector\x0a\x09^ (self includesSelector: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [ self superclass canUnderstand: aSelector ]]",
  15167. referencedClasses: [],
  15168. pragmas: [],
  15169. messageSends: ["or:", "includesSelector:", "asString", "and:", "notNil", "superclass", "canUnderstand:"]
  15170. }),
  15171. $globals.Behavior);
  15172. $core.addMethod(
  15173. $core.method({
  15174. selector: "includesBehavior:",
  15175. protocol: "testing",
  15176. fn: function (aClass){
  15177. var self=this,$self=this;
  15178. return $core.withContext(function($ctx1) {
  15179. return $recv($self.__eq_eq(aClass))._or_((function(){
  15180. return $core.withContext(function($ctx2) {
  15181. return $self._inheritsFrom_(aClass);
  15182. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  15183. }));
  15184. }, function($ctx1) {$ctx1.fill(self,"includesBehavior:",{aClass:aClass})});
  15185. },
  15186. args: ["aClass"],
  15187. source: "includesBehavior: aClass\x0a\x09^ self == aClass or: [\x0a\x09\x09\x09self inheritsFrom: aClass ]",
  15188. referencedClasses: [],
  15189. pragmas: [],
  15190. messageSends: ["or:", "==", "inheritsFrom:"]
  15191. }),
  15192. $globals.Behavior);
  15193. $core.addMethod(
  15194. $core.method({
  15195. selector: "inheritsFrom:",
  15196. protocol: "testing",
  15197. fn: function (aClass){
  15198. var self=this,$self=this;
  15199. return $core.withContext(function($ctx1) {
  15200. var $1,$3,$2,$receiver;
  15201. $1=$self._superclass();
  15202. $ctx1.sendIdx["superclass"]=1;
  15203. if(($receiver = $1) == null || $receiver.a$nil){
  15204. return false;
  15205. } else {
  15206. $1;
  15207. }
  15208. $3=$self._superclass();
  15209. $ctx1.sendIdx["superclass"]=2;
  15210. $2=$recv(aClass).__eq_eq($3);
  15211. return $recv($2)._or_((function(){
  15212. return $core.withContext(function($ctx2) {
  15213. return $recv($self._superclass())._inheritsFrom_(aClass);
  15214. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  15215. }));
  15216. }, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass})});
  15217. },
  15218. args: ["aClass"],
  15219. source: "inheritsFrom: aClass\x0a\x09self superclass ifNil: [ ^ false ].\x0a\x0a\x09^ aClass == self superclass or: [ \x0a\x09\x09self superclass inheritsFrom: aClass ]",
  15220. referencedClasses: [],
  15221. pragmas: [],
  15222. messageSends: ["ifNil:", "superclass", "or:", "==", "inheritsFrom:"]
  15223. }),
  15224. $globals.Behavior);
  15225. $core.addMethod(
  15226. $core.method({
  15227. selector: "instanceVariableNames",
  15228. protocol: "accessing",
  15229. fn: function (){
  15230. var self=this,$self=this;
  15231. return $self.slots;
  15232. },
  15233. args: [],
  15234. source: "instanceVariableNames\x0a\x09^ slots",
  15235. referencedClasses: [],
  15236. pragmas: [],
  15237. messageSends: []
  15238. }),
  15239. $globals.Behavior);
  15240. $core.addMethod(
  15241. $core.method({
  15242. selector: "isBehavior",
  15243. protocol: "testing",
  15244. fn: function (){
  15245. var self=this,$self=this;
  15246. return true;
  15247. },
  15248. args: [],
  15249. source: "isBehavior\x0a\x09^ true",
  15250. referencedClasses: [],
  15251. pragmas: [],
  15252. messageSends: []
  15253. }),
  15254. $globals.Behavior);
  15255. $core.addMethod(
  15256. $core.method({
  15257. selector: "javascriptConstructor",
  15258. protocol: "accessing",
  15259. fn: function (){
  15260. var self=this,$self=this;
  15261. return $self.fn;
  15262. },
  15263. args: [],
  15264. source: "javascriptConstructor\x0a\x09\x22Answer the JS constructor used to instantiate. See kernel-language.js\x22\x0a\x09\x0a\x09^ fn",
  15265. referencedClasses: [],
  15266. pragmas: [],
  15267. messageSends: []
  15268. }),
  15269. $globals.Behavior);
  15270. $core.addMethod(
  15271. $core.method({
  15272. selector: "javascriptConstructor:",
  15273. protocol: "accessing",
  15274. fn: function (aJavaScriptFunction){
  15275. var self=this,$self=this;
  15276. return $core.withContext(function($ctx1) {
  15277. $recv($recv($globals.Smalltalk)._core())._setClassConstructor_to_(self,aJavaScriptFunction);
  15278. return self;
  15279. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor:",{aJavaScriptFunction:aJavaScriptFunction})});
  15280. },
  15281. args: ["aJavaScriptFunction"],
  15282. 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",
  15283. referencedClasses: ["Smalltalk"],
  15284. pragmas: [],
  15285. messageSends: ["setClassConstructor:to:", "core"]
  15286. }),
  15287. $globals.Behavior);
  15288. $core.addMethod(
  15289. $core.method({
  15290. selector: "lookupSelector:",
  15291. protocol: "accessing",
  15292. fn: function (selector){
  15293. var self=this,$self=this;
  15294. var lookupClass;
  15295. return $core.withContext(function($ctx1) {
  15296. var $1;
  15297. var $early={};
  15298. try {
  15299. lookupClass=self;
  15300. $recv((function(){
  15301. return $core.withContext(function($ctx2) {
  15302. return $recv(lookupClass).__eq(nil);
  15303. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  15304. }))._whileFalse_((function(){
  15305. return $core.withContext(function($ctx2) {
  15306. $1=$recv(lookupClass)._includesSelector_(selector);
  15307. if($core.assert($1)){
  15308. throw $early=[$recv(lookupClass)._methodAt_(selector)];
  15309. }
  15310. lookupClass=$recv(lookupClass)._superclass();
  15311. return lookupClass;
  15312. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  15313. }));
  15314. return nil;
  15315. }
  15316. catch(e) {if(e===$early)return e[0]; throw e}
  15317. }, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass})});
  15318. },
  15319. args: ["selector"],
  15320. 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",
  15321. referencedClasses: [],
  15322. pragmas: [],
  15323. messageSends: ["whileFalse:", "=", "ifTrue:", "includesSelector:", "methodAt:", "superclass"]
  15324. }),
  15325. $globals.Behavior);
  15326. $core.addMethod(
  15327. $core.method({
  15328. selector: "new",
  15329. protocol: "instance creation",
  15330. fn: function (){
  15331. var self=this,$self=this;
  15332. return $core.withContext(function($ctx1) {
  15333. return $recv($self._basicNew())._initialize();
  15334. }, function($ctx1) {$ctx1.fill(self,"new",{})});
  15335. },
  15336. args: [],
  15337. source: "new\x0a\x09^ self basicNew initialize",
  15338. referencedClasses: [],
  15339. pragmas: [],
  15340. messageSends: ["initialize", "basicNew"]
  15341. }),
  15342. $globals.Behavior);
  15343. $core.addMethod(
  15344. $core.method({
  15345. selector: "prototype",
  15346. protocol: "accessing",
  15347. fn: function (){
  15348. var self=this,$self=this;
  15349. return $core.withContext(function($ctx1) {
  15350. return $recv($self._javascriptConstructor())._prototype();
  15351. }, function($ctx1) {$ctx1.fill(self,"prototype",{})});
  15352. },
  15353. args: [],
  15354. source: "prototype\x0a\x09^ self javascriptConstructor prototype",
  15355. referencedClasses: [],
  15356. pragmas: [],
  15357. messageSends: ["prototype", "javascriptConstructor"]
  15358. }),
  15359. $globals.Behavior);
  15360. $core.addMethod(
  15361. $core.method({
  15362. selector: "subclasses",
  15363. protocol: "accessing",
  15364. fn: function (){
  15365. var self=this,$self=this;
  15366. return $core.withContext(function($ctx1) {
  15367. $self._subclassResponsibility();
  15368. return self;
  15369. }, function($ctx1) {$ctx1.fill(self,"subclasses",{})});
  15370. },
  15371. args: [],
  15372. source: "subclasses\x0a\x09self subclassResponsibility",
  15373. referencedClasses: [],
  15374. pragmas: [],
  15375. messageSends: ["subclassResponsibility"]
  15376. }),
  15377. $globals.Behavior);
  15378. $core.addMethod(
  15379. $core.method({
  15380. selector: "superclass",
  15381. protocol: "accessing",
  15382. fn: function (){
  15383. var self=this,$self=this;
  15384. return $self.superclass;
  15385. },
  15386. args: [],
  15387. source: "superclass\x0a\x09^ superclass",
  15388. referencedClasses: [],
  15389. pragmas: [],
  15390. messageSends: []
  15391. }),
  15392. $globals.Behavior);
  15393. $core.addMethod(
  15394. $core.method({
  15395. selector: "theMetaClass",
  15396. protocol: "accessing",
  15397. fn: function (){
  15398. var self=this,$self=this;
  15399. return $core.withContext(function($ctx1) {
  15400. $self._subclassResponsibility();
  15401. return self;
  15402. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{})});
  15403. },
  15404. args: [],
  15405. source: "theMetaClass\x0a\x09self subclassResponsibility",
  15406. referencedClasses: [],
  15407. pragmas: [],
  15408. messageSends: ["subclassResponsibility"]
  15409. }),
  15410. $globals.Behavior);
  15411. $core.addMethod(
  15412. $core.method({
  15413. selector: "theNonMetaClass",
  15414. protocol: "accessing",
  15415. fn: function (){
  15416. var self=this,$self=this;
  15417. return $core.withContext(function($ctx1) {
  15418. $self._subclassResponsibility();
  15419. return self;
  15420. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{})});
  15421. },
  15422. args: [],
  15423. source: "theNonMetaClass\x0a\x09self subclassResponsibility",
  15424. referencedClasses: [],
  15425. pragmas: [],
  15426. messageSends: ["subclassResponsibility"]
  15427. }),
  15428. $globals.Behavior);
  15429. $core.addMethod(
  15430. $core.method({
  15431. selector: "withAllSubclasses",
  15432. protocol: "accessing",
  15433. fn: function (){
  15434. var self=this,$self=this;
  15435. return $core.withContext(function($ctx1) {
  15436. var $1;
  15437. $1=$recv($globals.Array)._with_(self);
  15438. $recv($1)._addAll_($self._allSubclasses());
  15439. return $recv($1)._yourself();
  15440. }, function($ctx1) {$ctx1.fill(self,"withAllSubclasses",{})});
  15441. },
  15442. args: [],
  15443. source: "withAllSubclasses\x0a\x09^ (Array with: self) addAll: self allSubclasses; yourself",
  15444. referencedClasses: ["Array"],
  15445. pragmas: [],
  15446. messageSends: ["addAll:", "with:", "allSubclasses", "yourself"]
  15447. }),
  15448. $globals.Behavior);
  15449. $core.addClass("Class", $globals.Behavior, ["package", "subclasses"], "Kernel-Classes");
  15450. $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.";
  15451. $core.addMethod(
  15452. $core.method({
  15453. selector: "basicPackage:",
  15454. protocol: "accessing",
  15455. fn: function (aPackage){
  15456. var self=this,$self=this;
  15457. $self.package=aPackage;
  15458. return self;
  15459. },
  15460. args: ["aPackage"],
  15461. source: "basicPackage: aPackage\x0a\x09package := aPackage",
  15462. referencedClasses: [],
  15463. pragmas: [],
  15464. messageSends: []
  15465. }),
  15466. $globals.Class);
  15467. $core.addMethod(
  15468. $core.method({
  15469. selector: "classTag",
  15470. protocol: "accessing",
  15471. fn: function (){
  15472. var self=this,$self=this;
  15473. return "class";
  15474. },
  15475. args: [],
  15476. 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'",
  15477. referencedClasses: [],
  15478. pragmas: [],
  15479. messageSends: []
  15480. }),
  15481. $globals.Class);
  15482. $core.addMethod(
  15483. $core.method({
  15484. selector: "definition",
  15485. protocol: "accessing",
  15486. fn: function (){
  15487. var self=this,$self=this;
  15488. return $core.withContext(function($ctx1) {
  15489. var $1,$2;
  15490. return $recv($globals.String)._streamContents_((function(stream){
  15491. return $core.withContext(function($ctx2) {
  15492. $recv(stream)._print_($self._superclass());
  15493. $ctx2.sendIdx["print:"]=1;
  15494. $recv(stream)._write_(" subclass: ");
  15495. $ctx2.sendIdx["write:"]=1;
  15496. $recv(stream)._printSymbol_($self._name());
  15497. $recv(stream)._lf();
  15498. $ctx2.sendIdx["lf"]=1;
  15499. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifNotEmpty_((function(tcd){
  15500. return $core.withContext(function($ctx3) {
  15501. $1=$recv($globals.String)._tab();
  15502. $ctx3.sendIdx["tab"]=1;
  15503. $2=$recv($globals.String)._lf();
  15504. $ctx3.sendIdx["lf"]=2;
  15505. return [$1,"uses: ",tcd,$2];
  15506. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,2)});
  15507. })));
  15508. $ctx2.sendIdx["write:"]=2;
  15509. $recv(stream)._tab();
  15510. $ctx2.sendIdx["tab"]=2;
  15511. $recv(stream)._write_(["slots: {",". "._join_($recv($self._instanceVariableNames())._collect_("symbolPrintString")),"}"]);
  15512. $ctx2.sendIdx["write:"]=3;
  15513. $recv(stream)._lf();
  15514. $recv(stream)._tab();
  15515. $recv(stream)._write_("package: ");
  15516. return $recv(stream)._print_($self._category());
  15517. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  15518. }));
  15519. }, function($ctx1) {$ctx1.fill(self,"definition",{})});
  15520. },
  15521. args: [],
  15522. 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 ]",
  15523. referencedClasses: ["String"],
  15524. pragmas: [],
  15525. messageSends: ["streamContents:", "print:", "superclass", "write:", "printSymbol:", "name", "lf", "ifNotEmpty:", "traitCompositionDefinition", "tab", "join:", "collect:", "instanceVariableNames", "category"]
  15526. }),
  15527. $globals.Class);
  15528. $core.addMethod(
  15529. $core.method({
  15530. selector: "includingPossibleMetaDo:",
  15531. protocol: "enumerating",
  15532. fn: function (aBlock){
  15533. var self=this,$self=this;
  15534. return $core.withContext(function($ctx1) {
  15535. $recv(aBlock)._value_(self);
  15536. $ctx1.sendIdx["value:"]=1;
  15537. $recv(aBlock)._value_($self._theMetaClass());
  15538. return self;
  15539. }, function($ctx1) {$ctx1.fill(self,"includingPossibleMetaDo:",{aBlock:aBlock})});
  15540. },
  15541. args: ["aBlock"],
  15542. source: "includingPossibleMetaDo: aBlock\x0a\x0a\x09aBlock value: self.\x0a\x09aBlock value: self theMetaClass",
  15543. referencedClasses: [],
  15544. pragmas: [],
  15545. messageSends: ["value:", "theMetaClass"]
  15546. }),
  15547. $globals.Class);
  15548. $core.addMethod(
  15549. $core.method({
  15550. selector: "isClass",
  15551. protocol: "testing",
  15552. fn: function (){
  15553. var self=this,$self=this;
  15554. return true;
  15555. },
  15556. args: [],
  15557. source: "isClass\x0a\x09^ true",
  15558. referencedClasses: [],
  15559. pragmas: [],
  15560. messageSends: []
  15561. }),
  15562. $globals.Class);
  15563. $core.addMethod(
  15564. $core.method({
  15565. selector: "package",
  15566. protocol: "accessing",
  15567. fn: function (){
  15568. var self=this,$self=this;
  15569. return $self.package;
  15570. },
  15571. args: [],
  15572. source: "package\x0a\x09^ package",
  15573. referencedClasses: [],
  15574. pragmas: [],
  15575. messageSends: []
  15576. }),
  15577. $globals.Class);
  15578. $core.addMethod(
  15579. $core.method({
  15580. selector: "provided",
  15581. protocol: "converting",
  15582. fn: function (){
  15583. var self=this,$self=this;
  15584. return $core.withContext(function($ctx1) {
  15585. return $recv($self._javascriptConstructor())._provided();
  15586. }, function($ctx1) {$ctx1.fill(self,"provided",{})});
  15587. },
  15588. args: [],
  15589. 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",
  15590. referencedClasses: [],
  15591. pragmas: [],
  15592. messageSends: ["provided", "javascriptConstructor"]
  15593. }),
  15594. $globals.Class);
  15595. $core.addMethod(
  15596. $core.method({
  15597. selector: "rename:",
  15598. protocol: "accessing",
  15599. fn: function (aString){
  15600. var self=this,$self=this;
  15601. return $core.withContext(function($ctx1) {
  15602. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(self,aString);
  15603. return self;
  15604. }, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString})});
  15605. },
  15606. args: ["aString"],
  15607. source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
  15608. referencedClasses: ["ClassBuilder"],
  15609. pragmas: [],
  15610. messageSends: ["renameClass:to:", "new"]
  15611. }),
  15612. $globals.Class);
  15613. $core.addMethod(
  15614. $core.method({
  15615. selector: "subclasses",
  15616. protocol: "accessing",
  15617. fn: function (){
  15618. var self=this,$self=this;
  15619. return $core.withContext(function($ctx1) {
  15620. return $recv($self.subclasses)._copy();
  15621. }, function($ctx1) {$ctx1.fill(self,"subclasses",{})});
  15622. },
  15623. args: [],
  15624. source: "subclasses\x0a\x09^ subclasses copy",
  15625. referencedClasses: [],
  15626. pragmas: [],
  15627. messageSends: ["copy"]
  15628. }),
  15629. $globals.Class);
  15630. $core.addMethod(
  15631. $core.method({
  15632. selector: "theMetaClass",
  15633. protocol: "accessing",
  15634. fn: function (){
  15635. var self=this,$self=this;
  15636. return $core.withContext(function($ctx1) {
  15637. return $self._class();
  15638. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{})});
  15639. },
  15640. args: [],
  15641. source: "theMetaClass\x0a\x09^ self class",
  15642. referencedClasses: [],
  15643. pragmas: [],
  15644. messageSends: ["class"]
  15645. }),
  15646. $globals.Class);
  15647. $core.addClass("Metaclass", $globals.Behavior, ["instanceClass"], "Kernel-Classes");
  15648. $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.";
  15649. $core.addMethod(
  15650. $core.method({
  15651. selector: "asJavaScriptSource",
  15652. protocol: "converting",
  15653. fn: function (){
  15654. var self=this,$self=this;
  15655. return $core.withContext(function($ctx1) {
  15656. var $1;
  15657. $1=$recv("$globals.".__comma($recv($self._instanceClass())._name())).__comma(".a$cls");
  15658. $ctx1.sendIdx[","]=1;
  15659. return $1;
  15660. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  15661. },
  15662. args: [],
  15663. source: "asJavaScriptSource\x0a\x09^ '$globals.', self instanceClass name, '.a$cls'",
  15664. referencedClasses: [],
  15665. pragmas: [],
  15666. messageSends: [",", "name", "instanceClass"]
  15667. }),
  15668. $globals.Metaclass);
  15669. $core.addMethod(
  15670. $core.method({
  15671. selector: "definition",
  15672. protocol: "accessing",
  15673. fn: function (){
  15674. var self=this,$self=this;
  15675. return $core.withContext(function($ctx1) {
  15676. var $1,$2;
  15677. return $recv($globals.String)._streamContents_((function(stream){
  15678. return $core.withContext(function($ctx2) {
  15679. $recv(stream)._print_(self);
  15680. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifEmpty_ifNotEmpty_((function(){
  15681. return " ";
  15682. }),(function(tcd){
  15683. return $core.withContext(function($ctx3) {
  15684. $1=$recv($globals.String)._lf();
  15685. $ctx3.sendIdx["lf"]=1;
  15686. $2=$recv($globals.String)._tab();
  15687. $ctx3.sendIdx["tab"]=1;
  15688. return [$1,$2,"uses: ",tcd,$recv($globals.String)._lf(),$recv($globals.String)._tab()];
  15689. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,3)});
  15690. })));
  15691. $ctx2.sendIdx["write:"]=1;
  15692. return $recv(stream)._write_(["slots: {",". "._join_($recv($self._instanceVariableNames())._collect_("symbolPrintString")),"}"]);
  15693. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  15694. }));
  15695. }, function($ctx1) {$ctx1.fill(self,"definition",{})});
  15696. },
  15697. args: [],
  15698. 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)). '}'} ]",
  15699. referencedClasses: ["String"],
  15700. pragmas: [],
  15701. messageSends: ["streamContents:", "print:", "write:", "ifEmpty:ifNotEmpty:", "traitCompositionDefinition", "lf", "tab", "join:", "collect:", "instanceVariableNames"]
  15702. }),
  15703. $globals.Metaclass);
  15704. $core.addMethod(
  15705. $core.method({
  15706. selector: "instanceClass",
  15707. protocol: "accessing",
  15708. fn: function (){
  15709. var self=this,$self=this;
  15710. return $self.instanceClass;
  15711. },
  15712. args: [],
  15713. source: "instanceClass\x0a\x09^ instanceClass",
  15714. referencedClasses: [],
  15715. pragmas: [],
  15716. messageSends: []
  15717. }),
  15718. $globals.Metaclass);
  15719. $core.addMethod(
  15720. $core.method({
  15721. selector: "instanceVariableNames:",
  15722. protocol: "accessing",
  15723. fn: function (aString){
  15724. var self=this,$self=this;
  15725. return $core.withContext(function($ctx1) {
  15726. return $self._slots_($recv(aString)._instanceVariablesStringAsSlotList());
  15727. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aString:aString})});
  15728. },
  15729. args: ["aString"],
  15730. source: "instanceVariableNames: aString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self slots: aString instanceVariablesStringAsSlotList",
  15731. referencedClasses: [],
  15732. pragmas: [],
  15733. messageSends: ["slots:", "instanceVariablesStringAsSlotList"]
  15734. }),
  15735. $globals.Metaclass);
  15736. $core.addMethod(
  15737. $core.method({
  15738. selector: "isMetaclass",
  15739. protocol: "testing",
  15740. fn: function (){
  15741. var self=this,$self=this;
  15742. return true;
  15743. },
  15744. args: [],
  15745. source: "isMetaclass\x0a\x09^ true",
  15746. referencedClasses: [],
  15747. pragmas: [],
  15748. messageSends: []
  15749. }),
  15750. $globals.Metaclass);
  15751. $core.addMethod(
  15752. $core.method({
  15753. selector: "name",
  15754. protocol: "accessing",
  15755. fn: function (){
  15756. var self=this,$self=this;
  15757. return $core.withContext(function($ctx1) {
  15758. return $recv($recv($self._instanceClass())._name()).__comma(" class");
  15759. }, function($ctx1) {$ctx1.fill(self,"name",{})});
  15760. },
  15761. args: [],
  15762. source: "name\x0a\x09^ self instanceClass name, ' class'",
  15763. referencedClasses: [],
  15764. pragmas: [],
  15765. messageSends: [",", "name", "instanceClass"]
  15766. }),
  15767. $globals.Metaclass);
  15768. $core.addMethod(
  15769. $core.method({
  15770. selector: "package",
  15771. protocol: "accessing",
  15772. fn: function (){
  15773. var self=this,$self=this;
  15774. return $core.withContext(function($ctx1) {
  15775. return $recv($self._instanceClass())._package();
  15776. }, function($ctx1) {$ctx1.fill(self,"package",{})});
  15777. },
  15778. args: [],
  15779. source: "package\x0a\x09^ self instanceClass package",
  15780. referencedClasses: [],
  15781. pragmas: [],
  15782. messageSends: ["package", "instanceClass"]
  15783. }),
  15784. $globals.Metaclass);
  15785. $core.addMethod(
  15786. $core.method({
  15787. selector: "slots:",
  15788. protocol: "accessing",
  15789. fn: function (aCollection){
  15790. var self=this,$self=this;
  15791. return $core.withContext(function($ctx1) {
  15792. $recv($recv($globals.ClassBuilder)._new())._class_slots_(self,aCollection);
  15793. return self;
  15794. }, function($ctx1) {$ctx1.fill(self,"slots:",{aCollection:aCollection})});
  15795. },
  15796. args: ["aCollection"],
  15797. source: "slots: aCollection\x0a\x09ClassBuilder new\x0a\x09\x09class: self slots: aCollection.\x0a\x09^ self",
  15798. referencedClasses: ["ClassBuilder"],
  15799. pragmas: [],
  15800. messageSends: ["class:slots:", "new"]
  15801. }),
  15802. $globals.Metaclass);
  15803. $core.addMethod(
  15804. $core.method({
  15805. selector: "subclasses",
  15806. protocol: "accessing",
  15807. fn: function (){
  15808. var self=this,$self=this;
  15809. return $core.withContext(function($ctx1) {
  15810. return $recv($recv($globals.Smalltalk)._core())._metaSubclasses_(self);
  15811. }, function($ctx1) {$ctx1.fill(self,"subclasses",{})});
  15812. },
  15813. args: [],
  15814. source: "subclasses\x0a\x09^ Smalltalk core metaSubclasses: self",
  15815. referencedClasses: ["Smalltalk"],
  15816. pragmas: [],
  15817. messageSends: ["metaSubclasses:", "core"]
  15818. }),
  15819. $globals.Metaclass);
  15820. $core.addMethod(
  15821. $core.method({
  15822. selector: "theMetaClass",
  15823. protocol: "accessing",
  15824. fn: function (){
  15825. var self=this,$self=this;
  15826. return self;
  15827. },
  15828. args: [],
  15829. source: "theMetaClass\x0a\x09^ self",
  15830. referencedClasses: [],
  15831. pragmas: [],
  15832. messageSends: []
  15833. }),
  15834. $globals.Metaclass);
  15835. $core.addMethod(
  15836. $core.method({
  15837. selector: "theNonMetaClass",
  15838. protocol: "accessing",
  15839. fn: function (){
  15840. var self=this,$self=this;
  15841. return $core.withContext(function($ctx1) {
  15842. return $self._instanceClass();
  15843. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{})});
  15844. },
  15845. args: [],
  15846. source: "theNonMetaClass\x0a\x09^ self instanceClass",
  15847. referencedClasses: [],
  15848. pragmas: [],
  15849. messageSends: ["instanceClass"]
  15850. }),
  15851. $globals.Metaclass);
  15852. $core.addMethod(
  15853. $core.method({
  15854. selector: "uses:instanceVariableNames:",
  15855. protocol: "accessing",
  15856. fn: function (aTraitCompositionDescription,aString){
  15857. var self=this,$self=this;
  15858. return $core.withContext(function($ctx1) {
  15859. return $self._uses_slots_(aTraitCompositionDescription,$recv(aString)._instanceVariablesStringAsSlotList());
  15860. }, function($ctx1) {$ctx1.fill(self,"uses:instanceVariableNames:",{aTraitCompositionDescription:aTraitCompositionDescription,aString:aString})});
  15861. },
  15862. args: ["aTraitCompositionDescription", "aString"],
  15863. source: "uses: aTraitCompositionDescription instanceVariableNames: aString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self uses: aTraitCompositionDescription slots: aString instanceVariablesStringAsSlotList",
  15864. referencedClasses: [],
  15865. pragmas: [],
  15866. messageSends: ["uses:slots:", "instanceVariablesStringAsSlotList"]
  15867. }),
  15868. $globals.Metaclass);
  15869. $core.addMethod(
  15870. $core.method({
  15871. selector: "uses:slots:",
  15872. protocol: "accessing",
  15873. fn: function (aTraitCompositionDescription,aCollection){
  15874. var self=this,$self=this;
  15875. return $core.withContext(function($ctx1) {
  15876. $self._slots_(aCollection);
  15877. $self._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  15878. return self;
  15879. }, function($ctx1) {$ctx1.fill(self,"uses:slots:",{aTraitCompositionDescription:aTraitCompositionDescription,aCollection:aCollection})});
  15880. },
  15881. args: ["aTraitCompositionDescription", "aCollection"],
  15882. source: "uses: aTraitCompositionDescription slots: aCollection\x0a\x09self\x0a\x09\x09slots: aCollection;\x0a\x09\x09setTraitComposition: aTraitCompositionDescription asTraitComposition.\x0a\x09^ self",
  15883. referencedClasses: [],
  15884. pragmas: [],
  15885. messageSends: ["slots:", "setTraitComposition:", "asTraitComposition"]
  15886. }),
  15887. $globals.Metaclass);
  15888. $core.addClass("ClassBuilder", $globals.Object, [], "Kernel-Classes");
  15889. $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:`.";
  15890. $core.addMethod(
  15891. $core.method({
  15892. selector: "addSubclassOf:named:instanceVariableNames:package:",
  15893. protocol: "class definition",
  15894. fn: function (aClass,className,aCollection,packageName){
  15895. var self=this,$self=this;
  15896. var theClass,thePackage;
  15897. return $core.withContext(function($ctx1) {
  15898. var $1,$2,$3,$receiver;
  15899. theClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  15900. thePackage=$recv($globals.Package)._named_(packageName);
  15901. $1=theClass;
  15902. if(($receiver = $1) == null || $receiver.a$nil){
  15903. $1;
  15904. } else {
  15905. $recv(theClass)._package_(thePackage);
  15906. $2=$recv($recv(theClass)._superclass()).__eq_eq(aClass);
  15907. if(!$core.assert($2)){
  15908. return $self._migrateClassNamed_superclass_instanceVariableNames_package_(className,aClass,aCollection,packageName);
  15909. }
  15910. }
  15911. $3=$self._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,className,aCollection,packageName);
  15912. $recv($3)._recompile();
  15913. return $recv($3)._yourself();
  15914. }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,theClass:theClass,thePackage:thePackage})});
  15915. },
  15916. args: ["aClass", "className", "aCollection", "packageName"],
  15917. 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",
  15918. referencedClasses: ["Smalltalk", "Package"],
  15919. pragmas: [],
  15920. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "ifFalse:", "==", "superclass", "migrateClassNamed:superclass:instanceVariableNames:package:", "recompile", "basicAddSubclassOf:named:instanceVariableNames:package:", "yourself"]
  15921. }),
  15922. $globals.ClassBuilder);
  15923. $core.addMethod(
  15924. $core.method({
  15925. selector: "addTraitNamed:package:",
  15926. protocol: "class definition",
  15927. fn: function (traitName,packageName){
  15928. var self=this,$self=this;
  15929. var theTrait,thePackage;
  15930. return $core.withContext(function($ctx1) {
  15931. var $1,$2,$receiver;
  15932. theTrait=$recv($recv($globals.Smalltalk)._globals())._at_(traitName);
  15933. thePackage=$recv($globals.Package)._named_(packageName);
  15934. $1=theTrait;
  15935. if(($receiver = $1) == null || $receiver.a$nil){
  15936. $1;
  15937. } else {
  15938. $2=theTrait;
  15939. $recv($2)._package_(thePackage);
  15940. $recv($2)._recompile();
  15941. return $recv($2)._yourself();
  15942. }
  15943. return $self._basicAddTraitNamed_package_(traitName,packageName);
  15944. }, function($ctx1) {$ctx1.fill(self,"addTraitNamed:package:",{traitName:traitName,packageName:packageName,theTrait:theTrait,thePackage:thePackage})});
  15945. },
  15946. args: ["traitName", "packageName"],
  15947. 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",
  15948. referencedClasses: ["Smalltalk", "Package"],
  15949. pragmas: [],
  15950. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "recompile", "yourself", "basicAddTraitNamed:package:"]
  15951. }),
  15952. $globals.ClassBuilder);
  15953. $core.addMethod(
  15954. $core.method({
  15955. selector: "basicAddSubclassOf:named:instanceVariableNames:package:",
  15956. protocol: "private",
  15957. fn: function (aClass,aString,aCollection,packageName){
  15958. var self=this,$self=this;
  15959. return $core.withContext(function($ctx1) {
  15960. return $core.addClass(aString, aClass, aCollection, packageName);
  15961. ;
  15962. return self;
  15963. }, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName})});
  15964. },
  15965. args: ["aClass", "aString", "aCollection", "packageName"],
  15966. source: "basicAddSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a\x09<inlineJS: '\x0a\x09\x09return $core.addClass(aString, aClass, aCollection, packageName);\x0a\x09'>",
  15967. referencedClasses: [],
  15968. pragmas: [["inlineJS:", ["\x0a\x09\x09return $core.addClass(aString, aClass, aCollection, packageName);\x0a\x09"]]],
  15969. messageSends: []
  15970. }),
  15971. $globals.ClassBuilder);
  15972. $core.addMethod(
  15973. $core.method({
  15974. selector: "basicAddTraitNamed:package:",
  15975. protocol: "private",
  15976. fn: function (aString,anotherString){
  15977. var self=this,$self=this;
  15978. return $core.withContext(function($ctx1) {
  15979. return $core.addTrait(aString, anotherString);
  15980. return self;
  15981. }, function($ctx1) {$ctx1.fill(self,"basicAddTraitNamed:package:",{aString:aString,anotherString:anotherString})});
  15982. },
  15983. args: ["aString", "anotherString"],
  15984. source: "basicAddTraitNamed: aString package: anotherString\x0a\x09<inlineJS: 'return $core.addTrait(aString, anotherString)'>",
  15985. referencedClasses: [],
  15986. pragmas: [["inlineJS:", ["return $core.addTrait(aString, anotherString)"]]],
  15987. messageSends: []
  15988. }),
  15989. $globals.ClassBuilder);
  15990. $core.addMethod(
  15991. $core.method({
  15992. selector: "basicClass:instanceVariables:",
  15993. protocol: "private",
  15994. fn: function (aClass,aCollection){
  15995. var self=this,$self=this;
  15996. return $core.withContext(function($ctx1) {
  15997. var $1;
  15998. $1=$recv(aClass)._isMetaclass();
  15999. if(!$core.assert($1)){
  16000. $self._error_($recv($recv(aClass)._name()).__comma(" is not a metaclass"));
  16001. }
  16002. $recv($recv($globals.Smalltalk)._core())._setSlots_to_(aClass,aCollection);
  16003. return self;
  16004. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariables:",{aClass:aClass,aCollection:aCollection})});
  16005. },
  16006. args: ["aClass", "aCollection"],
  16007. 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",
  16008. referencedClasses: ["Smalltalk"],
  16009. pragmas: [],
  16010. messageSends: ["ifFalse:", "isMetaclass", "error:", ",", "name", "setSlots:to:", "core"]
  16011. }),
  16012. $globals.ClassBuilder);
  16013. $core.addMethod(
  16014. $core.method({
  16015. selector: "basicRemoveClass:",
  16016. protocol: "private",
  16017. fn: function (aClass){
  16018. var self=this,$self=this;
  16019. return $core.withContext(function($ctx1) {
  16020. $core.removeClass(aClass);
  16021. return self;
  16022. }, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass})});
  16023. },
  16024. args: ["aClass"],
  16025. source: "basicRemoveClass: aClass\x0a\x09<inlineJS: '$core.removeClass(aClass)'>",
  16026. referencedClasses: [],
  16027. pragmas: [["inlineJS:", ["$core.removeClass(aClass)"]]],
  16028. messageSends: []
  16029. }),
  16030. $globals.ClassBuilder);
  16031. $core.addMethod(
  16032. $core.method({
  16033. selector: "basicRenameClass:to:",
  16034. protocol: "private",
  16035. fn: function (aClass,aString){
  16036. var self=this,$self=this;
  16037. return $core.withContext(function($ctx1) {
  16038. $globals[aString] = aClass;
  16039. delete $globals[aClass.name];
  16040. aClass.name = aString;
  16041. ;
  16042. return self;
  16043. }, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString})});
  16044. },
  16045. args: ["aClass", "aString"],
  16046. 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'>",
  16047. referencedClasses: [],
  16048. pragmas: [["inlineJS:", ["\x0a\x09\x09$globals[aString] = aClass;\x0a\x09\x09delete $globals[aClass.name];\x0a\x09\x09aClass.name = aString;\x0a\x09"]]],
  16049. messageSends: []
  16050. }),
  16051. $globals.ClassBuilder);
  16052. $core.addMethod(
  16053. $core.method({
  16054. selector: "basicSwapClassNames:with:",
  16055. protocol: "private",
  16056. fn: function (aClass,anotherClass){
  16057. var self=this,$self=this;
  16058. return $core.withContext(function($ctx1) {
  16059. var tmp = aClass.name;
  16060. aClass.name = anotherClass.name;
  16061. anotherClass.name = tmp;
  16062. ;
  16063. return self;
  16064. }, function($ctx1) {$ctx1.fill(self,"basicSwapClassNames:with:",{aClass:aClass,anotherClass:anotherClass})});
  16065. },
  16066. args: ["aClass", "anotherClass"],
  16067. 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'>",
  16068. referencedClasses: [],
  16069. pragmas: [["inlineJS:", ["\x0a\x09\x09var tmp = aClass.name;\x0a\x09\x09aClass.name = anotherClass.name;\x0a\x09\x09anotherClass.name = tmp;\x0a\x09"]]],
  16070. messageSends: []
  16071. }),
  16072. $globals.ClassBuilder);
  16073. $core.addMethod(
  16074. $core.method({
  16075. selector: "class:slots:",
  16076. protocol: "class definition",
  16077. fn: function (aClass,aCollection){
  16078. var self=this,$self=this;
  16079. return $core.withContext(function($ctx1) {
  16080. var $1,$3,$2;
  16081. $self._basicClass_instanceVariables_(aClass,aCollection);
  16082. $1=$recv($globals.SystemAnnouncer)._current();
  16083. $3=$recv($globals.ClassDefinitionChanged)._new();
  16084. $recv($3)._theClass_(aClass);
  16085. $2=$recv($3)._yourself();
  16086. $recv($1)._announce_($2);
  16087. return self;
  16088. }, function($ctx1) {$ctx1.fill(self,"class:slots:",{aClass:aClass,aCollection:aCollection})});
  16089. },
  16090. args: ["aClass", "aCollection"],
  16091. 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)",
  16092. referencedClasses: ["SystemAnnouncer", "ClassDefinitionChanged"],
  16093. pragmas: [],
  16094. messageSends: ["basicClass:instanceVariables:", "announce:", "current", "theClass:", "new", "yourself"]
  16095. }),
  16096. $globals.ClassBuilder);
  16097. $core.addMethod(
  16098. $core.method({
  16099. selector: "copyClass:named:",
  16100. protocol: "copying",
  16101. fn: function (aClass,className){
  16102. var self=this,$self=this;
  16103. var newClass;
  16104. return $core.withContext(function($ctx1) {
  16105. var $1,$3,$2;
  16106. newClass=$self._addSubclassOf_named_instanceVariableNames_package_($recv(aClass)._superclass(),className,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  16107. $self._copyClass_to_(aClass,newClass);
  16108. $1=$recv($globals.SystemAnnouncer)._current();
  16109. $3=$recv($globals.ClassAdded)._new();
  16110. $recv($3)._theClass_(newClass);
  16111. $2=$recv($3)._yourself();
  16112. $recv($1)._announce_($2);
  16113. return newClass;
  16114. }, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,className:className,newClass:newClass})});
  16115. },
  16116. args: ["aClass", "className"],
  16117. 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",
  16118. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  16119. pragmas: [],
  16120. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "copyClass:to:", "announce:", "current", "theClass:", "new", "yourself"]
  16121. }),
  16122. $globals.ClassBuilder);
  16123. $core.addMethod(
  16124. $core.method({
  16125. selector: "copyClass:to:",
  16126. protocol: "copying",
  16127. fn: function (aClass,anotherClass){
  16128. var self=this,$self=this;
  16129. return $core.withContext(function($ctx1) {
  16130. var $1,$3,$2,$4,$5,$6,$7,$8,$10,$9,$12,$11,$14,$15,$13,$16,$17,$18,$19;
  16131. $recv(anotherClass)._comment_($recv(aClass)._comment());
  16132. $1=$recv(aClass)._methodDictionary();
  16133. $ctx1.sendIdx["methodDictionary"]=1;
  16134. $recv($1)._valuesDo_((function(each){
  16135. return $core.withContext(function($ctx2) {
  16136. $3=$recv(each)._origin();
  16137. $ctx2.sendIdx["origin"]=1;
  16138. $2=$recv($3).__eq(aClass);
  16139. $ctx2.sendIdx["="]=1;
  16140. if($core.assert($2)){
  16141. $4=$recv($globals.Compiler)._new();
  16142. $ctx2.sendIdx["new"]=1;
  16143. $5=$recv(each)._source();
  16144. $ctx2.sendIdx["source"]=1;
  16145. $6=$recv(each)._protocol();
  16146. $ctx2.sendIdx["protocol"]=1;
  16147. return $recv($4)._install_forClass_protocol_($5,anotherClass,$6);
  16148. $ctx2.sendIdx["install:forClass:protocol:"]=1;
  16149. }
  16150. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16151. }));
  16152. $ctx1.sendIdx["valuesDo:"]=1;
  16153. $7=$recv(aClass)._traitComposition();
  16154. $ctx1.sendIdx["traitComposition"]=1;
  16155. $recv(anotherClass)._setTraitComposition_($7);
  16156. $ctx1.sendIdx["setTraitComposition:"]=1;
  16157. $8=$recv(anotherClass)._class();
  16158. $ctx1.sendIdx["class"]=1;
  16159. $10=$recv(aClass)._class();
  16160. $ctx1.sendIdx["class"]=2;
  16161. $9=$recv($10)._instanceVariableNames();
  16162. $self._basicClass_instanceVariables_($8,$9);
  16163. $12=$recv(aClass)._class();
  16164. $ctx1.sendIdx["class"]=3;
  16165. $11=$recv($12)._methodDictionary();
  16166. $recv($11)._valuesDo_((function(each){
  16167. return $core.withContext(function($ctx2) {
  16168. $14=$recv(each)._origin();
  16169. $15=$recv(aClass)._class();
  16170. $ctx2.sendIdx["class"]=4;
  16171. $13=$recv($14).__eq($15);
  16172. if($core.assert($13)){
  16173. $16=$recv($globals.Compiler)._new();
  16174. $17=$recv(each)._source();
  16175. $18=$recv(anotherClass)._class();
  16176. $ctx2.sendIdx["class"]=5;
  16177. return $recv($16)._install_forClass_protocol_($17,$18,$recv(each)._protocol());
  16178. }
  16179. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  16180. }));
  16181. $19=$recv(anotherClass)._class();
  16182. $ctx1.sendIdx["class"]=6;
  16183. $recv($19)._setTraitComposition_($recv($recv(aClass)._class())._traitComposition());
  16184. return self;
  16185. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass})});
  16186. },
  16187. args: ["aClass", "anotherClass"],
  16188. 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",
  16189. referencedClasses: ["Compiler"],
  16190. pragmas: [],
  16191. messageSends: ["comment:", "comment", "valuesDo:", "methodDictionary", "ifTrue:", "=", "origin", "install:forClass:protocol:", "new", "source", "protocol", "setTraitComposition:", "traitComposition", "basicClass:instanceVariables:", "class", "instanceVariableNames"]
  16192. }),
  16193. $globals.ClassBuilder);
  16194. $core.addMethod(
  16195. $core.method({
  16196. selector: "migrateClass:superclass:",
  16197. protocol: "class migration",
  16198. fn: function (aClass,anotherClass){
  16199. var self=this,$self=this;
  16200. return $core.withContext(function($ctx1) {
  16201. var $1;
  16202. $1=$recv(aClass)._name();
  16203. $ctx1.sendIdx["name"]=1;
  16204. return $self._migrateClassNamed_superclass_instanceVariableNames_package_($1,anotherClass,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  16205. }, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass})});
  16206. },
  16207. args: ["aClass", "anotherClass"],
  16208. 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",
  16209. referencedClasses: [],
  16210. pragmas: [],
  16211. messageSends: ["migrateClassNamed:superclass:instanceVariableNames:package:", "name", "instanceVariableNames", "package"]
  16212. }),
  16213. $globals.ClassBuilder);
  16214. $core.addMethod(
  16215. $core.method({
  16216. selector: "migrateClassNamed:superclass:instanceVariableNames:package:",
  16217. protocol: "class migration",
  16218. fn: function (className,aClass,aCollection,packageName){
  16219. var self=this,$self=this;
  16220. var oldClass,newClass,tmp;
  16221. return $core.withContext(function($ctx1) {
  16222. var $1,$3,$2;
  16223. tmp="new*".__comma(className);
  16224. oldClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  16225. newClass=$self._addSubclassOf_named_instanceVariableNames_package_(aClass,tmp,aCollection,packageName);
  16226. $self._basicSwapClassNames_with_(oldClass,newClass);
  16227. $ctx1.sendIdx["basicSwapClassNames:with:"]=1;
  16228. $recv((function(){
  16229. return $core.withContext(function($ctx2) {
  16230. return $self._copyClass_to_(oldClass,newClass);
  16231. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  16232. }))._on_do_($globals.Error,(function(exception){
  16233. return $core.withContext(function($ctx2) {
  16234. $self._basicSwapClassNames_with_(oldClass,newClass);
  16235. $self._basicRemoveClass_(newClass);
  16236. $ctx2.sendIdx["basicRemoveClass:"]=1;
  16237. return $recv(exception)._pass();
  16238. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,2)});
  16239. }));
  16240. $self._rawRenameClass_to_(oldClass,tmp);
  16241. $ctx1.sendIdx["rawRenameClass:to:"]=1;
  16242. $self._rawRenameClass_to_(newClass,className);
  16243. $recv($recv(oldClass)._subclasses())._do_((function(each){
  16244. return $core.withContext(function($ctx2) {
  16245. return $self._migrateClass_superclass_(each,newClass);
  16246. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  16247. }));
  16248. $self._basicRemoveClass_(oldClass);
  16249. $1=$recv($globals.SystemAnnouncer)._current();
  16250. $3=$recv($globals.ClassMigrated)._new();
  16251. $recv($3)._theClass_(newClass);
  16252. $recv($3)._oldClass_(oldClass);
  16253. $2=$recv($3)._yourself();
  16254. $recv($1)._announce_($2);
  16255. return newClass;
  16256. }, function($ctx1) {$ctx1.fill(self,"migrateClassNamed:superclass:instanceVariableNames:package:",{className:className,aClass:aClass,aCollection:aCollection,packageName:packageName,oldClass:oldClass,newClass:newClass,tmp:tmp})});
  16257. },
  16258. args: ["className", "aClass", "aCollection", "packageName"],
  16259. 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",
  16260. referencedClasses: ["Smalltalk", "Error", "SystemAnnouncer", "ClassMigrated"],
  16261. pragmas: [],
  16262. 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"]
  16263. }),
  16264. $globals.ClassBuilder);
  16265. $core.addMethod(
  16266. $core.method({
  16267. selector: "rawRenameClass:to:",
  16268. protocol: "private",
  16269. fn: function (aClass,aString){
  16270. var self=this,$self=this;
  16271. return $core.withContext(function($ctx1) {
  16272. $globals[aString] = aClass;
  16273. ;
  16274. return self;
  16275. }, function($ctx1) {$ctx1.fill(self,"rawRenameClass:to:",{aClass:aClass,aString:aString})});
  16276. },
  16277. args: ["aClass", "aString"],
  16278. source: "rawRenameClass: aClass to: aString\x0a\x09<inlineJS: '\x0a\x09\x09$globals[aString] = aClass;\x0a\x09'>",
  16279. referencedClasses: [],
  16280. pragmas: [["inlineJS:", ["\x0a\x09\x09$globals[aString] = aClass;\x0a\x09"]]],
  16281. messageSends: []
  16282. }),
  16283. $globals.ClassBuilder);
  16284. $core.addMethod(
  16285. $core.method({
  16286. selector: "renameClass:to:",
  16287. protocol: "class migration",
  16288. fn: function (aClass,className){
  16289. var self=this,$self=this;
  16290. return $core.withContext(function($ctx1) {
  16291. var $1,$3,$2;
  16292. $self._basicRenameClass_to_(aClass,className);
  16293. $recv(aClass)._recompile();
  16294. $1=$recv($globals.SystemAnnouncer)._current();
  16295. $3=$recv($globals.ClassRenamed)._new();
  16296. $recv($3)._theClass_(aClass);
  16297. $2=$recv($3)._yourself();
  16298. $recv($1)._announce_($2);
  16299. return self;
  16300. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,className:className})});
  16301. },
  16302. args: ["aClass", "className"],
  16303. 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)",
  16304. referencedClasses: ["SystemAnnouncer", "ClassRenamed"],
  16305. pragmas: [],
  16306. messageSends: ["basicRenameClass:to:", "recompile", "announce:", "current", "theClass:", "new", "yourself"]
  16307. }),
  16308. $globals.ClassBuilder);
  16309. $core.addMethod(
  16310. $core.method({
  16311. selector: "superclass:subclass:",
  16312. protocol: "class definition",
  16313. fn: function (aClass,className){
  16314. var self=this,$self=this;
  16315. return $core.withContext(function($ctx1) {
  16316. return $self._superclass_subclass_slots_package_(aClass,className,[],nil);
  16317. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,className:className})});
  16318. },
  16319. args: ["aClass", "className"],
  16320. source: "superclass: aClass subclass: className\x0a\x09^ self superclass: aClass subclass: className slots: #() package: nil",
  16321. referencedClasses: [],
  16322. pragmas: [],
  16323. messageSends: ["superclass:subclass:slots:package:"]
  16324. }),
  16325. $globals.ClassBuilder);
  16326. $core.addMethod(
  16327. $core.method({
  16328. selector: "superclass:subclass:slots:package:",
  16329. protocol: "class definition",
  16330. fn: function (aClass,className,aCollection,packageName){
  16331. var self=this,$self=this;
  16332. var newClass;
  16333. return $core.withContext(function($ctx1) {
  16334. var $1,$2,$4,$3,$receiver;
  16335. if(($receiver = packageName) == null || $receiver.a$nil){
  16336. $1="unclassified";
  16337. } else {
  16338. $1=packageName;
  16339. }
  16340. newClass=$self._addSubclassOf_named_instanceVariableNames_package_(aClass,className,aCollection,$1);
  16341. $2=$recv($globals.SystemAnnouncer)._current();
  16342. $4=$recv($globals.ClassAdded)._new();
  16343. $recv($4)._theClass_(newClass);
  16344. $3=$recv($4)._yourself();
  16345. $recv($2)._announce_($3);
  16346. return newClass;
  16347. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:slots:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,newClass:newClass})});
  16348. },
  16349. args: ["aClass", "className", "aCollection", "packageName"],
  16350. 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",
  16351. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  16352. pragmas: [],
  16353. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "ifNil:", "announce:", "current", "theClass:", "new", "yourself"]
  16354. }),
  16355. $globals.ClassBuilder);
  16356. $core.addMethod(
  16357. $core.method({
  16358. selector: "sortClasses:",
  16359. protocol: "as yet unclassified",
  16360. fn: function (aCollection){
  16361. var self=this,$self=this;
  16362. var root,members;
  16363. return $core.withContext(function($ctx1) {
  16364. var $1,$2,$3,$4,$5,$7,$6,$8,$receiver;
  16365. root=[nil,[]];
  16366. members=$recv($globals.HashedCollection)._new();
  16367. $recv(aCollection)._do_((function(each){
  16368. return $core.withContext(function($ctx2) {
  16369. $1=members;
  16370. $2=$recv(each)._name();
  16371. $ctx2.sendIdx["name"]=1;
  16372. return $recv($1)._at_put_($2,[each,[]]);
  16373. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16374. }));
  16375. $ctx1.sendIdx["do:"]=1;
  16376. $recv($recv($recv(aCollection)._asArray())._sorted_((function(a,b){
  16377. return $core.withContext(function($ctx2) {
  16378. $3=$recv(a)._name();
  16379. $ctx2.sendIdx["name"]=2;
  16380. $4=$recv(b)._name();
  16381. $ctx2.sendIdx["name"]=3;
  16382. return $recv($3).__lt_eq($4);
  16383. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)});
  16384. })))._do_((function(each){
  16385. var target;
  16386. return $core.withContext(function($ctx2) {
  16387. $5=members;
  16388. $7=$recv(each)._superclass();
  16389. if(($receiver = $7) == null || $receiver.a$nil){
  16390. $6=$7;
  16391. } else {
  16392. var superklass;
  16393. superklass=$receiver;
  16394. $6=$recv(superklass)._name();
  16395. $ctx2.sendIdx["name"]=4;
  16396. }
  16397. target=$recv($5)._at_ifAbsent_($6,(function(){
  16398. return root;
  16399. }));
  16400. $8=$recv(target)._second();
  16401. $ctx2.sendIdx["second"]=1;
  16402. return $recv($8)._add_($recv(members)._at_($recv(each)._name()));
  16403. }, function($ctx2) {$ctx2.fillBlock({each:each,target:target},$ctx1,3)});
  16404. }));
  16405. return $recv(root)._second();
  16406. }, function($ctx1) {$ctx1.fill(self,"sortClasses:",{aCollection:aCollection,root:root,members:members})});
  16407. },
  16408. args: ["aCollection"],
  16409. 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",
  16410. referencedClasses: ["HashedCollection"],
  16411. pragmas: [],
  16412. messageSends: ["new", "do:", "at:put:", "name", "sorted:", "asArray", "<=", "at:ifAbsent:", "ifNotNil:", "superclass", "add:", "second", "at:"]
  16413. }),
  16414. $globals.ClassBuilder.a$cls);
  16415. $core.addTrait("TBehaviorDefaults", "Kernel-Classes");
  16416. $core.addMethod(
  16417. $core.method({
  16418. selector: "allInstanceVariableNames",
  16419. protocol: "accessing",
  16420. fn: function (){
  16421. var self=this,$self=this;
  16422. return [];
  16423. },
  16424. args: [],
  16425. source: "allInstanceVariableNames\x0a\x09\x22Default for non-classes; to be able to send #allInstanceVariableNames to any class / trait.\x22\x0a\x09^ #()",
  16426. referencedClasses: [],
  16427. pragmas: [],
  16428. messageSends: []
  16429. }),
  16430. $globals.TBehaviorDefaults);
  16431. $core.addMethod(
  16432. $core.method({
  16433. selector: "allSubclassesDo:",
  16434. protocol: "enumerating",
  16435. fn: function (aBlock){
  16436. var self=this,$self=this;
  16437. return self;
  16438. },
  16439. args: ["aBlock"],
  16440. source: "allSubclassesDo: aBlock\x0a\x09\x22Default for non-classes; to be able to send #allSubclassesDo: to any class / trait.\x22",
  16441. referencedClasses: [],
  16442. pragmas: [],
  16443. messageSends: []
  16444. }),
  16445. $globals.TBehaviorDefaults);
  16446. $core.addMethod(
  16447. $core.method({
  16448. selector: "includingPossibleMetaDo:",
  16449. protocol: "enumerating",
  16450. fn: function (aBlock){
  16451. var self=this,$self=this;
  16452. return $core.withContext(function($ctx1) {
  16453. $recv(aBlock)._value_(self);
  16454. return self;
  16455. }, function($ctx1) {$ctx1.fill(self,"includingPossibleMetaDo:",{aBlock:aBlock})});
  16456. },
  16457. args: ["aBlock"],
  16458. source: "includingPossibleMetaDo: aBlock\x0a\x09\x22Default for non-classes.\x22\x0a\x09aBlock value: self",
  16459. referencedClasses: [],
  16460. pragmas: [],
  16461. messageSends: ["value:"]
  16462. }),
  16463. $globals.TBehaviorDefaults);
  16464. $core.addMethod(
  16465. $core.method({
  16466. selector: "name",
  16467. protocol: "accessing",
  16468. fn: function (){
  16469. var self=this,$self=this;
  16470. return nil;
  16471. },
  16472. args: [],
  16473. source: "name\x0a\x09^ nil",
  16474. referencedClasses: [],
  16475. pragmas: [],
  16476. messageSends: []
  16477. }),
  16478. $globals.TBehaviorDefaults);
  16479. $core.addMethod(
  16480. $core.method({
  16481. selector: "printOn:",
  16482. protocol: "printing",
  16483. fn: function (aStream){
  16484. var self=this,$self=this;
  16485. return $core.withContext(function($ctx1) {
  16486. var $1,$receiver;
  16487. $1=$self._name();
  16488. if(($receiver = $1) == null || $receiver.a$nil){
  16489. (
  16490. $ctx1.supercall = true,
  16491. ($globals.TBehaviorDefaults.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  16492. $ctx1.supercall = false;
  16493. } else {
  16494. var name;
  16495. name=$receiver;
  16496. $recv(aStream)._nextPutAll_(name);
  16497. }
  16498. return self;
  16499. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  16500. },
  16501. args: ["aStream"],
  16502. source: "printOn: aStream\x0a\x09self name\x0a\x09\x09ifNil: [ super printOn: aStream ]\x0a\x09\x09ifNotNil: [ :name | aStream nextPutAll: name ]",
  16503. referencedClasses: [],
  16504. pragmas: [],
  16505. messageSends: ["ifNil:ifNotNil:", "name", "printOn:", "nextPutAll:"]
  16506. }),
  16507. $globals.TBehaviorDefaults);
  16508. $core.addMethod(
  16509. $core.method({
  16510. selector: "superclass",
  16511. protocol: "accessing",
  16512. fn: function (){
  16513. var self=this,$self=this;
  16514. return nil;
  16515. },
  16516. args: [],
  16517. source: "superclass\x0a\x09\x22Default for non-classes; to be able to send #superclass to any class / trait.\x22\x0a\x09^ nil",
  16518. referencedClasses: [],
  16519. pragmas: [],
  16520. messageSends: []
  16521. }),
  16522. $globals.TBehaviorDefaults);
  16523. $core.addMethod(
  16524. $core.method({
  16525. selector: "traitUsers",
  16526. protocol: "accessing",
  16527. fn: function (){
  16528. var self=this,$self=this;
  16529. return [];
  16530. },
  16531. args: [],
  16532. source: "traitUsers\x0a\x09\x22Default for non-traits; to be able to send #traitUsers to any class / trait\x22\x0a\x09^ #()",
  16533. referencedClasses: [],
  16534. pragmas: [],
  16535. messageSends: []
  16536. }),
  16537. $globals.TBehaviorDefaults);
  16538. $core.addTrait("TBehaviorProvider", "Kernel-Classes");
  16539. $globals.TBehaviorProvider.comment="I have method dictionary and organization.";
  16540. $core.addMethod(
  16541. $core.method({
  16542. selector: ">>",
  16543. protocol: "accessing",
  16544. fn: function (aString){
  16545. var self=this,$self=this;
  16546. return $core.withContext(function($ctx1) {
  16547. return $self._methodAt_(aString);
  16548. }, function($ctx1) {$ctx1.fill(self,">>",{aString:aString})});
  16549. },
  16550. args: ["aString"],
  16551. source: ">> aString\x0a\x09^ self methodAt: aString",
  16552. referencedClasses: [],
  16553. pragmas: [],
  16554. messageSends: ["methodAt:"]
  16555. }),
  16556. $globals.TBehaviorProvider);
  16557. $core.addMethod(
  16558. $core.method({
  16559. selector: "addCompiledMethod:",
  16560. protocol: "compiling",
  16561. fn: function (aMethod){
  16562. var self=this,$self=this;
  16563. var oldMethod,announcement;
  16564. return $core.withContext(function($ctx1) {
  16565. var $1,$2,$3,$receiver;
  16566. oldMethod=$recv($self._methodDictionary())._at_ifAbsent_($recv(aMethod)._selector(),(function(){
  16567. return nil;
  16568. }));
  16569. $self._basicAddCompiledMethod_(aMethod);
  16570. $1=oldMethod;
  16571. if(($receiver = $1) == null || $receiver.a$nil){
  16572. $2=$recv($globals.MethodAdded)._new();
  16573. $ctx1.sendIdx["new"]=1;
  16574. $recv($2)._method_(aMethod);
  16575. $ctx1.sendIdx["method:"]=1;
  16576. announcement=$recv($2)._yourself();
  16577. $ctx1.sendIdx["yourself"]=1;
  16578. } else {
  16579. $3=$recv($globals.MethodModified)._new();
  16580. $recv($3)._oldMethod_(oldMethod);
  16581. $recv($3)._method_(aMethod);
  16582. announcement=$recv($3)._yourself();
  16583. }
  16584. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  16585. return self;
  16586. }, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement})});
  16587. },
  16588. args: ["aMethod"],
  16589. 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",
  16590. referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"],
  16591. pragmas: [],
  16592. messageSends: ["at:ifAbsent:", "methodDictionary", "selector", "basicAddCompiledMethod:", "ifNil:ifNotNil:", "method:", "new", "yourself", "oldMethod:", "announce:", "current"]
  16593. }),
  16594. $globals.TBehaviorProvider);
  16595. $core.addMethod(
  16596. $core.method({
  16597. selector: "basicAddCompiledMethod:",
  16598. protocol: "private",
  16599. fn: function (aMethod){
  16600. var self=this,$self=this;
  16601. return $core.withContext(function($ctx1) {
  16602. $core.addMethod(aMethod, self);
  16603. return self;
  16604. }, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod})});
  16605. },
  16606. args: ["aMethod"],
  16607. source: "basicAddCompiledMethod: aMethod\x0a\x09<inlineJS: '$core.addMethod(aMethod, self)'>",
  16608. referencedClasses: [],
  16609. pragmas: [["inlineJS:", ["$core.addMethod(aMethod, self)"]]],
  16610. messageSends: []
  16611. }),
  16612. $globals.TBehaviorProvider);
  16613. $core.addMethod(
  16614. $core.method({
  16615. selector: "basicRemoveCompiledMethod:",
  16616. protocol: "private",
  16617. fn: function (aMethod){
  16618. var self=this,$self=this;
  16619. return $core.withContext(function($ctx1) {
  16620. $core.removeMethod(aMethod,self);
  16621. return self;
  16622. }, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod})});
  16623. },
  16624. args: ["aMethod"],
  16625. source: "basicRemoveCompiledMethod: aMethod\x0a\x09<inlineJS: '$core.removeMethod(aMethod,self)'>",
  16626. referencedClasses: [],
  16627. pragmas: [["inlineJS:", ["$core.removeMethod(aMethod,self)"]]],
  16628. messageSends: []
  16629. }),
  16630. $globals.TBehaviorProvider);
  16631. $core.addMethod(
  16632. $core.method({
  16633. selector: "compile:protocol:",
  16634. protocol: "compiling",
  16635. fn: function (aString,anotherString){
  16636. var self=this,$self=this;
  16637. return $core.withContext(function($ctx1) {
  16638. return $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,self,anotherString);
  16639. }, function($ctx1) {$ctx1.fill(self,"compile:protocol:",{aString:aString,anotherString:anotherString})});
  16640. },
  16641. args: ["aString", "anotherString"],
  16642. source: "compile: aString protocol: anotherString\x0a\x09^ Compiler new\x0a\x09\x09install: aString\x0a\x09\x09forClass: self\x0a\x09\x09protocol: anotherString",
  16643. referencedClasses: ["Compiler"],
  16644. pragmas: [],
  16645. messageSends: ["install:forClass:protocol:", "new"]
  16646. }),
  16647. $globals.TBehaviorProvider);
  16648. $core.addMethod(
  16649. $core.method({
  16650. selector: "includesSelector:",
  16651. protocol: "testing",
  16652. fn: function (aString){
  16653. var self=this,$self=this;
  16654. return $core.withContext(function($ctx1) {
  16655. return $recv($self._methodDictionary())._includesKey_(aString);
  16656. }, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString})});
  16657. },
  16658. args: ["aString"],
  16659. source: "includesSelector: aString\x0a\x09^ self methodDictionary includesKey: aString",
  16660. referencedClasses: [],
  16661. pragmas: [],
  16662. messageSends: ["includesKey:", "methodDictionary"]
  16663. }),
  16664. $globals.TBehaviorProvider);
  16665. $core.addMethod(
  16666. $core.method({
  16667. selector: "methodAt:",
  16668. protocol: "accessing",
  16669. fn: function (aString){
  16670. var self=this,$self=this;
  16671. return $core.withContext(function($ctx1) {
  16672. return $recv($self._methodDictionary())._at_(aString);
  16673. }, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString})});
  16674. },
  16675. args: ["aString"],
  16676. source: "methodAt: aString\x0a\x09^ self methodDictionary at: aString",
  16677. referencedClasses: [],
  16678. pragmas: [],
  16679. messageSends: ["at:", "methodDictionary"]
  16680. }),
  16681. $globals.TBehaviorProvider);
  16682. $core.addMethod(
  16683. $core.method({
  16684. selector: "methodDictionary",
  16685. protocol: "accessing",
  16686. fn: function (){
  16687. var self=this,$self=this;
  16688. return $core.withContext(function($ctx1) {
  16689. var dict = $globals.HashedCollection._new();
  16690. var methods = self.methods;
  16691. Object.keys(methods).forEach(function(i) {
  16692. if(methods[i].selector) {
  16693. dict._at_put_(methods[i].selector, methods[i]);
  16694. }
  16695. });
  16696. return dict;
  16697. return self;
  16698. }, function($ctx1) {$ctx1.fill(self,"methodDictionary",{})});
  16699. },
  16700. args: [],
  16701. 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'>",
  16702. referencedClasses: [],
  16703. 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"]]],
  16704. messageSends: []
  16705. }),
  16706. $globals.TBehaviorProvider);
  16707. $core.addMethod(
  16708. $core.method({
  16709. selector: "methodOrganizationEnter:andLeave:",
  16710. protocol: "accessing",
  16711. fn: function (aMethod,oldMethod){
  16712. var self=this,$self=this;
  16713. return $core.withContext(function($ctx1) {
  16714. var $1,$2,$receiver;
  16715. if(($receiver = aMethod) == null || $receiver.a$nil){
  16716. aMethod;
  16717. } else {
  16718. $1=$self._organization();
  16719. $2=$recv(aMethod)._protocol();
  16720. $ctx1.sendIdx["protocol"]=1;
  16721. $recv($1)._addElement_($2);
  16722. }
  16723. if(($receiver = oldMethod) == null || $receiver.a$nil){
  16724. oldMethod;
  16725. } else {
  16726. $self._removeProtocolIfEmpty_($recv(oldMethod)._protocol());
  16727. }
  16728. return self;
  16729. }, function($ctx1) {$ctx1.fill(self,"methodOrganizationEnter:andLeave:",{aMethod:aMethod,oldMethod:oldMethod})});
  16730. },
  16731. args: ["aMethod", "oldMethod"],
  16732. 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 ]",
  16733. referencedClasses: [],
  16734. pragmas: [],
  16735. messageSends: ["ifNotNil:", "addElement:", "organization", "protocol", "removeProtocolIfEmpty:"]
  16736. }),
  16737. $globals.TBehaviorProvider);
  16738. $core.addMethod(
  16739. $core.method({
  16740. selector: "methodTemplate",
  16741. protocol: "accessing",
  16742. fn: function (){
  16743. var self=this,$self=this;
  16744. return $core.withContext(function($ctx1) {
  16745. return $recv($globals.String)._streamContents_((function(stream){
  16746. return $core.withContext(function($ctx2) {
  16747. $recv(stream)._write_("messageSelectorAndArgumentNames");
  16748. $ctx2.sendIdx["write:"]=1;
  16749. $recv(stream)._lf();
  16750. $ctx2.sendIdx["lf"]=1;
  16751. $recv(stream)._tab();
  16752. $ctx2.sendIdx["tab"]=1;
  16753. $recv(stream)._write_("\x22comment stating purpose of message\x22");
  16754. $ctx2.sendIdx["write:"]=2;
  16755. $recv(stream)._lf();
  16756. $ctx2.sendIdx["lf"]=2;
  16757. $recv(stream)._lf();
  16758. $ctx2.sendIdx["lf"]=3;
  16759. $recv(stream)._tab();
  16760. $ctx2.sendIdx["tab"]=2;
  16761. $recv(stream)._write_("| temporary variable names |");
  16762. $ctx2.sendIdx["write:"]=3;
  16763. $recv(stream)._lf();
  16764. $recv(stream)._tab();
  16765. return $recv(stream)._write_("statements");
  16766. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  16767. }));
  16768. }, function($ctx1) {$ctx1.fill(self,"methodTemplate",{})});
  16769. },
  16770. args: [],
  16771. 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' ]",
  16772. referencedClasses: ["String"],
  16773. pragmas: [],
  16774. messageSends: ["streamContents:", "write:", "lf", "tab"]
  16775. }),
  16776. $globals.TBehaviorProvider);
  16777. $core.addMethod(
  16778. $core.method({
  16779. selector: "methods",
  16780. protocol: "accessing",
  16781. fn: function (){
  16782. var self=this,$self=this;
  16783. return $core.withContext(function($ctx1) {
  16784. return $recv($self._methodDictionary())._values();
  16785. }, function($ctx1) {$ctx1.fill(self,"methods",{})});
  16786. },
  16787. args: [],
  16788. source: "methods\x0a\x09^ self methodDictionary values",
  16789. referencedClasses: [],
  16790. pragmas: [],
  16791. messageSends: ["values", "methodDictionary"]
  16792. }),
  16793. $globals.TBehaviorProvider);
  16794. $core.addMethod(
  16795. $core.method({
  16796. selector: "methodsInProtocol:",
  16797. protocol: "accessing",
  16798. fn: function (aString){
  16799. var self=this,$self=this;
  16800. return $core.withContext(function($ctx1) {
  16801. return $recv($self._methods())._select_((function(each){
  16802. return $core.withContext(function($ctx2) {
  16803. return $recv($recv(each)._protocol()).__eq(aString);
  16804. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16805. }));
  16806. }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString})});
  16807. },
  16808. args: ["aString"],
  16809. source: "methodsInProtocol: aString\x0a\x09^ self methods select: [ :each | each protocol = aString ]",
  16810. referencedClasses: [],
  16811. pragmas: [],
  16812. messageSends: ["select:", "methods", "=", "protocol"]
  16813. }),
  16814. $globals.TBehaviorProvider);
  16815. $core.addMethod(
  16816. $core.method({
  16817. selector: "organization",
  16818. protocol: "accessing",
  16819. fn: function (){
  16820. var self=this,$self=this;
  16821. return $core.withContext(function($ctx1) {
  16822. var $1,$receiver;
  16823. $1=$self._basicOrganization();
  16824. $ctx1.sendIdx["basicOrganization"]=1;
  16825. if(($receiver = $1) == null || $receiver.a$nil){
  16826. $self._basicOrganization_($recv($globals.ClassOrganizer)._on_(self));
  16827. return $self._basicOrganization();
  16828. } else {
  16829. return $1;
  16830. }
  16831. }, function($ctx1) {$ctx1.fill(self,"organization",{})});
  16832. },
  16833. args: [],
  16834. source: "organization\x0a\x09^ self basicOrganization ifNil: [\x0a\x09\x09self basicOrganization: (ClassOrganizer on: self).\x0a\x09\x09self basicOrganization ]",
  16835. referencedClasses: ["ClassOrganizer"],
  16836. pragmas: [],
  16837. messageSends: ["ifNil:", "basicOrganization", "basicOrganization:", "on:"]
  16838. }),
  16839. $globals.TBehaviorProvider);
  16840. $core.addMethod(
  16841. $core.method({
  16842. selector: "ownMethods",
  16843. protocol: "accessing",
  16844. fn: function (){
  16845. var self=this,$self=this;
  16846. return $core.withContext(function($ctx1) {
  16847. var $1;
  16848. return $recv($recv($self._ownProtocols())._inject_into_($recv($globals.OrderedCollection)._new(),(function(acc,each){
  16849. return $core.withContext(function($ctx2) {
  16850. return $recv(acc).__comma($self._ownMethodsInProtocol_(each));
  16851. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  16852. })))._sorted_((function(a,b){
  16853. return $core.withContext(function($ctx2) {
  16854. $1=$recv(a)._selector();
  16855. $ctx2.sendIdx["selector"]=1;
  16856. return $recv($1).__lt_eq($recv(b)._selector());
  16857. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)});
  16858. }));
  16859. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{})});
  16860. },
  16861. args: [],
  16862. 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 ]",
  16863. referencedClasses: ["OrderedCollection"],
  16864. pragmas: [],
  16865. messageSends: ["sorted:", "inject:into:", "ownProtocols", "new", ",", "ownMethodsInProtocol:", "<=", "selector"]
  16866. }),
  16867. $globals.TBehaviorProvider);
  16868. $core.addMethod(
  16869. $core.method({
  16870. selector: "ownMethodsInProtocol:",
  16871. protocol: "accessing",
  16872. fn: function (aString){
  16873. var self=this,$self=this;
  16874. return $core.withContext(function($ctx1) {
  16875. return $recv($self._methodsInProtocol_(aString))._select_((function(each){
  16876. return $core.withContext(function($ctx2) {
  16877. return $recv($recv(each)._origin()).__eq(self);
  16878. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16879. }));
  16880. }, function($ctx1) {$ctx1.fill(self,"ownMethodsInProtocol:",{aString:aString})});
  16881. },
  16882. args: ["aString"],
  16883. source: "ownMethodsInProtocol: aString\x0a\x09^ (self methodsInProtocol: aString) select: [ :each | each origin = self ]",
  16884. referencedClasses: [],
  16885. pragmas: [],
  16886. messageSends: ["select:", "methodsInProtocol:", "=", "origin"]
  16887. }),
  16888. $globals.TBehaviorProvider);
  16889. $core.addMethod(
  16890. $core.method({
  16891. selector: "ownProtocols",
  16892. protocol: "accessing",
  16893. fn: function (){
  16894. var self=this,$self=this;
  16895. return $core.withContext(function($ctx1) {
  16896. return $recv($self._protocols())._reject_((function(each){
  16897. return $core.withContext(function($ctx2) {
  16898. return $recv(each)._match_("^\x5c*");
  16899. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16900. }));
  16901. }, function($ctx1) {$ctx1.fill(self,"ownProtocols",{})});
  16902. },
  16903. args: [],
  16904. 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*' ]",
  16905. referencedClasses: [],
  16906. pragmas: [],
  16907. messageSends: ["reject:", "protocols", "match:"]
  16908. }),
  16909. $globals.TBehaviorProvider);
  16910. $core.addMethod(
  16911. $core.method({
  16912. selector: "packageOfProtocol:",
  16913. protocol: "accessing",
  16914. fn: function (aString){
  16915. var self=this,$self=this;
  16916. return $core.withContext(function($ctx1) {
  16917. var $1;
  16918. $1=$recv(aString)._beginsWith_("*");
  16919. if(!$core.assert($1)){
  16920. return $self._package();
  16921. }
  16922. return $recv($globals.Package)._named_ifAbsent_($recv(aString)._allButFirst(),(function(){
  16923. return nil;
  16924. }));
  16925. }, function($ctx1) {$ctx1.fill(self,"packageOfProtocol:",{aString:aString})});
  16926. },
  16927. args: ["aString"],
  16928. 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 ]",
  16929. referencedClasses: ["Package"],
  16930. pragmas: [],
  16931. messageSends: ["ifFalse:", "beginsWith:", "package", "named:ifAbsent:", "allButFirst"]
  16932. }),
  16933. $globals.TBehaviorProvider);
  16934. $core.addMethod(
  16935. $core.method({
  16936. selector: "protocols",
  16937. protocol: "accessing",
  16938. fn: function (){
  16939. var self=this,$self=this;
  16940. return $core.withContext(function($ctx1) {
  16941. return $recv($recv($recv($self._organization())._elements())._asArray())._sorted();
  16942. }, function($ctx1) {$ctx1.fill(self,"protocols",{})});
  16943. },
  16944. args: [],
  16945. source: "protocols\x0a\x09^ self organization elements asArray sorted",
  16946. referencedClasses: [],
  16947. pragmas: [],
  16948. messageSends: ["sorted", "asArray", "elements", "organization"]
  16949. }),
  16950. $globals.TBehaviorProvider);
  16951. $core.addMethod(
  16952. $core.method({
  16953. selector: "protocolsDo:",
  16954. protocol: "enumerating",
  16955. fn: function (aBlock){
  16956. var self=this,$self=this;
  16957. var methodsByProtocol;
  16958. return $core.withContext(function($ctx1) {
  16959. methodsByProtocol=$recv($globals.HashedCollection)._new();
  16960. $ctx1.sendIdx["new"]=1;
  16961. $recv($self._methodDictionary())._valuesDo_((function(m){
  16962. return $core.withContext(function($ctx2) {
  16963. return $recv($recv(methodsByProtocol)._at_ifAbsentPut_($recv(m)._protocol(),(function(){
  16964. return $core.withContext(function($ctx3) {
  16965. return $recv($globals.Array)._new();
  16966. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  16967. })))._add_(m);
  16968. }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
  16969. }));
  16970. $recv($self._protocols())._do_((function(protocol){
  16971. return $core.withContext(function($ctx2) {
  16972. return $recv(aBlock)._value_value_(protocol,$recv(methodsByProtocol)._at_(protocol));
  16973. }, function($ctx2) {$ctx2.fillBlock({protocol:protocol},$ctx1,3)});
  16974. }));
  16975. return self;
  16976. }, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByProtocol:methodsByProtocol})});
  16977. },
  16978. args: ["aBlock"],
  16979. 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) ]",
  16980. referencedClasses: ["HashedCollection", "Array"],
  16981. pragmas: [],
  16982. messageSends: ["new", "valuesDo:", "methodDictionary", "add:", "at:ifAbsentPut:", "protocol", "do:", "protocols", "value:value:", "at:"]
  16983. }),
  16984. $globals.TBehaviorProvider);
  16985. $core.addMethod(
  16986. $core.method({
  16987. selector: "recompile",
  16988. protocol: "compiling",
  16989. fn: function (){
  16990. var self=this,$self=this;
  16991. return $core.withContext(function($ctx1) {
  16992. return $recv($recv($globals.Compiler)._new())._recompile_(self);
  16993. }, function($ctx1) {$ctx1.fill(self,"recompile",{})});
  16994. },
  16995. args: [],
  16996. source: "recompile\x0a\x09^ Compiler new recompile: self",
  16997. referencedClasses: ["Compiler"],
  16998. pragmas: [],
  16999. messageSends: ["recompile:", "new"]
  17000. }),
  17001. $globals.TBehaviorProvider);
  17002. $core.addMethod(
  17003. $core.method({
  17004. selector: "removeCompiledMethod:",
  17005. protocol: "compiling",
  17006. fn: function (aMethod){
  17007. var self=this,$self=this;
  17008. return $core.withContext(function($ctx1) {
  17009. var $1,$3,$2;
  17010. $self._basicRemoveCompiledMethod_(aMethod);
  17011. $1=$recv($globals.SystemAnnouncer)._current();
  17012. $3=$recv($globals.MethodRemoved)._new();
  17013. $recv($3)._method_(aMethod);
  17014. $2=$recv($3)._yourself();
  17015. $recv($1)._announce_($2);
  17016. return self;
  17017. }, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod})});
  17018. },
  17019. args: ["aMethod"],
  17020. 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)",
  17021. referencedClasses: ["SystemAnnouncer", "MethodRemoved"],
  17022. pragmas: [],
  17023. messageSends: ["basicRemoveCompiledMethod:", "announce:", "current", "method:", "new", "yourself"]
  17024. }),
  17025. $globals.TBehaviorProvider);
  17026. $core.addMethod(
  17027. $core.method({
  17028. selector: "removeProtocolIfEmpty:",
  17029. protocol: "accessing",
  17030. fn: function (aString){
  17031. var self=this,$self=this;
  17032. return $core.withContext(function($ctx1) {
  17033. $recv($self._methods())._detect_ifNone_((function(each){
  17034. return $core.withContext(function($ctx2) {
  17035. return $recv($recv(each)._protocol()).__eq(aString);
  17036. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  17037. }),(function(){
  17038. return $core.withContext(function($ctx2) {
  17039. return $recv($self._organization())._removeElement_(aString);
  17040. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  17041. }));
  17042. return self;
  17043. }, function($ctx1) {$ctx1.fill(self,"removeProtocolIfEmpty:",{aString:aString})});
  17044. },
  17045. args: ["aString"],
  17046. source: "removeProtocolIfEmpty: aString\x0a\x09self methods\x0a\x09\x09detect: [ :each | each protocol = aString ]\x0a\x09\x09ifNone: [ self organization removeElement: aString ]",
  17047. referencedClasses: [],
  17048. pragmas: [],
  17049. messageSends: ["detect:ifNone:", "methods", "=", "protocol", "removeElement:", "organization"]
  17050. }),
  17051. $globals.TBehaviorProvider);
  17052. $core.addMethod(
  17053. $core.method({
  17054. selector: "selectors",
  17055. protocol: "accessing",
  17056. fn: function (){
  17057. var self=this,$self=this;
  17058. return $core.withContext(function($ctx1) {
  17059. return $recv($self._methodDictionary())._keys();
  17060. }, function($ctx1) {$ctx1.fill(self,"selectors",{})});
  17061. },
  17062. args: [],
  17063. source: "selectors\x0a\x09^ self methodDictionary keys",
  17064. referencedClasses: [],
  17065. pragmas: [],
  17066. messageSends: ["keys", "methodDictionary"]
  17067. }),
  17068. $globals.TBehaviorProvider);
  17069. $core.addMethod(
  17070. $core.method({
  17071. selector: "setTraitComposition:",
  17072. protocol: "compiling",
  17073. fn: function (aTraitComposition){
  17074. var self=this,$self=this;
  17075. return $core.withContext(function($ctx1) {
  17076. $core.setTraitComposition(aTraitComposition._asJavaScriptObject(), self);
  17077. return self;
  17078. }, function($ctx1) {$ctx1.fill(self,"setTraitComposition:",{aTraitComposition:aTraitComposition})});
  17079. },
  17080. args: ["aTraitComposition"],
  17081. source: "setTraitComposition: aTraitComposition\x0a\x09<inlineJS: '$core.setTraitComposition(aTraitComposition._asJavaScriptObject(), self)'>",
  17082. referencedClasses: [],
  17083. pragmas: [["inlineJS:", ["$core.setTraitComposition(aTraitComposition._asJavaScriptObject(), self)"]]],
  17084. messageSends: []
  17085. }),
  17086. $globals.TBehaviorProvider);
  17087. $core.addMethod(
  17088. $core.method({
  17089. selector: "traitComposition",
  17090. protocol: "accessing",
  17091. fn: function (){
  17092. var self=this,$self=this;
  17093. return $core.withContext(function($ctx1) {
  17094. var $1,$receiver;
  17095. $1=$self._basicAt_("traitComposition");
  17096. if(($receiver = $1) == null || $receiver.a$nil){
  17097. return [];
  17098. } else {
  17099. var aCollection;
  17100. aCollection=$receiver;
  17101. return $recv(aCollection)._collect_((function(each){
  17102. return $core.withContext(function($ctx2) {
  17103. return $recv($globals.TraitTransformation)._fromJSON_(each);
  17104. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  17105. }));
  17106. }
  17107. }, function($ctx1) {$ctx1.fill(self,"traitComposition",{})});
  17108. },
  17109. args: [],
  17110. source: "traitComposition\x0a\x09^ (self basicAt: 'traitComposition')\x0a\x09\x09ifNil: [ #() ]\x0a\x09\x09ifNotNil: [ :aCollection | aCollection collect: [ :each | TraitTransformation fromJSON: each ] ]",
  17111. referencedClasses: ["TraitTransformation"],
  17112. pragmas: [],
  17113. messageSends: ["ifNil:ifNotNil:", "basicAt:", "collect:", "fromJSON:"]
  17114. }),
  17115. $globals.TBehaviorProvider);
  17116. $core.addMethod(
  17117. $core.method({
  17118. selector: "traitCompositionDefinition",
  17119. protocol: "accessing",
  17120. fn: function (){
  17121. var self=this,$self=this;
  17122. return $core.withContext(function($ctx1) {
  17123. return $recv($self._traitComposition())._ifNotEmpty_((function(traitComposition){
  17124. return $core.withContext(function($ctx2) {
  17125. return $recv($globals.String)._streamContents_((function(str){
  17126. return $core.withContext(function($ctx3) {
  17127. $recv(str)._write_("{");
  17128. $ctx3.sendIdx["write:"]=1;
  17129. $recv(traitComposition)._do_separatedBy_((function(each){
  17130. return $core.withContext(function($ctx4) {
  17131. return $recv(str)._write_($recv(each)._definition());
  17132. $ctx4.sendIdx["write:"]=2;
  17133. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  17134. }),(function(){
  17135. return $core.withContext(function($ctx4) {
  17136. return $recv(str)._write_(". ");
  17137. $ctx4.sendIdx["write:"]=3;
  17138. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  17139. }));
  17140. return $recv(str)._write_("}");
  17141. }, function($ctx3) {$ctx3.fillBlock({str:str},$ctx2,2)});
  17142. }));
  17143. }, function($ctx2) {$ctx2.fillBlock({traitComposition:traitComposition},$ctx1,1)});
  17144. }));
  17145. }, function($ctx1) {$ctx1.fill(self,"traitCompositionDefinition",{})});
  17146. },
  17147. args: [],
  17148. 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: '}' ] ]",
  17149. referencedClasses: ["String"],
  17150. pragmas: [],
  17151. messageSends: ["ifNotEmpty:", "traitComposition", "streamContents:", "write:", "do:separatedBy:", "definition"]
  17152. }),
  17153. $globals.TBehaviorProvider);
  17154. $core.addTrait("TMasterBehavior", "Kernel-Classes");
  17155. $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.";
  17156. $core.addMethod(
  17157. $core.method({
  17158. selector: "asJavaScriptSource",
  17159. protocol: "converting",
  17160. fn: function (){
  17161. var self=this,$self=this;
  17162. return $core.withContext(function($ctx1) {
  17163. return "$globals.".__comma($self._name());
  17164. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  17165. },
  17166. args: [],
  17167. source: "asJavaScriptSource\x0a\x09^ '$globals.', self name",
  17168. referencedClasses: [],
  17169. pragmas: [],
  17170. messageSends: [",", "name"]
  17171. }),
  17172. $globals.TMasterBehavior);
  17173. $core.addMethod(
  17174. $core.method({
  17175. selector: "browse",
  17176. protocol: "browsing",
  17177. fn: function (){
  17178. var self=this,$self=this;
  17179. return $core.withContext(function($ctx1) {
  17180. $recv($globals.Finder)._findClass_(self);
  17181. return self;
  17182. }, function($ctx1) {$ctx1.fill(self,"browse",{})});
  17183. },
  17184. args: [],
  17185. source: "browse\x0a\x09Finder findClass: self",
  17186. referencedClasses: ["Finder"],
  17187. pragmas: [],
  17188. messageSends: ["findClass:"]
  17189. }),
  17190. $globals.TMasterBehavior);
  17191. $core.addMethod(
  17192. $core.method({
  17193. selector: "category",
  17194. protocol: "accessing",
  17195. fn: function (){
  17196. var self=this,$self=this;
  17197. return $core.withContext(function($ctx1) {
  17198. var $1,$receiver;
  17199. $1=$self._package();
  17200. $ctx1.sendIdx["package"]=1;
  17201. if(($receiver = $1) == null || $receiver.a$nil){
  17202. return "Unclassified";
  17203. } else {
  17204. return $recv($self._package())._name();
  17205. }
  17206. }, function($ctx1) {$ctx1.fill(self,"category",{})});
  17207. },
  17208. args: [],
  17209. source: "category\x0a\x09^ self package ifNil: [ 'Unclassified' ] ifNotNil: [ self package name ]",
  17210. referencedClasses: [],
  17211. pragmas: [],
  17212. messageSends: ["ifNil:ifNotNil:", "package", "name"]
  17213. }),
  17214. $globals.TMasterBehavior);
  17215. $core.addMethod(
  17216. $core.method({
  17217. selector: "classTag",
  17218. protocol: "accessing",
  17219. fn: function (){
  17220. var self=this,$self=this;
  17221. return $core.withContext(function($ctx1) {
  17222. return $self._subclassResponsibility();
  17223. }, function($ctx1) {$ctx1.fill(self,"classTag",{})});
  17224. },
  17225. args: [],
  17226. source: "classTag\x0a\x09\x22Every master behavior should define a class tag.\x22\x0a\x09^ self subclassResponsibility",
  17227. referencedClasses: [],
  17228. pragmas: [],
  17229. messageSends: ["subclassResponsibility"]
  17230. }),
  17231. $globals.TMasterBehavior);
  17232. $core.addMethod(
  17233. $core.method({
  17234. selector: "comment",
  17235. protocol: "accessing",
  17236. fn: function (){
  17237. var self=this,$self=this;
  17238. return $core.withContext(function($ctx1) {
  17239. var $1,$receiver;
  17240. $1=$self._basicAt_("comment");
  17241. if(($receiver = $1) == null || $receiver.a$nil){
  17242. return "";
  17243. } else {
  17244. return $1;
  17245. }
  17246. }, function($ctx1) {$ctx1.fill(self,"comment",{})});
  17247. },
  17248. args: [],
  17249. source: "comment\x0a\x09^ (self basicAt: 'comment') ifNil: [ '' ]",
  17250. referencedClasses: [],
  17251. pragmas: [],
  17252. messageSends: ["ifNil:", "basicAt:"]
  17253. }),
  17254. $globals.TMasterBehavior);
  17255. $core.addMethod(
  17256. $core.method({
  17257. selector: "comment:",
  17258. protocol: "accessing",
  17259. fn: function (aString){
  17260. var self=this,$self=this;
  17261. return $core.withContext(function($ctx1) {
  17262. var $1,$3,$2;
  17263. $self._basicAt_put_("comment",aString);
  17264. $1=$recv($globals.SystemAnnouncer)._current();
  17265. $3=$recv($globals.ClassCommentChanged)._new();
  17266. $recv($3)._theClass_(self);
  17267. $2=$recv($3)._yourself();
  17268. $recv($1)._announce_($2);
  17269. return self;
  17270. }, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString})});
  17271. },
  17272. args: ["aString"],
  17273. 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)",
  17274. referencedClasses: ["SystemAnnouncer", "ClassCommentChanged"],
  17275. pragmas: [],
  17276. messageSends: ["basicAt:put:", "announce:", "current", "theClass:", "new", "yourself"]
  17277. }),
  17278. $globals.TMasterBehavior);
  17279. $core.addMethod(
  17280. $core.method({
  17281. selector: "definedMethods",
  17282. protocol: "accessing",
  17283. fn: function (){
  17284. var self=this,$self=this;
  17285. var methods;
  17286. return $core.withContext(function($ctx1) {
  17287. var $1,$receiver;
  17288. methods=$self._methods();
  17289. $ctx1.sendIdx["methods"]=1;
  17290. $1=$self._theMetaClass();
  17291. if(($receiver = $1) == null || $receiver.a$nil){
  17292. return methods;
  17293. } else {
  17294. var meta;
  17295. meta=$receiver;
  17296. return $recv(methods).__comma($recv(meta)._methods());
  17297. }
  17298. return self;
  17299. }, function($ctx1) {$ctx1.fill(self,"definedMethods",{methods:methods})});
  17300. },
  17301. args: [],
  17302. 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 ]",
  17303. referencedClasses: [],
  17304. pragmas: [],
  17305. messageSends: ["methods", "ifNil:ifNotNil:", "theMetaClass", ","]
  17306. }),
  17307. $globals.TMasterBehavior);
  17308. $core.addMethod(
  17309. $core.method({
  17310. selector: "enterOrganization",
  17311. protocol: "accessing",
  17312. fn: function (){
  17313. var self=this,$self=this;
  17314. return $core.withContext(function($ctx1) {
  17315. var $1,$receiver;
  17316. if(($receiver = $globals.Smalltalk) == null || $receiver.a$nil){
  17317. $globals.Smalltalk;
  17318. } else {
  17319. $1=$self._basicAt_("category");
  17320. if(($receiver = $1) == null || $receiver.a$nil){
  17321. $self._basicPackage_(nil);
  17322. $ctx1.sendIdx["basicPackage:"]=1;
  17323. } else {
  17324. var category;
  17325. category=$receiver;
  17326. $self._basicPackage_($recv($globals.Package)._named_(category));
  17327. $recv($recv($self._package())._organization())._addElement_(self);
  17328. }
  17329. }
  17330. return self;
  17331. }, function($ctx1) {$ctx1.fill(self,"enterOrganization",{})});
  17332. },
  17333. args: [],
  17334. 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 ] ]",
  17335. referencedClasses: ["Smalltalk", "Package"],
  17336. pragmas: [],
  17337. messageSends: ["ifNotNil:", "ifNil:ifNotNil:", "basicAt:", "basicPackage:", "named:", "addElement:", "organization", "package"]
  17338. }),
  17339. $globals.TMasterBehavior);
  17340. $core.addMethod(
  17341. $core.method({
  17342. selector: "leaveOrganization",
  17343. protocol: "accessing",
  17344. fn: function (){
  17345. var self=this,$self=this;
  17346. return $core.withContext(function($ctx1) {
  17347. var $receiver;
  17348. if(($receiver = $globals.Smalltalk) == null || $receiver.a$nil){
  17349. $globals.Smalltalk;
  17350. } else {
  17351. $recv($recv($self._package())._organization())._removeElement_(self);
  17352. }
  17353. return self;
  17354. }, function($ctx1) {$ctx1.fill(self,"leaveOrganization",{})});
  17355. },
  17356. args: [],
  17357. source: "leaveOrganization\x0a\x09Smalltalk ifNotNil: [\x0a\x09\x09self package organization removeElement: self ]",
  17358. referencedClasses: ["Smalltalk"],
  17359. pragmas: [],
  17360. messageSends: ["ifNotNil:", "removeElement:", "organization", "package"]
  17361. }),
  17362. $globals.TMasterBehavior);
  17363. $core.addMethod(
  17364. $core.method({
  17365. selector: "name",
  17366. protocol: "accessing",
  17367. fn: function (){
  17368. var self=this,$self=this;
  17369. return $core.withContext(function($ctx1) {
  17370. return self.name;
  17371. return self;
  17372. }, function($ctx1) {$ctx1.fill(self,"name",{})});
  17373. },
  17374. args: [],
  17375. source: "name\x0a\x09<inlineJS: 'return self.name'>",
  17376. referencedClasses: [],
  17377. pragmas: [["inlineJS:", ["return self.name"]]],
  17378. messageSends: []
  17379. }),
  17380. $globals.TMasterBehavior);
  17381. $core.addMethod(
  17382. $core.method({
  17383. selector: "package:",
  17384. protocol: "accessing",
  17385. fn: function (aPackage){
  17386. var self=this,$self=this;
  17387. var oldPackage;
  17388. return $core.withContext(function($ctx1) {
  17389. var $2,$1,$3,$5,$4;
  17390. $2=$self._package();
  17391. $ctx1.sendIdx["package"]=1;
  17392. $1=$recv($2).__eq(aPackage);
  17393. if($core.assert($1)){
  17394. return self;
  17395. }
  17396. oldPackage=$self._package();
  17397. $self._leaveOrganization();
  17398. $self._basicAt_put_("category",$recv(aPackage)._name());
  17399. $self._enterOrganization();
  17400. $3=$recv($globals.SystemAnnouncer)._current();
  17401. $5=$recv($globals.ClassMoved)._new();
  17402. $recv($5)._theClass_(self);
  17403. $recv($5)._oldPackage_(oldPackage);
  17404. $4=$recv($5)._yourself();
  17405. $recv($3)._announce_($4);
  17406. return self;
  17407. }, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage})});
  17408. },
  17409. args: ["aPackage"],
  17410. 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)",
  17411. referencedClasses: ["SystemAnnouncer", "ClassMoved"],
  17412. pragmas: [],
  17413. messageSends: ["ifTrue:", "=", "package", "leaveOrganization", "basicAt:put:", "name", "enterOrganization", "announce:", "current", "theClass:", "new", "oldPackage:", "yourself"]
  17414. }),
  17415. $globals.TMasterBehavior);
  17416. $core.addMethod(
  17417. $core.method({
  17418. selector: "theNonMetaClass",
  17419. protocol: "accessing",
  17420. fn: function (){
  17421. var self=this,$self=this;
  17422. return self;
  17423. },
  17424. args: [],
  17425. source: "theNonMetaClass\x0a\x09^ self",
  17426. referencedClasses: [],
  17427. pragmas: [],
  17428. messageSends: []
  17429. }),
  17430. $globals.TMasterBehavior);
  17431. $core.addClass("Trait", $globals.Object, ["organization", "package", "traitUsers"], "Kernel-Classes");
  17432. $core.addMethod(
  17433. $core.method({
  17434. selector: "-",
  17435. protocol: "composition",
  17436. fn: function (anArray){
  17437. var self=this,$self=this;
  17438. return $core.withContext(function($ctx1) {
  17439. return $recv($self._asTraitTransformation()).__minus(anArray);
  17440. }, function($ctx1) {$ctx1.fill(self,"-",{anArray:anArray})});
  17441. },
  17442. args: ["anArray"],
  17443. source: "- anArray\x0a\x09^ self asTraitTransformation - anArray",
  17444. referencedClasses: [],
  17445. pragmas: [],
  17446. messageSends: ["-", "asTraitTransformation"]
  17447. }),
  17448. $globals.Trait);
  17449. $core.addMethod(
  17450. $core.method({
  17451. selector: "@",
  17452. protocol: "composition",
  17453. fn: function (anArrayOfAssociations){
  17454. var self=this,$self=this;
  17455. return $core.withContext(function($ctx1) {
  17456. return $recv($self._asTraitTransformation()).__at(anArrayOfAssociations);
  17457. }, function($ctx1) {$ctx1.fill(self,"@",{anArrayOfAssociations:anArrayOfAssociations})});
  17458. },
  17459. args: ["anArrayOfAssociations"],
  17460. source: "@ anArrayOfAssociations\x0a\x09^ self asTraitTransformation @ anArrayOfAssociations",
  17461. referencedClasses: [],
  17462. pragmas: [],
  17463. messageSends: ["@", "asTraitTransformation"]
  17464. }),
  17465. $globals.Trait);
  17466. $core.addMethod(
  17467. $core.method({
  17468. selector: "asTraitComposition",
  17469. protocol: "converting",
  17470. fn: function (){
  17471. var self=this,$self=this;
  17472. return $core.withContext(function($ctx1) {
  17473. return $recv($self._asTraitTransformation())._asTraitComposition();
  17474. }, function($ctx1) {$ctx1.fill(self,"asTraitComposition",{})});
  17475. },
  17476. args: [],
  17477. source: "asTraitComposition\x0a\x09^ self asTraitTransformation asTraitComposition",
  17478. referencedClasses: [],
  17479. pragmas: [],
  17480. messageSends: ["asTraitComposition", "asTraitTransformation"]
  17481. }),
  17482. $globals.Trait);
  17483. $core.addMethod(
  17484. $core.method({
  17485. selector: "asTraitTransformation",
  17486. protocol: "converting",
  17487. fn: function (){
  17488. var self=this,$self=this;
  17489. return $core.withContext(function($ctx1) {
  17490. return $recv($globals.TraitTransformation)._on_(self);
  17491. }, function($ctx1) {$ctx1.fill(self,"asTraitTransformation",{})});
  17492. },
  17493. args: [],
  17494. source: "asTraitTransformation\x0a\x09^ TraitTransformation on: self",
  17495. referencedClasses: ["TraitTransformation"],
  17496. pragmas: [],
  17497. messageSends: ["on:"]
  17498. }),
  17499. $globals.Trait);
  17500. $core.addMethod(
  17501. $core.method({
  17502. selector: "basicOrganization",
  17503. protocol: "accessing",
  17504. fn: function (){
  17505. var self=this,$self=this;
  17506. return $self.organization;
  17507. },
  17508. args: [],
  17509. source: "basicOrganization\x0a\x09^ organization",
  17510. referencedClasses: [],
  17511. pragmas: [],
  17512. messageSends: []
  17513. }),
  17514. $globals.Trait);
  17515. $core.addMethod(
  17516. $core.method({
  17517. selector: "basicOrganization:",
  17518. protocol: "accessing",
  17519. fn: function (aClassOrganizer){
  17520. var self=this,$self=this;
  17521. $self.organization=aClassOrganizer;
  17522. return self;
  17523. },
  17524. args: ["aClassOrganizer"],
  17525. source: "basicOrganization: aClassOrganizer\x0a\x09organization := aClassOrganizer",
  17526. referencedClasses: [],
  17527. pragmas: [],
  17528. messageSends: []
  17529. }),
  17530. $globals.Trait);
  17531. $core.addMethod(
  17532. $core.method({
  17533. selector: "basicPackage:",
  17534. protocol: "accessing",
  17535. fn: function (aPackage){
  17536. var self=this,$self=this;
  17537. $self.package=aPackage;
  17538. return self;
  17539. },
  17540. args: ["aPackage"],
  17541. source: "basicPackage: aPackage\x0a\x09package := aPackage",
  17542. referencedClasses: [],
  17543. pragmas: [],
  17544. messageSends: []
  17545. }),
  17546. $globals.Trait);
  17547. $core.addMethod(
  17548. $core.method({
  17549. selector: "classTag",
  17550. protocol: "accessing",
  17551. fn: function (){
  17552. var self=this,$self=this;
  17553. return "trait";
  17554. },
  17555. args: [],
  17556. source: "classTag\x0a\x09^ 'trait'",
  17557. referencedClasses: [],
  17558. pragmas: [],
  17559. messageSends: []
  17560. }),
  17561. $globals.Trait);
  17562. $core.addMethod(
  17563. $core.method({
  17564. selector: "definition",
  17565. protocol: "accessing",
  17566. fn: function (){
  17567. var self=this,$self=this;
  17568. return $core.withContext(function($ctx1) {
  17569. var $1;
  17570. return $recv($globals.String)._streamContents_((function(stream){
  17571. return $core.withContext(function($ctx2) {
  17572. $recv(stream)._write_("Trait named: ");
  17573. $ctx2.sendIdx["write:"]=1;
  17574. $recv(stream)._printSymbol_($self._name());
  17575. $recv(stream)._lf();
  17576. $ctx2.sendIdx["lf"]=1;
  17577. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifNotEmpty_((function(tcd){
  17578. return $core.withContext(function($ctx3) {
  17579. $1=$recv($globals.String)._tab();
  17580. $ctx3.sendIdx["tab"]=1;
  17581. return [$1,"uses: ",tcd,$recv($globals.String)._lf()];
  17582. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,2)});
  17583. })));
  17584. $ctx2.sendIdx["write:"]=2;
  17585. $recv(stream)._tab();
  17586. $recv(stream)._write_("package: ");
  17587. return $recv(stream)._print_($self._category());
  17588. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  17589. }));
  17590. }, function($ctx1) {$ctx1.fill(self,"definition",{})});
  17591. },
  17592. args: [],
  17593. 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 ]",
  17594. referencedClasses: ["String"],
  17595. pragmas: [],
  17596. messageSends: ["streamContents:", "write:", "printSymbol:", "name", "lf", "ifNotEmpty:", "traitCompositionDefinition", "tab", "print:", "category"]
  17597. }),
  17598. $globals.Trait);
  17599. $core.addMethod(
  17600. $core.method({
  17601. selector: "package",
  17602. protocol: "accessing",
  17603. fn: function (){
  17604. var self=this,$self=this;
  17605. return $self.package;
  17606. },
  17607. args: [],
  17608. source: "package\x0a\x09^ package",
  17609. referencedClasses: [],
  17610. pragmas: [],
  17611. messageSends: []
  17612. }),
  17613. $globals.Trait);
  17614. $core.addMethod(
  17615. $core.method({
  17616. selector: "theMetaClass",
  17617. protocol: "accessing",
  17618. fn: function (){
  17619. var self=this,$self=this;
  17620. return nil;
  17621. },
  17622. args: [],
  17623. source: "theMetaClass\x0a\x09^ nil",
  17624. referencedClasses: [],
  17625. pragmas: [],
  17626. messageSends: []
  17627. }),
  17628. $globals.Trait);
  17629. $core.addMethod(
  17630. $core.method({
  17631. selector: "traitUsers",
  17632. protocol: "accessing",
  17633. fn: function (){
  17634. var self=this,$self=this;
  17635. return $core.withContext(function($ctx1) {
  17636. return $recv($self.traitUsers)._copy();
  17637. }, function($ctx1) {$ctx1.fill(self,"traitUsers",{})});
  17638. },
  17639. args: [],
  17640. source: "traitUsers\x0a\x09^ traitUsers copy",
  17641. referencedClasses: [],
  17642. pragmas: [],
  17643. messageSends: ["copy"]
  17644. }),
  17645. $globals.Trait);
  17646. $core.addMethod(
  17647. $core.method({
  17648. selector: "named:package:",
  17649. protocol: "instance creation",
  17650. fn: function (aString,anotherString){
  17651. var self=this,$self=this;
  17652. return $core.withContext(function($ctx1) {
  17653. return $recv($recv($globals.ClassBuilder)._new())._addTraitNamed_package_(aString,anotherString);
  17654. }, function($ctx1) {$ctx1.fill(self,"named:package:",{aString:aString,anotherString:anotherString})});
  17655. },
  17656. args: ["aString", "anotherString"],
  17657. source: "named: aString package: anotherString\x0a\x09^ ClassBuilder new addTraitNamed: aString package: anotherString",
  17658. referencedClasses: ["ClassBuilder"],
  17659. pragmas: [],
  17660. messageSends: ["addTraitNamed:package:", "new"]
  17661. }),
  17662. $globals.Trait.a$cls);
  17663. $core.addMethod(
  17664. $core.method({
  17665. selector: "named:uses:package:",
  17666. protocol: "instance creation",
  17667. fn: function (aString,aTraitCompositionDescription,anotherString){
  17668. var self=this,$self=this;
  17669. var trait;
  17670. return $core.withContext(function($ctx1) {
  17671. trait=$self._named_package_(aString,anotherString);
  17672. $recv(trait)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  17673. return trait;
  17674. }, function($ctx1) {$ctx1.fill(self,"named:uses:package:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,anotherString:anotherString,trait:trait})});
  17675. },
  17676. args: ["aString", "aTraitCompositionDescription", "anotherString"],
  17677. 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",
  17678. referencedClasses: [],
  17679. pragmas: [],
  17680. messageSends: ["named:package:", "setTraitComposition:", "asTraitComposition"]
  17681. }),
  17682. $globals.Trait.a$cls);
  17683. $core.addClass("TraitTransformation", $globals.Object, ["trait", "aliases", "exclusions"], "Kernel-Classes");
  17684. $globals.TraitTransformation.comment="I am a single step in trait composition.\x0a\x0aI represent one trait including its aliases and exclusions.";
  17685. $core.addMethod(
  17686. $core.method({
  17687. selector: "-",
  17688. protocol: "composition",
  17689. fn: function (anArray){
  17690. var self=this,$self=this;
  17691. return $core.withContext(function($ctx1) {
  17692. var $1;
  17693. $1=$self._copy();
  17694. $recv($1)._addExclusions_(anArray);
  17695. return $recv($1)._yourself();
  17696. }, function($ctx1) {$ctx1.fill(self,"-",{anArray:anArray})});
  17697. },
  17698. args: ["anArray"],
  17699. source: "- anArray\x0a\x09^ self copy addExclusions: anArray; yourself",
  17700. referencedClasses: [],
  17701. pragmas: [],
  17702. messageSends: ["addExclusions:", "copy", "yourself"]
  17703. }),
  17704. $globals.TraitTransformation);
  17705. $core.addMethod(
  17706. $core.method({
  17707. selector: "@",
  17708. protocol: "composition",
  17709. fn: function (anArrayOfAssociations){
  17710. var self=this,$self=this;
  17711. return $core.withContext(function($ctx1) {
  17712. var $1;
  17713. $1=$self._copy();
  17714. $recv($1)._addAliases_(anArrayOfAssociations);
  17715. return $recv($1)._yourself();
  17716. }, function($ctx1) {$ctx1.fill(self,"@",{anArrayOfAssociations:anArrayOfAssociations})});
  17717. },
  17718. args: ["anArrayOfAssociations"],
  17719. source: "@ anArrayOfAssociations\x0a\x09^ self copy addAliases: anArrayOfAssociations; yourself",
  17720. referencedClasses: [],
  17721. pragmas: [],
  17722. messageSends: ["addAliases:", "copy", "yourself"]
  17723. }),
  17724. $globals.TraitTransformation);
  17725. $core.addMethod(
  17726. $core.method({
  17727. selector: "addAliases:",
  17728. protocol: "accessing",
  17729. fn: function (anArrayOfAssociations){
  17730. var self=this,$self=this;
  17731. return $core.withContext(function($ctx1) {
  17732. $recv(anArrayOfAssociations)._do_((function(each){
  17733. var key;
  17734. return $core.withContext(function($ctx2) {
  17735. key=$recv(each)._key();
  17736. return $recv($self.aliases)._at_ifPresent_ifAbsent_(key,(function(){
  17737. return $core.withContext(function($ctx3) {
  17738. return $self._error_("Cannot use same alias name twice.");
  17739. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  17740. }),(function(){
  17741. return $core.withContext(function($ctx3) {
  17742. return $recv($self.aliases)._at_put_(key,$recv(each)._value());
  17743. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  17744. }));
  17745. }, function($ctx2) {$ctx2.fillBlock({each:each,key:key},$ctx1,1)});
  17746. }));
  17747. return anArrayOfAssociations;
  17748. }, function($ctx1) {$ctx1.fill(self,"addAliases:",{anArrayOfAssociations:anArrayOfAssociations})});
  17749. },
  17750. args: ["anArrayOfAssociations"],
  17751. 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",
  17752. referencedClasses: [],
  17753. pragmas: [],
  17754. messageSends: ["do:", "key", "at:ifPresent:ifAbsent:", "error:", "at:put:", "value"]
  17755. }),
  17756. $globals.TraitTransformation);
  17757. $core.addMethod(
  17758. $core.method({
  17759. selector: "addExclusions:",
  17760. protocol: "accessing",
  17761. fn: function (anArray){
  17762. var self=this,$self=this;
  17763. return $core.withContext(function($ctx1) {
  17764. $recv($self.exclusions)._addAll_(anArray);
  17765. return anArray;
  17766. }, function($ctx1) {$ctx1.fill(self,"addExclusions:",{anArray:anArray})});
  17767. },
  17768. args: ["anArray"],
  17769. source: "addExclusions: anArray\x0a\x09exclusions addAll: anArray.\x0a\x09^ anArray",
  17770. referencedClasses: [],
  17771. pragmas: [],
  17772. messageSends: ["addAll:"]
  17773. }),
  17774. $globals.TraitTransformation);
  17775. $core.addMethod(
  17776. $core.method({
  17777. selector: "aliases",
  17778. protocol: "accessing",
  17779. fn: function (){
  17780. var self=this,$self=this;
  17781. return $self.aliases;
  17782. },
  17783. args: [],
  17784. source: "aliases\x0a\x09^ aliases",
  17785. referencedClasses: [],
  17786. pragmas: [],
  17787. messageSends: []
  17788. }),
  17789. $globals.TraitTransformation);
  17790. $core.addMethod(
  17791. $core.method({
  17792. selector: "asJavaScriptObject",
  17793. protocol: "converting",
  17794. fn: function (){
  17795. var self=this,$self=this;
  17796. return $core.withContext(function($ctx1) {
  17797. return $globals.HashedCollection._newFromPairs_(["trait",$self._trait(),"aliases",$self._aliases(),"exclusions",$recv($recv($self._exclusions())._asArray())._sorted()]);
  17798. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{})});
  17799. },
  17800. args: [],
  17801. source: "asJavaScriptObject\x0a\x09^ #{\x0a\x09\x09'trait' -> self trait.\x0a\x09\x09'aliases' -> self aliases.\x0a\x09\x09'exclusions' -> self exclusions asArray sorted }",
  17802. referencedClasses: [],
  17803. pragmas: [],
  17804. messageSends: ["trait", "aliases", "sorted", "asArray", "exclusions"]
  17805. }),
  17806. $globals.TraitTransformation);
  17807. $core.addMethod(
  17808. $core.method({
  17809. selector: "asJavaScriptSource",
  17810. protocol: "converting",
  17811. fn: function (){
  17812. var self=this,$self=this;
  17813. return $core.withContext(function($ctx1) {
  17814. var $2,$3,$1;
  17815. return $recv($globals.String)._streamContents_((function(str){
  17816. return $core.withContext(function($ctx2) {
  17817. $2=$recv($self._trait())._asJavaScriptSource();
  17818. $ctx2.sendIdx["asJavaScriptSource"]=1;
  17819. $3=$recv($self._aliases())._ifNotEmpty_((function(al){
  17820. return $core.withContext(function($ctx3) {
  17821. return [", aliases: ",$recv(al)._asJSONString()];
  17822. }, function($ctx3) {$ctx3.fillBlock({al:al},$ctx2,2)});
  17823. }));
  17824. $ctx2.sendIdx["ifNotEmpty:"]=1;
  17825. $1=["{trait: ",$2,$3,$recv($self._exclusions())._ifNotEmpty_((function(ex){
  17826. return $core.withContext(function($ctx3) {
  17827. return [", exclusions: ",$recv($recv($recv(ex)._asArray())._sorted())._asJavaScriptSource()];
  17828. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  17829. })),"}"];
  17830. return $recv(str)._write_($1);
  17831. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  17832. }));
  17833. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  17834. },
  17835. args: [],
  17836. 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'}' } ]",
  17837. referencedClasses: ["String"],
  17838. pragmas: [],
  17839. messageSends: ["streamContents:", "write:", "asJavaScriptSource", "trait", "ifNotEmpty:", "aliases", "asJSONString", "exclusions", "sorted", "asArray"]
  17840. }),
  17841. $globals.TraitTransformation);
  17842. $core.addMethod(
  17843. $core.method({
  17844. selector: "asTraitComposition",
  17845. protocol: "converting",
  17846. fn: function (){
  17847. var self=this,$self=this;
  17848. return [self];
  17849. },
  17850. args: [],
  17851. source: "asTraitComposition\x0a\x09^ { self }",
  17852. referencedClasses: [],
  17853. pragmas: [],
  17854. messageSends: []
  17855. }),
  17856. $globals.TraitTransformation);
  17857. $core.addMethod(
  17858. $core.method({
  17859. selector: "asTraitTransformation",
  17860. protocol: "converting",
  17861. fn: function (){
  17862. var self=this,$self=this;
  17863. return self;
  17864. },
  17865. args: [],
  17866. source: "asTraitTransformation\x0a\x09^ self",
  17867. referencedClasses: [],
  17868. pragmas: [],
  17869. messageSends: []
  17870. }),
  17871. $globals.TraitTransformation);
  17872. $core.addMethod(
  17873. $core.method({
  17874. selector: "definition",
  17875. protocol: "accessing",
  17876. fn: function (){
  17877. var self=this,$self=this;
  17878. return $core.withContext(function($ctx1) {
  17879. return $recv($globals.String)._streamContents_((function(str){
  17880. return $core.withContext(function($ctx2) {
  17881. $recv(str)._print_($self._trait());
  17882. $recv($self._aliases())._ifNotEmpty_((function(al){
  17883. return $core.withContext(function($ctx3) {
  17884. $recv(str)._write_(" @ {");
  17885. $ctx3.sendIdx["write:"]=1;
  17886. $recv($recv(al)._associations())._do_separatedBy_((function(each){
  17887. return $core.withContext(function($ctx4) {
  17888. $recv(str)._printSymbol_($recv(each)._key());
  17889. $ctx4.sendIdx["printSymbol:"]=1;
  17890. $recv(str)._write_(" -> ");
  17891. $ctx4.sendIdx["write:"]=2;
  17892. return $recv(str)._printSymbol_($recv(each)._value());
  17893. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  17894. }),(function(){
  17895. return $core.withContext(function($ctx4) {
  17896. return $recv(str)._write_(". ");
  17897. $ctx4.sendIdx["write:"]=3;
  17898. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  17899. }));
  17900. $ctx3.sendIdx["do:separatedBy:"]=1;
  17901. return $recv(str)._write_("}");
  17902. $ctx3.sendIdx["write:"]=4;
  17903. }, function($ctx3) {$ctx3.fillBlock({al:al},$ctx2,2)});
  17904. }));
  17905. $ctx2.sendIdx["ifNotEmpty:"]=1;
  17906. return $recv($self._exclusions())._ifNotEmpty_((function(ex){
  17907. return $core.withContext(function($ctx3) {
  17908. $recv(str)._write_(" - #(");
  17909. $ctx3.sendIdx["write:"]=5;
  17910. $recv($recv($recv(ex)._asArray())._sorted())._do_separatedBy_((function(each){
  17911. return $core.withContext(function($ctx4) {
  17912. return $recv(str)._write_($recv($recv(each)._symbolPrintString())._allButFirst());
  17913. $ctx4.sendIdx["write:"]=6;
  17914. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,6)});
  17915. }),(function(){
  17916. return $core.withContext(function($ctx4) {
  17917. return $recv(str)._space();
  17918. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,7)});
  17919. }));
  17920. return $recv(str)._write_(")");
  17921. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,5)});
  17922. }));
  17923. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  17924. }));
  17925. }, function($ctx1) {$ctx1.fill(self,"definition",{})});
  17926. },
  17927. args: [],
  17928. 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: ')' ] ]",
  17929. referencedClasses: ["String"],
  17930. pragmas: [],
  17931. messageSends: ["streamContents:", "print:", "trait", "ifNotEmpty:", "aliases", "write:", "do:separatedBy:", "associations", "printSymbol:", "key", "value", "exclusions", "sorted", "asArray", "allButFirst", "symbolPrintString", "space"]
  17932. }),
  17933. $globals.TraitTransformation);
  17934. $core.addMethod(
  17935. $core.method({
  17936. selector: "exclusions",
  17937. protocol: "accessing",
  17938. fn: function (){
  17939. var self=this,$self=this;
  17940. return $self.exclusions;
  17941. },
  17942. args: [],
  17943. source: "exclusions\x0a\x09^ exclusions",
  17944. referencedClasses: [],
  17945. pragmas: [],
  17946. messageSends: []
  17947. }),
  17948. $globals.TraitTransformation);
  17949. $core.addMethod(
  17950. $core.method({
  17951. selector: "initialize",
  17952. protocol: "initialization",
  17953. fn: function (){
  17954. var self=this,$self=this;
  17955. return $core.withContext(function($ctx1) {
  17956. (
  17957. $ctx1.supercall = true,
  17958. ($globals.TraitTransformation.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  17959. $ctx1.supercall = false;
  17960. $self.aliases=$globals.HashedCollection._newFromPairs_([]);
  17961. $self.exclusions=$recv($globals.Set)._new();
  17962. $self.trait=nil;
  17963. return self;
  17964. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  17965. },
  17966. args: [],
  17967. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09aliases := #{}.\x0a\x09exclusions := Set new.\x0a\x09trait := nil",
  17968. referencedClasses: ["Set"],
  17969. pragmas: [],
  17970. messageSends: ["initialize", "new"]
  17971. }),
  17972. $globals.TraitTransformation);
  17973. $core.addMethod(
  17974. $core.method({
  17975. selector: "postCopy",
  17976. protocol: "copying",
  17977. fn: function (){
  17978. var self=this,$self=this;
  17979. return $core.withContext(function($ctx1) {
  17980. $self.aliases=$recv($self.aliases)._copy();
  17981. $ctx1.sendIdx["copy"]=1;
  17982. $self.exclusions=$recv($self.exclusions)._copy();
  17983. return self;
  17984. }, function($ctx1) {$ctx1.fill(self,"postCopy",{})});
  17985. },
  17986. args: [],
  17987. source: "postCopy\x0a\x09aliases := aliases copy.\x0a\x09exclusions := exclusions copy",
  17988. referencedClasses: [],
  17989. pragmas: [],
  17990. messageSends: ["copy"]
  17991. }),
  17992. $globals.TraitTransformation);
  17993. $core.addMethod(
  17994. $core.method({
  17995. selector: "trait",
  17996. protocol: "accessing",
  17997. fn: function (){
  17998. var self=this,$self=this;
  17999. return $self.trait;
  18000. },
  18001. args: [],
  18002. source: "trait\x0a\x09^ trait",
  18003. referencedClasses: [],
  18004. pragmas: [],
  18005. messageSends: []
  18006. }),
  18007. $globals.TraitTransformation);
  18008. $core.addMethod(
  18009. $core.method({
  18010. selector: "trait:",
  18011. protocol: "accessing",
  18012. fn: function (anObject){
  18013. var self=this,$self=this;
  18014. $self.trait=anObject;
  18015. return self;
  18016. },
  18017. args: ["anObject"],
  18018. source: "trait: anObject\x0a\x09trait := anObject",
  18019. referencedClasses: [],
  18020. pragmas: [],
  18021. messageSends: []
  18022. }),
  18023. $globals.TraitTransformation);
  18024. $core.addMethod(
  18025. $core.method({
  18026. selector: "fromJSON:",
  18027. protocol: "instance creation",
  18028. fn: function (aJSObject){
  18029. var self=this,$self=this;
  18030. return $core.withContext(function($ctx1) {
  18031. var $1,$4,$3,$2;
  18032. $1=(
  18033. $ctx1.supercall = true,
  18034. ($globals.TraitTransformation.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  18035. $ctx1.supercall = false;
  18036. $recv($1)._trait_($recv(aJSObject)._at_("trait"));
  18037. $4=$recv(aJSObject)._at_ifAbsent_("aliases",(function(){
  18038. return $globals.HashedCollection._newFromPairs_([]);
  18039. }));
  18040. $ctx1.sendIdx["at:ifAbsent:"]=1;
  18041. $3=$recv($globals.Smalltalk)._readJSObject_($4);
  18042. $2=$recv($3)._associations();
  18043. $recv($1)._addAliases_($2);
  18044. $recv($1)._addExclusions_($recv(aJSObject)._at_ifAbsent_("exclusions",(function(){
  18045. return [];
  18046. })));
  18047. return $recv($1)._yourself();
  18048. }, function($ctx1) {$ctx1.fill(self,"fromJSON:",{aJSObject:aJSObject})});
  18049. },
  18050. args: ["aJSObject"],
  18051. 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",
  18052. referencedClasses: ["Smalltalk"],
  18053. pragmas: [],
  18054. messageSends: ["trait:", "new", "at:", "addAliases:", "associations", "readJSObject:", "at:ifAbsent:", "addExclusions:", "yourself"]
  18055. }),
  18056. $globals.TraitTransformation.a$cls);
  18057. $core.addMethod(
  18058. $core.method({
  18059. selector: "on:",
  18060. protocol: "instance creation",
  18061. fn: function (aTrait){
  18062. var self=this,$self=this;
  18063. return $core.withContext(function($ctx1) {
  18064. var $1;
  18065. $1=(
  18066. $ctx1.supercall = true,
  18067. ($globals.TraitTransformation.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  18068. $ctx1.supercall = false;
  18069. $recv($1)._trait_(aTrait);
  18070. return $recv($1)._yourself();
  18071. }, function($ctx1) {$ctx1.fill(self,"on:",{aTrait:aTrait})});
  18072. },
  18073. args: ["aTrait"],
  18074. source: "on: aTrait\x0a\x09^ super new trait: aTrait; yourself",
  18075. referencedClasses: [],
  18076. pragmas: [],
  18077. messageSends: ["trait:", "new", "yourself"]
  18078. }),
  18079. $globals.TraitTransformation.a$cls);
  18080. $core.setTraitComposition([{trait: $globals.TBehaviorDefaults}, {trait: $globals.TBehaviorProvider}], $globals.Behavior);
  18081. $core.setTraitComposition([{trait: $globals.TMasterBehavior}, {trait: $globals.TSubclassable}], $globals.Class);
  18082. $core.setTraitComposition([{trait: $globals.TBehaviorDefaults}, {trait: $globals.TBehaviorProvider}, {trait: $globals.TMasterBehavior}], $globals.Trait);
  18083. $core.addMethod(
  18084. $core.method({
  18085. selector: "asTraitComposition",
  18086. protocol: "*Kernel-Classes",
  18087. fn: function (){
  18088. var self=this,$self=this;
  18089. return $core.withContext(function($ctx1) {
  18090. return $self._collect_((function(each){
  18091. return $core.withContext(function($ctx2) {
  18092. return $recv(each)._asTraitTransformation();
  18093. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18094. }));
  18095. }, function($ctx1) {$ctx1.fill(self,"asTraitComposition",{})});
  18096. },
  18097. args: [],
  18098. source: "asTraitComposition\x0a\x09\x22not implemented yet, noop atm\x22\x0a\x09^ self collect: [ :each | each asTraitTransformation ]",
  18099. referencedClasses: [],
  18100. pragmas: [],
  18101. messageSends: ["collect:", "asTraitTransformation"]
  18102. }),
  18103. $globals.Array);
  18104. $core.addMethod(
  18105. $core.method({
  18106. selector: "instanceVariablesStringAsSlotList",
  18107. protocol: "*Kernel-Classes",
  18108. fn: function (){
  18109. var self=this,$self=this;
  18110. return $core.withContext(function($ctx1) {
  18111. return $recv($self._tokenize_(" "))._reject_((function(each){
  18112. return $core.withContext(function($ctx2) {
  18113. return $recv(each)._isEmpty();
  18114. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18115. }));
  18116. }, function($ctx1) {$ctx1.fill(self,"instanceVariablesStringAsSlotList",{})});
  18117. },
  18118. args: [],
  18119. source: "instanceVariablesStringAsSlotList\x0a\x09^ (self tokenize: ' ') reject: [ :each | each isEmpty ]",
  18120. referencedClasses: [],
  18121. pragmas: [],
  18122. messageSends: ["reject:", "tokenize:", "isEmpty"]
  18123. }),
  18124. $globals.String);
  18125. });
  18126. define('amber/core/Kernel-Methods',["amber/boot", "require", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  18127. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  18128. var $pkg = $core.addPackage("Kernel-Methods");
  18129. $pkg.innerEval = function (expr) { return eval(expr); };
  18130. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  18131. $core.addClass("BlockClosure", $globals.Object, ["prototype", "length"], "Kernel-Methods");
  18132. $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 | ... ] `";
  18133. $core.addMethod(
  18134. $core.method({
  18135. selector: "applyTo:arguments:",
  18136. protocol: "evaluating",
  18137. fn: function (anObject,aCollection){
  18138. var self=this,$self=this;
  18139. return $core.withContext(function($ctx1) {
  18140. return self.apply(anObject, aCollection);
  18141. return self;
  18142. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection})});
  18143. },
  18144. args: ["anObject", "aCollection"],
  18145. source: "applyTo: anObject arguments: aCollection\x0a\x09<inlineJS: 'return self.apply(anObject, aCollection)'>",
  18146. referencedClasses: [],
  18147. pragmas: [["inlineJS:", ["return self.apply(anObject, aCollection)"]]],
  18148. messageSends: []
  18149. }),
  18150. $globals.BlockClosure);
  18151. $core.addMethod(
  18152. $core.method({
  18153. selector: "asCompiledMethod:",
  18154. protocol: "converting",
  18155. fn: function (aString){
  18156. var self=this,$self=this;
  18157. return $core.withContext(function($ctx1) {
  18158. return $core.method({selector:aString, fn:self});;
  18159. return self;
  18160. }, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString})});
  18161. },
  18162. args: ["aString"],
  18163. source: "asCompiledMethod: aString\x0a\x09<inlineJS: 'return $core.method({selector:aString, fn:self});'>",
  18164. referencedClasses: [],
  18165. pragmas: [["inlineJS:", ["return $core.method({selector:aString, fn:self});"]]],
  18166. messageSends: []
  18167. }),
  18168. $globals.BlockClosure);
  18169. $core.addMethod(
  18170. $core.method({
  18171. selector: "compiledSource",
  18172. protocol: "accessing",
  18173. fn: function (){
  18174. var self=this,$self=this;
  18175. return $core.withContext(function($ctx1) {
  18176. return self.toString();
  18177. return self;
  18178. }, function($ctx1) {$ctx1.fill(self,"compiledSource",{})});
  18179. },
  18180. args: [],
  18181. source: "compiledSource\x0a\x09<inlineJS: 'return self.toString()'>",
  18182. referencedClasses: [],
  18183. pragmas: [["inlineJS:", ["return self.toString()"]]],
  18184. messageSends: []
  18185. }),
  18186. $globals.BlockClosure);
  18187. $core.addMethod(
  18188. $core.method({
  18189. selector: "currySelf",
  18190. protocol: "converting",
  18191. fn: function (){
  18192. var self=this,$self=this;
  18193. return $core.withContext(function($ctx1) {
  18194. return function () {
  18195. var args = [ this ];
  18196. args.push.apply(args, arguments);
  18197. return self.apply(null, args);
  18198. }
  18199. ;
  18200. return self;
  18201. }, function($ctx1) {$ctx1.fill(self,"currySelf",{})});
  18202. },
  18203. args: [],
  18204. 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'>",
  18205. referencedClasses: [],
  18206. 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"]]],
  18207. messageSends: []
  18208. }),
  18209. $globals.BlockClosure);
  18210. $core.addMethod(
  18211. $core.method({
  18212. selector: "ensure:",
  18213. protocol: "evaluating",
  18214. fn: function (aBlock){
  18215. var self=this,$self=this;
  18216. return $core.withContext(function($ctx1) {
  18217. try{return $self._value()}finally{aBlock._value()};
  18218. return self;
  18219. }, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock})});
  18220. },
  18221. args: ["aBlock"],
  18222. source: "ensure: aBlock\x0a\x09<inlineJS: 'try{return $self._value()}finally{aBlock._value()}'>",
  18223. referencedClasses: [],
  18224. pragmas: [["inlineJS:", ["try{return $self._value()}finally{aBlock._value()}"]]],
  18225. messageSends: []
  18226. }),
  18227. $globals.BlockClosure);
  18228. $core.addMethod(
  18229. $core.method({
  18230. selector: "fork",
  18231. protocol: "timeout/interval",
  18232. fn: function (){
  18233. var self=this,$self=this;
  18234. return $core.withContext(function($ctx1) {
  18235. $recv($recv($globals.ForkPool)._default())._fork_(self);
  18236. return self;
  18237. }, function($ctx1) {$ctx1.fill(self,"fork",{})});
  18238. },
  18239. args: [],
  18240. source: "fork\x0a\x09ForkPool default fork: self",
  18241. referencedClasses: ["ForkPool"],
  18242. pragmas: [],
  18243. messageSends: ["fork:", "default"]
  18244. }),
  18245. $globals.BlockClosure);
  18246. $core.addMethod(
  18247. $core.method({
  18248. selector: "new",
  18249. protocol: "evaluating",
  18250. fn: function (){
  18251. var self=this,$self=this;
  18252. return $core.withContext(function($ctx1) {
  18253. return new self();
  18254. return self;
  18255. }, function($ctx1) {$ctx1.fill(self,"new",{})});
  18256. },
  18257. args: [],
  18258. 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()'>",
  18259. referencedClasses: [],
  18260. pragmas: [["inlineJS:", ["return new self()"]]],
  18261. messageSends: []
  18262. }),
  18263. $globals.BlockClosure);
  18264. $core.addMethod(
  18265. $core.method({
  18266. selector: "newValue:",
  18267. protocol: "evaluating",
  18268. fn: function (anObject){
  18269. var self=this,$self=this;
  18270. return $core.withContext(function($ctx1) {
  18271. return $self._newWithValues_([anObject]);
  18272. }, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject})});
  18273. },
  18274. args: ["anObject"],
  18275. source: "newValue: anObject\x0a\x09^ self newWithValues: { anObject }",
  18276. referencedClasses: [],
  18277. pragmas: [],
  18278. messageSends: ["newWithValues:"]
  18279. }),
  18280. $globals.BlockClosure);
  18281. $core.addMethod(
  18282. $core.method({
  18283. selector: "newValue:value:",
  18284. protocol: "evaluating",
  18285. fn: function (anObject,anObject2){
  18286. var self=this,$self=this;
  18287. return $core.withContext(function($ctx1) {
  18288. return $self._newWithValues_([anObject,anObject2]);
  18289. }, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2})});
  18290. },
  18291. args: ["anObject", "anObject2"],
  18292. source: "newValue: anObject value: anObject2\x0a\x09^ self newWithValues: { anObject. anObject2 }.",
  18293. referencedClasses: [],
  18294. pragmas: [],
  18295. messageSends: ["newWithValues:"]
  18296. }),
  18297. $globals.BlockClosure);
  18298. $core.addMethod(
  18299. $core.method({
  18300. selector: "newValue:value:value:",
  18301. protocol: "evaluating",
  18302. fn: function (anObject,anObject2,anObject3){
  18303. var self=this,$self=this;
  18304. return $core.withContext(function($ctx1) {
  18305. return $self._newWithValues_([anObject,anObject2,anObject3]);
  18306. }, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3})});
  18307. },
  18308. args: ["anObject", "anObject2", "anObject3"],
  18309. source: "newValue: anObject value: anObject2 value: anObject3\x0a\x09^ self newWithValues: { anObject. anObject2. anObject3 }.",
  18310. referencedClasses: [],
  18311. pragmas: [],
  18312. messageSends: ["newWithValues:"]
  18313. }),
  18314. $globals.BlockClosure);
  18315. $core.addMethod(
  18316. $core.method({
  18317. selector: "newWithValues:",
  18318. protocol: "evaluating",
  18319. fn: function (aCollection){
  18320. var self=this,$self=this;
  18321. return $core.withContext(function($ctx1) {
  18322. var object = Object.create(self.prototype);
  18323. var result = self.apply(object, aCollection);
  18324. return typeof result === "object" ? result : object;
  18325. ;
  18326. return self;
  18327. }, function($ctx1) {$ctx1.fill(self,"newWithValues:",{aCollection:aCollection})});
  18328. },
  18329. args: ["aCollection"],
  18330. 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'>",
  18331. referencedClasses: [],
  18332. 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"]]],
  18333. messageSends: []
  18334. }),
  18335. $globals.BlockClosure);
  18336. $core.addMethod(
  18337. $core.method({
  18338. selector: "numArgs",
  18339. protocol: "accessing",
  18340. fn: function (){
  18341. var self=this,$self=this;
  18342. return $self.length;
  18343. },
  18344. args: [],
  18345. source: "numArgs\x0a\x09^ length",
  18346. referencedClasses: [],
  18347. pragmas: [],
  18348. messageSends: []
  18349. }),
  18350. $globals.BlockClosure);
  18351. $core.addMethod(
  18352. $core.method({
  18353. selector: "on:do:",
  18354. protocol: "error handling",
  18355. fn: function (anErrorClass,aBlock){
  18356. var self=this,$self=this;
  18357. return $core.withContext(function($ctx1) {
  18358. var $1;
  18359. return $self._tryCatch_((function(error){
  18360. var smalltalkError;
  18361. return $core.withContext(function($ctx2) {
  18362. smalltalkError=$recv($globals.Smalltalk)._asSmalltalkException_(error);
  18363. $1=$recv(smalltalkError)._isKindOf_(anErrorClass);
  18364. if($core.assert($1)){
  18365. return $recv(aBlock)._value_(smalltalkError);
  18366. } else {
  18367. return $recv(smalltalkError)._pass();
  18368. }
  18369. }, function($ctx2) {$ctx2.fillBlock({error:error,smalltalkError:smalltalkError},$ctx1,1)});
  18370. }));
  18371. }, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock})});
  18372. },
  18373. args: ["anErrorClass", "aBlock"],
  18374. source: "on: anErrorClass do: aBlock\x0a\x09\x22All exceptions thrown in the Smalltalk stack are cought.\x0a\x09Convert all JS exceptions to JavaScriptException instances.\x22\x0a\x09\x0a\x09^ self tryCatch: [ :error | | smalltalkError |\x0a\x09\x09smalltalkError := Smalltalk asSmalltalkException: error.\x0a\x09\x09(smalltalkError isKindOf: anErrorClass)\x0a\x09\x09ifTrue: [ aBlock value: smalltalkError ]\x0a\x09\x09ifFalse: [ smalltalkError pass ] ]",
  18375. referencedClasses: ["Smalltalk"],
  18376. pragmas: [],
  18377. messageSends: ["tryCatch:", "asSmalltalkException:", "ifTrue:ifFalse:", "isKindOf:", "value:", "pass"]
  18378. }),
  18379. $globals.BlockClosure);
  18380. $core.addMethod(
  18381. $core.method({
  18382. selector: "prototype",
  18383. protocol: "accessing",
  18384. fn: function (){
  18385. var self=this,$self=this;
  18386. return $self.prototype;
  18387. },
  18388. args: [],
  18389. source: "prototype\x0a\x09^ prototype",
  18390. referencedClasses: [],
  18391. pragmas: [],
  18392. messageSends: []
  18393. }),
  18394. $globals.BlockClosure);
  18395. $core.addMethod(
  18396. $core.method({
  18397. selector: "provided",
  18398. protocol: "converting",
  18399. fn: function (){
  18400. var self=this,$self=this;
  18401. return $core.withContext(function($ctx1) {
  18402. return $recv($globals.JSObjectProxy)._on_(self);
  18403. }, function($ctx1) {$ctx1.fill(self,"provided",{})});
  18404. },
  18405. args: [],
  18406. 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",
  18407. referencedClasses: ["JSObjectProxy"],
  18408. pragmas: [],
  18409. messageSends: ["on:"]
  18410. }),
  18411. $globals.BlockClosure);
  18412. $core.addMethod(
  18413. $core.method({
  18414. selector: "receiver",
  18415. protocol: "accessing",
  18416. fn: function (){
  18417. var self=this,$self=this;
  18418. return nil;
  18419. },
  18420. args: [],
  18421. source: "receiver\x0a\x09^ nil",
  18422. referencedClasses: [],
  18423. pragmas: [],
  18424. messageSends: []
  18425. }),
  18426. $globals.BlockClosure);
  18427. $core.addMethod(
  18428. $core.method({
  18429. selector: "timeToRun",
  18430. protocol: "evaluating",
  18431. fn: function (){
  18432. var self=this,$self=this;
  18433. return $core.withContext(function($ctx1) {
  18434. return $recv($globals.Date)._millisecondsToRun_(self);
  18435. }, function($ctx1) {$ctx1.fill(self,"timeToRun",{})});
  18436. },
  18437. args: [],
  18438. source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
  18439. referencedClasses: ["Date"],
  18440. pragmas: [],
  18441. messageSends: ["millisecondsToRun:"]
  18442. }),
  18443. $globals.BlockClosure);
  18444. $core.addMethod(
  18445. $core.method({
  18446. selector: "tryCatch:",
  18447. protocol: "error handling",
  18448. fn: function (aBlock){
  18449. var self=this,$self=this;
  18450. return $core.withContext(function($ctx1) {
  18451. try {
  18452. return $self._value();
  18453. } catch(error) {
  18454. // pass non-local returns undetected
  18455. if (Array.isArray(error) && error.length === 1) throw error;
  18456. return aBlock._value_(error);
  18457. }
  18458. ;
  18459. return self;
  18460. }, function($ctx1) {$ctx1.fill(self,"tryCatch:",{aBlock:aBlock})});
  18461. },
  18462. args: ["aBlock"],
  18463. 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'>",
  18464. referencedClasses: [],
  18465. 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"]]],
  18466. messageSends: []
  18467. }),
  18468. $globals.BlockClosure);
  18469. $core.addMethod(
  18470. $core.method({
  18471. selector: "value",
  18472. protocol: "evaluating",
  18473. fn: function (){
  18474. var self=this,$self=this;
  18475. return $core.withContext(function($ctx1) {
  18476. return self();;
  18477. return self;
  18478. }, function($ctx1) {$ctx1.fill(self,"value",{})});
  18479. },
  18480. args: [],
  18481. source: "value\x0a\x09<inlineJS: 'return self();'>",
  18482. referencedClasses: [],
  18483. pragmas: [["inlineJS:", ["return self();"]]],
  18484. messageSends: []
  18485. }),
  18486. $globals.BlockClosure);
  18487. $core.addMethod(
  18488. $core.method({
  18489. selector: "value:",
  18490. protocol: "evaluating",
  18491. fn: function (anArg){
  18492. var self=this,$self=this;
  18493. return $core.withContext(function($ctx1) {
  18494. return self(anArg);;
  18495. return self;
  18496. }, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg})});
  18497. },
  18498. args: ["anArg"],
  18499. source: "value: anArg\x0a\x09<inlineJS: 'return self(anArg);'>",
  18500. referencedClasses: [],
  18501. pragmas: [["inlineJS:", ["return self(anArg);"]]],
  18502. messageSends: []
  18503. }),
  18504. $globals.BlockClosure);
  18505. $core.addMethod(
  18506. $core.method({
  18507. selector: "value:value:",
  18508. protocol: "evaluating",
  18509. fn: function (firstArg,secondArg){
  18510. var self=this,$self=this;
  18511. return $core.withContext(function($ctx1) {
  18512. return self(firstArg, secondArg);;
  18513. return self;
  18514. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg})});
  18515. },
  18516. args: ["firstArg", "secondArg"],
  18517. source: "value: firstArg value: secondArg\x0a\x09<inlineJS: 'return self(firstArg, secondArg);'>",
  18518. referencedClasses: [],
  18519. pragmas: [["inlineJS:", ["return self(firstArg, secondArg);"]]],
  18520. messageSends: []
  18521. }),
  18522. $globals.BlockClosure);
  18523. $core.addMethod(
  18524. $core.method({
  18525. selector: "value:value:value:",
  18526. protocol: "evaluating",
  18527. fn: function (firstArg,secondArg,thirdArg){
  18528. var self=this,$self=this;
  18529. return $core.withContext(function($ctx1) {
  18530. return self(firstArg, secondArg, thirdArg);;
  18531. return self;
  18532. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg})});
  18533. },
  18534. args: ["firstArg", "secondArg", "thirdArg"],
  18535. source: "value: firstArg value: secondArg value: thirdArg\x0a\x09<inlineJS: 'return self(firstArg, secondArg, thirdArg);'>",
  18536. referencedClasses: [],
  18537. pragmas: [["inlineJS:", ["return self(firstArg, secondArg, thirdArg);"]]],
  18538. messageSends: []
  18539. }),
  18540. $globals.BlockClosure);
  18541. $core.addMethod(
  18542. $core.method({
  18543. selector: "valueWithInterval:",
  18544. protocol: "timeout/interval",
  18545. fn: function (aNumber){
  18546. var self=this,$self=this;
  18547. return $core.withContext(function($ctx1) {
  18548. var interval = setInterval(self, aNumber);
  18549. return $globals.Timeout._on_(interval);
  18550. ;
  18551. return self;
  18552. }, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber})});
  18553. },
  18554. args: ["aNumber"],
  18555. source: "valueWithInterval: aNumber\x0a\x09<inlineJS: '\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(interval);\x0a\x09'>",
  18556. referencedClasses: [],
  18557. pragmas: [["inlineJS:", ["\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(interval);\x0a\x09"]]],
  18558. messageSends: []
  18559. }),
  18560. $globals.BlockClosure);
  18561. $core.addMethod(
  18562. $core.method({
  18563. selector: "valueWithPossibleArguments:",
  18564. protocol: "evaluating",
  18565. fn: function (aCollection){
  18566. var self=this,$self=this;
  18567. return $core.withContext(function($ctx1) {
  18568. return self.apply(null, aCollection);;
  18569. return self;
  18570. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection})});
  18571. },
  18572. args: ["aCollection"],
  18573. source: "valueWithPossibleArguments: aCollection\x0a\x09<inlineJS: 'return self.apply(null, aCollection);'>",
  18574. referencedClasses: [],
  18575. pragmas: [["inlineJS:", ["return self.apply(null, aCollection);"]]],
  18576. messageSends: []
  18577. }),
  18578. $globals.BlockClosure);
  18579. $core.addMethod(
  18580. $core.method({
  18581. selector: "valueWithTimeout:",
  18582. protocol: "timeout/interval",
  18583. fn: function (aNumber){
  18584. var self=this,$self=this;
  18585. return $core.withContext(function($ctx1) {
  18586. var timeout = setTimeout(self, aNumber);
  18587. return $globals.Timeout._on_(timeout);
  18588. ;
  18589. return self;
  18590. }, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber})});
  18591. },
  18592. args: ["aNumber"],
  18593. source: "valueWithTimeout: aNumber\x0a\x09<inlineJS: '\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(timeout);\x0a\x09'>",
  18594. referencedClasses: [],
  18595. pragmas: [["inlineJS:", ["\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(timeout);\x0a\x09"]]],
  18596. messageSends: []
  18597. }),
  18598. $globals.BlockClosure);
  18599. $core.addMethod(
  18600. $core.method({
  18601. selector: "whileFalse",
  18602. protocol: "controlling",
  18603. fn: function (){
  18604. var self=this,$self=this;
  18605. return $core.withContext(function($ctx1) {
  18606. $self._whileFalse_((function(){
  18607. }));
  18608. return self;
  18609. }, function($ctx1) {$ctx1.fill(self,"whileFalse",{})});
  18610. },
  18611. args: [],
  18612. source: "whileFalse\x0a\x09self whileFalse: []",
  18613. referencedClasses: [],
  18614. pragmas: [],
  18615. messageSends: ["whileFalse:"]
  18616. }),
  18617. $globals.BlockClosure);
  18618. $core.addMethod(
  18619. $core.method({
  18620. selector: "whileFalse:",
  18621. protocol: "controlling",
  18622. fn: function (aBlock){
  18623. var self=this,$self=this;
  18624. return $core.withContext(function($ctx1) {
  18625. while(!$core.assert($self._value())) {aBlock._value()};
  18626. return self;
  18627. }, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock})});
  18628. },
  18629. args: ["aBlock"],
  18630. source: "whileFalse: aBlock\x0a\x09<inlineJS: 'while(!$core.assert($self._value())) {aBlock._value()}'>",
  18631. referencedClasses: [],
  18632. pragmas: [["inlineJS:", ["while(!$core.assert($self._value())) {aBlock._value()}"]]],
  18633. messageSends: []
  18634. }),
  18635. $globals.BlockClosure);
  18636. $core.addMethod(
  18637. $core.method({
  18638. selector: "whileTrue",
  18639. protocol: "controlling",
  18640. fn: function (){
  18641. var self=this,$self=this;
  18642. return $core.withContext(function($ctx1) {
  18643. $self._whileTrue_((function(){
  18644. }));
  18645. return self;
  18646. }, function($ctx1) {$ctx1.fill(self,"whileTrue",{})});
  18647. },
  18648. args: [],
  18649. source: "whileTrue\x0a\x09self whileTrue: []",
  18650. referencedClasses: [],
  18651. pragmas: [],
  18652. messageSends: ["whileTrue:"]
  18653. }),
  18654. $globals.BlockClosure);
  18655. $core.addMethod(
  18656. $core.method({
  18657. selector: "whileTrue:",
  18658. protocol: "controlling",
  18659. fn: function (aBlock){
  18660. var self=this,$self=this;
  18661. return $core.withContext(function($ctx1) {
  18662. while($core.assert($self._value())) {aBlock._value()};
  18663. return self;
  18664. }, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock})});
  18665. },
  18666. args: ["aBlock"],
  18667. source: "whileTrue: aBlock\x0a\x09<inlineJS: 'while($core.assert($self._value())) {aBlock._value()}'>",
  18668. referencedClasses: [],
  18669. pragmas: [["inlineJS:", ["while($core.assert($self._value())) {aBlock._value()}"]]],
  18670. messageSends: []
  18671. }),
  18672. $globals.BlockClosure);
  18673. $core.addClass("CompiledMethod", $globals.Object, ["args", "fn", "messageSends", "pragmas", "owner", "methodClass", "protocol", "referencedClasses", "selector", "source"], "Kernel-Methods");
  18674. $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";
  18675. $core.addMethod(
  18676. $core.method({
  18677. selector: "arguments",
  18678. protocol: "accessing",
  18679. fn: function (){
  18680. var self=this,$self=this;
  18681. return $core.withContext(function($ctx1) {
  18682. var $1,$receiver;
  18683. $1=$self.args;
  18684. if(($receiver = $1) == null || $receiver.a$nil){
  18685. return [];
  18686. } else {
  18687. return $1;
  18688. }
  18689. }, function($ctx1) {$ctx1.fill(self,"arguments",{})});
  18690. },
  18691. args: [],
  18692. source: "arguments\x0a\x09^ args ifNil: [ #() ]",
  18693. referencedClasses: [],
  18694. pragmas: [],
  18695. messageSends: ["ifNil:"]
  18696. }),
  18697. $globals.CompiledMethod);
  18698. $core.addMethod(
  18699. $core.method({
  18700. selector: "asString",
  18701. protocol: "converting",
  18702. fn: function (){
  18703. var self=this,$self=this;
  18704. return $core.withContext(function($ctx1) {
  18705. return $self._asStringForClass_($self._methodClass());
  18706. }, function($ctx1) {$ctx1.fill(self,"asString",{})});
  18707. },
  18708. args: [],
  18709. source: "asString\x0a\x09^ self asStringForClass: self methodClass",
  18710. referencedClasses: [],
  18711. pragmas: [],
  18712. messageSends: ["asStringForClass:", "methodClass"]
  18713. }),
  18714. $globals.CompiledMethod);
  18715. $core.addMethod(
  18716. $core.method({
  18717. selector: "asStringForClass:",
  18718. protocol: "converting",
  18719. fn: function (aClass){
  18720. var self=this,$self=this;
  18721. var result;
  18722. return $core.withContext(function($ctx1) {
  18723. var $2,$1,$4,$6,$7,$5,$3,$10,$9,$12,$11,$8,$14,$16,$15,$13,$17,$receiver;
  18724. result=$recv(aClass)._name();
  18725. $ctx1.sendIdx["name"]=1;
  18726. $2=$self._methodClass();
  18727. $ctx1.sendIdx["methodClass"]=1;
  18728. $1=$recv($2).__eq(aClass);
  18729. $ctx1.sendIdx["="]=1;
  18730. if(!$core.assert($1)){
  18731. $4=$recv(result).__comma(" (");
  18732. $ctx1.sendIdx[","]=3;
  18733. $6=$self._methodClass();
  18734. $ctx1.sendIdx["methodClass"]=2;
  18735. if(($receiver = $6) == null || $receiver.a$nil){
  18736. $5="nil";
  18737. } else {
  18738. $7=$self._methodClass();
  18739. $ctx1.sendIdx["methodClass"]=3;
  18740. $5=$recv($7)._name();
  18741. $ctx1.sendIdx["name"]=2;
  18742. }
  18743. $3=$recv($4).__comma($5);
  18744. $ctx1.sendIdx[","]=2;
  18745. result=$recv($3).__comma(")");
  18746. $ctx1.sendIdx[","]=1;
  18747. result;
  18748. }
  18749. $10=$self._origin();
  18750. $ctx1.sendIdx["origin"]=1;
  18751. $9=$recv($10).__eq(aClass);
  18752. $ctx1.sendIdx["="]=2;
  18753. $12=$self._origin();
  18754. $ctx1.sendIdx["origin"]=2;
  18755. $11=$recv($12).__eq($self._methodClass());
  18756. $8=$recv($9).__or($11);
  18757. if(!$core.assert($8)){
  18758. $14=$recv(result).__comma(" /");
  18759. $ctx1.sendIdx[","]=6;
  18760. $16=$self._origin();
  18761. $ctx1.sendIdx["origin"]=3;
  18762. if(($receiver = $16) == null || $receiver.a$nil){
  18763. $15="nil";
  18764. } else {
  18765. $15=$recv($self._origin())._name();
  18766. }
  18767. $13=$recv($14).__comma($15);
  18768. $ctx1.sendIdx[","]=5;
  18769. result=$recv($13).__comma("/");
  18770. $ctx1.sendIdx[","]=4;
  18771. result;
  18772. }
  18773. $17=$recv($recv(result).__comma(" >> ")).__comma($recv($self._selector())._symbolPrintString());
  18774. $ctx1.sendIdx[","]=7;
  18775. return $17;
  18776. }, function($ctx1) {$ctx1.fill(self,"asStringForClass:",{aClass:aClass,result:result})});
  18777. },
  18778. args: ["aClass"],
  18779. 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",
  18780. referencedClasses: [],
  18781. pragmas: [],
  18782. messageSends: ["name", "ifFalse:", "=", "methodClass", ",", "ifNil:ifNotNil:", "|", "origin", "symbolPrintString", "selector"]
  18783. }),
  18784. $globals.CompiledMethod);
  18785. $core.addMethod(
  18786. $core.method({
  18787. selector: "basicPragmas",
  18788. protocol: "accessing",
  18789. fn: function (){
  18790. var self=this,$self=this;
  18791. return $core.withContext(function($ctx1) {
  18792. var $1,$receiver;
  18793. $1=$self.pragmas;
  18794. if(($receiver = $1) == null || $receiver.a$nil){
  18795. return [];
  18796. } else {
  18797. return $1;
  18798. }
  18799. }, function($ctx1) {$ctx1.fill(self,"basicPragmas",{})});
  18800. },
  18801. args: [],
  18802. source: "basicPragmas\x0a\x09^ pragmas ifNil: [ #() ]",
  18803. referencedClasses: [],
  18804. pragmas: [],
  18805. messageSends: ["ifNil:"]
  18806. }),
  18807. $globals.CompiledMethod);
  18808. $core.addMethod(
  18809. $core.method({
  18810. selector: "browse",
  18811. protocol: "browsing",
  18812. fn: function (){
  18813. var self=this,$self=this;
  18814. return $core.withContext(function($ctx1) {
  18815. $recv($globals.Finder)._findMethod_(self);
  18816. return self;
  18817. }, function($ctx1) {$ctx1.fill(self,"browse",{})});
  18818. },
  18819. args: [],
  18820. source: "browse\x0a\x09Finder findMethod: self",
  18821. referencedClasses: ["Finder"],
  18822. pragmas: [],
  18823. messageSends: ["findMethod:"]
  18824. }),
  18825. $globals.CompiledMethod);
  18826. $core.addMethod(
  18827. $core.method({
  18828. selector: "category",
  18829. protocol: "accessing",
  18830. fn: function (){
  18831. var self=this,$self=this;
  18832. return $core.withContext(function($ctx1) {
  18833. return $self._protocol();
  18834. }, function($ctx1) {$ctx1.fill(self,"category",{})});
  18835. },
  18836. args: [],
  18837. source: "category\x0a\x09^ self protocol",
  18838. referencedClasses: [],
  18839. pragmas: [],
  18840. messageSends: ["protocol"]
  18841. }),
  18842. $globals.CompiledMethod);
  18843. $core.addMethod(
  18844. $core.method({
  18845. selector: "defaultProtocol",
  18846. protocol: "defaults",
  18847. fn: function (){
  18848. var self=this,$self=this;
  18849. return "as yet unclassified";
  18850. },
  18851. args: [],
  18852. source: "defaultProtocol\x0a\x09^ 'as yet unclassified'",
  18853. referencedClasses: [],
  18854. pragmas: [],
  18855. messageSends: []
  18856. }),
  18857. $globals.CompiledMethod);
  18858. $core.addMethod(
  18859. $core.method({
  18860. selector: "fn",
  18861. protocol: "accessing",
  18862. fn: function (){
  18863. var self=this,$self=this;
  18864. return $self.fn;
  18865. },
  18866. args: [],
  18867. source: "fn\x0a\x09^ fn",
  18868. referencedClasses: [],
  18869. pragmas: [],
  18870. messageSends: []
  18871. }),
  18872. $globals.CompiledMethod);
  18873. $core.addMethod(
  18874. $core.method({
  18875. selector: "fn:",
  18876. protocol: "accessing",
  18877. fn: function (aBlock){
  18878. var self=this,$self=this;
  18879. $self.fn=aBlock;
  18880. return self;
  18881. },
  18882. args: ["aBlock"],
  18883. source: "fn: aBlock\x0a\x09fn := aBlock",
  18884. referencedClasses: [],
  18885. pragmas: [],
  18886. messageSends: []
  18887. }),
  18888. $globals.CompiledMethod);
  18889. $core.addMethod(
  18890. $core.method({
  18891. selector: "isCompiledMethod",
  18892. protocol: "testing",
  18893. fn: function (){
  18894. var self=this,$self=this;
  18895. return true;
  18896. },
  18897. args: [],
  18898. source: "isCompiledMethod\x0a\x09^ true",
  18899. referencedClasses: [],
  18900. pragmas: [],
  18901. messageSends: []
  18902. }),
  18903. $globals.CompiledMethod);
  18904. $core.addMethod(
  18905. $core.method({
  18906. selector: "isOverridden",
  18907. protocol: "testing",
  18908. fn: function (){
  18909. var self=this,$self=this;
  18910. return $core.withContext(function($ctx1) {
  18911. var $1;
  18912. var $early={};
  18913. try {
  18914. $recv($self._methodClass())._allSubclassesDo_((function(each){
  18915. return $core.withContext(function($ctx2) {
  18916. $1=$recv(each)._includesSelector_($self.selector);
  18917. if($core.assert($1)){
  18918. throw $early=[true];
  18919. }
  18920. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18921. }));
  18922. return false;
  18923. }
  18924. catch(e) {if(e===$early)return e[0]; throw e}
  18925. }, function($ctx1) {$ctx1.fill(self,"isOverridden",{})});
  18926. },
  18927. args: [],
  18928. source: "isOverridden\x0a self methodClass allSubclassesDo: [ :each |\x0a\x09 (each includesSelector: selector)\x0a \x09ifTrue: [ ^ true ] ].\x0a\x09^ false",
  18929. referencedClasses: [],
  18930. pragmas: [],
  18931. messageSends: ["allSubclassesDo:", "methodClass", "ifTrue:", "includesSelector:"]
  18932. }),
  18933. $globals.CompiledMethod);
  18934. $core.addMethod(
  18935. $core.method({
  18936. selector: "isOverride",
  18937. protocol: "testing",
  18938. fn: function (){
  18939. var self=this,$self=this;
  18940. var superclass;
  18941. return $core.withContext(function($ctx1) {
  18942. var $1,$2,$receiver;
  18943. $1=$self._methodClass();
  18944. $ctx1.sendIdx["methodClass"]=1;
  18945. superclass=$recv($1)._superclass();
  18946. $ctx1.sendIdx["superclass"]=1;
  18947. $2=superclass;
  18948. if(($receiver = $2) == null || $receiver.a$nil){
  18949. return false;
  18950. } else {
  18951. $2;
  18952. }
  18953. return $recv($recv($recv($self._methodClass())._superclass())._lookupSelector_($self._selector()))._notNil();
  18954. }, function($ctx1) {$ctx1.fill(self,"isOverride",{superclass:superclass})});
  18955. },
  18956. args: [],
  18957. 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",
  18958. referencedClasses: [],
  18959. pragmas: [],
  18960. messageSends: ["superclass", "methodClass", "ifNil:", "notNil", "lookupSelector:", "selector"]
  18961. }),
  18962. $globals.CompiledMethod);
  18963. $core.addMethod(
  18964. $core.method({
  18965. selector: "messageSends",
  18966. protocol: "accessing",
  18967. fn: function (){
  18968. var self=this,$self=this;
  18969. return $self.messageSends;
  18970. },
  18971. args: [],
  18972. source: "messageSends\x0a\x09^ messageSends",
  18973. referencedClasses: [],
  18974. pragmas: [],
  18975. messageSends: []
  18976. }),
  18977. $globals.CompiledMethod);
  18978. $core.addMethod(
  18979. $core.method({
  18980. selector: "methodClass",
  18981. protocol: "accessing",
  18982. fn: function (){
  18983. var self=this,$self=this;
  18984. return $self.methodClass;
  18985. },
  18986. args: [],
  18987. source: "methodClass\x0a\x09^ methodClass",
  18988. referencedClasses: [],
  18989. pragmas: [],
  18990. messageSends: []
  18991. }),
  18992. $globals.CompiledMethod);
  18993. $core.addMethod(
  18994. $core.method({
  18995. selector: "origin",
  18996. protocol: "accessing",
  18997. fn: function (){
  18998. var self=this,$self=this;
  18999. return $self.owner;
  19000. },
  19001. args: [],
  19002. source: "origin\x0a\x09^ owner",
  19003. referencedClasses: [],
  19004. pragmas: [],
  19005. messageSends: []
  19006. }),
  19007. $globals.CompiledMethod);
  19008. $core.addMethod(
  19009. $core.method({
  19010. selector: "package",
  19011. protocol: "accessing",
  19012. fn: function (){
  19013. var self=this,$self=this;
  19014. return $core.withContext(function($ctx1) {
  19015. var $1,$receiver;
  19016. $1=$self._origin();
  19017. if(($receiver = $1) == null || $receiver.a$nil){
  19018. return $1;
  19019. } else {
  19020. var class_;
  19021. class_=$receiver;
  19022. return $recv(class_)._packageOfProtocol_($self._protocol());
  19023. }
  19024. }, function($ctx1) {$ctx1.fill(self,"package",{})});
  19025. },
  19026. args: [],
  19027. 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 ]",
  19028. referencedClasses: [],
  19029. pragmas: [],
  19030. messageSends: ["ifNotNil:", "origin", "packageOfProtocol:", "protocol"]
  19031. }),
  19032. $globals.CompiledMethod);
  19033. $core.addMethod(
  19034. $core.method({
  19035. selector: "pragmas",
  19036. protocol: "accessing",
  19037. fn: function (){
  19038. var self=this,$self=this;
  19039. return $core.withContext(function($ctx1) {
  19040. return $recv($self._basicPragmas())._collect_((function(each){
  19041. return $core.withContext(function($ctx2) {
  19042. return $recv($globals.Message)._selector_arguments_($recv(each)._first(),$recv(each)._second());
  19043. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  19044. }));
  19045. }, function($ctx1) {$ctx1.fill(self,"pragmas",{})});
  19046. },
  19047. args: [],
  19048. source: "pragmas\x0a\x09^ self basicPragmas collect: [ :each | Message selector: each first arguments: each second ]",
  19049. referencedClasses: ["Message"],
  19050. pragmas: [],
  19051. messageSends: ["collect:", "basicPragmas", "selector:arguments:", "first", "second"]
  19052. }),
  19053. $globals.CompiledMethod);
  19054. $core.addMethod(
  19055. $core.method({
  19056. selector: "pragmas:",
  19057. protocol: "accessing",
  19058. fn: function (anArrayOfMessages){
  19059. var self=this,$self=this;
  19060. return $core.withContext(function($ctx1) {
  19061. $self.pragmas=$recv(anArrayOfMessages)._collect_((function(each){
  19062. return $core.withContext(function($ctx2) {
  19063. return [$recv(each)._selector(),$recv(each)._arguments()];
  19064. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  19065. }));
  19066. return self;
  19067. }, function($ctx1) {$ctx1.fill(self,"pragmas:",{anArrayOfMessages:anArrayOfMessages})});
  19068. },
  19069. args: ["anArrayOfMessages"],
  19070. source: "pragmas: anArrayOfMessages\x0a\x09pragmas := anArrayOfMessages collect: [ :each | { each selector. each arguments } ]",
  19071. referencedClasses: [],
  19072. pragmas: [],
  19073. messageSends: ["collect:", "selector", "arguments"]
  19074. }),
  19075. $globals.CompiledMethod);
  19076. $core.addMethod(
  19077. $core.method({
  19078. selector: "protocol",
  19079. protocol: "accessing",
  19080. fn: function (){
  19081. var self=this,$self=this;
  19082. return $core.withContext(function($ctx1) {
  19083. var $1,$receiver;
  19084. $1=$self.protocol;
  19085. if(($receiver = $1) == null || $receiver.a$nil){
  19086. return $self._defaultProtocol();
  19087. } else {
  19088. return $1;
  19089. }
  19090. }, function($ctx1) {$ctx1.fill(self,"protocol",{})});
  19091. },
  19092. args: [],
  19093. source: "protocol\x0a\x09^ protocol ifNil: [ self defaultProtocol ]",
  19094. referencedClasses: [],
  19095. pragmas: [],
  19096. messageSends: ["ifNil:", "defaultProtocol"]
  19097. }),
  19098. $globals.CompiledMethod);
  19099. $core.addMethod(
  19100. $core.method({
  19101. selector: "protocol:",
  19102. protocol: "accessing",
  19103. fn: function (aString){
  19104. var self=this,$self=this;
  19105. var oldProtocol;
  19106. return $core.withContext(function($ctx1) {
  19107. var $1,$2,$4,$3,$5,$receiver;
  19108. oldProtocol=$self._protocol();
  19109. $self.protocol=aString;
  19110. $1=oldProtocol;
  19111. if(($receiver = $1) == null || $receiver.a$nil){
  19112. $1;
  19113. } else {
  19114. $2=$recv($globals.SystemAnnouncer)._current();
  19115. $4=$recv($globals.MethodMoved)._new();
  19116. $recv($4)._method_(self);
  19117. $recv($4)._oldProtocol_(oldProtocol);
  19118. $3=$recv($4)._yourself();
  19119. $recv($2)._announce_($3);
  19120. }
  19121. $5=$self._origin();
  19122. if(($receiver = $5) == null || $receiver.a$nil){
  19123. $5;
  19124. } else {
  19125. var origin;
  19126. origin=$receiver;
  19127. $recv($recv(origin)._organization())._addElement_(aString);
  19128. $recv(origin)._removeProtocolIfEmpty_(oldProtocol);
  19129. }
  19130. return self;
  19131. }, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString,oldProtocol:oldProtocol})});
  19132. },
  19133. args: ["aString"],
  19134. 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 ]",
  19135. referencedClasses: ["SystemAnnouncer", "MethodMoved"],
  19136. pragmas: [],
  19137. messageSends: ["protocol", "ifNotNil:", "announce:", "current", "method:", "new", "oldProtocol:", "yourself", "origin", "addElement:", "organization", "removeProtocolIfEmpty:"]
  19138. }),
  19139. $globals.CompiledMethod);
  19140. $core.addMethod(
  19141. $core.method({
  19142. selector: "referencedClasses",
  19143. protocol: "accessing",
  19144. fn: function (){
  19145. var self=this,$self=this;
  19146. return $self.referencedClasses;
  19147. },
  19148. args: [],
  19149. source: "referencedClasses\x0a\x09^ referencedClasses",
  19150. referencedClasses: [],
  19151. pragmas: [],
  19152. messageSends: []
  19153. }),
  19154. $globals.CompiledMethod);
  19155. $core.addMethod(
  19156. $core.method({
  19157. selector: "selector",
  19158. protocol: "accessing",
  19159. fn: function (){
  19160. var self=this,$self=this;
  19161. return $self.selector;
  19162. },
  19163. args: [],
  19164. source: "selector\x0a\x09^ selector",
  19165. referencedClasses: [],
  19166. pragmas: [],
  19167. messageSends: []
  19168. }),
  19169. $globals.CompiledMethod);
  19170. $core.addMethod(
  19171. $core.method({
  19172. selector: "selector:",
  19173. protocol: "accessing",
  19174. fn: function (aString){
  19175. var self=this,$self=this;
  19176. $self.selector=aString;
  19177. return self;
  19178. },
  19179. args: ["aString"],
  19180. source: "selector: aString\x0a\x09selector := aString",
  19181. referencedClasses: [],
  19182. pragmas: [],
  19183. messageSends: []
  19184. }),
  19185. $globals.CompiledMethod);
  19186. $core.addMethod(
  19187. $core.method({
  19188. selector: "sendTo:arguments:",
  19189. protocol: "evaluating",
  19190. fn: function (anObject,aCollection){
  19191. var self=this,$self=this;
  19192. return $core.withContext(function($ctx1) {
  19193. return $recv($self._fn())._applyTo_arguments_(anObject,aCollection);
  19194. }, function($ctx1) {$ctx1.fill(self,"sendTo:arguments:",{anObject:anObject,aCollection:aCollection})});
  19195. },
  19196. args: ["anObject", "aCollection"],
  19197. source: "sendTo: anObject arguments: aCollection\x0a\x09^ self fn applyTo: anObject arguments: aCollection",
  19198. referencedClasses: [],
  19199. pragmas: [],
  19200. messageSends: ["applyTo:arguments:", "fn"]
  19201. }),
  19202. $globals.CompiledMethod);
  19203. $core.addMethod(
  19204. $core.method({
  19205. selector: "source",
  19206. protocol: "accessing",
  19207. fn: function (){
  19208. var self=this,$self=this;
  19209. return $core.withContext(function($ctx1) {
  19210. var $1,$receiver;
  19211. $1=$self.source;
  19212. if(($receiver = $1) == null || $receiver.a$nil){
  19213. return "";
  19214. } else {
  19215. return $1;
  19216. }
  19217. }, function($ctx1) {$ctx1.fill(self,"source",{})});
  19218. },
  19219. args: [],
  19220. source: "source\x0a\x09^ source ifNil: [ '' ]",
  19221. referencedClasses: [],
  19222. pragmas: [],
  19223. messageSends: ["ifNil:"]
  19224. }),
  19225. $globals.CompiledMethod);
  19226. $core.addMethod(
  19227. $core.method({
  19228. selector: "source:",
  19229. protocol: "accessing",
  19230. fn: function (aString){
  19231. var self=this,$self=this;
  19232. $self.source=aString;
  19233. return self;
  19234. },
  19235. args: ["aString"],
  19236. source: "source: aString\x0a\x09source := aString",
  19237. referencedClasses: [],
  19238. pragmas: [],
  19239. messageSends: []
  19240. }),
  19241. $globals.CompiledMethod);
  19242. $core.addClass("ForkPool", $globals.Object, ["poolSize", "maxPoolSize", "queue", "worker"], "Kernel-Methods");
  19243. $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`";
  19244. $core.addMethod(
  19245. $core.method({
  19246. selector: "addWorker",
  19247. protocol: "private",
  19248. fn: function (){
  19249. var self=this,$self=this;
  19250. return $core.withContext(function($ctx1) {
  19251. $recv($self.worker)._valueWithTimeout_((0));
  19252. $self.poolSize=$recv($self.poolSize).__plus((1));
  19253. return self;
  19254. }, function($ctx1) {$ctx1.fill(self,"addWorker",{})});
  19255. },
  19256. args: [],
  19257. source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a\x09poolSize := poolSize + 1",
  19258. referencedClasses: [],
  19259. pragmas: [],
  19260. messageSends: ["valueWithTimeout:", "+"]
  19261. }),
  19262. $globals.ForkPool);
  19263. $core.addMethod(
  19264. $core.method({
  19265. selector: "defaultMaxPoolSize",
  19266. protocol: "defaults",
  19267. fn: function (){
  19268. var self=this,$self=this;
  19269. return $core.withContext(function($ctx1) {
  19270. return $recv($self._class())._defaultMaxPoolSize();
  19271. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{})});
  19272. },
  19273. args: [],
  19274. source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize",
  19275. referencedClasses: [],
  19276. pragmas: [],
  19277. messageSends: ["defaultMaxPoolSize", "class"]
  19278. }),
  19279. $globals.ForkPool);
  19280. $core.addMethod(
  19281. $core.method({
  19282. selector: "fork:",
  19283. protocol: "actions",
  19284. fn: function (aBlock){
  19285. var self=this,$self=this;
  19286. return $core.withContext(function($ctx1) {
  19287. var $1;
  19288. $1=$recv($self.poolSize).__lt($self._maxPoolSize());
  19289. if($core.assert($1)){
  19290. $self._addWorker();
  19291. }
  19292. $recv($self.queue)._nextPut_(aBlock);
  19293. return self;
  19294. }, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock})});
  19295. },
  19296. args: ["aBlock"],
  19297. source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue nextPut: aBlock",
  19298. referencedClasses: [],
  19299. pragmas: [],
  19300. messageSends: ["ifTrue:", "<", "maxPoolSize", "addWorker", "nextPut:"]
  19301. }),
  19302. $globals.ForkPool);
  19303. $core.addMethod(
  19304. $core.method({
  19305. selector: "initialize",
  19306. protocol: "initialization",
  19307. fn: function (){
  19308. var self=this,$self=this;
  19309. return $core.withContext(function($ctx1) {
  19310. (
  19311. $ctx1.supercall = true,
  19312. ($globals.ForkPool.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  19313. $ctx1.supercall = false;
  19314. $self.poolSize=(0);
  19315. $self.queue=$recv($globals.Queue)._new();
  19316. $self.worker=$self._makeWorker();
  19317. return self;
  19318. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  19319. },
  19320. args: [],
  19321. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09poolSize := 0.\x0a\x09queue := Queue new.\x0a\x09worker := self makeWorker",
  19322. referencedClasses: ["Queue"],
  19323. pragmas: [],
  19324. messageSends: ["initialize", "new", "makeWorker"]
  19325. }),
  19326. $globals.ForkPool);
  19327. $core.addMethod(
  19328. $core.method({
  19329. selector: "makeWorker",
  19330. protocol: "initialization",
  19331. fn: function (){
  19332. var self=this,$self=this;
  19333. var sentinel;
  19334. return $core.withContext(function($ctx1) {
  19335. var $1;
  19336. sentinel=$recv($globals.Object)._new();
  19337. return (function(){
  19338. var block;
  19339. return $core.withContext(function($ctx2) {
  19340. $self.poolSize=$recv($self.poolSize).__minus((1));
  19341. block=$recv($self.queue)._nextIfAbsent_((function(){
  19342. return sentinel;
  19343. }));
  19344. $1=$recv(block).__eq_eq(sentinel);
  19345. if(!$core.assert($1)){
  19346. return $recv((function(){
  19347. return $core.withContext(function($ctx3) {
  19348. return $recv(block)._value();
  19349. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  19350. }))._ensure_((function(){
  19351. return $core.withContext(function($ctx3) {
  19352. return $self._addWorker();
  19353. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  19354. }));
  19355. }
  19356. }, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1,1)});
  19357. });
  19358. }, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel})});
  19359. },
  19360. args: [],
  19361. 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 ] ]]",
  19362. referencedClasses: ["Object"],
  19363. pragmas: [],
  19364. messageSends: ["new", "-", "nextIfAbsent:", "ifFalse:", "==", "ensure:", "value", "addWorker"]
  19365. }),
  19366. $globals.ForkPool);
  19367. $core.addMethod(
  19368. $core.method({
  19369. selector: "maxPoolSize",
  19370. protocol: "accessing",
  19371. fn: function (){
  19372. var self=this,$self=this;
  19373. return $core.withContext(function($ctx1) {
  19374. var $1,$receiver;
  19375. $1=$self.maxPoolSize;
  19376. if(($receiver = $1) == null || $receiver.a$nil){
  19377. return $self._defaultMaxPoolSize();
  19378. } else {
  19379. return $1;
  19380. }
  19381. }, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{})});
  19382. },
  19383. args: [],
  19384. source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]",
  19385. referencedClasses: [],
  19386. pragmas: [],
  19387. messageSends: ["ifNil:", "defaultMaxPoolSize"]
  19388. }),
  19389. $globals.ForkPool);
  19390. $core.addMethod(
  19391. $core.method({
  19392. selector: "maxPoolSize:",
  19393. protocol: "accessing",
  19394. fn: function (anInteger){
  19395. var self=this,$self=this;
  19396. $self.maxPoolSize=anInteger;
  19397. return self;
  19398. },
  19399. args: ["anInteger"],
  19400. source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger",
  19401. referencedClasses: [],
  19402. pragmas: [],
  19403. messageSends: []
  19404. }),
  19405. $globals.ForkPool);
  19406. $core.setSlots($globals.ForkPool.a$cls, ["default"]);
  19407. $core.addMethod(
  19408. $core.method({
  19409. selector: "default",
  19410. protocol: "accessing",
  19411. fn: function (){
  19412. var self=this,$self=this;
  19413. return $core.withContext(function($ctx1) {
  19414. var $1,$receiver;
  19415. $1=$self.default;
  19416. if(($receiver = $1) == null || $receiver.a$nil){
  19417. $self.default=$self._new();
  19418. return $self.default;
  19419. } else {
  19420. return $1;
  19421. }
  19422. }, function($ctx1) {$ctx1.fill(self,"default",{})});
  19423. },
  19424. args: [],
  19425. source: "default\x0a\x09^ default ifNil: [ default := self new ]",
  19426. referencedClasses: [],
  19427. pragmas: [],
  19428. messageSends: ["ifNil:", "new"]
  19429. }),
  19430. $globals.ForkPool.a$cls);
  19431. $core.addMethod(
  19432. $core.method({
  19433. selector: "defaultMaxPoolSize",
  19434. protocol: "accessing",
  19435. fn: function (){
  19436. var self=this,$self=this;
  19437. return (100);
  19438. },
  19439. args: [],
  19440. source: "defaultMaxPoolSize\x0a\x09^ 100",
  19441. referencedClasses: [],
  19442. pragmas: [],
  19443. messageSends: []
  19444. }),
  19445. $globals.ForkPool.a$cls);
  19446. $core.addMethod(
  19447. $core.method({
  19448. selector: "resetDefault",
  19449. protocol: "accessing",
  19450. fn: function (){
  19451. var self=this,$self=this;
  19452. $self.default=nil;
  19453. return self;
  19454. },
  19455. args: [],
  19456. source: "resetDefault\x0a\x09default := nil",
  19457. referencedClasses: [],
  19458. pragmas: [],
  19459. messageSends: []
  19460. }),
  19461. $globals.ForkPool.a$cls);
  19462. $core.addClass("Message", $globals.Object, ["selector", "arguments"], "Kernel-Methods");
  19463. $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.";
  19464. $core.addMethod(
  19465. $core.method({
  19466. selector: "arguments",
  19467. protocol: "accessing",
  19468. fn: function (){
  19469. var self=this,$self=this;
  19470. return $self.arguments;
  19471. },
  19472. args: [],
  19473. source: "arguments\x0a\x09^ arguments",
  19474. referencedClasses: [],
  19475. pragmas: [],
  19476. messageSends: []
  19477. }),
  19478. $globals.Message);
  19479. $core.addMethod(
  19480. $core.method({
  19481. selector: "arguments:",
  19482. protocol: "accessing",
  19483. fn: function (anArray){
  19484. var self=this,$self=this;
  19485. $self.arguments=anArray;
  19486. return self;
  19487. },
  19488. args: ["anArray"],
  19489. source: "arguments: anArray\x0a\x09arguments := anArray",
  19490. referencedClasses: [],
  19491. pragmas: [],
  19492. messageSends: []
  19493. }),
  19494. $globals.Message);
  19495. $core.addMethod(
  19496. $core.method({
  19497. selector: "printOn:",
  19498. protocol: "printing",
  19499. fn: function (aStream){
  19500. var self=this,$self=this;
  19501. return $core.withContext(function($ctx1) {
  19502. (
  19503. $ctx1.supercall = true,
  19504. ($globals.Message.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  19505. $ctx1.supercall = false;
  19506. $recv(aStream)._nextPutAll_("(");
  19507. $ctx1.sendIdx["nextPutAll:"]=1;
  19508. $recv(aStream)._nextPutAll_($self._selector());
  19509. $ctx1.sendIdx["nextPutAll:"]=2;
  19510. $recv(aStream)._nextPutAll_(")");
  19511. return self;
  19512. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  19513. },
  19514. args: ["aStream"],
  19515. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
  19516. referencedClasses: [],
  19517. pragmas: [],
  19518. messageSends: ["printOn:", "nextPutAll:", "selector"]
  19519. }),
  19520. $globals.Message);
  19521. $core.addMethod(
  19522. $core.method({
  19523. selector: "selector",
  19524. protocol: "accessing",
  19525. fn: function (){
  19526. var self=this,$self=this;
  19527. return $self.selector;
  19528. },
  19529. args: [],
  19530. source: "selector\x0a\x09^ selector",
  19531. referencedClasses: [],
  19532. pragmas: [],
  19533. messageSends: []
  19534. }),
  19535. $globals.Message);
  19536. $core.addMethod(
  19537. $core.method({
  19538. selector: "selector:",
  19539. protocol: "accessing",
  19540. fn: function (aString){
  19541. var self=this,$self=this;
  19542. $self.selector=aString;
  19543. return self;
  19544. },
  19545. args: ["aString"],
  19546. source: "selector: aString\x0a\x09selector := aString",
  19547. referencedClasses: [],
  19548. pragmas: [],
  19549. messageSends: []
  19550. }),
  19551. $globals.Message);
  19552. $core.addMethod(
  19553. $core.method({
  19554. selector: "sendTo:",
  19555. protocol: "actions",
  19556. fn: function (anObject){
  19557. var self=this,$self=this;
  19558. return $core.withContext(function($ctx1) {
  19559. return $recv(anObject)._perform_withArguments_($self._selector(),$self._arguments());
  19560. }, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject})});
  19561. },
  19562. args: ["anObject"],
  19563. source: "sendTo: anObject\x0a\x09^ anObject perform: self selector withArguments: self arguments",
  19564. referencedClasses: [],
  19565. pragmas: [],
  19566. messageSends: ["perform:withArguments:", "selector", "arguments"]
  19567. }),
  19568. $globals.Message);
  19569. $core.addMethod(
  19570. $core.method({
  19571. selector: "selector:arguments:",
  19572. protocol: "instance creation",
  19573. fn: function (aString,anArray){
  19574. var self=this,$self=this;
  19575. return $core.withContext(function($ctx1) {
  19576. var $1;
  19577. $1=$self._new();
  19578. $recv($1)._selector_(aString);
  19579. $recv($1)._arguments_(anArray);
  19580. return $recv($1)._yourself();
  19581. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray})});
  19582. },
  19583. args: ["aString", "anArray"],
  19584. source: "selector: aString arguments: anArray\x0a\x09^ self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
  19585. referencedClasses: [],
  19586. pragmas: [],
  19587. messageSends: ["selector:", "new", "arguments:", "yourself"]
  19588. }),
  19589. $globals.Message.a$cls);
  19590. $core.addMethod(
  19591. $core.method({
  19592. selector: "selector:arguments:notUnderstoodBy:",
  19593. protocol: "dnu handling",
  19594. fn: function (aString,anArray,anObject){
  19595. var self=this,$self=this;
  19596. return $core.withContext(function($ctx1) {
  19597. return $recv(anObject)._doesNotUnderstand_($self._selector_arguments_(aString,anArray));
  19598. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:notUnderstoodBy:",{aString:aString,anArray:anArray,anObject:anObject})});
  19599. },
  19600. args: ["aString", "anArray", "anObject"],
  19601. 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)",
  19602. referencedClasses: [],
  19603. pragmas: [],
  19604. messageSends: ["doesNotUnderstand:", "selector:arguments:"]
  19605. }),
  19606. $globals.Message.a$cls);
  19607. $core.addClass("MessageSend", $globals.Object, ["receiver", "message"], "Kernel-Methods");
  19608. $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.";
  19609. $core.addMethod(
  19610. $core.method({
  19611. selector: "arguments",
  19612. protocol: "accessing",
  19613. fn: function (){
  19614. var self=this,$self=this;
  19615. return $core.withContext(function($ctx1) {
  19616. return $recv($self.message)._arguments();
  19617. }, function($ctx1) {$ctx1.fill(self,"arguments",{})});
  19618. },
  19619. args: [],
  19620. source: "arguments\x0a\x09^ message arguments",
  19621. referencedClasses: [],
  19622. pragmas: [],
  19623. messageSends: ["arguments"]
  19624. }),
  19625. $globals.MessageSend);
  19626. $core.addMethod(
  19627. $core.method({
  19628. selector: "arguments:",
  19629. protocol: "accessing",
  19630. fn: function (aCollection){
  19631. var self=this,$self=this;
  19632. return $core.withContext(function($ctx1) {
  19633. $recv($self.message)._arguments_(aCollection);
  19634. return self;
  19635. }, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection})});
  19636. },
  19637. args: ["aCollection"],
  19638. source: "arguments: aCollection\x0a\x09message arguments: aCollection",
  19639. referencedClasses: [],
  19640. pragmas: [],
  19641. messageSends: ["arguments:"]
  19642. }),
  19643. $globals.MessageSend);
  19644. $core.addMethod(
  19645. $core.method({
  19646. selector: "initialize",
  19647. protocol: "initialization",
  19648. fn: function (){
  19649. var self=this,$self=this;
  19650. return $core.withContext(function($ctx1) {
  19651. (
  19652. $ctx1.supercall = true,
  19653. ($globals.MessageSend.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  19654. $ctx1.supercall = false;
  19655. $self.message=$recv($globals.Message)._new();
  19656. return self;
  19657. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  19658. },
  19659. args: [],
  19660. source: "initialize\x0a\x09super initialize.\x0a\x09message := Message new",
  19661. referencedClasses: ["Message"],
  19662. pragmas: [],
  19663. messageSends: ["initialize", "new"]
  19664. }),
  19665. $globals.MessageSend);
  19666. $core.addMethod(
  19667. $core.method({
  19668. selector: "printOn:",
  19669. protocol: "printing",
  19670. fn: function (aStream){
  19671. var self=this,$self=this;
  19672. return $core.withContext(function($ctx1) {
  19673. (
  19674. $ctx1.supercall = true,
  19675. ($globals.MessageSend.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  19676. $ctx1.supercall = false;
  19677. $recv(aStream)._nextPutAll_("(");
  19678. $ctx1.sendIdx["nextPutAll:"]=1;
  19679. $recv(aStream)._nextPutAll_($self._receiver());
  19680. $ctx1.sendIdx["nextPutAll:"]=2;
  19681. $recv(aStream)._nextPutAll_(" >> ");
  19682. $ctx1.sendIdx["nextPutAll:"]=3;
  19683. $recv(aStream)._nextPutAll_($self._selector());
  19684. $ctx1.sendIdx["nextPutAll:"]=4;
  19685. $recv(aStream)._nextPutAll_(")");
  19686. return self;
  19687. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  19688. },
  19689. args: ["aStream"],
  19690. 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: ')'",
  19691. referencedClasses: [],
  19692. pragmas: [],
  19693. messageSends: ["printOn:", "nextPutAll:", "receiver", "selector"]
  19694. }),
  19695. $globals.MessageSend);
  19696. $core.addMethod(
  19697. $core.method({
  19698. selector: "receiver",
  19699. protocol: "accessing",
  19700. fn: function (){
  19701. var self=this,$self=this;
  19702. return $self.receiver;
  19703. },
  19704. args: [],
  19705. source: "receiver\x0a\x09^ receiver",
  19706. referencedClasses: [],
  19707. pragmas: [],
  19708. messageSends: []
  19709. }),
  19710. $globals.MessageSend);
  19711. $core.addMethod(
  19712. $core.method({
  19713. selector: "receiver:",
  19714. protocol: "accessing",
  19715. fn: function (anObject){
  19716. var self=this,$self=this;
  19717. $self.receiver=anObject;
  19718. return self;
  19719. },
  19720. args: ["anObject"],
  19721. source: "receiver: anObject\x0a\x09receiver := anObject",
  19722. referencedClasses: [],
  19723. pragmas: [],
  19724. messageSends: []
  19725. }),
  19726. $globals.MessageSend);
  19727. $core.addMethod(
  19728. $core.method({
  19729. selector: "selector",
  19730. protocol: "accessing",
  19731. fn: function (){
  19732. var self=this,$self=this;
  19733. return $core.withContext(function($ctx1) {
  19734. return $recv($self.message)._selector();
  19735. }, function($ctx1) {$ctx1.fill(self,"selector",{})});
  19736. },
  19737. args: [],
  19738. source: "selector\x0a\x09^ message selector",
  19739. referencedClasses: [],
  19740. pragmas: [],
  19741. messageSends: ["selector"]
  19742. }),
  19743. $globals.MessageSend);
  19744. $core.addMethod(
  19745. $core.method({
  19746. selector: "selector:",
  19747. protocol: "accessing",
  19748. fn: function (aString){
  19749. var self=this,$self=this;
  19750. return $core.withContext(function($ctx1) {
  19751. $recv($self.message)._selector_(aString);
  19752. return self;
  19753. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString})});
  19754. },
  19755. args: ["aString"],
  19756. source: "selector: aString\x0a\x09message selector: aString",
  19757. referencedClasses: [],
  19758. pragmas: [],
  19759. messageSends: ["selector:"]
  19760. }),
  19761. $globals.MessageSend);
  19762. $core.addMethod(
  19763. $core.method({
  19764. selector: "value",
  19765. protocol: "evaluating",
  19766. fn: function (){
  19767. var self=this,$self=this;
  19768. return $core.withContext(function($ctx1) {
  19769. return $recv($self.message)._sendTo_($self._receiver());
  19770. }, function($ctx1) {$ctx1.fill(self,"value",{})});
  19771. },
  19772. args: [],
  19773. source: "value\x0a\x09^ message sendTo: self receiver",
  19774. referencedClasses: [],
  19775. pragmas: [],
  19776. messageSends: ["sendTo:", "receiver"]
  19777. }),
  19778. $globals.MessageSend);
  19779. $core.addMethod(
  19780. $core.method({
  19781. selector: "value:",
  19782. protocol: "evaluating",
  19783. fn: function (anObject){
  19784. var self=this,$self=this;
  19785. return $core.withContext(function($ctx1) {
  19786. var $1;
  19787. $1=$self.message;
  19788. $recv($1)._arguments_([anObject]);
  19789. return $recv($1)._sendTo_($self._receiver());
  19790. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject})});
  19791. },
  19792. args: ["anObject"],
  19793. source: "value: anObject\x0a\x09^ message \x0a\x09\x09arguments: { anObject };\x0a\x09\x09sendTo: self receiver",
  19794. referencedClasses: [],
  19795. pragmas: [],
  19796. messageSends: ["arguments:", "sendTo:", "receiver"]
  19797. }),
  19798. $globals.MessageSend);
  19799. $core.addMethod(
  19800. $core.method({
  19801. selector: "value:value:",
  19802. protocol: "evaluating",
  19803. fn: function (firstArgument,secondArgument){
  19804. var self=this,$self=this;
  19805. return $core.withContext(function($ctx1) {
  19806. var $1;
  19807. $1=$self.message;
  19808. $recv($1)._arguments_([firstArgument,secondArgument]);
  19809. return $recv($1)._sendTo_($self._receiver());
  19810. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument})});
  19811. },
  19812. args: ["firstArgument", "secondArgument"],
  19813. source: "value: firstArgument value: secondArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument };\x0a\x09\x09sendTo: self receiver",
  19814. referencedClasses: [],
  19815. pragmas: [],
  19816. messageSends: ["arguments:", "sendTo:", "receiver"]
  19817. }),
  19818. $globals.MessageSend);
  19819. $core.addMethod(
  19820. $core.method({
  19821. selector: "value:value:value:",
  19822. protocol: "evaluating",
  19823. fn: function (firstArgument,secondArgument,thirdArgument){
  19824. var self=this,$self=this;
  19825. return $core.withContext(function($ctx1) {
  19826. var $1;
  19827. $1=$self.message;
  19828. $recv($1)._arguments_([firstArgument,secondArgument,thirdArgument]);
  19829. return $recv($1)._sendTo_($self._receiver());
  19830. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument})});
  19831. },
  19832. args: ["firstArgument", "secondArgument", "thirdArgument"],
  19833. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument. thirdArgument };\x0a\x09\x09sendTo: self receiver",
  19834. referencedClasses: [],
  19835. pragmas: [],
  19836. messageSends: ["arguments:", "sendTo:", "receiver"]
  19837. }),
  19838. $globals.MessageSend);
  19839. $core.addMethod(
  19840. $core.method({
  19841. selector: "valueWithPossibleArguments:",
  19842. protocol: "evaluating",
  19843. fn: function (aCollection){
  19844. var self=this,$self=this;
  19845. return $core.withContext(function($ctx1) {
  19846. $self._arguments_(aCollection);
  19847. return $self._value();
  19848. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection})});
  19849. },
  19850. args: ["aCollection"],
  19851. source: "valueWithPossibleArguments: aCollection\x0a\x09self arguments: aCollection.\x0a\x09^ self value",
  19852. referencedClasses: [],
  19853. pragmas: [],
  19854. messageSends: ["arguments:", "value"]
  19855. }),
  19856. $globals.MessageSend);
  19857. $core.addClass("MethodContext", $globals.Object, ["receiver", "evaluatedSelector", "homeContext", "index", "locals", "outerContext", "selector", "sendIdx", "supercall"], "Kernel-Methods");
  19858. $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`.";
  19859. $core.addMethod(
  19860. $core.method({
  19861. selector: "basicReceiver",
  19862. protocol: "accessing",
  19863. fn: function (){
  19864. var self=this,$self=this;
  19865. return $self.receiver;
  19866. },
  19867. args: [],
  19868. source: "basicReceiver\x0a\x09^ receiver",
  19869. referencedClasses: [],
  19870. pragmas: [],
  19871. messageSends: []
  19872. }),
  19873. $globals.MethodContext);
  19874. $core.addMethod(
  19875. $core.method({
  19876. selector: "evaluatedSelector",
  19877. protocol: "accessing",
  19878. fn: function (){
  19879. var self=this,$self=this;
  19880. return $self.evaluatedSelector;
  19881. },
  19882. args: [],
  19883. source: "evaluatedSelector\x0a\x09^ evaluatedSelector",
  19884. referencedClasses: [],
  19885. pragmas: [],
  19886. messageSends: []
  19887. }),
  19888. $globals.MethodContext);
  19889. $core.addMethod(
  19890. $core.method({
  19891. selector: "home",
  19892. protocol: "accessing",
  19893. fn: function (){
  19894. var self=this,$self=this;
  19895. return $self.homeContext;
  19896. },
  19897. args: [],
  19898. source: "home\x0a\x09^ homeContext",
  19899. referencedClasses: [],
  19900. pragmas: [],
  19901. messageSends: []
  19902. }),
  19903. $globals.MethodContext);
  19904. $core.addMethod(
  19905. $core.method({
  19906. selector: "index",
  19907. protocol: "accessing",
  19908. fn: function (){
  19909. var self=this,$self=this;
  19910. return $core.withContext(function($ctx1) {
  19911. var $1,$receiver;
  19912. $1=$self.index;
  19913. if(($receiver = $1) == null || $receiver.a$nil){
  19914. return (0);
  19915. } else {
  19916. return $1;
  19917. }
  19918. }, function($ctx1) {$ctx1.fill(self,"index",{})});
  19919. },
  19920. args: [],
  19921. source: "index\x0a\x09^ index ifNil: [ 0 ]",
  19922. referencedClasses: [],
  19923. pragmas: [],
  19924. messageSends: ["ifNil:"]
  19925. }),
  19926. $globals.MethodContext);
  19927. $core.addMethod(
  19928. $core.method({
  19929. selector: "locals",
  19930. protocol: "accessing",
  19931. fn: function (){
  19932. var self=this,$self=this;
  19933. return $self.locals;
  19934. },
  19935. args: [],
  19936. source: "locals\x0a\x09^ locals",
  19937. referencedClasses: [],
  19938. pragmas: [],
  19939. messageSends: []
  19940. }),
  19941. $globals.MethodContext);
  19942. $core.addMethod(
  19943. $core.method({
  19944. selector: "outerContext",
  19945. protocol: "accessing",
  19946. fn: function (){
  19947. var self=this,$self=this;
  19948. return $core.withContext(function($ctx1) {
  19949. var $1,$receiver;
  19950. $1=$self.outerContext;
  19951. if(($receiver = $1) == null || $receiver.a$nil){
  19952. return $self._home();
  19953. } else {
  19954. return $1;
  19955. }
  19956. }, function($ctx1) {$ctx1.fill(self,"outerContext",{})});
  19957. },
  19958. args: [],
  19959. source: "outerContext\x0a\x09^ outerContext ifNil: [ self home ]",
  19960. referencedClasses: [],
  19961. pragmas: [],
  19962. messageSends: ["ifNil:", "home"]
  19963. }),
  19964. $globals.MethodContext);
  19965. $core.addMethod(
  19966. $core.method({
  19967. selector: "selector",
  19968. protocol: "accessing",
  19969. fn: function (){
  19970. var self=this,$self=this;
  19971. return $core.withContext(function($ctx1) {
  19972. var $1,$receiver;
  19973. $1=$self.selector;
  19974. if(($receiver = $1) == null || $receiver.a$nil){
  19975. return $1;
  19976. } else {
  19977. return $recv($recv($globals.Smalltalk)._core())._js2st_($self.selector);
  19978. }
  19979. }, function($ctx1) {$ctx1.fill(self,"selector",{})});
  19980. },
  19981. args: [],
  19982. source: "selector\x0a\x09^ selector ifNotNil: [ Smalltalk core js2st: selector ]",
  19983. referencedClasses: ["Smalltalk"],
  19984. pragmas: [],
  19985. messageSends: ["ifNotNil:", "js2st:", "core"]
  19986. }),
  19987. $globals.MethodContext);
  19988. $core.addMethod(
  19989. $core.method({
  19990. selector: "sendIndexes",
  19991. protocol: "accessing",
  19992. fn: function (){
  19993. var self=this,$self=this;
  19994. return $self.sendIdx;
  19995. },
  19996. args: [],
  19997. source: "sendIndexes\x0a\x09^ sendIdx",
  19998. referencedClasses: [],
  19999. pragmas: [],
  20000. messageSends: []
  20001. }),
  20002. $globals.MethodContext);
  20003. $core.addMethod(
  20004. $core.method({
  20005. selector: "stubHere",
  20006. protocol: "accessing",
  20007. fn: function (){
  20008. var self=this,$self=this;
  20009. return $core.withContext(function($ctx1) {
  20010. $self.homeContext=$recv($globals.JSObjectProxy)._undefined();
  20011. return self;
  20012. }, function($ctx1) {$ctx1.fill(self,"stubHere",{})});
  20013. },
  20014. args: [],
  20015. source: "stubHere\x0a\x09homeContext := JSObjectProxy undefined",
  20016. referencedClasses: ["JSObjectProxy"],
  20017. pragmas: [],
  20018. messageSends: ["undefined"]
  20019. }),
  20020. $globals.MethodContext);
  20021. $core.addMethod(
  20022. $core.method({
  20023. selector: "stubToAtMost:",
  20024. protocol: "error handling",
  20025. fn: function (anInteger){
  20026. var self=this,$self=this;
  20027. var context;
  20028. return $core.withContext(function($ctx1) {
  20029. var $1,$2,$receiver;
  20030. context=self;
  20031. $recv(anInteger)._timesRepeat_((function(){
  20032. return $core.withContext(function($ctx2) {
  20033. $1=context;
  20034. if(($receiver = $1) == null || $receiver.a$nil){
  20035. context=$1;
  20036. } else {
  20037. context=$recv(context)._home();
  20038. }
  20039. return context;
  20040. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20041. }));
  20042. $2=context;
  20043. if(($receiver = $2) == null || $receiver.a$nil){
  20044. $2;
  20045. } else {
  20046. $recv(context)._stubHere();
  20047. }
  20048. return self;
  20049. }, function($ctx1) {$ctx1.fill(self,"stubToAtMost:",{anInteger:anInteger,context:context})});
  20050. },
  20051. args: ["anInteger"],
  20052. source: "stubToAtMost: anInteger\x0a\x09| context |\x0a\x09context := self.\x0a\x09anInteger timesRepeat: [ context := context ifNotNil: [ context home ] ].\x0a\x09context ifNotNil: [ context stubHere ]",
  20053. referencedClasses: [],
  20054. pragmas: [],
  20055. messageSends: ["timesRepeat:", "ifNotNil:", "home", "stubHere"]
  20056. }),
  20057. $globals.MethodContext);
  20058. $core.addMethod(
  20059. $core.method({
  20060. selector: "supercall",
  20061. protocol: "accessing",
  20062. fn: function (){
  20063. var self=this,$self=this;
  20064. return $core.withContext(function($ctx1) {
  20065. return $recv($self.supercall).__eq(true);
  20066. }, function($ctx1) {$ctx1.fill(self,"supercall",{})});
  20067. },
  20068. args: [],
  20069. source: "supercall\x0a\x09^ supercall = true",
  20070. referencedClasses: [],
  20071. pragmas: [],
  20072. messageSends: ["="]
  20073. }),
  20074. $globals.MethodContext);
  20075. $core.addClass("NativeFunction", $globals.Object, [], "Kernel-Methods");
  20076. $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' ]";
  20077. $core.addMethod(
  20078. $core.method({
  20079. selector: "constructorNamed:",
  20080. protocol: "instance creation",
  20081. fn: function (aString){
  20082. var self=this,$self=this;
  20083. return $core.withContext(function($ctx1) {
  20084. var nativeFunc=$globals.Platform._globals()[aString];
  20085. return new nativeFunc();
  20086. ;
  20087. return self;
  20088. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:",{aString:aString})});
  20089. },
  20090. args: ["aString"],
  20091. source: "constructorNamed: aString\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc();\x0a\x09'>",
  20092. referencedClasses: [],
  20093. pragmas: [["inlineJS:", ["\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc();\x0a\x09"]]],
  20094. messageSends: []
  20095. }),
  20096. $globals.NativeFunction.a$cls);
  20097. $core.addMethod(
  20098. $core.method({
  20099. selector: "constructorNamed:value:",
  20100. protocol: "instance creation",
  20101. fn: function (aString,anObject){
  20102. var self=this,$self=this;
  20103. return $core.withContext(function($ctx1) {
  20104. var nativeFunc=$globals.Platform._globals()[aString];
  20105. return new nativeFunc(anObject);
  20106. ;
  20107. return self;
  20108. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:",{aString:aString,anObject:anObject})});
  20109. },
  20110. args: ["aString", "anObject"],
  20111. source: "constructorNamed: aString value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09'>",
  20112. referencedClasses: [],
  20113. pragmas: [["inlineJS:", ["\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09"]]],
  20114. messageSends: []
  20115. }),
  20116. $globals.NativeFunction.a$cls);
  20117. $core.addMethod(
  20118. $core.method({
  20119. selector: "constructorNamed:value:value:",
  20120. protocol: "instance creation",
  20121. fn: function (aString,anObject,anObject2){
  20122. var self=this,$self=this;
  20123. return $core.withContext(function($ctx1) {
  20124. var nativeFunc=$globals.Platform._globals[aString];
  20125. return new nativeFunc(anObject,anObject2);
  20126. ;
  20127. return self;
  20128. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2})});
  20129. },
  20130. args: ["aString", "anObject", "anObject2"],
  20131. 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'>",
  20132. referencedClasses: [],
  20133. pragmas: [["inlineJS:", ["\x0a\x09\x09var nativeFunc=$globals.Platform._globals[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09"]]],
  20134. messageSends: []
  20135. }),
  20136. $globals.NativeFunction.a$cls);
  20137. $core.addMethod(
  20138. $core.method({
  20139. selector: "constructorNamed:value:value:value:",
  20140. protocol: "instance creation",
  20141. fn: function (aString,anObject,anObject2,anObject3){
  20142. var self=this,$self=this;
  20143. return $core.withContext(function($ctx1) {
  20144. var nativeFunc=$globals.Platform._globals[aString];
  20145. return new nativeFunc(anObject,anObject2, anObject3);
  20146. ;
  20147. return self;
  20148. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3})});
  20149. },
  20150. args: ["aString", "anObject", "anObject2", "anObject3"],
  20151. 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'>",
  20152. referencedClasses: [],
  20153. pragmas: [["inlineJS:", ["\x0a\x09\x09var nativeFunc=$globals.Platform._globals[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09"]]],
  20154. messageSends: []
  20155. }),
  20156. $globals.NativeFunction.a$cls);
  20157. $core.addMethod(
  20158. $core.method({
  20159. selector: "constructorOf:",
  20160. protocol: "instance creation",
  20161. fn: function (nativeFunc){
  20162. var self=this,$self=this;
  20163. return $core.withContext(function($ctx1) {
  20164. return new nativeFunc();
  20165. ;
  20166. return self;
  20167. }, function($ctx1) {$ctx1.fill(self,"constructorOf:",{nativeFunc:nativeFunc})});
  20168. },
  20169. args: ["nativeFunc"],
  20170. source: "constructorOf: nativeFunc\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc();\x0a\x09'>",
  20171. referencedClasses: [],
  20172. pragmas: [["inlineJS:", ["\x0a\x09\x09return new nativeFunc();\x0a\x09"]]],
  20173. messageSends: []
  20174. }),
  20175. $globals.NativeFunction.a$cls);
  20176. $core.addMethod(
  20177. $core.method({
  20178. selector: "constructorOf:value:",
  20179. protocol: "instance creation",
  20180. fn: function (nativeFunc,anObject){
  20181. var self=this,$self=this;
  20182. return $core.withContext(function($ctx1) {
  20183. return new nativeFunc(anObject);
  20184. ;
  20185. return self;
  20186. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:",{nativeFunc:nativeFunc,anObject:anObject})});
  20187. },
  20188. args: ["nativeFunc", "anObject"],
  20189. source: "constructorOf: nativeFunc value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09'>",
  20190. referencedClasses: [],
  20191. pragmas: [["inlineJS:", ["\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09"]]],
  20192. messageSends: []
  20193. }),
  20194. $globals.NativeFunction.a$cls);
  20195. $core.addMethod(
  20196. $core.method({
  20197. selector: "constructorOf:value:value:",
  20198. protocol: "instance creation",
  20199. fn: function (nativeFunc,anObject,anObject2){
  20200. var self=this,$self=this;
  20201. return $core.withContext(function($ctx1) {
  20202. return new nativeFunc(anObject,anObject2);
  20203. ;
  20204. return self;
  20205. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2})});
  20206. },
  20207. args: ["nativeFunc", "anObject", "anObject2"],
  20208. source: "constructorOf: nativeFunc value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09'>",
  20209. referencedClasses: [],
  20210. pragmas: [["inlineJS:", ["\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09"]]],
  20211. messageSends: []
  20212. }),
  20213. $globals.NativeFunction.a$cls);
  20214. $core.addMethod(
  20215. $core.method({
  20216. selector: "constructorOf:value:value:value:",
  20217. protocol: "instance creation",
  20218. fn: function (nativeFunc,anObject,anObject2,anObject3){
  20219. var self=this,$self=this;
  20220. return $core.withContext(function($ctx1) {
  20221. return new nativeFunc(anObject,anObject2, anObject3);
  20222. ;
  20223. return self;
  20224. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3})});
  20225. },
  20226. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  20227. source: "constructorOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  20228. referencedClasses: [],
  20229. pragmas: [["inlineJS:", ["\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09"]]],
  20230. messageSends: []
  20231. }),
  20232. $globals.NativeFunction.a$cls);
  20233. $core.addMethod(
  20234. $core.method({
  20235. selector: "exists:",
  20236. protocol: "testing",
  20237. fn: function (aString){
  20238. var self=this,$self=this;
  20239. return $core.withContext(function($ctx1) {
  20240. return $recv($globals.Platform)._includesGlobal_(aString);
  20241. }, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString})});
  20242. },
  20243. args: ["aString"],
  20244. source: "exists: aString\x0a\x09^ Platform includesGlobal: aString",
  20245. referencedClasses: ["Platform"],
  20246. pragmas: [],
  20247. messageSends: ["includesGlobal:"]
  20248. }),
  20249. $globals.NativeFunction.a$cls);
  20250. $core.addMethod(
  20251. $core.method({
  20252. selector: "functionNamed:",
  20253. protocol: "function calling",
  20254. fn: function (aString){
  20255. var self=this,$self=this;
  20256. return $core.withContext(function($ctx1) {
  20257. var nativeFunc=$globals.Platform._globals[aString];
  20258. return nativeFunc();
  20259. ;
  20260. return self;
  20261. }, function($ctx1) {$ctx1.fill(self,"functionNamed:",{aString:aString})});
  20262. },
  20263. args: ["aString"],
  20264. source: "functionNamed: aString\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals[aString];\x0a\x09\x09return nativeFunc();\x0a\x09'>",
  20265. referencedClasses: [],
  20266. pragmas: [["inlineJS:", ["\x0a\x09\x09var nativeFunc=$globals.Platform._globals[aString];\x0a\x09\x09return nativeFunc();\x0a\x09"]]],
  20267. messageSends: []
  20268. }),
  20269. $globals.NativeFunction.a$cls);
  20270. $core.addMethod(
  20271. $core.method({
  20272. selector: "functionNamed:value:",
  20273. protocol: "function calling",
  20274. fn: function (aString,anObject){
  20275. var self=this,$self=this;
  20276. return $core.withContext(function($ctx1) {
  20277. var nativeFunc=$globals.Platform._globals()[aString];
  20278. return nativeFunc(anObject);
  20279. ;
  20280. return self;
  20281. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:",{aString:aString,anObject:anObject})});
  20282. },
  20283. args: ["aString", "anObject"],
  20284. source: "functionNamed: aString value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return nativeFunc(anObject);\x0a\x09'>",
  20285. referencedClasses: [],
  20286. pragmas: [["inlineJS:", ["\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return nativeFunc(anObject);\x0a\x09"]]],
  20287. messageSends: []
  20288. }),
  20289. $globals.NativeFunction.a$cls);
  20290. $core.addMethod(
  20291. $core.method({
  20292. selector: "functionNamed:value:value:",
  20293. protocol: "function calling",
  20294. fn: function (aString,anObject,anObject2){
  20295. var self=this,$self=this;
  20296. return $core.withContext(function($ctx1) {
  20297. var nativeFunc=$globals.Platform._globals()[aString];
  20298. return nativeFunc(anObject,anObject2);
  20299. ;
  20300. return self;
  20301. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2})});
  20302. },
  20303. args: ["aString", "anObject", "anObject2"],
  20304. 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'>",
  20305. referencedClasses: [],
  20306. pragmas: [["inlineJS:", ["\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09"]]],
  20307. messageSends: []
  20308. }),
  20309. $globals.NativeFunction.a$cls);
  20310. $core.addMethod(
  20311. $core.method({
  20312. selector: "functionNamed:value:value:value:",
  20313. protocol: "function calling",
  20314. fn: function (aString,anObject,anObject2,anObject3){
  20315. var self=this,$self=this;
  20316. return $core.withContext(function($ctx1) {
  20317. var nativeFunc=$globals.Platform._globals()[aString];
  20318. return nativeFunc(anObject,anObject2, anObject3);
  20319. ;
  20320. return self;
  20321. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3})});
  20322. },
  20323. args: ["aString", "anObject", "anObject2", "anObject3"],
  20324. 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'>",
  20325. referencedClasses: [],
  20326. pragmas: [["inlineJS:", ["\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09"]]],
  20327. messageSends: []
  20328. }),
  20329. $globals.NativeFunction.a$cls);
  20330. $core.addMethod(
  20331. $core.method({
  20332. selector: "functionNamed:valueWithArgs:",
  20333. protocol: "function calling",
  20334. fn: function (aString,args){
  20335. var self=this,$self=this;
  20336. return $core.withContext(function($ctx1) {
  20337. var nativeFunc=$globals.Platform._globals()[aString];
  20338. return Function.prototype.apply.call(nativeFunc, null, args);
  20339. ;
  20340. return self;
  20341. }, function($ctx1) {$ctx1.fill(self,"functionNamed:valueWithArgs:",{aString:aString,args:args})});
  20342. },
  20343. args: ["aString", "args"],
  20344. 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'>",
  20345. referencedClasses: [],
  20346. pragmas: [["inlineJS:", ["\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09"]]],
  20347. messageSends: []
  20348. }),
  20349. $globals.NativeFunction.a$cls);
  20350. $core.addMethod(
  20351. $core.method({
  20352. selector: "functionOf:",
  20353. protocol: "function calling",
  20354. fn: function (nativeFunc){
  20355. var self=this,$self=this;
  20356. return $core.withContext(function($ctx1) {
  20357. return nativeFunc();
  20358. ;
  20359. return self;
  20360. }, function($ctx1) {$ctx1.fill(self,"functionOf:",{nativeFunc:nativeFunc})});
  20361. },
  20362. args: ["nativeFunc"],
  20363. source: "functionOf: nativeFunc\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc();\x0a\x09'>",
  20364. referencedClasses: [],
  20365. pragmas: [["inlineJS:", ["\x0a\x09\x09return nativeFunc();\x0a\x09"]]],
  20366. messageSends: []
  20367. }),
  20368. $globals.NativeFunction.a$cls);
  20369. $core.addMethod(
  20370. $core.method({
  20371. selector: "functionOf:value:",
  20372. protocol: "function calling",
  20373. fn: function (nativeFunc,anObject){
  20374. var self=this,$self=this;
  20375. return $core.withContext(function($ctx1) {
  20376. return nativeFunc(anObject);
  20377. ;
  20378. return self;
  20379. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:",{nativeFunc:nativeFunc,anObject:anObject})});
  20380. },
  20381. args: ["nativeFunc", "anObject"],
  20382. source: "functionOf: nativeFunc value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject);\x0a\x09'>",
  20383. referencedClasses: [],
  20384. pragmas: [["inlineJS:", ["\x0a\x09\x09return nativeFunc(anObject);\x0a\x09"]]],
  20385. messageSends: []
  20386. }),
  20387. $globals.NativeFunction.a$cls);
  20388. $core.addMethod(
  20389. $core.method({
  20390. selector: "functionOf:value:value:",
  20391. protocol: "function calling",
  20392. fn: function (nativeFunc,anObject,anObject2){
  20393. var self=this,$self=this;
  20394. return $core.withContext(function($ctx1) {
  20395. return nativeFunc(anObject,anObject2);
  20396. ;
  20397. return self;
  20398. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2})});
  20399. },
  20400. args: ["nativeFunc", "anObject", "anObject2"],
  20401. source: "functionOf: nativeFunc value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09'>",
  20402. referencedClasses: [],
  20403. pragmas: [["inlineJS:", ["\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09"]]],
  20404. messageSends: []
  20405. }),
  20406. $globals.NativeFunction.a$cls);
  20407. $core.addMethod(
  20408. $core.method({
  20409. selector: "functionOf:value:value:value:",
  20410. protocol: "function calling",
  20411. fn: function (nativeFunc,anObject,anObject2,anObject3){
  20412. var self=this,$self=this;
  20413. return $core.withContext(function($ctx1) {
  20414. return nativeFunc(anObject,anObject2, anObject3);
  20415. ;
  20416. return self;
  20417. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3})});
  20418. },
  20419. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  20420. source: "functionOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  20421. referencedClasses: [],
  20422. pragmas: [["inlineJS:", ["\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09"]]],
  20423. messageSends: []
  20424. }),
  20425. $globals.NativeFunction.a$cls);
  20426. $core.addMethod(
  20427. $core.method({
  20428. selector: "functionOf:valueWithArgs:",
  20429. protocol: "function calling",
  20430. fn: function (nativeFunc,args){
  20431. var self=this,$self=this;
  20432. return $core.withContext(function($ctx1) {
  20433. return Function.prototype.apply.call(nativeFunc, null, args);
  20434. ;
  20435. return self;
  20436. }, function($ctx1) {$ctx1.fill(self,"functionOf:valueWithArgs:",{nativeFunc:nativeFunc,args:args})});
  20437. },
  20438. args: ["nativeFunc", "args"],
  20439. source: "functionOf: nativeFunc valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09'>",
  20440. referencedClasses: [],
  20441. pragmas: [["inlineJS:", ["\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09"]]],
  20442. messageSends: []
  20443. }),
  20444. $globals.NativeFunction.a$cls);
  20445. $core.addMethod(
  20446. $core.method({
  20447. selector: "isNativeFunction:",
  20448. protocol: "testing",
  20449. fn: function (anObject){
  20450. var self=this,$self=this;
  20451. return $core.withContext(function($ctx1) {
  20452. return typeof anObject === "function";
  20453. return self;
  20454. }, function($ctx1) {$ctx1.fill(self,"isNativeFunction:",{anObject:anObject})});
  20455. },
  20456. args: ["anObject"],
  20457. source: "isNativeFunction: anObject\x0a\x09<inlineJS: 'return typeof anObject === \x22function\x22'>",
  20458. referencedClasses: [],
  20459. pragmas: [["inlineJS:", ["return typeof anObject === \x22function\x22"]]],
  20460. messageSends: []
  20461. }),
  20462. $globals.NativeFunction.a$cls);
  20463. $core.addMethod(
  20464. $core.method({
  20465. selector: "methodOf:this:",
  20466. protocol: "method calling",
  20467. fn: function (nativeFunc,thisObject){
  20468. var self=this,$self=this;
  20469. return $core.withContext(function($ctx1) {
  20470. return Function.prototype.call.call(nativeFunc, thisObject);
  20471. ;
  20472. return self;
  20473. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:",{nativeFunc:nativeFunc,thisObject:thisObject})});
  20474. },
  20475. args: ["nativeFunc", "thisObject"],
  20476. source: "methodOf: nativeFunc this: thisObject\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject);\x0a\x09'>",
  20477. referencedClasses: [],
  20478. pragmas: [["inlineJS:", ["\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject);\x0a\x09"]]],
  20479. messageSends: []
  20480. }),
  20481. $globals.NativeFunction.a$cls);
  20482. $core.addMethod(
  20483. $core.method({
  20484. selector: "methodOf:this:value:",
  20485. protocol: "method calling",
  20486. fn: function (nativeFunc,thisObject,anObject){
  20487. var self=this,$self=this;
  20488. return $core.withContext(function($ctx1) {
  20489. return Function.prototype.call.call(nativeFunc, thisObject, anObject);
  20490. ;
  20491. return self;
  20492. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject})});
  20493. },
  20494. args: ["nativeFunc", "thisObject", "anObject"],
  20495. source: "methodOf: nativeFunc this: thisObject value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject, anObject);\x0a\x09'>",
  20496. referencedClasses: [],
  20497. pragmas: [["inlineJS:", ["\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject, anObject);\x0a\x09"]]],
  20498. messageSends: []
  20499. }),
  20500. $globals.NativeFunction.a$cls);
  20501. $core.addMethod(
  20502. $core.method({
  20503. selector: "methodOf:this:value:value:",
  20504. protocol: "method calling",
  20505. fn: function (nativeFunc,thisObject,anObject,anObject2){
  20506. var self=this,$self=this;
  20507. return $core.withContext(function($ctx1) {
  20508. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);
  20509. ;
  20510. return self;
  20511. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2})});
  20512. },
  20513. args: ["nativeFunc", "thisObject", "anObject", "anObject2"],
  20514. 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'>",
  20515. referencedClasses: [],
  20516. pragmas: [["inlineJS:", ["\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);\x0a\x09"]]],
  20517. messageSends: []
  20518. }),
  20519. $globals.NativeFunction.a$cls);
  20520. $core.addMethod(
  20521. $core.method({
  20522. selector: "methodOf:this:value:value:value:",
  20523. protocol: "method calling",
  20524. fn: function (nativeFunc,thisObject,anObject,anObject2,anObject3){
  20525. var self=this,$self=this;
  20526. return $core.withContext(function($ctx1) {
  20527. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);
  20528. ;
  20529. return self;
  20530. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2,anObject3:anObject3})});
  20531. },
  20532. args: ["nativeFunc", "thisObject", "anObject", "anObject2", "anObject3"],
  20533. 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'>",
  20534. referencedClasses: [],
  20535. pragmas: [["inlineJS:", ["\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);\x0a\x09"]]],
  20536. messageSends: []
  20537. }),
  20538. $globals.NativeFunction.a$cls);
  20539. $core.addMethod(
  20540. $core.method({
  20541. selector: "methodOf:this:valueWithArgs:",
  20542. protocol: "method calling",
  20543. fn: function (nativeFunc,thisObject,args){
  20544. var self=this,$self=this;
  20545. return $core.withContext(function($ctx1) {
  20546. return Function.prototype.apply.call(nativeFunc, thisObject, args);
  20547. ;
  20548. return self;
  20549. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:valueWithArgs:",{nativeFunc:nativeFunc,thisObject:thisObject,args:args})});
  20550. },
  20551. args: ["nativeFunc", "thisObject", "args"],
  20552. source: "methodOf: nativeFunc this: thisObject valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, thisObject, args);\x0a\x09'>",
  20553. referencedClasses: [],
  20554. pragmas: [["inlineJS:", ["\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, thisObject, args);\x0a\x09"]]],
  20555. messageSends: []
  20556. }),
  20557. $globals.NativeFunction.a$cls);
  20558. $core.addTrait("TMethodContext", "Kernel-Methods");
  20559. $core.addMethod(
  20560. $core.method({
  20561. selector: "asString",
  20562. protocol: "converting",
  20563. fn: function (){
  20564. var self=this,$self=this;
  20565. return $core.withContext(function($ctx1) {
  20566. var $1,$2,$receiver;
  20567. $1=$self._isBlockContext();
  20568. if($core.assert($1)){
  20569. return $recv("a block (in ".__comma($recv($self._methodContext())._asString())).__comma(")");
  20570. $ctx1.sendIdx[","]=1;
  20571. } else {
  20572. $2=$self._method();
  20573. if(($receiver = $2) == null || $receiver.a$nil){
  20574. return $2;
  20575. } else {
  20576. var method;
  20577. method=$receiver;
  20578. return $recv(method)._asStringForClass_($recv($self._receiver())._class());
  20579. }
  20580. }
  20581. }, function($ctx1) {$ctx1.fill(self,"asString",{})});
  20582. },
  20583. args: [],
  20584. source: "asString\x0a\x09^ self isBlockContext\x0a\x09\x09ifTrue: [ 'a block (in ', self methodContext asString, ')' ]\x0a\x09\x09ifFalse: [ self method ifNotNil: [ :method | method asStringForClass: self receiver class ] ]",
  20585. referencedClasses: [],
  20586. pragmas: [],
  20587. messageSends: ["ifTrue:ifFalse:", "isBlockContext", ",", "asString", "methodContext", "ifNotNil:", "method", "asStringForClass:", "class", "receiver"]
  20588. }),
  20589. $globals.TMethodContext);
  20590. $core.addMethod(
  20591. $core.method({
  20592. selector: "basicReceiver",
  20593. protocol: "accessing",
  20594. fn: function (){
  20595. var self=this,$self=this;
  20596. return $core.withContext(function($ctx1) {
  20597. $self._subclassResponsibility();
  20598. return self;
  20599. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{})});
  20600. },
  20601. args: [],
  20602. source: "basicReceiver\x0a\x09self subclassResponsibility",
  20603. referencedClasses: [],
  20604. pragmas: [],
  20605. messageSends: ["subclassResponsibility"]
  20606. }),
  20607. $globals.TMethodContext);
  20608. $core.addMethod(
  20609. $core.method({
  20610. selector: "findContextSuchThat:",
  20611. protocol: "accessing",
  20612. fn: function (testBlock){
  20613. var self=this,$self=this;
  20614. var context;
  20615. return $core.withContext(function($ctx1) {
  20616. var $1;
  20617. var $early={};
  20618. try {
  20619. context=self;
  20620. $recv((function(){
  20621. return $core.withContext(function($ctx2) {
  20622. return $recv(context)._isNil();
  20623. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20624. }))._whileFalse_((function(){
  20625. return $core.withContext(function($ctx2) {
  20626. $1=$recv(testBlock)._value_(context);
  20627. if($core.assert($1)){
  20628. throw $early=[context];
  20629. }
  20630. context=$recv(context)._outerContext();
  20631. return context;
  20632. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  20633. }));
  20634. return nil;
  20635. }
  20636. catch(e) {if(e===$early)return e[0]; throw e}
  20637. }, function($ctx1) {$ctx1.fill(self,"findContextSuchThat:",{testBlock:testBlock,context:context})});
  20638. },
  20639. args: ["testBlock"],
  20640. 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",
  20641. referencedClasses: [],
  20642. pragmas: [],
  20643. messageSends: ["whileFalse:", "isNil", "ifTrue:", "value:", "outerContext"]
  20644. }),
  20645. $globals.TMethodContext);
  20646. $core.addMethod(
  20647. $core.method({
  20648. selector: "home",
  20649. protocol: "accessing",
  20650. fn: function (){
  20651. var self=this,$self=this;
  20652. return $core.withContext(function($ctx1) {
  20653. $self._subclassResponsibility();
  20654. return self;
  20655. }, function($ctx1) {$ctx1.fill(self,"home",{})});
  20656. },
  20657. args: [],
  20658. source: "home\x0a\x09self subclassResponsibility",
  20659. referencedClasses: [],
  20660. pragmas: [],
  20661. messageSends: ["subclassResponsibility"]
  20662. }),
  20663. $globals.TMethodContext);
  20664. $core.addMethod(
  20665. $core.method({
  20666. selector: "index",
  20667. protocol: "accessing",
  20668. fn: function (){
  20669. var self=this,$self=this;
  20670. return $core.withContext(function($ctx1) {
  20671. $self._subclassResponsibility();
  20672. return self;
  20673. }, function($ctx1) {$ctx1.fill(self,"index",{})});
  20674. },
  20675. args: [],
  20676. source: "index\x0a\x09self subclassResponsibility",
  20677. referencedClasses: [],
  20678. pragmas: [],
  20679. messageSends: ["subclassResponsibility"]
  20680. }),
  20681. $globals.TMethodContext);
  20682. $core.addMethod(
  20683. $core.method({
  20684. selector: "isBlockContext",
  20685. protocol: "testing",
  20686. fn: function (){
  20687. var self=this,$self=this;
  20688. return $core.withContext(function($ctx1) {
  20689. return $recv($self._selector())._isNil();
  20690. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{})});
  20691. },
  20692. args: [],
  20693. source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a\x09\x0a\x09^ self selector isNil",
  20694. referencedClasses: [],
  20695. pragmas: [],
  20696. messageSends: ["isNil", "selector"]
  20697. }),
  20698. $globals.TMethodContext);
  20699. $core.addMethod(
  20700. $core.method({
  20701. selector: "locals",
  20702. protocol: "accessing",
  20703. fn: function (){
  20704. var self=this,$self=this;
  20705. return $core.withContext(function($ctx1) {
  20706. $self._subclassResponsibility();
  20707. return self;
  20708. }, function($ctx1) {$ctx1.fill(self,"locals",{})});
  20709. },
  20710. args: [],
  20711. source: "locals\x0a\x09self subclassResponsibility",
  20712. referencedClasses: [],
  20713. pragmas: [],
  20714. messageSends: ["subclassResponsibility"]
  20715. }),
  20716. $globals.TMethodContext);
  20717. $core.addMethod(
  20718. $core.method({
  20719. selector: "method",
  20720. protocol: "accessing",
  20721. fn: function (){
  20722. var self=this,$self=this;
  20723. var method,lookupClass,receiverClass,supercall;
  20724. return $core.withContext(function($ctx1) {
  20725. var $1,$3,$2,$4,$6,$5,$7,$8,$receiver;
  20726. $1=$self._methodContext();
  20727. $ctx1.sendIdx["methodContext"]=1;
  20728. if(($receiver = $1) == null || $receiver.a$nil){
  20729. return nil;
  20730. } else {
  20731. $1;
  20732. }
  20733. $3=$self._methodContext();
  20734. $ctx1.sendIdx["methodContext"]=2;
  20735. $2=$recv($3)._receiver();
  20736. receiverClass=$recv($2)._class();
  20737. $4=receiverClass;
  20738. $6=$self._methodContext();
  20739. $ctx1.sendIdx["methodContext"]=3;
  20740. $5=$recv($6)._selector();
  20741. $ctx1.sendIdx["selector"]=1;
  20742. method=$recv($4)._lookupSelector_($5);
  20743. $ctx1.sendIdx["lookupSelector:"]=1;
  20744. $7=$self._outerContext();
  20745. if(($receiver = $7) == null || $receiver.a$nil){
  20746. supercall=false;
  20747. } else {
  20748. var outer;
  20749. outer=$receiver;
  20750. supercall=$recv(outer)._supercall();
  20751. }
  20752. $8=supercall;
  20753. if($core.assert($8)){
  20754. return $recv($recv($recv(method)._methodClass())._superclass())._lookupSelector_($recv($self._methodContext())._selector());
  20755. } else {
  20756. return method;
  20757. }
  20758. }, function($ctx1) {$ctx1.fill(self,"method",{method:method,lookupClass:lookupClass,receiverClass:receiverClass,supercall:supercall})});
  20759. },
  20760. args: [],
  20761. 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 ]",
  20762. referencedClasses: [],
  20763. pragmas: [],
  20764. messageSends: ["ifNil:", "methodContext", "class", "receiver", "lookupSelector:", "selector", "ifNil:ifNotNil:", "outerContext", "supercall", "ifFalse:ifTrue:", "superclass", "methodClass"]
  20765. }),
  20766. $globals.TMethodContext);
  20767. $core.addMethod(
  20768. $core.method({
  20769. selector: "methodContext",
  20770. protocol: "accessing",
  20771. fn: function (){
  20772. var self=this,$self=this;
  20773. return $core.withContext(function($ctx1) {
  20774. var $1,$2,$receiver;
  20775. $1=$self._isBlockContext();
  20776. if(!$core.assert($1)){
  20777. return self;
  20778. }
  20779. $2=$self._outerContext();
  20780. if(($receiver = $2) == null || $receiver.a$nil){
  20781. return $2;
  20782. } else {
  20783. var outer;
  20784. outer=$receiver;
  20785. return $recv(outer)._methodContext();
  20786. }
  20787. }, function($ctx1) {$ctx1.fill(self,"methodContext",{})});
  20788. },
  20789. args: [],
  20790. source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self outerContext ifNotNil: [ :outer |\x0a\x09\x09outer methodContext ]",
  20791. referencedClasses: [],
  20792. pragmas: [],
  20793. messageSends: ["ifFalse:", "isBlockContext", "ifNotNil:", "outerContext", "methodContext"]
  20794. }),
  20795. $globals.TMethodContext);
  20796. $core.addMethod(
  20797. $core.method({
  20798. selector: "outerContext",
  20799. protocol: "accessing",
  20800. fn: function (){
  20801. var self=this,$self=this;
  20802. return $core.withContext(function($ctx1) {
  20803. $self._subclassResponsibility();
  20804. return self;
  20805. }, function($ctx1) {$ctx1.fill(self,"outerContext",{})});
  20806. },
  20807. args: [],
  20808. source: "outerContext\x0a\x09self subclassResponsibility",
  20809. referencedClasses: [],
  20810. pragmas: [],
  20811. messageSends: ["subclassResponsibility"]
  20812. }),
  20813. $globals.TMethodContext);
  20814. $core.addMethod(
  20815. $core.method({
  20816. selector: "printOn:",
  20817. protocol: "printing",
  20818. fn: function (aStream){
  20819. var self=this,$self=this;
  20820. return $core.withContext(function($ctx1) {
  20821. (
  20822. $ctx1.supercall = true,
  20823. ($globals.TMethodContext.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  20824. $ctx1.supercall = false;
  20825. $recv(aStream)._nextPutAll_("(");
  20826. $ctx1.sendIdx["nextPutAll:"]=1;
  20827. $recv(aStream)._nextPutAll_($self._asString());
  20828. $ctx1.sendIdx["nextPutAll:"]=2;
  20829. $recv(aStream)._nextPutAll_(")");
  20830. return self;
  20831. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  20832. },
  20833. args: ["aStream"],
  20834. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self asString;\x0a\x09\x09nextPutAll: ')'",
  20835. referencedClasses: [],
  20836. pragmas: [],
  20837. messageSends: ["printOn:", "nextPutAll:", "asString"]
  20838. }),
  20839. $globals.TMethodContext);
  20840. $core.addMethod(
  20841. $core.method({
  20842. selector: "receiver",
  20843. protocol: "accessing",
  20844. fn: function (){
  20845. var self=this,$self=this;
  20846. return $core.withContext(function($ctx1) {
  20847. var $2,$1;
  20848. $1=$recv($self._isBlockContext())._and_((function(){
  20849. return $core.withContext(function($ctx2) {
  20850. $2=$self._outerContext();
  20851. $ctx2.sendIdx["outerContext"]=1;
  20852. return $recv($2)._notNil();
  20853. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20854. }));
  20855. if($core.assert($1)){
  20856. return $recv($self._outerContext())._receiver();
  20857. } else {
  20858. return $self._basicReceiver();
  20859. }
  20860. }, function($ctx1) {$ctx1.fill(self,"receiver",{})});
  20861. },
  20862. args: [],
  20863. source: "receiver\x0a\x09^ (self isBlockContext and: [ self outerContext notNil ])\x0a\x09\x09ifTrue: [ self outerContext receiver ]\x0a\x09\x09ifFalse: [ self basicReceiver ]",
  20864. referencedClasses: [],
  20865. pragmas: [],
  20866. messageSends: ["ifTrue:ifFalse:", "and:", "isBlockContext", "notNil", "outerContext", "receiver", "basicReceiver"]
  20867. }),
  20868. $globals.TMethodContext);
  20869. $core.addMethod(
  20870. $core.method({
  20871. selector: "selector",
  20872. protocol: "accessing",
  20873. fn: function (){
  20874. var self=this,$self=this;
  20875. return $core.withContext(function($ctx1) {
  20876. $self._subclassResponsibility();
  20877. return self;
  20878. }, function($ctx1) {$ctx1.fill(self,"selector",{})});
  20879. },
  20880. args: [],
  20881. source: "selector\x0a\x09self subclassResponsibility",
  20882. referencedClasses: [],
  20883. pragmas: [],
  20884. messageSends: ["subclassResponsibility"]
  20885. }),
  20886. $globals.TMethodContext);
  20887. $core.addMethod(
  20888. $core.method({
  20889. selector: "sendIndexes",
  20890. protocol: "accessing",
  20891. fn: function (){
  20892. var self=this,$self=this;
  20893. return $core.withContext(function($ctx1) {
  20894. $self._subclassResponsibility();
  20895. return self;
  20896. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{})});
  20897. },
  20898. args: [],
  20899. source: "sendIndexes\x0a\x09self subclassResponsibility",
  20900. referencedClasses: [],
  20901. pragmas: [],
  20902. messageSends: ["subclassResponsibility"]
  20903. }),
  20904. $globals.TMethodContext);
  20905. $core.addMethod(
  20906. $core.method({
  20907. selector: "supercall",
  20908. protocol: "accessing",
  20909. fn: function (){
  20910. var self=this,$self=this;
  20911. return $core.withContext(function($ctx1) {
  20912. $self._subclassResponsibility();
  20913. return self;
  20914. }, function($ctx1) {$ctx1.fill(self,"supercall",{})});
  20915. },
  20916. args: [],
  20917. source: "supercall\x0a\x09self subclassResponsibility",
  20918. referencedClasses: [],
  20919. pragmas: [],
  20920. messageSends: ["subclassResponsibility"]
  20921. }),
  20922. $globals.TMethodContext);
  20923. $core.addClass("Timeout", $globals.Object, ["rawTimeout"], "Kernel-Methods");
  20924. $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.";
  20925. $core.addMethod(
  20926. $core.method({
  20927. selector: "clearInterval",
  20928. protocol: "timeout/interval",
  20929. fn: function (){
  20930. var self=this,$self=this;
  20931. return $core.withContext(function($ctx1) {
  20932. var interval = $self.rawTimeout;
  20933. clearInterval(interval);
  20934. ;
  20935. return self;
  20936. }, function($ctx1) {$ctx1.fill(self,"clearInterval",{})});
  20937. },
  20938. args: [],
  20939. source: "clearInterval\x0a\x09<inlineJS: '\x0a\x09\x09var interval = $self.rawTimeout;\x0a\x09\x09clearInterval(interval);\x0a\x09'>",
  20940. referencedClasses: [],
  20941. pragmas: [["inlineJS:", ["\x0a\x09\x09var interval = $self.rawTimeout;\x0a\x09\x09clearInterval(interval);\x0a\x09"]]],
  20942. messageSends: []
  20943. }),
  20944. $globals.Timeout);
  20945. $core.addMethod(
  20946. $core.method({
  20947. selector: "clearTimeout",
  20948. protocol: "timeout/interval",
  20949. fn: function (){
  20950. var self=this,$self=this;
  20951. return $core.withContext(function($ctx1) {
  20952. var timeout = $self.rawTimeout;
  20953. clearTimeout(timeout);
  20954. ;
  20955. return self;
  20956. }, function($ctx1) {$ctx1.fill(self,"clearTimeout",{})});
  20957. },
  20958. args: [],
  20959. source: "clearTimeout\x0a\x09<inlineJS: '\x0a\x09\x09var timeout = $self.rawTimeout;\x0a\x09\x09clearTimeout(timeout);\x0a\x09'>",
  20960. referencedClasses: [],
  20961. pragmas: [["inlineJS:", ["\x0a\x09\x09var timeout = $self.rawTimeout;\x0a\x09\x09clearTimeout(timeout);\x0a\x09"]]],
  20962. messageSends: []
  20963. }),
  20964. $globals.Timeout);
  20965. $core.addMethod(
  20966. $core.method({
  20967. selector: "rawTimeout:",
  20968. protocol: "accessing",
  20969. fn: function (anObject){
  20970. var self=this,$self=this;
  20971. $self.rawTimeout=anObject;
  20972. return self;
  20973. },
  20974. args: ["anObject"],
  20975. source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
  20976. referencedClasses: [],
  20977. pragmas: [],
  20978. messageSends: []
  20979. }),
  20980. $globals.Timeout);
  20981. $core.addMethod(
  20982. $core.method({
  20983. selector: "on:",
  20984. protocol: "instance creation",
  20985. fn: function (anObject){
  20986. var self=this,$self=this;
  20987. return $core.withContext(function($ctx1) {
  20988. var $1;
  20989. $1=$self._new();
  20990. $recv($1)._rawTimeout_(anObject);
  20991. return $recv($1)._yourself();
  20992. }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject})});
  20993. },
  20994. args: ["anObject"],
  20995. source: "on: anObject\x0a\x09^ self new rawTimeout: anObject; yourself",
  20996. referencedClasses: [],
  20997. pragmas: [],
  20998. messageSends: ["rawTimeout:", "new", "yourself"]
  20999. }),
  21000. $globals.Timeout.a$cls);
  21001. $core.setTraitComposition([{trait: $globals.TMethodContext}], $globals.MethodContext);
  21002. });
  21003. define('amber/core/Kernel-Dag',["amber/boot", "require", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  21004. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  21005. var $pkg = $core.addPackage("Kernel-Dag");
  21006. $pkg.innerEval = function (expr) { return eval(expr); };
  21007. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  21008. $core.addClass("AbstractDagVisitor", $globals.Object, [], "Kernel-Dag");
  21009. $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:`.";
  21010. $core.addMethod(
  21011. $core.method({
  21012. selector: "value:",
  21013. protocol: "evaluating",
  21014. fn: function (anObject){
  21015. var self=this,$self=this;
  21016. return $core.withContext(function($ctx1) {
  21017. return $self._visit_(anObject);
  21018. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject})});
  21019. },
  21020. args: ["anObject"],
  21021. source: "value: anObject\x0a\x09^ self visit: anObject",
  21022. referencedClasses: [],
  21023. pragmas: [],
  21024. messageSends: ["visit:"]
  21025. }),
  21026. $globals.AbstractDagVisitor);
  21027. $core.addMethod(
  21028. $core.method({
  21029. selector: "visit:",
  21030. protocol: "visiting",
  21031. fn: function (aNode){
  21032. var self=this,$self=this;
  21033. return $core.withContext(function($ctx1) {
  21034. return $recv(aNode)._acceptDagVisitor_(self);
  21035. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode})});
  21036. },
  21037. args: ["aNode"],
  21038. source: "visit: aNode\x0a\x09^ aNode acceptDagVisitor: self",
  21039. referencedClasses: [],
  21040. pragmas: [],
  21041. messageSends: ["acceptDagVisitor:"]
  21042. }),
  21043. $globals.AbstractDagVisitor);
  21044. $core.addMethod(
  21045. $core.method({
  21046. selector: "visitAll:",
  21047. protocol: "visiting",
  21048. fn: function (aCollection){
  21049. var self=this,$self=this;
  21050. return $core.withContext(function($ctx1) {
  21051. return $recv(aCollection)._collect_((function(each){
  21052. return $core.withContext(function($ctx2) {
  21053. return $self._visit_(each);
  21054. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21055. }));
  21056. }, function($ctx1) {$ctx1.fill(self,"visitAll:",{aCollection:aCollection})});
  21057. },
  21058. args: ["aCollection"],
  21059. source: "visitAll: aCollection\x0a\x09^ aCollection collect: [ :each | self visit: each ]",
  21060. referencedClasses: [],
  21061. pragmas: [],
  21062. messageSends: ["collect:", "visit:"]
  21063. }),
  21064. $globals.AbstractDagVisitor);
  21065. $core.addMethod(
  21066. $core.method({
  21067. selector: "visitAllChildren:",
  21068. protocol: "visiting",
  21069. fn: function (aDagNode){
  21070. var self=this,$self=this;
  21071. return $core.withContext(function($ctx1) {
  21072. return $self._visitAll_($recv(aDagNode)._dagChildren());
  21073. }, function($ctx1) {$ctx1.fill(self,"visitAllChildren:",{aDagNode:aDagNode})});
  21074. },
  21075. args: ["aDagNode"],
  21076. source: "visitAllChildren: aDagNode\x0a\x09^ self visitAll: aDagNode dagChildren",
  21077. referencedClasses: [],
  21078. pragmas: [],
  21079. messageSends: ["visitAll:", "dagChildren"]
  21080. }),
  21081. $globals.AbstractDagVisitor);
  21082. $core.addMethod(
  21083. $core.method({
  21084. selector: "visitDagNode:",
  21085. protocol: "visiting",
  21086. fn: function (aNode){
  21087. var self=this,$self=this;
  21088. return $core.withContext(function($ctx1) {
  21089. $self._subclassResponsibility();
  21090. return self;
  21091. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode})});
  21092. },
  21093. args: ["aNode"],
  21094. source: "visitDagNode: aNode\x0a\x09self subclassResponsibility",
  21095. referencedClasses: [],
  21096. pragmas: [],
  21097. messageSends: ["subclassResponsibility"]
  21098. }),
  21099. $globals.AbstractDagVisitor);
  21100. $core.addMethod(
  21101. $core.method({
  21102. selector: "visitDagNodeVariantRedux:",
  21103. protocol: "visiting",
  21104. fn: function (aNode){
  21105. var self=this,$self=this;
  21106. var newChildren,oldChildren;
  21107. return $core.withContext(function($ctx1) {
  21108. var $2,$3,$1,$4,$5;
  21109. var $early={};
  21110. try {
  21111. oldChildren=$recv(aNode)._dagChildren();
  21112. newChildren=$self._visitAllChildren_(aNode);
  21113. $2=$recv(oldChildren)._size();
  21114. $ctx1.sendIdx["size"]=1;
  21115. $3=$recv(newChildren)._size();
  21116. $ctx1.sendIdx["size"]=2;
  21117. $1=$recv($2).__eq($3);
  21118. if($core.assert($1)){
  21119. $recv((1)._to_($recv(oldChildren)._size()))._detect_ifNone_((function(i){
  21120. return $core.withContext(function($ctx2) {
  21121. $4=$recv(oldChildren)._at_(i);
  21122. $ctx2.sendIdx["at:"]=1;
  21123. return $recv($4).__tild_eq($recv(newChildren)._at_(i));
  21124. }, function($ctx2) {$ctx2.fillBlock({i:i},$ctx1,2)});
  21125. }),(function(){
  21126. throw $early=[aNode];
  21127. }));
  21128. }
  21129. $5=$recv(aNode)._copy();
  21130. $recv($5)._dagChildren_(newChildren);
  21131. return $recv($5)._yourself();
  21132. }
  21133. catch(e) {if(e===$early)return e[0]; throw e}
  21134. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantRedux:",{aNode:aNode,newChildren:newChildren,oldChildren:oldChildren})});
  21135. },
  21136. args: ["aNode"],
  21137. source: "visitDagNodeVariantRedux: aNode\x0a\x09\x22Immutable-guarded implementation of visitDagNode:.\x0a\x09Visits all children and checks if there were changes.\x0a\x09If not, returns aNode.\x0a\x09If yes, returns copy of aNode with new children.\x22\x0a\x0a\x09| newChildren oldChildren |\x0a\x09oldChildren := aNode dagChildren.\x0a\x09newChildren := self visitAllChildren: aNode.\x0a\x09oldChildren size = newChildren size ifTrue: [\x0a\x09\x09(1 to: oldChildren size) detect: [ :i |\x0a\x09\x09\x09(oldChildren at: i) ~= (newChildren at: i)\x0a\x09\x09] ifNone: [ \x22no change\x22 ^ aNode ] ].\x0a\x09^ aNode copy dagChildren: newChildren; yourself",
  21138. referencedClasses: [],
  21139. pragmas: [],
  21140. messageSends: ["dagChildren", "visitAllChildren:", "ifTrue:", "=", "size", "detect:ifNone:", "to:", "~=", "at:", "dagChildren:", "copy", "yourself"]
  21141. }),
  21142. $globals.AbstractDagVisitor);
  21143. $core.addMethod(
  21144. $core.method({
  21145. selector: "visitDagNodeVariantSimple:",
  21146. protocol: "visiting",
  21147. fn: function (aNode){
  21148. var self=this,$self=this;
  21149. return $core.withContext(function($ctx1) {
  21150. $self._visitAllChildren_(aNode);
  21151. return aNode;
  21152. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantSimple:",{aNode:aNode})});
  21153. },
  21154. args: ["aNode"],
  21155. source: "visitDagNodeVariantSimple: aNode\x0a\x09\x22Simple implementation of visitDagNode:.\x0a\x09Visits children, then returns aNode\x22\x0a\x0a\x09self visitAllChildren: aNode.\x0a\x09^ aNode",
  21156. referencedClasses: [],
  21157. pragmas: [],
  21158. messageSends: ["visitAllChildren:"]
  21159. }),
  21160. $globals.AbstractDagVisitor);
  21161. $core.addClass("PathDagVisitor", $globals.AbstractDagVisitor, ["path"], "Kernel-Dag");
  21162. $globals.PathDagVisitor.comment="I am base class of `DagNode` visitor.\x0a\x0aI hold the path of ancestors up to actual node\x0ain `self path`.";
  21163. $core.addMethod(
  21164. $core.method({
  21165. selector: "initialize",
  21166. protocol: "initialization",
  21167. fn: function (){
  21168. var self=this,$self=this;
  21169. return $core.withContext(function($ctx1) {
  21170. (
  21171. $ctx1.supercall = true,
  21172. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  21173. $ctx1.supercall = false;
  21174. $self.path=[];
  21175. return self;
  21176. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  21177. },
  21178. args: [],
  21179. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09path := #()",
  21180. referencedClasses: [],
  21181. pragmas: [],
  21182. messageSends: ["initialize"]
  21183. }),
  21184. $globals.PathDagVisitor);
  21185. $core.addMethod(
  21186. $core.method({
  21187. selector: "path",
  21188. protocol: "accessing",
  21189. fn: function (){
  21190. var self=this,$self=this;
  21191. return $self.path;
  21192. },
  21193. args: [],
  21194. source: "path\x0a\x09^ path",
  21195. referencedClasses: [],
  21196. pragmas: [],
  21197. messageSends: []
  21198. }),
  21199. $globals.PathDagVisitor);
  21200. $core.addMethod(
  21201. $core.method({
  21202. selector: "visit:",
  21203. protocol: "visiting",
  21204. fn: function (aNode){
  21205. var self=this,$self=this;
  21206. var oldPath,result;
  21207. return $core.withContext(function($ctx1) {
  21208. result=aNode;
  21209. oldPath=$self.path;
  21210. $recv((function(){
  21211. return $core.withContext(function($ctx2) {
  21212. $self.path=$recv($self.path).__comma([aNode]);
  21213. result=(
  21214. $ctx2.supercall = true,
  21215. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
  21216. $ctx2.supercall = false;
  21217. return result;
  21218. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  21219. }))._ensure_((function(){
  21220. $self.path=oldPath;
  21221. return $self.path;
  21222. }));
  21223. return result;
  21224. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode,oldPath:oldPath,result:result})});
  21225. },
  21226. args: ["aNode"],
  21227. 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",
  21228. referencedClasses: [],
  21229. pragmas: [],
  21230. messageSends: ["ensure:", ",", "visit:"]
  21231. }),
  21232. $globals.PathDagVisitor);
  21233. $core.addMethod(
  21234. $core.method({
  21235. selector: "visitDagNodeVariantRedux:",
  21236. protocol: "visiting",
  21237. fn: function (aNode){
  21238. var self=this,$self=this;
  21239. var newNode;
  21240. return $core.withContext(function($ctx1) {
  21241. var $1;
  21242. newNode=(
  21243. $ctx1.supercall = true,
  21244. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visitDagNodeVariantRedux_.apply($self, [aNode]));
  21245. $ctx1.supercall = false;
  21246. $1=$recv(aNode).__eq_eq(newNode);
  21247. if(!$core.assert($1)){
  21248. $recv($self.path)._at_put_($recv($self.path)._size(),newNode);
  21249. }
  21250. return newNode;
  21251. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantRedux:",{aNode:aNode,newNode:newNode})});
  21252. },
  21253. args: ["aNode"],
  21254. source: "visitDagNodeVariantRedux: aNode\x0a\x09| newNode |\x0a\x09newNode := super visitDagNodeVariantRedux: aNode.\x0a\x09aNode == newNode ifFalse: [ path at: path size put: newNode ].\x0a\x09^ newNode",
  21255. referencedClasses: [],
  21256. pragmas: [],
  21257. messageSends: ["visitDagNodeVariantRedux:", "ifFalse:", "==", "at:put:", "size"]
  21258. }),
  21259. $globals.PathDagVisitor);
  21260. $core.addClass("DagNode", $globals.Object, [], "Kernel-Dag");
  21261. $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).";
  21262. $core.addMethod(
  21263. $core.method({
  21264. selector: "acceptDagVisitor:",
  21265. protocol: "visiting",
  21266. fn: function (aVisitor){
  21267. var self=this,$self=this;
  21268. return $core.withContext(function($ctx1) {
  21269. return $recv(aVisitor)._visitDagNode_(self);
  21270. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  21271. },
  21272. args: ["aVisitor"],
  21273. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDagNode: self",
  21274. referencedClasses: [],
  21275. pragmas: [],
  21276. messageSends: ["visitDagNode:"]
  21277. }),
  21278. $globals.DagNode);
  21279. $core.addMethod(
  21280. $core.method({
  21281. selector: "allDagChildren",
  21282. protocol: "accessing",
  21283. fn: function (){
  21284. var self=this,$self=this;
  21285. var allNodes;
  21286. return $core.withContext(function($ctx1) {
  21287. var $1;
  21288. $1=$self._dagChildren();
  21289. $ctx1.sendIdx["dagChildren"]=1;
  21290. allNodes=$recv($1)._asSet();
  21291. $recv($self._dagChildren())._do_((function(each){
  21292. return $core.withContext(function($ctx2) {
  21293. return $recv(allNodes)._addAll_($recv(each)._allDagChildren());
  21294. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21295. }));
  21296. return allNodes;
  21297. }, function($ctx1) {$ctx1.fill(self,"allDagChildren",{allNodes:allNodes})});
  21298. },
  21299. args: [],
  21300. 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",
  21301. referencedClasses: [],
  21302. pragmas: [],
  21303. messageSends: ["asSet", "dagChildren", "do:", "addAll:", "allDagChildren"]
  21304. }),
  21305. $globals.DagNode);
  21306. $core.addMethod(
  21307. $core.method({
  21308. selector: "dagChildren",
  21309. protocol: "accessing",
  21310. fn: function (){
  21311. var self=this,$self=this;
  21312. return $core.withContext(function($ctx1) {
  21313. $self._subclassResponsibility();
  21314. return self;
  21315. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{})});
  21316. },
  21317. args: [],
  21318. source: "dagChildren\x0a\x09self subclassResponsibility",
  21319. referencedClasses: [],
  21320. pragmas: [],
  21321. messageSends: ["subclassResponsibility"]
  21322. }),
  21323. $globals.DagNode);
  21324. $core.addMethod(
  21325. $core.method({
  21326. selector: "dagChildren:",
  21327. protocol: "accessing",
  21328. fn: function (aCollection){
  21329. var self=this,$self=this;
  21330. return $core.withContext(function($ctx1) {
  21331. $self._subclassResponsibility();
  21332. return self;
  21333. }, function($ctx1) {$ctx1.fill(self,"dagChildren:",{aCollection:aCollection})});
  21334. },
  21335. args: ["aCollection"],
  21336. source: "dagChildren: aCollection\x0a\x09self subclassResponsibility",
  21337. referencedClasses: [],
  21338. pragmas: [],
  21339. messageSends: ["subclassResponsibility"]
  21340. }),
  21341. $globals.DagNode);
  21342. $core.addMethod(
  21343. $core.method({
  21344. selector: "isDagNode",
  21345. protocol: "testing",
  21346. fn: function (){
  21347. var self=this,$self=this;
  21348. return true;
  21349. },
  21350. args: [],
  21351. source: "isDagNode\x0a\x09^ true",
  21352. referencedClasses: [],
  21353. pragmas: [],
  21354. messageSends: []
  21355. }),
  21356. $globals.DagNode);
  21357. $core.addClass("DagParentNode", $globals.DagNode, ["nodes"], "Kernel-Dag");
  21358. $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.";
  21359. $core.addMethod(
  21360. $core.method({
  21361. selector: "addDagChild:",
  21362. protocol: "accessing",
  21363. fn: function (aDagNode){
  21364. var self=this,$self=this;
  21365. return $core.withContext(function($ctx1) {
  21366. $recv($self._dagChildren())._add_(aDagNode);
  21367. return self;
  21368. }, function($ctx1) {$ctx1.fill(self,"addDagChild:",{aDagNode:aDagNode})});
  21369. },
  21370. args: ["aDagNode"],
  21371. source: "addDagChild: aDagNode\x0a\x09self dagChildren add: aDagNode",
  21372. referencedClasses: [],
  21373. pragmas: [],
  21374. messageSends: ["add:", "dagChildren"]
  21375. }),
  21376. $globals.DagParentNode);
  21377. $core.addMethod(
  21378. $core.method({
  21379. selector: "dagChildren",
  21380. protocol: "accessing",
  21381. fn: function (){
  21382. var self=this,$self=this;
  21383. return $core.withContext(function($ctx1) {
  21384. var $1,$receiver;
  21385. $1=$self.nodes;
  21386. if(($receiver = $1) == null || $receiver.a$nil){
  21387. $self.nodes=$recv($globals.Array)._new();
  21388. return $self.nodes;
  21389. } else {
  21390. return $1;
  21391. }
  21392. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{})});
  21393. },
  21394. args: [],
  21395. source: "dagChildren\x0a\x09^ nodes ifNil: [ nodes := Array new ]",
  21396. referencedClasses: ["Array"],
  21397. pragmas: [],
  21398. messageSends: ["ifNil:", "new"]
  21399. }),
  21400. $globals.DagParentNode);
  21401. $core.addMethod(
  21402. $core.method({
  21403. selector: "dagChildren:",
  21404. protocol: "accessing",
  21405. fn: function (aCollection){
  21406. var self=this,$self=this;
  21407. $self.nodes=aCollection;
  21408. return self;
  21409. },
  21410. args: ["aCollection"],
  21411. source: "dagChildren: aCollection\x0a\x09nodes := aCollection",
  21412. referencedClasses: [],
  21413. pragmas: [],
  21414. messageSends: []
  21415. }),
  21416. $globals.DagParentNode);
  21417. $core.addClass("DagSink", $globals.DagNode, ["nodes"], "Kernel-Dag");
  21418. $globals.DagSink.comment="I am `DagNode` with no direct successors.\x0a\x0aSending `dagChildren:` with empty collection is legal.";
  21419. $core.addMethod(
  21420. $core.method({
  21421. selector: "dagChildren",
  21422. protocol: "accessing",
  21423. fn: function (){
  21424. var self=this,$self=this;
  21425. return [];
  21426. },
  21427. args: [],
  21428. source: "dagChildren\x0a\x09^ #()",
  21429. referencedClasses: [],
  21430. pragmas: [],
  21431. messageSends: []
  21432. }),
  21433. $globals.DagSink);
  21434. $core.addMethod(
  21435. $core.method({
  21436. selector: "dagChildren:",
  21437. protocol: "accessing",
  21438. fn: function (aCollection){
  21439. var self=this,$self=this;
  21440. return $core.withContext(function($ctx1) {
  21441. $recv(aCollection)._ifNotEmpty_((function(){
  21442. return $core.withContext(function($ctx2) {
  21443. return $self._error_("A DagSink cannot have children.");
  21444. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  21445. }));
  21446. return self;
  21447. }, function($ctx1) {$ctx1.fill(self,"dagChildren:",{aCollection:aCollection})});
  21448. },
  21449. args: ["aCollection"],
  21450. source: "dagChildren: aCollection\x0a\x09aCollection ifNotEmpty: [ self error: 'A DagSink cannot have children.' ]",
  21451. referencedClasses: [],
  21452. pragmas: [],
  21453. messageSends: ["ifNotEmpty:", "error:"]
  21454. }),
  21455. $globals.DagSink);
  21456. $core.addMethod(
  21457. $core.method({
  21458. selector: "isDagNode",
  21459. protocol: "*Kernel-Dag",
  21460. fn: function (){
  21461. var self=this,$self=this;
  21462. return false;
  21463. },
  21464. args: [],
  21465. source: "isDagNode\x0a\x09^ false",
  21466. referencedClasses: [],
  21467. pragmas: [],
  21468. messageSends: []
  21469. }),
  21470. $globals.Object);
  21471. });
  21472. define('amber/core/Kernel-Exceptions',["amber/boot", "require", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  21473. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  21474. var $pkg = $core.addPackage("Kernel-Exceptions");
  21475. $pkg.innerEval = function (expr) { return eval(expr); };
  21476. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  21477. $core.addClass("Error", $globals.Object, ["message", "stack", "amberHandled", "context", "smalltalkError"], "Kernel-Exceptions");
  21478. $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.";
  21479. $core.addMethod(
  21480. $core.method({
  21481. selector: "basicSignal",
  21482. protocol: "private",
  21483. fn: function (){
  21484. var self=this,$self=this;
  21485. return $core.withContext(function($ctx1) {
  21486. throw self;;
  21487. return self;
  21488. }, function($ctx1) {$ctx1.fill(self,"basicSignal",{})});
  21489. },
  21490. args: [],
  21491. source: "basicSignal\x0a\x09<inlineJS: 'throw self;'>",
  21492. referencedClasses: [],
  21493. pragmas: [["inlineJS:", ["throw self;"]]],
  21494. messageSends: []
  21495. }),
  21496. $globals.Error);
  21497. $core.addMethod(
  21498. $core.method({
  21499. selector: "beHandled",
  21500. protocol: "accessing",
  21501. fn: function (){
  21502. var self=this,$self=this;
  21503. $self.amberHandled=true;
  21504. return self;
  21505. },
  21506. args: [],
  21507. source: "beHandled\x0a\x09amberHandled := true",
  21508. referencedClasses: [],
  21509. pragmas: [],
  21510. messageSends: []
  21511. }),
  21512. $globals.Error);
  21513. $core.addMethod(
  21514. $core.method({
  21515. selector: "beSmalltalkError",
  21516. protocol: "accessing",
  21517. fn: function (){
  21518. var self=this,$self=this;
  21519. $self.smalltalkError=true;
  21520. return self;
  21521. },
  21522. args: [],
  21523. source: "beSmalltalkError\x0a\x09smalltalkError := true",
  21524. referencedClasses: [],
  21525. pragmas: [],
  21526. messageSends: []
  21527. }),
  21528. $globals.Error);
  21529. $core.addMethod(
  21530. $core.method({
  21531. selector: "beUnhandled",
  21532. protocol: "accessing",
  21533. fn: function (){
  21534. var self=this,$self=this;
  21535. $self.amberHandled=false;
  21536. return self;
  21537. },
  21538. args: [],
  21539. source: "beUnhandled\x0a\x09amberHandled := false",
  21540. referencedClasses: [],
  21541. pragmas: [],
  21542. messageSends: []
  21543. }),
  21544. $globals.Error);
  21545. $core.addMethod(
  21546. $core.method({
  21547. selector: "context",
  21548. protocol: "accessing",
  21549. fn: function (){
  21550. var self=this,$self=this;
  21551. return $self.context;
  21552. },
  21553. args: [],
  21554. source: "context\x0a\x09^ context",
  21555. referencedClasses: [],
  21556. pragmas: [],
  21557. messageSends: []
  21558. }),
  21559. $globals.Error);
  21560. $core.addMethod(
  21561. $core.method({
  21562. selector: "context:",
  21563. protocol: "accessing",
  21564. fn: function (aMethodContext){
  21565. var self=this,$self=this;
  21566. $self.context=aMethodContext;
  21567. return self;
  21568. },
  21569. args: ["aMethodContext"],
  21570. source: "context: aMethodContext\x0a\x09context := aMethodContext",
  21571. referencedClasses: [],
  21572. pragmas: [],
  21573. messageSends: []
  21574. }),
  21575. $globals.Error);
  21576. $core.addMethod(
  21577. $core.method({
  21578. selector: "initialize",
  21579. protocol: "initialization",
  21580. fn: function (){
  21581. var self=this,$self=this;
  21582. return $core.withContext(function($ctx1) {
  21583. $self._messageText_("Errorclass: ".__comma($recv($self._class())._name()));
  21584. return self;
  21585. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  21586. },
  21587. args: [],
  21588. source: "initialize\x0a\x09self messageText: 'Errorclass: ', (self class name).",
  21589. referencedClasses: [],
  21590. pragmas: [],
  21591. messageSends: ["messageText:", ",", "name", "class"]
  21592. }),
  21593. $globals.Error);
  21594. $core.addMethod(
  21595. $core.method({
  21596. selector: "isSmalltalkError",
  21597. protocol: "testing",
  21598. fn: function (){
  21599. var self=this,$self=this;
  21600. return $core.withContext(function($ctx1) {
  21601. return $recv($self.smalltalkError).__eq_eq(true);
  21602. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkError",{})});
  21603. },
  21604. args: [],
  21605. source: "isSmalltalkError\x0a\x09^ smalltalkError == true",
  21606. referencedClasses: [],
  21607. pragmas: [],
  21608. messageSends: ["=="]
  21609. }),
  21610. $globals.Error);
  21611. $core.addMethod(
  21612. $core.method({
  21613. selector: "jsStack",
  21614. protocol: "accessing",
  21615. fn: function (){
  21616. var self=this,$self=this;
  21617. return $self.stack;
  21618. },
  21619. args: [],
  21620. source: "jsStack\x0a\x09^ stack",
  21621. referencedClasses: [],
  21622. pragmas: [],
  21623. messageSends: []
  21624. }),
  21625. $globals.Error);
  21626. $core.addMethod(
  21627. $core.method({
  21628. selector: "messageText",
  21629. protocol: "accessing",
  21630. fn: function (){
  21631. var self=this,$self=this;
  21632. return $self.message;
  21633. },
  21634. args: [],
  21635. source: "messageText\x0a\x09^ message",
  21636. referencedClasses: [],
  21637. pragmas: [],
  21638. messageSends: []
  21639. }),
  21640. $globals.Error);
  21641. $core.addMethod(
  21642. $core.method({
  21643. selector: "messageText:",
  21644. protocol: "accessing",
  21645. fn: function (aString){
  21646. var self=this,$self=this;
  21647. $self.message=aString;
  21648. return self;
  21649. },
  21650. args: ["aString"],
  21651. source: "messageText: aString\x0a\x09message := aString",
  21652. referencedClasses: [],
  21653. pragmas: [],
  21654. messageSends: []
  21655. }),
  21656. $globals.Error);
  21657. $core.addMethod(
  21658. $core.method({
  21659. selector: "outer",
  21660. protocol: "signaling",
  21661. fn: function (){
  21662. var self=this,$self=this;
  21663. return $core.withContext(function($ctx1) {
  21664. return $self._pass();
  21665. }, function($ctx1) {$ctx1.fill(self,"outer",{})});
  21666. },
  21667. args: [],
  21668. source: "outer\x0a\x09\x22Pharo compatibility. Just sends #pass.\x22\x0a\x09\x0a\x09^ self pass",
  21669. referencedClasses: [],
  21670. pragmas: [],
  21671. messageSends: ["pass"]
  21672. }),
  21673. $globals.Error);
  21674. $core.addMethod(
  21675. $core.method({
  21676. selector: "pass",
  21677. protocol: "signaling",
  21678. fn: function (){
  21679. var self=this,$self=this;
  21680. return $core.withContext(function($ctx1) {
  21681. $self._beUnhandled();
  21682. $self._basicSignal();
  21683. return self;
  21684. }, function($ctx1) {$ctx1.fill(self,"pass",{})});
  21685. },
  21686. args: [],
  21687. source: "pass\x0a\x09\x22Let outer handler take care of this.\x22\x0a\x0a\x09self beUnhandled; basicSignal",
  21688. referencedClasses: [],
  21689. pragmas: [],
  21690. messageSends: ["beUnhandled", "basicSignal"]
  21691. }),
  21692. $globals.Error);
  21693. $core.addMethod(
  21694. $core.method({
  21695. selector: "resignal",
  21696. protocol: "signaling",
  21697. fn: function (){
  21698. var self=this,$self=this;
  21699. return $core.withContext(function($ctx1) {
  21700. $self._deprecatedAPI_("Use #pass.");
  21701. return $self._pass();
  21702. }, function($ctx1) {$ctx1.fill(self,"resignal",{})});
  21703. },
  21704. args: [],
  21705. source: "resignal\x0a\x09self deprecatedAPI: 'Use #pass.'.\x0a\x09^ self pass",
  21706. referencedClasses: [],
  21707. pragmas: [],
  21708. messageSends: ["deprecatedAPI:", "pass"]
  21709. }),
  21710. $globals.Error);
  21711. $core.addMethod(
  21712. $core.method({
  21713. selector: "signal",
  21714. protocol: "signaling",
  21715. fn: function (){
  21716. var self=this,$self=this;
  21717. return $core.withContext(function($ctx1) {
  21718. $self._beUnhandled();
  21719. $self._context_($core.getThisContext());
  21720. $self._beSmalltalkError();
  21721. $self._basicSignal();
  21722. return self;
  21723. }, function($ctx1) {$ctx1.fill(self,"signal",{})});
  21724. },
  21725. args: [],
  21726. source: "signal\x0a\x09self beUnhandled; context: thisContext; beSmalltalkError; basicSignal",
  21727. referencedClasses: [],
  21728. pragmas: [],
  21729. messageSends: ["beUnhandled", "context:", "beSmalltalkError", "basicSignal"]
  21730. }),
  21731. $globals.Error);
  21732. $core.addMethod(
  21733. $core.method({
  21734. selector: "signal:",
  21735. protocol: "signaling",
  21736. fn: function (aString){
  21737. var self=this,$self=this;
  21738. return $core.withContext(function($ctx1) {
  21739. $self._messageText_(aString);
  21740. $self._signal();
  21741. return self;
  21742. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString})});
  21743. },
  21744. args: ["aString"],
  21745. source: "signal: aString\x0a\x09self messageText: aString; signal",
  21746. referencedClasses: [],
  21747. pragmas: [],
  21748. messageSends: ["messageText:", "signal"]
  21749. }),
  21750. $globals.Error);
  21751. $core.addMethod(
  21752. $core.method({
  21753. selector: "signalerContext",
  21754. protocol: "accessing",
  21755. fn: function (){
  21756. var self=this,$self=this;
  21757. return $core.withContext(function($ctx1) {
  21758. return $self._signalerContextFrom_($self._context());
  21759. }, function($ctx1) {$ctx1.fill(self,"signalerContext",{})});
  21760. },
  21761. args: [],
  21762. source: "signalerContext\x0a\x09^ self signalerContextFrom: self context",
  21763. referencedClasses: [],
  21764. pragmas: [],
  21765. messageSends: ["signalerContextFrom:", "context"]
  21766. }),
  21767. $globals.Error);
  21768. $core.addMethod(
  21769. $core.method({
  21770. selector: "signalerContextFrom:",
  21771. protocol: "accessing",
  21772. fn: function (aContext){
  21773. var self=this,$self=this;
  21774. return $core.withContext(function($ctx1) {
  21775. var $3,$2,$1;
  21776. return $recv(aContext)._findContextSuchThat_((function(one){
  21777. return $core.withContext(function($ctx2) {
  21778. $3=$recv(one)._receiver();
  21779. $ctx2.sendIdx["receiver"]=1;
  21780. $2=$recv($3).__eq_eq(self);
  21781. $ctx2.sendIdx["=="]=1;
  21782. $1=$recv($2)._or_((function(){
  21783. return $core.withContext(function($ctx3) {
  21784. return $recv($recv(one)._receiver()).__eq_eq($self._class());
  21785. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  21786. }));
  21787. return $recv($1)._not();
  21788. }, function($ctx2) {$ctx2.fillBlock({one:one},$ctx1,1)});
  21789. }));
  21790. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext})});
  21791. },
  21792. args: ["aContext"],
  21793. 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 ]",
  21794. referencedClasses: [],
  21795. pragmas: [],
  21796. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class"]
  21797. }),
  21798. $globals.Error);
  21799. $core.addMethod(
  21800. $core.method({
  21801. selector: "wasHandled",
  21802. protocol: "testing",
  21803. fn: function (){
  21804. var self=this,$self=this;
  21805. return $core.withContext(function($ctx1) {
  21806. return $recv($self.amberHandled).__eq_eq(true);
  21807. }, function($ctx1) {$ctx1.fill(self,"wasHandled",{})});
  21808. },
  21809. args: [],
  21810. source: "wasHandled\x0a\x09^ amberHandled == true",
  21811. referencedClasses: [],
  21812. pragmas: [],
  21813. messageSends: ["=="]
  21814. }),
  21815. $globals.Error);
  21816. $core.addMethod(
  21817. $core.method({
  21818. selector: "classTag",
  21819. protocol: "accessing",
  21820. fn: function (){
  21821. var self=this,$self=this;
  21822. return "exception";
  21823. },
  21824. args: [],
  21825. 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'",
  21826. referencedClasses: [],
  21827. pragmas: [],
  21828. messageSends: []
  21829. }),
  21830. $globals.Error.a$cls);
  21831. $core.addMethod(
  21832. $core.method({
  21833. selector: "signal",
  21834. protocol: "instance creation",
  21835. fn: function (){
  21836. var self=this,$self=this;
  21837. return $core.withContext(function($ctx1) {
  21838. return $recv($self._new())._signal();
  21839. }, function($ctx1) {$ctx1.fill(self,"signal",{})});
  21840. },
  21841. args: [],
  21842. source: "signal\x0a\x09^ self new signal",
  21843. referencedClasses: [],
  21844. pragmas: [],
  21845. messageSends: ["signal", "new"]
  21846. }),
  21847. $globals.Error.a$cls);
  21848. $core.addMethod(
  21849. $core.method({
  21850. selector: "signal:",
  21851. protocol: "instance creation",
  21852. fn: function (aString){
  21853. var self=this,$self=this;
  21854. return $core.withContext(function($ctx1) {
  21855. return $recv($self._new())._signal_(aString);
  21856. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString})});
  21857. },
  21858. args: ["aString"],
  21859. source: "signal: aString\x0a\x09^ self new\x0a\x09\x09signal: aString",
  21860. referencedClasses: [],
  21861. pragmas: [],
  21862. messageSends: ["signal:", "new"]
  21863. }),
  21864. $globals.Error.a$cls);
  21865. $core.addClass("Halt", $globals.Error, [], "Kernel-Exceptions");
  21866. $globals.Halt.comment="I am provided to support `Object>>#halt`.";
  21867. $core.addMethod(
  21868. $core.method({
  21869. selector: "messageText",
  21870. protocol: "accessing",
  21871. fn: function (){
  21872. var self=this,$self=this;
  21873. return "Halt encountered";
  21874. },
  21875. args: [],
  21876. source: "messageText\x0a\x09^ 'Halt encountered'",
  21877. referencedClasses: [],
  21878. pragmas: [],
  21879. messageSends: []
  21880. }),
  21881. $globals.Halt);
  21882. $core.addMethod(
  21883. $core.method({
  21884. selector: "signalerContextFrom:",
  21885. protocol: "accessing",
  21886. fn: function (aContext){
  21887. var self=this,$self=this;
  21888. return $core.withContext(function($ctx1) {
  21889. var $3,$2,$1;
  21890. return $recv(aContext)._findContextSuchThat_((function(one){
  21891. return $core.withContext(function($ctx2) {
  21892. $3=$recv(one)._receiver();
  21893. $ctx2.sendIdx["receiver"]=1;
  21894. $2=$recv($3).__eq_eq(self);
  21895. $ctx2.sendIdx["=="]=1;
  21896. $1=$recv($2)._or_((function(){
  21897. return $core.withContext(function($ctx3) {
  21898. return $recv($recv($recv(one)._receiver()).__eq_eq($self._class()))._or_((function(){
  21899. return $core.withContext(function($ctx4) {
  21900. return $recv($recv($recv(one)._method())._selector()).__eq("halt");
  21901. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  21902. }));
  21903. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  21904. }));
  21905. $ctx2.sendIdx["or:"]=1;
  21906. return $recv($1)._not();
  21907. }, function($ctx2) {$ctx2.fillBlock({one:one},$ctx1,1)});
  21908. }));
  21909. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext})});
  21910. },
  21911. args: ["aContext"],
  21912. 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 ]",
  21913. referencedClasses: [],
  21914. pragmas: [],
  21915. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class", "=", "selector", "method"]
  21916. }),
  21917. $globals.Halt);
  21918. $core.addClass("JavaScriptException", $globals.Error, ["exception"], "Kernel-Exceptions");
  21919. $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:`";
  21920. $core.addMethod(
  21921. $core.method({
  21922. selector: "exception",
  21923. protocol: "accessing",
  21924. fn: function (){
  21925. var self=this,$self=this;
  21926. return $self.exception;
  21927. },
  21928. args: [],
  21929. source: "exception\x0a\x09^ exception",
  21930. referencedClasses: [],
  21931. pragmas: [],
  21932. messageSends: []
  21933. }),
  21934. $globals.JavaScriptException);
  21935. $core.addMethod(
  21936. $core.method({
  21937. selector: "exception:",
  21938. protocol: "accessing",
  21939. fn: function (anException){
  21940. var self=this,$self=this;
  21941. $self.exception=anException;
  21942. return self;
  21943. },
  21944. args: ["anException"],
  21945. source: "exception: anException\x0a\x09exception := anException",
  21946. referencedClasses: [],
  21947. pragmas: [],
  21948. messageSends: []
  21949. }),
  21950. $globals.JavaScriptException);
  21951. $core.addMethod(
  21952. $core.method({
  21953. selector: "messageText",
  21954. protocol: "accessing",
  21955. fn: function (){
  21956. var self=this,$self=this;
  21957. return $core.withContext(function($ctx1) {
  21958. return "JavaScript exception: " + $self.exception.toString();
  21959. return self;
  21960. }, function($ctx1) {$ctx1.fill(self,"messageText",{})});
  21961. },
  21962. args: [],
  21963. source: "messageText\x0a\x09<inlineJS: 'return \x22JavaScript exception: \x22 + $self.exception.toString()'>",
  21964. referencedClasses: [],
  21965. pragmas: [["inlineJS:", ["return \x22JavaScript exception: \x22 + $self.exception.toString()"]]],
  21966. messageSends: []
  21967. }),
  21968. $globals.JavaScriptException);
  21969. $core.addMethod(
  21970. $core.method({
  21971. selector: "shouldBeStubbed",
  21972. protocol: "testing",
  21973. fn: function (){
  21974. var self=this,$self=this;
  21975. return $core.withContext(function($ctx1) {
  21976. return $self.exception instanceof RangeError;
  21977. return self;
  21978. }, function($ctx1) {$ctx1.fill(self,"shouldBeStubbed",{})});
  21979. },
  21980. args: [],
  21981. source: "shouldBeStubbed\x0a\x09<inlineJS: 'return $self.exception instanceof RangeError'>",
  21982. referencedClasses: [],
  21983. pragmas: [["inlineJS:", ["return $self.exception instanceof RangeError"]]],
  21984. messageSends: []
  21985. }),
  21986. $globals.JavaScriptException);
  21987. $core.addMethod(
  21988. $core.method({
  21989. selector: "wrap",
  21990. protocol: "error handling",
  21991. fn: function (){
  21992. var self=this,$self=this;
  21993. return $core.withContext(function($ctx1) {
  21994. var $1;
  21995. $recv((function(){
  21996. return $core.withContext(function($ctx2) {
  21997. return $self._signal();
  21998. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  21999. }))._tryCatch_((function(){
  22000. return $core.withContext(function($ctx2) {
  22001. $1=$self._shouldBeStubbed();
  22002. if($core.assert($1)){
  22003. return $recv($self._context())._stubToAtMost_((100));
  22004. }
  22005. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  22006. }));
  22007. return self;
  22008. }, function($ctx1) {$ctx1.fill(self,"wrap",{})});
  22009. },
  22010. args: [],
  22011. source: "wrap\x0a\x09[ self signal ] tryCatch:\x0a\x09\x09[ self shouldBeStubbed ifTrue: [ self context stubToAtMost: 100 ] ]",
  22012. referencedClasses: [],
  22013. pragmas: [],
  22014. messageSends: ["tryCatch:", "signal", "ifTrue:", "shouldBeStubbed", "stubToAtMost:", "context"]
  22015. }),
  22016. $globals.JavaScriptException);
  22017. $core.addMethod(
  22018. $core.method({
  22019. selector: "on:",
  22020. protocol: "instance creation",
  22021. fn: function (anException){
  22022. var self=this,$self=this;
  22023. return $core.withContext(function($ctx1) {
  22024. var $1;
  22025. $1=$self._new();
  22026. $recv($1)._exception_(anException);
  22027. return $recv($1)._yourself();
  22028. }, function($ctx1) {$ctx1.fill(self,"on:",{anException:anException})});
  22029. },
  22030. args: ["anException"],
  22031. source: "on: anException\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09yourself",
  22032. referencedClasses: [],
  22033. pragmas: [],
  22034. messageSends: ["exception:", "new", "yourself"]
  22035. }),
  22036. $globals.JavaScriptException.a$cls);
  22037. $core.addMethod(
  22038. $core.method({
  22039. selector: "on:context:",
  22040. protocol: "instance creation",
  22041. fn: function (anException,aMethodContext){
  22042. var self=this,$self=this;
  22043. return $core.withContext(function($ctx1) {
  22044. var $1;
  22045. $1=$self._new();
  22046. $recv($1)._exception_(anException);
  22047. $recv($1)._context_(aMethodContext);
  22048. return $recv($1)._yourself();
  22049. }, function($ctx1) {$ctx1.fill(self,"on:context:",{anException:anException,aMethodContext:aMethodContext})});
  22050. },
  22051. args: ["anException", "aMethodContext"],
  22052. source: "on: anException context: aMethodContext\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09context: aMethodContext;\x0a\x09\x09yourself",
  22053. referencedClasses: [],
  22054. pragmas: [],
  22055. messageSends: ["exception:", "new", "context:", "yourself"]
  22056. }),
  22057. $globals.JavaScriptException.a$cls);
  22058. $core.addClass("MessageNotUnderstood", $globals.Error, ["smalltalkMessage", "receiver"], "Kernel-Exceptions");
  22059. $globals.MessageNotUnderstood.comment="This exception is provided to support `Object>>doesNotUnderstand:`.";
  22060. $core.addMethod(
  22061. $core.method({
  22062. selector: "message",
  22063. protocol: "accessing",
  22064. fn: function (){
  22065. var self=this,$self=this;
  22066. return $self.smalltalkMessage;
  22067. },
  22068. args: [],
  22069. source: "message\x0a\x09^ smalltalkMessage",
  22070. referencedClasses: [],
  22071. pragmas: [],
  22072. messageSends: []
  22073. }),
  22074. $globals.MessageNotUnderstood);
  22075. $core.addMethod(
  22076. $core.method({
  22077. selector: "message:",
  22078. protocol: "accessing",
  22079. fn: function (aMessage){
  22080. var self=this,$self=this;
  22081. $self.smalltalkMessage=aMessage;
  22082. return self;
  22083. },
  22084. args: ["aMessage"],
  22085. source: "message: aMessage\x0a\x09smalltalkMessage := aMessage",
  22086. referencedClasses: [],
  22087. pragmas: [],
  22088. messageSends: []
  22089. }),
  22090. $globals.MessageNotUnderstood);
  22091. $core.addMethod(
  22092. $core.method({
  22093. selector: "messageText",
  22094. protocol: "accessing",
  22095. fn: function (){
  22096. var self=this,$self=this;
  22097. return $core.withContext(function($ctx1) {
  22098. var $1;
  22099. $1=$recv($recv($recv($self._receiver())._asString()).__comma(" does not understand #")).__comma($recv($self._message())._selector());
  22100. $ctx1.sendIdx[","]=1;
  22101. return $1;
  22102. }, function($ctx1) {$ctx1.fill(self,"messageText",{})});
  22103. },
  22104. args: [],
  22105. source: "messageText\x0a\x09^ self receiver asString, ' does not understand #', self message selector",
  22106. referencedClasses: [],
  22107. pragmas: [],
  22108. messageSends: [",", "asString", "receiver", "selector", "message"]
  22109. }),
  22110. $globals.MessageNotUnderstood);
  22111. $core.addMethod(
  22112. $core.method({
  22113. selector: "receiver",
  22114. protocol: "accessing",
  22115. fn: function (){
  22116. var self=this,$self=this;
  22117. return $self.receiver;
  22118. },
  22119. args: [],
  22120. source: "receiver\x0a\x09^ receiver",
  22121. referencedClasses: [],
  22122. pragmas: [],
  22123. messageSends: []
  22124. }),
  22125. $globals.MessageNotUnderstood);
  22126. $core.addMethod(
  22127. $core.method({
  22128. selector: "receiver:",
  22129. protocol: "accessing",
  22130. fn: function (anObject){
  22131. var self=this,$self=this;
  22132. $self.receiver=anObject;
  22133. return self;
  22134. },
  22135. args: ["anObject"],
  22136. source: "receiver: anObject\x0a\x09receiver := anObject",
  22137. referencedClasses: [],
  22138. pragmas: [],
  22139. messageSends: []
  22140. }),
  22141. $globals.MessageNotUnderstood);
  22142. $core.addClass("NonBooleanReceiver", $globals.Error, ["object"], "Kernel-Exceptions");
  22143. $globals.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver.";
  22144. $core.addMethod(
  22145. $core.method({
  22146. selector: "object",
  22147. protocol: "accessing",
  22148. fn: function (){
  22149. var self=this,$self=this;
  22150. return $self.object;
  22151. },
  22152. args: [],
  22153. source: "object\x0a\x09^ object",
  22154. referencedClasses: [],
  22155. pragmas: [],
  22156. messageSends: []
  22157. }),
  22158. $globals.NonBooleanReceiver);
  22159. $core.addMethod(
  22160. $core.method({
  22161. selector: "object:",
  22162. protocol: "accessing",
  22163. fn: function (anObject){
  22164. var self=this,$self=this;
  22165. $self.object=anObject;
  22166. return self;
  22167. },
  22168. args: ["anObject"],
  22169. source: "object: anObject\x0a\x09object := anObject",
  22170. referencedClasses: [],
  22171. pragmas: [],
  22172. messageSends: []
  22173. }),
  22174. $globals.NonBooleanReceiver);
  22175. $core.addMethod(
  22176. $core.method({
  22177. selector: "signalOn:",
  22178. protocol: "instance creation",
  22179. fn: function (anObject){
  22180. var self=this,$self=this;
  22181. return $core.withContext(function($ctx1) {
  22182. var $1;
  22183. $1=$self._new();
  22184. $recv($1)._object_(anObject);
  22185. return $recv($1)._signal();
  22186. }, function($ctx1) {$ctx1.fill(self,"signalOn:",{anObject:anObject})});
  22187. },
  22188. args: ["anObject"],
  22189. source: "signalOn: anObject\x0a\x09^ self new\x0a\x09\x09object: anObject;\x0a\x09\x09signal",
  22190. referencedClasses: [],
  22191. pragmas: [],
  22192. messageSends: ["object:", "new", "signal"]
  22193. }),
  22194. $globals.NonBooleanReceiver.a$cls);
  22195. });
  22196. define('amber/core/Kernel-Promises',["amber/boot", "require", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  22197. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  22198. var $pkg = $core.addPackage("Kernel-Promises");
  22199. $pkg.innerEval = function (expr) { return eval(expr); };
  22200. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  22201. $core.addClass("Promise", $globals.Object, [], "Kernel-Promises");
  22202. $core.addMethod(
  22203. $core.method({
  22204. selector: "all:",
  22205. protocol: "composites",
  22206. fn: function (aCollection){
  22207. var self=this,$self=this;
  22208. return $core.withContext(function($ctx1) {
  22209. return Promise.all($recv(aCollection)._asArray());
  22210. return self;
  22211. }, function($ctx1) {$ctx1.fill(self,"all:",{aCollection:aCollection})});
  22212. },
  22213. args: ["aCollection"],
  22214. source: "all: aCollection\x0a\x22Returns a Promise resolved with results of sub-promises.\x22\x0a<inlineJS: 'return Promise.all($recv(aCollection)._asArray())'>",
  22215. referencedClasses: [],
  22216. pragmas: [["inlineJS:", ["return Promise.all($recv(aCollection)._asArray())"]]],
  22217. messageSends: []
  22218. }),
  22219. $globals.Promise.a$cls);
  22220. $core.addMethod(
  22221. $core.method({
  22222. selector: "any:",
  22223. protocol: "composites",
  22224. fn: function (aCollection){
  22225. var self=this,$self=this;
  22226. return $core.withContext(function($ctx1) {
  22227. return Promise.race($recv(aCollection)._asArray());
  22228. return self;
  22229. }, function($ctx1) {$ctx1.fill(self,"any:",{aCollection:aCollection})});
  22230. },
  22231. args: ["aCollection"],
  22232. source: "any: aCollection\x0a\x22Returns a Promise resolved with first result of sub-promises.\x22\x0a<inlineJS: 'return Promise.race($recv(aCollection)._asArray())'>",
  22233. referencedClasses: [],
  22234. pragmas: [["inlineJS:", ["return Promise.race($recv(aCollection)._asArray())"]]],
  22235. messageSends: []
  22236. }),
  22237. $globals.Promise.a$cls);
  22238. $core.addMethod(
  22239. $core.method({
  22240. selector: "forBlock:",
  22241. protocol: "instance creation",
  22242. fn: function (aBlock){
  22243. var self=this,$self=this;
  22244. return $core.withContext(function($ctx1) {
  22245. return $recv($self._new())._then_(aBlock);
  22246. }, function($ctx1) {$ctx1.fill(self,"forBlock:",{aBlock:aBlock})});
  22247. },
  22248. args: ["aBlock"],
  22249. 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",
  22250. referencedClasses: [],
  22251. pragmas: [],
  22252. messageSends: ["then:", "new"]
  22253. }),
  22254. $globals.Promise.a$cls);
  22255. $core.addMethod(
  22256. $core.method({
  22257. selector: "new",
  22258. protocol: "instance creation",
  22259. fn: function (){
  22260. var self=this,$self=this;
  22261. return $core.withContext(function($ctx1) {
  22262. return Promise.resolve();
  22263. return self;
  22264. }, function($ctx1) {$ctx1.fill(self,"new",{})});
  22265. },
  22266. args: [],
  22267. source: "new\x0a\x22Returns a dumb Promise resolved with nil.\x22\x0a<inlineJS: 'return Promise.resolve()'>",
  22268. referencedClasses: [],
  22269. pragmas: [["inlineJS:", ["return Promise.resolve()"]]],
  22270. messageSends: []
  22271. }),
  22272. $globals.Promise.a$cls);
  22273. $core.addMethod(
  22274. $core.method({
  22275. selector: "new:",
  22276. protocol: "instance creation",
  22277. fn: function (aBlock){
  22278. var self=this,$self=this;
  22279. return $core.withContext(function($ctx1) {
  22280. return new Promise(function (resolve, reject) {
  22281. var model = {value: resolve, signal: reject};
  22282. aBlock._value_(model);
  22283. });
  22284. return self;
  22285. }, function($ctx1) {$ctx1.fill(self,"new:",{aBlock:aBlock})});
  22286. },
  22287. args: ["aBlock"],
  22288. 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})'>",
  22289. referencedClasses: [],
  22290. pragmas: [["inlineJS:", ["return new Promise(function (resolve, reject) {\x0a var model = {value: resolve, signal: reject};\x0a aBlock._value_(model);\x0a})"]]],
  22291. messageSends: []
  22292. }),
  22293. $globals.Promise.a$cls);
  22294. $core.addMethod(
  22295. $core.method({
  22296. selector: "signal:",
  22297. protocol: "instance creation",
  22298. fn: function (anObject){
  22299. var self=this,$self=this;
  22300. return $core.withContext(function($ctx1) {
  22301. return $recv(anObject)._in_(function (x) {return Promise.reject(x)});
  22302. return self;
  22303. }, function($ctx1) {$ctx1.fill(self,"signal:",{anObject:anObject})});
  22304. },
  22305. args: ["anObject"],
  22306. source: "signal: anObject\x0a\x22Returns a Promise rejected with anObject.\x22\x0a<inlineJS: 'return $recv(anObject)._in_(function (x) {return Promise.reject(x)})'>",
  22307. referencedClasses: [],
  22308. pragmas: [["inlineJS:", ["return $recv(anObject)._in_(function (x) {return Promise.reject(x)})"]]],
  22309. messageSends: []
  22310. }),
  22311. $globals.Promise.a$cls);
  22312. $core.addMethod(
  22313. $core.method({
  22314. selector: "value:",
  22315. protocol: "instance creation",
  22316. fn: function (anObject){
  22317. var self=this,$self=this;
  22318. return $core.withContext(function($ctx1) {
  22319. return $recv(anObject)._in_(function (x) {return Promise.resolve(x)});
  22320. return self;
  22321. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject})});
  22322. },
  22323. args: ["anObject"],
  22324. source: "value: anObject\x0a\x22Returns a Promise resolved with anObject.\x22\x0a<inlineJS: 'return $recv(anObject)._in_(function (x) {return Promise.resolve(x)})'>",
  22325. referencedClasses: [],
  22326. pragmas: [["inlineJS:", ["return $recv(anObject)._in_(function (x) {return Promise.resolve(x)})"]]],
  22327. messageSends: []
  22328. }),
  22329. $globals.Promise.a$cls);
  22330. $core.addTrait("TThenable", "Kernel-Promises");
  22331. $core.addMethod(
  22332. $core.method({
  22333. selector: "catch:",
  22334. protocol: "promises",
  22335. fn: function (aBlock){
  22336. var self=this,$self=this;
  22337. return $core.withContext(function($ctx1) {
  22338. return self.then(null, function (err) {return $core.seamless(function () {
  22339. return aBlock._value_(err);
  22340. })});
  22341. return self;
  22342. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock})});
  22343. },
  22344. args: ["aBlock"],
  22345. source: "catch: aBlock\x0a<inlineJS: 'return self.then(null, function (err) {return $core.seamless(function () {\x0a return aBlock._value_(err);\x0a})})'>",
  22346. referencedClasses: [],
  22347. pragmas: [["inlineJS:", ["return self.then(null, function (err) {return $core.seamless(function () {\x0a return aBlock._value_(err);\x0a})})"]]],
  22348. messageSends: []
  22349. }),
  22350. $globals.TThenable);
  22351. $core.addMethod(
  22352. $core.method({
  22353. selector: "on:do:",
  22354. protocol: "promises",
  22355. fn: function (aClass,aBlock){
  22356. var self=this,$self=this;
  22357. return $core.withContext(function($ctx1) {
  22358. return self.then(null, function (err) {return $core.seamless(function () {
  22359. if (err._isKindOf_(aClass)) return aBlock._value_(err);
  22360. else throw err;
  22361. })});
  22362. return self;
  22363. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock})});
  22364. },
  22365. args: ["aClass", "aBlock"],
  22366. 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})})'>",
  22367. referencedClasses: [],
  22368. 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})})"]]],
  22369. messageSends: []
  22370. }),
  22371. $globals.TThenable);
  22372. $core.addMethod(
  22373. $core.method({
  22374. selector: "on:do:catch:",
  22375. protocol: "promises",
  22376. fn: function (aClass,aBlock,anotherBlock){
  22377. var self=this,$self=this;
  22378. return $core.withContext(function($ctx1) {
  22379. return $recv($self._on_do_(aClass,aBlock))._catch_(anotherBlock);
  22380. }, function($ctx1) {$ctx1.fill(self,"on:do:catch:",{aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock})});
  22381. },
  22382. args: ["aClass", "aBlock", "anotherBlock"],
  22383. source: "on: aClass do: aBlock catch: anotherBlock\x0a\x09^ (self on: aClass do: aBlock) catch: anotherBlock",
  22384. referencedClasses: [],
  22385. pragmas: [],
  22386. messageSends: ["catch:", "on:do:"]
  22387. }),
  22388. $globals.TThenable);
  22389. $core.addMethod(
  22390. $core.method({
  22391. selector: "then:",
  22392. protocol: "promises",
  22393. fn: function (aBlockOrArray){
  22394. var self=this,$self=this;
  22395. return $core.withContext(function($ctx1) {
  22396. var array = Array.isArray(aBlockOrArray) ? aBlockOrArray : [aBlockOrArray];
  22397. return array.reduce(function (soFar, aBlock) {
  22398. return soFar.then(typeof aBlock === "function" && aBlock.length > 1 ?
  22399. function (result) {return $core.seamless(function () {
  22400. if (Array.isArray(result)) {
  22401. return aBlock._valueWithPossibleArguments_([result].concat(result.slice(0, aBlock.length-1)));
  22402. } else {
  22403. return aBlock._value_(result);
  22404. }
  22405. })} :
  22406. function (result) {return $core.seamless(function () {
  22407. return aBlock._value_(result);
  22408. })}
  22409. );
  22410. }, self);
  22411. return self;
  22412. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray})});
  22413. },
  22414. args: ["aBlockOrArray"],
  22415. 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)'>",
  22416. referencedClasses: [],
  22417. 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)"]]],
  22418. messageSends: []
  22419. }),
  22420. $globals.TThenable);
  22421. $core.addMethod(
  22422. $core.method({
  22423. selector: "then:catch:",
  22424. protocol: "promises",
  22425. fn: function (aBlockOrArray,anotherBlock){
  22426. var self=this,$self=this;
  22427. return $core.withContext(function($ctx1) {
  22428. return $recv($self._then_(aBlockOrArray))._catch_(anotherBlock);
  22429. }, function($ctx1) {$ctx1.fill(self,"then:catch:",{aBlockOrArray:aBlockOrArray,anotherBlock:anotherBlock})});
  22430. },
  22431. args: ["aBlockOrArray", "anotherBlock"],
  22432. source: "then: aBlockOrArray catch: anotherBlock\x0a\x09^ (self then: aBlockOrArray) catch: anotherBlock",
  22433. referencedClasses: [],
  22434. pragmas: [],
  22435. messageSends: ["catch:", "then:"]
  22436. }),
  22437. $globals.TThenable);
  22438. $core.addMethod(
  22439. $core.method({
  22440. selector: "then:on:do:",
  22441. protocol: "promises",
  22442. fn: function (aBlockOrArray,aClass,aBlock){
  22443. var self=this,$self=this;
  22444. return $core.withContext(function($ctx1) {
  22445. return $recv($self._then_(aBlockOrArray))._on_do_(aClass,aBlock);
  22446. }, function($ctx1) {$ctx1.fill(self,"then:on:do:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock})});
  22447. },
  22448. args: ["aBlockOrArray", "aClass", "aBlock"],
  22449. source: "then: aBlockOrArray on: aClass do: aBlock\x0a\x09^ (self then: aBlockOrArray) on: aClass do: aBlock",
  22450. referencedClasses: [],
  22451. pragmas: [],
  22452. messageSends: ["on:do:", "then:"]
  22453. }),
  22454. $globals.TThenable);
  22455. $core.addMethod(
  22456. $core.method({
  22457. selector: "then:on:do:catch:",
  22458. protocol: "promises",
  22459. fn: function (aBlockOrArray,aClass,aBlock,anotherBlock){
  22460. var self=this,$self=this;
  22461. return $core.withContext(function($ctx1) {
  22462. return $recv($recv($self._then_(aBlockOrArray))._on_do_(aClass,aBlock))._catch_(anotherBlock);
  22463. }, function($ctx1) {$ctx1.fill(self,"then:on:do:catch:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock})});
  22464. },
  22465. args: ["aBlockOrArray", "aClass", "aBlock", "anotherBlock"],
  22466. source: "then: aBlockOrArray on: aClass do: aBlock catch: anotherBlock\x0a\x09^ ((self then: aBlockOrArray) on: aClass do: aBlock) catch: anotherBlock",
  22467. referencedClasses: [],
  22468. pragmas: [],
  22469. messageSends: ["catch:", "on:do:", "then:"]
  22470. }),
  22471. $globals.TThenable);
  22472. $core.setTraitComposition([{trait: $globals.TThenable}], $globals.Promise);
  22473. });
  22474. /*
  22475. * Generated by PEG.js 0.10.0.
  22476. *
  22477. * http://pegjs.org/
  22478. */
  22479. define('amber/parser',["./boot"], function(__boot) {
  22480. "use strict";
  22481. function peg$subclass(child, parent) {
  22482. function ctor() { this.constructor = child; }
  22483. ctor.prototype = parent.prototype;
  22484. child.prototype = new ctor();
  22485. }
  22486. function peg$SyntaxError(message, expected, found, location) {
  22487. this.message = message;
  22488. this.expected = expected;
  22489. this.found = found;
  22490. this.location = location;
  22491. this.name = "SyntaxError";
  22492. if (typeof Error.captureStackTrace === "function") {
  22493. Error.captureStackTrace(this, peg$SyntaxError);
  22494. }
  22495. }
  22496. peg$subclass(peg$SyntaxError, Error);
  22497. peg$SyntaxError.buildMessage = function(expected, found) {
  22498. var DESCRIBE_EXPECTATION_FNS = {
  22499. literal: function(expectation) {
  22500. return "\"" + literalEscape(expectation.text) + "\"";
  22501. },
  22502. "class": function(expectation) {
  22503. var escapedParts = "",
  22504. i;
  22505. for (i = 0; i < expectation.parts.length; i++) {
  22506. escapedParts += expectation.parts[i] instanceof Array
  22507. ? classEscape(expectation.parts[i][0]) + "-" + classEscape(expectation.parts[i][1])
  22508. : classEscape(expectation.parts[i]);
  22509. }
  22510. return "[" + (expectation.inverted ? "^" : "") + escapedParts + "]";
  22511. },
  22512. any: function(expectation) {
  22513. return "any character";
  22514. },
  22515. end: function(expectation) {
  22516. return "end of input";
  22517. },
  22518. other: function(expectation) {
  22519. return expectation.description;
  22520. }
  22521. };
  22522. function hex(ch) {
  22523. return ch.charCodeAt(0).toString(16).toUpperCase();
  22524. }
  22525. function literalEscape(s) {
  22526. return s
  22527. .replace(/\\/g, '\\\\')
  22528. .replace(/"/g, '\\"')
  22529. .replace(/\0/g, '\\0')
  22530. .replace(/\t/g, '\\t')
  22531. .replace(/\n/g, '\\n')
  22532. .replace(/\r/g, '\\r')
  22533. .replace(/[\x00-\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
  22534. .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return '\\x' + hex(ch); });
  22535. }
  22536. function classEscape(s) {
  22537. return s
  22538. .replace(/\\/g, '\\\\')
  22539. .replace(/\]/g, '\\]')
  22540. .replace(/\^/g, '\\^')
  22541. .replace(/-/g, '\\-')
  22542. .replace(/\0/g, '\\0')
  22543. .replace(/\t/g, '\\t')
  22544. .replace(/\n/g, '\\n')
  22545. .replace(/\r/g, '\\r')
  22546. .replace(/[\x00-\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
  22547. .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return '\\x' + hex(ch); });
  22548. }
  22549. function describeExpectation(expectation) {
  22550. return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
  22551. }
  22552. function describeExpected(expected) {
  22553. var descriptions = new Array(expected.length),
  22554. i, j;
  22555. for (i = 0; i < expected.length; i++) {
  22556. descriptions[i] = describeExpectation(expected[i]);
  22557. }
  22558. descriptions.sort();
  22559. if (descriptions.length > 0) {
  22560. for (i = 1, j = 1; i < descriptions.length; i++) {
  22561. if (descriptions[i - 1] !== descriptions[i]) {
  22562. descriptions[j] = descriptions[i];
  22563. j++;
  22564. }
  22565. }
  22566. descriptions.length = j;
  22567. }
  22568. switch (descriptions.length) {
  22569. case 1:
  22570. return descriptions[0];
  22571. case 2:
  22572. return descriptions[0] + " or " + descriptions[1];
  22573. default:
  22574. return descriptions.slice(0, -1).join(", ")
  22575. + ", or "
  22576. + descriptions[descriptions.length - 1];
  22577. }
  22578. }
  22579. function describeFound(found) {
  22580. return found ? "\"" + literalEscape(found) + "\"" : "end of input";
  22581. }
  22582. return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
  22583. };
  22584. function peg$parse(input, options) {
  22585. options = options !== void 0 ? options : {};
  22586. var peg$FAILED = {},
  22587. peg$startRuleFunctions = { start: peg$parsestart },
  22588. peg$startRuleFunction = peg$parsestart,
  22589. peg$c0 = /^[ \t\x0B\f\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF\n\r\u2028\u2029]/,
  22590. peg$c1 = peg$classExpectation([" ", "\t", "\x0B", "\f", "\xA0", "\u1680", ["\u2000", "\u200A"], "\u202F", "\u205F", "\u3000", "\uFEFF", "\n", "\r", "\u2028", "\u2029"], false, false),
  22591. peg$c2 = "\"",
  22592. peg$c3 = peg$literalExpectation("\"", false),
  22593. peg$c4 = /^[^"]/,
  22594. peg$c5 = peg$classExpectation(["\""], true, false),
  22595. peg$c6 = ".",
  22596. peg$c7 = peg$literalExpectation(".", false),
  22597. peg$c8 = /^[a-zA-Z]/,
  22598. peg$c9 = peg$classExpectation([["a", "z"], ["A", "Z"]], false, false),
  22599. peg$c10 = /^[a-zA-Z0-9]/,
  22600. peg$c11 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"]], false, false),
  22601. peg$c12 = ":",
  22602. peg$c13 = peg$literalExpectation(":", false),
  22603. peg$c14 = /^[A-Z]/,
  22604. peg$c15 = peg$classExpectation([["A", "Z"]], false, false),
  22605. peg$c16 = function(val) {
  22606. return newNode($globals.ValueNode)._value_(val);
  22607. },
  22608. peg$c17 = "'",
  22609. peg$c18 = peg$literalExpectation("'", false),
  22610. peg$c19 = "''",
  22611. peg$c20 = peg$literalExpectation("''", false),
  22612. peg$c21 = function() {return '\'';},
  22613. peg$c22 = /^[^']/,
  22614. peg$c23 = peg$classExpectation(["'"], true, false),
  22615. peg$c24 = function(val) {return val.join('');},
  22616. peg$c25 = "$",
  22617. peg$c26 = peg$literalExpectation("$", false),
  22618. peg$c27 = peg$anyExpectation(),
  22619. peg$c28 = function(char) {
  22620. return newNode($globals.ValueNode)._value_(char);
  22621. },
  22622. peg$c29 = "#",
  22623. peg$c30 = peg$literalExpectation("#", false),
  22624. peg$c31 = function(rest) {return rest;},
  22625. peg$c32 = "e",
  22626. peg$c33 = peg$literalExpectation("e", false),
  22627. peg$c34 = function(n) {return parseFloat(n);},
  22628. peg$c35 = "-",
  22629. peg$c36 = peg$literalExpectation("-", false),
  22630. peg$c37 = "16r",
  22631. peg$c38 = peg$literalExpectation("16r", false),
  22632. peg$c39 = /^[0-9a-fA-F]/,
  22633. peg$c40 = peg$classExpectation([["0", "9"], ["a", "f"], ["A", "F"]], false, false),
  22634. peg$c41 = function(neg, num) {
  22635. return parseInt(((neg || '') + num), 16);
  22636. },
  22637. peg$c42 = /^[0-9]/,
  22638. peg$c43 = peg$classExpectation([["0", "9"]], false, false),
  22639. peg$c44 = function(n) {return parseFloat(n, 10);},
  22640. peg$c45 = function(n) {return parseInt(n, 10);},
  22641. peg$c46 = "#(",
  22642. peg$c47 = peg$literalExpectation("#(", false),
  22643. peg$c48 = ")",
  22644. peg$c49 = peg$literalExpectation(")", false),
  22645. peg$c50 = function(rest) {
  22646. return newNode($globals.ValueNode)._value_(rest);
  22647. },
  22648. peg$c51 = "(",
  22649. peg$c52 = peg$literalExpectation("(", false),
  22650. peg$c53 = function(lit) {return lit._value();},
  22651. peg$c54 = "{",
  22652. peg$c55 = peg$literalExpectation("{", false),
  22653. peg$c56 = "}",
  22654. peg$c57 = peg$literalExpectation("}", false),
  22655. peg$c58 = function(expressions) {
  22656. return newNode($globals.DynamicArrayNode)._dagChildren_(expressions || []);
  22657. },
  22658. peg$c59 = "#{",
  22659. peg$c60 = peg$literalExpectation("#{", false),
  22660. peg$c61 = function(expressions) {
  22661. return newNode($globals.DynamicDictionaryNode)._dagChildren_(expressions || []);
  22662. },
  22663. peg$c62 = "true",
  22664. peg$c63 = peg$literalExpectation("true", false),
  22665. peg$c64 = function() {return true;},
  22666. peg$c65 = "false",
  22667. peg$c66 = peg$literalExpectation("false", false),
  22668. peg$c67 = function() {return false;},
  22669. peg$c68 = "nil",
  22670. peg$c69 = peg$literalExpectation("nil", false),
  22671. peg$c70 = function() {return null;},
  22672. peg$c71 = function(identifier) {
  22673. return newNode($globals.VariableNode)._value_(identifier);
  22674. },
  22675. peg$c72 = /^[\\+*\/=><,@%~|&\-]/,
  22676. peg$c73 = peg$classExpectation(["\\", "+", "*", "/", "=", ">", "<", ",", "@", "%", "~", "|", "&", "-"], false, false),
  22677. peg$c74 = function(key, arg) {return {key:key, arg:arg};},
  22678. peg$c75 = function(pairs) {
  22679. var selector = '';
  22680. var params = [];
  22681. for(var i = 0; i < pairs.length; i++) {
  22682. selector += pairs[i].key;
  22683. params.push(pairs[i].arg);
  22684. }
  22685. return [selector, params];
  22686. },
  22687. peg$c76 = function(selector, arg) {
  22688. return [selector, [arg]];
  22689. },
  22690. peg$c77 = function(selector) {return [selector, []];},
  22691. peg$c78 = function(expression) {
  22692. return expression;
  22693. },
  22694. peg$c79 = function(first, others) {
  22695. return [first].concat(others);
  22696. },
  22697. peg$c80 = function(selector) {
  22698. return $globals.Message._selector_arguments_(selector, []);
  22699. },
  22700. peg$c81 = function(pairs) {
  22701. var selector = '';
  22702. var args = [];
  22703. for(var i = 0; i < pairs.length; i++) {
  22704. selector += pairs[i].key;
  22705. args.push(pairs[i].arg._value());
  22706. }
  22707. return $globals.Message._selector_arguments_(selector, args)
  22708. },
  22709. peg$c82 = "<",
  22710. peg$c83 = peg$literalExpectation("<", false),
  22711. peg$c84 = ">",
  22712. peg$c85 = peg$literalExpectation(">", false),
  22713. peg$c86 = function(message) {return message;},
  22714. peg$c87 = ":=",
  22715. peg$c88 = peg$literalExpectation(":=", false),
  22716. peg$c89 = function(variable, expression) {
  22717. return newNode($globals.AssignmentNode)._left_(variable)._right_(expression);
  22718. },
  22719. peg$c90 = "^",
  22720. peg$c91 = peg$literalExpectation("^", false),
  22721. peg$c92 = function(expression) {
  22722. return newNode($globals.ReturnNode)._dagChildren_([expression]);
  22723. },
  22724. peg$c93 = "|",
  22725. peg$c94 = peg$literalExpectation("|", false),
  22726. peg$c95 = function(variable) {return variable;},
  22727. peg$c96 = function(vars) {
  22728. return vars;
  22729. },
  22730. peg$c97 = function(param) {return param;},
  22731. peg$c98 = function(params) {
  22732. return params;
  22733. },
  22734. peg$c99 = function(ret) {return [ret];},
  22735. peg$c100 = function(exps, ret) {
  22736. var expressions = exps;
  22737. expressions.push(ret);
  22738. return expressions;
  22739. },
  22740. peg$c101 = function(expressions) {return expressions || [];},
  22741. peg$c102 = function(aPragmas, temps, zPragmas, statements) {
  22742. return [newNode($globals.SequenceNode)
  22743. ._temps_(temps || [])
  22744. ._dagChildren_(statements || []), (aPragmas || []).concat(zPragmas || [])];
  22745. },
  22746. peg$c103 = function(temps, statements) {
  22747. return newNode($globals.BlockSequenceNode)
  22748. ._temps_(temps || [])
  22749. ._dagChildren_(statements || []);
  22750. },
  22751. peg$c104 = "[",
  22752. peg$c105 = peg$literalExpectation("[", false),
  22753. peg$c106 = "]",
  22754. peg$c107 = peg$literalExpectation("]", false),
  22755. peg$c108 = function(params, sequence) {
  22756. return newNode($globals.BlockNode)._parameters_(params || [])._dagChildren_([sequence]);
  22757. },
  22758. peg$c109 = function(selector) {
  22759. return newNode($globals.SendNode)._selector_(selector);
  22760. },
  22761. peg$c110 = function(receiver, tail) {
  22762. return receiver._withTail_(tail);
  22763. },
  22764. peg$c111 = function(selector, arg) {
  22765. return newNode($globals.SendNode)._selector_(selector)._arguments_([arg]);
  22766. },
  22767. peg$c112 = function(unarys, binarys) { return unarys.concat(binarys); },
  22768. peg$c113 = function(pairs) {
  22769. var selector = '';
  22770. var args = [];
  22771. for(var i = 0; i < pairs.length; i++) {
  22772. selector += pairs[i].key;
  22773. args.push(pairs[i].arg);
  22774. }
  22775. return newNode($globals.SendNode)._selector_(selector)._arguments_(args);
  22776. },
  22777. peg$c114 = function(binarys, final) {
  22778. if (final) binarys.push(final);
  22779. return binarys;
  22780. },
  22781. peg$c115 = function(receiver, tail) {return tail.length > 0;},
  22782. peg$c116 = ";",
  22783. peg$c117 = peg$literalExpectation(";", false),
  22784. peg$c118 = function(receiver, tail, mess) {return mess;},
  22785. peg$c119 = function(receiver, tail, messages) {
  22786. messages.unshift(receiver._withTail_(tail));
  22787. return newNode($globals.CascadeNode)._dagChildren_(messages);
  22788. },
  22789. peg$c120 = function(pattern, sequence) {
  22790. return newNode($globals.MethodNode)
  22791. ._selector_(pattern[0])
  22792. ._arguments_(pattern[1])
  22793. ._pragmas_(sequence[1])
  22794. ._dagChildren_([sequence[0]]);
  22795. },
  22796. peg$c121 = function(receiver, tail) { return tail.length > 0 && tail[tail.length-1]._selector() === '->' },
  22797. peg$c122 = function(receiver, tail) {
  22798. var last = tail.pop();
  22799. return [receiver._withTail_(tail), last._arguments()[0]];
  22800. },
  22801. peg$c123 = function(first, others) {
  22802. return first.concat.apply(first, others);
  22803. },
  22804. peg$currPos = 0,
  22805. peg$savedPos = 0,
  22806. peg$posDetailsCache = [{ line: 1, column: 1 }],
  22807. peg$maxFailPos = 0,
  22808. peg$maxFailExpected = [],
  22809. peg$silentFails = 0,
  22810. peg$resultsCache = {},
  22811. peg$result;
  22812. if ("startRule" in options) {
  22813. if (!(options.startRule in peg$startRuleFunctions)) {
  22814. throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
  22815. }
  22816. peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
  22817. }
  22818. function text() {
  22819. return input.substring(peg$savedPos, peg$currPos);
  22820. }
  22821. function location() {
  22822. return peg$computeLocation(peg$savedPos, peg$currPos);
  22823. }
  22824. function expected(description, location) {
  22825. location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos)
  22826. throw peg$buildStructuredError(
  22827. [peg$otherExpectation(description)],
  22828. input.substring(peg$savedPos, peg$currPos),
  22829. location
  22830. );
  22831. }
  22832. function error(message, location) {
  22833. location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos)
  22834. throw peg$buildSimpleError(message, location);
  22835. }
  22836. function peg$literalExpectation(text, ignoreCase) {
  22837. return { type: "literal", text: text, ignoreCase: ignoreCase };
  22838. }
  22839. function peg$classExpectation(parts, inverted, ignoreCase) {
  22840. return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };
  22841. }
  22842. function peg$anyExpectation() {
  22843. return { type: "any" };
  22844. }
  22845. function peg$endExpectation() {
  22846. return { type: "end" };
  22847. }
  22848. function peg$otherExpectation(description) {
  22849. return { type: "other", description: description };
  22850. }
  22851. function peg$computePosDetails(pos) {
  22852. var details = peg$posDetailsCache[pos], p;
  22853. if (details) {
  22854. return details;
  22855. } else {
  22856. p = pos - 1;
  22857. while (!peg$posDetailsCache[p]) {
  22858. p--;
  22859. }
  22860. details = peg$posDetailsCache[p];
  22861. details = {
  22862. line: details.line,
  22863. column: details.column
  22864. };
  22865. while (p < pos) {
  22866. if (input.charCodeAt(p) === 10) {
  22867. details.line++;
  22868. details.column = 1;
  22869. } else {
  22870. details.column++;
  22871. }
  22872. p++;
  22873. }
  22874. peg$posDetailsCache[pos] = details;
  22875. return details;
  22876. }
  22877. }
  22878. function peg$computeLocation(startPos, endPos) {
  22879. var startPosDetails = peg$computePosDetails(startPos),
  22880. endPosDetails = peg$computePosDetails(endPos);
  22881. return {
  22882. start: {
  22883. offset: startPos,
  22884. line: startPosDetails.line,
  22885. column: startPosDetails.column
  22886. },
  22887. end: {
  22888. offset: endPos,
  22889. line: endPosDetails.line,
  22890. column: endPosDetails.column
  22891. }
  22892. };
  22893. }
  22894. function peg$fail(expected) {
  22895. if (peg$currPos < peg$maxFailPos) { return; }
  22896. if (peg$currPos > peg$maxFailPos) {
  22897. peg$maxFailPos = peg$currPos;
  22898. peg$maxFailExpected = [];
  22899. }
  22900. peg$maxFailExpected.push(expected);
  22901. }
  22902. function peg$buildSimpleError(message, location) {
  22903. return new peg$SyntaxError(message, null, null, location);
  22904. }
  22905. function peg$buildStructuredError(expected, found, location) {
  22906. return new peg$SyntaxError(
  22907. peg$SyntaxError.buildMessage(expected, found),
  22908. expected,
  22909. found,
  22910. location
  22911. );
  22912. }
  22913. function peg$parsestart() {
  22914. var s0;
  22915. var key = peg$currPos * 67 + 0,
  22916. cached = peg$resultsCache[key];
  22917. if (cached) {
  22918. peg$currPos = cached.nextPos;
  22919. return cached.result;
  22920. }
  22921. s0 = peg$parsemethod();
  22922. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  22923. return s0;
  22924. }
  22925. function peg$parseseparator() {
  22926. var s0, s1;
  22927. var key = peg$currPos * 67 + 1,
  22928. cached = peg$resultsCache[key];
  22929. if (cached) {
  22930. peg$currPos = cached.nextPos;
  22931. return cached.result;
  22932. }
  22933. s0 = [];
  22934. if (peg$c0.test(input.charAt(peg$currPos))) {
  22935. s1 = input.charAt(peg$currPos);
  22936. peg$currPos++;
  22937. } else {
  22938. s1 = peg$FAILED;
  22939. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  22940. }
  22941. if (s1 !== peg$FAILED) {
  22942. while (s1 !== peg$FAILED) {
  22943. s0.push(s1);
  22944. if (peg$c0.test(input.charAt(peg$currPos))) {
  22945. s1 = input.charAt(peg$currPos);
  22946. peg$currPos++;
  22947. } else {
  22948. s1 = peg$FAILED;
  22949. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  22950. }
  22951. }
  22952. } else {
  22953. s0 = peg$FAILED;
  22954. }
  22955. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  22956. return s0;
  22957. }
  22958. function peg$parsecomments() {
  22959. var s0, s1, s2, s3, s4;
  22960. var key = peg$currPos * 67 + 2,
  22961. cached = peg$resultsCache[key];
  22962. if (cached) {
  22963. peg$currPos = cached.nextPos;
  22964. return cached.result;
  22965. }
  22966. s0 = [];
  22967. s1 = peg$currPos;
  22968. if (input.charCodeAt(peg$currPos) === 34) {
  22969. s2 = peg$c2;
  22970. peg$currPos++;
  22971. } else {
  22972. s2 = peg$FAILED;
  22973. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  22974. }
  22975. if (s2 !== peg$FAILED) {
  22976. s3 = [];
  22977. if (peg$c4.test(input.charAt(peg$currPos))) {
  22978. s4 = input.charAt(peg$currPos);
  22979. peg$currPos++;
  22980. } else {
  22981. s4 = peg$FAILED;
  22982. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  22983. }
  22984. while (s4 !== peg$FAILED) {
  22985. s3.push(s4);
  22986. if (peg$c4.test(input.charAt(peg$currPos))) {
  22987. s4 = input.charAt(peg$currPos);
  22988. peg$currPos++;
  22989. } else {
  22990. s4 = peg$FAILED;
  22991. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  22992. }
  22993. }
  22994. if (s3 !== peg$FAILED) {
  22995. if (input.charCodeAt(peg$currPos) === 34) {
  22996. s4 = peg$c2;
  22997. peg$currPos++;
  22998. } else {
  22999. s4 = peg$FAILED;
  23000. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  23001. }
  23002. if (s4 !== peg$FAILED) {
  23003. s2 = [s2, s3, s4];
  23004. s1 = s2;
  23005. } else {
  23006. peg$currPos = s1;
  23007. s1 = peg$FAILED;
  23008. }
  23009. } else {
  23010. peg$currPos = s1;
  23011. s1 = peg$FAILED;
  23012. }
  23013. } else {
  23014. peg$currPos = s1;
  23015. s1 = peg$FAILED;
  23016. }
  23017. if (s1 !== peg$FAILED) {
  23018. while (s1 !== peg$FAILED) {
  23019. s0.push(s1);
  23020. s1 = peg$currPos;
  23021. if (input.charCodeAt(peg$currPos) === 34) {
  23022. s2 = peg$c2;
  23023. peg$currPos++;
  23024. } else {
  23025. s2 = peg$FAILED;
  23026. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  23027. }
  23028. if (s2 !== peg$FAILED) {
  23029. s3 = [];
  23030. if (peg$c4.test(input.charAt(peg$currPos))) {
  23031. s4 = input.charAt(peg$currPos);
  23032. peg$currPos++;
  23033. } else {
  23034. s4 = peg$FAILED;
  23035. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  23036. }
  23037. while (s4 !== peg$FAILED) {
  23038. s3.push(s4);
  23039. if (peg$c4.test(input.charAt(peg$currPos))) {
  23040. s4 = input.charAt(peg$currPos);
  23041. peg$currPos++;
  23042. } else {
  23043. s4 = peg$FAILED;
  23044. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  23045. }
  23046. }
  23047. if (s3 !== peg$FAILED) {
  23048. if (input.charCodeAt(peg$currPos) === 34) {
  23049. s4 = peg$c2;
  23050. peg$currPos++;
  23051. } else {
  23052. s4 = peg$FAILED;
  23053. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  23054. }
  23055. if (s4 !== peg$FAILED) {
  23056. s2 = [s2, s3, s4];
  23057. s1 = s2;
  23058. } else {
  23059. peg$currPos = s1;
  23060. s1 = peg$FAILED;
  23061. }
  23062. } else {
  23063. peg$currPos = s1;
  23064. s1 = peg$FAILED;
  23065. }
  23066. } else {
  23067. peg$currPos = s1;
  23068. s1 = peg$FAILED;
  23069. }
  23070. }
  23071. } else {
  23072. s0 = peg$FAILED;
  23073. }
  23074. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23075. return s0;
  23076. }
  23077. function peg$parsews() {
  23078. var s0, s1;
  23079. var key = peg$currPos * 67 + 3,
  23080. cached = peg$resultsCache[key];
  23081. if (cached) {
  23082. peg$currPos = cached.nextPos;
  23083. return cached.result;
  23084. }
  23085. s0 = [];
  23086. s1 = peg$parseseparator();
  23087. if (s1 === peg$FAILED) {
  23088. s1 = peg$parsecomments();
  23089. }
  23090. while (s1 !== peg$FAILED) {
  23091. s0.push(s1);
  23092. s1 = peg$parseseparator();
  23093. if (s1 === peg$FAILED) {
  23094. s1 = peg$parsecomments();
  23095. }
  23096. }
  23097. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23098. return s0;
  23099. }
  23100. function peg$parsemaybeDotsWs() {
  23101. var s0, s1;
  23102. var key = peg$currPos * 67 + 4,
  23103. cached = peg$resultsCache[key];
  23104. if (cached) {
  23105. peg$currPos = cached.nextPos;
  23106. return cached.result;
  23107. }
  23108. s0 = [];
  23109. if (input.charCodeAt(peg$currPos) === 46) {
  23110. s1 = peg$c6;
  23111. peg$currPos++;
  23112. } else {
  23113. s1 = peg$FAILED;
  23114. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  23115. }
  23116. if (s1 === peg$FAILED) {
  23117. s1 = peg$parseseparator();
  23118. if (s1 === peg$FAILED) {
  23119. s1 = peg$parsecomments();
  23120. }
  23121. }
  23122. while (s1 !== peg$FAILED) {
  23123. s0.push(s1);
  23124. if (input.charCodeAt(peg$currPos) === 46) {
  23125. s1 = peg$c6;
  23126. peg$currPos++;
  23127. } else {
  23128. s1 = peg$FAILED;
  23129. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  23130. }
  23131. if (s1 === peg$FAILED) {
  23132. s1 = peg$parseseparator();
  23133. if (s1 === peg$FAILED) {
  23134. s1 = peg$parsecomments();
  23135. }
  23136. }
  23137. }
  23138. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23139. return s0;
  23140. }
  23141. function peg$parsesomeDotsWs() {
  23142. var s0, s1, s2, s3;
  23143. var key = peg$currPos * 67 + 5,
  23144. cached = peg$resultsCache[key];
  23145. if (cached) {
  23146. peg$currPos = cached.nextPos;
  23147. return cached.result;
  23148. }
  23149. s0 = peg$currPos;
  23150. s1 = peg$parsews();
  23151. if (s1 !== peg$FAILED) {
  23152. if (input.charCodeAt(peg$currPos) === 46) {
  23153. s2 = peg$c6;
  23154. peg$currPos++;
  23155. } else {
  23156. s2 = peg$FAILED;
  23157. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  23158. }
  23159. if (s2 !== peg$FAILED) {
  23160. s3 = peg$parsemaybeDotsWs();
  23161. if (s3 !== peg$FAILED) {
  23162. s1 = [s1, s2, s3];
  23163. s0 = s1;
  23164. } else {
  23165. peg$currPos = s0;
  23166. s0 = peg$FAILED;
  23167. }
  23168. } else {
  23169. peg$currPos = s0;
  23170. s0 = peg$FAILED;
  23171. }
  23172. } else {
  23173. peg$currPos = s0;
  23174. s0 = peg$FAILED;
  23175. }
  23176. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23177. return s0;
  23178. }
  23179. function peg$parseidentifier() {
  23180. var s0, s1, s2, s3, s4;
  23181. var key = peg$currPos * 67 + 6,
  23182. cached = peg$resultsCache[key];
  23183. if (cached) {
  23184. peg$currPos = cached.nextPos;
  23185. return cached.result;
  23186. }
  23187. s0 = peg$currPos;
  23188. s1 = peg$currPos;
  23189. if (peg$c8.test(input.charAt(peg$currPos))) {
  23190. s2 = input.charAt(peg$currPos);
  23191. peg$currPos++;
  23192. } else {
  23193. s2 = peg$FAILED;
  23194. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  23195. }
  23196. if (s2 !== peg$FAILED) {
  23197. s3 = [];
  23198. if (peg$c10.test(input.charAt(peg$currPos))) {
  23199. s4 = input.charAt(peg$currPos);
  23200. peg$currPos++;
  23201. } else {
  23202. s4 = peg$FAILED;
  23203. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  23204. }
  23205. while (s4 !== peg$FAILED) {
  23206. s3.push(s4);
  23207. if (peg$c10.test(input.charAt(peg$currPos))) {
  23208. s4 = input.charAt(peg$currPos);
  23209. peg$currPos++;
  23210. } else {
  23211. s4 = peg$FAILED;
  23212. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  23213. }
  23214. }
  23215. if (s3 !== peg$FAILED) {
  23216. s2 = [s2, s3];
  23217. s1 = s2;
  23218. } else {
  23219. peg$currPos = s1;
  23220. s1 = peg$FAILED;
  23221. }
  23222. } else {
  23223. peg$currPos = s1;
  23224. s1 = peg$FAILED;
  23225. }
  23226. if (s1 !== peg$FAILED) {
  23227. s0 = input.substring(s0, peg$currPos);
  23228. } else {
  23229. s0 = s1;
  23230. }
  23231. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23232. return s0;
  23233. }
  23234. function peg$parsekeyword() {
  23235. var s0, s1, s2, s3;
  23236. var key = peg$currPos * 67 + 7,
  23237. cached = peg$resultsCache[key];
  23238. if (cached) {
  23239. peg$currPos = cached.nextPos;
  23240. return cached.result;
  23241. }
  23242. s0 = peg$currPos;
  23243. s1 = peg$currPos;
  23244. s2 = peg$parseidentifier();
  23245. if (s2 !== peg$FAILED) {
  23246. if (input.charCodeAt(peg$currPos) === 58) {
  23247. s3 = peg$c12;
  23248. peg$currPos++;
  23249. } else {
  23250. s3 = peg$FAILED;
  23251. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  23252. }
  23253. if (s3 !== peg$FAILED) {
  23254. s2 = [s2, s3];
  23255. s1 = s2;
  23256. } else {
  23257. peg$currPos = s1;
  23258. s1 = peg$FAILED;
  23259. }
  23260. } else {
  23261. peg$currPos = s1;
  23262. s1 = peg$FAILED;
  23263. }
  23264. if (s1 !== peg$FAILED) {
  23265. s0 = input.substring(s0, peg$currPos);
  23266. } else {
  23267. s0 = s1;
  23268. }
  23269. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23270. return s0;
  23271. }
  23272. function peg$parseclassName() {
  23273. var s0, s1, s2, s3, s4;
  23274. var key = peg$currPos * 67 + 8,
  23275. cached = peg$resultsCache[key];
  23276. if (cached) {
  23277. peg$currPos = cached.nextPos;
  23278. return cached.result;
  23279. }
  23280. s0 = peg$currPos;
  23281. s1 = peg$currPos;
  23282. if (peg$c14.test(input.charAt(peg$currPos))) {
  23283. s2 = input.charAt(peg$currPos);
  23284. peg$currPos++;
  23285. } else {
  23286. s2 = peg$FAILED;
  23287. if (peg$silentFails === 0) { peg$fail(peg$c15); }
  23288. }
  23289. if (s2 !== peg$FAILED) {
  23290. s3 = [];
  23291. if (peg$c10.test(input.charAt(peg$currPos))) {
  23292. s4 = input.charAt(peg$currPos);
  23293. peg$currPos++;
  23294. } else {
  23295. s4 = peg$FAILED;
  23296. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  23297. }
  23298. while (s4 !== peg$FAILED) {
  23299. s3.push(s4);
  23300. if (peg$c10.test(input.charAt(peg$currPos))) {
  23301. s4 = input.charAt(peg$currPos);
  23302. peg$currPos++;
  23303. } else {
  23304. s4 = peg$FAILED;
  23305. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  23306. }
  23307. }
  23308. if (s3 !== peg$FAILED) {
  23309. s2 = [s2, s3];
  23310. s1 = s2;
  23311. } else {
  23312. peg$currPos = s1;
  23313. s1 = peg$FAILED;
  23314. }
  23315. } else {
  23316. peg$currPos = s1;
  23317. s1 = peg$FAILED;
  23318. }
  23319. if (s1 !== peg$FAILED) {
  23320. s0 = input.substring(s0, peg$currPos);
  23321. } else {
  23322. s0 = s1;
  23323. }
  23324. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23325. return s0;
  23326. }
  23327. function peg$parsestring() {
  23328. var s0, s1;
  23329. var key = peg$currPos * 67 + 9,
  23330. cached = peg$resultsCache[key];
  23331. if (cached) {
  23332. peg$currPos = cached.nextPos;
  23333. return cached.result;
  23334. }
  23335. s0 = peg$currPos;
  23336. s1 = peg$parserawString();
  23337. if (s1 !== peg$FAILED) {
  23338. peg$savedPos = s0;
  23339. s1 = peg$c16(s1);
  23340. }
  23341. s0 = s1;
  23342. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23343. return s0;
  23344. }
  23345. function peg$parserawString() {
  23346. var s0, s1, s2, s3, s4;
  23347. var key = peg$currPos * 67 + 10,
  23348. cached = peg$resultsCache[key];
  23349. if (cached) {
  23350. peg$currPos = cached.nextPos;
  23351. return cached.result;
  23352. }
  23353. s0 = peg$currPos;
  23354. if (input.charCodeAt(peg$currPos) === 39) {
  23355. s1 = peg$c17;
  23356. peg$currPos++;
  23357. } else {
  23358. s1 = peg$FAILED;
  23359. if (peg$silentFails === 0) { peg$fail(peg$c18); }
  23360. }
  23361. if (s1 !== peg$FAILED) {
  23362. s2 = [];
  23363. s3 = peg$currPos;
  23364. if (input.substr(peg$currPos, 2) === peg$c19) {
  23365. s4 = peg$c19;
  23366. peg$currPos += 2;
  23367. } else {
  23368. s4 = peg$FAILED;
  23369. if (peg$silentFails === 0) { peg$fail(peg$c20); }
  23370. }
  23371. if (s4 !== peg$FAILED) {
  23372. peg$savedPos = s3;
  23373. s4 = peg$c21();
  23374. }
  23375. s3 = s4;
  23376. if (s3 === peg$FAILED) {
  23377. if (peg$c22.test(input.charAt(peg$currPos))) {
  23378. s3 = input.charAt(peg$currPos);
  23379. peg$currPos++;
  23380. } else {
  23381. s3 = peg$FAILED;
  23382. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  23383. }
  23384. }
  23385. while (s3 !== peg$FAILED) {
  23386. s2.push(s3);
  23387. s3 = peg$currPos;
  23388. if (input.substr(peg$currPos, 2) === peg$c19) {
  23389. s4 = peg$c19;
  23390. peg$currPos += 2;
  23391. } else {
  23392. s4 = peg$FAILED;
  23393. if (peg$silentFails === 0) { peg$fail(peg$c20); }
  23394. }
  23395. if (s4 !== peg$FAILED) {
  23396. peg$savedPos = s3;
  23397. s4 = peg$c21();
  23398. }
  23399. s3 = s4;
  23400. if (s3 === peg$FAILED) {
  23401. if (peg$c22.test(input.charAt(peg$currPos))) {
  23402. s3 = input.charAt(peg$currPos);
  23403. peg$currPos++;
  23404. } else {
  23405. s3 = peg$FAILED;
  23406. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  23407. }
  23408. }
  23409. }
  23410. if (s2 !== peg$FAILED) {
  23411. if (input.charCodeAt(peg$currPos) === 39) {
  23412. s3 = peg$c17;
  23413. peg$currPos++;
  23414. } else {
  23415. s3 = peg$FAILED;
  23416. if (peg$silentFails === 0) { peg$fail(peg$c18); }
  23417. }
  23418. if (s3 !== peg$FAILED) {
  23419. peg$savedPos = s0;
  23420. s1 = peg$c24(s2);
  23421. s0 = s1;
  23422. } else {
  23423. peg$currPos = s0;
  23424. s0 = peg$FAILED;
  23425. }
  23426. } else {
  23427. peg$currPos = s0;
  23428. s0 = peg$FAILED;
  23429. }
  23430. } else {
  23431. peg$currPos = s0;
  23432. s0 = peg$FAILED;
  23433. }
  23434. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23435. return s0;
  23436. }
  23437. function peg$parsecharacter() {
  23438. var s0, s1, s2;
  23439. var key = peg$currPos * 67 + 11,
  23440. cached = peg$resultsCache[key];
  23441. if (cached) {
  23442. peg$currPos = cached.nextPos;
  23443. return cached.result;
  23444. }
  23445. s0 = peg$currPos;
  23446. if (input.charCodeAt(peg$currPos) === 36) {
  23447. s1 = peg$c25;
  23448. peg$currPos++;
  23449. } else {
  23450. s1 = peg$FAILED;
  23451. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  23452. }
  23453. if (s1 !== peg$FAILED) {
  23454. if (input.length > peg$currPos) {
  23455. s2 = input.charAt(peg$currPos);
  23456. peg$currPos++;
  23457. } else {
  23458. s2 = peg$FAILED;
  23459. if (peg$silentFails === 0) { peg$fail(peg$c27); }
  23460. }
  23461. if (s2 !== peg$FAILED) {
  23462. peg$savedPos = s0;
  23463. s1 = peg$c28(s2);
  23464. s0 = s1;
  23465. } else {
  23466. peg$currPos = s0;
  23467. s0 = peg$FAILED;
  23468. }
  23469. } else {
  23470. peg$currPos = s0;
  23471. s0 = peg$FAILED;
  23472. }
  23473. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23474. return s0;
  23475. }
  23476. function peg$parsesymbol() {
  23477. var s0, s1, s2;
  23478. var key = peg$currPos * 67 + 12,
  23479. cached = peg$resultsCache[key];
  23480. if (cached) {
  23481. peg$currPos = cached.nextPos;
  23482. return cached.result;
  23483. }
  23484. s0 = peg$currPos;
  23485. if (input.charCodeAt(peg$currPos) === 35) {
  23486. s1 = peg$c29;
  23487. peg$currPos++;
  23488. } else {
  23489. s1 = peg$FAILED;
  23490. if (peg$silentFails === 0) { peg$fail(peg$c30); }
  23491. }
  23492. if (s1 !== peg$FAILED) {
  23493. s2 = peg$parsebareSymbol();
  23494. if (s2 !== peg$FAILED) {
  23495. peg$savedPos = s0;
  23496. s1 = peg$c31(s2);
  23497. s0 = s1;
  23498. } else {
  23499. peg$currPos = s0;
  23500. s0 = peg$FAILED;
  23501. }
  23502. } else {
  23503. peg$currPos = s0;
  23504. s0 = peg$FAILED;
  23505. }
  23506. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23507. return s0;
  23508. }
  23509. function peg$parsebareSymbol() {
  23510. var s0, s1, s2, s3;
  23511. var key = peg$currPos * 67 + 13,
  23512. cached = peg$resultsCache[key];
  23513. if (cached) {
  23514. peg$currPos = cached.nextPos;
  23515. return cached.result;
  23516. }
  23517. s0 = peg$currPos;
  23518. s1 = peg$currPos;
  23519. s2 = [];
  23520. s3 = peg$parsekeyword();
  23521. if (s3 !== peg$FAILED) {
  23522. while (s3 !== peg$FAILED) {
  23523. s2.push(s3);
  23524. s3 = peg$parsekeyword();
  23525. }
  23526. } else {
  23527. s2 = peg$FAILED;
  23528. }
  23529. if (s2 !== peg$FAILED) {
  23530. s1 = input.substring(s1, peg$currPos);
  23531. } else {
  23532. s1 = s2;
  23533. }
  23534. if (s1 === peg$FAILED) {
  23535. s1 = peg$parsebinarySelector();
  23536. if (s1 === peg$FAILED) {
  23537. s1 = peg$parseidentifier();
  23538. if (s1 === peg$FAILED) {
  23539. s1 = peg$parserawString();
  23540. }
  23541. }
  23542. }
  23543. if (s1 !== peg$FAILED) {
  23544. peg$savedPos = s0;
  23545. s1 = peg$c16(s1);
  23546. }
  23547. s0 = s1;
  23548. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23549. return s0;
  23550. }
  23551. function peg$parsenumber() {
  23552. var s0, s1;
  23553. var key = peg$currPos * 67 + 14,
  23554. cached = peg$resultsCache[key];
  23555. if (cached) {
  23556. peg$currPos = cached.nextPos;
  23557. return cached.result;
  23558. }
  23559. s0 = peg$currPos;
  23560. s1 = peg$parserawNumber();
  23561. if (s1 !== peg$FAILED) {
  23562. peg$savedPos = s0;
  23563. s1 = peg$c16(s1);
  23564. }
  23565. s0 = s1;
  23566. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23567. return s0;
  23568. }
  23569. function peg$parserawNumber() {
  23570. var s0;
  23571. var key = peg$currPos * 67 + 15,
  23572. cached = peg$resultsCache[key];
  23573. if (cached) {
  23574. peg$currPos = cached.nextPos;
  23575. return cached.result;
  23576. }
  23577. s0 = peg$parsenumberExp();
  23578. if (s0 === peg$FAILED) {
  23579. s0 = peg$parsehex();
  23580. if (s0 === peg$FAILED) {
  23581. s0 = peg$parsefloat();
  23582. if (s0 === peg$FAILED) {
  23583. s0 = peg$parseinteger();
  23584. }
  23585. }
  23586. }
  23587. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23588. return s0;
  23589. }
  23590. function peg$parsenumberExp() {
  23591. var s0, s1, s2, s3, s4, s5;
  23592. var key = peg$currPos * 67 + 16,
  23593. cached = peg$resultsCache[key];
  23594. if (cached) {
  23595. peg$currPos = cached.nextPos;
  23596. return cached.result;
  23597. }
  23598. s0 = peg$currPos;
  23599. s1 = peg$currPos;
  23600. s2 = peg$currPos;
  23601. s3 = peg$parsefloat();
  23602. if (s3 === peg$FAILED) {
  23603. s3 = peg$parseinteger();
  23604. }
  23605. if (s3 !== peg$FAILED) {
  23606. if (input.charCodeAt(peg$currPos) === 101) {
  23607. s4 = peg$c32;
  23608. peg$currPos++;
  23609. } else {
  23610. s4 = peg$FAILED;
  23611. if (peg$silentFails === 0) { peg$fail(peg$c33); }
  23612. }
  23613. if (s4 !== peg$FAILED) {
  23614. s5 = peg$parseinteger();
  23615. if (s5 !== peg$FAILED) {
  23616. s3 = [s3, s4, s5];
  23617. s2 = s3;
  23618. } else {
  23619. peg$currPos = s2;
  23620. s2 = peg$FAILED;
  23621. }
  23622. } else {
  23623. peg$currPos = s2;
  23624. s2 = peg$FAILED;
  23625. }
  23626. } else {
  23627. peg$currPos = s2;
  23628. s2 = peg$FAILED;
  23629. }
  23630. if (s2 !== peg$FAILED) {
  23631. s1 = input.substring(s1, peg$currPos);
  23632. } else {
  23633. s1 = s2;
  23634. }
  23635. if (s1 !== peg$FAILED) {
  23636. peg$savedPos = s0;
  23637. s1 = peg$c34(s1);
  23638. }
  23639. s0 = s1;
  23640. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23641. return s0;
  23642. }
  23643. function peg$parsehex() {
  23644. var s0, s1, s2, s3, s4, s5;
  23645. var key = peg$currPos * 67 + 17,
  23646. cached = peg$resultsCache[key];
  23647. if (cached) {
  23648. peg$currPos = cached.nextPos;
  23649. return cached.result;
  23650. }
  23651. s0 = peg$currPos;
  23652. if (input.charCodeAt(peg$currPos) === 45) {
  23653. s1 = peg$c35;
  23654. peg$currPos++;
  23655. } else {
  23656. s1 = peg$FAILED;
  23657. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  23658. }
  23659. if (s1 === peg$FAILED) {
  23660. s1 = null;
  23661. }
  23662. if (s1 !== peg$FAILED) {
  23663. if (input.substr(peg$currPos, 3) === peg$c37) {
  23664. s2 = peg$c37;
  23665. peg$currPos += 3;
  23666. } else {
  23667. s2 = peg$FAILED;
  23668. if (peg$silentFails === 0) { peg$fail(peg$c38); }
  23669. }
  23670. if (s2 !== peg$FAILED) {
  23671. s3 = peg$currPos;
  23672. s4 = [];
  23673. if (peg$c39.test(input.charAt(peg$currPos))) {
  23674. s5 = input.charAt(peg$currPos);
  23675. peg$currPos++;
  23676. } else {
  23677. s5 = peg$FAILED;
  23678. if (peg$silentFails === 0) { peg$fail(peg$c40); }
  23679. }
  23680. if (s5 !== peg$FAILED) {
  23681. while (s5 !== peg$FAILED) {
  23682. s4.push(s5);
  23683. if (peg$c39.test(input.charAt(peg$currPos))) {
  23684. s5 = input.charAt(peg$currPos);
  23685. peg$currPos++;
  23686. } else {
  23687. s5 = peg$FAILED;
  23688. if (peg$silentFails === 0) { peg$fail(peg$c40); }
  23689. }
  23690. }
  23691. } else {
  23692. s4 = peg$FAILED;
  23693. }
  23694. if (s4 !== peg$FAILED) {
  23695. s3 = input.substring(s3, peg$currPos);
  23696. } else {
  23697. s3 = s4;
  23698. }
  23699. if (s3 !== peg$FAILED) {
  23700. peg$savedPos = s0;
  23701. s1 = peg$c41(s1, s3);
  23702. s0 = s1;
  23703. } else {
  23704. peg$currPos = s0;
  23705. s0 = peg$FAILED;
  23706. }
  23707. } else {
  23708. peg$currPos = s0;
  23709. s0 = peg$FAILED;
  23710. }
  23711. } else {
  23712. peg$currPos = s0;
  23713. s0 = peg$FAILED;
  23714. }
  23715. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23716. return s0;
  23717. }
  23718. function peg$parsefloat() {
  23719. var s0, s1, s2, s3, s4, s5, s6, s7;
  23720. var key = peg$currPos * 67 + 18,
  23721. cached = peg$resultsCache[key];
  23722. if (cached) {
  23723. peg$currPos = cached.nextPos;
  23724. return cached.result;
  23725. }
  23726. s0 = peg$currPos;
  23727. s1 = peg$currPos;
  23728. s2 = peg$currPos;
  23729. if (input.charCodeAt(peg$currPos) === 45) {
  23730. s3 = peg$c35;
  23731. peg$currPos++;
  23732. } else {
  23733. s3 = peg$FAILED;
  23734. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  23735. }
  23736. if (s3 === peg$FAILED) {
  23737. s3 = null;
  23738. }
  23739. if (s3 !== peg$FAILED) {
  23740. s4 = [];
  23741. if (peg$c42.test(input.charAt(peg$currPos))) {
  23742. s5 = input.charAt(peg$currPos);
  23743. peg$currPos++;
  23744. } else {
  23745. s5 = peg$FAILED;
  23746. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  23747. }
  23748. if (s5 !== peg$FAILED) {
  23749. while (s5 !== peg$FAILED) {
  23750. s4.push(s5);
  23751. if (peg$c42.test(input.charAt(peg$currPos))) {
  23752. s5 = input.charAt(peg$currPos);
  23753. peg$currPos++;
  23754. } else {
  23755. s5 = peg$FAILED;
  23756. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  23757. }
  23758. }
  23759. } else {
  23760. s4 = peg$FAILED;
  23761. }
  23762. if (s4 !== peg$FAILED) {
  23763. if (input.charCodeAt(peg$currPos) === 46) {
  23764. s5 = peg$c6;
  23765. peg$currPos++;
  23766. } else {
  23767. s5 = peg$FAILED;
  23768. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  23769. }
  23770. if (s5 !== peg$FAILED) {
  23771. s6 = [];
  23772. if (peg$c42.test(input.charAt(peg$currPos))) {
  23773. s7 = input.charAt(peg$currPos);
  23774. peg$currPos++;
  23775. } else {
  23776. s7 = peg$FAILED;
  23777. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  23778. }
  23779. if (s7 !== peg$FAILED) {
  23780. while (s7 !== peg$FAILED) {
  23781. s6.push(s7);
  23782. if (peg$c42.test(input.charAt(peg$currPos))) {
  23783. s7 = input.charAt(peg$currPos);
  23784. peg$currPos++;
  23785. } else {
  23786. s7 = peg$FAILED;
  23787. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  23788. }
  23789. }
  23790. } else {
  23791. s6 = peg$FAILED;
  23792. }
  23793. if (s6 !== peg$FAILED) {
  23794. s3 = [s3, s4, s5, s6];
  23795. s2 = s3;
  23796. } else {
  23797. peg$currPos = s2;
  23798. s2 = peg$FAILED;
  23799. }
  23800. } else {
  23801. peg$currPos = s2;
  23802. s2 = peg$FAILED;
  23803. }
  23804. } else {
  23805. peg$currPos = s2;
  23806. s2 = peg$FAILED;
  23807. }
  23808. } else {
  23809. peg$currPos = s2;
  23810. s2 = peg$FAILED;
  23811. }
  23812. if (s2 !== peg$FAILED) {
  23813. s1 = input.substring(s1, peg$currPos);
  23814. } else {
  23815. s1 = s2;
  23816. }
  23817. if (s1 !== peg$FAILED) {
  23818. peg$savedPos = s0;
  23819. s1 = peg$c44(s1);
  23820. }
  23821. s0 = s1;
  23822. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23823. return s0;
  23824. }
  23825. function peg$parseinteger() {
  23826. var s0, s1, s2, s3, s4, s5;
  23827. var key = peg$currPos * 67 + 19,
  23828. cached = peg$resultsCache[key];
  23829. if (cached) {
  23830. peg$currPos = cached.nextPos;
  23831. return cached.result;
  23832. }
  23833. s0 = peg$currPos;
  23834. s1 = peg$currPos;
  23835. s2 = peg$currPos;
  23836. if (input.charCodeAt(peg$currPos) === 45) {
  23837. s3 = peg$c35;
  23838. peg$currPos++;
  23839. } else {
  23840. s3 = peg$FAILED;
  23841. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  23842. }
  23843. if (s3 === peg$FAILED) {
  23844. s3 = null;
  23845. }
  23846. if (s3 !== peg$FAILED) {
  23847. s4 = [];
  23848. if (peg$c42.test(input.charAt(peg$currPos))) {
  23849. s5 = input.charAt(peg$currPos);
  23850. peg$currPos++;
  23851. } else {
  23852. s5 = peg$FAILED;
  23853. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  23854. }
  23855. if (s5 !== peg$FAILED) {
  23856. while (s5 !== peg$FAILED) {
  23857. s4.push(s5);
  23858. if (peg$c42.test(input.charAt(peg$currPos))) {
  23859. s5 = input.charAt(peg$currPos);
  23860. peg$currPos++;
  23861. } else {
  23862. s5 = peg$FAILED;
  23863. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  23864. }
  23865. }
  23866. } else {
  23867. s4 = peg$FAILED;
  23868. }
  23869. if (s4 !== peg$FAILED) {
  23870. s3 = [s3, s4];
  23871. s2 = s3;
  23872. } else {
  23873. peg$currPos = s2;
  23874. s2 = peg$FAILED;
  23875. }
  23876. } else {
  23877. peg$currPos = s2;
  23878. s2 = peg$FAILED;
  23879. }
  23880. if (s2 !== peg$FAILED) {
  23881. s1 = input.substring(s1, peg$currPos);
  23882. } else {
  23883. s1 = s2;
  23884. }
  23885. if (s1 !== peg$FAILED) {
  23886. peg$savedPos = s0;
  23887. s1 = peg$c45(s1);
  23888. }
  23889. s0 = s1;
  23890. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23891. return s0;
  23892. }
  23893. function peg$parseliteralArray() {
  23894. var s0, s1, s2, s3, s4;
  23895. var key = peg$currPos * 67 + 20,
  23896. cached = peg$resultsCache[key];
  23897. if (cached) {
  23898. peg$currPos = cached.nextPos;
  23899. return cached.result;
  23900. }
  23901. s0 = peg$currPos;
  23902. if (input.substr(peg$currPos, 2) === peg$c46) {
  23903. s1 = peg$c46;
  23904. peg$currPos += 2;
  23905. } else {
  23906. s1 = peg$FAILED;
  23907. if (peg$silentFails === 0) { peg$fail(peg$c47); }
  23908. }
  23909. if (s1 !== peg$FAILED) {
  23910. s2 = peg$parsewsLiteralArrayContents();
  23911. if (s2 !== peg$FAILED) {
  23912. s3 = peg$parsews();
  23913. if (s3 !== peg$FAILED) {
  23914. if (input.charCodeAt(peg$currPos) === 41) {
  23915. s4 = peg$c48;
  23916. peg$currPos++;
  23917. } else {
  23918. s4 = peg$FAILED;
  23919. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  23920. }
  23921. if (s4 !== peg$FAILED) {
  23922. peg$savedPos = s0;
  23923. s1 = peg$c50(s2);
  23924. s0 = s1;
  23925. } else {
  23926. peg$currPos = s0;
  23927. s0 = peg$FAILED;
  23928. }
  23929. } else {
  23930. peg$currPos = s0;
  23931. s0 = peg$FAILED;
  23932. }
  23933. } else {
  23934. peg$currPos = s0;
  23935. s0 = peg$FAILED;
  23936. }
  23937. } else {
  23938. peg$currPos = s0;
  23939. s0 = peg$FAILED;
  23940. }
  23941. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23942. return s0;
  23943. }
  23944. function peg$parsebareLiteralArray() {
  23945. var s0, s1, s2, s3, s4;
  23946. var key = peg$currPos * 67 + 21,
  23947. cached = peg$resultsCache[key];
  23948. if (cached) {
  23949. peg$currPos = cached.nextPos;
  23950. return cached.result;
  23951. }
  23952. s0 = peg$currPos;
  23953. if (input.charCodeAt(peg$currPos) === 40) {
  23954. s1 = peg$c51;
  23955. peg$currPos++;
  23956. } else {
  23957. s1 = peg$FAILED;
  23958. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  23959. }
  23960. if (s1 !== peg$FAILED) {
  23961. s2 = peg$parsewsLiteralArrayContents();
  23962. if (s2 !== peg$FAILED) {
  23963. s3 = peg$parsews();
  23964. if (s3 !== peg$FAILED) {
  23965. if (input.charCodeAt(peg$currPos) === 41) {
  23966. s4 = peg$c48;
  23967. peg$currPos++;
  23968. } else {
  23969. s4 = peg$FAILED;
  23970. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  23971. }
  23972. if (s4 !== peg$FAILED) {
  23973. peg$savedPos = s0;
  23974. s1 = peg$c50(s2);
  23975. s0 = s1;
  23976. } else {
  23977. peg$currPos = s0;
  23978. s0 = peg$FAILED;
  23979. }
  23980. } else {
  23981. peg$currPos = s0;
  23982. s0 = peg$FAILED;
  23983. }
  23984. } else {
  23985. peg$currPos = s0;
  23986. s0 = peg$FAILED;
  23987. }
  23988. } else {
  23989. peg$currPos = s0;
  23990. s0 = peg$FAILED;
  23991. }
  23992. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23993. return s0;
  23994. }
  23995. function peg$parseliteralArrayElement() {
  23996. var s0;
  23997. var key = peg$currPos * 67 + 22,
  23998. cached = peg$resultsCache[key];
  23999. if (cached) {
  24000. peg$currPos = cached.nextPos;
  24001. return cached.result;
  24002. }
  24003. s0 = peg$parseparseTimeLiteral();
  24004. if (s0 === peg$FAILED) {
  24005. s0 = peg$parsebareLiteralArray();
  24006. if (s0 === peg$FAILED) {
  24007. s0 = peg$parsebareSymbol();
  24008. }
  24009. }
  24010. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24011. return s0;
  24012. }
  24013. function peg$parsewsLiteralArrayContents() {
  24014. var s0, s1, s2, s3;
  24015. var key = peg$currPos * 67 + 23,
  24016. cached = peg$resultsCache[key];
  24017. if (cached) {
  24018. peg$currPos = cached.nextPos;
  24019. return cached.result;
  24020. }
  24021. s0 = [];
  24022. s1 = peg$currPos;
  24023. s2 = peg$parsews();
  24024. if (s2 !== peg$FAILED) {
  24025. s3 = peg$parseliteralArrayElement();
  24026. if (s3 !== peg$FAILED) {
  24027. peg$savedPos = s1;
  24028. s2 = peg$c53(s3);
  24029. s1 = s2;
  24030. } else {
  24031. peg$currPos = s1;
  24032. s1 = peg$FAILED;
  24033. }
  24034. } else {
  24035. peg$currPos = s1;
  24036. s1 = peg$FAILED;
  24037. }
  24038. while (s1 !== peg$FAILED) {
  24039. s0.push(s1);
  24040. s1 = peg$currPos;
  24041. s2 = peg$parsews();
  24042. if (s2 !== peg$FAILED) {
  24043. s3 = peg$parseliteralArrayElement();
  24044. if (s3 !== peg$FAILED) {
  24045. peg$savedPos = s1;
  24046. s2 = peg$c53(s3);
  24047. s1 = s2;
  24048. } else {
  24049. peg$currPos = s1;
  24050. s1 = peg$FAILED;
  24051. }
  24052. } else {
  24053. peg$currPos = s1;
  24054. s1 = peg$FAILED;
  24055. }
  24056. }
  24057. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24058. return s0;
  24059. }
  24060. function peg$parsedynamicArray() {
  24061. var s0, s1, s2, s3, s4;
  24062. var key = peg$currPos * 67 + 24,
  24063. cached = peg$resultsCache[key];
  24064. if (cached) {
  24065. peg$currPos = cached.nextPos;
  24066. return cached.result;
  24067. }
  24068. s0 = peg$currPos;
  24069. if (input.charCodeAt(peg$currPos) === 123) {
  24070. s1 = peg$c54;
  24071. peg$currPos++;
  24072. } else {
  24073. s1 = peg$FAILED;
  24074. if (peg$silentFails === 0) { peg$fail(peg$c55); }
  24075. }
  24076. if (s1 !== peg$FAILED) {
  24077. s2 = peg$parsewsExpressions();
  24078. if (s2 === peg$FAILED) {
  24079. s2 = null;
  24080. }
  24081. if (s2 !== peg$FAILED) {
  24082. s3 = peg$parsemaybeDotsWs();
  24083. if (s3 !== peg$FAILED) {
  24084. if (input.charCodeAt(peg$currPos) === 125) {
  24085. s4 = peg$c56;
  24086. peg$currPos++;
  24087. } else {
  24088. s4 = peg$FAILED;
  24089. if (peg$silentFails === 0) { peg$fail(peg$c57); }
  24090. }
  24091. if (s4 !== peg$FAILED) {
  24092. peg$savedPos = s0;
  24093. s1 = peg$c58(s2);
  24094. s0 = s1;
  24095. } else {
  24096. peg$currPos = s0;
  24097. s0 = peg$FAILED;
  24098. }
  24099. } else {
  24100. peg$currPos = s0;
  24101. s0 = peg$FAILED;
  24102. }
  24103. } else {
  24104. peg$currPos = s0;
  24105. s0 = peg$FAILED;
  24106. }
  24107. } else {
  24108. peg$currPos = s0;
  24109. s0 = peg$FAILED;
  24110. }
  24111. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24112. return s0;
  24113. }
  24114. function peg$parsedynamicDictionary() {
  24115. var s0, s1, s2, s3, s4;
  24116. var key = peg$currPos * 67 + 25,
  24117. cached = peg$resultsCache[key];
  24118. if (cached) {
  24119. peg$currPos = cached.nextPos;
  24120. return cached.result;
  24121. }
  24122. s0 = peg$currPos;
  24123. if (input.substr(peg$currPos, 2) === peg$c59) {
  24124. s1 = peg$c59;
  24125. peg$currPos += 2;
  24126. } else {
  24127. s1 = peg$FAILED;
  24128. if (peg$silentFails === 0) { peg$fail(peg$c60); }
  24129. }
  24130. if (s1 !== peg$FAILED) {
  24131. s2 = peg$parsewsAssociations();
  24132. if (s2 === peg$FAILED) {
  24133. s2 = null;
  24134. }
  24135. if (s2 !== peg$FAILED) {
  24136. s3 = peg$parsemaybeDotsWs();
  24137. if (s3 !== peg$FAILED) {
  24138. if (input.charCodeAt(peg$currPos) === 125) {
  24139. s4 = peg$c56;
  24140. peg$currPos++;
  24141. } else {
  24142. s4 = peg$FAILED;
  24143. if (peg$silentFails === 0) { peg$fail(peg$c57); }
  24144. }
  24145. if (s4 !== peg$FAILED) {
  24146. peg$savedPos = s0;
  24147. s1 = peg$c61(s2);
  24148. s0 = s1;
  24149. } else {
  24150. peg$currPos = s0;
  24151. s0 = peg$FAILED;
  24152. }
  24153. } else {
  24154. peg$currPos = s0;
  24155. s0 = peg$FAILED;
  24156. }
  24157. } else {
  24158. peg$currPos = s0;
  24159. s0 = peg$FAILED;
  24160. }
  24161. } else {
  24162. peg$currPos = s0;
  24163. s0 = peg$FAILED;
  24164. }
  24165. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24166. return s0;
  24167. }
  24168. function peg$parsepseudoVariable() {
  24169. var s0, s1, s2;
  24170. var key = peg$currPos * 67 + 26,
  24171. cached = peg$resultsCache[key];
  24172. if (cached) {
  24173. peg$currPos = cached.nextPos;
  24174. return cached.result;
  24175. }
  24176. s0 = peg$currPos;
  24177. s1 = peg$currPos;
  24178. if (input.substr(peg$currPos, 4) === peg$c62) {
  24179. s2 = peg$c62;
  24180. peg$currPos += 4;
  24181. } else {
  24182. s2 = peg$FAILED;
  24183. if (peg$silentFails === 0) { peg$fail(peg$c63); }
  24184. }
  24185. if (s2 !== peg$FAILED) {
  24186. peg$savedPos = s1;
  24187. s2 = peg$c64();
  24188. }
  24189. s1 = s2;
  24190. if (s1 === peg$FAILED) {
  24191. s1 = peg$currPos;
  24192. if (input.substr(peg$currPos, 5) === peg$c65) {
  24193. s2 = peg$c65;
  24194. peg$currPos += 5;
  24195. } else {
  24196. s2 = peg$FAILED;
  24197. if (peg$silentFails === 0) { peg$fail(peg$c66); }
  24198. }
  24199. if (s2 !== peg$FAILED) {
  24200. peg$savedPos = s1;
  24201. s2 = peg$c67();
  24202. }
  24203. s1 = s2;
  24204. if (s1 === peg$FAILED) {
  24205. s1 = peg$currPos;
  24206. if (input.substr(peg$currPos, 3) === peg$c68) {
  24207. s2 = peg$c68;
  24208. peg$currPos += 3;
  24209. } else {
  24210. s2 = peg$FAILED;
  24211. if (peg$silentFails === 0) { peg$fail(peg$c69); }
  24212. }
  24213. if (s2 !== peg$FAILED) {
  24214. peg$savedPos = s1;
  24215. s2 = peg$c70();
  24216. }
  24217. s1 = s2;
  24218. }
  24219. }
  24220. if (s1 !== peg$FAILED) {
  24221. peg$savedPos = s0;
  24222. s1 = peg$c16(s1);
  24223. }
  24224. s0 = s1;
  24225. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24226. return s0;
  24227. }
  24228. function peg$parseparseTimeLiteral() {
  24229. var s0;
  24230. var key = peg$currPos * 67 + 27,
  24231. cached = peg$resultsCache[key];
  24232. if (cached) {
  24233. peg$currPos = cached.nextPos;
  24234. return cached.result;
  24235. }
  24236. s0 = peg$parsepseudoVariable();
  24237. if (s0 === peg$FAILED) {
  24238. s0 = peg$parsenumber();
  24239. if (s0 === peg$FAILED) {
  24240. s0 = peg$parseliteralArray();
  24241. if (s0 === peg$FAILED) {
  24242. s0 = peg$parsestring();
  24243. if (s0 === peg$FAILED) {
  24244. s0 = peg$parsesymbol();
  24245. if (s0 === peg$FAILED) {
  24246. s0 = peg$parsecharacter();
  24247. }
  24248. }
  24249. }
  24250. }
  24251. }
  24252. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24253. return s0;
  24254. }
  24255. function peg$parseruntimeLiteral() {
  24256. var s0;
  24257. var key = peg$currPos * 67 + 28,
  24258. cached = peg$resultsCache[key];
  24259. if (cached) {
  24260. peg$currPos = cached.nextPos;
  24261. return cached.result;
  24262. }
  24263. s0 = peg$parsedynamicDictionary();
  24264. if (s0 === peg$FAILED) {
  24265. s0 = peg$parsedynamicArray();
  24266. if (s0 === peg$FAILED) {
  24267. s0 = peg$parseblock();
  24268. }
  24269. }
  24270. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24271. return s0;
  24272. }
  24273. function peg$parseliteral() {
  24274. var s0;
  24275. var key = peg$currPos * 67 + 29,
  24276. cached = peg$resultsCache[key];
  24277. if (cached) {
  24278. peg$currPos = cached.nextPos;
  24279. return cached.result;
  24280. }
  24281. s0 = peg$parseruntimeLiteral();
  24282. if (s0 === peg$FAILED) {
  24283. s0 = peg$parseparseTimeLiteral();
  24284. }
  24285. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24286. return s0;
  24287. }
  24288. function peg$parsevariable() {
  24289. var s0, s1;
  24290. var key = peg$currPos * 67 + 30,
  24291. cached = peg$resultsCache[key];
  24292. if (cached) {
  24293. peg$currPos = cached.nextPos;
  24294. return cached.result;
  24295. }
  24296. s0 = peg$currPos;
  24297. s1 = peg$parseidentifier();
  24298. if (s1 !== peg$FAILED) {
  24299. peg$savedPos = s0;
  24300. s1 = peg$c71(s1);
  24301. }
  24302. s0 = s1;
  24303. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24304. return s0;
  24305. }
  24306. function peg$parsebinarySelector() {
  24307. var s0, s1, s2;
  24308. var key = peg$currPos * 67 + 31,
  24309. cached = peg$resultsCache[key];
  24310. if (cached) {
  24311. peg$currPos = cached.nextPos;
  24312. return cached.result;
  24313. }
  24314. s0 = peg$currPos;
  24315. s1 = [];
  24316. if (peg$c72.test(input.charAt(peg$currPos))) {
  24317. s2 = input.charAt(peg$currPos);
  24318. peg$currPos++;
  24319. } else {
  24320. s2 = peg$FAILED;
  24321. if (peg$silentFails === 0) { peg$fail(peg$c73); }
  24322. }
  24323. if (s2 !== peg$FAILED) {
  24324. while (s2 !== peg$FAILED) {
  24325. s1.push(s2);
  24326. if (peg$c72.test(input.charAt(peg$currPos))) {
  24327. s2 = input.charAt(peg$currPos);
  24328. peg$currPos++;
  24329. } else {
  24330. s2 = peg$FAILED;
  24331. if (peg$silentFails === 0) { peg$fail(peg$c73); }
  24332. }
  24333. }
  24334. } else {
  24335. s1 = peg$FAILED;
  24336. }
  24337. if (s1 !== peg$FAILED) {
  24338. s0 = input.substring(s0, peg$currPos);
  24339. } else {
  24340. s0 = s1;
  24341. }
  24342. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24343. return s0;
  24344. }
  24345. function peg$parsewsKeywordPattern() {
  24346. var s0, s1, s2, s3, s4, s5, s6;
  24347. var key = peg$currPos * 67 + 32,
  24348. cached = peg$resultsCache[key];
  24349. if (cached) {
  24350. peg$currPos = cached.nextPos;
  24351. return cached.result;
  24352. }
  24353. s0 = peg$currPos;
  24354. s1 = [];
  24355. s2 = peg$currPos;
  24356. s3 = peg$parsews();
  24357. if (s3 !== peg$FAILED) {
  24358. s4 = peg$parsekeyword();
  24359. if (s4 !== peg$FAILED) {
  24360. s5 = peg$parsews();
  24361. if (s5 !== peg$FAILED) {
  24362. s6 = peg$parseidentifier();
  24363. if (s6 !== peg$FAILED) {
  24364. peg$savedPos = s2;
  24365. s3 = peg$c74(s4, s6);
  24366. s2 = s3;
  24367. } else {
  24368. peg$currPos = s2;
  24369. s2 = peg$FAILED;
  24370. }
  24371. } else {
  24372. peg$currPos = s2;
  24373. s2 = peg$FAILED;
  24374. }
  24375. } else {
  24376. peg$currPos = s2;
  24377. s2 = peg$FAILED;
  24378. }
  24379. } else {
  24380. peg$currPos = s2;
  24381. s2 = peg$FAILED;
  24382. }
  24383. if (s2 !== peg$FAILED) {
  24384. while (s2 !== peg$FAILED) {
  24385. s1.push(s2);
  24386. s2 = peg$currPos;
  24387. s3 = peg$parsews();
  24388. if (s3 !== peg$FAILED) {
  24389. s4 = peg$parsekeyword();
  24390. if (s4 !== peg$FAILED) {
  24391. s5 = peg$parsews();
  24392. if (s5 !== peg$FAILED) {
  24393. s6 = peg$parseidentifier();
  24394. if (s6 !== peg$FAILED) {
  24395. peg$savedPos = s2;
  24396. s3 = peg$c74(s4, s6);
  24397. s2 = s3;
  24398. } else {
  24399. peg$currPos = s2;
  24400. s2 = peg$FAILED;
  24401. }
  24402. } else {
  24403. peg$currPos = s2;
  24404. s2 = peg$FAILED;
  24405. }
  24406. } else {
  24407. peg$currPos = s2;
  24408. s2 = peg$FAILED;
  24409. }
  24410. } else {
  24411. peg$currPos = s2;
  24412. s2 = peg$FAILED;
  24413. }
  24414. }
  24415. } else {
  24416. s1 = peg$FAILED;
  24417. }
  24418. if (s1 !== peg$FAILED) {
  24419. peg$savedPos = s0;
  24420. s1 = peg$c75(s1);
  24421. }
  24422. s0 = s1;
  24423. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24424. return s0;
  24425. }
  24426. function peg$parsewsBinaryPattern() {
  24427. var s0, s1, s2, s3, s4;
  24428. var key = peg$currPos * 67 + 33,
  24429. cached = peg$resultsCache[key];
  24430. if (cached) {
  24431. peg$currPos = cached.nextPos;
  24432. return cached.result;
  24433. }
  24434. s0 = peg$currPos;
  24435. s1 = peg$parsews();
  24436. if (s1 !== peg$FAILED) {
  24437. s2 = peg$parsebinarySelector();
  24438. if (s2 !== peg$FAILED) {
  24439. s3 = peg$parsews();
  24440. if (s3 !== peg$FAILED) {
  24441. s4 = peg$parseidentifier();
  24442. if (s4 !== peg$FAILED) {
  24443. peg$savedPos = s0;
  24444. s1 = peg$c76(s2, s4);
  24445. s0 = s1;
  24446. } else {
  24447. peg$currPos = s0;
  24448. s0 = peg$FAILED;
  24449. }
  24450. } else {
  24451. peg$currPos = s0;
  24452. s0 = peg$FAILED;
  24453. }
  24454. } else {
  24455. peg$currPos = s0;
  24456. s0 = peg$FAILED;
  24457. }
  24458. } else {
  24459. peg$currPos = s0;
  24460. s0 = peg$FAILED;
  24461. }
  24462. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24463. return s0;
  24464. }
  24465. function peg$parsewsUnaryPattern() {
  24466. var s0, s1, s2;
  24467. var key = peg$currPos * 67 + 34,
  24468. cached = peg$resultsCache[key];
  24469. if (cached) {
  24470. peg$currPos = cached.nextPos;
  24471. return cached.result;
  24472. }
  24473. s0 = peg$currPos;
  24474. s1 = peg$parsews();
  24475. if (s1 !== peg$FAILED) {
  24476. s2 = peg$parseidentifier();
  24477. if (s2 !== peg$FAILED) {
  24478. peg$savedPos = s0;
  24479. s1 = peg$c77(s2);
  24480. s0 = s1;
  24481. } else {
  24482. peg$currPos = s0;
  24483. s0 = peg$FAILED;
  24484. }
  24485. } else {
  24486. peg$currPos = s0;
  24487. s0 = peg$FAILED;
  24488. }
  24489. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24490. return s0;
  24491. }
  24492. function peg$parseexpression() {
  24493. var s0;
  24494. var key = peg$currPos * 67 + 35,
  24495. cached = peg$resultsCache[key];
  24496. if (cached) {
  24497. peg$currPos = cached.nextPos;
  24498. return cached.result;
  24499. }
  24500. s0 = peg$parseassignment();
  24501. if (s0 === peg$FAILED) {
  24502. s0 = peg$parsecascade();
  24503. if (s0 === peg$FAILED) {
  24504. s0 = peg$parsekeywordSend();
  24505. }
  24506. }
  24507. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24508. return s0;
  24509. }
  24510. function peg$parsewsExpressionsRest() {
  24511. var s0, s1, s2;
  24512. var key = peg$currPos * 67 + 36,
  24513. cached = peg$resultsCache[key];
  24514. if (cached) {
  24515. peg$currPos = cached.nextPos;
  24516. return cached.result;
  24517. }
  24518. s0 = peg$currPos;
  24519. s1 = peg$parsesomeDotsWs();
  24520. if (s1 !== peg$FAILED) {
  24521. s2 = peg$parseexpression();
  24522. if (s2 !== peg$FAILED) {
  24523. peg$savedPos = s0;
  24524. s1 = peg$c78(s2);
  24525. s0 = s1;
  24526. } else {
  24527. peg$currPos = s0;
  24528. s0 = peg$FAILED;
  24529. }
  24530. } else {
  24531. peg$currPos = s0;
  24532. s0 = peg$FAILED;
  24533. }
  24534. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24535. return s0;
  24536. }
  24537. function peg$parsewsExpressions() {
  24538. var s0, s1, s2, s3, s4;
  24539. var key = peg$currPos * 67 + 37,
  24540. cached = peg$resultsCache[key];
  24541. if (cached) {
  24542. peg$currPos = cached.nextPos;
  24543. return cached.result;
  24544. }
  24545. s0 = peg$currPos;
  24546. s1 = peg$parsemaybeDotsWs();
  24547. if (s1 !== peg$FAILED) {
  24548. s2 = peg$parseexpression();
  24549. if (s2 !== peg$FAILED) {
  24550. s3 = [];
  24551. s4 = peg$parsewsExpressionsRest();
  24552. while (s4 !== peg$FAILED) {
  24553. s3.push(s4);
  24554. s4 = peg$parsewsExpressionsRest();
  24555. }
  24556. if (s3 !== peg$FAILED) {
  24557. peg$savedPos = s0;
  24558. s1 = peg$c79(s2, s3);
  24559. s0 = s1;
  24560. } else {
  24561. peg$currPos = s0;
  24562. s0 = peg$FAILED;
  24563. }
  24564. } else {
  24565. peg$currPos = s0;
  24566. s0 = peg$FAILED;
  24567. }
  24568. } else {
  24569. peg$currPos = s0;
  24570. s0 = peg$FAILED;
  24571. }
  24572. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24573. return s0;
  24574. }
  24575. function peg$parsewsUnaryPragmaMessage() {
  24576. var s0, s1, s2, s3, s4;
  24577. var key = peg$currPos * 67 + 38,
  24578. cached = peg$resultsCache[key];
  24579. if (cached) {
  24580. peg$currPos = cached.nextPos;
  24581. return cached.result;
  24582. }
  24583. s0 = peg$currPos;
  24584. s1 = peg$parsews();
  24585. if (s1 !== peg$FAILED) {
  24586. s2 = peg$parseidentifier();
  24587. if (s2 !== peg$FAILED) {
  24588. s3 = peg$currPos;
  24589. peg$silentFails++;
  24590. if (input.charCodeAt(peg$currPos) === 58) {
  24591. s4 = peg$c12;
  24592. peg$currPos++;
  24593. } else {
  24594. s4 = peg$FAILED;
  24595. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  24596. }
  24597. peg$silentFails--;
  24598. if (s4 === peg$FAILED) {
  24599. s3 = void 0;
  24600. } else {
  24601. peg$currPos = s3;
  24602. s3 = peg$FAILED;
  24603. }
  24604. if (s3 !== peg$FAILED) {
  24605. peg$savedPos = s0;
  24606. s1 = peg$c80(s2);
  24607. s0 = s1;
  24608. } else {
  24609. peg$currPos = s0;
  24610. s0 = peg$FAILED;
  24611. }
  24612. } else {
  24613. peg$currPos = s0;
  24614. s0 = peg$FAILED;
  24615. }
  24616. } else {
  24617. peg$currPos = s0;
  24618. s0 = peg$FAILED;
  24619. }
  24620. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24621. return s0;
  24622. }
  24623. function peg$parsewsKeywordPragmaMessage() {
  24624. var s0, s1, s2, s3, s4, s5, s6;
  24625. var key = peg$currPos * 67 + 39,
  24626. cached = peg$resultsCache[key];
  24627. if (cached) {
  24628. peg$currPos = cached.nextPos;
  24629. return cached.result;
  24630. }
  24631. s0 = peg$currPos;
  24632. s1 = [];
  24633. s2 = peg$currPos;
  24634. s3 = peg$parsews();
  24635. if (s3 !== peg$FAILED) {
  24636. s4 = peg$parsekeyword();
  24637. if (s4 !== peg$FAILED) {
  24638. s5 = peg$parsews();
  24639. if (s5 !== peg$FAILED) {
  24640. s6 = peg$parseparseTimeLiteral();
  24641. if (s6 !== peg$FAILED) {
  24642. peg$savedPos = s2;
  24643. s3 = peg$c74(s4, s6);
  24644. s2 = s3;
  24645. } else {
  24646. peg$currPos = s2;
  24647. s2 = peg$FAILED;
  24648. }
  24649. } else {
  24650. peg$currPos = s2;
  24651. s2 = peg$FAILED;
  24652. }
  24653. } else {
  24654. peg$currPos = s2;
  24655. s2 = peg$FAILED;
  24656. }
  24657. } else {
  24658. peg$currPos = s2;
  24659. s2 = peg$FAILED;
  24660. }
  24661. if (s2 !== peg$FAILED) {
  24662. while (s2 !== peg$FAILED) {
  24663. s1.push(s2);
  24664. s2 = peg$currPos;
  24665. s3 = peg$parsews();
  24666. if (s3 !== peg$FAILED) {
  24667. s4 = peg$parsekeyword();
  24668. if (s4 !== peg$FAILED) {
  24669. s5 = peg$parsews();
  24670. if (s5 !== peg$FAILED) {
  24671. s6 = peg$parseparseTimeLiteral();
  24672. if (s6 !== peg$FAILED) {
  24673. peg$savedPos = s2;
  24674. s3 = peg$c74(s4, s6);
  24675. s2 = s3;
  24676. } else {
  24677. peg$currPos = s2;
  24678. s2 = peg$FAILED;
  24679. }
  24680. } else {
  24681. peg$currPos = s2;
  24682. s2 = peg$FAILED;
  24683. }
  24684. } else {
  24685. peg$currPos = s2;
  24686. s2 = peg$FAILED;
  24687. }
  24688. } else {
  24689. peg$currPos = s2;
  24690. s2 = peg$FAILED;
  24691. }
  24692. }
  24693. } else {
  24694. s1 = peg$FAILED;
  24695. }
  24696. if (s1 !== peg$FAILED) {
  24697. peg$savedPos = s0;
  24698. s1 = peg$c81(s1);
  24699. }
  24700. s0 = s1;
  24701. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24702. return s0;
  24703. }
  24704. function peg$parsewsPragmaMessage() {
  24705. var s0;
  24706. var key = peg$currPos * 67 + 40,
  24707. cached = peg$resultsCache[key];
  24708. if (cached) {
  24709. peg$currPos = cached.nextPos;
  24710. return cached.result;
  24711. }
  24712. s0 = peg$parsewsUnaryPragmaMessage();
  24713. if (s0 === peg$FAILED) {
  24714. s0 = peg$parsewsKeywordPragmaMessage();
  24715. }
  24716. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24717. return s0;
  24718. }
  24719. function peg$parsewsPragmas() {
  24720. var s0, s1, s2, s3, s4, s5, s6;
  24721. var key = peg$currPos * 67 + 41,
  24722. cached = peg$resultsCache[key];
  24723. if (cached) {
  24724. peg$currPos = cached.nextPos;
  24725. return cached.result;
  24726. }
  24727. s0 = [];
  24728. s1 = peg$currPos;
  24729. s2 = peg$parsews();
  24730. if (s2 !== peg$FAILED) {
  24731. if (input.charCodeAt(peg$currPos) === 60) {
  24732. s3 = peg$c82;
  24733. peg$currPos++;
  24734. } else {
  24735. s3 = peg$FAILED;
  24736. if (peg$silentFails === 0) { peg$fail(peg$c83); }
  24737. }
  24738. if (s3 !== peg$FAILED) {
  24739. s4 = peg$parsewsPragmaMessage();
  24740. if (s4 !== peg$FAILED) {
  24741. s5 = peg$parsews();
  24742. if (s5 !== peg$FAILED) {
  24743. if (input.charCodeAt(peg$currPos) === 62) {
  24744. s6 = peg$c84;
  24745. peg$currPos++;
  24746. } else {
  24747. s6 = peg$FAILED;
  24748. if (peg$silentFails === 0) { peg$fail(peg$c85); }
  24749. }
  24750. if (s6 !== peg$FAILED) {
  24751. peg$savedPos = s1;
  24752. s2 = peg$c86(s4);
  24753. s1 = s2;
  24754. } else {
  24755. peg$currPos = s1;
  24756. s1 = peg$FAILED;
  24757. }
  24758. } else {
  24759. peg$currPos = s1;
  24760. s1 = peg$FAILED;
  24761. }
  24762. } else {
  24763. peg$currPos = s1;
  24764. s1 = peg$FAILED;
  24765. }
  24766. } else {
  24767. peg$currPos = s1;
  24768. s1 = peg$FAILED;
  24769. }
  24770. } else {
  24771. peg$currPos = s1;
  24772. s1 = peg$FAILED;
  24773. }
  24774. while (s1 !== peg$FAILED) {
  24775. s0.push(s1);
  24776. s1 = peg$currPos;
  24777. s2 = peg$parsews();
  24778. if (s2 !== peg$FAILED) {
  24779. if (input.charCodeAt(peg$currPos) === 60) {
  24780. s3 = peg$c82;
  24781. peg$currPos++;
  24782. } else {
  24783. s3 = peg$FAILED;
  24784. if (peg$silentFails === 0) { peg$fail(peg$c83); }
  24785. }
  24786. if (s3 !== peg$FAILED) {
  24787. s4 = peg$parsewsPragmaMessage();
  24788. if (s4 !== peg$FAILED) {
  24789. s5 = peg$parsews();
  24790. if (s5 !== peg$FAILED) {
  24791. if (input.charCodeAt(peg$currPos) === 62) {
  24792. s6 = peg$c84;
  24793. peg$currPos++;
  24794. } else {
  24795. s6 = peg$FAILED;
  24796. if (peg$silentFails === 0) { peg$fail(peg$c85); }
  24797. }
  24798. if (s6 !== peg$FAILED) {
  24799. peg$savedPos = s1;
  24800. s2 = peg$c86(s4);
  24801. s1 = s2;
  24802. } else {
  24803. peg$currPos = s1;
  24804. s1 = peg$FAILED;
  24805. }
  24806. } else {
  24807. peg$currPos = s1;
  24808. s1 = peg$FAILED;
  24809. }
  24810. } else {
  24811. peg$currPos = s1;
  24812. s1 = peg$FAILED;
  24813. }
  24814. } else {
  24815. peg$currPos = s1;
  24816. s1 = peg$FAILED;
  24817. }
  24818. } else {
  24819. peg$currPos = s1;
  24820. s1 = peg$FAILED;
  24821. }
  24822. }
  24823. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24824. return s0;
  24825. }
  24826. function peg$parseassignment() {
  24827. var s0, s1, s2, s3, s4, s5;
  24828. var key = peg$currPos * 67 + 42,
  24829. cached = peg$resultsCache[key];
  24830. if (cached) {
  24831. peg$currPos = cached.nextPos;
  24832. return cached.result;
  24833. }
  24834. s0 = peg$currPos;
  24835. s1 = peg$parsevariable();
  24836. if (s1 !== peg$FAILED) {
  24837. s2 = peg$parsews();
  24838. if (s2 !== peg$FAILED) {
  24839. if (input.substr(peg$currPos, 2) === peg$c87) {
  24840. s3 = peg$c87;
  24841. peg$currPos += 2;
  24842. } else {
  24843. s3 = peg$FAILED;
  24844. if (peg$silentFails === 0) { peg$fail(peg$c88); }
  24845. }
  24846. if (s3 !== peg$FAILED) {
  24847. s4 = peg$parsews();
  24848. if (s4 !== peg$FAILED) {
  24849. s5 = peg$parseexpression();
  24850. if (s5 !== peg$FAILED) {
  24851. peg$savedPos = s0;
  24852. s1 = peg$c89(s1, s5);
  24853. s0 = s1;
  24854. } else {
  24855. peg$currPos = s0;
  24856. s0 = peg$FAILED;
  24857. }
  24858. } else {
  24859. peg$currPos = s0;
  24860. s0 = peg$FAILED;
  24861. }
  24862. } else {
  24863. peg$currPos = s0;
  24864. s0 = peg$FAILED;
  24865. }
  24866. } else {
  24867. peg$currPos = s0;
  24868. s0 = peg$FAILED;
  24869. }
  24870. } else {
  24871. peg$currPos = s0;
  24872. s0 = peg$FAILED;
  24873. }
  24874. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24875. return s0;
  24876. }
  24877. function peg$parseret() {
  24878. var s0, s1, s2, s3;
  24879. var key = peg$currPos * 67 + 43,
  24880. cached = peg$resultsCache[key];
  24881. if (cached) {
  24882. peg$currPos = cached.nextPos;
  24883. return cached.result;
  24884. }
  24885. s0 = peg$currPos;
  24886. if (input.charCodeAt(peg$currPos) === 94) {
  24887. s1 = peg$c90;
  24888. peg$currPos++;
  24889. } else {
  24890. s1 = peg$FAILED;
  24891. if (peg$silentFails === 0) { peg$fail(peg$c91); }
  24892. }
  24893. if (s1 !== peg$FAILED) {
  24894. s2 = peg$parsews();
  24895. if (s2 !== peg$FAILED) {
  24896. s3 = peg$parseexpression();
  24897. if (s3 !== peg$FAILED) {
  24898. peg$savedPos = s0;
  24899. s1 = peg$c92(s3);
  24900. s0 = s1;
  24901. } else {
  24902. peg$currPos = s0;
  24903. s0 = peg$FAILED;
  24904. }
  24905. } else {
  24906. peg$currPos = s0;
  24907. s0 = peg$FAILED;
  24908. }
  24909. } else {
  24910. peg$currPos = s0;
  24911. s0 = peg$FAILED;
  24912. }
  24913. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24914. return s0;
  24915. }
  24916. function peg$parsetemps() {
  24917. var s0, s1, s2, s3, s4, s5;
  24918. var key = peg$currPos * 67 + 44,
  24919. cached = peg$resultsCache[key];
  24920. if (cached) {
  24921. peg$currPos = cached.nextPos;
  24922. return cached.result;
  24923. }
  24924. s0 = peg$currPos;
  24925. if (input.charCodeAt(peg$currPos) === 124) {
  24926. s1 = peg$c93;
  24927. peg$currPos++;
  24928. } else {
  24929. s1 = peg$FAILED;
  24930. if (peg$silentFails === 0) { peg$fail(peg$c94); }
  24931. }
  24932. if (s1 !== peg$FAILED) {
  24933. s2 = [];
  24934. s3 = peg$currPos;
  24935. s4 = peg$parsews();
  24936. if (s4 !== peg$FAILED) {
  24937. s5 = peg$parseidentifier();
  24938. if (s5 !== peg$FAILED) {
  24939. peg$savedPos = s3;
  24940. s4 = peg$c95(s5);
  24941. s3 = s4;
  24942. } else {
  24943. peg$currPos = s3;
  24944. s3 = peg$FAILED;
  24945. }
  24946. } else {
  24947. peg$currPos = s3;
  24948. s3 = peg$FAILED;
  24949. }
  24950. while (s3 !== peg$FAILED) {
  24951. s2.push(s3);
  24952. s3 = peg$currPos;
  24953. s4 = peg$parsews();
  24954. if (s4 !== peg$FAILED) {
  24955. s5 = peg$parseidentifier();
  24956. if (s5 !== peg$FAILED) {
  24957. peg$savedPos = s3;
  24958. s4 = peg$c95(s5);
  24959. s3 = s4;
  24960. } else {
  24961. peg$currPos = s3;
  24962. s3 = peg$FAILED;
  24963. }
  24964. } else {
  24965. peg$currPos = s3;
  24966. s3 = peg$FAILED;
  24967. }
  24968. }
  24969. if (s2 !== peg$FAILED) {
  24970. s3 = peg$parsews();
  24971. if (s3 !== peg$FAILED) {
  24972. if (input.charCodeAt(peg$currPos) === 124) {
  24973. s4 = peg$c93;
  24974. peg$currPos++;
  24975. } else {
  24976. s4 = peg$FAILED;
  24977. if (peg$silentFails === 0) { peg$fail(peg$c94); }
  24978. }
  24979. if (s4 !== peg$FAILED) {
  24980. peg$savedPos = s0;
  24981. s1 = peg$c96(s2);
  24982. s0 = s1;
  24983. } else {
  24984. peg$currPos = s0;
  24985. s0 = peg$FAILED;
  24986. }
  24987. } else {
  24988. peg$currPos = s0;
  24989. s0 = peg$FAILED;
  24990. }
  24991. } else {
  24992. peg$currPos = s0;
  24993. s0 = peg$FAILED;
  24994. }
  24995. } else {
  24996. peg$currPos = s0;
  24997. s0 = peg$FAILED;
  24998. }
  24999. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25000. return s0;
  25001. }
  25002. function peg$parsewsBlockParamList() {
  25003. var s0, s1, s2, s3, s4, s5, s6;
  25004. var key = peg$currPos * 67 + 45,
  25005. cached = peg$resultsCache[key];
  25006. if (cached) {
  25007. peg$currPos = cached.nextPos;
  25008. return cached.result;
  25009. }
  25010. s0 = peg$currPos;
  25011. s1 = [];
  25012. s2 = peg$currPos;
  25013. s3 = peg$parsews();
  25014. if (s3 !== peg$FAILED) {
  25015. if (input.charCodeAt(peg$currPos) === 58) {
  25016. s4 = peg$c12;
  25017. peg$currPos++;
  25018. } else {
  25019. s4 = peg$FAILED;
  25020. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  25021. }
  25022. if (s4 !== peg$FAILED) {
  25023. s5 = peg$parsews();
  25024. if (s5 !== peg$FAILED) {
  25025. s6 = peg$parseidentifier();
  25026. if (s6 !== peg$FAILED) {
  25027. peg$savedPos = s2;
  25028. s3 = peg$c97(s6);
  25029. s2 = s3;
  25030. } else {
  25031. peg$currPos = s2;
  25032. s2 = peg$FAILED;
  25033. }
  25034. } else {
  25035. peg$currPos = s2;
  25036. s2 = peg$FAILED;
  25037. }
  25038. } else {
  25039. peg$currPos = s2;
  25040. s2 = peg$FAILED;
  25041. }
  25042. } else {
  25043. peg$currPos = s2;
  25044. s2 = peg$FAILED;
  25045. }
  25046. if (s2 !== peg$FAILED) {
  25047. while (s2 !== peg$FAILED) {
  25048. s1.push(s2);
  25049. s2 = peg$currPos;
  25050. s3 = peg$parsews();
  25051. if (s3 !== peg$FAILED) {
  25052. if (input.charCodeAt(peg$currPos) === 58) {
  25053. s4 = peg$c12;
  25054. peg$currPos++;
  25055. } else {
  25056. s4 = peg$FAILED;
  25057. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  25058. }
  25059. if (s4 !== peg$FAILED) {
  25060. s5 = peg$parsews();
  25061. if (s5 !== peg$FAILED) {
  25062. s6 = peg$parseidentifier();
  25063. if (s6 !== peg$FAILED) {
  25064. peg$savedPos = s2;
  25065. s3 = peg$c97(s6);
  25066. s2 = s3;
  25067. } else {
  25068. peg$currPos = s2;
  25069. s2 = peg$FAILED;
  25070. }
  25071. } else {
  25072. peg$currPos = s2;
  25073. s2 = peg$FAILED;
  25074. }
  25075. } else {
  25076. peg$currPos = s2;
  25077. s2 = peg$FAILED;
  25078. }
  25079. } else {
  25080. peg$currPos = s2;
  25081. s2 = peg$FAILED;
  25082. }
  25083. }
  25084. } else {
  25085. s1 = peg$FAILED;
  25086. }
  25087. if (s1 !== peg$FAILED) {
  25088. s2 = peg$parsews();
  25089. if (s2 !== peg$FAILED) {
  25090. if (input.charCodeAt(peg$currPos) === 124) {
  25091. s3 = peg$c93;
  25092. peg$currPos++;
  25093. } else {
  25094. s3 = peg$FAILED;
  25095. if (peg$silentFails === 0) { peg$fail(peg$c94); }
  25096. }
  25097. if (s3 !== peg$FAILED) {
  25098. peg$savedPos = s0;
  25099. s1 = peg$c98(s1);
  25100. s0 = s1;
  25101. } else {
  25102. peg$currPos = s0;
  25103. s0 = peg$FAILED;
  25104. }
  25105. } else {
  25106. peg$currPos = s0;
  25107. s0 = peg$FAILED;
  25108. }
  25109. } else {
  25110. peg$currPos = s0;
  25111. s0 = peg$FAILED;
  25112. }
  25113. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25114. return s0;
  25115. }
  25116. function peg$parsesubexpression() {
  25117. var s0, s1, s2, s3, s4, s5;
  25118. var key = peg$currPos * 67 + 46,
  25119. cached = peg$resultsCache[key];
  25120. if (cached) {
  25121. peg$currPos = cached.nextPos;
  25122. return cached.result;
  25123. }
  25124. s0 = peg$currPos;
  25125. if (input.charCodeAt(peg$currPos) === 40) {
  25126. s1 = peg$c51;
  25127. peg$currPos++;
  25128. } else {
  25129. s1 = peg$FAILED;
  25130. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  25131. }
  25132. if (s1 !== peg$FAILED) {
  25133. s2 = peg$parsews();
  25134. if (s2 !== peg$FAILED) {
  25135. s3 = peg$parseexpression();
  25136. if (s3 !== peg$FAILED) {
  25137. s4 = peg$parsews();
  25138. if (s4 !== peg$FAILED) {
  25139. if (input.charCodeAt(peg$currPos) === 41) {
  25140. s5 = peg$c48;
  25141. peg$currPos++;
  25142. } else {
  25143. s5 = peg$FAILED;
  25144. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  25145. }
  25146. if (s5 !== peg$FAILED) {
  25147. peg$savedPos = s0;
  25148. s1 = peg$c78(s3);
  25149. s0 = s1;
  25150. } else {
  25151. peg$currPos = s0;
  25152. s0 = peg$FAILED;
  25153. }
  25154. } else {
  25155. peg$currPos = s0;
  25156. s0 = peg$FAILED;
  25157. }
  25158. } else {
  25159. peg$currPos = s0;
  25160. s0 = peg$FAILED;
  25161. }
  25162. } else {
  25163. peg$currPos = s0;
  25164. s0 = peg$FAILED;
  25165. }
  25166. } else {
  25167. peg$currPos = s0;
  25168. s0 = peg$FAILED;
  25169. }
  25170. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25171. return s0;
  25172. }
  25173. function peg$parsewsStatements() {
  25174. var s0, s1, s2, s3;
  25175. var key = peg$currPos * 67 + 47,
  25176. cached = peg$resultsCache[key];
  25177. if (cached) {
  25178. peg$currPos = cached.nextPos;
  25179. return cached.result;
  25180. }
  25181. s0 = peg$currPos;
  25182. s1 = peg$parsemaybeDotsWs();
  25183. if (s1 !== peg$FAILED) {
  25184. s2 = peg$parseret();
  25185. if (s2 !== peg$FAILED) {
  25186. peg$savedPos = s0;
  25187. s1 = peg$c99(s2);
  25188. s0 = s1;
  25189. } else {
  25190. peg$currPos = s0;
  25191. s0 = peg$FAILED;
  25192. }
  25193. } else {
  25194. peg$currPos = s0;
  25195. s0 = peg$FAILED;
  25196. }
  25197. if (s0 === peg$FAILED) {
  25198. s0 = peg$currPos;
  25199. s1 = peg$parsewsExpressions();
  25200. if (s1 !== peg$FAILED) {
  25201. s2 = peg$parsesomeDotsWs();
  25202. if (s2 !== peg$FAILED) {
  25203. s3 = peg$parseret();
  25204. if (s3 !== peg$FAILED) {
  25205. peg$savedPos = s0;
  25206. s1 = peg$c100(s1, s3);
  25207. s0 = s1;
  25208. } else {
  25209. peg$currPos = s0;
  25210. s0 = peg$FAILED;
  25211. }
  25212. } else {
  25213. peg$currPos = s0;
  25214. s0 = peg$FAILED;
  25215. }
  25216. } else {
  25217. peg$currPos = s0;
  25218. s0 = peg$FAILED;
  25219. }
  25220. if (s0 === peg$FAILED) {
  25221. s0 = peg$currPos;
  25222. s1 = peg$parsewsExpressions();
  25223. if (s1 === peg$FAILED) {
  25224. s1 = null;
  25225. }
  25226. if (s1 !== peg$FAILED) {
  25227. peg$savedPos = s0;
  25228. s1 = peg$c101(s1);
  25229. }
  25230. s0 = s1;
  25231. }
  25232. }
  25233. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25234. return s0;
  25235. }
  25236. function peg$parsewsSequenceWs() {
  25237. var s0, s1, s2, s3, s4, s5, s6;
  25238. var key = peg$currPos * 67 + 48,
  25239. cached = peg$resultsCache[key];
  25240. if (cached) {
  25241. peg$currPos = cached.nextPos;
  25242. return cached.result;
  25243. }
  25244. s0 = peg$currPos;
  25245. s1 = peg$parsewsPragmas();
  25246. if (s1 === peg$FAILED) {
  25247. s1 = null;
  25248. }
  25249. if (s1 !== peg$FAILED) {
  25250. s2 = peg$parsews();
  25251. if (s2 !== peg$FAILED) {
  25252. s3 = peg$parsetemps();
  25253. if (s3 === peg$FAILED) {
  25254. s3 = null;
  25255. }
  25256. if (s3 !== peg$FAILED) {
  25257. s4 = peg$parsewsPragmas();
  25258. if (s4 === peg$FAILED) {
  25259. s4 = null;
  25260. }
  25261. if (s4 !== peg$FAILED) {
  25262. s5 = peg$parsewsStatements();
  25263. if (s5 === peg$FAILED) {
  25264. s5 = null;
  25265. }
  25266. if (s5 !== peg$FAILED) {
  25267. s6 = peg$parsemaybeDotsWs();
  25268. if (s6 !== peg$FAILED) {
  25269. peg$savedPos = s0;
  25270. s1 = peg$c102(s1, s3, s4, s5);
  25271. s0 = s1;
  25272. } else {
  25273. peg$currPos = s0;
  25274. s0 = peg$FAILED;
  25275. }
  25276. } else {
  25277. peg$currPos = s0;
  25278. s0 = peg$FAILED;
  25279. }
  25280. } else {
  25281. peg$currPos = s0;
  25282. s0 = peg$FAILED;
  25283. }
  25284. } else {
  25285. peg$currPos = s0;
  25286. s0 = peg$FAILED;
  25287. }
  25288. } else {
  25289. peg$currPos = s0;
  25290. s0 = peg$FAILED;
  25291. }
  25292. } else {
  25293. peg$currPos = s0;
  25294. s0 = peg$FAILED;
  25295. }
  25296. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25297. return s0;
  25298. }
  25299. function peg$parsewsBlockSequenceWs() {
  25300. var s0, s1, s2, s3, s4;
  25301. var key = peg$currPos * 67 + 49,
  25302. cached = peg$resultsCache[key];
  25303. if (cached) {
  25304. peg$currPos = cached.nextPos;
  25305. return cached.result;
  25306. }
  25307. s0 = peg$currPos;
  25308. s1 = peg$parsews();
  25309. if (s1 !== peg$FAILED) {
  25310. s2 = peg$parsetemps();
  25311. if (s2 === peg$FAILED) {
  25312. s2 = null;
  25313. }
  25314. if (s2 !== peg$FAILED) {
  25315. s3 = peg$parsewsStatements();
  25316. if (s3 === peg$FAILED) {
  25317. s3 = null;
  25318. }
  25319. if (s3 !== peg$FAILED) {
  25320. s4 = peg$parsemaybeDotsWs();
  25321. if (s4 !== peg$FAILED) {
  25322. peg$savedPos = s0;
  25323. s1 = peg$c103(s2, s3);
  25324. s0 = s1;
  25325. } else {
  25326. peg$currPos = s0;
  25327. s0 = peg$FAILED;
  25328. }
  25329. } else {
  25330. peg$currPos = s0;
  25331. s0 = peg$FAILED;
  25332. }
  25333. } else {
  25334. peg$currPos = s0;
  25335. s0 = peg$FAILED;
  25336. }
  25337. } else {
  25338. peg$currPos = s0;
  25339. s0 = peg$FAILED;
  25340. }
  25341. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25342. return s0;
  25343. }
  25344. function peg$parseblock() {
  25345. var s0, s1, s2, s3, s4;
  25346. var key = peg$currPos * 67 + 50,
  25347. cached = peg$resultsCache[key];
  25348. if (cached) {
  25349. peg$currPos = cached.nextPos;
  25350. return cached.result;
  25351. }
  25352. s0 = peg$currPos;
  25353. if (input.charCodeAt(peg$currPos) === 91) {
  25354. s1 = peg$c104;
  25355. peg$currPos++;
  25356. } else {
  25357. s1 = peg$FAILED;
  25358. if (peg$silentFails === 0) { peg$fail(peg$c105); }
  25359. }
  25360. if (s1 !== peg$FAILED) {
  25361. s2 = peg$parsewsBlockParamList();
  25362. if (s2 === peg$FAILED) {
  25363. s2 = null;
  25364. }
  25365. if (s2 !== peg$FAILED) {
  25366. s3 = peg$parsewsBlockSequenceWs();
  25367. if (s3 !== peg$FAILED) {
  25368. if (input.charCodeAt(peg$currPos) === 93) {
  25369. s4 = peg$c106;
  25370. peg$currPos++;
  25371. } else {
  25372. s4 = peg$FAILED;
  25373. if (peg$silentFails === 0) { peg$fail(peg$c107); }
  25374. }
  25375. if (s4 !== peg$FAILED) {
  25376. peg$savedPos = s0;
  25377. s1 = peg$c108(s2, s3);
  25378. s0 = s1;
  25379. } else {
  25380. peg$currPos = s0;
  25381. s0 = peg$FAILED;
  25382. }
  25383. } else {
  25384. peg$currPos = s0;
  25385. s0 = peg$FAILED;
  25386. }
  25387. } else {
  25388. peg$currPos = s0;
  25389. s0 = peg$FAILED;
  25390. }
  25391. } else {
  25392. peg$currPos = s0;
  25393. s0 = peg$FAILED;
  25394. }
  25395. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25396. return s0;
  25397. }
  25398. function peg$parseoperand() {
  25399. var s0;
  25400. var key = peg$currPos * 67 + 51,
  25401. cached = peg$resultsCache[key];
  25402. if (cached) {
  25403. peg$currPos = cached.nextPos;
  25404. return cached.result;
  25405. }
  25406. s0 = peg$parseliteral();
  25407. if (s0 === peg$FAILED) {
  25408. s0 = peg$parsevariable();
  25409. if (s0 === peg$FAILED) {
  25410. s0 = peg$parsesubexpression();
  25411. }
  25412. }
  25413. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25414. return s0;
  25415. }
  25416. function peg$parsewsUnaryMessage() {
  25417. var s0, s1, s2, s3, s4;
  25418. var key = peg$currPos * 67 + 52,
  25419. cached = peg$resultsCache[key];
  25420. if (cached) {
  25421. peg$currPos = cached.nextPos;
  25422. return cached.result;
  25423. }
  25424. s0 = peg$currPos;
  25425. s1 = peg$parsews();
  25426. if (s1 !== peg$FAILED) {
  25427. s2 = peg$parseidentifier();
  25428. if (s2 !== peg$FAILED) {
  25429. s3 = peg$currPos;
  25430. peg$silentFails++;
  25431. if (input.charCodeAt(peg$currPos) === 58) {
  25432. s4 = peg$c12;
  25433. peg$currPos++;
  25434. } else {
  25435. s4 = peg$FAILED;
  25436. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  25437. }
  25438. peg$silentFails--;
  25439. if (s4 === peg$FAILED) {
  25440. s3 = void 0;
  25441. } else {
  25442. peg$currPos = s3;
  25443. s3 = peg$FAILED;
  25444. }
  25445. if (s3 !== peg$FAILED) {
  25446. peg$savedPos = s0;
  25447. s1 = peg$c109(s2);
  25448. s0 = s1;
  25449. } else {
  25450. peg$currPos = s0;
  25451. s0 = peg$FAILED;
  25452. }
  25453. } else {
  25454. peg$currPos = s0;
  25455. s0 = peg$FAILED;
  25456. }
  25457. } else {
  25458. peg$currPos = s0;
  25459. s0 = peg$FAILED;
  25460. }
  25461. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25462. return s0;
  25463. }
  25464. function peg$parsewsUnaryTail() {
  25465. var s0, s1;
  25466. var key = peg$currPos * 67 + 53,
  25467. cached = peg$resultsCache[key];
  25468. if (cached) {
  25469. peg$currPos = cached.nextPos;
  25470. return cached.result;
  25471. }
  25472. s0 = [];
  25473. s1 = peg$parsewsUnaryMessage();
  25474. while (s1 !== peg$FAILED) {
  25475. s0.push(s1);
  25476. s1 = peg$parsewsUnaryMessage();
  25477. }
  25478. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25479. return s0;
  25480. }
  25481. function peg$parseunarySend() {
  25482. var s0, s1, s2;
  25483. var key = peg$currPos * 67 + 54,
  25484. cached = peg$resultsCache[key];
  25485. if (cached) {
  25486. peg$currPos = cached.nextPos;
  25487. return cached.result;
  25488. }
  25489. s0 = peg$currPos;
  25490. s1 = peg$parseoperand();
  25491. if (s1 !== peg$FAILED) {
  25492. s2 = peg$parsewsUnaryTail();
  25493. if (s2 !== peg$FAILED) {
  25494. peg$savedPos = s0;
  25495. s1 = peg$c110(s1, s2);
  25496. s0 = s1;
  25497. } else {
  25498. peg$currPos = s0;
  25499. s0 = peg$FAILED;
  25500. }
  25501. } else {
  25502. peg$currPos = s0;
  25503. s0 = peg$FAILED;
  25504. }
  25505. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25506. return s0;
  25507. }
  25508. function peg$parsewsBinaryMessage() {
  25509. var s0, s1, s2, s3, s4;
  25510. var key = peg$currPos * 67 + 55,
  25511. cached = peg$resultsCache[key];
  25512. if (cached) {
  25513. peg$currPos = cached.nextPos;
  25514. return cached.result;
  25515. }
  25516. s0 = peg$currPos;
  25517. s1 = peg$parsews();
  25518. if (s1 !== peg$FAILED) {
  25519. s2 = peg$parsebinarySelector();
  25520. if (s2 !== peg$FAILED) {
  25521. s3 = peg$parsews();
  25522. if (s3 !== peg$FAILED) {
  25523. s4 = peg$parseunarySend();
  25524. if (s4 !== peg$FAILED) {
  25525. peg$savedPos = s0;
  25526. s1 = peg$c111(s2, s4);
  25527. s0 = s1;
  25528. } else {
  25529. peg$currPos = s0;
  25530. s0 = peg$FAILED;
  25531. }
  25532. } else {
  25533. peg$currPos = s0;
  25534. s0 = peg$FAILED;
  25535. }
  25536. } else {
  25537. peg$currPos = s0;
  25538. s0 = peg$FAILED;
  25539. }
  25540. } else {
  25541. peg$currPos = s0;
  25542. s0 = peg$FAILED;
  25543. }
  25544. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25545. return s0;
  25546. }
  25547. function peg$parsewsBinaryTail() {
  25548. var s0, s1, s2, s3;
  25549. var key = peg$currPos * 67 + 56,
  25550. cached = peg$resultsCache[key];
  25551. if (cached) {
  25552. peg$currPos = cached.nextPos;
  25553. return cached.result;
  25554. }
  25555. s0 = peg$currPos;
  25556. s1 = peg$parsewsUnaryTail();
  25557. if (s1 !== peg$FAILED) {
  25558. s2 = [];
  25559. s3 = peg$parsewsBinaryMessage();
  25560. while (s3 !== peg$FAILED) {
  25561. s2.push(s3);
  25562. s3 = peg$parsewsBinaryMessage();
  25563. }
  25564. if (s2 !== peg$FAILED) {
  25565. peg$savedPos = s0;
  25566. s1 = peg$c112(s1, s2);
  25567. s0 = s1;
  25568. } else {
  25569. peg$currPos = s0;
  25570. s0 = peg$FAILED;
  25571. }
  25572. } else {
  25573. peg$currPos = s0;
  25574. s0 = peg$FAILED;
  25575. }
  25576. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25577. return s0;
  25578. }
  25579. function peg$parsebinarySend() {
  25580. var s0, s1, s2;
  25581. var key = peg$currPos * 67 + 57,
  25582. cached = peg$resultsCache[key];
  25583. if (cached) {
  25584. peg$currPos = cached.nextPos;
  25585. return cached.result;
  25586. }
  25587. s0 = peg$currPos;
  25588. s1 = peg$parseoperand();
  25589. if (s1 !== peg$FAILED) {
  25590. s2 = peg$parsewsBinaryTail();
  25591. if (s2 !== peg$FAILED) {
  25592. peg$savedPos = s0;
  25593. s1 = peg$c110(s1, s2);
  25594. s0 = s1;
  25595. } else {
  25596. peg$currPos = s0;
  25597. s0 = peg$FAILED;
  25598. }
  25599. } else {
  25600. peg$currPos = s0;
  25601. s0 = peg$FAILED;
  25602. }
  25603. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25604. return s0;
  25605. }
  25606. function peg$parsewsKeywordMessage() {
  25607. var s0, s1, s2, s3, s4, s5, s6;
  25608. var key = peg$currPos * 67 + 58,
  25609. cached = peg$resultsCache[key];
  25610. if (cached) {
  25611. peg$currPos = cached.nextPos;
  25612. return cached.result;
  25613. }
  25614. s0 = peg$currPos;
  25615. s1 = [];
  25616. s2 = peg$currPos;
  25617. s3 = peg$parsews();
  25618. if (s3 !== peg$FAILED) {
  25619. s4 = peg$parsekeyword();
  25620. if (s4 !== peg$FAILED) {
  25621. s5 = peg$parsews();
  25622. if (s5 !== peg$FAILED) {
  25623. s6 = peg$parsebinarySend();
  25624. if (s6 !== peg$FAILED) {
  25625. peg$savedPos = s2;
  25626. s3 = peg$c74(s4, s6);
  25627. s2 = s3;
  25628. } else {
  25629. peg$currPos = s2;
  25630. s2 = peg$FAILED;
  25631. }
  25632. } else {
  25633. peg$currPos = s2;
  25634. s2 = peg$FAILED;
  25635. }
  25636. } else {
  25637. peg$currPos = s2;
  25638. s2 = peg$FAILED;
  25639. }
  25640. } else {
  25641. peg$currPos = s2;
  25642. s2 = peg$FAILED;
  25643. }
  25644. if (s2 !== peg$FAILED) {
  25645. while (s2 !== peg$FAILED) {
  25646. s1.push(s2);
  25647. s2 = peg$currPos;
  25648. s3 = peg$parsews();
  25649. if (s3 !== peg$FAILED) {
  25650. s4 = peg$parsekeyword();
  25651. if (s4 !== peg$FAILED) {
  25652. s5 = peg$parsews();
  25653. if (s5 !== peg$FAILED) {
  25654. s6 = peg$parsebinarySend();
  25655. if (s6 !== peg$FAILED) {
  25656. peg$savedPos = s2;
  25657. s3 = peg$c74(s4, s6);
  25658. s2 = s3;
  25659. } else {
  25660. peg$currPos = s2;
  25661. s2 = peg$FAILED;
  25662. }
  25663. } else {
  25664. peg$currPos = s2;
  25665. s2 = peg$FAILED;
  25666. }
  25667. } else {
  25668. peg$currPos = s2;
  25669. s2 = peg$FAILED;
  25670. }
  25671. } else {
  25672. peg$currPos = s2;
  25673. s2 = peg$FAILED;
  25674. }
  25675. }
  25676. } else {
  25677. s1 = peg$FAILED;
  25678. }
  25679. if (s1 !== peg$FAILED) {
  25680. peg$savedPos = s0;
  25681. s1 = peg$c113(s1);
  25682. }
  25683. s0 = s1;
  25684. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25685. return s0;
  25686. }
  25687. function peg$parsewsKeywordTail() {
  25688. var s0, s1, s2;
  25689. var key = peg$currPos * 67 + 59,
  25690. cached = peg$resultsCache[key];
  25691. if (cached) {
  25692. peg$currPos = cached.nextPos;
  25693. return cached.result;
  25694. }
  25695. s0 = peg$currPos;
  25696. s1 = peg$parsewsBinaryTail();
  25697. if (s1 !== peg$FAILED) {
  25698. s2 = peg$parsewsKeywordMessage();
  25699. if (s2 === peg$FAILED) {
  25700. s2 = null;
  25701. }
  25702. if (s2 !== peg$FAILED) {
  25703. peg$savedPos = s0;
  25704. s1 = peg$c114(s1, s2);
  25705. s0 = s1;
  25706. } else {
  25707. peg$currPos = s0;
  25708. s0 = peg$FAILED;
  25709. }
  25710. } else {
  25711. peg$currPos = s0;
  25712. s0 = peg$FAILED;
  25713. }
  25714. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25715. return s0;
  25716. }
  25717. function peg$parsekeywordSend() {
  25718. var s0, s1, s2;
  25719. var key = peg$currPos * 67 + 60,
  25720. cached = peg$resultsCache[key];
  25721. if (cached) {
  25722. peg$currPos = cached.nextPos;
  25723. return cached.result;
  25724. }
  25725. s0 = peg$currPos;
  25726. s1 = peg$parseoperand();
  25727. if (s1 !== peg$FAILED) {
  25728. s2 = peg$parsewsKeywordTail();
  25729. if (s2 !== peg$FAILED) {
  25730. peg$savedPos = s0;
  25731. s1 = peg$c110(s1, s2);
  25732. s0 = s1;
  25733. } else {
  25734. peg$currPos = s0;
  25735. s0 = peg$FAILED;
  25736. }
  25737. } else {
  25738. peg$currPos = s0;
  25739. s0 = peg$FAILED;
  25740. }
  25741. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25742. return s0;
  25743. }
  25744. function peg$parsewsMessage() {
  25745. var s0;
  25746. var key = peg$currPos * 67 + 61,
  25747. cached = peg$resultsCache[key];
  25748. if (cached) {
  25749. peg$currPos = cached.nextPos;
  25750. return cached.result;
  25751. }
  25752. s0 = peg$parsewsBinaryMessage();
  25753. if (s0 === peg$FAILED) {
  25754. s0 = peg$parsewsUnaryMessage();
  25755. if (s0 === peg$FAILED) {
  25756. s0 = peg$parsewsKeywordMessage();
  25757. }
  25758. }
  25759. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25760. return s0;
  25761. }
  25762. function peg$parsecascade() {
  25763. var s0, s1, s2, s3, s4, s5, s6, s7, s8;
  25764. var key = peg$currPos * 67 + 62,
  25765. cached = peg$resultsCache[key];
  25766. if (cached) {
  25767. peg$currPos = cached.nextPos;
  25768. return cached.result;
  25769. }
  25770. s0 = peg$currPos;
  25771. s1 = peg$parseoperand();
  25772. if (s1 !== peg$FAILED) {
  25773. s2 = peg$parsewsKeywordTail();
  25774. if (s2 !== peg$FAILED) {
  25775. peg$savedPos = peg$currPos;
  25776. s3 = peg$c115(s1, s2);
  25777. if (s3) {
  25778. s3 = void 0;
  25779. } else {
  25780. s3 = peg$FAILED;
  25781. }
  25782. if (s3 !== peg$FAILED) {
  25783. s4 = [];
  25784. s5 = peg$currPos;
  25785. s6 = peg$parsews();
  25786. if (s6 !== peg$FAILED) {
  25787. if (input.charCodeAt(peg$currPos) === 59) {
  25788. s7 = peg$c116;
  25789. peg$currPos++;
  25790. } else {
  25791. s7 = peg$FAILED;
  25792. if (peg$silentFails === 0) { peg$fail(peg$c117); }
  25793. }
  25794. if (s7 !== peg$FAILED) {
  25795. s8 = peg$parsewsMessage();
  25796. if (s8 !== peg$FAILED) {
  25797. peg$savedPos = s5;
  25798. s6 = peg$c118(s1, s2, s8);
  25799. s5 = s6;
  25800. } else {
  25801. peg$currPos = s5;
  25802. s5 = peg$FAILED;
  25803. }
  25804. } else {
  25805. peg$currPos = s5;
  25806. s5 = peg$FAILED;
  25807. }
  25808. } else {
  25809. peg$currPos = s5;
  25810. s5 = peg$FAILED;
  25811. }
  25812. if (s5 !== peg$FAILED) {
  25813. while (s5 !== peg$FAILED) {
  25814. s4.push(s5);
  25815. s5 = peg$currPos;
  25816. s6 = peg$parsews();
  25817. if (s6 !== peg$FAILED) {
  25818. if (input.charCodeAt(peg$currPos) === 59) {
  25819. s7 = peg$c116;
  25820. peg$currPos++;
  25821. } else {
  25822. s7 = peg$FAILED;
  25823. if (peg$silentFails === 0) { peg$fail(peg$c117); }
  25824. }
  25825. if (s7 !== peg$FAILED) {
  25826. s8 = peg$parsewsMessage();
  25827. if (s8 !== peg$FAILED) {
  25828. peg$savedPos = s5;
  25829. s6 = peg$c118(s1, s2, s8);
  25830. s5 = s6;
  25831. } else {
  25832. peg$currPos = s5;
  25833. s5 = peg$FAILED;
  25834. }
  25835. } else {
  25836. peg$currPos = s5;
  25837. s5 = peg$FAILED;
  25838. }
  25839. } else {
  25840. peg$currPos = s5;
  25841. s5 = peg$FAILED;
  25842. }
  25843. }
  25844. } else {
  25845. s4 = peg$FAILED;
  25846. }
  25847. if (s4 !== peg$FAILED) {
  25848. peg$savedPos = s0;
  25849. s1 = peg$c119(s1, s2, s4);
  25850. s0 = s1;
  25851. } else {
  25852. peg$currPos = s0;
  25853. s0 = peg$FAILED;
  25854. }
  25855. } else {
  25856. peg$currPos = s0;
  25857. s0 = peg$FAILED;
  25858. }
  25859. } else {
  25860. peg$currPos = s0;
  25861. s0 = peg$FAILED;
  25862. }
  25863. } else {
  25864. peg$currPos = s0;
  25865. s0 = peg$FAILED;
  25866. }
  25867. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25868. return s0;
  25869. }
  25870. function peg$parsemethod() {
  25871. var s0, s1, s2;
  25872. var key = peg$currPos * 67 + 63,
  25873. cached = peg$resultsCache[key];
  25874. if (cached) {
  25875. peg$currPos = cached.nextPos;
  25876. return cached.result;
  25877. }
  25878. s0 = peg$currPos;
  25879. s1 = peg$parsewsKeywordPattern();
  25880. if (s1 === peg$FAILED) {
  25881. s1 = peg$parsewsBinaryPattern();
  25882. if (s1 === peg$FAILED) {
  25883. s1 = peg$parsewsUnaryPattern();
  25884. }
  25885. }
  25886. if (s1 !== peg$FAILED) {
  25887. s2 = peg$parsewsSequenceWs();
  25888. if (s2 !== peg$FAILED) {
  25889. peg$savedPos = s0;
  25890. s1 = peg$c120(s1, s2);
  25891. s0 = s1;
  25892. } else {
  25893. peg$currPos = s0;
  25894. s0 = peg$FAILED;
  25895. }
  25896. } else {
  25897. peg$currPos = s0;
  25898. s0 = peg$FAILED;
  25899. }
  25900. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25901. return s0;
  25902. }
  25903. function peg$parseassociationSend() {
  25904. var s0, s1, s2, s3;
  25905. var key = peg$currPos * 67 + 64,
  25906. cached = peg$resultsCache[key];
  25907. if (cached) {
  25908. peg$currPos = cached.nextPos;
  25909. return cached.result;
  25910. }
  25911. s0 = peg$currPos;
  25912. s1 = peg$parseoperand();
  25913. if (s1 !== peg$FAILED) {
  25914. s2 = peg$parsewsBinaryTail();
  25915. if (s2 !== peg$FAILED) {
  25916. peg$savedPos = peg$currPos;
  25917. s3 = peg$c121(s1, s2);
  25918. if (s3) {
  25919. s3 = void 0;
  25920. } else {
  25921. s3 = peg$FAILED;
  25922. }
  25923. if (s3 !== peg$FAILED) {
  25924. peg$savedPos = s0;
  25925. s1 = peg$c122(s1, s2);
  25926. s0 = s1;
  25927. } else {
  25928. peg$currPos = s0;
  25929. s0 = peg$FAILED;
  25930. }
  25931. } else {
  25932. peg$currPos = s0;
  25933. s0 = peg$FAILED;
  25934. }
  25935. } else {
  25936. peg$currPos = s0;
  25937. s0 = peg$FAILED;
  25938. }
  25939. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25940. return s0;
  25941. }
  25942. function peg$parsewsAssociationsRest() {
  25943. var s0, s1, s2;
  25944. var key = peg$currPos * 67 + 65,
  25945. cached = peg$resultsCache[key];
  25946. if (cached) {
  25947. peg$currPos = cached.nextPos;
  25948. return cached.result;
  25949. }
  25950. s0 = peg$currPos;
  25951. s1 = peg$parsesomeDotsWs();
  25952. if (s1 !== peg$FAILED) {
  25953. s2 = peg$parseassociationSend();
  25954. if (s2 !== peg$FAILED) {
  25955. peg$savedPos = s0;
  25956. s1 = peg$c78(s2);
  25957. s0 = s1;
  25958. } else {
  25959. peg$currPos = s0;
  25960. s0 = peg$FAILED;
  25961. }
  25962. } else {
  25963. peg$currPos = s0;
  25964. s0 = peg$FAILED;
  25965. }
  25966. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25967. return s0;
  25968. }
  25969. function peg$parsewsAssociations() {
  25970. var s0, s1, s2, s3, s4;
  25971. var key = peg$currPos * 67 + 66,
  25972. cached = peg$resultsCache[key];
  25973. if (cached) {
  25974. peg$currPos = cached.nextPos;
  25975. return cached.result;
  25976. }
  25977. s0 = peg$currPos;
  25978. s1 = peg$parsemaybeDotsWs();
  25979. if (s1 !== peg$FAILED) {
  25980. s2 = peg$parseassociationSend();
  25981. if (s2 !== peg$FAILED) {
  25982. s3 = [];
  25983. s4 = peg$parsewsAssociationsRest();
  25984. while (s4 !== peg$FAILED) {
  25985. s3.push(s4);
  25986. s4 = peg$parsewsAssociationsRest();
  25987. }
  25988. if (s3 !== peg$FAILED) {
  25989. peg$savedPos = s0;
  25990. s1 = peg$c123(s2, s3);
  25991. s0 = s1;
  25992. } else {
  25993. peg$currPos = s0;
  25994. s0 = peg$FAILED;
  25995. }
  25996. } else {
  25997. peg$currPos = s0;
  25998. s0 = peg$FAILED;
  25999. }
  26000. } else {
  26001. peg$currPos = s0;
  26002. s0 = peg$FAILED;
  26003. }
  26004. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26005. return s0;
  26006. }
  26007. var $globals = __boot.globals;
  26008. function newNode(nodeClass) {
  26009. return nodeClass._new()._location_(location())._source_(text());
  26010. }
  26011. peg$result = peg$startRuleFunction();
  26012. if (peg$result !== peg$FAILED && peg$currPos === input.length) {
  26013. return peg$result;
  26014. } else {
  26015. if (peg$result !== peg$FAILED && peg$currPos < input.length) {
  26016. peg$fail(peg$endExpectation());
  26017. }
  26018. throw peg$buildStructuredError(
  26019. peg$maxFailExpected,
  26020. peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
  26021. peg$maxFailPos < input.length
  26022. ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
  26023. : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
  26024. );
  26025. }
  26026. }
  26027. return {
  26028. SyntaxError: peg$SyntaxError,
  26029. parse: peg$parse
  26030. };
  26031. });
  26032. define('amber/core/Kernel-Infrastructure',["amber/boot", "require", "amber/core/Kernel-Collections", "amber/core/Kernel-Exceptions", "amber/core/Kernel-Objects", "amber/core/Kernel-Promises"], function($boot,requirejs){"use strict";
  26033. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  26034. var $pkg = $core.addPackage("Kernel-Infrastructure");
  26035. $pkg.innerEval = function (expr) { return eval(expr); };
  26036. $pkg.imports = ["smalltalkParser=amber/parser"];
  26037. var smalltalkParser;
  26038. $pkg.isReady = new Promise(function (resolve, reject) { requirejs(["amber/parser"], function ($1) {smalltalkParser=$1; resolve();}, reject); });
  26039. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  26040. $core.addClass("AmberBootstrapInitialization", $globals.Object, [], "Kernel-Infrastructure");
  26041. $core.addMethod(
  26042. $core.method({
  26043. selector: "organizeClasses",
  26044. protocol: "organization",
  26045. fn: function (){
  26046. var self=this,$self=this;
  26047. return $core.withContext(function($ctx1) {
  26048. $recv($recv($globals.Smalltalk)._classes())._do_((function(each){
  26049. return $core.withContext(function($ctx2) {
  26050. return $recv(each)._enterOrganization();
  26051. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26052. }));
  26053. return self;
  26054. }, function($ctx1) {$ctx1.fill(self,"organizeClasses",{})});
  26055. },
  26056. args: [],
  26057. source: "organizeClasses\x0a\x09Smalltalk classes do: [ :each | each enterOrganization ]",
  26058. referencedClasses: ["Smalltalk"],
  26059. pragmas: [],
  26060. messageSends: ["do:", "classes", "enterOrganization"]
  26061. }),
  26062. $globals.AmberBootstrapInitialization.a$cls);
  26063. $core.addMethod(
  26064. $core.method({
  26065. selector: "organizeMethods",
  26066. protocol: "organization",
  26067. fn: function (){
  26068. var self=this,$self=this;
  26069. return $core.withContext(function($ctx1) {
  26070. $recv($recv($globals.Smalltalk)._classes())._do_((function(eachClass){
  26071. return $core.withContext(function($ctx2) {
  26072. return $recv($recv(eachClass)._definedMethods())._do_((function(eachMethod){
  26073. return $core.withContext(function($ctx3) {
  26074. return $recv($recv(eachMethod)._methodClass())._methodOrganizationEnter_andLeave_(eachMethod,nil);
  26075. }, function($ctx3) {$ctx3.fillBlock({eachMethod:eachMethod},$ctx2,2)});
  26076. }));
  26077. }, function($ctx2) {$ctx2.fillBlock({eachClass:eachClass},$ctx1,1)});
  26078. }));
  26079. $ctx1.sendIdx["do:"]=1;
  26080. return self;
  26081. }, function($ctx1) {$ctx1.fill(self,"organizeMethods",{})});
  26082. },
  26083. args: [],
  26084. source: "organizeMethods\x0a\x09Smalltalk classes do: [ :eachClass |\x0a\x09\x09eachClass definedMethods do: [ :eachMethod |\x0a\x09\x09\x09eachMethod methodClass methodOrganizationEnter: eachMethod andLeave: nil ] ]",
  26085. referencedClasses: ["Smalltalk"],
  26086. pragmas: [],
  26087. messageSends: ["do:", "classes", "definedMethods", "methodOrganizationEnter:andLeave:", "methodClass"]
  26088. }),
  26089. $globals.AmberBootstrapInitialization.a$cls);
  26090. $core.addMethod(
  26091. $core.method({
  26092. selector: "run",
  26093. protocol: "public api",
  26094. fn: function (){
  26095. var self=this,$self=this;
  26096. return $core.withContext(function($ctx1) {
  26097. $recv($globals.SmalltalkImage)._initialize();
  26098. $self._organizeClasses();
  26099. $self._organizeMethods();
  26100. return $recv($recv($globals.Smalltalk)._postLoad())._then_((function(){
  26101. return $core.withContext(function($ctx2) {
  26102. return $recv($recv($globals.Smalltalk)._globals())._at_put_("SmalltalkParser",smalltalkParser);
  26103. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  26104. }));
  26105. }, function($ctx1) {$ctx1.fill(self,"run",{})});
  26106. },
  26107. args: [],
  26108. source: "run\x0a\x09SmalltalkImage initialize.\x0a\x09self\x0a\x09\x09organizeClasses;\x0a\x09\x09organizeMethods.\x0a\x09^ Smalltalk postLoad\x0a\x09\x09\x22TODO remove, backward compat\x22\x0a\x09\x09then: [ Smalltalk globals at: #SmalltalkParser put: smalltalkParser ]",
  26109. referencedClasses: ["SmalltalkImage", "Smalltalk"],
  26110. pragmas: [],
  26111. messageSends: ["initialize", "organizeClasses", "organizeMethods", "then:", "postLoad", "at:put:", "globals"]
  26112. }),
  26113. $globals.AmberBootstrapInitialization.a$cls);
  26114. $core.addClass("JSObjectProxy", $globals.ProtoObject, ["jsObject"], "Kernel-Infrastructure");
  26115. $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`.";
  26116. $core.addMethod(
  26117. $core.method({
  26118. selector: "=",
  26119. protocol: "comparing",
  26120. fn: function (anObject){
  26121. var self=this,$self=this;
  26122. return $core.withContext(function($ctx1) {
  26123. var $2,$1;
  26124. $2=$recv(anObject)._class();
  26125. $ctx1.sendIdx["class"]=1;
  26126. $1=$recv($2).__eq_eq($self._class());
  26127. if(!$core.assert($1)){
  26128. return false;
  26129. }
  26130. return $recv($globals.JSObjectProxy)._compareJSObjectOfProxy_withProxy_(self,anObject);
  26131. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject})});
  26132. },
  26133. args: ["anObject"],
  26134. source: "= anObject\x0a\x09anObject class == self class ifFalse: [ ^ false ].\x0a\x09^ JSObjectProxy compareJSObjectOfProxy: self withProxy: anObject",
  26135. referencedClasses: ["JSObjectProxy"],
  26136. pragmas: [],
  26137. messageSends: ["ifFalse:", "==", "class", "compareJSObjectOfProxy:withProxy:"]
  26138. }),
  26139. $globals.JSObjectProxy);
  26140. $core.addMethod(
  26141. $core.method({
  26142. selector: "asJavaScriptObject",
  26143. protocol: "converting",
  26144. fn: function (){
  26145. var self=this,$self=this;
  26146. return $self.jsObject;
  26147. },
  26148. args: [],
  26149. source: "asJavaScriptObject\x0a\x09\x22Answers the receiver in a stringify-friendly fashion\x22\x0a\x0a\x09^ jsObject",
  26150. referencedClasses: [],
  26151. pragmas: [],
  26152. messageSends: []
  26153. }),
  26154. $globals.JSObjectProxy);
  26155. $core.addMethod(
  26156. $core.method({
  26157. selector: "at:",
  26158. protocol: "accessing",
  26159. fn: function (aString){
  26160. var self=this,$self=this;
  26161. return $core.withContext(function($ctx1) {
  26162. return $self.jsObject[aString];
  26163. return self;
  26164. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString})});
  26165. },
  26166. args: ["aString"],
  26167. source: "at: aString\x0a\x09<inlineJS: 'return $self.jsObject[aString]'>",
  26168. referencedClasses: [],
  26169. pragmas: [["inlineJS:", ["return $self.jsObject[aString]"]]],
  26170. messageSends: []
  26171. }),
  26172. $globals.JSObjectProxy);
  26173. $core.addMethod(
  26174. $core.method({
  26175. selector: "at:ifAbsent:",
  26176. protocol: "accessing",
  26177. fn: function (aString,aBlock){
  26178. var self=this,$self=this;
  26179. return $core.withContext(function($ctx1) {
  26180. var obj = $self.jsObject;
  26181. return aString in obj ? obj[aString] : aBlock._value();
  26182. ;
  26183. return self;
  26184. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock})});
  26185. },
  26186. args: ["aString", "aBlock"],
  26187. 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'>",
  26188. referencedClasses: [],
  26189. pragmas: [["inlineJS:", ["\x0a\x09\x09var obj = $self.jsObject;\x0a\x09\x09return aString in obj ? obj[aString] : aBlock._value();\x0a\x09"]]],
  26190. messageSends: []
  26191. }),
  26192. $globals.JSObjectProxy);
  26193. $core.addMethod(
  26194. $core.method({
  26195. selector: "at:ifPresent:",
  26196. protocol: "accessing",
  26197. fn: function (aString,aBlock){
  26198. var self=this,$self=this;
  26199. return $core.withContext(function($ctx1) {
  26200. var obj = $self.jsObject;
  26201. return aString in obj ? aBlock._value_(obj[aString]) : nil;
  26202. ;
  26203. return self;
  26204. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock})});
  26205. },
  26206. args: ["aString", "aBlock"],
  26207. 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'>",
  26208. referencedClasses: [],
  26209. pragmas: [["inlineJS:", ["\x0a\x09\x09var obj = $self.jsObject;\x0a\x09\x09return aString in obj ? aBlock._value_(obj[aString]) : nil;\x0a\x09"]]],
  26210. messageSends: []
  26211. }),
  26212. $globals.JSObjectProxy);
  26213. $core.addMethod(
  26214. $core.method({
  26215. selector: "at:ifPresent:ifAbsent:",
  26216. protocol: "accessing",
  26217. fn: function (aString,aBlock,anotherBlock){
  26218. var self=this,$self=this;
  26219. return $core.withContext(function($ctx1) {
  26220. var obj = $self.jsObject;
  26221. return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();
  26222. ;
  26223. return self;
  26224. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock})});
  26225. },
  26226. args: ["aString", "aBlock", "anotherBlock"],
  26227. 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'>",
  26228. referencedClasses: [],
  26229. pragmas: [["inlineJS:", ["\x0a\x09\x09var obj = $self.jsObject;\x0a\x09\x09return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();\x0a\x09"]]],
  26230. messageSends: []
  26231. }),
  26232. $globals.JSObjectProxy);
  26233. $core.addMethod(
  26234. $core.method({
  26235. selector: "at:put:",
  26236. protocol: "accessing",
  26237. fn: function (aString,anObject){
  26238. var self=this,$self=this;
  26239. return $core.withContext(function($ctx1) {
  26240. return $self.jsObject[aString] = anObject;
  26241. return self;
  26242. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject})});
  26243. },
  26244. args: ["aString", "anObject"],
  26245. source: "at: aString put: anObject\x0a\x09<inlineJS: 'return $self.jsObject[aString] = anObject'>",
  26246. referencedClasses: [],
  26247. pragmas: [["inlineJS:", ["return $self.jsObject[aString] = anObject"]]],
  26248. messageSends: []
  26249. }),
  26250. $globals.JSObjectProxy);
  26251. $core.addMethod(
  26252. $core.method({
  26253. selector: "catch:",
  26254. protocol: "promises",
  26255. fn: function (aBlock){
  26256. var self=this,$self=this;
  26257. return $core.withContext(function($ctx1) {
  26258. var $1,$2;
  26259. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  26260. if($core.assert($1)){
  26261. return $recv($recv($globals.TThenable).__gt_gt("catch:"))._sendTo_arguments_($self.jsObject,[aBlock]);
  26262. } else {
  26263. $2=(
  26264. $ctx1.supercall = true,
  26265. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._catch_.apply($self, [aBlock]));
  26266. $ctx1.supercall = false;
  26267. return $2;
  26268. }
  26269. return self;
  26270. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock})});
  26271. },
  26272. args: ["aBlock"],
  26273. source: "catch: aBlock\x0a(NativeFunction isNativeFunction: (self at: #then))\x0a\x09ifTrue: [ ^ (TThenable >> #catch:) sendTo: jsObject arguments: {aBlock} ]\x0a\x09ifFalse: [ ^ super catch: aBlock ]",
  26274. referencedClasses: ["NativeFunction", "TThenable"],
  26275. pragmas: [],
  26276. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "catch:"]
  26277. }),
  26278. $globals.JSObjectProxy);
  26279. $core.addMethod(
  26280. $core.method({
  26281. selector: "doesNotUnderstand:",
  26282. protocol: "proxy",
  26283. fn: function (aMessage){
  26284. var self=this,$self=this;
  26285. return $core.withContext(function($ctx1) {
  26286. var $1,$receiver;
  26287. $1=$recv($globals.JSObjectProxy)._lookupProperty_ofProxy_($recv($recv(aMessage)._selector())._asJavaScriptPropertyName(),self);
  26288. if(($receiver = $1) == null || $receiver.a$nil){
  26289. return (
  26290. $ctx1.supercall = true,
  26291. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._doesNotUnderstand_.apply($self, [aMessage]));
  26292. $ctx1.supercall = false;
  26293. } else {
  26294. var jsSelector;
  26295. jsSelector=$receiver;
  26296. return $recv($globals.JSObjectProxy)._forwardMessage_withArguments_ofProxy_(jsSelector,$recv(aMessage)._arguments(),self);
  26297. }
  26298. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage})});
  26299. },
  26300. args: ["aMessage"],
  26301. 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 ]",
  26302. referencedClasses: ["JSObjectProxy"],
  26303. pragmas: [],
  26304. messageSends: ["ifNil:ifNotNil:", "lookupProperty:ofProxy:", "asJavaScriptPropertyName", "selector", "doesNotUnderstand:", "forwardMessage:withArguments:ofProxy:", "arguments"]
  26305. }),
  26306. $globals.JSObjectProxy);
  26307. $core.addMethod(
  26308. $core.method({
  26309. selector: "in:",
  26310. protocol: "accessing",
  26311. fn: function (aValuable){
  26312. var self=this,$self=this;
  26313. return $core.withContext(function($ctx1) {
  26314. return $recv(aValuable)._value_($self.jsObject);
  26315. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable})});
  26316. },
  26317. args: ["aValuable"],
  26318. source: "in: aValuable\x0a\x09^ aValuable value: jsObject",
  26319. referencedClasses: [],
  26320. pragmas: [],
  26321. messageSends: ["value:"]
  26322. }),
  26323. $globals.JSObjectProxy);
  26324. $core.addMethod(
  26325. $core.method({
  26326. selector: "jsObject",
  26327. protocol: "accessing",
  26328. fn: function (){
  26329. var self=this,$self=this;
  26330. return $self.jsObject;
  26331. },
  26332. args: [],
  26333. source: "jsObject\x0a\x09^ jsObject",
  26334. referencedClasses: [],
  26335. pragmas: [],
  26336. messageSends: []
  26337. }),
  26338. $globals.JSObjectProxy);
  26339. $core.addMethod(
  26340. $core.method({
  26341. selector: "keysAndValuesDo:",
  26342. protocol: "enumerating",
  26343. fn: function (aBlock){
  26344. var self=this,$self=this;
  26345. return $core.withContext(function($ctx1) {
  26346. var o = $self.jsObject;
  26347. for(var i in o) {
  26348. aBlock._value_value_(i, o[i]);
  26349. }
  26350. ;
  26351. return self;
  26352. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock})});
  26353. },
  26354. args: ["aBlock"],
  26355. 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'>",
  26356. referencedClasses: [],
  26357. 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"]]],
  26358. messageSends: []
  26359. }),
  26360. $globals.JSObjectProxy);
  26361. $core.addMethod(
  26362. $core.method({
  26363. selector: "on:do:",
  26364. protocol: "promises",
  26365. fn: function (aClass,aBlock){
  26366. var self=this,$self=this;
  26367. return $core.withContext(function($ctx1) {
  26368. var $1,$2;
  26369. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  26370. if($core.assert($1)){
  26371. return $recv($recv($globals.TThenable).__gt_gt("on:do:"))._sendTo_arguments_($self.jsObject,[aClass,aBlock]);
  26372. } else {
  26373. $2=(
  26374. $ctx1.supercall = true,
  26375. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._on_do_.apply($self, [aClass,aBlock]));
  26376. $ctx1.supercall = false;
  26377. return $2;
  26378. }
  26379. return self;
  26380. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock})});
  26381. },
  26382. args: ["aClass", "aBlock"],
  26383. 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 ]",
  26384. referencedClasses: ["NativeFunction", "TThenable"],
  26385. pragmas: [],
  26386. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "on:do:"]
  26387. }),
  26388. $globals.JSObjectProxy);
  26389. $core.addMethod(
  26390. $core.method({
  26391. selector: "printOn:",
  26392. protocol: "printing",
  26393. fn: function (aStream){
  26394. var self=this,$self=this;
  26395. return $core.withContext(function($ctx1) {
  26396. $recv(aStream)._nextPutAll_($self._printString());
  26397. return self;
  26398. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  26399. },
  26400. args: ["aStream"],
  26401. source: "printOn: aStream\x0a\x09aStream nextPutAll: self printString",
  26402. referencedClasses: [],
  26403. pragmas: [],
  26404. messageSends: ["nextPutAll:", "printString"]
  26405. }),
  26406. $globals.JSObjectProxy);
  26407. $core.addMethod(
  26408. $core.method({
  26409. selector: "printString",
  26410. protocol: "printing",
  26411. fn: function (){
  26412. var self=this,$self=this;
  26413. return $core.withContext(function($ctx1) {
  26414. var js = $self.jsObject;
  26415. return js.toString
  26416. ? js.toString()
  26417. : Object.prototype.toString.call(js)
  26418. ;
  26419. return self;
  26420. }, function($ctx1) {$ctx1.fill(self,"printString",{})});
  26421. },
  26422. args: [],
  26423. source: "printString\x0a\x09<inlineJS: '\x0a\x09\x09var js = $self.jsObject;\x0a\x09\x09return js.toString\x0a\x09\x09\x09? js.toString()\x0a\x09\x09\x09: Object.prototype.toString.call(js)\x0a\x09'>",
  26424. referencedClasses: [],
  26425. pragmas: [["inlineJS:", ["\x0a\x09\x09var js = $self.jsObject;\x0a\x09\x09return js.toString\x0a\x09\x09\x09? js.toString()\x0a\x09\x09\x09: Object.prototype.toString.call(js)\x0a\x09"]]],
  26426. messageSends: []
  26427. }),
  26428. $globals.JSObjectProxy);
  26429. $core.addMethod(
  26430. $core.method({
  26431. selector: "putOn:",
  26432. protocol: "streaming",
  26433. fn: function (aStream){
  26434. var self=this,$self=this;
  26435. return $core.withContext(function($ctx1) {
  26436. $recv(aStream)._nextPutJSObject_($self.jsObject);
  26437. return self;
  26438. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream})});
  26439. },
  26440. args: ["aStream"],
  26441. source: "putOn: aStream\x0a\x09aStream nextPutJSObject: jsObject",
  26442. referencedClasses: [],
  26443. pragmas: [],
  26444. messageSends: ["nextPutJSObject:"]
  26445. }),
  26446. $globals.JSObjectProxy);
  26447. $core.addMethod(
  26448. $core.method({
  26449. selector: "removeKey:",
  26450. protocol: "accessing",
  26451. fn: function (aString){
  26452. var self=this,$self=this;
  26453. return $core.withContext(function($ctx1) {
  26454. delete $self.jsObject[aString]; return aString;
  26455. return self;
  26456. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aString:aString})});
  26457. },
  26458. args: ["aString"],
  26459. source: "removeKey: aString\x0a\x09<inlineJS: 'delete $self.jsObject[aString]; return aString'>",
  26460. referencedClasses: [],
  26461. pragmas: [["inlineJS:", ["delete $self.jsObject[aString]; return aString"]]],
  26462. messageSends: []
  26463. }),
  26464. $globals.JSObjectProxy);
  26465. $core.addMethod(
  26466. $core.method({
  26467. selector: "then:",
  26468. protocol: "promises",
  26469. fn: function (aBlockOrArray){
  26470. var self=this,$self=this;
  26471. return $core.withContext(function($ctx1) {
  26472. var $1,$2;
  26473. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  26474. if($core.assert($1)){
  26475. return $recv($recv($globals.TThenable).__gt_gt("then:"))._sendTo_arguments_($self.jsObject,[aBlockOrArray]);
  26476. } else {
  26477. $2=(
  26478. $ctx1.supercall = true,
  26479. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._then_.apply($self, [aBlockOrArray]));
  26480. $ctx1.supercall = false;
  26481. return $2;
  26482. }
  26483. return self;
  26484. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray})});
  26485. },
  26486. args: ["aBlockOrArray"],
  26487. source: "then: aBlockOrArray\x0a(NativeFunction isNativeFunction: (self at: #then))\x0a\x09ifTrue: [ ^ (TThenable >> #then:) sendTo: jsObject arguments: {aBlockOrArray} ]\x0a\x09ifFalse: [ ^ super then: aBlockOrArray ]",
  26488. referencedClasses: ["NativeFunction", "TThenable"],
  26489. pragmas: [],
  26490. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "then:"]
  26491. }),
  26492. $globals.JSObjectProxy);
  26493. $core.addMethod(
  26494. $core.method({
  26495. selector: "addObjectVariablesTo:ofProxy:",
  26496. protocol: "proxy",
  26497. fn: function (aDictionary,aProxy){
  26498. var self=this,$self=this;
  26499. return $core.withContext(function($ctx1) {
  26500. var jsObject = aProxy.jsObject;
  26501. for(var i in jsObject) {
  26502. aDictionary._at_put_(i, jsObject[i]);
  26503. }
  26504. ;
  26505. return self;
  26506. }, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:ofProxy:",{aDictionary:aDictionary,aProxy:aProxy})});
  26507. },
  26508. args: ["aDictionary", "aProxy"],
  26509. 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'>",
  26510. referencedClasses: [],
  26511. 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"]]],
  26512. messageSends: []
  26513. }),
  26514. $globals.JSObjectProxy.a$cls);
  26515. $core.addMethod(
  26516. $core.method({
  26517. selector: "compareJSObjectOfProxy:withProxy:",
  26518. protocol: "proxy",
  26519. fn: function (aProxy,anotherProxy){
  26520. var self=this,$self=this;
  26521. return $core.withContext(function($ctx1) {
  26522. var anotherJSObject = anotherProxy.a$cls ? anotherProxy.jsObject : anotherProxy;
  26523. return aProxy.jsObject === anotherJSObject;
  26524. return self;
  26525. }, function($ctx1) {$ctx1.fill(self,"compareJSObjectOfProxy:withProxy:",{aProxy:aProxy,anotherProxy:anotherProxy})});
  26526. },
  26527. args: ["aProxy", "anotherProxy"],
  26528. source: "compareJSObjectOfProxy: aProxy withProxy: anotherProxy\x0a<inlineJS: '\x0a\x09var anotherJSObject = anotherProxy.a$cls ? anotherProxy.jsObject : anotherProxy;\x0a\x09return aProxy.jsObject === anotherJSObject\x0a'>",
  26529. referencedClasses: [],
  26530. pragmas: [["inlineJS:", ["\x0a\x09var anotherJSObject = anotherProxy.a$cls ? anotherProxy.jsObject : anotherProxy;\x0a\x09return aProxy.jsObject === anotherJSObject"]]],
  26531. messageSends: []
  26532. }),
  26533. $globals.JSObjectProxy.a$cls);
  26534. $core.addMethod(
  26535. $core.method({
  26536. selector: "forwardMessage:withArguments:ofProxy:",
  26537. protocol: "proxy",
  26538. fn: function (aString,anArray,aProxy){
  26539. var self=this,$self=this;
  26540. return $core.withContext(function($ctx1) {
  26541. return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);
  26542. ;
  26543. return self;
  26544. }, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:ofProxy:",{aString:aString,anArray:anArray,aProxy:aProxy})});
  26545. },
  26546. args: ["aString", "anArray", "aProxy"],
  26547. source: "forwardMessage: aString withArguments: anArray ofProxy: aProxy\x0a\x09<inlineJS: '\x0a\x09\x09return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);\x0a\x09'>",
  26548. referencedClasses: [],
  26549. pragmas: [["inlineJS:", ["\x0a\x09\x09return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);\x0a\x09"]]],
  26550. messageSends: []
  26551. }),
  26552. $globals.JSObjectProxy.a$cls);
  26553. $core.addMethod(
  26554. $core.method({
  26555. selector: "jsObject:ofProxy:",
  26556. protocol: "proxy",
  26557. fn: function (aJSObject,aProxy){
  26558. var self=this,$self=this;
  26559. return $core.withContext(function($ctx1) {
  26560. aProxy.jsObject = aJSObject;
  26561. return self;
  26562. }, function($ctx1) {$ctx1.fill(self,"jsObject:ofProxy:",{aJSObject:aJSObject,aProxy:aProxy})});
  26563. },
  26564. args: ["aJSObject", "aProxy"],
  26565. source: "jsObject: aJSObject ofProxy: aProxy\x0a\x09<inlineJS: 'aProxy.jsObject = aJSObject'>",
  26566. referencedClasses: [],
  26567. pragmas: [["inlineJS:", ["aProxy.jsObject = aJSObject"]]],
  26568. messageSends: []
  26569. }),
  26570. $globals.JSObjectProxy.a$cls);
  26571. $core.addMethod(
  26572. $core.method({
  26573. selector: "lookupProperty:ofProxy:",
  26574. protocol: "proxy",
  26575. fn: function (aString,aProxy){
  26576. var self=this,$self=this;
  26577. return $core.withContext(function($ctx1) {
  26578. return aString in aProxy._jsObject() ? aString : nil;
  26579. return self;
  26580. }, function($ctx1) {$ctx1.fill(self,"lookupProperty:ofProxy:",{aString:aString,aProxy:aProxy})});
  26581. },
  26582. args: ["aString", "aProxy"],
  26583. 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'>",
  26584. referencedClasses: [],
  26585. pragmas: [["inlineJS:", ["return aString in aProxy._jsObject() ? aString : nil"]]],
  26586. messageSends: []
  26587. }),
  26588. $globals.JSObjectProxy.a$cls);
  26589. $core.addMethod(
  26590. $core.method({
  26591. selector: "null",
  26592. protocol: "accessing",
  26593. fn: function (){
  26594. var self=this,$self=this;
  26595. return $core.withContext(function($ctx1) {
  26596. return null;
  26597. return self;
  26598. }, function($ctx1) {$ctx1.fill(self,"null",{})});
  26599. },
  26600. args: [],
  26601. source: "null\x0a\x09<inlineJS: 'return null'>",
  26602. referencedClasses: [],
  26603. pragmas: [["inlineJS:", ["return null"]]],
  26604. messageSends: []
  26605. }),
  26606. $globals.JSObjectProxy.a$cls);
  26607. $core.addMethod(
  26608. $core.method({
  26609. selector: "on:",
  26610. protocol: "instance creation",
  26611. fn: function (aJSObject){
  26612. var self=this,$self=this;
  26613. var instance;
  26614. return $core.withContext(function($ctx1) {
  26615. instance=$self._new();
  26616. $self._jsObject_ofProxy_(aJSObject,instance);
  26617. return instance;
  26618. }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject,instance:instance})});
  26619. },
  26620. args: ["aJSObject"],
  26621. source: "on: aJSObject\x0a\x09| instance |\x0a\x09instance := self new.\x0a\x09self jsObject: aJSObject ofProxy: instance.\x0a\x09^ instance",
  26622. referencedClasses: [],
  26623. pragmas: [],
  26624. messageSends: ["new", "jsObject:ofProxy:"]
  26625. }),
  26626. $globals.JSObjectProxy.a$cls);
  26627. $core.addMethod(
  26628. $core.method({
  26629. selector: "undefined",
  26630. protocol: "accessing",
  26631. fn: function (){
  26632. var self=this,$self=this;
  26633. return $core.withContext(function($ctx1) {
  26634. return undefined;
  26635. return self;
  26636. }, function($ctx1) {$ctx1.fill(self,"undefined",{})});
  26637. },
  26638. args: [],
  26639. source: "undefined\x0a\x09<inlineJS: 'return undefined'>",
  26640. referencedClasses: [],
  26641. pragmas: [["inlineJS:", ["return undefined"]]],
  26642. messageSends: []
  26643. }),
  26644. $globals.JSObjectProxy.a$cls);
  26645. $core.addClass("Organizer", $globals.Object, ["elements"], "Kernel-Infrastructure");
  26646. $globals.Organizer.comment="I represent categorization information. \x0a\x0a## API\x0a\x0aUse `#addElement:` and `#removeElement:` to manipulate instances.";
  26647. $core.addMethod(
  26648. $core.method({
  26649. selector: "addElement:",
  26650. protocol: "accessing",
  26651. fn: function (anObject){
  26652. var self=this,$self=this;
  26653. return $core.withContext(function($ctx1) {
  26654. $recv($self._elements())._add_(anObject);
  26655. return self;
  26656. }, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject})});
  26657. },
  26658. args: ["anObject"],
  26659. source: "addElement: anObject\x0a\x09self elements add: anObject",
  26660. referencedClasses: [],
  26661. pragmas: [],
  26662. messageSends: ["add:", "elements"]
  26663. }),
  26664. $globals.Organizer);
  26665. $core.addMethod(
  26666. $core.method({
  26667. selector: "elements",
  26668. protocol: "accessing",
  26669. fn: function (){
  26670. var self=this,$self=this;
  26671. return $self.elements;
  26672. },
  26673. args: [],
  26674. source: "elements\x0a\x09^ elements",
  26675. referencedClasses: [],
  26676. pragmas: [],
  26677. messageSends: []
  26678. }),
  26679. $globals.Organizer);
  26680. $core.addMethod(
  26681. $core.method({
  26682. selector: "initialize",
  26683. protocol: "initialization",
  26684. fn: function (){
  26685. var self=this,$self=this;
  26686. return $core.withContext(function($ctx1) {
  26687. (
  26688. $ctx1.supercall = true,
  26689. ($globals.Organizer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  26690. $ctx1.supercall = false;
  26691. $self.elements=$recv($globals.Set)._new();
  26692. return self;
  26693. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  26694. },
  26695. args: [],
  26696. source: "initialize\x0a\x09super initialize.\x0a\x09elements := Set new",
  26697. referencedClasses: ["Set"],
  26698. pragmas: [],
  26699. messageSends: ["initialize", "new"]
  26700. }),
  26701. $globals.Organizer);
  26702. $core.addMethod(
  26703. $core.method({
  26704. selector: "removeElement:",
  26705. protocol: "accessing",
  26706. fn: function (anObject){
  26707. var self=this,$self=this;
  26708. return $core.withContext(function($ctx1) {
  26709. $recv($self._elements())._remove_ifAbsent_(anObject,(function(){
  26710. }));
  26711. return self;
  26712. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject})});
  26713. },
  26714. args: ["anObject"],
  26715. source: "removeElement: anObject\x0a\x09self elements remove: anObject ifAbsent: []",
  26716. referencedClasses: [],
  26717. pragmas: [],
  26718. messageSends: ["remove:ifAbsent:", "elements"]
  26719. }),
  26720. $globals.Organizer);
  26721. $core.addClass("ClassOrganizer", $globals.Organizer, ["traitOrBehavior"], "Kernel-Infrastructure");
  26722. $globals.ClassOrganizer.comment="I am an organizer specific to classes. I hold method categorization information for classes.";
  26723. $core.addMethod(
  26724. $core.method({
  26725. selector: "addElement:",
  26726. protocol: "accessing",
  26727. fn: function (aString){
  26728. var self=this,$self=this;
  26729. return $core.withContext(function($ctx1) {
  26730. var $1,$3,$2;
  26731. (
  26732. $ctx1.supercall = true,
  26733. ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._addElement_.apply($self, [aString]));
  26734. $ctx1.supercall = false;
  26735. $1=$recv($globals.SystemAnnouncer)._current();
  26736. $3=$recv($globals.ProtocolAdded)._new();
  26737. $recv($3)._protocol_(aString);
  26738. $recv($3)._theClass_($self._theClass());
  26739. $2=$recv($3)._yourself();
  26740. $recv($1)._announce_($2);
  26741. return self;
  26742. }, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString})});
  26743. },
  26744. args: ["aString"],
  26745. 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)",
  26746. referencedClasses: ["SystemAnnouncer", "ProtocolAdded"],
  26747. pragmas: [],
  26748. messageSends: ["addElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  26749. }),
  26750. $globals.ClassOrganizer);
  26751. $core.addMethod(
  26752. $core.method({
  26753. selector: "removeElement:",
  26754. protocol: "accessing",
  26755. fn: function (aString){
  26756. var self=this,$self=this;
  26757. return $core.withContext(function($ctx1) {
  26758. var $1,$3,$2;
  26759. (
  26760. $ctx1.supercall = true,
  26761. ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._removeElement_.apply($self, [aString]));
  26762. $ctx1.supercall = false;
  26763. $1=$recv($globals.SystemAnnouncer)._current();
  26764. $3=$recv($globals.ProtocolRemoved)._new();
  26765. $recv($3)._protocol_(aString);
  26766. $recv($3)._theClass_($self._theClass());
  26767. $2=$recv($3)._yourself();
  26768. $recv($1)._announce_($2);
  26769. return self;
  26770. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString})});
  26771. },
  26772. args: ["aString"],
  26773. 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)",
  26774. referencedClasses: ["SystemAnnouncer", "ProtocolRemoved"],
  26775. pragmas: [],
  26776. messageSends: ["removeElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  26777. }),
  26778. $globals.ClassOrganizer);
  26779. $core.addMethod(
  26780. $core.method({
  26781. selector: "theClass",
  26782. protocol: "accessing",
  26783. fn: function (){
  26784. var self=this,$self=this;
  26785. return $self.traitOrBehavior;
  26786. },
  26787. args: [],
  26788. source: "theClass\x0a\x09^ traitOrBehavior",
  26789. referencedClasses: [],
  26790. pragmas: [],
  26791. messageSends: []
  26792. }),
  26793. $globals.ClassOrganizer);
  26794. $core.addMethod(
  26795. $core.method({
  26796. selector: "theClass:",
  26797. protocol: "accessing",
  26798. fn: function (aClass){
  26799. var self=this,$self=this;
  26800. $self.traitOrBehavior=aClass;
  26801. return self;
  26802. },
  26803. args: ["aClass"],
  26804. source: "theClass: aClass\x0a\x09traitOrBehavior := aClass",
  26805. referencedClasses: [],
  26806. pragmas: [],
  26807. messageSends: []
  26808. }),
  26809. $globals.ClassOrganizer);
  26810. $core.addMethod(
  26811. $core.method({
  26812. selector: "on:",
  26813. protocol: "instance creation",
  26814. fn: function (aClass){
  26815. var self=this,$self=this;
  26816. return $core.withContext(function($ctx1) {
  26817. var $1;
  26818. $1=$self._new();
  26819. $recv($1)._theClass_(aClass);
  26820. return $recv($1)._yourself();
  26821. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass})});
  26822. },
  26823. args: ["aClass"],
  26824. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  26825. referencedClasses: [],
  26826. pragmas: [],
  26827. messageSends: ["theClass:", "new", "yourself"]
  26828. }),
  26829. $globals.ClassOrganizer.a$cls);
  26830. $core.addClass("PackageOrganizer", $globals.Organizer, [], "Kernel-Infrastructure");
  26831. $globals.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information.";
  26832. $core.addClass("Package", $globals.Object, ["evalBlock", "basicTransport", "name", "transport", "imports", "dirty", "organization", "isReady"], "Kernel-Infrastructure");
  26833. $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'";
  26834. $core.addMethod(
  26835. $core.method({
  26836. selector: "basicTransport",
  26837. protocol: "private",
  26838. fn: function (){
  26839. var self=this,$self=this;
  26840. return $self.basicTransport;
  26841. },
  26842. args: [],
  26843. source: "basicTransport\x0a\x09\x22Answer the transport literal JavaScript object as setup in the JavaScript file, if any\x22\x0a\x09\x0a\x09^ basicTransport",
  26844. referencedClasses: [],
  26845. pragmas: [],
  26846. messageSends: []
  26847. }),
  26848. $globals.Package);
  26849. $core.addMethod(
  26850. $core.method({
  26851. selector: "beClean",
  26852. protocol: "accessing",
  26853. fn: function (){
  26854. var self=this,$self=this;
  26855. return $core.withContext(function($ctx1) {
  26856. var $1,$3,$2;
  26857. $self.dirty=false;
  26858. $1=$recv($globals.SystemAnnouncer)._current();
  26859. $3=$recv($globals.PackageClean)._new();
  26860. $recv($3)._package_(self);
  26861. $2=$recv($3)._yourself();
  26862. $recv($1)._announce_($2);
  26863. return self;
  26864. }, function($ctx1) {$ctx1.fill(self,"beClean",{})});
  26865. },
  26866. args: [],
  26867. source: "beClean\x0a\x09dirty := false.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageClean new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  26868. referencedClasses: ["SystemAnnouncer", "PackageClean"],
  26869. pragmas: [],
  26870. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  26871. }),
  26872. $globals.Package);
  26873. $core.addMethod(
  26874. $core.method({
  26875. selector: "beDirty",
  26876. protocol: "accessing",
  26877. fn: function (){
  26878. var self=this,$self=this;
  26879. return $core.withContext(function($ctx1) {
  26880. var $1,$3,$2;
  26881. $self.dirty=true;
  26882. $1=$recv($globals.SystemAnnouncer)._current();
  26883. $3=$recv($globals.PackageDirty)._new();
  26884. $recv($3)._package_(self);
  26885. $2=$recv($3)._yourself();
  26886. $recv($1)._announce_($2);
  26887. return self;
  26888. }, function($ctx1) {$ctx1.fill(self,"beDirty",{})});
  26889. },
  26890. args: [],
  26891. source: "beDirty\x0a\x09dirty := true.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageDirty new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  26892. referencedClasses: ["SystemAnnouncer", "PackageDirty"],
  26893. pragmas: [],
  26894. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  26895. }),
  26896. $globals.Package);
  26897. $core.addMethod(
  26898. $core.method({
  26899. selector: "classTemplate",
  26900. protocol: "accessing",
  26901. fn: function (){
  26902. var self=this,$self=this;
  26903. return $core.withContext(function($ctx1) {
  26904. return $recv($globals.String)._streamContents_((function(stream){
  26905. return $core.withContext(function($ctx2) {
  26906. $recv(stream)._write_("Object subclass: #NameOfSubclass");
  26907. $ctx2.sendIdx["write:"]=1;
  26908. $recv(stream)._lf();
  26909. $ctx2.sendIdx["lf"]=1;
  26910. $recv(stream)._tab();
  26911. $ctx2.sendIdx["tab"]=1;
  26912. $recv(stream)._write_("instanceVariableNames: ''");
  26913. $ctx2.sendIdx["write:"]=2;
  26914. $recv(stream)._lf();
  26915. $recv(stream)._tab();
  26916. $recv(stream)._write_("package: ");
  26917. return $recv(stream)._print_($self._name());
  26918. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  26919. }));
  26920. }, function($ctx1) {$ctx1.fill(self,"classTemplate",{})});
  26921. },
  26922. args: [],
  26923. 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 ]",
  26924. referencedClasses: ["String"],
  26925. pragmas: [],
  26926. messageSends: ["streamContents:", "write:", "lf", "tab", "print:", "name"]
  26927. }),
  26928. $globals.Package);
  26929. $core.addMethod(
  26930. $core.method({
  26931. selector: "classes",
  26932. protocol: "classes",
  26933. fn: function (){
  26934. var self=this,$self=this;
  26935. return $core.withContext(function($ctx1) {
  26936. return $recv($recv($self._organization())._elements())._copy();
  26937. }, function($ctx1) {$ctx1.fill(self,"classes",{})});
  26938. },
  26939. args: [],
  26940. source: "classes\x0a\x09^ self organization elements copy",
  26941. referencedClasses: [],
  26942. pragmas: [],
  26943. messageSends: ["copy", "elements", "organization"]
  26944. }),
  26945. $globals.Package);
  26946. $core.addMethod(
  26947. $core.method({
  26948. selector: "definition",
  26949. protocol: "accessing",
  26950. fn: function (){
  26951. var self=this,$self=this;
  26952. return $core.withContext(function($ctx1) {
  26953. var $1;
  26954. return $recv($globals.String)._streamContents_((function(stream){
  26955. return $core.withContext(function($ctx2) {
  26956. $1=$recv($self._class())._name();
  26957. $ctx2.sendIdx["name"]=1;
  26958. $recv(stream)._write_($1);
  26959. $ctx2.sendIdx["write:"]=1;
  26960. $recv(stream)._lf();
  26961. $ctx2.sendIdx["lf"]=1;
  26962. $recv(stream)._tab();
  26963. $ctx2.sendIdx["tab"]=1;
  26964. $recv(stream)._write_("named: ");
  26965. $ctx2.sendIdx["write:"]=2;
  26966. $recv(stream)._print_($self._name());
  26967. $recv(stream)._lf();
  26968. $ctx2.sendIdx["lf"]=2;
  26969. $recv(stream)._tab();
  26970. $ctx2.sendIdx["tab"]=2;
  26971. $recv(stream)._write_(["imports: ",$self._importsDefinition()]);
  26972. $ctx2.sendIdx["write:"]=3;
  26973. $recv(stream)._lf();
  26974. $recv(stream)._tab();
  26975. return $recv(stream)._write_(["transport: (",$recv($self._transport())._definition(),")"]);
  26976. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  26977. }));
  26978. }, function($ctx1) {$ctx1.fill(self,"definition",{})});
  26979. },
  26980. args: [],
  26981. 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. ')' } ]",
  26982. referencedClasses: ["String"],
  26983. pragmas: [],
  26984. messageSends: ["streamContents:", "write:", "name", "class", "lf", "tab", "print:", "importsDefinition", "definition", "transport"]
  26985. }),
  26986. $globals.Package);
  26987. $core.addMethod(
  26988. $core.method({
  26989. selector: "eval:",
  26990. protocol: "evaluating",
  26991. fn: function (aString){
  26992. var self=this,$self=this;
  26993. return $core.withContext(function($ctx1) {
  26994. var $1,$receiver;
  26995. $1=$self.evalBlock;
  26996. if(($receiver = $1) == null || $receiver.a$nil){
  26997. return $recv($globals.Compiler)._eval_(aString);
  26998. } else {
  26999. return $recv($self.evalBlock)._value_(aString);
  27000. }
  27001. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString})});
  27002. },
  27003. args: ["aString"],
  27004. source: "eval: aString\x0a\x09^ evalBlock\x0a\x09\x09ifNotNil: [ evalBlock value: aString ]\x0a\x09\x09ifNil: [ Compiler eval: aString ]",
  27005. referencedClasses: ["Compiler"],
  27006. pragmas: [],
  27007. messageSends: ["ifNotNil:ifNil:", "value:", "eval:"]
  27008. }),
  27009. $globals.Package);
  27010. $core.addMethod(
  27011. $core.method({
  27012. selector: "evalBlock",
  27013. protocol: "accessing",
  27014. fn: function (){
  27015. var self=this,$self=this;
  27016. return $self.evalBlock;
  27017. },
  27018. args: [],
  27019. source: "evalBlock\x0a\x09^ evalBlock",
  27020. referencedClasses: [],
  27021. pragmas: [],
  27022. messageSends: []
  27023. }),
  27024. $globals.Package);
  27025. $core.addMethod(
  27026. $core.method({
  27027. selector: "evalBlock:",
  27028. protocol: "accessing",
  27029. fn: function (aBlock){
  27030. var self=this,$self=this;
  27031. $self.evalBlock=aBlock;
  27032. return self;
  27033. },
  27034. args: ["aBlock"],
  27035. source: "evalBlock: aBlock\x0a\x09evalBlock := aBlock",
  27036. referencedClasses: [],
  27037. pragmas: [],
  27038. messageSends: []
  27039. }),
  27040. $globals.Package);
  27041. $core.addMethod(
  27042. $core.method({
  27043. selector: "imports",
  27044. protocol: "accessing",
  27045. fn: function (){
  27046. var self=this,$self=this;
  27047. return $core.withContext(function($ctx1) {
  27048. var $1,$receiver;
  27049. $1=$self.imports;
  27050. if(($receiver = $1) == null || $receiver.a$nil){
  27051. $self._imports_([]);
  27052. return $self.imports;
  27053. } else {
  27054. return $1;
  27055. }
  27056. }, function($ctx1) {$ctx1.fill(self,"imports",{})});
  27057. },
  27058. args: [],
  27059. source: "imports\x0a\x09^ imports ifNil: [\x0a\x09\x09self imports: #().\x0a\x09\x09imports ]",
  27060. referencedClasses: [],
  27061. pragmas: [],
  27062. messageSends: ["ifNil:", "imports:"]
  27063. }),
  27064. $globals.Package);
  27065. $core.addMethod(
  27066. $core.method({
  27067. selector: "imports:",
  27068. protocol: "accessing",
  27069. fn: function (anArray){
  27070. var self=this,$self=this;
  27071. return $core.withContext(function($ctx1) {
  27072. $self._validateImports_(anArray);
  27073. $self.imports=$recv(anArray)._asSet();
  27074. return self;
  27075. }, function($ctx1) {$ctx1.fill(self,"imports:",{anArray:anArray})});
  27076. },
  27077. args: ["anArray"],
  27078. source: "imports: anArray\x0a\x09self validateImports: anArray.\x0a\x09imports := anArray asSet",
  27079. referencedClasses: [],
  27080. pragmas: [],
  27081. messageSends: ["validateImports:", "asSet"]
  27082. }),
  27083. $globals.Package);
  27084. $core.addMethod(
  27085. $core.method({
  27086. selector: "importsAsJson",
  27087. protocol: "converting",
  27088. fn: function (){
  27089. var self=this,$self=this;
  27090. return $core.withContext(function($ctx1) {
  27091. var $1;
  27092. return $recv($self._sortedImportsAsArray())._collect_((function(each){
  27093. return $core.withContext(function($ctx2) {
  27094. $1=$recv(each)._isString();
  27095. if($core.assert($1)){
  27096. return each;
  27097. } else {
  27098. return $recv($recv($recv(each)._key()).__comma("=")).__comma($recv(each)._value());
  27099. $ctx2.sendIdx[","]=1;
  27100. }
  27101. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27102. }));
  27103. }, function($ctx1) {$ctx1.fill(self,"importsAsJson",{})});
  27104. },
  27105. args: [],
  27106. 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 ]]",
  27107. referencedClasses: [],
  27108. pragmas: [],
  27109. messageSends: ["collect:", "sortedImportsAsArray", "ifTrue:ifFalse:", "isString", ",", "key", "value"]
  27110. }),
  27111. $globals.Package);
  27112. $core.addMethod(
  27113. $core.method({
  27114. selector: "importsDefinition",
  27115. protocol: "accessing",
  27116. fn: function (){
  27117. var self=this,$self=this;
  27118. return $core.withContext(function($ctx1) {
  27119. return $recv($globals.String)._streamContents_((function(stream){
  27120. return $core.withContext(function($ctx2) {
  27121. $recv(stream)._write_("{");
  27122. $ctx2.sendIdx["write:"]=1;
  27123. $recv($self._sortedImportsAsArray())._do_separatedBy_((function(each){
  27124. return $core.withContext(function($ctx3) {
  27125. return $recv(stream)._print_(each);
  27126. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  27127. }),(function(){
  27128. return $core.withContext(function($ctx3) {
  27129. return $recv(stream)._write_(". ");
  27130. $ctx3.sendIdx["write:"]=2;
  27131. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  27132. }));
  27133. return $recv(stream)._write_("}");
  27134. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  27135. }));
  27136. }, function($ctx1) {$ctx1.fill(self,"importsDefinition",{})});
  27137. },
  27138. args: [],
  27139. 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: '}' ]",
  27140. referencedClasses: ["String"],
  27141. pragmas: [],
  27142. messageSends: ["streamContents:", "write:", "do:separatedBy:", "sortedImportsAsArray", "print:"]
  27143. }),
  27144. $globals.Package);
  27145. $core.addMethod(
  27146. $core.method({
  27147. selector: "importsFromJson:",
  27148. protocol: "converting",
  27149. fn: function (anArray){
  27150. var self=this,$self=this;
  27151. return $core.withContext(function($ctx1) {
  27152. var $1;
  27153. return $recv(anArray)._collect_((function(each){
  27154. var split;
  27155. return $core.withContext(function($ctx2) {
  27156. split=$recv(each)._tokenize_("=");
  27157. $1=$recv($recv(split)._size()).__eq((1));
  27158. if($core.assert($1)){
  27159. return $recv(split)._first();
  27160. $ctx2.sendIdx["first"]=1;
  27161. } else {
  27162. return $recv($recv(split)._first()).__minus_gt($recv(split)._second());
  27163. }
  27164. }, function($ctx2) {$ctx2.fillBlock({each:each,split:split},$ctx1,1)});
  27165. }));
  27166. }, function($ctx1) {$ctx1.fill(self,"importsFromJson:",{anArray:anArray})});
  27167. },
  27168. args: ["anArray"],
  27169. 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 ]]",
  27170. referencedClasses: [],
  27171. pragmas: [],
  27172. messageSends: ["collect:", "tokenize:", "ifTrue:ifFalse:", "=", "size", "first", "->", "second"]
  27173. }),
  27174. $globals.Package);
  27175. $core.addMethod(
  27176. $core.method({
  27177. selector: "initialize",
  27178. protocol: "initialization",
  27179. fn: function (){
  27180. var self=this,$self=this;
  27181. return $core.withContext(function($ctx1) {
  27182. (
  27183. $ctx1.supercall = true,
  27184. ($globals.Package.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  27185. $ctx1.supercall = false;
  27186. $self.organization=$recv($globals.PackageOrganizer)._new();
  27187. $ctx1.sendIdx["new"]=1;
  27188. $self.evalBlock=nil;
  27189. $self.dirty=nil;
  27190. $self.imports=nil;
  27191. $self.isReady=$recv($globals.Promise)._new();
  27192. $self.transport=nil;
  27193. return self;
  27194. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  27195. },
  27196. args: [],
  27197. 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",
  27198. referencedClasses: ["PackageOrganizer", "Promise"],
  27199. pragmas: [],
  27200. messageSends: ["initialize", "new"]
  27201. }),
  27202. $globals.Package);
  27203. $core.addMethod(
  27204. $core.method({
  27205. selector: "isDirty",
  27206. protocol: "testing",
  27207. fn: function (){
  27208. var self=this,$self=this;
  27209. return $core.withContext(function($ctx1) {
  27210. var $1,$receiver;
  27211. $1=$self.dirty;
  27212. if(($receiver = $1) == null || $receiver.a$nil){
  27213. return false;
  27214. } else {
  27215. return $1;
  27216. }
  27217. }, function($ctx1) {$ctx1.fill(self,"isDirty",{})});
  27218. },
  27219. args: [],
  27220. source: "isDirty\x0a\x09^ dirty ifNil: [ false ]",
  27221. referencedClasses: [],
  27222. pragmas: [],
  27223. messageSends: ["ifNil:"]
  27224. }),
  27225. $globals.Package);
  27226. $core.addMethod(
  27227. $core.method({
  27228. selector: "isPackage",
  27229. protocol: "testing",
  27230. fn: function (){
  27231. var self=this,$self=this;
  27232. return true;
  27233. },
  27234. args: [],
  27235. source: "isPackage\x0a\x09^ true",
  27236. referencedClasses: [],
  27237. pragmas: [],
  27238. messageSends: []
  27239. }),
  27240. $globals.Package);
  27241. $core.addMethod(
  27242. $core.method({
  27243. selector: "isReady",
  27244. protocol: "accessing",
  27245. fn: function (){
  27246. var self=this,$self=this;
  27247. return $self.isReady;
  27248. },
  27249. args: [],
  27250. source: "isReady\x0a\x09^ isReady",
  27251. referencedClasses: [],
  27252. pragmas: [],
  27253. messageSends: []
  27254. }),
  27255. $globals.Package);
  27256. $core.addMethod(
  27257. $core.method({
  27258. selector: "isReady:",
  27259. protocol: "accessing",
  27260. fn: function (aPromise){
  27261. var self=this,$self=this;
  27262. $self.isReady=aPromise;
  27263. return self;
  27264. },
  27265. args: ["aPromise"],
  27266. source: "isReady: aPromise\x0a\x09isReady := aPromise",
  27267. referencedClasses: [],
  27268. pragmas: [],
  27269. messageSends: []
  27270. }),
  27271. $globals.Package);
  27272. $core.addMethod(
  27273. $core.method({
  27274. selector: "javaScriptDescriptor:",
  27275. protocol: "accessing",
  27276. fn: function (anObject){
  27277. var self=this,$self=this;
  27278. var basicEval,basicImports;
  27279. return $core.withContext(function($ctx1) {
  27280. basicEval=$recv(anObject)._at_ifAbsent_("innerEval",(function(){
  27281. return $core.withContext(function($ctx2) {
  27282. return nil._asJavaScriptObject();
  27283. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  27284. }));
  27285. $ctx1.sendIdx["at:ifAbsent:"]=1;
  27286. basicImports=$recv(anObject)._at_ifAbsent_("imports",(function(){
  27287. return [];
  27288. }));
  27289. $ctx1.sendIdx["at:ifAbsent:"]=2;
  27290. $self.basicTransport=$recv(anObject)._at_ifAbsent_("transport",(function(){
  27291. }));
  27292. $recv(anObject)._at_ifPresent_("isReady",(function(aPromise){
  27293. return $core.withContext(function($ctx2) {
  27294. return $self._isReady_(aPromise);
  27295. }, function($ctx2) {$ctx2.fillBlock({aPromise:aPromise},$ctx1,4)});
  27296. }));
  27297. $self._evalBlock_(basicEval);
  27298. $self._imports_($self._importsFromJson_(basicImports));
  27299. return self;
  27300. }, function($ctx1) {$ctx1.fill(self,"javaScriptDescriptor:",{anObject:anObject,basicEval:basicEval,basicImports:basicImports})});
  27301. },
  27302. args: ["anObject"],
  27303. 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)",
  27304. referencedClasses: [],
  27305. pragmas: [],
  27306. messageSends: ["at:ifAbsent:", "asJavaScriptObject", "at:ifPresent:", "isReady:", "evalBlock:", "imports:", "importsFromJson:"]
  27307. }),
  27308. $globals.Package);
  27309. $core.addMethod(
  27310. $core.method({
  27311. selector: "loadDependencies",
  27312. protocol: "dependencies",
  27313. fn: function (){
  27314. var self=this,$self=this;
  27315. var classes,packages;
  27316. return $core.withContext(function($ctx1) {
  27317. var $1;
  27318. classes=$self._loadDependencyClasses();
  27319. $1=$recv($recv(classes)._collect_((function(each){
  27320. return $core.withContext(function($ctx2) {
  27321. return $recv(each)._package();
  27322. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27323. })))._asSet();
  27324. $recv($1)._remove_ifAbsent_(self,(function(){
  27325. }));
  27326. return $recv($1)._yourself();
  27327. }, function($ctx1) {$ctx1.fill(self,"loadDependencies",{classes:classes,packages:packages})});
  27328. },
  27329. args: [],
  27330. 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",
  27331. referencedClasses: [],
  27332. pragmas: [],
  27333. messageSends: ["loadDependencyClasses", "remove:ifAbsent:", "asSet", "collect:", "package", "yourself"]
  27334. }),
  27335. $globals.Package);
  27336. $core.addMethod(
  27337. $core.method({
  27338. selector: "loadDependencyClasses",
  27339. protocol: "dependencies",
  27340. fn: function (){
  27341. var self=this,$self=this;
  27342. var starCategoryName;
  27343. return $core.withContext(function($ctx1) {
  27344. var $3,$2,$1;
  27345. starCategoryName="*".__comma($self._name());
  27346. $3=$self._classes();
  27347. $ctx1.sendIdx["classes"]=1;
  27348. $2=$recv($3)._collect_((function(each){
  27349. return $core.withContext(function($ctx2) {
  27350. return $recv(each)._superclass();
  27351. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27352. }));
  27353. $ctx1.sendIdx["collect:"]=1;
  27354. $1=$recv($2)._asSet();
  27355. $recv($1)._addAll_($recv($recv($globals.Smalltalk)._classes())._select_((function(each){
  27356. return $core.withContext(function($ctx2) {
  27357. return $recv($recv([each,$recv(each)._theMetaClass()])._copyWithout_(nil))._anySatisfy_((function(any){
  27358. return $core.withContext(function($ctx3) {
  27359. return $recv($recv($recv(any)._protocols())._includes_(starCategoryName))._and_((function(){
  27360. return $core.withContext(function($ctx4) {
  27361. return $recv($recv(any)._ownMethodsInProtocol_(starCategoryName))._notEmpty();
  27362. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  27363. }));
  27364. }, function($ctx3) {$ctx3.fillBlock({any:any},$ctx2,3)});
  27365. }));
  27366. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  27367. })));
  27368. $ctx1.sendIdx["addAll:"]=1;
  27369. $recv($1)._addAll_($recv($globals.Array)._streamContents_((function(as){
  27370. return $core.withContext(function($ctx2) {
  27371. return $recv($self._traitCompositions())._valuesDo_((function(each){
  27372. return $core.withContext(function($ctx3) {
  27373. return $recv(as)._write_($recv(each)._collect_((function(eachTT){
  27374. return $core.withContext(function($ctx4) {
  27375. return $recv(eachTT)._trait();
  27376. }, function($ctx4) {$ctx4.fillBlock({eachTT:eachTT},$ctx3,7)});
  27377. })));
  27378. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,6)});
  27379. }));
  27380. }, function($ctx2) {$ctx2.fillBlock({as:as},$ctx1,5)});
  27381. })));
  27382. $recv($1)._remove_ifAbsent_(nil,(function(){
  27383. }));
  27384. return $recv($1)._yourself();
  27385. }, function($ctx1) {$ctx1.fill(self,"loadDependencyClasses",{starCategoryName:starCategoryName})});
  27386. },
  27387. args: [],
  27388. 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",
  27389. referencedClasses: ["Smalltalk", "Array"],
  27390. pragmas: [],
  27391. messageSends: [",", "name", "addAll:", "asSet", "collect:", "classes", "superclass", "select:", "anySatisfy:", "copyWithout:", "theMetaClass", "and:", "includes:", "protocols", "notEmpty", "ownMethodsInProtocol:", "streamContents:", "valuesDo:", "traitCompositions", "write:", "trait", "remove:ifAbsent:", "yourself"]
  27392. }),
  27393. $globals.Package);
  27394. $core.addMethod(
  27395. $core.method({
  27396. selector: "name",
  27397. protocol: "accessing",
  27398. fn: function (){
  27399. var self=this,$self=this;
  27400. return $self.name;
  27401. },
  27402. args: [],
  27403. source: "name\x0a\x09^ name",
  27404. referencedClasses: [],
  27405. pragmas: [],
  27406. messageSends: []
  27407. }),
  27408. $globals.Package);
  27409. $core.addMethod(
  27410. $core.method({
  27411. selector: "name:",
  27412. protocol: "accessing",
  27413. fn: function (aString){
  27414. var self=this,$self=this;
  27415. $self.name=aString;
  27416. return self;
  27417. },
  27418. args: ["aString"],
  27419. source: "name: aString\x0a\x09name := aString",
  27420. referencedClasses: [],
  27421. pragmas: [],
  27422. messageSends: []
  27423. }),
  27424. $globals.Package);
  27425. $core.addMethod(
  27426. $core.method({
  27427. selector: "organization",
  27428. protocol: "accessing",
  27429. fn: function (){
  27430. var self=this,$self=this;
  27431. return $self.organization;
  27432. },
  27433. args: [],
  27434. source: "organization\x0a\x09^ organization",
  27435. referencedClasses: [],
  27436. pragmas: [],
  27437. messageSends: []
  27438. }),
  27439. $globals.Package);
  27440. $core.addMethod(
  27441. $core.method({
  27442. selector: "printOn:",
  27443. protocol: "printing",
  27444. fn: function (aStream){
  27445. var self=this,$self=this;
  27446. return $core.withContext(function($ctx1) {
  27447. (
  27448. $ctx1.supercall = true,
  27449. ($globals.Package.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  27450. $ctx1.supercall = false;
  27451. $recv(aStream)._nextPutAll_(" (");
  27452. $ctx1.sendIdx["nextPutAll:"]=1;
  27453. $recv(aStream)._nextPutAll_($self._name());
  27454. $ctx1.sendIdx["nextPutAll:"]=2;
  27455. $recv(aStream)._nextPutAll_(")");
  27456. return self;
  27457. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  27458. },
  27459. args: ["aStream"],
  27460. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  27461. referencedClasses: [],
  27462. pragmas: [],
  27463. messageSends: ["printOn:", "nextPutAll:", "name"]
  27464. }),
  27465. $globals.Package);
  27466. $core.addMethod(
  27467. $core.method({
  27468. selector: "setupClasses",
  27469. protocol: "classes",
  27470. fn: function (){
  27471. var self=this,$self=this;
  27472. return $core.withContext(function($ctx1) {
  27473. $recv($self._classes())._do_((function(each){
  27474. return $core.withContext(function($ctx2) {
  27475. return $recv(each)._initialize();
  27476. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27477. }));
  27478. return self;
  27479. }, function($ctx1) {$ctx1.fill(self,"setupClasses",{})});
  27480. },
  27481. args: [],
  27482. source: "setupClasses\x0a\x09self classes do: [ :each | each initialize ]",
  27483. referencedClasses: [],
  27484. pragmas: [],
  27485. messageSends: ["do:", "classes", "initialize"]
  27486. }),
  27487. $globals.Package);
  27488. $core.addMethod(
  27489. $core.method({
  27490. selector: "sortedClasses",
  27491. protocol: "classes",
  27492. fn: function (){
  27493. var self=this,$self=this;
  27494. return $core.withContext(function($ctx1) {
  27495. return $recv($self._class())._sortedClasses_($self._classes());
  27496. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{})});
  27497. },
  27498. args: [],
  27499. 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",
  27500. referencedClasses: [],
  27501. pragmas: [],
  27502. messageSends: ["sortedClasses:", "class", "classes"]
  27503. }),
  27504. $globals.Package);
  27505. $core.addMethod(
  27506. $core.method({
  27507. selector: "sortedImportsAsArray",
  27508. protocol: "private",
  27509. fn: function (){
  27510. var self=this,$self=this;
  27511. return $core.withContext(function($ctx1) {
  27512. var $3,$2,$4,$1,$6,$5,$7;
  27513. return $recv($recv($self._imports())._asArray())._sorted_((function(a,b){
  27514. return $core.withContext(function($ctx2) {
  27515. $3=$recv(a)._isString();
  27516. $ctx2.sendIdx["isString"]=1;
  27517. $2=$recv($3)._not();
  27518. $4=$recv(b)._isString();
  27519. $ctx2.sendIdx["isString"]=2;
  27520. $1=$recv($2).__and($4);
  27521. return $recv($1)._or_((function(){
  27522. return $core.withContext(function($ctx3) {
  27523. $6=$recv(a)._isString();
  27524. $ctx3.sendIdx["isString"]=3;
  27525. $5=$recv($6).__eq($recv(b)._isString());
  27526. return $recv($5)._and_((function(){
  27527. return $core.withContext(function($ctx4) {
  27528. $7=$recv(a)._value();
  27529. $ctx4.sendIdx["value"]=1;
  27530. return $recv($7).__lt_eq($recv(b)._value());
  27531. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  27532. }));
  27533. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  27534. }));
  27535. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  27536. }));
  27537. }, function($ctx1) {$ctx1.fill(self,"sortedImportsAsArray",{})});
  27538. },
  27539. args: [],
  27540. 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 ]]]",
  27541. referencedClasses: [],
  27542. pragmas: [],
  27543. messageSends: ["sorted:", "asArray", "imports", "or:", "&", "not", "isString", "and:", "=", "<=", "value"]
  27544. }),
  27545. $globals.Package);
  27546. $core.addMethod(
  27547. $core.method({
  27548. selector: "traitCompositions",
  27549. protocol: "dependencies",
  27550. fn: function (){
  27551. var self=this,$self=this;
  27552. var traitCompositions;
  27553. return $core.withContext(function($ctx1) {
  27554. traitCompositions=$recv($globals.Dictionary)._new();
  27555. $recv($self._classes())._do_((function(eachClass){
  27556. return $core.withContext(function($ctx2) {
  27557. return $recv(eachClass)._includingPossibleMetaDo_((function(each){
  27558. return $core.withContext(function($ctx3) {
  27559. return $recv(traitCompositions)._at_put_(each,$recv(each)._traitComposition());
  27560. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  27561. }));
  27562. }, function($ctx2) {$ctx2.fillBlock({eachClass:eachClass},$ctx1,1)});
  27563. }));
  27564. return $recv(traitCompositions)._reject_((function(each){
  27565. return $core.withContext(function($ctx2) {
  27566. return $recv(each)._isEmpty();
  27567. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  27568. }));
  27569. }, function($ctx1) {$ctx1.fill(self,"traitCompositions",{traitCompositions:traitCompositions})});
  27570. },
  27571. args: [],
  27572. 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 ]",
  27573. referencedClasses: ["Dictionary"],
  27574. pragmas: [],
  27575. messageSends: ["new", "do:", "classes", "includingPossibleMetaDo:", "at:put:", "traitComposition", "reject:", "isEmpty"]
  27576. }),
  27577. $globals.Package);
  27578. $core.addMethod(
  27579. $core.method({
  27580. selector: "transport",
  27581. protocol: "accessing",
  27582. fn: function (){
  27583. var self=this,$self=this;
  27584. return $core.withContext(function($ctx1) {
  27585. var $1,$receiver;
  27586. $1=$self.transport;
  27587. if(($receiver = $1) == null || $receiver.a$nil){
  27588. $self._transport_($recv($globals.PackageTransport)._fromJson_($self._basicTransport()));
  27589. return $self.transport;
  27590. } else {
  27591. return $1;
  27592. }
  27593. }, function($ctx1) {$ctx1.fill(self,"transport",{})});
  27594. },
  27595. args: [],
  27596. source: "transport\x0a\x09^ transport ifNil: [ \x0a\x09\x09self transport: (PackageTransport fromJson: self basicTransport).\x0a\x09\x09transport ]",
  27597. referencedClasses: ["PackageTransport"],
  27598. pragmas: [],
  27599. messageSends: ["ifNil:", "transport:", "fromJson:", "basicTransport"]
  27600. }),
  27601. $globals.Package);
  27602. $core.addMethod(
  27603. $core.method({
  27604. selector: "transport:",
  27605. protocol: "accessing",
  27606. fn: function (aPackageTransport){
  27607. var self=this,$self=this;
  27608. return $core.withContext(function($ctx1) {
  27609. $self.transport=aPackageTransport;
  27610. $recv(aPackageTransport)._package_(self);
  27611. return self;
  27612. }, function($ctx1) {$ctx1.fill(self,"transport:",{aPackageTransport:aPackageTransport})});
  27613. },
  27614. args: ["aPackageTransport"],
  27615. source: "transport: aPackageTransport\x0a\x09transport := aPackageTransport.\x0a\x09aPackageTransport package: self",
  27616. referencedClasses: [],
  27617. pragmas: [],
  27618. messageSends: ["package:"]
  27619. }),
  27620. $globals.Package);
  27621. $core.addMethod(
  27622. $core.method({
  27623. selector: "validateImports:",
  27624. protocol: "validation",
  27625. fn: function (aCollection){
  27626. var self=this,$self=this;
  27627. return $core.withContext(function($ctx1) {
  27628. var $1,$2,$5,$4,$3,$6;
  27629. $recv(aCollection)._do_((function(import_){
  27630. return $core.withContext(function($ctx2) {
  27631. $1=$recv(import_)._isString();
  27632. $ctx2.sendIdx["isString"]=1;
  27633. if(!$core.assert($1)){
  27634. $2=$recv(import_)._respondsTo_("key");
  27635. if(!$core.assert($2)){
  27636. $self._error_("Imports must be Strings or Associations");
  27637. $ctx2.sendIdx["error:"]=1;
  27638. }
  27639. $5=$recv(import_)._key();
  27640. $ctx2.sendIdx["key"]=1;
  27641. $4=$recv($5)._isString();
  27642. $ctx2.sendIdx["isString"]=2;
  27643. $3=$recv($4).__and($recv($recv(import_)._value())._isString());
  27644. if(!$core.assert($3)){
  27645. $self._error_("Key and value must be Strings");
  27646. $ctx2.sendIdx["error:"]=2;
  27647. }
  27648. $6=$recv($recv(import_)._key())._match_("^[a-zA-Z][a-zA-Z0-9]*$");
  27649. if(!$core.assert($6)){
  27650. return $self._error_("Keys must be identifiers");
  27651. }
  27652. }
  27653. }, function($ctx2) {$ctx2.fillBlock({import_:import_},$ctx1,1)});
  27654. }));
  27655. return self;
  27656. }, function($ctx1) {$ctx1.fill(self,"validateImports:",{aCollection:aCollection})});
  27657. },
  27658. args: ["aCollection"],
  27659. 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' ]]]",
  27660. referencedClasses: [],
  27661. pragmas: [],
  27662. messageSends: ["do:", "ifFalse:", "isString", "respondsTo:", "error:", "&", "key", "value", "match:"]
  27663. }),
  27664. $globals.Package);
  27665. $core.setSlots($globals.Package.a$cls, ["defaultCommitPathJs", "defaultCommitPathSt"]);
  27666. $core.addMethod(
  27667. $core.method({
  27668. selector: "named:",
  27669. protocol: "accessing",
  27670. fn: function (aPackageName){
  27671. var self=this,$self=this;
  27672. return $core.withContext(function($ctx1) {
  27673. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,(function(){
  27674. return $core.withContext(function($ctx2) {
  27675. return $recv($globals.Smalltalk)._createPackage_(aPackageName);
  27676. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  27677. }));
  27678. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName})});
  27679. },
  27680. args: ["aPackageName"],
  27681. source: "named: aPackageName\x0a\x09^ Smalltalk \x0a\x09\x09packageAt: aPackageName\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09Smalltalk createPackage: aPackageName ]",
  27682. referencedClasses: ["Smalltalk"],
  27683. pragmas: [],
  27684. messageSends: ["packageAt:ifAbsent:", "createPackage:"]
  27685. }),
  27686. $globals.Package.a$cls);
  27687. $core.addMethod(
  27688. $core.method({
  27689. selector: "named:ifAbsent:",
  27690. protocol: "accessing",
  27691. fn: function (aPackageName,aBlock){
  27692. var self=this,$self=this;
  27693. return $core.withContext(function($ctx1) {
  27694. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,aBlock);
  27695. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock})});
  27696. },
  27697. args: ["aPackageName", "aBlock"],
  27698. source: "named: aPackageName ifAbsent: aBlock\x0a\x09^ Smalltalk packageAt: aPackageName ifAbsent: aBlock",
  27699. referencedClasses: ["Smalltalk"],
  27700. pragmas: [],
  27701. messageSends: ["packageAt:ifAbsent:"]
  27702. }),
  27703. $globals.Package.a$cls);
  27704. $core.addMethod(
  27705. $core.method({
  27706. selector: "named:imports:transport:",
  27707. protocol: "accessing",
  27708. fn: function (aPackageName,anArray,aTransport){
  27709. var self=this,$self=this;
  27710. var pkg;
  27711. return $core.withContext(function($ctx1) {
  27712. pkg=$self._named_(aPackageName);
  27713. $recv(pkg)._imports_(anArray);
  27714. $recv(pkg)._transport_(aTransport);
  27715. return pkg;
  27716. }, function($ctx1) {$ctx1.fill(self,"named:imports:transport:",{aPackageName:aPackageName,anArray:anArray,aTransport:aTransport,pkg:pkg})});
  27717. },
  27718. args: ["aPackageName", "anArray", "aTransport"],
  27719. 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",
  27720. referencedClasses: [],
  27721. pragmas: [],
  27722. messageSends: ["named:", "imports:", "transport:"]
  27723. }),
  27724. $globals.Package.a$cls);
  27725. $core.addMethod(
  27726. $core.method({
  27727. selector: "named:javaScriptDescriptor:",
  27728. protocol: "instance creation",
  27729. fn: function (aString,anObject){
  27730. var self=this,$self=this;
  27731. var pkg;
  27732. return $core.withContext(function($ctx1) {
  27733. pkg=$recv($globals.Smalltalk)._createPackage_(aString);
  27734. $recv(pkg)._javaScriptDescriptor_(anObject);
  27735. return pkg;
  27736. }, function($ctx1) {$ctx1.fill(self,"named:javaScriptDescriptor:",{aString:aString,anObject:anObject,pkg:pkg})});
  27737. },
  27738. args: ["aString", "anObject"],
  27739. source: "named: aString javaScriptDescriptor: anObject\x0a\x09| pkg |\x0a\x09\x0a\x09pkg := Smalltalk createPackage: aString.\x0a\x09pkg javaScriptDescriptor: anObject.\x0a\x09^ pkg",
  27740. referencedClasses: ["Smalltalk"],
  27741. pragmas: [],
  27742. messageSends: ["createPackage:", "javaScriptDescriptor:"]
  27743. }),
  27744. $globals.Package.a$cls);
  27745. $core.addMethod(
  27746. $core.method({
  27747. selector: "named:transport:",
  27748. protocol: "accessing",
  27749. fn: function (aPackageName,aTransport){
  27750. var self=this,$self=this;
  27751. var pkg;
  27752. return $core.withContext(function($ctx1) {
  27753. pkg=$self._named_(aPackageName);
  27754. $recv(pkg)._transport_(aTransport);
  27755. return pkg;
  27756. }, function($ctx1) {$ctx1.fill(self,"named:transport:",{aPackageName:aPackageName,aTransport:aTransport,pkg:pkg})});
  27757. },
  27758. args: ["aPackageName", "aTransport"],
  27759. source: "named: aPackageName transport: aTransport\x0a\x09| pkg |\x0a\x09\x0a\x09pkg := self named: aPackageName.\x0a\x09pkg transport: aTransport.\x0a\x09\x0a\x09^ pkg",
  27760. referencedClasses: [],
  27761. pragmas: [],
  27762. messageSends: ["named:", "transport:"]
  27763. }),
  27764. $globals.Package.a$cls);
  27765. $core.addMethod(
  27766. $core.method({
  27767. selector: "new:",
  27768. protocol: "instance creation",
  27769. fn: function (aString){
  27770. var self=this,$self=this;
  27771. return $core.withContext(function($ctx1) {
  27772. var $1;
  27773. $1=$recv($globals.Package)._new();
  27774. $recv($1)._name_(aString);
  27775. return $recv($1)._yourself();
  27776. }, function($ctx1) {$ctx1.fill(self,"new:",{aString:aString})});
  27777. },
  27778. args: ["aString"],
  27779. source: "new: aString\x0a\x09^ Package new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  27780. referencedClasses: ["Package"],
  27781. pragmas: [],
  27782. messageSends: ["name:", "new", "yourself"]
  27783. }),
  27784. $globals.Package.a$cls);
  27785. $core.addMethod(
  27786. $core.method({
  27787. selector: "sortedClasses:",
  27788. protocol: "sorting",
  27789. fn: function (classes){
  27790. var self=this,$self=this;
  27791. return $core.withContext(function($ctx1) {
  27792. return $recv($globals.Array)._streamContents_((function(stream){
  27793. return $core.withContext(function($ctx2) {
  27794. return $recv(stream).__lt_lt($recv($globals.ClassBuilder)._sortClasses_(classes));
  27795. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  27796. }));
  27797. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes})});
  27798. },
  27799. args: ["classes"],
  27800. source: "sortedClasses: classes\x0a\x09^ Array streamContents: [ :stream | stream << (ClassBuilder sortClasses: classes) ]",
  27801. referencedClasses: ["Array", "ClassBuilder"],
  27802. pragmas: [],
  27803. messageSends: ["streamContents:", "<<", "sortClasses:"]
  27804. }),
  27805. $globals.Package.a$cls);
  27806. $core.addClass("PackageStateObserver", $globals.Object, [], "Kernel-Infrastructure");
  27807. $globals.PackageStateObserver.comment="My current instance listens for any changes in the system that might affect the state of a package (being dirty).";
  27808. $core.addMethod(
  27809. $core.method({
  27810. selector: "announcer",
  27811. protocol: "accessing",
  27812. fn: function (){
  27813. var self=this,$self=this;
  27814. return $core.withContext(function($ctx1) {
  27815. return $recv($globals.SystemAnnouncer)._current();
  27816. }, function($ctx1) {$ctx1.fill(self,"announcer",{})});
  27817. },
  27818. args: [],
  27819. source: "announcer\x0a\x09^ SystemAnnouncer current",
  27820. referencedClasses: ["SystemAnnouncer"],
  27821. pragmas: [],
  27822. messageSends: ["current"]
  27823. }),
  27824. $globals.PackageStateObserver);
  27825. $core.addMethod(
  27826. $core.method({
  27827. selector: "observeSystem",
  27828. protocol: "actions",
  27829. fn: function (){
  27830. var self=this,$self=this;
  27831. return $core.withContext(function($ctx1) {
  27832. var $1;
  27833. $1=$self._announcer();
  27834. $recv($1)._on_send_to_($globals.PackageAdded,"onPackageAdded:",self);
  27835. $ctx1.sendIdx["on:send:to:"]=1;
  27836. $recv($1)._on_send_to_($globals.ClassAnnouncement,"onClassModification:",self);
  27837. $ctx1.sendIdx["on:send:to:"]=2;
  27838. $recv($1)._on_send_to_($globals.MethodAnnouncement,"onMethodModification:",self);
  27839. $ctx1.sendIdx["on:send:to:"]=3;
  27840. $recv($1)._on_send_to_($globals.ProtocolAnnouncement,"onProtocolModification:",self);
  27841. return self;
  27842. }, function($ctx1) {$ctx1.fill(self,"observeSystem",{})});
  27843. },
  27844. args: [],
  27845. 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",
  27846. referencedClasses: ["PackageAdded", "ClassAnnouncement", "MethodAnnouncement", "ProtocolAnnouncement"],
  27847. pragmas: [],
  27848. messageSends: ["on:send:to:", "announcer"]
  27849. }),
  27850. $globals.PackageStateObserver);
  27851. $core.addMethod(
  27852. $core.method({
  27853. selector: "onClassModification:",
  27854. protocol: "reactions",
  27855. fn: function (anAnnouncement){
  27856. var self=this,$self=this;
  27857. return $core.withContext(function($ctx1) {
  27858. var $1,$receiver;
  27859. $1=$recv(anAnnouncement)._theClass();
  27860. if(($receiver = $1) == null || $receiver.a$nil){
  27861. $1;
  27862. } else {
  27863. var theClass;
  27864. theClass=$receiver;
  27865. $recv($recv(theClass)._package())._beDirty();
  27866. }
  27867. return self;
  27868. }, function($ctx1) {$ctx1.fill(self,"onClassModification:",{anAnnouncement:anAnnouncement})});
  27869. },
  27870. args: ["anAnnouncement"],
  27871. source: "onClassModification: anAnnouncement\x0a\x09anAnnouncement theClass ifNotNil: [ :theClass | theClass package beDirty ]",
  27872. referencedClasses: [],
  27873. pragmas: [],
  27874. messageSends: ["ifNotNil:", "theClass", "beDirty", "package"]
  27875. }),
  27876. $globals.PackageStateObserver);
  27877. $core.addMethod(
  27878. $core.method({
  27879. selector: "onMethodModification:",
  27880. protocol: "reactions",
  27881. fn: function (anAnnouncement){
  27882. var self=this,$self=this;
  27883. return $core.withContext(function($ctx1) {
  27884. var $1,$receiver;
  27885. $1=$recv($recv(anAnnouncement)._method())._package();
  27886. if(($receiver = $1) == null || $receiver.a$nil){
  27887. $1;
  27888. } else {
  27889. var package_;
  27890. package_=$receiver;
  27891. $recv(package_)._beDirty();
  27892. }
  27893. return self;
  27894. }, function($ctx1) {$ctx1.fill(self,"onMethodModification:",{anAnnouncement:anAnnouncement})});
  27895. },
  27896. args: ["anAnnouncement"],
  27897. source: "onMethodModification: anAnnouncement\x0a\x09anAnnouncement method package ifNotNil: [ :package | package beDirty ]",
  27898. referencedClasses: [],
  27899. pragmas: [],
  27900. messageSends: ["ifNotNil:", "package", "method", "beDirty"]
  27901. }),
  27902. $globals.PackageStateObserver);
  27903. $core.addMethod(
  27904. $core.method({
  27905. selector: "onPackageAdded:",
  27906. protocol: "reactions",
  27907. fn: function (anAnnouncement){
  27908. var self=this,$self=this;
  27909. return $core.withContext(function($ctx1) {
  27910. $recv($recv(anAnnouncement)._package())._beDirty();
  27911. return self;
  27912. }, function($ctx1) {$ctx1.fill(self,"onPackageAdded:",{anAnnouncement:anAnnouncement})});
  27913. },
  27914. args: ["anAnnouncement"],
  27915. source: "onPackageAdded: anAnnouncement\x0a\x09anAnnouncement package beDirty",
  27916. referencedClasses: [],
  27917. pragmas: [],
  27918. messageSends: ["beDirty", "package"]
  27919. }),
  27920. $globals.PackageStateObserver);
  27921. $core.addMethod(
  27922. $core.method({
  27923. selector: "onProtocolModification:",
  27924. protocol: "reactions",
  27925. fn: function (anAnnouncement){
  27926. var self=this,$self=this;
  27927. return $core.withContext(function($ctx1) {
  27928. var $1,$receiver;
  27929. $1=$recv(anAnnouncement)._package();
  27930. if(($receiver = $1) == null || $receiver.a$nil){
  27931. $1;
  27932. } else {
  27933. var package_;
  27934. package_=$receiver;
  27935. $recv(package_)._beDirty();
  27936. }
  27937. return self;
  27938. }, function($ctx1) {$ctx1.fill(self,"onProtocolModification:",{anAnnouncement:anAnnouncement})});
  27939. },
  27940. args: ["anAnnouncement"],
  27941. source: "onProtocolModification: anAnnouncement\x0a\x09anAnnouncement package ifNotNil: [ :package | package beDirty ]",
  27942. referencedClasses: [],
  27943. pragmas: [],
  27944. messageSends: ["ifNotNil:", "package", "beDirty"]
  27945. }),
  27946. $globals.PackageStateObserver);
  27947. $core.setSlots($globals.PackageStateObserver.a$cls, ["current"]);
  27948. $core.addMethod(
  27949. $core.method({
  27950. selector: "current",
  27951. protocol: "accessing",
  27952. fn: function (){
  27953. var self=this,$self=this;
  27954. return $core.withContext(function($ctx1) {
  27955. var $1,$receiver;
  27956. $1=$self.current;
  27957. if(($receiver = $1) == null || $receiver.a$nil){
  27958. $self.current=$self._new();
  27959. return $self.current;
  27960. } else {
  27961. return $1;
  27962. }
  27963. }, function($ctx1) {$ctx1.fill(self,"current",{})});
  27964. },
  27965. args: [],
  27966. source: "current\x0a\x09^ current ifNil: [ current := self new ]",
  27967. referencedClasses: [],
  27968. pragmas: [],
  27969. messageSends: ["ifNil:", "new"]
  27970. }),
  27971. $globals.PackageStateObserver.a$cls);
  27972. $core.addMethod(
  27973. $core.method({
  27974. selector: "initialize",
  27975. protocol: "initialization",
  27976. fn: function (){
  27977. var self=this,$self=this;
  27978. return $core.withContext(function($ctx1) {
  27979. $recv($self._current())._observeSystem();
  27980. return self;
  27981. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  27982. },
  27983. args: [],
  27984. source: "initialize\x0a\x09self current observeSystem",
  27985. referencedClasses: [],
  27986. pragmas: [],
  27987. messageSends: ["observeSystem", "current"]
  27988. }),
  27989. $globals.PackageStateObserver.a$cls);
  27990. $core.addClass("ParseError", $globals.Error, [], "Kernel-Infrastructure");
  27991. $globals.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`";
  27992. $core.addClass("Setting", $globals.Object, ["key", "value", "defaultValue"], "Kernel-Infrastructure");
  27993. $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`";
  27994. $core.addMethod(
  27995. $core.method({
  27996. selector: "defaultValue",
  27997. protocol: "accessing",
  27998. fn: function (){
  27999. var self=this,$self=this;
  28000. return $self.defaultValue;
  28001. },
  28002. args: [],
  28003. source: "defaultValue\x0a\x09^ defaultValue",
  28004. referencedClasses: [],
  28005. pragmas: [],
  28006. messageSends: []
  28007. }),
  28008. $globals.Setting);
  28009. $core.addMethod(
  28010. $core.method({
  28011. selector: "defaultValue:",
  28012. protocol: "accessing",
  28013. fn: function (aStringifiableObject){
  28014. var self=this,$self=this;
  28015. $self.defaultValue=aStringifiableObject;
  28016. return self;
  28017. },
  28018. args: ["aStringifiableObject"],
  28019. source: "defaultValue: aStringifiableObject\x0a\x09defaultValue := aStringifiableObject",
  28020. referencedClasses: [],
  28021. pragmas: [],
  28022. messageSends: []
  28023. }),
  28024. $globals.Setting);
  28025. $core.addMethod(
  28026. $core.method({
  28027. selector: "key",
  28028. protocol: "accessing",
  28029. fn: function (){
  28030. var self=this,$self=this;
  28031. return $self.key;
  28032. },
  28033. args: [],
  28034. source: "key\x0a\x09^ key",
  28035. referencedClasses: [],
  28036. pragmas: [],
  28037. messageSends: []
  28038. }),
  28039. $globals.Setting);
  28040. $core.addMethod(
  28041. $core.method({
  28042. selector: "key:",
  28043. protocol: "accessing",
  28044. fn: function (aString){
  28045. var self=this,$self=this;
  28046. $self.key=aString;
  28047. return self;
  28048. },
  28049. args: ["aString"],
  28050. source: "key: aString\x0a\x09key := aString",
  28051. referencedClasses: [],
  28052. pragmas: [],
  28053. messageSends: []
  28054. }),
  28055. $globals.Setting);
  28056. $core.addMethod(
  28057. $core.method({
  28058. selector: "value",
  28059. protocol: "accessing",
  28060. fn: function (){
  28061. var self=this,$self=this;
  28062. return $core.withContext(function($ctx1) {
  28063. return $recv($recv($globals.Smalltalk)._settings())._at_ifAbsent_($self._key(),(function(){
  28064. return $core.withContext(function($ctx2) {
  28065. return $self._defaultValue();
  28066. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28067. }));
  28068. }, function($ctx1) {$ctx1.fill(self,"value",{})});
  28069. },
  28070. args: [],
  28071. source: "value\x0a\x09^ Smalltalk settings at: self key ifAbsent: [ self defaultValue ]",
  28072. referencedClasses: ["Smalltalk"],
  28073. pragmas: [],
  28074. messageSends: ["at:ifAbsent:", "settings", "key", "defaultValue"]
  28075. }),
  28076. $globals.Setting);
  28077. $core.addMethod(
  28078. $core.method({
  28079. selector: "value:",
  28080. protocol: "accessing",
  28081. fn: function (aStringifiableObject){
  28082. var self=this,$self=this;
  28083. return $core.withContext(function($ctx1) {
  28084. return $recv($recv($globals.Smalltalk)._settings())._at_put_($self._key(),aStringifiableObject);
  28085. }, function($ctx1) {$ctx1.fill(self,"value:",{aStringifiableObject:aStringifiableObject})});
  28086. },
  28087. args: ["aStringifiableObject"],
  28088. source: "value: aStringifiableObject\x0a\x09^ Smalltalk settings at: self key put: aStringifiableObject",
  28089. referencedClasses: ["Smalltalk"],
  28090. pragmas: [],
  28091. messageSends: ["at:put:", "settings", "key"]
  28092. }),
  28093. $globals.Setting);
  28094. $core.addMethod(
  28095. $core.method({
  28096. selector: "at:ifAbsent:",
  28097. protocol: "instance creation",
  28098. fn: function (aString,aDefaultValue){
  28099. var self=this,$self=this;
  28100. return $core.withContext(function($ctx1) {
  28101. var $1;
  28102. $1=(
  28103. $ctx1.supercall = true,
  28104. ($globals.Setting.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  28105. $ctx1.supercall = false;
  28106. $recv($1)._key_(aString);
  28107. $recv($1)._defaultValue_(aDefaultValue);
  28108. return $recv($1)._yourself();
  28109. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aDefaultValue:aDefaultValue})});
  28110. },
  28111. args: ["aString", "aDefaultValue"],
  28112. source: "at: aString ifAbsent: aDefaultValue\x0a\x09\x0a\x09^ super new\x0a\x09\x09key: aString;\x0a\x09\x09defaultValue: aDefaultValue;\x0a\x09\x09yourself",
  28113. referencedClasses: [],
  28114. pragmas: [],
  28115. messageSends: ["key:", "new", "defaultValue:", "yourself"]
  28116. }),
  28117. $globals.Setting.a$cls);
  28118. $core.addMethod(
  28119. $core.method({
  28120. selector: "new",
  28121. protocol: "instance creation",
  28122. fn: function (){
  28123. var self=this,$self=this;
  28124. return $core.withContext(function($ctx1) {
  28125. $self._shouldNotImplement();
  28126. return self;
  28127. }, function($ctx1) {$ctx1.fill(self,"new",{})});
  28128. },
  28129. args: [],
  28130. source: "new\x0a\x09self shouldNotImplement",
  28131. referencedClasses: [],
  28132. pragmas: [],
  28133. messageSends: ["shouldNotImplement"]
  28134. }),
  28135. $globals.Setting.a$cls);
  28136. $core.addClass("SmalltalkImage", $globals.Object, ["globalJsVariables", "packageDictionary"], "Kernel-Infrastructure");
  28137. $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.";
  28138. $core.addMethod(
  28139. $core.method({
  28140. selector: "addGlobalJsVariable:",
  28141. protocol: "globals",
  28142. fn: function (aString){
  28143. var self=this,$self=this;
  28144. return $core.withContext(function($ctx1) {
  28145. $recv($self._globalJsVariables())._add_(aString);
  28146. return self;
  28147. }, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString})});
  28148. },
  28149. args: ["aString"],
  28150. source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString",
  28151. referencedClasses: [],
  28152. pragmas: [],
  28153. messageSends: ["add:", "globalJsVariables"]
  28154. }),
  28155. $globals.SmalltalkImage);
  28156. $core.addMethod(
  28157. $core.method({
  28158. selector: "adoptPackageDescriptors",
  28159. protocol: "private",
  28160. fn: function (){
  28161. var self=this,$self=this;
  28162. return $core.withContext(function($ctx1) {
  28163. return $self._tryAdoptPackageDescriptorsBeyond_($recv($globals.Set)._new());
  28164. }, function($ctx1) {$ctx1.fill(self,"adoptPackageDescriptors",{})});
  28165. },
  28166. args: [],
  28167. source: "adoptPackageDescriptors\x0a\x09^ self tryAdoptPackageDescriptorsBeyond: Set new",
  28168. referencedClasses: ["Set"],
  28169. pragmas: [],
  28170. messageSends: ["tryAdoptPackageDescriptorsBeyond:", "new"]
  28171. }),
  28172. $globals.SmalltalkImage);
  28173. $core.addMethod(
  28174. $core.method({
  28175. selector: "amdRequire",
  28176. protocol: "accessing amd",
  28177. fn: function (){
  28178. var self=this,$self=this;
  28179. return $core.withContext(function($ctx1) {
  28180. return $recv($self._core())._at_("amdRequire");
  28181. }, function($ctx1) {$ctx1.fill(self,"amdRequire",{})});
  28182. },
  28183. args: [],
  28184. source: "amdRequire\x0a\x09^ self core at: 'amdRequire'",
  28185. referencedClasses: [],
  28186. pragmas: [],
  28187. messageSends: ["at:", "core"]
  28188. }),
  28189. $globals.SmalltalkImage);
  28190. $core.addMethod(
  28191. $core.method({
  28192. selector: "asSmalltalkException:",
  28193. protocol: "error handling",
  28194. fn: function (anObject){
  28195. var self=this,$self=this;
  28196. return $core.withContext(function($ctx1) {
  28197. var $1;
  28198. $1=$recv($self._isSmalltalkObject_(anObject))._and_((function(){
  28199. return $core.withContext(function($ctx2) {
  28200. return $recv(anObject)._isKindOf_($globals.Error);
  28201. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28202. }));
  28203. if($core.assert($1)){
  28204. return anObject;
  28205. } else {
  28206. return $recv($globals.JavaScriptException)._on_(anObject);
  28207. }
  28208. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject})});
  28209. },
  28210. args: ["anObject"],
  28211. source: "asSmalltalkException: anObject\x0a\x09\x22A JavaScript exception may be thrown.\x0a\x09We then need to convert it back to a Smalltalk object\x22\x0a\x09\x0a\x09^ ((self isSmalltalkObject: anObject) and: [ anObject isKindOf: Error ])\x0a\x09\x09ifTrue: [ anObject ]\x0a\x09\x09ifFalse: [ JavaScriptException on: anObject ]",
  28212. referencedClasses: ["Error", "JavaScriptException"],
  28213. pragmas: [],
  28214. messageSends: ["ifTrue:ifFalse:", "and:", "isSmalltalkObject:", "isKindOf:", "on:"]
  28215. }),
  28216. $globals.SmalltalkImage);
  28217. $core.addMethod(
  28218. $core.method({
  28219. selector: "basicCreatePackage:",
  28220. protocol: "private",
  28221. fn: function (packageName){
  28222. var self=this,$self=this;
  28223. return $core.withContext(function($ctx1) {
  28224. return $recv($self._packageDictionary())._at_ifAbsentPut_(packageName,(function(){
  28225. return $core.withContext(function($ctx2) {
  28226. return $recv($globals.Package)._new_(packageName);
  28227. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28228. }));
  28229. }, function($ctx1) {$ctx1.fill(self,"basicCreatePackage:",{packageName:packageName})});
  28230. },
  28231. args: ["packageName"],
  28232. 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 ]",
  28233. referencedClasses: ["Package"],
  28234. pragmas: [],
  28235. messageSends: ["at:ifAbsentPut:", "packageDictionary", "new:"]
  28236. }),
  28237. $globals.SmalltalkImage);
  28238. $core.addMethod(
  28239. $core.method({
  28240. selector: "basicParse:",
  28241. protocol: "private",
  28242. fn: function (aString){
  28243. var self=this,$self=this;
  28244. return $core.withContext(function($ctx1) {
  28245. return $recv(smalltalkParser)._parse_(aString);
  28246. }, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString})});
  28247. },
  28248. args: ["aString"],
  28249. source: "basicParse: aString\x0a\x09^ smalltalkParser parse: aString",
  28250. referencedClasses: [],
  28251. pragmas: [],
  28252. messageSends: ["parse:"]
  28253. }),
  28254. $globals.SmalltalkImage);
  28255. $core.addMethod(
  28256. $core.method({
  28257. selector: "beClean",
  28258. protocol: "packages",
  28259. fn: function (){
  28260. var self=this,$self=this;
  28261. return $core.withContext(function($ctx1) {
  28262. $recv($self._packages())._do_("beClean");
  28263. return self;
  28264. }, function($ctx1) {$ctx1.fill(self,"beClean",{})});
  28265. },
  28266. args: [],
  28267. source: "beClean\x0a\x09\x22Marks all packages clean.\x22\x0a\x0a\x09self packages do: #beClean",
  28268. referencedClasses: [],
  28269. pragmas: [],
  28270. messageSends: ["do:", "packages"]
  28271. }),
  28272. $globals.SmalltalkImage);
  28273. $core.addMethod(
  28274. $core.method({
  28275. selector: "cancelOptOut:",
  28276. protocol: "accessing",
  28277. fn: function (anObject){
  28278. var self=this,$self=this;
  28279. return $core.withContext(function($ctx1) {
  28280. delete anObject.a$cls;;
  28281. return self;
  28282. }, function($ctx1) {$ctx1.fill(self,"cancelOptOut:",{anObject:anObject})});
  28283. },
  28284. args: ["anObject"],
  28285. 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;'>",
  28286. referencedClasses: [],
  28287. pragmas: [["inlineJS:", ["delete anObject.a$cls;"]]],
  28288. messageSends: []
  28289. }),
  28290. $globals.SmalltalkImage);
  28291. $core.addMethod(
  28292. $core.method({
  28293. selector: "classes",
  28294. protocol: "classes",
  28295. fn: function (){
  28296. var self=this,$self=this;
  28297. return $core.withContext(function($ctx1) {
  28298. return $recv($recv($self._core())._traitsOrClasses())._copy();
  28299. }, function($ctx1) {$ctx1.fill(self,"classes",{})});
  28300. },
  28301. args: [],
  28302. source: "classes\x0a\x09^ self core traitsOrClasses copy",
  28303. referencedClasses: [],
  28304. pragmas: [],
  28305. messageSends: ["copy", "traitsOrClasses", "core"]
  28306. }),
  28307. $globals.SmalltalkImage);
  28308. $core.addMethod(
  28309. $core.method({
  28310. selector: "core",
  28311. protocol: "accessing",
  28312. fn: function (){
  28313. var self=this,$self=this;
  28314. return $core.withContext(function($ctx1) {
  28315. return $core;
  28316. return self;
  28317. }, function($ctx1) {$ctx1.fill(self,"core",{})});
  28318. },
  28319. args: [],
  28320. source: "core\x0a\x09<inlineJS: 'return $core'>",
  28321. referencedClasses: [],
  28322. pragmas: [["inlineJS:", ["return $core"]]],
  28323. messageSends: []
  28324. }),
  28325. $globals.SmalltalkImage);
  28326. $core.addMethod(
  28327. $core.method({
  28328. selector: "createPackage:",
  28329. protocol: "packages",
  28330. fn: function (packageName){
  28331. var self=this,$self=this;
  28332. var package_,announcement;
  28333. return $core.withContext(function($ctx1) {
  28334. var $1;
  28335. package_=$self._basicCreatePackage_(packageName);
  28336. $1=$recv($globals.PackageAdded)._new();
  28337. $recv($1)._package_(package_);
  28338. announcement=$recv($1)._yourself();
  28339. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  28340. return package_;
  28341. }, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName,package_:package_,announcement:announcement})});
  28342. },
  28343. args: ["packageName"],
  28344. 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",
  28345. referencedClasses: ["PackageAdded", "SystemAnnouncer"],
  28346. pragmas: [],
  28347. messageSends: ["basicCreatePackage:", "package:", "new", "yourself", "announce:", "current"]
  28348. }),
  28349. $globals.SmalltalkImage);
  28350. $core.addMethod(
  28351. $core.method({
  28352. selector: "defaultAmdNamespace",
  28353. protocol: "accessing amd",
  28354. fn: function (){
  28355. var self=this,$self=this;
  28356. return $core.withContext(function($ctx1) {
  28357. return "transport.defaultAmdNamespace"._settingValue();
  28358. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{})});
  28359. },
  28360. args: [],
  28361. source: "defaultAmdNamespace\x0a\x09^ 'transport.defaultAmdNamespace' settingValue",
  28362. referencedClasses: [],
  28363. pragmas: [],
  28364. messageSends: ["settingValue"]
  28365. }),
  28366. $globals.SmalltalkImage);
  28367. $core.addMethod(
  28368. $core.method({
  28369. selector: "defaultAmdNamespace:",
  28370. protocol: "accessing amd",
  28371. fn: function (aString){
  28372. var self=this,$self=this;
  28373. return $core.withContext(function($ctx1) {
  28374. "transport.defaultAmdNamespace"._settingValue_(aString);
  28375. return self;
  28376. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString})});
  28377. },
  28378. args: ["aString"],
  28379. source: "defaultAmdNamespace: aString\x0a\x09'transport.defaultAmdNamespace' settingValue: aString",
  28380. referencedClasses: [],
  28381. pragmas: [],
  28382. messageSends: ["settingValue:"]
  28383. }),
  28384. $globals.SmalltalkImage);
  28385. $core.addMethod(
  28386. $core.method({
  28387. selector: "deleteClass:",
  28388. protocol: "private",
  28389. fn: function (aClass){
  28390. var self=this,$self=this;
  28391. return $core.withContext(function($ctx1) {
  28392. $core.removeClass(aClass);
  28393. return self;
  28394. }, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass})});
  28395. },
  28396. args: ["aClass"],
  28397. 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)'>",
  28398. referencedClasses: [],
  28399. pragmas: [["inlineJS:", ["$core.removeClass(aClass)"]]],
  28400. messageSends: []
  28401. }),
  28402. $globals.SmalltalkImage);
  28403. $core.addMethod(
  28404. $core.method({
  28405. selector: "deleteGlobalJsVariable:",
  28406. protocol: "globals",
  28407. fn: function (aString){
  28408. var self=this,$self=this;
  28409. return $core.withContext(function($ctx1) {
  28410. $recv($self._globalJsVariables())._remove_ifAbsent_(aString,(function(){
  28411. }));
  28412. return self;
  28413. }, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString})});
  28414. },
  28415. args: ["aString"],
  28416. source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[]",
  28417. referencedClasses: [],
  28418. pragmas: [],
  28419. messageSends: ["remove:ifAbsent:", "globalJsVariables"]
  28420. }),
  28421. $globals.SmalltalkImage);
  28422. $core.addMethod(
  28423. $core.method({
  28424. selector: "existsJsGlobal:",
  28425. protocol: "testing",
  28426. fn: function (aString){
  28427. var self=this,$self=this;
  28428. return $core.withContext(function($ctx1) {
  28429. $self._deprecatedAPI_("Use Platform >> includesGlobal: instead");
  28430. return $recv($globals.Platform)._includesGlobal_(aString);
  28431. }, function($ctx1) {$ctx1.fill(self,"existsJsGlobal:",{aString:aString})});
  28432. },
  28433. args: ["aString"],
  28434. source: "existsJsGlobal: aString\x0a\x09self deprecatedAPI: 'Use Platform >> includesGlobal: instead'.\x0a\x09^ Platform includesGlobal: aString",
  28435. referencedClasses: ["Platform"],
  28436. pragmas: [],
  28437. messageSends: ["deprecatedAPI:", "includesGlobal:"]
  28438. }),
  28439. $globals.SmalltalkImage);
  28440. $core.addMethod(
  28441. $core.method({
  28442. selector: "globalJsVariables",
  28443. protocol: "globals",
  28444. fn: function (){
  28445. var self=this,$self=this;
  28446. return $core.withContext(function($ctx1) {
  28447. var $1,$receiver;
  28448. $1=$self.globalJsVariables;
  28449. if(($receiver = $1) == null || $receiver.a$nil){
  28450. $self.globalJsVariables=["window", "document", "process", "global"];
  28451. return $self.globalJsVariables;
  28452. } else {
  28453. return $1;
  28454. }
  28455. }, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{})});
  28456. },
  28457. args: [],
  28458. source: "globalJsVariables\x0a\x09^ globalJsVariables ifNil: [\x0a\x09\x09globalJsVariables := #(window document process global) ]",
  28459. referencedClasses: [],
  28460. pragmas: [],
  28461. messageSends: ["ifNil:"]
  28462. }),
  28463. $globals.SmalltalkImage);
  28464. $core.addMethod(
  28465. $core.method({
  28466. selector: "globals",
  28467. protocol: "accessing",
  28468. fn: function (){
  28469. var self=this,$self=this;
  28470. return $core.withContext(function($ctx1) {
  28471. return $globals;
  28472. return self;
  28473. }, function($ctx1) {$ctx1.fill(self,"globals",{})});
  28474. },
  28475. args: [],
  28476. source: "globals\x0a\x09<inlineJS: 'return $globals'>",
  28477. referencedClasses: [],
  28478. pragmas: [["inlineJS:", ["return $globals"]]],
  28479. messageSends: []
  28480. }),
  28481. $globals.SmalltalkImage);
  28482. $core.addMethod(
  28483. $core.method({
  28484. selector: "isSmalltalkObject:",
  28485. protocol: "testing",
  28486. fn: function (anObject){
  28487. var self=this,$self=this;
  28488. return $core.withContext(function($ctx1) {
  28489. return anObject.a$cls != null;
  28490. return self;
  28491. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject})});
  28492. },
  28493. args: ["anObject"],
  28494. 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'>",
  28495. referencedClasses: [],
  28496. pragmas: [["inlineJS:", ["return anObject.a$cls != null"]]],
  28497. messageSends: []
  28498. }),
  28499. $globals.SmalltalkImage);
  28500. $core.addMethod(
  28501. $core.method({
  28502. selector: "optOut:",
  28503. protocol: "accessing",
  28504. fn: function (anObject){
  28505. var self=this,$self=this;
  28506. return $core.withContext(function($ctx1) {
  28507. anObject.a$cls = null;
  28508. return self;
  28509. }, function($ctx1) {$ctx1.fill(self,"optOut:",{anObject:anObject})});
  28510. },
  28511. args: ["anObject"],
  28512. 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'>",
  28513. referencedClasses: [],
  28514. pragmas: [["inlineJS:", ["anObject.a$cls = null"]]],
  28515. messageSends: []
  28516. }),
  28517. $globals.SmalltalkImage);
  28518. $core.addMethod(
  28519. $core.method({
  28520. selector: "packageAt:ifAbsent:",
  28521. protocol: "packages",
  28522. fn: function (packageName,aBlock){
  28523. var self=this,$self=this;
  28524. return $core.withContext(function($ctx1) {
  28525. return $recv($self._packageDictionary())._at_ifAbsent_(packageName,aBlock);
  28526. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock})});
  28527. },
  28528. args: ["packageName", "aBlock"],
  28529. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^ self packageDictionary at: packageName ifAbsent: aBlock",
  28530. referencedClasses: [],
  28531. pragmas: [],
  28532. messageSends: ["at:ifAbsent:", "packageDictionary"]
  28533. }),
  28534. $globals.SmalltalkImage);
  28535. $core.addMethod(
  28536. $core.method({
  28537. selector: "packageAt:ifPresent:",
  28538. protocol: "packages",
  28539. fn: function (packageName,aBlock){
  28540. var self=this,$self=this;
  28541. return $core.withContext(function($ctx1) {
  28542. return $recv($self._packageDictionary())._at_ifPresent_(packageName,aBlock);
  28543. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifPresent:",{packageName:packageName,aBlock:aBlock})});
  28544. },
  28545. args: ["packageName", "aBlock"],
  28546. source: "packageAt: packageName ifPresent: aBlock\x0a\x09^ self packageDictionary at: packageName ifPresent: aBlock",
  28547. referencedClasses: [],
  28548. pragmas: [],
  28549. messageSends: ["at:ifPresent:", "packageDictionary"]
  28550. }),
  28551. $globals.SmalltalkImage);
  28552. $core.addMethod(
  28553. $core.method({
  28554. selector: "packageDictionary",
  28555. protocol: "packages",
  28556. fn: function (){
  28557. var self=this,$self=this;
  28558. return $core.withContext(function($ctx1) {
  28559. var $1,$receiver;
  28560. $1=$self.packageDictionary;
  28561. if(($receiver = $1) == null || $receiver.a$nil){
  28562. $self.packageDictionary=$recv($globals.Dictionary)._new();
  28563. return $self.packageDictionary;
  28564. } else {
  28565. return $1;
  28566. }
  28567. }, function($ctx1) {$ctx1.fill(self,"packageDictionary",{})});
  28568. },
  28569. args: [],
  28570. source: "packageDictionary\x0a\x09^ packageDictionary ifNil: [ packageDictionary := Dictionary new ]",
  28571. referencedClasses: ["Dictionary"],
  28572. pragmas: [],
  28573. messageSends: ["ifNil:", "new"]
  28574. }),
  28575. $globals.SmalltalkImage);
  28576. $core.addMethod(
  28577. $core.method({
  28578. selector: "packages",
  28579. protocol: "packages",
  28580. fn: function (){
  28581. var self=this,$self=this;
  28582. return $core.withContext(function($ctx1) {
  28583. return $recv($recv($self._packageDictionary())._values())._copy();
  28584. }, function($ctx1) {$ctx1.fill(self,"packages",{})});
  28585. },
  28586. args: [],
  28587. source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09^ self packageDictionary values copy",
  28588. referencedClasses: [],
  28589. pragmas: [],
  28590. messageSends: ["copy", "values", "packageDictionary"]
  28591. }),
  28592. $globals.SmalltalkImage);
  28593. $core.addMethod(
  28594. $core.method({
  28595. selector: "parse:",
  28596. protocol: "accessing",
  28597. fn: function (aString){
  28598. var self=this,$self=this;
  28599. var result;
  28600. return $core.withContext(function($ctx1) {
  28601. var $1;
  28602. $recv((function(){
  28603. return $core.withContext(function($ctx2) {
  28604. result=$self._basicParse_(aString);
  28605. return result;
  28606. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28607. }))._tryCatch_((function(ex){
  28608. return $core.withContext(function($ctx2) {
  28609. return $recv($self._parseError_parsing_(ex,aString))._signal();
  28610. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  28611. }));
  28612. $1=result;
  28613. $recv($1)._source_(aString);
  28614. return $recv($1)._yourself();
  28615. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result})});
  28616. },
  28617. args: ["aString"],
  28618. source: "parse: aString\x0a\x09| result |\x0a\x09\x0a\x09[ result := self basicParse: aString ] \x0a\x09\x09tryCatch: [ :ex | (self parseError: ex parsing: aString) signal ].\x0a\x09\x09\x0a\x09^ result\x0a\x09\x09source: aString;\x0a\x09\x09yourself",
  28619. referencedClasses: [],
  28620. pragmas: [],
  28621. messageSends: ["tryCatch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"]
  28622. }),
  28623. $globals.SmalltalkImage);
  28624. $core.addMethod(
  28625. $core.method({
  28626. selector: "parseError:parsing:",
  28627. protocol: "error handling",
  28628. fn: function (anException,aString){
  28629. var self=this,$self=this;
  28630. return $core.withContext(function($ctx1) {
  28631. var $1,$2,$9,$8,$7,$6,$5,$4,$3,$receiver;
  28632. $1=$recv(anException)._basicAt_("location");
  28633. $ctx1.sendIdx["basicAt:"]=1;
  28634. if(($receiver = $1) == null || $receiver.a$nil){
  28635. return $recv(anException)._pass();
  28636. } else {
  28637. var loc;
  28638. loc=$receiver;
  28639. $2=$recv($globals.ParseError)._new();
  28640. $9=$recv(loc)._start();
  28641. $ctx1.sendIdx["start"]=1;
  28642. $8=$recv($9)._line();
  28643. $7="Parse error on line ".__comma($8);
  28644. $6=$recv($7).__comma(" column ");
  28645. $ctx1.sendIdx[","]=4;
  28646. $5=$recv($6).__comma($recv($recv(loc)._start())._column());
  28647. $ctx1.sendIdx[","]=3;
  28648. $4=$recv($5).__comma(" : Unexpected character ");
  28649. $ctx1.sendIdx[","]=2;
  28650. $3=$recv($4).__comma($recv(anException)._basicAt_("found"));
  28651. $ctx1.sendIdx[","]=1;
  28652. $recv($2)._messageText_($3);
  28653. return $recv($2)._yourself();
  28654. }
  28655. return self;
  28656. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString})});
  28657. },
  28658. args: ["anException", "aString"],
  28659. 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 ]",
  28660. referencedClasses: ["ParseError"],
  28661. pragmas: [],
  28662. messageSends: ["ifNil:ifNotNil:", "basicAt:", "pass", "messageText:", "new", ",", "line", "start", "column", "yourself"]
  28663. }),
  28664. $globals.SmalltalkImage);
  28665. $core.addMethod(
  28666. $core.method({
  28667. selector: "postLoad",
  28668. protocol: "image",
  28669. fn: function (){
  28670. var self=this,$self=this;
  28671. return $core.withContext(function($ctx1) {
  28672. var $1;
  28673. return $recv($self._adoptPackageDescriptors())._then_((function(pkgs){
  28674. var classes;
  28675. return $core.withContext(function($ctx2) {
  28676. $recv(pkgs)._do_("beClean");
  28677. $ctx2.sendIdx["do:"]=1;
  28678. classes=$recv($recv($globals.Smalltalk)._classes())._select_((function(each){
  28679. return $core.withContext(function($ctx3) {
  28680. return $recv(pkgs)._includes_($recv(each)._package());
  28681. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  28682. }));
  28683. $recv(classes)._do_((function(each){
  28684. return $core.withContext(function($ctx3) {
  28685. $1=$recv(each).__eq($self._class());
  28686. if(!$core.assert($1)){
  28687. return $recv(each)._initialize();
  28688. }
  28689. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)});
  28690. }));
  28691. return $self._sweepPackageDescriptors_(pkgs);
  28692. }, function($ctx2) {$ctx2.fillBlock({pkgs:pkgs,classes:classes},$ctx1,1)});
  28693. }));
  28694. }, function($ctx1) {$ctx1.fill(self,"postLoad",{})});
  28695. },
  28696. args: [],
  28697. 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 ]",
  28698. referencedClasses: ["Smalltalk"],
  28699. pragmas: [],
  28700. messageSends: ["then:", "adoptPackageDescriptors", "do:", "select:", "classes", "includes:", "package", "ifFalse:", "=", "class", "initialize", "sweepPackageDescriptors:"]
  28701. }),
  28702. $globals.SmalltalkImage);
  28703. $core.addMethod(
  28704. $core.method({
  28705. selector: "pseudoVariableNames",
  28706. protocol: "accessing",
  28707. fn: function (){
  28708. var self=this,$self=this;
  28709. return ["self", "super", "nil", "true", "false", "thisContext"];
  28710. },
  28711. args: [],
  28712. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  28713. referencedClasses: [],
  28714. pragmas: [],
  28715. messageSends: []
  28716. }),
  28717. $globals.SmalltalkImage);
  28718. $core.addMethod(
  28719. $core.method({
  28720. selector: "readJSObject:",
  28721. protocol: "accessing",
  28722. fn: function (anObject){
  28723. var self=this,$self=this;
  28724. return $core.withContext(function($ctx1) {
  28725. return $core.readJSObject(anObject);
  28726. return self;
  28727. }, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject})});
  28728. },
  28729. args: ["anObject"],
  28730. source: "readJSObject: anObject\x0a\x09<inlineJS: 'return $core.readJSObject(anObject)'>",
  28731. referencedClasses: [],
  28732. pragmas: [["inlineJS:", ["return $core.readJSObject(anObject)"]]],
  28733. messageSends: []
  28734. }),
  28735. $globals.SmalltalkImage);
  28736. $core.addMethod(
  28737. $core.method({
  28738. selector: "removeClass:",
  28739. protocol: "classes",
  28740. fn: function (aClass){
  28741. var self=this,$self=this;
  28742. return $core.withContext(function($ctx1) {
  28743. var $1,$2,$5,$4,$6,$3,$7,$9,$8;
  28744. $1=$recv(aClass)._isMetaclass();
  28745. if($core.assert($1)){
  28746. $2=$recv($recv(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!");
  28747. $ctx1.sendIdx[","]=1;
  28748. $self._error_($2);
  28749. $ctx1.sendIdx["error:"]=1;
  28750. }
  28751. $recv(aClass)._allSubclassesDo_((function(subclass){
  28752. return $core.withContext(function($ctx2) {
  28753. $5=$recv(aClass)._name();
  28754. $ctx2.sendIdx["name"]=1;
  28755. $4=$recv($5).__comma(" has a subclass: ");
  28756. $ctx2.sendIdx[","]=3;
  28757. $6=$recv(subclass)._name();
  28758. $ctx2.sendIdx["name"]=2;
  28759. $3=$recv($4).__comma($6);
  28760. $ctx2.sendIdx[","]=2;
  28761. return $self._error_($3);
  28762. $ctx2.sendIdx["error:"]=2;
  28763. }, function($ctx2) {$ctx2.fillBlock({subclass:subclass},$ctx1,2)});
  28764. }));
  28765. $recv($recv(aClass)._traitUsers())._ifNotEmpty_((function(){
  28766. return $core.withContext(function($ctx2) {
  28767. return $self._error_($recv($recv(aClass)._name()).__comma(" has trait users."));
  28768. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  28769. }));
  28770. $self._deleteClass_(aClass);
  28771. $recv(aClass)._includingPossibleMetaDo_((function(each){
  28772. return $core.withContext(function($ctx2) {
  28773. return $recv(each)._setTraitComposition_([]);
  28774. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  28775. }));
  28776. $7=$recv($globals.SystemAnnouncer)._current();
  28777. $9=$recv($globals.ClassRemoved)._new();
  28778. $recv($9)._theClass_(aClass);
  28779. $8=$recv($9)._yourself();
  28780. $recv($7)._announce_($8);
  28781. return self;
  28782. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass})});
  28783. },
  28784. args: ["aClass"],
  28785. 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)",
  28786. referencedClasses: ["SystemAnnouncer", "ClassRemoved"],
  28787. pragmas: [],
  28788. messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "allSubclassesDo:", "name", "ifNotEmpty:", "traitUsers", "deleteClass:", "includingPossibleMetaDo:", "setTraitComposition:", "announce:", "current", "theClass:", "new", "yourself"]
  28789. }),
  28790. $globals.SmalltalkImage);
  28791. $core.addMethod(
  28792. $core.method({
  28793. selector: "removePackage:",
  28794. protocol: "packages",
  28795. fn: function (packageName){
  28796. var self=this,$self=this;
  28797. var pkg;
  28798. return $core.withContext(function($ctx1) {
  28799. pkg=$self._packageAt_ifAbsent_(packageName,(function(){
  28800. return $core.withContext(function($ctx2) {
  28801. return $self._error_("Missing package: ".__comma(packageName));
  28802. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28803. }));
  28804. $recv($recv(pkg)._classes())._do_((function(each){
  28805. return $core.withContext(function($ctx2) {
  28806. return $self._removeClass_(each);
  28807. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  28808. }));
  28809. $recv($self._packageDictionary())._removeKey_(packageName);
  28810. return self;
  28811. }, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg})});
  28812. },
  28813. args: ["packageName"],
  28814. 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",
  28815. referencedClasses: [],
  28816. pragmas: [],
  28817. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "removeKey:", "packageDictionary"]
  28818. }),
  28819. $globals.SmalltalkImage);
  28820. $core.addMethod(
  28821. $core.method({
  28822. selector: "renamePackage:to:",
  28823. protocol: "packages",
  28824. fn: function (packageName,newName){
  28825. var self=this,$self=this;
  28826. var pkg;
  28827. return $core.withContext(function($ctx1) {
  28828. var $1,$2,$3;
  28829. pkg=$self._packageAt_ifAbsent_(packageName,(function(){
  28830. return $core.withContext(function($ctx2) {
  28831. $1="Missing package: ".__comma(packageName);
  28832. $ctx2.sendIdx[","]=1;
  28833. return $self._error_($1);
  28834. $ctx2.sendIdx["error:"]=1;
  28835. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28836. }));
  28837. $self._packageAt_ifPresent_(newName,(function(){
  28838. return $core.withContext(function($ctx2) {
  28839. return $self._error_("Already exists a package called: ".__comma(newName));
  28840. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  28841. }));
  28842. $2=pkg;
  28843. $recv($2)._name_(newName);
  28844. $recv($2)._beDirty();
  28845. $3=$self._packageDictionary();
  28846. $recv($3)._at_put_(newName,pkg);
  28847. $recv($3)._removeKey_(packageName);
  28848. return self;
  28849. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg})});
  28850. },
  28851. args: ["packageName", "newName"],
  28852. 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",
  28853. referencedClasses: [],
  28854. pragmas: [],
  28855. messageSends: ["packageAt:ifAbsent:", "error:", ",", "packageAt:ifPresent:", "name:", "beDirty", "at:put:", "packageDictionary", "removeKey:"]
  28856. }),
  28857. $globals.SmalltalkImage);
  28858. $core.addMethod(
  28859. $core.method({
  28860. selector: "reservedWords",
  28861. protocol: "accessing",
  28862. fn: function (){
  28863. var self=this,$self=this;
  28864. 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"];
  28865. },
  28866. args: [],
  28867. 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)",
  28868. referencedClasses: [],
  28869. pragmas: [],
  28870. messageSends: []
  28871. }),
  28872. $globals.SmalltalkImage);
  28873. $core.addMethod(
  28874. $core.method({
  28875. selector: "settings",
  28876. protocol: "accessing",
  28877. fn: function (){
  28878. var self=this,$self=this;
  28879. return $globals.SmalltalkSettings;
  28880. },
  28881. args: [],
  28882. source: "settings\x0a\x09^ SmalltalkSettings",
  28883. referencedClasses: ["SmalltalkSettings"],
  28884. pragmas: [],
  28885. messageSends: []
  28886. }),
  28887. $globals.SmalltalkImage);
  28888. $core.addMethod(
  28889. $core.method({
  28890. selector: "sweepPackageDescriptors:",
  28891. protocol: "private",
  28892. fn: function (pkgs){
  28893. var self=this,$self=this;
  28894. var pd;
  28895. return $core.withContext(function($ctx1) {
  28896. pd=$recv($self._core())._packageDescriptors();
  28897. $recv(pkgs)._do_((function(each){
  28898. return $core.withContext(function($ctx2) {
  28899. return $recv(pd)._removeKey_($recv(each)._name());
  28900. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  28901. }));
  28902. return self;
  28903. }, function($ctx1) {$ctx1.fill(self,"sweepPackageDescriptors:",{pkgs:pkgs,pd:pd})});
  28904. },
  28905. args: ["pkgs"],
  28906. source: "sweepPackageDescriptors: pkgs\x0a\x09| pd |\x09\x0a\x09pd := self core packageDescriptors.\x0a\x09pkgs do: [ :each | pd removeKey: each name ]",
  28907. referencedClasses: [],
  28908. pragmas: [],
  28909. messageSends: ["packageDescriptors", "core", "do:", "removeKey:", "name"]
  28910. }),
  28911. $globals.SmalltalkImage);
  28912. $core.addMethod(
  28913. $core.method({
  28914. selector: "tryAdoptPackageDescriptorsBeyond:",
  28915. protocol: "private",
  28916. fn: function (aSet){
  28917. var self=this,$self=this;
  28918. var original;
  28919. return $core.withContext(function($ctx1) {
  28920. var $1;
  28921. original=$recv(aSet)._copy();
  28922. $recv($recv($self._core())._packageDescriptors())._keysAndValuesDo_((function(key,value){
  28923. return $core.withContext(function($ctx2) {
  28924. return $recv(aSet)._add_($recv($globals.Package)._named_javaScriptDescriptor_(key,value));
  28925. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  28926. }));
  28927. $1=$recv(aSet)._allSatisfy_((function(each){
  28928. return $core.withContext(function($ctx2) {
  28929. return $recv(original)._includes_(each);
  28930. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  28931. }));
  28932. if($core.assert($1)){
  28933. return $recv($globals.Promise)._value_(aSet);
  28934. } else {
  28935. return $recv($recv($globals.Promise)._all_($recv(aSet)._collect_("isReady")))._then_((function(){
  28936. return $core.withContext(function($ctx2) {
  28937. return $self._tryAdoptPackageDescriptorsBeyond_(aSet);
  28938. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  28939. }));
  28940. }
  28941. }, function($ctx1) {$ctx1.fill(self,"tryAdoptPackageDescriptorsBeyond:",{aSet:aSet,original:original})});
  28942. },
  28943. args: ["aSet"],
  28944. 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 ]",
  28945. referencedClasses: ["Package", "Promise"],
  28946. pragmas: [],
  28947. messageSends: ["copy", "keysAndValuesDo:", "packageDescriptors", "core", "add:", "named:javaScriptDescriptor:", "ifFalse:ifTrue:", "allSatisfy:", "includes:", "then:", "all:", "collect:", "tryAdoptPackageDescriptorsBeyond:", "value:"]
  28948. }),
  28949. $globals.SmalltalkImage);
  28950. $core.addMethod(
  28951. $core.method({
  28952. selector: "version",
  28953. protocol: "accessing",
  28954. fn: function (){
  28955. var self=this,$self=this;
  28956. return "0.23.1";
  28957. },
  28958. args: [],
  28959. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.23.1'",
  28960. referencedClasses: [],
  28961. pragmas: [],
  28962. messageSends: []
  28963. }),
  28964. $globals.SmalltalkImage);
  28965. $core.setSlots($globals.SmalltalkImage.a$cls, ["current"]);
  28966. $core.addMethod(
  28967. $core.method({
  28968. selector: "current",
  28969. protocol: "instance creation",
  28970. fn: function (){
  28971. var self=this,$self=this;
  28972. return $core.withContext(function($ctx1) {
  28973. var $1,$receiver;
  28974. $1=$self.current;
  28975. if(($receiver = $1) == null || $receiver.a$nil){
  28976. $self.current=(
  28977. $ctx1.supercall = true,
  28978. ($globals.SmalltalkImage.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  28979. $ctx1.supercall = false;
  28980. return $self.current;
  28981. } else {
  28982. $self._deprecatedAPI();
  28983. return $self.current;
  28984. }
  28985. }, function($ctx1) {$ctx1.fill(self,"current",{})});
  28986. },
  28987. args: [],
  28988. source: "current\x0a\x09^ current ifNil: [ current := super new ] ifNotNil: [ self deprecatedAPI. current ]",
  28989. referencedClasses: [],
  28990. pragmas: [],
  28991. messageSends: ["ifNil:ifNotNil:", "new", "deprecatedAPI"]
  28992. }),
  28993. $globals.SmalltalkImage.a$cls);
  28994. $core.addMethod(
  28995. $core.method({
  28996. selector: "initialize",
  28997. protocol: "initialization",
  28998. fn: function (){
  28999. var self=this,$self=this;
  29000. var st;
  29001. return $core.withContext(function($ctx1) {
  29002. st=$self._current();
  29003. $recv($recv(st)._globals())._at_put_("Smalltalk",st);
  29004. return self;
  29005. }, function($ctx1) {$ctx1.fill(self,"initialize",{st:st})});
  29006. },
  29007. args: [],
  29008. source: "initialize\x0a\x09| st |\x0a\x09st := self current.\x0a\x09st globals at: 'Smalltalk' put: st",
  29009. referencedClasses: [],
  29010. pragmas: [],
  29011. messageSends: ["current", "at:put:", "globals"]
  29012. }),
  29013. $globals.SmalltalkImage.a$cls);
  29014. $core.addMethod(
  29015. $core.method({
  29016. selector: "new",
  29017. protocol: "instance creation",
  29018. fn: function (){
  29019. var self=this,$self=this;
  29020. return $core.withContext(function($ctx1) {
  29021. $self._shouldNotImplement();
  29022. return self;
  29023. }, function($ctx1) {$ctx1.fill(self,"new",{})});
  29024. },
  29025. args: [],
  29026. source: "new\x0a\x09self shouldNotImplement",
  29027. referencedClasses: [],
  29028. pragmas: [],
  29029. messageSends: ["shouldNotImplement"]
  29030. }),
  29031. $globals.SmalltalkImage.a$cls);
  29032. $core.setTraitComposition([{trait: $globals.TThenable}], $globals.JSObjectProxy);
  29033. $core.addMethod(
  29034. $core.method({
  29035. selector: "nextPutJSObject:",
  29036. protocol: "*Kernel-Infrastructure",
  29037. fn: function (aJSObject){
  29038. var self=this,$self=this;
  29039. return $core.withContext(function($ctx1) {
  29040. $self._nextPut_(aJSObject);
  29041. return self;
  29042. }, function($ctx1) {$ctx1.fill(self,"nextPutJSObject:",{aJSObject:aJSObject})});
  29043. },
  29044. args: ["aJSObject"],
  29045. source: "nextPutJSObject: aJSObject\x0a\x09self nextPut: aJSObject",
  29046. referencedClasses: [],
  29047. pragmas: [],
  29048. messageSends: ["nextPut:"]
  29049. }),
  29050. $globals.ProtoStream);
  29051. $core.addMethod(
  29052. $core.method({
  29053. selector: "asJavaScriptPropertyName",
  29054. protocol: "*Kernel-Infrastructure",
  29055. fn: function (){
  29056. var self=this,$self=this;
  29057. return $core.withContext(function($ctx1) {
  29058. return $core.st2prop(self);
  29059. return self;
  29060. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptPropertyName",{})});
  29061. },
  29062. args: [],
  29063. source: "asJavaScriptPropertyName\x0a<inlineJS: 'return $core.st2prop(self)'>",
  29064. referencedClasses: [],
  29065. pragmas: [["inlineJS:", ["return $core.st2prop(self)"]]],
  29066. messageSends: []
  29067. }),
  29068. $globals.String);
  29069. $core.addMethod(
  29070. $core.method({
  29071. selector: "asSetting",
  29072. protocol: "*Kernel-Infrastructure",
  29073. fn: function (){
  29074. var self=this,$self=this;
  29075. return $core.withContext(function($ctx1) {
  29076. return $recv($globals.Setting)._at_ifAbsent_(self,nil);
  29077. }, function($ctx1) {$ctx1.fill(self,"asSetting",{})});
  29078. },
  29079. args: [],
  29080. 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",
  29081. referencedClasses: ["Setting"],
  29082. pragmas: [],
  29083. messageSends: ["at:ifAbsent:"]
  29084. }),
  29085. $globals.String);
  29086. $core.addMethod(
  29087. $core.method({
  29088. selector: "asSettingIfAbsent:",
  29089. protocol: "*Kernel-Infrastructure",
  29090. fn: function (aDefaultValue){
  29091. var self=this,$self=this;
  29092. return $core.withContext(function($ctx1) {
  29093. return $recv($globals.Setting)._at_ifAbsent_(self,aDefaultValue);
  29094. }, function($ctx1) {$ctx1.fill(self,"asSettingIfAbsent:",{aDefaultValue:aDefaultValue})});
  29095. },
  29096. args: ["aDefaultValue"],
  29097. 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",
  29098. referencedClasses: ["Setting"],
  29099. pragmas: [],
  29100. messageSends: ["at:ifAbsent:"]
  29101. }),
  29102. $globals.String);
  29103. $core.addMethod(
  29104. $core.method({
  29105. selector: "settingValue",
  29106. protocol: "*Kernel-Infrastructure",
  29107. fn: function (){
  29108. var self=this,$self=this;
  29109. return $core.withContext(function($ctx1) {
  29110. return $recv($self._asSetting())._value();
  29111. }, function($ctx1) {$ctx1.fill(self,"settingValue",{})});
  29112. },
  29113. args: [],
  29114. source: "settingValue\x0a\x09^ self asSetting value",
  29115. referencedClasses: [],
  29116. pragmas: [],
  29117. messageSends: ["value", "asSetting"]
  29118. }),
  29119. $globals.String);
  29120. $core.addMethod(
  29121. $core.method({
  29122. selector: "settingValue:",
  29123. protocol: "*Kernel-Infrastructure",
  29124. fn: function (aValue){
  29125. var self=this,$self=this;
  29126. return $core.withContext(function($ctx1) {
  29127. return $recv($self._asSetting())._value_(aValue);
  29128. }, function($ctx1) {$ctx1.fill(self,"settingValue:",{aValue:aValue})});
  29129. },
  29130. args: ["aValue"],
  29131. 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",
  29132. referencedClasses: [],
  29133. pragmas: [],
  29134. messageSends: ["value:", "asSetting"]
  29135. }),
  29136. $globals.String);
  29137. $core.addMethod(
  29138. $core.method({
  29139. selector: "settingValueIfAbsent:",
  29140. protocol: "*Kernel-Infrastructure",
  29141. fn: function (aDefaultValue){
  29142. var self=this,$self=this;
  29143. return $core.withContext(function($ctx1) {
  29144. return $recv($self._asSettingIfAbsent_(aDefaultValue))._value();
  29145. }, function($ctx1) {$ctx1.fill(self,"settingValueIfAbsent:",{aDefaultValue:aDefaultValue})});
  29146. },
  29147. args: ["aDefaultValue"],
  29148. 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",
  29149. referencedClasses: [],
  29150. pragmas: [],
  29151. messageSends: ["value", "asSettingIfAbsent:"]
  29152. }),
  29153. $globals.String);
  29154. });
  29155. define('amber/core/Kernel-Announcements',["amber/boot", "require", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  29156. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  29157. var $pkg = $core.addPackage("Kernel-Announcements");
  29158. $pkg.innerEval = function (expr) { return eval(expr); };
  29159. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  29160. $core.addClass("AnnouncementSubscription", $globals.Object, ["valuable", "announcementClass"], "Kernel-Announcements");
  29161. $globals.AnnouncementSubscription.comment="I am a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible.";
  29162. $core.addMethod(
  29163. $core.method({
  29164. selector: "announcementClass",
  29165. protocol: "accessing",
  29166. fn: function (){
  29167. var self=this,$self=this;
  29168. return $self.announcementClass;
  29169. },
  29170. args: [],
  29171. source: "announcementClass\x0a\x09^ announcementClass",
  29172. referencedClasses: [],
  29173. pragmas: [],
  29174. messageSends: []
  29175. }),
  29176. $globals.AnnouncementSubscription);
  29177. $core.addMethod(
  29178. $core.method({
  29179. selector: "announcementClass:",
  29180. protocol: "accessing",
  29181. fn: function (aClass){
  29182. var self=this,$self=this;
  29183. return $core.withContext(function($ctx1) {
  29184. $self.announcementClass=$recv($recv($globals.Smalltalk)._globals())._at_($recv(aClass)._name());
  29185. return self;
  29186. }, function($ctx1) {$ctx1.fill(self,"announcementClass:",{aClass:aClass})});
  29187. },
  29188. args: ["aClass"],
  29189. source: "announcementClass: aClass\x0a\x09announcementClass := Smalltalk globals at: aClass name",
  29190. referencedClasses: ["Smalltalk"],
  29191. pragmas: [],
  29192. messageSends: ["at:", "globals", "name"]
  29193. }),
  29194. $globals.AnnouncementSubscription);
  29195. $core.addMethod(
  29196. $core.method({
  29197. selector: "deliver:",
  29198. protocol: "announcing",
  29199. fn: function (anAnnouncement){
  29200. var self=this,$self=this;
  29201. return $core.withContext(function($ctx1) {
  29202. var $1;
  29203. $1=$self._handlesAnnouncement_(anAnnouncement);
  29204. if($core.assert($1)){
  29205. $recv($self._valuable())._value_(anAnnouncement);
  29206. }
  29207. return self;
  29208. }, function($ctx1) {$ctx1.fill(self,"deliver:",{anAnnouncement:anAnnouncement})});
  29209. },
  29210. args: ["anAnnouncement"],
  29211. source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [ self valuable value: anAnnouncement ]",
  29212. referencedClasses: [],
  29213. pragmas: [],
  29214. messageSends: ["ifTrue:", "handlesAnnouncement:", "value:", "valuable"]
  29215. }),
  29216. $globals.AnnouncementSubscription);
  29217. $core.addMethod(
  29218. $core.method({
  29219. selector: "handlesAnnouncement:",
  29220. protocol: "announcing",
  29221. fn: function (anAnnouncement){
  29222. var self=this,$self=this;
  29223. return $core.withContext(function($ctx1) {
  29224. return $recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv(anAnnouncement)._class())._name()))._includesBehavior_($self._announcementClass());
  29225. }, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement})});
  29226. },
  29227. args: ["anAnnouncement"],
  29228. 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",
  29229. referencedClasses: ["Smalltalk"],
  29230. pragmas: [],
  29231. messageSends: ["includesBehavior:", "at:", "globals", "name", "class", "announcementClass"]
  29232. }),
  29233. $globals.AnnouncementSubscription);
  29234. $core.addMethod(
  29235. $core.method({
  29236. selector: "receiver",
  29237. protocol: "accessing",
  29238. fn: function (){
  29239. var self=this,$self=this;
  29240. return $core.withContext(function($ctx1) {
  29241. return $recv($self._valuable())._receiver();
  29242. }, function($ctx1) {$ctx1.fill(self,"receiver",{})});
  29243. },
  29244. args: [],
  29245. source: "receiver\x0a\x09^ self valuable receiver",
  29246. referencedClasses: [],
  29247. pragmas: [],
  29248. messageSends: ["receiver", "valuable"]
  29249. }),
  29250. $globals.AnnouncementSubscription);
  29251. $core.addMethod(
  29252. $core.method({
  29253. selector: "valuable",
  29254. protocol: "accessing",
  29255. fn: function (){
  29256. var self=this,$self=this;
  29257. return $self.valuable;
  29258. },
  29259. args: [],
  29260. source: "valuable\x0a\x09^ valuable",
  29261. referencedClasses: [],
  29262. pragmas: [],
  29263. messageSends: []
  29264. }),
  29265. $globals.AnnouncementSubscription);
  29266. $core.addMethod(
  29267. $core.method({
  29268. selector: "valuable:",
  29269. protocol: "accessing",
  29270. fn: function (aValuable){
  29271. var self=this,$self=this;
  29272. $self.valuable=aValuable;
  29273. return self;
  29274. },
  29275. args: ["aValuable"],
  29276. source: "valuable: aValuable\x0a\x09valuable := aValuable",
  29277. referencedClasses: [],
  29278. pragmas: [],
  29279. messageSends: []
  29280. }),
  29281. $globals.AnnouncementSubscription);
  29282. $core.addClass("AnnouncementValuable", $globals.Object, ["valuable", "receiver"], "Kernel-Announcements");
  29283. $globals.AnnouncementValuable.comment="I wrap `valuable` objects (typically instances of `BlockClosure`) with a `receiver` to be able to unregister subscriptions based on a `receiver`.";
  29284. $core.addMethod(
  29285. $core.method({
  29286. selector: "receiver",
  29287. protocol: "accessing",
  29288. fn: function (){
  29289. var self=this,$self=this;
  29290. return $self.receiver;
  29291. },
  29292. args: [],
  29293. source: "receiver\x0a\x09^ receiver",
  29294. referencedClasses: [],
  29295. pragmas: [],
  29296. messageSends: []
  29297. }),
  29298. $globals.AnnouncementValuable);
  29299. $core.addMethod(
  29300. $core.method({
  29301. selector: "receiver:",
  29302. protocol: "accessing",
  29303. fn: function (anObject){
  29304. var self=this,$self=this;
  29305. $self.receiver=anObject;
  29306. return self;
  29307. },
  29308. args: ["anObject"],
  29309. source: "receiver: anObject\x0a\x09receiver := anObject",
  29310. referencedClasses: [],
  29311. pragmas: [],
  29312. messageSends: []
  29313. }),
  29314. $globals.AnnouncementValuable);
  29315. $core.addMethod(
  29316. $core.method({
  29317. selector: "valuable",
  29318. protocol: "accessing",
  29319. fn: function (){
  29320. var self=this,$self=this;
  29321. return $self.valuable;
  29322. },
  29323. args: [],
  29324. source: "valuable\x0a\x09^ valuable",
  29325. referencedClasses: [],
  29326. pragmas: [],
  29327. messageSends: []
  29328. }),
  29329. $globals.AnnouncementValuable);
  29330. $core.addMethod(
  29331. $core.method({
  29332. selector: "valuable:",
  29333. protocol: "accessing",
  29334. fn: function (anObject){
  29335. var self=this,$self=this;
  29336. $self.valuable=anObject;
  29337. return self;
  29338. },
  29339. args: ["anObject"],
  29340. source: "valuable: anObject\x0a\x09valuable := anObject",
  29341. referencedClasses: [],
  29342. pragmas: [],
  29343. messageSends: []
  29344. }),
  29345. $globals.AnnouncementValuable);
  29346. $core.addMethod(
  29347. $core.method({
  29348. selector: "value",
  29349. protocol: "evaluating",
  29350. fn: function (){
  29351. var self=this,$self=this;
  29352. return $core.withContext(function($ctx1) {
  29353. return $recv($self._valuable())._value();
  29354. }, function($ctx1) {$ctx1.fill(self,"value",{})});
  29355. },
  29356. args: [],
  29357. source: "value\x0a\x09^ self valuable value",
  29358. referencedClasses: [],
  29359. pragmas: [],
  29360. messageSends: ["value", "valuable"]
  29361. }),
  29362. $globals.AnnouncementValuable);
  29363. $core.addMethod(
  29364. $core.method({
  29365. selector: "value:",
  29366. protocol: "evaluating",
  29367. fn: function (anObject){
  29368. var self=this,$self=this;
  29369. return $core.withContext(function($ctx1) {
  29370. return $recv($self._valuable())._value_(anObject);
  29371. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject})});
  29372. },
  29373. args: ["anObject"],
  29374. source: "value: anObject\x0a\x09^ self valuable value: anObject",
  29375. referencedClasses: [],
  29376. pragmas: [],
  29377. messageSends: ["value:", "valuable"]
  29378. }),
  29379. $globals.AnnouncementValuable);
  29380. $core.addClass("Announcer", $globals.Object, ["registry", "subscriptions"], "Kernel-Announcements");
  29381. $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' ].";
  29382. $core.addMethod(
  29383. $core.method({
  29384. selector: "announce:",
  29385. protocol: "announcing",
  29386. fn: function (anAnnouncement){
  29387. var self=this,$self=this;
  29388. return $core.withContext(function($ctx1) {
  29389. $recv($self.subscriptions)._do_((function(each){
  29390. return $core.withContext(function($ctx2) {
  29391. return $recv(each)._deliver_(anAnnouncement);
  29392. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  29393. }));
  29394. return self;
  29395. }, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement})});
  29396. },
  29397. args: ["anAnnouncement"],
  29398. source: "announce: anAnnouncement\x0a\x09subscriptions do: [ :each |\x0a\x09\x09each deliver: anAnnouncement ]",
  29399. referencedClasses: [],
  29400. pragmas: [],
  29401. messageSends: ["do:", "deliver:"]
  29402. }),
  29403. $globals.Announcer);
  29404. $core.addMethod(
  29405. $core.method({
  29406. selector: "initialize",
  29407. protocol: "initialization",
  29408. fn: function (){
  29409. var self=this,$self=this;
  29410. return $core.withContext(function($ctx1) {
  29411. (
  29412. $ctx1.supercall = true,
  29413. ($globals.Announcer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  29414. $ctx1.supercall = false;
  29415. $self.subscriptions=$recv($globals.OrderedCollection)._new();
  29416. return self;
  29417. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  29418. },
  29419. args: [],
  29420. source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := OrderedCollection new",
  29421. referencedClasses: ["OrderedCollection"],
  29422. pragmas: [],
  29423. messageSends: ["initialize", "new"]
  29424. }),
  29425. $globals.Announcer);
  29426. $core.addMethod(
  29427. $core.method({
  29428. selector: "on:do:",
  29429. protocol: "subscribing",
  29430. fn: function (aClass,aBlock){
  29431. var self=this,$self=this;
  29432. return $core.withContext(function($ctx1) {
  29433. $self._on_do_for_(aClass,aBlock,nil);
  29434. return self;
  29435. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock})});
  29436. },
  29437. args: ["aClass", "aBlock"],
  29438. source: "on: aClass do: aBlock\x0a\x09self on: aClass do: aBlock for: nil",
  29439. referencedClasses: [],
  29440. pragmas: [],
  29441. messageSends: ["on:do:for:"]
  29442. }),
  29443. $globals.Announcer);
  29444. $core.addMethod(
  29445. $core.method({
  29446. selector: "on:do:for:",
  29447. protocol: "subscribing",
  29448. fn: function (aClass,aBlock,aReceiver){
  29449. var self=this,$self=this;
  29450. return $core.withContext(function($ctx1) {
  29451. var $1,$3,$5,$6,$4,$2;
  29452. $1=$self.subscriptions;
  29453. $3=$recv($globals.AnnouncementSubscription)._new();
  29454. $ctx1.sendIdx["new"]=1;
  29455. $5=$recv($globals.AnnouncementValuable)._new();
  29456. $recv($5)._valuable_(aBlock);
  29457. $recv($5)._receiver_(aReceiver);
  29458. $6=$recv($5)._yourself();
  29459. $ctx1.sendIdx["yourself"]=1;
  29460. $4=$6;
  29461. $recv($3)._valuable_($4);
  29462. $ctx1.sendIdx["valuable:"]=1;
  29463. $recv($3)._announcementClass_(aClass);
  29464. $2=$recv($3)._yourself();
  29465. $recv($1)._add_($2);
  29466. return self;
  29467. }, function($ctx1) {$ctx1.fill(self,"on:do:for:",{aClass:aClass,aBlock:aBlock,aReceiver:aReceiver})});
  29468. },
  29469. args: ["aClass", "aBlock", "aReceiver"],
  29470. 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)",
  29471. referencedClasses: ["AnnouncementSubscription", "AnnouncementValuable"],
  29472. pragmas: [],
  29473. messageSends: ["add:", "valuable:", "new", "receiver:", "yourself", "announcementClass:"]
  29474. }),
  29475. $globals.Announcer);
  29476. $core.addMethod(
  29477. $core.method({
  29478. selector: "on:doOnce:",
  29479. protocol: "subscribing",
  29480. fn: function (aClass,aBlock){
  29481. var self=this,$self=this;
  29482. var subscription;
  29483. return $core.withContext(function($ctx1) {
  29484. var $1;
  29485. $1=$recv($globals.AnnouncementSubscription)._new();
  29486. $recv($1)._announcementClass_(aClass);
  29487. subscription=$recv($1)._yourself();
  29488. $recv(subscription)._valuable_((function(ann){
  29489. return $core.withContext(function($ctx2) {
  29490. $recv($self.subscriptions)._remove_(subscription);
  29491. return $recv(aBlock)._value_(ann);
  29492. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,1)});
  29493. }));
  29494. $recv($self.subscriptions)._add_(subscription);
  29495. return self;
  29496. }, function($ctx1) {$ctx1.fill(self,"on:doOnce:",{aClass:aClass,aBlock:aBlock,subscription:subscription})});
  29497. },
  29498. args: ["aClass", "aBlock"],
  29499. 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",
  29500. referencedClasses: ["AnnouncementSubscription"],
  29501. pragmas: [],
  29502. messageSends: ["announcementClass:", "new", "yourself", "valuable:", "remove:", "value:", "add:"]
  29503. }),
  29504. $globals.Announcer);
  29505. $core.addMethod(
  29506. $core.method({
  29507. selector: "on:send:to:",
  29508. protocol: "subscribing",
  29509. fn: function (aClass,aSelector,anObject){
  29510. var self=this,$self=this;
  29511. return $core.withContext(function($ctx1) {
  29512. var $1,$3,$5,$6,$4,$2;
  29513. $1=$self.subscriptions;
  29514. $3=$recv($globals.AnnouncementSubscription)._new();
  29515. $ctx1.sendIdx["new"]=1;
  29516. $5=$recv($globals.MessageSend)._new();
  29517. $recv($5)._receiver_(anObject);
  29518. $recv($5)._selector_(aSelector);
  29519. $6=$recv($5)._yourself();
  29520. $ctx1.sendIdx["yourself"]=1;
  29521. $4=$6;
  29522. $recv($3)._valuable_($4);
  29523. $recv($3)._announcementClass_(aClass);
  29524. $2=$recv($3)._yourself();
  29525. $recv($1)._add_($2);
  29526. return self;
  29527. }, function($ctx1) {$ctx1.fill(self,"on:send:to:",{aClass:aClass,aSelector:aSelector,anObject:anObject})});
  29528. },
  29529. args: ["aClass", "aSelector", "anObject"],
  29530. 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)",
  29531. referencedClasses: ["AnnouncementSubscription", "MessageSend"],
  29532. pragmas: [],
  29533. messageSends: ["add:", "valuable:", "new", "receiver:", "selector:", "yourself", "announcementClass:"]
  29534. }),
  29535. $globals.Announcer);
  29536. $core.addMethod(
  29537. $core.method({
  29538. selector: "unsubscribe:",
  29539. protocol: "subscribing",
  29540. fn: function (anObject){
  29541. var self=this,$self=this;
  29542. return $core.withContext(function($ctx1) {
  29543. $self.subscriptions=$recv($self.subscriptions)._reject_((function(each){
  29544. return $core.withContext(function($ctx2) {
  29545. return $recv($recv(each)._receiver()).__eq(anObject);
  29546. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  29547. }));
  29548. return self;
  29549. }, function($ctx1) {$ctx1.fill(self,"unsubscribe:",{anObject:anObject})});
  29550. },
  29551. args: ["anObject"],
  29552. source: "unsubscribe: anObject\x0a\x09subscriptions := subscriptions reject: [ :each |\x0a\x09\x09each receiver = anObject ]",
  29553. referencedClasses: [],
  29554. pragmas: [],
  29555. messageSends: ["reject:", "=", "receiver"]
  29556. }),
  29557. $globals.Announcer);
  29558. $core.addClass("SystemAnnouncer", $globals.Announcer, [], "Kernel-Announcements");
  29559. $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`";
  29560. $core.setSlots($globals.SystemAnnouncer.a$cls, ["current"]);
  29561. $core.addMethod(
  29562. $core.method({
  29563. selector: "current",
  29564. protocol: "accessing",
  29565. fn: function (){
  29566. var self=this,$self=this;
  29567. return $core.withContext(function($ctx1) {
  29568. var $1,$receiver;
  29569. $1=$self.current;
  29570. if(($receiver = $1) == null || $receiver.a$nil){
  29571. $self.current=(
  29572. $ctx1.supercall = true,
  29573. ($globals.SystemAnnouncer.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  29574. $ctx1.supercall = false;
  29575. return $self.current;
  29576. } else {
  29577. return $1;
  29578. }
  29579. }, function($ctx1) {$ctx1.fill(self,"current",{})});
  29580. },
  29581. args: [],
  29582. source: "current\x0a\x09^ current ifNil: [ current := super new ]",
  29583. referencedClasses: [],
  29584. pragmas: [],
  29585. messageSends: ["ifNil:", "new"]
  29586. }),
  29587. $globals.SystemAnnouncer.a$cls);
  29588. $core.addMethod(
  29589. $core.method({
  29590. selector: "new",
  29591. protocol: "instance creation",
  29592. fn: function (){
  29593. var self=this,$self=this;
  29594. return $core.withContext(function($ctx1) {
  29595. $self._shouldNotImplement();
  29596. return self;
  29597. }, function($ctx1) {$ctx1.fill(self,"new",{})});
  29598. },
  29599. args: [],
  29600. source: "new\x0a\x09self shouldNotImplement",
  29601. referencedClasses: [],
  29602. pragmas: [],
  29603. messageSends: ["shouldNotImplement"]
  29604. }),
  29605. $globals.SystemAnnouncer.a$cls);
  29606. $core.addClass("SystemAnnouncement", $globals.Object, [], "Kernel-Announcements");
  29607. $globals.SystemAnnouncement.comment="I am the superclass of all system announcements";
  29608. $core.addMethod(
  29609. $core.method({
  29610. selector: "classTag",
  29611. protocol: "accessing",
  29612. fn: function (){
  29613. var self=this,$self=this;
  29614. return "announcement";
  29615. },
  29616. args: [],
  29617. 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'",
  29618. referencedClasses: [],
  29619. pragmas: [],
  29620. messageSends: []
  29621. }),
  29622. $globals.SystemAnnouncement.a$cls);
  29623. $core.addClass("ClassAnnouncement", $globals.SystemAnnouncement, ["theClass"], "Kernel-Announcements");
  29624. $globals.ClassAnnouncement.comment="I am the abstract superclass of class-related announcements.";
  29625. $core.addMethod(
  29626. $core.method({
  29627. selector: "theClass",
  29628. protocol: "accessing",
  29629. fn: function (){
  29630. var self=this,$self=this;
  29631. return $self.theClass;
  29632. },
  29633. args: [],
  29634. source: "theClass\x0a\x09^ theClass",
  29635. referencedClasses: [],
  29636. pragmas: [],
  29637. messageSends: []
  29638. }),
  29639. $globals.ClassAnnouncement);
  29640. $core.addMethod(
  29641. $core.method({
  29642. selector: "theClass:",
  29643. protocol: "accessing",
  29644. fn: function (aClass){
  29645. var self=this,$self=this;
  29646. $self.theClass=aClass;
  29647. return self;
  29648. },
  29649. args: ["aClass"],
  29650. source: "theClass: aClass\x0a\x09theClass := aClass",
  29651. referencedClasses: [],
  29652. pragmas: [],
  29653. messageSends: []
  29654. }),
  29655. $globals.ClassAnnouncement);
  29656. $core.addClass("ClassAdded", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  29657. $globals.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods";
  29658. $core.addClass("ClassCommentChanged", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  29659. $globals.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)";
  29660. $core.addClass("ClassDefinitionChanged", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  29661. $globals.ClassDefinitionChanged.comment="I am emitted when the definition of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:";
  29662. $core.addClass("ClassMigrated", $globals.ClassAnnouncement, ["oldClass"], "Kernel-Announcements");
  29663. $globals.ClassMigrated.comment="I am emitted when a class is migrated.";
  29664. $core.addMethod(
  29665. $core.method({
  29666. selector: "oldClass",
  29667. protocol: "accessing",
  29668. fn: function (){
  29669. var self=this,$self=this;
  29670. return $self.oldClass;
  29671. },
  29672. args: [],
  29673. source: "oldClass\x0a\x09^ oldClass",
  29674. referencedClasses: [],
  29675. pragmas: [],
  29676. messageSends: []
  29677. }),
  29678. $globals.ClassMigrated);
  29679. $core.addMethod(
  29680. $core.method({
  29681. selector: "oldClass:",
  29682. protocol: "accessing",
  29683. fn: function (aClass){
  29684. var self=this,$self=this;
  29685. $self.oldClass=aClass;
  29686. return self;
  29687. },
  29688. args: ["aClass"],
  29689. source: "oldClass: aClass\x0a\x09oldClass := aClass",
  29690. referencedClasses: [],
  29691. pragmas: [],
  29692. messageSends: []
  29693. }),
  29694. $globals.ClassMigrated);
  29695. $core.addClass("ClassMoved", $globals.ClassAnnouncement, ["oldPackage"], "Kernel-Announcements");
  29696. $globals.ClassMoved.comment="I am emitted when a class is moved from one package to another.";
  29697. $core.addMethod(
  29698. $core.method({
  29699. selector: "oldPackage",
  29700. protocol: "accessing",
  29701. fn: function (){
  29702. var self=this,$self=this;
  29703. return $self.oldPackage;
  29704. },
  29705. args: [],
  29706. source: "oldPackage\x0a\x09^ oldPackage",
  29707. referencedClasses: [],
  29708. pragmas: [],
  29709. messageSends: []
  29710. }),
  29711. $globals.ClassMoved);
  29712. $core.addMethod(
  29713. $core.method({
  29714. selector: "oldPackage:",
  29715. protocol: "accessing",
  29716. fn: function (aPackage){
  29717. var self=this,$self=this;
  29718. $self.oldPackage=aPackage;
  29719. return self;
  29720. },
  29721. args: ["aPackage"],
  29722. source: "oldPackage: aPackage\x0a\x09oldPackage := aPackage",
  29723. referencedClasses: [],
  29724. pragmas: [],
  29725. messageSends: []
  29726. }),
  29727. $globals.ClassMoved);
  29728. $core.addClass("ClassRemoved", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  29729. $globals.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:";
  29730. $core.addClass("ClassRenamed", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  29731. $globals.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:";
  29732. $core.addClass("MethodAnnouncement", $globals.SystemAnnouncement, ["method"], "Kernel-Announcements");
  29733. $globals.MethodAnnouncement.comment="I am the abstract superclass of method-related announcements.";
  29734. $core.addMethod(
  29735. $core.method({
  29736. selector: "method",
  29737. protocol: "accessing",
  29738. fn: function (){
  29739. var self=this,$self=this;
  29740. return $self.method;
  29741. },
  29742. args: [],
  29743. source: "method\x0a\x09^ method",
  29744. referencedClasses: [],
  29745. pragmas: [],
  29746. messageSends: []
  29747. }),
  29748. $globals.MethodAnnouncement);
  29749. $core.addMethod(
  29750. $core.method({
  29751. selector: "method:",
  29752. protocol: "accessing",
  29753. fn: function (aCompiledMethod){
  29754. var self=this,$self=this;
  29755. $self.method=aCompiledMethod;
  29756. return self;
  29757. },
  29758. args: ["aCompiledMethod"],
  29759. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  29760. referencedClasses: [],
  29761. pragmas: [],
  29762. messageSends: []
  29763. }),
  29764. $globals.MethodAnnouncement);
  29765. $core.addClass("MethodAdded", $globals.MethodAnnouncement, [], "Kernel-Announcements");
  29766. $globals.MethodAdded.comment="I am emitted when a `CompiledMethod` is added to a class.";
  29767. $core.addClass("MethodModified", $globals.MethodAnnouncement, ["oldMethod"], "Kernel-Announcements");
  29768. $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.";
  29769. $core.addMethod(
  29770. $core.method({
  29771. selector: "oldMethod",
  29772. protocol: "accessing",
  29773. fn: function (){
  29774. var self=this,$self=this;
  29775. return $self.oldMethod;
  29776. },
  29777. args: [],
  29778. source: "oldMethod\x0a\x09^ oldMethod",
  29779. referencedClasses: [],
  29780. pragmas: [],
  29781. messageSends: []
  29782. }),
  29783. $globals.MethodModified);
  29784. $core.addMethod(
  29785. $core.method({
  29786. selector: "oldMethod:",
  29787. protocol: "accessing",
  29788. fn: function (aMethod){
  29789. var self=this,$self=this;
  29790. $self.oldMethod=aMethod;
  29791. return self;
  29792. },
  29793. args: ["aMethod"],
  29794. source: "oldMethod: aMethod\x0a\x09oldMethod := aMethod",
  29795. referencedClasses: [],
  29796. pragmas: [],
  29797. messageSends: []
  29798. }),
  29799. $globals.MethodModified);
  29800. $core.addClass("MethodMoved", $globals.MethodAnnouncement, ["oldProtocol"], "Kernel-Announcements");
  29801. $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.";
  29802. $core.addMethod(
  29803. $core.method({
  29804. selector: "oldProtocol",
  29805. protocol: "accessing",
  29806. fn: function (){
  29807. var self=this,$self=this;
  29808. return $self.oldProtocol;
  29809. },
  29810. args: [],
  29811. source: "oldProtocol\x0a\x09^ oldProtocol",
  29812. referencedClasses: [],
  29813. pragmas: [],
  29814. messageSends: []
  29815. }),
  29816. $globals.MethodMoved);
  29817. $core.addMethod(
  29818. $core.method({
  29819. selector: "oldProtocol:",
  29820. protocol: "accessing",
  29821. fn: function (aString){
  29822. var self=this,$self=this;
  29823. $self.oldProtocol=aString;
  29824. return self;
  29825. },
  29826. args: ["aString"],
  29827. source: "oldProtocol: aString\x0a\x09oldProtocol := aString",
  29828. referencedClasses: [],
  29829. pragmas: [],
  29830. messageSends: []
  29831. }),
  29832. $globals.MethodMoved);
  29833. $core.addClass("MethodRemoved", $globals.MethodAnnouncement, [], "Kernel-Announcements");
  29834. $globals.MethodRemoved.comment="I am emitted when a `CompiledMethod` is removed from a class.";
  29835. $core.addClass("PackageAnnouncement", $globals.SystemAnnouncement, ["package"], "Kernel-Announcements");
  29836. $globals.PackageAnnouncement.comment="I am the abstract superclass of package-related announcements.";
  29837. $core.addMethod(
  29838. $core.method({
  29839. selector: "package",
  29840. protocol: "accessing",
  29841. fn: function (){
  29842. var self=this,$self=this;
  29843. return $self.package;
  29844. },
  29845. args: [],
  29846. source: "package\x0a\x09^ package",
  29847. referencedClasses: [],
  29848. pragmas: [],
  29849. messageSends: []
  29850. }),
  29851. $globals.PackageAnnouncement);
  29852. $core.addMethod(
  29853. $core.method({
  29854. selector: "package:",
  29855. protocol: "accessing",
  29856. fn: function (aPackage){
  29857. var self=this,$self=this;
  29858. $self.package=aPackage;
  29859. return self;
  29860. },
  29861. args: ["aPackage"],
  29862. source: "package: aPackage\x0a\x09package := aPackage",
  29863. referencedClasses: [],
  29864. pragmas: [],
  29865. messageSends: []
  29866. }),
  29867. $globals.PackageAnnouncement);
  29868. $core.addClass("PackageAdded", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  29869. $globals.PackageAdded.comment="I am emitted when a `Package` is added to the system.";
  29870. $core.addClass("PackageClean", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  29871. $globals.PackageClean.comment="I am emitted when a package is committed and becomes clean.";
  29872. $core.addClass("PackageDirty", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  29873. $globals.PackageDirty.comment="I am emitted when a package becomes dirty.";
  29874. $core.addClass("PackageRemoved", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  29875. $globals.PackageRemoved.comment="I am emitted when a `Package` is removed from the system.";
  29876. $core.addClass("ProtocolAnnouncement", $globals.SystemAnnouncement, ["theClass", "protocol"], "Kernel-Announcements");
  29877. $globals.ProtocolAnnouncement.comment="I am the abstract superclass of protocol-related announcements.";
  29878. $core.addMethod(
  29879. $core.method({
  29880. selector: "package",
  29881. protocol: "accessing",
  29882. fn: function (){
  29883. var self=this,$self=this;
  29884. return $core.withContext(function($ctx1) {
  29885. var $1,$receiver;
  29886. $1=$self._theClass();
  29887. if(($receiver = $1) == null || $receiver.a$nil){
  29888. return $1;
  29889. } else {
  29890. var class_;
  29891. class_=$receiver;
  29892. return $recv(class_)._packageOfProtocol_($self._protocol());
  29893. }
  29894. }, function($ctx1) {$ctx1.fill(self,"package",{})});
  29895. },
  29896. args: [],
  29897. source: "package\x0a\x09\x0a\x09^ self theClass ifNotNil: [ :class | class packageOfProtocol: self protocol ]",
  29898. referencedClasses: [],
  29899. pragmas: [],
  29900. messageSends: ["ifNotNil:", "theClass", "packageOfProtocol:", "protocol"]
  29901. }),
  29902. $globals.ProtocolAnnouncement);
  29903. $core.addMethod(
  29904. $core.method({
  29905. selector: "protocol",
  29906. protocol: "accessing",
  29907. fn: function (){
  29908. var self=this,$self=this;
  29909. return $self.protocol;
  29910. },
  29911. args: [],
  29912. source: "protocol\x0a\x09^ protocol",
  29913. referencedClasses: [],
  29914. pragmas: [],
  29915. messageSends: []
  29916. }),
  29917. $globals.ProtocolAnnouncement);
  29918. $core.addMethod(
  29919. $core.method({
  29920. selector: "protocol:",
  29921. protocol: "accessing",
  29922. fn: function (aString){
  29923. var self=this,$self=this;
  29924. $self.protocol=aString;
  29925. return self;
  29926. },
  29927. args: ["aString"],
  29928. source: "protocol: aString\x0a\x09protocol := aString",
  29929. referencedClasses: [],
  29930. pragmas: [],
  29931. messageSends: []
  29932. }),
  29933. $globals.ProtocolAnnouncement);
  29934. $core.addMethod(
  29935. $core.method({
  29936. selector: "theClass",
  29937. protocol: "accessing",
  29938. fn: function (){
  29939. var self=this,$self=this;
  29940. return $self.theClass;
  29941. },
  29942. args: [],
  29943. source: "theClass\x0a\x09^ theClass",
  29944. referencedClasses: [],
  29945. pragmas: [],
  29946. messageSends: []
  29947. }),
  29948. $globals.ProtocolAnnouncement);
  29949. $core.addMethod(
  29950. $core.method({
  29951. selector: "theClass:",
  29952. protocol: "accessing",
  29953. fn: function (aClass){
  29954. var self=this,$self=this;
  29955. $self.theClass=aClass;
  29956. return self;
  29957. },
  29958. args: ["aClass"],
  29959. source: "theClass: aClass\x0a\x09theClass := aClass",
  29960. referencedClasses: [],
  29961. pragmas: [],
  29962. messageSends: []
  29963. }),
  29964. $globals.ProtocolAnnouncement);
  29965. $core.addClass("ProtocolAdded", $globals.ProtocolAnnouncement, [], "Kernel-Announcements");
  29966. $globals.ProtocolAdded.comment="I am emitted when a protocol is added to a class.";
  29967. $core.addClass("ProtocolRemoved", $globals.ProtocolAnnouncement, [], "Kernel-Announcements");
  29968. $globals.ProtocolRemoved.comment="I am emitted when a protocol is removed from a class.";
  29969. });
  29970. 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";
  29971. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  29972. var $pkg = $core.addPackage("Platform-Services");
  29973. $pkg.innerEval = function (expr) { return eval(expr); };
  29974. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  29975. $core.addClass("ConsoleErrorHandler", $globals.Object, [], "Platform-Services");
  29976. $globals.ConsoleErrorHandler.comment="I am manage Smalltalk errors, displaying the stack in the console.";
  29977. $core.addMethod(
  29978. $core.method({
  29979. selector: "handleError:",
  29980. protocol: "error handling",
  29981. fn: function (anError){
  29982. var self=this,$self=this;
  29983. return $core.withContext(function($ctx1) {
  29984. var $1,$receiver;
  29985. $1=$recv(anError)._context();
  29986. $ctx1.sendIdx["context"]=1;
  29987. if(($receiver = $1) == null || $receiver.a$nil){
  29988. $1;
  29989. } else {
  29990. $self._logErrorContext_($recv(anError)._context());
  29991. }
  29992. $self._logError_(anError);
  29993. return self;
  29994. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError})});
  29995. },
  29996. args: ["anError"],
  29997. source: "handleError: anError\x0a\x09anError context ifNotNil: [ self logErrorContext: anError context ].\x0a\x09self logError: anError",
  29998. referencedClasses: [],
  29999. pragmas: [],
  30000. messageSends: ["ifNotNil:", "context", "logErrorContext:", "logError:"]
  30001. }),
  30002. $globals.ConsoleErrorHandler);
  30003. $core.addMethod(
  30004. $core.method({
  30005. selector: "log:",
  30006. protocol: "private",
  30007. fn: function (aString){
  30008. var self=this,$self=this;
  30009. return $core.withContext(function($ctx1) {
  30010. $recv(console)._log_(aString);
  30011. return self;
  30012. }, function($ctx1) {$ctx1.fill(self,"log:",{aString:aString})});
  30013. },
  30014. args: ["aString"],
  30015. source: "log: aString\x0a\x09console log: aString",
  30016. referencedClasses: [],
  30017. pragmas: [],
  30018. messageSends: ["log:"]
  30019. }),
  30020. $globals.ConsoleErrorHandler);
  30021. $core.addMethod(
  30022. $core.method({
  30023. selector: "logContext:",
  30024. protocol: "private",
  30025. fn: function (aContext){
  30026. var self=this,$self=this;
  30027. return $core.withContext(function($ctx1) {
  30028. var $1,$receiver;
  30029. $1=$recv(aContext)._home();
  30030. $ctx1.sendIdx["home"]=1;
  30031. if(($receiver = $1) == null || $receiver.a$nil){
  30032. $1;
  30033. } else {
  30034. $self._logContext_($recv(aContext)._home());
  30035. }
  30036. $self._log_($recv(aContext)._asString());
  30037. return self;
  30038. }, function($ctx1) {$ctx1.fill(self,"logContext:",{aContext:aContext})});
  30039. },
  30040. args: ["aContext"],
  30041. source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home ].\x0a\x09self log: aContext asString",
  30042. referencedClasses: [],
  30043. pragmas: [],
  30044. messageSends: ["ifNotNil:", "home", "logContext:", "log:", "asString"]
  30045. }),
  30046. $globals.ConsoleErrorHandler);
  30047. $core.addMethod(
  30048. $core.method({
  30049. selector: "logError:",
  30050. protocol: "private",
  30051. fn: function (anError){
  30052. var self=this,$self=this;
  30053. return $core.withContext(function($ctx1) {
  30054. $self._log_($recv(anError)._messageText());
  30055. return self;
  30056. }, function($ctx1) {$ctx1.fill(self,"logError:",{anError:anError})});
  30057. },
  30058. args: ["anError"],
  30059. source: "logError: anError\x0a\x09self log: anError messageText",
  30060. referencedClasses: [],
  30061. pragmas: [],
  30062. messageSends: ["log:", "messageText"]
  30063. }),
  30064. $globals.ConsoleErrorHandler);
  30065. $core.addMethod(
  30066. $core.method({
  30067. selector: "logErrorContext:",
  30068. protocol: "private",
  30069. fn: function (aContext){
  30070. var self=this,$self=this;
  30071. return $core.withContext(function($ctx1) {
  30072. var $1,$receiver;
  30073. if(($receiver = aContext) == null || $receiver.a$nil){
  30074. aContext;
  30075. } else {
  30076. $1=$recv(aContext)._home();
  30077. $ctx1.sendIdx["home"]=1;
  30078. if(($receiver = $1) == null || $receiver.a$nil){
  30079. $1;
  30080. } else {
  30081. $self._logContext_($recv(aContext)._home());
  30082. }
  30083. }
  30084. return self;
  30085. }, function($ctx1) {$ctx1.fill(self,"logErrorContext:",{aContext:aContext})});
  30086. },
  30087. args: ["aContext"],
  30088. source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home ]]",
  30089. referencedClasses: [],
  30090. pragmas: [],
  30091. messageSends: ["ifNotNil:", "home", "logContext:"]
  30092. }),
  30093. $globals.ConsoleErrorHandler);
  30094. $core.setSlots($globals.ConsoleErrorHandler.a$cls, ["current"]);
  30095. $core.addMethod(
  30096. $core.method({
  30097. selector: "initialize",
  30098. protocol: "initialization",
  30099. fn: function (){
  30100. var self=this,$self=this;
  30101. return $core.withContext(function($ctx1) {
  30102. $recv($globals.ErrorHandler)._registerIfNone_($self._new());
  30103. return self;
  30104. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  30105. },
  30106. args: [],
  30107. source: "initialize\x0a\x09ErrorHandler registerIfNone: self new",
  30108. referencedClasses: ["ErrorHandler"],
  30109. pragmas: [],
  30110. messageSends: ["registerIfNone:", "new"]
  30111. }),
  30112. $globals.ConsoleErrorHandler.a$cls);
  30113. $core.addClass("ConsoleTranscript", $globals.Object, ["textarea"], "Platform-Services");
  30114. $globals.ConsoleTranscript.comment="I am a specific transcript emitting to the JavaScript console.\x0a\x0aIf no other transcript is registered, I am the default.";
  30115. $core.addMethod(
  30116. $core.method({
  30117. selector: "clear",
  30118. protocol: "printing",
  30119. fn: function (){
  30120. var self=this,$self=this;
  30121. return self;
  30122. },
  30123. args: [],
  30124. source: "clear\x0a\x09\x22no op\x22",
  30125. referencedClasses: [],
  30126. pragmas: [],
  30127. messageSends: []
  30128. }),
  30129. $globals.ConsoleTranscript);
  30130. $core.addMethod(
  30131. $core.method({
  30132. selector: "cr",
  30133. protocol: "printing",
  30134. fn: function (){
  30135. var self=this,$self=this;
  30136. return self;
  30137. },
  30138. args: [],
  30139. source: "cr\x0a\x09\x22no op\x22",
  30140. referencedClasses: [],
  30141. pragmas: [],
  30142. messageSends: []
  30143. }),
  30144. $globals.ConsoleTranscript);
  30145. $core.addMethod(
  30146. $core.method({
  30147. selector: "open",
  30148. protocol: "actions",
  30149. fn: function (){
  30150. var self=this,$self=this;
  30151. return self;
  30152. },
  30153. args: [],
  30154. source: "open",
  30155. referencedClasses: [],
  30156. pragmas: [],
  30157. messageSends: []
  30158. }),
  30159. $globals.ConsoleTranscript);
  30160. $core.addMethod(
  30161. $core.method({
  30162. selector: "show:",
  30163. protocol: "printing",
  30164. fn: function (anObject){
  30165. var self=this,$self=this;
  30166. return $core.withContext(function($ctx1) {
  30167. console.log(String($recv(anObject)._asString()));
  30168. return self;
  30169. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject})});
  30170. },
  30171. args: ["anObject"],
  30172. 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()))'>",
  30173. referencedClasses: [],
  30174. pragmas: [["inlineJS:", ["console.log(String($recv(anObject)._asString()))"]]],
  30175. messageSends: []
  30176. }),
  30177. $globals.ConsoleTranscript);
  30178. $core.addMethod(
  30179. $core.method({
  30180. selector: "initialize",
  30181. protocol: "initialization",
  30182. fn: function (){
  30183. var self=this,$self=this;
  30184. return $core.withContext(function($ctx1) {
  30185. $recv($globals.Transcript)._registerIfNone_($self._new());
  30186. return self;
  30187. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  30188. },
  30189. args: [],
  30190. source: "initialize\x0a\x09Transcript registerIfNone: self new",
  30191. referencedClasses: ["Transcript"],
  30192. pragmas: [],
  30193. messageSends: ["registerIfNone:", "new"]
  30194. }),
  30195. $globals.ConsoleTranscript.a$cls);
  30196. $core.addClass("Environment", $globals.Object, [], "Platform-Services");
  30197. $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.";
  30198. $core.addMethod(
  30199. $core.method({
  30200. selector: "addInstVarNamed:to:",
  30201. protocol: "compiling",
  30202. fn: function (aString,aClass){
  30203. var self=this,$self=this;
  30204. var newInstVars;
  30205. return $core.withContext(function($ctx1) {
  30206. var $1,$2,$3,$4,$5;
  30207. newInstVars=$recv($recv(aClass)._instanceVariableNames())._copyWith_(aString);
  30208. $1=$recv(aClass)._isMetaclass();
  30209. if($core.assert($1)){
  30210. $2=$self._classBuilder();
  30211. $ctx1.sendIdx["classBuilder"]=1;
  30212. $recv($2)._class_slots_(aClass,newInstVars);
  30213. } else {
  30214. $3=$self._classBuilder();
  30215. $4=$recv(aClass)._superclass();
  30216. $5=$recv(aClass)._name();
  30217. $ctx1.sendIdx["name"]=1;
  30218. $recv($3)._addSubclassOf_named_instanceVariableNames_package_($4,$5,newInstVars,$recv($recv(aClass)._package())._name());
  30219. }
  30220. return self;
  30221. }, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass,newInstVars:newInstVars})});
  30222. },
  30223. args: ["aString", "aClass"],
  30224. 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 ]",
  30225. referencedClasses: [],
  30226. pragmas: [],
  30227. messageSends: ["copyWith:", "instanceVariableNames", "ifTrue:ifFalse:", "isMetaclass", "class:slots:", "classBuilder", "addSubclassOf:named:instanceVariableNames:package:", "superclass", "name", "package"]
  30228. }),
  30229. $globals.Environment);
  30230. $core.addMethod(
  30231. $core.method({
  30232. selector: "allSelectors",
  30233. protocol: "accessing",
  30234. fn: function (){
  30235. var self=this,$self=this;
  30236. return $core.withContext(function($ctx1) {
  30237. return $recv($recv($globals.Smalltalk)._core())._allSelectors();
  30238. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{})});
  30239. },
  30240. args: [],
  30241. source: "allSelectors\x0a\x09^ Smalltalk core allSelectors",
  30242. referencedClasses: ["Smalltalk"],
  30243. pragmas: [],
  30244. messageSends: ["allSelectors", "core"]
  30245. }),
  30246. $globals.Environment);
  30247. $core.addMethod(
  30248. $core.method({
  30249. selector: "availableClassNames",
  30250. protocol: "accessing",
  30251. fn: function (){
  30252. var self=this,$self=this;
  30253. return $core.withContext(function($ctx1) {
  30254. return $recv($recv($globals.Smalltalk)._classes())._collect_((function(each){
  30255. return $core.withContext(function($ctx2) {
  30256. return $recv(each)._name();
  30257. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30258. }));
  30259. }, function($ctx1) {$ctx1.fill(self,"availableClassNames",{})});
  30260. },
  30261. args: [],
  30262. source: "availableClassNames\x0a\x09^ Smalltalk classes \x0a\x09\x09collect: [ :each | each name ]",
  30263. referencedClasses: ["Smalltalk"],
  30264. pragmas: [],
  30265. messageSends: ["collect:", "classes", "name"]
  30266. }),
  30267. $globals.Environment);
  30268. $core.addMethod(
  30269. $core.method({
  30270. selector: "availablePackageNames",
  30271. protocol: "accessing",
  30272. fn: function (){
  30273. var self=this,$self=this;
  30274. return $core.withContext(function($ctx1) {
  30275. return $recv($recv($globals.Smalltalk)._packages())._collect_((function(each){
  30276. return $core.withContext(function($ctx2) {
  30277. return $recv(each)._name();
  30278. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30279. }));
  30280. }, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{})});
  30281. },
  30282. args: [],
  30283. source: "availablePackageNames\x0a\x09^ Smalltalk packages \x0a\x09\x09collect: [ :each | each name ]",
  30284. referencedClasses: ["Smalltalk"],
  30285. pragmas: [],
  30286. messageSends: ["collect:", "packages", "name"]
  30287. }),
  30288. $globals.Environment);
  30289. $core.addMethod(
  30290. $core.method({
  30291. selector: "availableProtocolsFor:",
  30292. protocol: "accessing",
  30293. fn: function (aClass){
  30294. var self=this,$self=this;
  30295. var protocols;
  30296. return $core.withContext(function($ctx1) {
  30297. var $1,$receiver;
  30298. protocols=$recv(aClass)._protocols();
  30299. $1=$recv(aClass)._superclass();
  30300. $ctx1.sendIdx["superclass"]=1;
  30301. if(($receiver = $1) == null || $receiver.a$nil){
  30302. $1;
  30303. } else {
  30304. $recv(protocols)._addAll_($self._availableProtocolsFor_($recv(aClass)._superclass()));
  30305. }
  30306. return $recv($recv($recv(protocols)._asSet())._asArray())._sort();
  30307. }, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols})});
  30308. },
  30309. args: ["aClass"],
  30310. 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",
  30311. referencedClasses: [],
  30312. pragmas: [],
  30313. messageSends: ["protocols", "ifNotNil:", "superclass", "addAll:", "availableProtocolsFor:", "sort", "asArray", "asSet"]
  30314. }),
  30315. $globals.Environment);
  30316. $core.addMethod(
  30317. $core.method({
  30318. selector: "classBuilder",
  30319. protocol: "accessing",
  30320. fn: function (){
  30321. var self=this,$self=this;
  30322. return $core.withContext(function($ctx1) {
  30323. return $recv($globals.ClassBuilder)._new();
  30324. }, function($ctx1) {$ctx1.fill(self,"classBuilder",{})});
  30325. },
  30326. args: [],
  30327. source: "classBuilder\x0a\x09^ ClassBuilder new",
  30328. referencedClasses: ["ClassBuilder"],
  30329. pragmas: [],
  30330. messageSends: ["new"]
  30331. }),
  30332. $globals.Environment);
  30333. $core.addMethod(
  30334. $core.method({
  30335. selector: "classNamed:",
  30336. protocol: "accessing",
  30337. fn: function (aString){
  30338. var self=this,$self=this;
  30339. return $core.withContext(function($ctx1) {
  30340. var $1,$receiver;
  30341. $1=$recv($recv($globals.Smalltalk)._globals())._at_($recv(aString)._asSymbol());
  30342. if(($receiver = $1) == null || $receiver.a$nil){
  30343. return $self._error_("Invalid class name");
  30344. } else {
  30345. return $1;
  30346. }
  30347. }, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString})});
  30348. },
  30349. args: ["aString"],
  30350. source: "classNamed: aString\x0a\x09^ (Smalltalk globals at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
  30351. referencedClasses: ["Smalltalk"],
  30352. pragmas: [],
  30353. messageSends: ["ifNil:", "at:", "globals", "asSymbol", "error:"]
  30354. }),
  30355. $globals.Environment);
  30356. $core.addMethod(
  30357. $core.method({
  30358. selector: "classes",
  30359. protocol: "accessing",
  30360. fn: function (){
  30361. var self=this,$self=this;
  30362. return $core.withContext(function($ctx1) {
  30363. return $recv($globals.Smalltalk)._classes();
  30364. }, function($ctx1) {$ctx1.fill(self,"classes",{})});
  30365. },
  30366. args: [],
  30367. source: "classes\x0a\x09^ Smalltalk classes",
  30368. referencedClasses: ["Smalltalk"],
  30369. pragmas: [],
  30370. messageSends: ["classes"]
  30371. }),
  30372. $globals.Environment);
  30373. $core.addMethod(
  30374. $core.method({
  30375. selector: "commitPackage:onSuccess:onError:",
  30376. protocol: "actions",
  30377. fn: function (aPackage,aBlock,anotherBlock){
  30378. var self=this,$self=this;
  30379. return $core.withContext(function($ctx1) {
  30380. $recv($recv(aPackage)._transport())._commitOnSuccess_onError_(aBlock,anotherBlock);
  30381. return self;
  30382. }, function($ctx1) {$ctx1.fill(self,"commitPackage:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock})});
  30383. },
  30384. args: ["aPackage", "aBlock", "anotherBlock"],
  30385. source: "commitPackage: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09aPackage transport\x0a\x09\x09commitOnSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  30386. referencedClasses: [],
  30387. pragmas: [],
  30388. messageSends: ["commitOnSuccess:onError:", "transport"]
  30389. }),
  30390. $globals.Environment);
  30391. $core.addMethod(
  30392. $core.method({
  30393. selector: "compileClassComment:for:",
  30394. protocol: "compiling",
  30395. fn: function (aString,aClass){
  30396. var self=this,$self=this;
  30397. return $core.withContext(function($ctx1) {
  30398. $recv(aClass)._comment_(aString);
  30399. return self;
  30400. }, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass})});
  30401. },
  30402. args: ["aString", "aClass"],
  30403. source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString",
  30404. referencedClasses: [],
  30405. pragmas: [],
  30406. messageSends: ["comment:"]
  30407. }),
  30408. $globals.Environment);
  30409. $core.addMethod(
  30410. $core.method({
  30411. selector: "compileClassDefinition:",
  30412. protocol: "compiling",
  30413. fn: function (aString){
  30414. var self=this,$self=this;
  30415. return $core.withContext(function($ctx1) {
  30416. $recv((function(){
  30417. return $core.withContext(function($ctx2) {
  30418. return $self._evaluate_for_(aString,$recv($globals.DoIt)._new());
  30419. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30420. }))._on_do_($globals.Error,(function(error){
  30421. return $core.withContext(function($ctx2) {
  30422. return $recv($globals.Terminal)._alert_($recv(error)._messageText());
  30423. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  30424. }));
  30425. return self;
  30426. }, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString})});
  30427. },
  30428. args: ["aString"],
  30429. source: "compileClassDefinition: aString\x0a\x09[ self evaluate: aString for: DoIt new ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error | Terminal alert: error messageText ]",
  30430. referencedClasses: ["DoIt", "Error", "Terminal"],
  30431. pragmas: [],
  30432. messageSends: ["on:do:", "evaluate:for:", "new", "alert:", "messageText"]
  30433. }),
  30434. $globals.Environment);
  30435. $core.addMethod(
  30436. $core.method({
  30437. selector: "compileMethod:for:protocol:",
  30438. protocol: "compiling",
  30439. fn: function (sourceCode,class_,protocol){
  30440. var self=this,$self=this;
  30441. return $core.withContext(function($ctx1) {
  30442. return $recv(class_)._compile_protocol_(sourceCode,protocol);
  30443. }, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol})});
  30444. },
  30445. args: ["sourceCode", "class", "protocol"],
  30446. source: "compileMethod: sourceCode for: class protocol: protocol\x0a\x09^ class\x0a\x09\x09compile: sourceCode\x0a\x09\x09protocol: protocol",
  30447. referencedClasses: [],
  30448. pragmas: [],
  30449. messageSends: ["compile:protocol:"]
  30450. }),
  30451. $globals.Environment);
  30452. $core.addMethod(
  30453. $core.method({
  30454. selector: "copyClass:to:",
  30455. protocol: "actions",
  30456. fn: function (aClass,aClassName){
  30457. var self=this,$self=this;
  30458. return $core.withContext(function($ctx1) {
  30459. var $1,$2,$receiver;
  30460. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  30461. if(($receiver = $1) == null || $receiver.a$nil){
  30462. $1;
  30463. } else {
  30464. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  30465. $ctx1.sendIdx[","]=1;
  30466. $self._error_($2);
  30467. }
  30468. $recv($recv($globals.ClassBuilder)._new())._copyClass_named_(aClass,aClassName);
  30469. return self;
  30470. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName})});
  30471. },
  30472. args: ["aClass", "aClassName"],
  30473. 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",
  30474. referencedClasses: ["Smalltalk", "ClassBuilder"],
  30475. pragmas: [],
  30476. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "copyClass:named:", "new"]
  30477. }),
  30478. $globals.Environment);
  30479. $core.addMethod(
  30480. $core.method({
  30481. selector: "doItReceiver",
  30482. protocol: "accessing",
  30483. fn: function (){
  30484. var self=this,$self=this;
  30485. return $core.withContext(function($ctx1) {
  30486. return $recv($globals.DoIt)._new();
  30487. }, function($ctx1) {$ctx1.fill(self,"doItReceiver",{})});
  30488. },
  30489. args: [],
  30490. source: "doItReceiver\x0a\x09^ DoIt new",
  30491. referencedClasses: ["DoIt"],
  30492. pragmas: [],
  30493. messageSends: ["new"]
  30494. }),
  30495. $globals.Environment);
  30496. $core.addMethod(
  30497. $core.method({
  30498. selector: "evaluate:for:",
  30499. protocol: "evaluating",
  30500. fn: function (aString,anObject){
  30501. var self=this,$self=this;
  30502. return $core.withContext(function($ctx1) {
  30503. return $recv($globals.Evaluator)._evaluate_for_(aString,anObject);
  30504. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject})});
  30505. },
  30506. args: ["aString", "anObject"],
  30507. source: "evaluate: aString for: anObject\x0a\x09^ Evaluator evaluate: aString for: anObject",
  30508. referencedClasses: ["Evaluator"],
  30509. pragmas: [],
  30510. messageSends: ["evaluate:for:"]
  30511. }),
  30512. $globals.Environment);
  30513. $core.addMethod(
  30514. $core.method({
  30515. selector: "evaluate:on:do:",
  30516. protocol: "error handling",
  30517. fn: function (aBlock,anErrorClass,exceptionBlock){
  30518. var self=this,$self=this;
  30519. return $core.withContext(function($ctx1) {
  30520. var $1;
  30521. $recv(aBlock)._tryCatch_((function(exception){
  30522. return $core.withContext(function($ctx2) {
  30523. $1=$recv(exception)._isKindOf_($self._classNamed_($recv(anErrorClass)._name()));
  30524. if($core.assert($1)){
  30525. return $recv(exceptionBlock)._value_(exception);
  30526. } else {
  30527. return $recv(exception)._pass();
  30528. }
  30529. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,1)});
  30530. }));
  30531. return self;
  30532. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:do:",{aBlock:aBlock,anErrorClass:anErrorClass,exceptionBlock:exceptionBlock})});
  30533. },
  30534. args: ["aBlock", "anErrorClass", "exceptionBlock"],
  30535. source: "evaluate: aBlock on: anErrorClass do: exceptionBlock\x0a\x09\x22Evaluate a block and catch exceptions happening on the environment stack\x22\x0a\x09\x0a\x09aBlock tryCatch: [ :exception | \x0a\x09\x09(exception isKindOf: (self classNamed: anErrorClass name))\x0a\x09\x09\x09ifTrue: [ exceptionBlock value: exception ]\x0a \x09\x09\x09ifFalse: [ exception pass ] ]",
  30536. referencedClasses: [],
  30537. pragmas: [],
  30538. messageSends: ["tryCatch:", "ifTrue:ifFalse:", "isKindOf:", "classNamed:", "name", "value:", "pass"]
  30539. }),
  30540. $globals.Environment);
  30541. $core.addMethod(
  30542. $core.method({
  30543. selector: "inspect:",
  30544. protocol: "actions",
  30545. fn: function (anObject){
  30546. var self=this,$self=this;
  30547. return $core.withContext(function($ctx1) {
  30548. $recv($globals.Inspector)._inspect_(anObject);
  30549. return self;
  30550. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject})});
  30551. },
  30552. args: ["anObject"],
  30553. source: "inspect: anObject\x0a\x09Inspector inspect: anObject",
  30554. referencedClasses: ["Inspector"],
  30555. pragmas: [],
  30556. messageSends: ["inspect:"]
  30557. }),
  30558. $globals.Environment);
  30559. $core.addMethod(
  30560. $core.method({
  30561. selector: "moveClass:toPackage:",
  30562. protocol: "actions",
  30563. fn: function (aClass,aPackageName){
  30564. var self=this,$self=this;
  30565. var package_;
  30566. return $core.withContext(function($ctx1) {
  30567. var $1,$2,$receiver;
  30568. package_=$recv($globals.Package)._named_(aPackageName);
  30569. $1=package_;
  30570. if(($receiver = $1) == null || $receiver.a$nil){
  30571. $self._error_("Invalid package name");
  30572. } else {
  30573. $1;
  30574. }
  30575. $2=$recv(package_).__eq_eq($recv(aClass)._package());
  30576. if($core.assert($2)){
  30577. return self;
  30578. }
  30579. $recv(aClass)._package_(package_);
  30580. $recv(aClass)._recompile();
  30581. return self;
  30582. }, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_})});
  30583. },
  30584. args: ["aClass", "aPackageName"],
  30585. 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",
  30586. referencedClasses: ["Package"],
  30587. pragmas: [],
  30588. messageSends: ["named:", "ifNil:", "error:", "ifTrue:", "==", "package", "package:", "recompile"]
  30589. }),
  30590. $globals.Environment);
  30591. $core.addMethod(
  30592. $core.method({
  30593. selector: "moveMethod:toClass:",
  30594. protocol: "actions",
  30595. fn: function (aMethod,aClassName){
  30596. var self=this,$self=this;
  30597. var destinationClass;
  30598. return $core.withContext(function($ctx1) {
  30599. var $2,$3,$1,$5,$4;
  30600. destinationClass=$self._classNamed_(aClassName);
  30601. $2=destinationClass;
  30602. $3=$recv(aMethod)._origin();
  30603. $ctx1.sendIdx["origin"]=1;
  30604. $1=$recv($2).__eq_eq($3);
  30605. if($core.assert($1)){
  30606. return self;
  30607. }
  30608. $5=$recv(aMethod)._origin();
  30609. $ctx1.sendIdx["origin"]=2;
  30610. $4=$recv($5)._isMetaclass();
  30611. if($core.assert($4)){
  30612. destinationClass=$recv(destinationClass)._theMetaClass();
  30613. destinationClass;
  30614. }
  30615. $recv(destinationClass)._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  30616. $recv($recv(aMethod)._origin())._removeCompiledMethod_(aMethod);
  30617. return self;
  30618. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass})});
  30619. },
  30620. args: ["aMethod", "aClassName"],
  30621. 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",
  30622. referencedClasses: [],
  30623. pragmas: [],
  30624. messageSends: ["classNamed:", "ifTrue:", "==", "origin", "isMetaclass", "theMetaClass", "compile:protocol:", "source", "protocol", "removeCompiledMethod:"]
  30625. }),
  30626. $globals.Environment);
  30627. $core.addMethod(
  30628. $core.method({
  30629. selector: "moveMethod:toProtocol:",
  30630. protocol: "actions",
  30631. fn: function (aMethod,aProtocol){
  30632. var self=this,$self=this;
  30633. return $core.withContext(function($ctx1) {
  30634. $recv(aMethod)._protocol_(aProtocol);
  30635. $recv($recv(aMethod)._origin())._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  30636. return self;
  30637. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol})});
  30638. },
  30639. args: ["aMethod", "aProtocol"],
  30640. source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod protocol: aProtocol.\x0a\x0a\x09aMethod origin\x0a\x09\x09compile: aMethod source\x0a\x09\x09protocol: aMethod protocol",
  30641. referencedClasses: [],
  30642. pragmas: [],
  30643. messageSends: ["protocol:", "compile:protocol:", "origin", "source", "protocol"]
  30644. }),
  30645. $globals.Environment);
  30646. $core.addMethod(
  30647. $core.method({
  30648. selector: "packages",
  30649. protocol: "accessing",
  30650. fn: function (){
  30651. var self=this,$self=this;
  30652. return $core.withContext(function($ctx1) {
  30653. return $recv($globals.Smalltalk)._packages();
  30654. }, function($ctx1) {$ctx1.fill(self,"packages",{})});
  30655. },
  30656. args: [],
  30657. source: "packages\x0a\x09^ Smalltalk packages",
  30658. referencedClasses: ["Smalltalk"],
  30659. pragmas: [],
  30660. messageSends: ["packages"]
  30661. }),
  30662. $globals.Environment);
  30663. $core.addMethod(
  30664. $core.method({
  30665. selector: "registerErrorHandler:",
  30666. protocol: "services",
  30667. fn: function (anErrorHandler){
  30668. var self=this,$self=this;
  30669. return $core.withContext(function($ctx1) {
  30670. $recv($globals.ErrorHandler)._register_(anErrorHandler);
  30671. return self;
  30672. }, function($ctx1) {$ctx1.fill(self,"registerErrorHandler:",{anErrorHandler:anErrorHandler})});
  30673. },
  30674. args: ["anErrorHandler"],
  30675. source: "registerErrorHandler: anErrorHandler\x0a\x09ErrorHandler register: anErrorHandler",
  30676. referencedClasses: ["ErrorHandler"],
  30677. pragmas: [],
  30678. messageSends: ["register:"]
  30679. }),
  30680. $globals.Environment);
  30681. $core.addMethod(
  30682. $core.method({
  30683. selector: "registerFinder:",
  30684. protocol: "services",
  30685. fn: function (aFinder){
  30686. var self=this,$self=this;
  30687. return $core.withContext(function($ctx1) {
  30688. $recv($globals.Finder)._register_(aFinder);
  30689. return self;
  30690. }, function($ctx1) {$ctx1.fill(self,"registerFinder:",{aFinder:aFinder})});
  30691. },
  30692. args: ["aFinder"],
  30693. source: "registerFinder: aFinder\x0a\x09Finder register: aFinder",
  30694. referencedClasses: ["Finder"],
  30695. pragmas: [],
  30696. messageSends: ["register:"]
  30697. }),
  30698. $globals.Environment);
  30699. $core.addMethod(
  30700. $core.method({
  30701. selector: "registerInspector:",
  30702. protocol: "services",
  30703. fn: function (anInspector){
  30704. var self=this,$self=this;
  30705. return $core.withContext(function($ctx1) {
  30706. $recv($globals.Inspector)._register_(anInspector);
  30707. return self;
  30708. }, function($ctx1) {$ctx1.fill(self,"registerInspector:",{anInspector:anInspector})});
  30709. },
  30710. args: ["anInspector"],
  30711. source: "registerInspector: anInspector\x0a\x09Inspector register: anInspector",
  30712. referencedClasses: ["Inspector"],
  30713. pragmas: [],
  30714. messageSends: ["register:"]
  30715. }),
  30716. $globals.Environment);
  30717. $core.addMethod(
  30718. $core.method({
  30719. selector: "registerProgressHandler:",
  30720. protocol: "services",
  30721. fn: function (aProgressHandler){
  30722. var self=this,$self=this;
  30723. return $core.withContext(function($ctx1) {
  30724. $recv($globals.ProgressHandler)._register_(aProgressHandler);
  30725. return self;
  30726. }, function($ctx1) {$ctx1.fill(self,"registerProgressHandler:",{aProgressHandler:aProgressHandler})});
  30727. },
  30728. args: ["aProgressHandler"],
  30729. source: "registerProgressHandler: aProgressHandler\x0a\x09ProgressHandler register: aProgressHandler",
  30730. referencedClasses: ["ProgressHandler"],
  30731. pragmas: [],
  30732. messageSends: ["register:"]
  30733. }),
  30734. $globals.Environment);
  30735. $core.addMethod(
  30736. $core.method({
  30737. selector: "registerTranscript:",
  30738. protocol: "services",
  30739. fn: function (aTranscript){
  30740. var self=this,$self=this;
  30741. return $core.withContext(function($ctx1) {
  30742. $recv($globals.Transcript)._register_(aTranscript);
  30743. return self;
  30744. }, function($ctx1) {$ctx1.fill(self,"registerTranscript:",{aTranscript:aTranscript})});
  30745. },
  30746. args: ["aTranscript"],
  30747. source: "registerTranscript: aTranscript\x0a\x09Transcript register: aTranscript",
  30748. referencedClasses: ["Transcript"],
  30749. pragmas: [],
  30750. messageSends: ["register:"]
  30751. }),
  30752. $globals.Environment);
  30753. $core.addMethod(
  30754. $core.method({
  30755. selector: "removeClass:",
  30756. protocol: "actions",
  30757. fn: function (aClass){
  30758. var self=this,$self=this;
  30759. return $core.withContext(function($ctx1) {
  30760. $recv($globals.Smalltalk)._removeClass_(aClass);
  30761. return self;
  30762. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass})});
  30763. },
  30764. args: ["aClass"],
  30765. source: "removeClass: aClass\x0a\x09Smalltalk removeClass: aClass",
  30766. referencedClasses: ["Smalltalk"],
  30767. pragmas: [],
  30768. messageSends: ["removeClass:"]
  30769. }),
  30770. $globals.Environment);
  30771. $core.addMethod(
  30772. $core.method({
  30773. selector: "removeMethod:",
  30774. protocol: "actions",
  30775. fn: function (aMethod){
  30776. var self=this,$self=this;
  30777. return $core.withContext(function($ctx1) {
  30778. $recv($recv(aMethod)._origin())._removeCompiledMethod_(aMethod);
  30779. return self;
  30780. }, function($ctx1) {$ctx1.fill(self,"removeMethod:",{aMethod:aMethod})});
  30781. },
  30782. args: ["aMethod"],
  30783. source: "removeMethod: aMethod\x0a\x09aMethod origin removeCompiledMethod: aMethod",
  30784. referencedClasses: [],
  30785. pragmas: [],
  30786. messageSends: ["removeCompiledMethod:", "origin"]
  30787. }),
  30788. $globals.Environment);
  30789. $core.addMethod(
  30790. $core.method({
  30791. selector: "removeProtocol:from:",
  30792. protocol: "actions",
  30793. fn: function (aString,aClass){
  30794. var self=this,$self=this;
  30795. return $core.withContext(function($ctx1) {
  30796. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  30797. return $core.withContext(function($ctx2) {
  30798. return $recv(aClass)._removeCompiledMethod_(each);
  30799. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30800. }));
  30801. return self;
  30802. }, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass})});
  30803. },
  30804. args: ["aString", "aClass"],
  30805. source: "removeProtocol: aString from: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | aClass removeCompiledMethod: each ]",
  30806. referencedClasses: [],
  30807. pragmas: [],
  30808. messageSends: ["do:", "methodsInProtocol:", "removeCompiledMethod:"]
  30809. }),
  30810. $globals.Environment);
  30811. $core.addMethod(
  30812. $core.method({
  30813. selector: "renameClass:to:",
  30814. protocol: "actions",
  30815. fn: function (aClass,aClassName){
  30816. var self=this,$self=this;
  30817. return $core.withContext(function($ctx1) {
  30818. var $1,$2,$receiver;
  30819. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  30820. if(($receiver = $1) == null || $receiver.a$nil){
  30821. $1;
  30822. } else {
  30823. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  30824. $ctx1.sendIdx[","]=1;
  30825. $self._error_($2);
  30826. }
  30827. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(aClass,aClassName);
  30828. return self;
  30829. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName})});
  30830. },
  30831. args: ["aClass", "aClassName"],
  30832. 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",
  30833. referencedClasses: ["Smalltalk", "ClassBuilder"],
  30834. pragmas: [],
  30835. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renameClass:to:", "new"]
  30836. }),
  30837. $globals.Environment);
  30838. $core.addMethod(
  30839. $core.method({
  30840. selector: "renamePackage:to:",
  30841. protocol: "actions",
  30842. fn: function (aPackageName,aNewPackageName){
  30843. var self=this,$self=this;
  30844. return $core.withContext(function($ctx1) {
  30845. $recv($globals.Smalltalk)._renamePackage_to_(aPackageName,aNewPackageName);
  30846. return self;
  30847. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{aPackageName:aPackageName,aNewPackageName:aNewPackageName})});
  30848. },
  30849. args: ["aPackageName", "aNewPackageName"],
  30850. source: "renamePackage: aPackageName to: aNewPackageName\x0a Smalltalk renamePackage: aPackageName to: aNewPackageName",
  30851. referencedClasses: ["Smalltalk"],
  30852. pragmas: [],
  30853. messageSends: ["renamePackage:to:"]
  30854. }),
  30855. $globals.Environment);
  30856. $core.addMethod(
  30857. $core.method({
  30858. selector: "renameProtocol:to:in:",
  30859. protocol: "actions",
  30860. fn: function (aString,anotherString,aClass){
  30861. var self=this,$self=this;
  30862. return $core.withContext(function($ctx1) {
  30863. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  30864. return $core.withContext(function($ctx2) {
  30865. return $recv(each)._protocol_(anotherString);
  30866. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30867. }));
  30868. return self;
  30869. }, function($ctx1) {$ctx1.fill(self,"renameProtocol:to:in:",{aString:aString,anotherString:anotherString,aClass:aClass})});
  30870. },
  30871. args: ["aString", "anotherString", "aClass"],
  30872. source: "renameProtocol: aString to: anotherString in: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | each protocol: anotherString ]",
  30873. referencedClasses: [],
  30874. pragmas: [],
  30875. messageSends: ["do:", "methodsInProtocol:", "protocol:"]
  30876. }),
  30877. $globals.Environment);
  30878. $core.addMethod(
  30879. $core.method({
  30880. selector: "setClassCommentOf:to:",
  30881. protocol: "actions",
  30882. fn: function (aClass,aString){
  30883. var self=this,$self=this;
  30884. return $core.withContext(function($ctx1) {
  30885. $recv(aClass)._comment_(aString);
  30886. return self;
  30887. }, function($ctx1) {$ctx1.fill(self,"setClassCommentOf:to:",{aClass:aClass,aString:aString})});
  30888. },
  30889. args: ["aClass", "aString"],
  30890. source: "setClassCommentOf: aClass to: aString\x0a\x09aClass comment: aString",
  30891. referencedClasses: [],
  30892. pragmas: [],
  30893. messageSends: ["comment:"]
  30894. }),
  30895. $globals.Environment);
  30896. $core.addMethod(
  30897. $core.method({
  30898. selector: "systemAnnouncer",
  30899. protocol: "accessing",
  30900. fn: function (){
  30901. var self=this,$self=this;
  30902. return $core.withContext(function($ctx1) {
  30903. return $recv($recv($recv($globals.Smalltalk)._globals())._at_("SystemAnnouncer"))._current();
  30904. }, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{})});
  30905. },
  30906. args: [],
  30907. source: "systemAnnouncer\x0a\x09^ (Smalltalk globals at: #SystemAnnouncer) current",
  30908. referencedClasses: ["Smalltalk"],
  30909. pragmas: [],
  30910. messageSends: ["current", "at:", "globals"]
  30911. }),
  30912. $globals.Environment);
  30913. $core.addClass("NullProgressHandler", $globals.Object, [], "Platform-Services");
  30914. $globals.NullProgressHandler.comment="I am the default progress handler. I do not display any progress, and simply iterate over the collection.";
  30915. $core.addMethod(
  30916. $core.method({
  30917. selector: "do:on:displaying:",
  30918. protocol: "progress handling",
  30919. fn: function (aBlock,aCollection,aString){
  30920. var self=this,$self=this;
  30921. return $core.withContext(function($ctx1) {
  30922. $recv(aCollection)._do_(aBlock);
  30923. return self;
  30924. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString})});
  30925. },
  30926. args: ["aBlock", "aCollection", "aString"],
  30927. source: "do: aBlock on: aCollection displaying: aString\x0a\x09aCollection do: aBlock",
  30928. referencedClasses: [],
  30929. pragmas: [],
  30930. messageSends: ["do:"]
  30931. }),
  30932. $globals.NullProgressHandler);
  30933. $core.setSlots($globals.NullProgressHandler.a$cls, ["current"]);
  30934. $core.addMethod(
  30935. $core.method({
  30936. selector: "initialize",
  30937. protocol: "initialization",
  30938. fn: function (){
  30939. var self=this,$self=this;
  30940. return $core.withContext(function($ctx1) {
  30941. $recv($globals.ProgressHandler)._registerIfNone_($self._new());
  30942. return self;
  30943. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  30944. },
  30945. args: [],
  30946. source: "initialize\x0a\x09ProgressHandler registerIfNone: self new",
  30947. referencedClasses: ["ProgressHandler"],
  30948. pragmas: [],
  30949. messageSends: ["registerIfNone:", "new"]
  30950. }),
  30951. $globals.NullProgressHandler.a$cls);
  30952. $core.addClass("Service", $globals.Object, [], "Platform-Services");
  30953. $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.";
  30954. $core.setSlots($globals.Service.a$cls, ["current"]);
  30955. $core.addMethod(
  30956. $core.method({
  30957. selector: "current",
  30958. protocol: "accessing",
  30959. fn: function (){
  30960. var self=this,$self=this;
  30961. return $self.current;
  30962. },
  30963. args: [],
  30964. source: "current\x0a\x09^ current",
  30965. referencedClasses: [],
  30966. pragmas: [],
  30967. messageSends: []
  30968. }),
  30969. $globals.Service.a$cls);
  30970. $core.addMethod(
  30971. $core.method({
  30972. selector: "new",
  30973. protocol: "instance creation",
  30974. fn: function (){
  30975. var self=this,$self=this;
  30976. return $core.withContext(function($ctx1) {
  30977. $self._shouldNotImplement();
  30978. return self;
  30979. }, function($ctx1) {$ctx1.fill(self,"new",{})});
  30980. },
  30981. args: [],
  30982. source: "new\x0a\x09self shouldNotImplement",
  30983. referencedClasses: [],
  30984. pragmas: [],
  30985. messageSends: ["shouldNotImplement"]
  30986. }),
  30987. $globals.Service.a$cls);
  30988. $core.addMethod(
  30989. $core.method({
  30990. selector: "register:",
  30991. protocol: "registration",
  30992. fn: function (anObject){
  30993. var self=this,$self=this;
  30994. $self.current=anObject;
  30995. return self;
  30996. },
  30997. args: ["anObject"],
  30998. source: "register: anObject\x0a\x09current := anObject",
  30999. referencedClasses: [],
  31000. pragmas: [],
  31001. messageSends: []
  31002. }),
  31003. $globals.Service.a$cls);
  31004. $core.addMethod(
  31005. $core.method({
  31006. selector: "registerIfNone:",
  31007. protocol: "registration",
  31008. fn: function (anObject){
  31009. var self=this,$self=this;
  31010. return $core.withContext(function($ctx1) {
  31011. var $1,$receiver;
  31012. $1=$self._current();
  31013. if(($receiver = $1) == null || $receiver.a$nil){
  31014. $self._register_(anObject);
  31015. } else {
  31016. $1;
  31017. }
  31018. return self;
  31019. }, function($ctx1) {$ctx1.fill(self,"registerIfNone:",{anObject:anObject})});
  31020. },
  31021. args: ["anObject"],
  31022. source: "registerIfNone: anObject\x0a\x09self current ifNil: [ self register: anObject ]",
  31023. referencedClasses: [],
  31024. pragmas: [],
  31025. messageSends: ["ifNil:", "current", "register:"]
  31026. }),
  31027. $globals.Service.a$cls);
  31028. $core.addClass("ErrorHandler", $globals.Service, [], "Platform-Services");
  31029. $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.";
  31030. $core.addMethod(
  31031. $core.method({
  31032. selector: "handleError:",
  31033. protocol: "error handling",
  31034. fn: function (anError){
  31035. var self=this,$self=this;
  31036. return $core.withContext(function($ctx1) {
  31037. var $1;
  31038. $1=$recv((function(){
  31039. return $core.withContext(function($ctx2) {
  31040. return $recv(anError)._isSmalltalkError();
  31041. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31042. }))._tryCatch_((function(){
  31043. return false;
  31044. }));
  31045. if($core.assert($1)){
  31046. $self._handleUnhandledError_(anError);
  31047. $ctx1.sendIdx["handleUnhandledError:"]=1;
  31048. } else {
  31049. var smalltalkError;
  31050. smalltalkError=$recv($globals.JavaScriptException)._on_(anError);
  31051. $recv(smalltalkError)._wrap();
  31052. $self._handleUnhandledError_(smalltalkError);
  31053. }
  31054. return self;
  31055. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError})});
  31056. },
  31057. args: ["anError"],
  31058. source: "handleError: anError\x0a\x09([ anError isSmalltalkError ] tryCatch: [ false ])\x0a\x09\x09ifTrue: [ self handleUnhandledError: anError ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09| smalltalkError |\x0a\x09\x09\x09smalltalkError := JavaScriptException on: anError.\x0a\x09\x09\x09smalltalkError wrap.\x0a\x09\x09\x09self handleUnhandledError: smalltalkError ]",
  31059. referencedClasses: ["JavaScriptException"],
  31060. pragmas: [],
  31061. messageSends: ["ifTrue:ifFalse:", "tryCatch:", "isSmalltalkError", "handleUnhandledError:", "on:", "wrap"]
  31062. }),
  31063. $globals.ErrorHandler.a$cls);
  31064. $core.addMethod(
  31065. $core.method({
  31066. selector: "handleUnhandledError:",
  31067. protocol: "error handling",
  31068. fn: function (anError){
  31069. var self=this,$self=this;
  31070. return $core.withContext(function($ctx1) {
  31071. var $1;
  31072. $1=$recv(anError)._wasHandled();
  31073. if(!$core.assert($1)){
  31074. $recv($self._current())._handleError_(anError);
  31075. $recv(anError)._beHandled();
  31076. }
  31077. return self;
  31078. }, function($ctx1) {$ctx1.fill(self,"handleUnhandledError:",{anError:anError})});
  31079. },
  31080. args: ["anError"],
  31081. source: "handleUnhandledError: anError\x0a\x09anError wasHandled ifFalse: [\x0a\x09\x09self current handleError: anError.\x0a\x09\x09anError beHandled ]",
  31082. referencedClasses: [],
  31083. pragmas: [],
  31084. messageSends: ["ifFalse:", "wasHandled", "handleError:", "current", "beHandled"]
  31085. }),
  31086. $globals.ErrorHandler.a$cls);
  31087. $core.addClass("Finder", $globals.Service, [], "Platform-Services");
  31088. $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.";
  31089. $core.addMethod(
  31090. $core.method({
  31091. selector: "findClass:",
  31092. protocol: "finding",
  31093. fn: function (aClass){
  31094. var self=this,$self=this;
  31095. return $core.withContext(function($ctx1) {
  31096. return $recv($self._current())._findClass_(aClass);
  31097. }, function($ctx1) {$ctx1.fill(self,"findClass:",{aClass:aClass})});
  31098. },
  31099. args: ["aClass"],
  31100. source: "findClass: aClass\x0a\x09^ self current findClass: aClass",
  31101. referencedClasses: [],
  31102. pragmas: [],
  31103. messageSends: ["findClass:", "current"]
  31104. }),
  31105. $globals.Finder.a$cls);
  31106. $core.addMethod(
  31107. $core.method({
  31108. selector: "findMethod:",
  31109. protocol: "finding",
  31110. fn: function (aCompiledMethod){
  31111. var self=this,$self=this;
  31112. return $core.withContext(function($ctx1) {
  31113. return $recv($self._current())._findMethod_(aCompiledMethod);
  31114. }, function($ctx1) {$ctx1.fill(self,"findMethod:",{aCompiledMethod:aCompiledMethod})});
  31115. },
  31116. args: ["aCompiledMethod"],
  31117. source: "findMethod: aCompiledMethod\x0a\x09^ self current findMethod: aCompiledMethod",
  31118. referencedClasses: [],
  31119. pragmas: [],
  31120. messageSends: ["findMethod:", "current"]
  31121. }),
  31122. $globals.Finder.a$cls);
  31123. $core.addMethod(
  31124. $core.method({
  31125. selector: "findString:",
  31126. protocol: "finding",
  31127. fn: function (aString){
  31128. var self=this,$self=this;
  31129. return $core.withContext(function($ctx1) {
  31130. return $recv($self._current())._findString_(aString);
  31131. }, function($ctx1) {$ctx1.fill(self,"findString:",{aString:aString})});
  31132. },
  31133. args: ["aString"],
  31134. source: "findString: aString\x0a\x09^ self current findString: aString",
  31135. referencedClasses: [],
  31136. pragmas: [],
  31137. messageSends: ["findString:", "current"]
  31138. }),
  31139. $globals.Finder.a$cls);
  31140. $core.addClass("Inspector", $globals.Service, [], "Platform-Services");
  31141. $globals.Inspector.comment="I am the service responsible for inspecting objects.\x0a\x0aThe default inspector object is the transcript.";
  31142. $core.addMethod(
  31143. $core.method({
  31144. selector: "inspect:",
  31145. protocol: "inspecting",
  31146. fn: function (anObject){
  31147. var self=this,$self=this;
  31148. return $core.withContext(function($ctx1) {
  31149. return $recv($self._current())._inspect_(anObject);
  31150. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject})});
  31151. },
  31152. args: ["anObject"],
  31153. source: "inspect: anObject\x0a\x09^ self current inspect: anObject",
  31154. referencedClasses: [],
  31155. pragmas: [],
  31156. messageSends: ["inspect:", "current"]
  31157. }),
  31158. $globals.Inspector.a$cls);
  31159. $core.addClass("Platform", $globals.Service, [], "Platform-Services");
  31160. $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";
  31161. $core.addMethod(
  31162. $core.method({
  31163. selector: "globals",
  31164. protocol: "accessing",
  31165. fn: function (){
  31166. var self=this,$self=this;
  31167. return $core.withContext(function($ctx1) {
  31168. return $recv($self._current())._globals();
  31169. }, function($ctx1) {$ctx1.fill(self,"globals",{})});
  31170. },
  31171. args: [],
  31172. source: "globals\x0a\x09^ self current globals",
  31173. referencedClasses: [],
  31174. pragmas: [],
  31175. messageSends: ["globals", "current"]
  31176. }),
  31177. $globals.Platform.a$cls);
  31178. $core.addMethod(
  31179. $core.method({
  31180. selector: "includesGlobal:",
  31181. protocol: "testing",
  31182. fn: function (aString){
  31183. var self=this,$self=this;
  31184. return $core.withContext(function($ctx1) {
  31185. return $recv($self._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  31186. return true;
  31187. }),(function(){
  31188. return false;
  31189. }));
  31190. }, function($ctx1) {$ctx1.fill(self,"includesGlobal:",{aString:aString})});
  31191. },
  31192. args: ["aString"],
  31193. source: "includesGlobal: aString\x0a\x09^ self globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
  31194. referencedClasses: [],
  31195. pragmas: [],
  31196. messageSends: ["at:ifPresent:ifAbsent:", "globals"]
  31197. }),
  31198. $globals.Platform.a$cls);
  31199. $core.addMethod(
  31200. $core.method({
  31201. selector: "newXhr",
  31202. protocol: "accessing",
  31203. fn: function (){
  31204. var self=this,$self=this;
  31205. return $core.withContext(function($ctx1) {
  31206. return $recv($self._current())._newXhr();
  31207. }, function($ctx1) {$ctx1.fill(self,"newXhr",{})});
  31208. },
  31209. args: [],
  31210. source: "newXhr\x0a\x09^ self current newXhr",
  31211. referencedClasses: [],
  31212. pragmas: [],
  31213. messageSends: ["newXhr", "current"]
  31214. }),
  31215. $globals.Platform.a$cls);
  31216. $core.addClass("ProgressHandler", $globals.Service, [], "Platform-Services");
  31217. $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`.";
  31218. $core.addMethod(
  31219. $core.method({
  31220. selector: "do:on:displaying:",
  31221. protocol: "progress handling",
  31222. fn: function (aBlock,aCollection,aString){
  31223. var self=this,$self=this;
  31224. return $core.withContext(function($ctx1) {
  31225. $recv($self._current())._do_on_displaying_(aBlock,aCollection,aString);
  31226. return self;
  31227. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString})});
  31228. },
  31229. args: ["aBlock", "aCollection", "aString"],
  31230. source: "do: aBlock on: aCollection displaying: aString\x0a\x09self current do: aBlock on: aCollection displaying: aString",
  31231. referencedClasses: [],
  31232. pragmas: [],
  31233. messageSends: ["do:on:displaying:", "current"]
  31234. }),
  31235. $globals.ProgressHandler.a$cls);
  31236. $core.addClass("Terminal", $globals.Service, [], "Platform-Services");
  31237. $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:'.";
  31238. $core.addMethod(
  31239. $core.method({
  31240. selector: "alert:",
  31241. protocol: "dialogs",
  31242. fn: function (aString){
  31243. var self=this,$self=this;
  31244. return $core.withContext(function($ctx1) {
  31245. return $recv($self._current())._alert_(aString);
  31246. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString})});
  31247. },
  31248. args: ["aString"],
  31249. source: "alert: aString\x0a\x09^ self current alert: aString",
  31250. referencedClasses: [],
  31251. pragmas: [],
  31252. messageSends: ["alert:", "current"]
  31253. }),
  31254. $globals.Terminal.a$cls);
  31255. $core.addMethod(
  31256. $core.method({
  31257. selector: "confirm:",
  31258. protocol: "dialogs",
  31259. fn: function (aString){
  31260. var self=this,$self=this;
  31261. return $core.withContext(function($ctx1) {
  31262. return $recv($self._current())._confirm_(aString);
  31263. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString})});
  31264. },
  31265. args: ["aString"],
  31266. source: "confirm: aString\x0a\x09^ self current confirm: aString",
  31267. referencedClasses: [],
  31268. pragmas: [],
  31269. messageSends: ["confirm:", "current"]
  31270. }),
  31271. $globals.Terminal.a$cls);
  31272. $core.addMethod(
  31273. $core.method({
  31274. selector: "prompt:",
  31275. protocol: "dialogs",
  31276. fn: function (aString){
  31277. var self=this,$self=this;
  31278. return $core.withContext(function($ctx1) {
  31279. return $recv($self._current())._prompt_(aString);
  31280. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString})});
  31281. },
  31282. args: ["aString"],
  31283. source: "prompt: aString\x0a\x09^ self current prompt: aString",
  31284. referencedClasses: [],
  31285. pragmas: [],
  31286. messageSends: ["prompt:", "current"]
  31287. }),
  31288. $globals.Terminal.a$cls);
  31289. $core.addMethod(
  31290. $core.method({
  31291. selector: "prompt:default:",
  31292. protocol: "dialogs",
  31293. fn: function (aString,defaultString){
  31294. var self=this,$self=this;
  31295. return $core.withContext(function($ctx1) {
  31296. return $recv($self._current())._prompt_default_(aString,defaultString);
  31297. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString})});
  31298. },
  31299. args: ["aString", "defaultString"],
  31300. source: "prompt: aString default: defaultString\x0a\x09^ self current prompt: aString default: defaultString",
  31301. referencedClasses: [],
  31302. pragmas: [],
  31303. messageSends: ["prompt:default:", "current"]
  31304. }),
  31305. $globals.Terminal.a$cls);
  31306. $core.addClass("Transcript", $globals.Service, [], "Platform-Services");
  31307. $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.";
  31308. $core.addMethod(
  31309. $core.method({
  31310. selector: "clear",
  31311. protocol: "printing",
  31312. fn: function (){
  31313. var self=this,$self=this;
  31314. return $core.withContext(function($ctx1) {
  31315. $recv($self._current())._clear();
  31316. return self;
  31317. }, function($ctx1) {$ctx1.fill(self,"clear",{})});
  31318. },
  31319. args: [],
  31320. source: "clear\x0a\x09self current clear",
  31321. referencedClasses: [],
  31322. pragmas: [],
  31323. messageSends: ["clear", "current"]
  31324. }),
  31325. $globals.Transcript.a$cls);
  31326. $core.addMethod(
  31327. $core.method({
  31328. selector: "cr",
  31329. protocol: "printing",
  31330. fn: function (){
  31331. var self=this,$self=this;
  31332. return $core.withContext(function($ctx1) {
  31333. $recv($self._current())._show_($recv($globals.String)._cr());
  31334. return self;
  31335. }, function($ctx1) {$ctx1.fill(self,"cr",{})});
  31336. },
  31337. args: [],
  31338. source: "cr\x0a\x09self current show: String cr",
  31339. referencedClasses: ["String"],
  31340. pragmas: [],
  31341. messageSends: ["show:", "current", "cr"]
  31342. }),
  31343. $globals.Transcript.a$cls);
  31344. $core.addMethod(
  31345. $core.method({
  31346. selector: "inspect:",
  31347. protocol: "printing",
  31348. fn: function (anObject){
  31349. var self=this,$self=this;
  31350. return $core.withContext(function($ctx1) {
  31351. $self._show_(anObject);
  31352. return self;
  31353. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject})});
  31354. },
  31355. args: ["anObject"],
  31356. source: "inspect: anObject\x0a\x09self show: anObject",
  31357. referencedClasses: [],
  31358. pragmas: [],
  31359. messageSends: ["show:"]
  31360. }),
  31361. $globals.Transcript.a$cls);
  31362. $core.addMethod(
  31363. $core.method({
  31364. selector: "open",
  31365. protocol: "instance creation",
  31366. fn: function (){
  31367. var self=this,$self=this;
  31368. return $core.withContext(function($ctx1) {
  31369. $recv($self._current())._open();
  31370. return self;
  31371. }, function($ctx1) {$ctx1.fill(self,"open",{})});
  31372. },
  31373. args: [],
  31374. source: "open\x0a\x09self current open",
  31375. referencedClasses: [],
  31376. pragmas: [],
  31377. messageSends: ["open", "current"]
  31378. }),
  31379. $globals.Transcript.a$cls);
  31380. $core.addMethod(
  31381. $core.method({
  31382. selector: "show:",
  31383. protocol: "printing",
  31384. fn: function (anObject){
  31385. var self=this,$self=this;
  31386. return $core.withContext(function($ctx1) {
  31387. $recv($self._current())._show_(anObject);
  31388. return self;
  31389. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject})});
  31390. },
  31391. args: ["anObject"],
  31392. source: "show: anObject\x0a\x09self current show: anObject",
  31393. referencedClasses: [],
  31394. pragmas: [],
  31395. messageSends: ["show:", "current"]
  31396. }),
  31397. $globals.Transcript.a$cls);
  31398. $core.addMethod(
  31399. $core.method({
  31400. selector: "inspectOn:",
  31401. protocol: "*Platform-Services",
  31402. fn: function (anInspector){
  31403. var self=this,$self=this;
  31404. var variables;
  31405. return $core.withContext(function($ctx1) {
  31406. variables=$recv($globals.Dictionary)._new();
  31407. $recv(variables)._at_put_("#self",self);
  31408. $ctx1.sendIdx["at:put:"]=1;
  31409. $recv(variables)._at_put_("#keys",$self._keys());
  31410. $ctx1.sendIdx["at:put:"]=2;
  31411. $self._keysAndValuesDo_((function(key,value){
  31412. return $core.withContext(function($ctx2) {
  31413. return $recv(variables)._at_put_(key,value);
  31414. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  31415. }));
  31416. $recv(anInspector)._setLabel_($self._printString());
  31417. $recv(anInspector)._setVariables_(variables);
  31418. return self;
  31419. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables})});
  31420. },
  31421. args: ["anInspector"],
  31422. source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self.\x0a\x09variables at: '#keys' put: self keys.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09variables at: key put: value ].\x0a\x09anInspector\x0a\x09\x09setLabel: self printString;\x0a\x09\x09setVariables: variables",
  31423. referencedClasses: ["Dictionary"],
  31424. pragmas: [],
  31425. messageSends: ["new", "at:put:", "keys", "keysAndValuesDo:", "setLabel:", "printString", "setVariables:"]
  31426. }),
  31427. $globals.AssociativeCollection);
  31428. $core.addMethod(
  31429. $core.method({
  31430. selector: "inspectOn:",
  31431. protocol: "*Platform-Services",
  31432. fn: function (anInspector){
  31433. var self=this,$self=this;
  31434. var variables;
  31435. return $core.withContext(function($ctx1) {
  31436. variables=$recv($globals.Dictionary)._new();
  31437. $recv(variables)._at_put_("#self",self);
  31438. $ctx1.sendIdx["at:put:"]=1;
  31439. $self._withIndexDo_((function(each,i){
  31440. return $core.withContext(function($ctx2) {
  31441. return $recv(variables)._at_put_(i,each);
  31442. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  31443. }));
  31444. $recv(anInspector)._setLabel_($self._printString());
  31445. $recv(anInspector)._setVariables_(variables);
  31446. return self;
  31447. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables})});
  31448. },
  31449. args: ["anInspector"],
  31450. source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self.\x0a\x09self withIndexDo: [ :each :i |\x0a\x09\x09variables at: i put: each ].\x0a\x09anInspector\x0a\x09\x09setLabel: self printString;\x0a\x09\x09setVariables: variables",
  31451. referencedClasses: ["Dictionary"],
  31452. pragmas: [],
  31453. messageSends: ["new", "at:put:", "withIndexDo:", "setLabel:", "printString", "setVariables:"]
  31454. }),
  31455. $globals.Collection);
  31456. $core.addMethod(
  31457. $core.method({
  31458. selector: "inspectOn:",
  31459. protocol: "*Platform-Services",
  31460. fn: function (anInspector){
  31461. var self=this,$self=this;
  31462. var variables;
  31463. return $core.withContext(function($ctx1) {
  31464. variables=$recv($globals.Dictionary)._new();
  31465. $recv(variables)._at_put_("#self",self);
  31466. $ctx1.sendIdx["at:put:"]=1;
  31467. $recv(variables)._at_put_("#year",$self._year());
  31468. $ctx1.sendIdx["at:put:"]=2;
  31469. $recv(variables)._at_put_("#month",$self._month());
  31470. $ctx1.sendIdx["at:put:"]=3;
  31471. $recv(variables)._at_put_("#day",$self._day());
  31472. $ctx1.sendIdx["at:put:"]=4;
  31473. $recv(variables)._at_put_("#hours",$self._hours());
  31474. $ctx1.sendIdx["at:put:"]=5;
  31475. $recv(variables)._at_put_("#minutes",$self._minutes());
  31476. $ctx1.sendIdx["at:put:"]=6;
  31477. $recv(variables)._at_put_("#seconds",$self._seconds());
  31478. $ctx1.sendIdx["at:put:"]=7;
  31479. $recv(variables)._at_put_("#milliseconds",$self._milliseconds());
  31480. $recv(anInspector)._setLabel_($self._printString());
  31481. $recv(anInspector)._setVariables_(variables);
  31482. return self;
  31483. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables})});
  31484. },
  31485. args: ["anInspector"],
  31486. 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",
  31487. referencedClasses: ["Dictionary"],
  31488. pragmas: [],
  31489. messageSends: ["new", "at:put:", "year", "month", "day", "hours", "minutes", "seconds", "milliseconds", "setLabel:", "printString", "setVariables:"]
  31490. }),
  31491. $globals.Date);
  31492. $core.addMethod(
  31493. $core.method({
  31494. selector: "inspectOn:",
  31495. protocol: "*Platform-Services",
  31496. fn: function (anInspector){
  31497. var self=this,$self=this;
  31498. var variables;
  31499. return $core.withContext(function($ctx1) {
  31500. variables=$recv($globals.Dictionary)._new();
  31501. $recv(variables)._at_put_("#self",$self._jsObject());
  31502. $recv(anInspector)._setLabel_($self._printString());
  31503. $recv($globals.JSObjectProxy)._addObjectVariablesTo_ofProxy_(variables,self);
  31504. $recv(anInspector)._setVariables_(variables);
  31505. return self;
  31506. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables})});
  31507. },
  31508. args: ["anInspector"],
  31509. 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",
  31510. referencedClasses: ["Dictionary", "JSObjectProxy"],
  31511. pragmas: [],
  31512. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:ofProxy:", "setVariables:"]
  31513. }),
  31514. $globals.JSObjectProxy);
  31515. $core.addMethod(
  31516. $core.method({
  31517. selector: "inspectOn:",
  31518. protocol: "*Platform-Services",
  31519. fn: function (anInspector){
  31520. var self=this,$self=this;
  31521. var variables;
  31522. return $core.withContext(function($ctx1) {
  31523. variables=$recv($globals.Dictionary)._new();
  31524. $recv(variables)._at_put_("#self",self);
  31525. $ctx1.sendIdx["at:put:"]=1;
  31526. $recv($recv($self._class())._allInstanceVariableNames())._do_((function(each){
  31527. return $core.withContext(function($ctx2) {
  31528. return $recv(variables)._at_put_(each,$self._instVarAt_(each));
  31529. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31530. }));
  31531. $recv(anInspector)._setLabel_($self._printString());
  31532. $recv(anInspector)._setVariables_(variables);
  31533. return self;
  31534. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables})});
  31535. },
  31536. args: ["anInspector"],
  31537. source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self.\x0a\x09self class allInstanceVariableNames do: [ :each |\x0a\x09\x09variables at: each put: (self instVarAt: each) ].\x0a\x09anInspector\x0a\x09\x09setLabel: self printString;\x0a\x09\x09setVariables: variables",
  31538. referencedClasses: ["Dictionary"],
  31539. pragmas: [],
  31540. messageSends: ["new", "at:put:", "do:", "allInstanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  31541. }),
  31542. $globals.Object);
  31543. $core.addMethod(
  31544. $core.method({
  31545. selector: "do:displayingProgress:",
  31546. protocol: "*Platform-Services",
  31547. fn: function (aBlock,aString){
  31548. var self=this,$self=this;
  31549. return $core.withContext(function($ctx1) {
  31550. $recv($globals.ProgressHandler)._do_on_displaying_(aBlock,self,aString);
  31551. return self;
  31552. }, function($ctx1) {$ctx1.fill(self,"do:displayingProgress:",{aBlock:aBlock,aString:aString})});
  31553. },
  31554. args: ["aBlock", "aString"],
  31555. source: "do: aBlock displayingProgress: aString\x0a\x09ProgressHandler \x0a\x09\x09do: aBlock \x0a\x09\x09on: self \x0a\x09\x09displaying: aString",
  31556. referencedClasses: ["ProgressHandler"],
  31557. pragmas: [],
  31558. messageSends: ["do:on:displaying:"]
  31559. }),
  31560. $globals.SequenceableCollection);
  31561. $core.addMethod(
  31562. $core.method({
  31563. selector: "inspectOn:",
  31564. protocol: "*Platform-Services",
  31565. fn: function (anInspector){
  31566. var self=this,$self=this;
  31567. var variables,i;
  31568. return $core.withContext(function($ctx1) {
  31569. variables=$recv($globals.Dictionary)._new();
  31570. $recv(variables)._at_put_("#self",self);
  31571. $ctx1.sendIdx["at:put:"]=1;
  31572. i=(1);
  31573. $self._do_((function(each){
  31574. return $core.withContext(function($ctx2) {
  31575. $recv(variables)._at_put_(i,each);
  31576. i=$recv(i).__plus((1));
  31577. return i;
  31578. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31579. }));
  31580. $recv(anInspector)._setLabel_($self._printString());
  31581. $recv(anInspector)._setVariables_(variables);
  31582. return self;
  31583. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables,i:i})});
  31584. },
  31585. args: ["anInspector"],
  31586. source: "inspectOn: anInspector\x0a\x09| variables i |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self.\x0a\x09i := 1.\x0a\x09self do: [ :each |\x0a\x09\x09variables at: i put: each.\x0a\x09\x09i := i + 1 ].\x0a\x09anInspector\x0a\x09\x09setLabel: self printString;\x0a\x09\x09setVariables: variables",
  31587. referencedClasses: ["Dictionary"],
  31588. pragmas: [],
  31589. messageSends: ["new", "at:put:", "do:", "+", "setLabel:", "printString", "setVariables:"]
  31590. }),
  31591. $globals.Set);
  31592. $core.addMethod(
  31593. $core.method({
  31594. selector: "inspectOn:",
  31595. protocol: "*Platform-Services",
  31596. fn: function (anInspector){
  31597. var self=this,$self=this;
  31598. var label;
  31599. return $core.withContext(function($ctx1) {
  31600. var $3,$2,$1,$5,$4;
  31601. (
  31602. $ctx1.supercall = true,
  31603. ($globals.String.superclass||$boot.nilAsClass).fn.prototype._inspectOn_.apply($self, [anInspector]));
  31604. $ctx1.supercall = false;
  31605. $3=$self._printString();
  31606. $ctx1.sendIdx["printString"]=1;
  31607. $2=$recv($3)._size();
  31608. $1=$recv($2).__gt((30));
  31609. if($core.assert($1)){
  31610. $5=$self._printString();
  31611. $ctx1.sendIdx["printString"]=2;
  31612. $4=$recv($5)._copyFrom_to_((1),(30));
  31613. label=$recv($4).__comma("...'");
  31614. label;
  31615. } else {
  31616. label=$self._printString();
  31617. label;
  31618. }
  31619. $recv(anInspector)._setLabel_(label);
  31620. return self;
  31621. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,label:label})});
  31622. },
  31623. args: ["anInspector"],
  31624. source: "inspectOn: anInspector\x0a\x09| label |\x0a\x09super inspectOn: anInspector.\x0a\x09self printString size > 30\x0a\x09\x09ifTrue: [ label := (self printString copyFrom: 1 to: 30), '...''' ]\x0a\x09\x09ifFalse: [ label := self printString ].\x0a\x09anInspector setLabel: label",
  31625. referencedClasses: [],
  31626. pragmas: [],
  31627. messageSends: ["inspectOn:", "ifTrue:ifFalse:", ">", "size", "printString", ",", "copyFrom:to:", "setLabel:"]
  31628. }),
  31629. $globals.String);
  31630. $core.addMethod(
  31631. $core.method({
  31632. selector: "inspectOn:",
  31633. protocol: "*Platform-Services",
  31634. fn: function (anInspector){
  31635. var self=this,$self=this;
  31636. var variables;
  31637. return $core.withContext(function($ctx1) {
  31638. variables=$recv($globals.Dictionary)._new();
  31639. $recv(variables)._at_put_("#self",self);
  31640. $ctx1.sendIdx["at:put:"]=1;
  31641. $recv(variables)._at_put_("#home",$self._home());
  31642. $ctx1.sendIdx["at:put:"]=2;
  31643. $recv(variables)._at_put_("#receiver",$self._receiver());
  31644. $ctx1.sendIdx["at:put:"]=3;
  31645. $recv(variables)._at_put_("#selector",$self._selector());
  31646. $ctx1.sendIdx["at:put:"]=4;
  31647. $recv(variables)._at_put_("#locals",$self._locals());
  31648. $ctx1.sendIdx["at:put:"]=5;
  31649. $recv($recv($self._class())._instanceVariableNames())._do_((function(each){
  31650. return $core.withContext(function($ctx2) {
  31651. return $recv(variables)._at_put_(each,$self._instVarAt_(each));
  31652. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31653. }));
  31654. $recv(anInspector)._setLabel_($self._printString());
  31655. $recv(anInspector)._setVariables_(variables);
  31656. return self;
  31657. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables})});
  31658. },
  31659. args: ["anInspector"],
  31660. source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self.\x0a\x09variables at: '#home' put: self home.\x0a\x09variables at: '#receiver' put: self receiver.\x0a\x09variables at: '#selector' put: self selector.\x0a\x09variables at: '#locals' put: self locals.\x0a\x09self class instanceVariableNames do: [ :each |\x0a\x09\x09variables at: each put: (self instVarAt: each) ].\x0a\x09anInspector\x0a\x09\x09setLabel: self printString;\x0a\x09\x09setVariables: variables",
  31661. referencedClasses: ["Dictionary"],
  31662. pragmas: [],
  31663. messageSends: ["new", "at:put:", "home", "receiver", "selector", "locals", "do:", "instanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  31664. }),
  31665. $globals.TMethodContext);
  31666. });
  31667. define('amber/deploy',[
  31668. './helpers',
  31669. './boot', // pre-fetch, dep of ./helpers
  31670. // --- packages of the core Amber begin here ---
  31671. 'amber/core/Kernel-Helpers',
  31672. 'amber/core/Kernel-Objects',
  31673. 'amber/core/Kernel-Classes',
  31674. 'amber/core/Kernel-Methods',
  31675. 'amber/core/Kernel-Collections',
  31676. 'amber/core/Kernel-Dag',
  31677. 'amber/core/Kernel-Infrastructure',
  31678. 'amber/core/Kernel-Promises',
  31679. 'amber/core/Kernel-Exceptions',
  31680. 'amber/core/Kernel-Announcements',
  31681. 'amber/core/Platform-Services',
  31682. // --- packages of the core Amber end here ---
  31683. ], function (amber) {
  31684. return amber;
  31685. });
  31686. 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";
  31687. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  31688. var $pkg = $core.addPackage("Platform-ImportExport");
  31689. $pkg.innerEval = function (expr) { return eval(expr); };
  31690. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  31691. $core.addClass("AbstractExporter", $globals.Object, [], "Platform-ImportExport");
  31692. $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.";
  31693. $core.addMethod(
  31694. $core.method({
  31695. selector: "exportPackage:on:",
  31696. protocol: "output",
  31697. fn: function (aPackage,aStream){
  31698. var self=this,$self=this;
  31699. return $core.withContext(function($ctx1) {
  31700. $self._subclassResponsibility();
  31701. return self;
  31702. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream})});
  31703. },
  31704. args: ["aPackage", "aStream"],
  31705. source: "exportPackage: aPackage on: aStream\x0a\x09self subclassResponsibility",
  31706. referencedClasses: [],
  31707. pragmas: [],
  31708. messageSends: ["subclassResponsibility"]
  31709. }),
  31710. $globals.AbstractExporter);
  31711. $core.addMethod(
  31712. $core.method({
  31713. selector: "extensionMethodsOfPackage:",
  31714. protocol: "accessing",
  31715. fn: function (aPackage){
  31716. var self=this,$self=this;
  31717. var result;
  31718. return $core.withContext(function($ctx1) {
  31719. result=$recv($globals.OrderedCollection)._new();
  31720. $recv($self._extensionProtocolsOfPackage_(aPackage))._do_((function(each){
  31721. return $core.withContext(function($ctx2) {
  31722. return $recv(result)._addAll_($recv(each)._ownMethods());
  31723. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31724. }));
  31725. return result;
  31726. }, function($ctx1) {$ctx1.fill(self,"extensionMethodsOfPackage:",{aPackage:aPackage,result:result})});
  31727. },
  31728. args: ["aPackage"],
  31729. 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",
  31730. referencedClasses: ["OrderedCollection"],
  31731. pragmas: [],
  31732. messageSends: ["new", "do:", "extensionProtocolsOfPackage:", "addAll:", "ownMethods"]
  31733. }),
  31734. $globals.AbstractExporter);
  31735. $core.addMethod(
  31736. $core.method({
  31737. selector: "extensionProtocolsOfPackage:",
  31738. protocol: "accessing",
  31739. fn: function (aPackage){
  31740. var self=this,$self=this;
  31741. var extensionName,result;
  31742. return $core.withContext(function($ctx1) {
  31743. var $1,$2,$3;
  31744. $1=$recv(aPackage)._name();
  31745. $ctx1.sendIdx["name"]=1;
  31746. extensionName="*".__comma($1);
  31747. result=$recv($globals.OrderedCollection)._new();
  31748. $recv($recv($recv($recv($globals.Smalltalk)._classes())._asArray())._sorted_((function(a,b){
  31749. return $core.withContext(function($ctx2) {
  31750. $2=$recv(a)._name();
  31751. $ctx2.sendIdx["name"]=2;
  31752. return $recv($2).__lt($recv(b)._name());
  31753. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  31754. })))._do_((function(each){
  31755. return $core.withContext(function($ctx2) {
  31756. return $recv(each)._includingPossibleMetaDo_((function(behavior){
  31757. return $core.withContext(function($ctx3) {
  31758. $3=$recv($recv(behavior)._protocols())._includes_(extensionName);
  31759. if($core.assert($3)){
  31760. return $recv(result)._add_($recv($globals.ExportMethodProtocol)._name_theClass_(extensionName,behavior));
  31761. }
  31762. }, function($ctx3) {$ctx3.fillBlock({behavior:behavior},$ctx2,3)});
  31763. }));
  31764. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  31765. }));
  31766. return result;
  31767. }, function($ctx1) {$ctx1.fill(self,"extensionProtocolsOfPackage:",{aPackage:aPackage,extensionName:extensionName,result:result})});
  31768. },
  31769. args: ["aPackage"],
  31770. 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",
  31771. referencedClasses: ["OrderedCollection", "Smalltalk", "ExportMethodProtocol"],
  31772. pragmas: [],
  31773. messageSends: [",", "name", "new", "do:", "sorted:", "asArray", "classes", "<", "includingPossibleMetaDo:", "ifTrue:", "includes:", "protocols", "add:", "name:theClass:"]
  31774. }),
  31775. $globals.AbstractExporter);
  31776. $core.addClass("ChunkExporter", $globals.AbstractExporter, [], "Platform-ImportExport");
  31777. $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.";
  31778. $core.addMethod(
  31779. $core.method({
  31780. selector: "chunkEscape:",
  31781. protocol: "convenience",
  31782. fn: function (aString){
  31783. var self=this,$self=this;
  31784. return $core.withContext(function($ctx1) {
  31785. return $recv($recv(aString)._replace_with_("!","!!"))._trimBoth();
  31786. }, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString})});
  31787. },
  31788. args: ["aString"],
  31789. source: "chunkEscape: aString\x0a\x09\x22Replace all occurrences of ! with !! and trim at both ends.\x22\x0a\x0a\x09^ (aString replace: '!' with: '!!') trimBoth",
  31790. referencedClasses: [],
  31791. pragmas: [],
  31792. messageSends: ["trimBoth", "replace:with:"]
  31793. }),
  31794. $globals.ChunkExporter);
  31795. $core.addMethod(
  31796. $core.method({
  31797. selector: "exportBehavior:on:",
  31798. protocol: "output",
  31799. fn: function (aBehavior,aStream){
  31800. var self=this,$self=this;
  31801. return $core.withContext(function($ctx1) {
  31802. $recv(aBehavior)._exportBehaviorDefinitionTo_using_(aStream,self);
  31803. $self._exportProtocols_on_($self._ownMethodProtocolsOfClass_(aBehavior),aStream);
  31804. return self;
  31805. }, function($ctx1) {$ctx1.fill(self,"exportBehavior:on:",{aBehavior:aBehavior,aStream:aStream})});
  31806. },
  31807. args: ["aBehavior", "aStream"],
  31808. source: "exportBehavior: aBehavior on: aStream\x0a\x09aBehavior exportBehaviorDefinitionTo: aStream using: self.\x0a\x09self \x0a\x09\x09exportProtocols: (self ownMethodProtocolsOfClass: aBehavior)\x0a\x09\x09on: aStream",
  31809. referencedClasses: [],
  31810. pragmas: [],
  31811. messageSends: ["exportBehaviorDefinitionTo:using:", "exportProtocols:on:", "ownMethodProtocolsOfClass:"]
  31812. }),
  31813. $globals.ChunkExporter);
  31814. $core.addMethod(
  31815. $core.method({
  31816. selector: "exportCategoryEpilogueOf:on:",
  31817. protocol: "output",
  31818. fn: function (aCategory,aStream){
  31819. var self=this,$self=this;
  31820. return $core.withContext(function($ctx1) {
  31821. $recv(aStream)._write_(" !");
  31822. $recv(aStream)._lf();
  31823. $ctx1.sendIdx["lf"]=1;
  31824. $recv(aStream)._lf();
  31825. return self;
  31826. }, function($ctx1) {$ctx1.fill(self,"exportCategoryEpilogueOf:on:",{aCategory:aCategory,aStream:aStream})});
  31827. },
  31828. args: ["aCategory", "aStream"],
  31829. source: "exportCategoryEpilogueOf: aCategory on: aStream\x0a\x09aStream write: ' !'; lf; lf",
  31830. referencedClasses: [],
  31831. pragmas: [],
  31832. messageSends: ["write:", "lf"]
  31833. }),
  31834. $globals.ChunkExporter);
  31835. $core.addMethod(
  31836. $core.method({
  31837. selector: "exportCategoryPrologueOf:on:",
  31838. protocol: "output",
  31839. fn: function (aCategory,aStream){
  31840. var self=this,$self=this;
  31841. return $core.withContext(function($ctx1) {
  31842. $recv(aStream)._write_("!");
  31843. $ctx1.sendIdx["write:"]=1;
  31844. $recv(aStream)._print_($recv(aCategory)._theClass());
  31845. $ctx1.sendIdx["print:"]=1;
  31846. $recv(aStream)._write_(" methodsFor: ");
  31847. $ctx1.sendIdx["write:"]=2;
  31848. $recv(aStream)._print_(aCategory);
  31849. $recv(aStream)._write_("!");
  31850. return self;
  31851. }, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{aCategory:aCategory,aStream:aStream})});
  31852. },
  31853. args: ["aCategory", "aStream"],
  31854. 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: '!'",
  31855. referencedClasses: [],
  31856. pragmas: [],
  31857. messageSends: ["write:", "print:", "theClass"]
  31858. }),
  31859. $globals.ChunkExporter);
  31860. $core.addMethod(
  31861. $core.method({
  31862. selector: "exportDefinitionOf:on:",
  31863. protocol: "output",
  31864. fn: function (aClass,aStream){
  31865. var self=this,$self=this;
  31866. return $core.withContext(function($ctx1) {
  31867. var $1;
  31868. $recv(aStream)._print_($recv(aClass)._superclass());
  31869. $ctx1.sendIdx["print:"]=1;
  31870. $recv(aStream)._write_(" subclass: ");
  31871. $ctx1.sendIdx["write:"]=1;
  31872. $recv(aStream)._printSymbol_($recv(aClass)._name());
  31873. $recv(aStream)._lf();
  31874. $ctx1.sendIdx["lf"]=1;
  31875. $recv(aStream)._tab();
  31876. $ctx1.sendIdx["tab"]=1;
  31877. $recv(aStream)._write_(["slots: {",". "._join_($recv($recv(aClass)._instanceVariableNames())._collect_("symbolPrintString")),"}"]);
  31878. $ctx1.sendIdx["write:"]=2;
  31879. $recv(aStream)._lf();
  31880. $ctx1.sendIdx["lf"]=2;
  31881. $recv(aStream)._tab();
  31882. $recv(aStream)._write_("package: ");
  31883. $ctx1.sendIdx["write:"]=3;
  31884. $recv(aStream)._print_($recv(aClass)._category());
  31885. $ctx1.sendIdx["print:"]=2;
  31886. $recv(aStream)._write_("!");
  31887. $ctx1.sendIdx["write:"]=4;
  31888. $recv(aStream)._lf();
  31889. $ctx1.sendIdx["lf"]=3;
  31890. $1=$recv(aClass)._comment();
  31891. $ctx1.sendIdx["comment"]=1;
  31892. $recv($1)._ifNotEmpty_((function(){
  31893. return $core.withContext(function($ctx2) {
  31894. $recv(aStream)._write_("!");
  31895. $ctx2.sendIdx["write:"]=5;
  31896. $recv(aStream)._print_(aClass);
  31897. $recv(aStream)._write_(" commentStamp!");
  31898. $ctx2.sendIdx["write:"]=6;
  31899. $recv(aStream)._lf();
  31900. $ctx2.sendIdx["lf"]=4;
  31901. $recv(aStream)._write_([$self._chunkEscape_($recv(aClass)._comment()),"!"]);
  31902. return $recv(aStream)._lf();
  31903. $ctx2.sendIdx["lf"]=5;
  31904. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31905. }));
  31906. $recv(aStream)._lf();
  31907. return self;
  31908. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream})});
  31909. },
  31910. args: ["aClass", "aStream"],
  31911. 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",
  31912. referencedClasses: [],
  31913. pragmas: [],
  31914. messageSends: ["print:", "superclass", "write:", "printSymbol:", "name", "lf", "tab", "join:", "collect:", "instanceVariableNames", "category", "ifNotEmpty:", "comment", "chunkEscape:"]
  31915. }),
  31916. $globals.ChunkExporter);
  31917. $core.addMethod(
  31918. $core.method({
  31919. selector: "exportMetaDefinitionOf:on:",
  31920. protocol: "output",
  31921. fn: function (aClass,aStream){
  31922. var self=this,$self=this;
  31923. var classIvars,classTraitComposition;
  31924. return $core.withContext(function($ctx1) {
  31925. var $1,$2;
  31926. $1=$recv(aClass)._class();
  31927. $ctx1.sendIdx["class"]=1;
  31928. classIvars=$recv($1)._instanceVariableNames();
  31929. classTraitComposition=$recv($recv(aClass)._class())._traitComposition();
  31930. $2=$recv(classIvars)._notEmpty();
  31931. if($core.assert($2)){
  31932. $recv(aStream)._print_($recv(aClass)._theMetaClass());
  31933. $recv(aStream)._space();
  31934. $recv(aStream)._write_(["slots: {",". "._join_($recv(classIvars)._collect_("symbolPrintString")),"}!"]);
  31935. $recv(aStream)._lf();
  31936. $ctx1.sendIdx["lf"]=1;
  31937. $recv(aStream)._lf();
  31938. }
  31939. return self;
  31940. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream,classIvars:classIvars,classTraitComposition:classTraitComposition})});
  31941. },
  31942. args: ["aClass", "aStream"],
  31943. 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 ]",
  31944. referencedClasses: [],
  31945. pragmas: [],
  31946. messageSends: ["instanceVariableNames", "class", "traitComposition", "ifTrue:", "notEmpty", "print:", "theMetaClass", "space", "write:", "join:", "collect:", "lf"]
  31947. }),
  31948. $globals.ChunkExporter);
  31949. $core.addMethod(
  31950. $core.method({
  31951. selector: "exportMethod:on:",
  31952. protocol: "output",
  31953. fn: function (aMethod,aStream){
  31954. var self=this,$self=this;
  31955. return $core.withContext(function($ctx1) {
  31956. $recv(aStream)._lf();
  31957. $ctx1.sendIdx["lf"]=1;
  31958. $recv(aStream)._lf();
  31959. $ctx1.sendIdx["lf"]=2;
  31960. $recv(aStream)._write_($self._chunkEscape_($recv(aMethod)._source()));
  31961. $ctx1.sendIdx["write:"]=1;
  31962. $recv(aStream)._lf();
  31963. $recv(aStream)._write_("!");
  31964. return self;
  31965. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream})});
  31966. },
  31967. args: ["aMethod", "aStream"],
  31968. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09lf; lf; write: (self chunkEscape: aMethod source); lf;\x0a\x09\x09write: '!'",
  31969. referencedClasses: [],
  31970. pragmas: [],
  31971. messageSends: ["lf", "write:", "chunkEscape:", "source"]
  31972. }),
  31973. $globals.ChunkExporter);
  31974. $core.addMethod(
  31975. $core.method({
  31976. selector: "exportPackage:on:",
  31977. protocol: "output",
  31978. fn: function (aPackage,aStream){
  31979. var self=this,$self=this;
  31980. return $core.withContext(function($ctx1) {
  31981. $self._exportPackageDefinitionOf_on_(aPackage,aStream);
  31982. $self._exportPackageImportsOf_on_(aPackage,aStream);
  31983. $recv($recv(aPackage)._sortedClasses())._do_((function(eachClass){
  31984. return $core.withContext(function($ctx2) {
  31985. return $recv(eachClass)._includingPossibleMetaDo_((function(each){
  31986. return $core.withContext(function($ctx3) {
  31987. return $self._exportBehavior_on_(each,aStream);
  31988. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  31989. }));
  31990. }, function($ctx2) {$ctx2.fillBlock({eachClass:eachClass},$ctx1,1)});
  31991. }));
  31992. $self._exportPackageTraitCompositionsOf_on_(aPackage,aStream);
  31993. $self._exportProtocols_on_($self._extensionProtocolsOfPackage_(aPackage),aStream);
  31994. return self;
  31995. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream})});
  31996. },
  31997. args: ["aPackage", "aStream"],
  31998. 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",
  31999. referencedClasses: [],
  32000. pragmas: [],
  32001. messageSends: ["exportPackageDefinitionOf:on:", "exportPackageImportsOf:on:", "do:", "sortedClasses", "includingPossibleMetaDo:", "exportBehavior:on:", "exportPackageTraitCompositionsOf:on:", "exportProtocols:on:", "extensionProtocolsOfPackage:"]
  32002. }),
  32003. $globals.ChunkExporter);
  32004. $core.addMethod(
  32005. $core.method({
  32006. selector: "exportPackageDefinitionOf:on:",
  32007. protocol: "output",
  32008. fn: function (aPackage,aStream){
  32009. var self=this,$self=this;
  32010. return $core.withContext(function($ctx1) {
  32011. $recv(aStream)._write_("Smalltalk createPackage: ");
  32012. $ctx1.sendIdx["write:"]=1;
  32013. $recv(aStream)._print_($recv(aPackage)._name());
  32014. $recv(aStream)._write_("!");
  32015. $recv(aStream)._lf();
  32016. return self;
  32017. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream})});
  32018. },
  32019. args: ["aPackage", "aStream"],
  32020. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: 'Smalltalk createPackage: ';\x0a\x09\x09print: aPackage name;\x0a\x09\x09write: '!';\x0a\x09\x09lf",
  32021. referencedClasses: [],
  32022. pragmas: [],
  32023. messageSends: ["write:", "print:", "name", "lf"]
  32024. }),
  32025. $globals.ChunkExporter);
  32026. $core.addMethod(
  32027. $core.method({
  32028. selector: "exportPackageImportsOf:on:",
  32029. protocol: "output",
  32030. fn: function (aPackage,aStream){
  32031. var self=this,$self=this;
  32032. return $core.withContext(function($ctx1) {
  32033. var $1;
  32034. $recv($recv(aPackage)._imports())._ifNotEmpty_((function(imports){
  32035. return $core.withContext(function($ctx2) {
  32036. $recv(aStream)._write_("(Smalltalk packageAt: ");
  32037. $ctx2.sendIdx["write:"]=1;
  32038. $1=$recv(aPackage)._name();
  32039. $ctx2.sendIdx["name"]=1;
  32040. $recv(aStream)._print_($1);
  32041. $ctx2.sendIdx["print:"]=1;
  32042. $recv(aStream)._write_(" ifAbsent: [ self error: ");
  32043. $ctx2.sendIdx["write:"]=2;
  32044. $recv(aStream)._print_("Package not created: ".__comma($recv(aPackage)._name()));
  32045. $recv(aStream)._write_([" ]) imports: ",$self._chunkEscape_($recv(aPackage)._importsDefinition()),"!"]);
  32046. return $recv(aStream)._lf();
  32047. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  32048. }));
  32049. return self;
  32050. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream})});
  32051. },
  32052. args: ["aPackage", "aStream"],
  32053. 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 ]",
  32054. referencedClasses: [],
  32055. pragmas: [],
  32056. messageSends: ["ifNotEmpty:", "imports", "write:", "print:", "name", ",", "chunkEscape:", "importsDefinition", "lf"]
  32057. }),
  32058. $globals.ChunkExporter);
  32059. $core.addMethod(
  32060. $core.method({
  32061. selector: "exportPackageTraitCompositionsOf:on:",
  32062. protocol: "output",
  32063. fn: function (aPackage,aStream){
  32064. var self=this,$self=this;
  32065. return $core.withContext(function($ctx1) {
  32066. $recv($recv(aPackage)._traitCompositions())._ifNotEmpty_((function(traitCompositions){
  32067. return $core.withContext(function($ctx2) {
  32068. $recv(traitCompositions)._keysAndValuesDo_((function(key,value){
  32069. return $core.withContext(function($ctx3) {
  32070. return $self._exportTraitComposition_of_on_(value,key,aStream);
  32071. }, function($ctx3) {$ctx3.fillBlock({key:key,value:value},$ctx2,2)});
  32072. }));
  32073. $recv(aStream)._write_("! !");
  32074. $recv(aStream)._lf();
  32075. $ctx2.sendIdx["lf"]=1;
  32076. return $recv(aStream)._lf();
  32077. }, function($ctx2) {$ctx2.fillBlock({traitCompositions:traitCompositions},$ctx1,1)});
  32078. }));
  32079. return self;
  32080. }, function($ctx1) {$ctx1.fill(self,"exportPackageTraitCompositionsOf:on:",{aPackage:aPackage,aStream:aStream})});
  32081. },
  32082. args: ["aPackage", "aStream"],
  32083. 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 ]",
  32084. referencedClasses: [],
  32085. pragmas: [],
  32086. messageSends: ["ifNotEmpty:", "traitCompositions", "keysAndValuesDo:", "exportTraitComposition:of:on:", "write:", "lf"]
  32087. }),
  32088. $globals.ChunkExporter);
  32089. $core.addMethod(
  32090. $core.method({
  32091. selector: "exportProtocol:on:",
  32092. protocol: "output",
  32093. fn: function (aProtocol,aStream){
  32094. var self=this,$self=this;
  32095. return $core.withContext(function($ctx1) {
  32096. $recv($recv(aProtocol)._ownMethods())._ifNotEmpty_((function(methods){
  32097. return $core.withContext(function($ctx2) {
  32098. $self._exportProtocolPrologueOf_on_(aProtocol,aStream);
  32099. $recv(methods)._do_((function(method){
  32100. return $core.withContext(function($ctx3) {
  32101. return $self._exportMethod_on_(method,aStream);
  32102. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,2)});
  32103. }));
  32104. return $self._exportProtocolEpilogueOf_on_(aProtocol,aStream);
  32105. }, function($ctx2) {$ctx2.fillBlock({methods:methods},$ctx1,1)});
  32106. }));
  32107. return self;
  32108. }, function($ctx1) {$ctx1.fill(self,"exportProtocol:on:",{aProtocol:aProtocol,aStream:aStream})});
  32109. },
  32110. args: ["aProtocol", "aStream"],
  32111. 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 ]",
  32112. referencedClasses: [],
  32113. pragmas: [],
  32114. messageSends: ["ifNotEmpty:", "ownMethods", "exportProtocolPrologueOf:on:", "do:", "exportMethod:on:", "exportProtocolEpilogueOf:on:"]
  32115. }),
  32116. $globals.ChunkExporter);
  32117. $core.addMethod(
  32118. $core.method({
  32119. selector: "exportProtocolEpilogueOf:on:",
  32120. protocol: "output",
  32121. fn: function (aProtocol,aStream){
  32122. var self=this,$self=this;
  32123. return $core.withContext(function($ctx1) {
  32124. $recv(aStream)._write_(" !");
  32125. $recv(aStream)._lf();
  32126. $ctx1.sendIdx["lf"]=1;
  32127. $recv(aStream)._lf();
  32128. return self;
  32129. }, function($ctx1) {$ctx1.fill(self,"exportProtocolEpilogueOf:on:",{aProtocol:aProtocol,aStream:aStream})});
  32130. },
  32131. args: ["aProtocol", "aStream"],
  32132. source: "exportProtocolEpilogueOf: aProtocol on: aStream\x0a\x09aStream write: ' !'; lf; lf",
  32133. referencedClasses: [],
  32134. pragmas: [],
  32135. messageSends: ["write:", "lf"]
  32136. }),
  32137. $globals.ChunkExporter);
  32138. $core.addMethod(
  32139. $core.method({
  32140. selector: "exportProtocolPrologueOf:on:",
  32141. protocol: "output",
  32142. fn: function (aProtocol,aStream){
  32143. var self=this,$self=this;
  32144. return $core.withContext(function($ctx1) {
  32145. $recv(aStream)._write_("!");
  32146. $ctx1.sendIdx["write:"]=1;
  32147. $recv(aStream)._print_($recv(aProtocol)._theClass());
  32148. $ctx1.sendIdx["print:"]=1;
  32149. $recv(aStream)._write_(" methodsFor: ");
  32150. $ctx1.sendIdx["write:"]=2;
  32151. $recv(aStream)._print_($recv(aProtocol)._name());
  32152. $recv(aStream)._write_("!");
  32153. return self;
  32154. }, function($ctx1) {$ctx1.fill(self,"exportProtocolPrologueOf:on:",{aProtocol:aProtocol,aStream:aStream})});
  32155. },
  32156. args: ["aProtocol", "aStream"],
  32157. 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: '!'",
  32158. referencedClasses: [],
  32159. pragmas: [],
  32160. messageSends: ["write:", "print:", "theClass", "name"]
  32161. }),
  32162. $globals.ChunkExporter);
  32163. $core.addMethod(
  32164. $core.method({
  32165. selector: "exportProtocols:on:",
  32166. protocol: "output",
  32167. fn: function (aCollection,aStream){
  32168. var self=this,$self=this;
  32169. return $core.withContext(function($ctx1) {
  32170. $recv(aCollection)._do_((function(each){
  32171. return $core.withContext(function($ctx2) {
  32172. return $self._exportProtocol_on_(each,aStream);
  32173. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32174. }));
  32175. return self;
  32176. }, function($ctx1) {$ctx1.fill(self,"exportProtocols:on:",{aCollection:aCollection,aStream:aStream})});
  32177. },
  32178. args: ["aCollection", "aStream"],
  32179. source: "exportProtocols: aCollection on: aStream\x0a\x09aCollection do: [ :each |\x0a\x09\x09self exportProtocol: each on: aStream ]",
  32180. referencedClasses: [],
  32181. pragmas: [],
  32182. messageSends: ["do:", "exportProtocol:on:"]
  32183. }),
  32184. $globals.ChunkExporter);
  32185. $core.addMethod(
  32186. $core.method({
  32187. selector: "exportTraitComposition:of:on:",
  32188. protocol: "output",
  32189. fn: function (aTraitComposition,aBehavior,aStream){
  32190. var self=this,$self=this;
  32191. return $core.withContext(function($ctx1) {
  32192. $recv(aStream)._print_(aBehavior);
  32193. $recv(aStream)._write_(" setTraitComposition: ");
  32194. $ctx1.sendIdx["write:"]=1;
  32195. $recv(aStream)._write_($recv(aBehavior)._traitCompositionDefinition());
  32196. $ctx1.sendIdx["write:"]=2;
  32197. $recv(aStream)._write_(" asTraitComposition!");
  32198. $recv(aStream)._lf();
  32199. return self;
  32200. }, function($ctx1) {$ctx1.fill(self,"exportTraitComposition:of:on:",{aTraitComposition:aTraitComposition,aBehavior:aBehavior,aStream:aStream})});
  32201. },
  32202. args: ["aTraitComposition", "aBehavior", "aStream"],
  32203. 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",
  32204. referencedClasses: [],
  32205. pragmas: [],
  32206. messageSends: ["print:", "write:", "traitCompositionDefinition", "lf"]
  32207. }),
  32208. $globals.ChunkExporter);
  32209. $core.addMethod(
  32210. $core.method({
  32211. selector: "exportTraitDefinitionOf:on:",
  32212. protocol: "output",
  32213. fn: function (aClass,aStream){
  32214. var self=this,$self=this;
  32215. return $core.withContext(function($ctx1) {
  32216. var $1;
  32217. $recv(aStream)._write_("Trait named: ");
  32218. $ctx1.sendIdx["write:"]=1;
  32219. $recv(aStream)._printSymbol_($recv(aClass)._name());
  32220. $recv(aStream)._lf();
  32221. $ctx1.sendIdx["lf"]=1;
  32222. $recv(aStream)._tab();
  32223. $recv(aStream)._write_("package: ");
  32224. $ctx1.sendIdx["write:"]=2;
  32225. $recv(aStream)._print_($recv(aClass)._category());
  32226. $ctx1.sendIdx["print:"]=1;
  32227. $recv(aStream)._write_("!");
  32228. $ctx1.sendIdx["write:"]=3;
  32229. $recv(aStream)._lf();
  32230. $ctx1.sendIdx["lf"]=2;
  32231. $1=$recv(aClass)._comment();
  32232. $ctx1.sendIdx["comment"]=1;
  32233. $recv($1)._ifNotEmpty_((function(){
  32234. return $core.withContext(function($ctx2) {
  32235. $recv(aStream)._write_("!");
  32236. $ctx2.sendIdx["write:"]=4;
  32237. $recv(aStream)._print_(aClass);
  32238. $recv(aStream)._write_(" commentStamp!");
  32239. $ctx2.sendIdx["write:"]=5;
  32240. $recv(aStream)._lf();
  32241. $ctx2.sendIdx["lf"]=3;
  32242. $recv(aStream)._write_([$self._chunkEscape_($recv(aClass)._comment()),"!"]);
  32243. return $recv(aStream)._lf();
  32244. $ctx2.sendIdx["lf"]=4;
  32245. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32246. }));
  32247. $recv(aStream)._lf();
  32248. return self;
  32249. }, function($ctx1) {$ctx1.fill(self,"exportTraitDefinitionOf:on:",{aClass:aClass,aStream:aStream})});
  32250. },
  32251. args: ["aClass", "aStream"],
  32252. 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",
  32253. referencedClasses: [],
  32254. pragmas: [],
  32255. messageSends: ["write:", "printSymbol:", "name", "lf", "tab", "print:", "category", "ifNotEmpty:", "comment", "chunkEscape:"]
  32256. }),
  32257. $globals.ChunkExporter);
  32258. $core.addMethod(
  32259. $core.method({
  32260. selector: "extensionCategoriesOfPackage:",
  32261. protocol: "accessing",
  32262. fn: function (aPackage){
  32263. var self=this,$self=this;
  32264. var name,map,result;
  32265. return $core.withContext(function($ctx1) {
  32266. var $1;
  32267. name=$recv(aPackage)._name();
  32268. result=$recv($globals.OrderedCollection)._new();
  32269. $ctx1.sendIdx["new"]=1;
  32270. $recv($recv($globals.Package)._sortedClasses_($recv($globals.Smalltalk)._classes()))._do_((function(each){
  32271. return $core.withContext(function($ctx2) {
  32272. return $recv(each)._includingPossibleMetaDo_((function(aClass){
  32273. return $core.withContext(function($ctx3) {
  32274. map=$recv($globals.Dictionary)._new();
  32275. $recv(aClass)._protocolsDo_((function(category,methods){
  32276. return $core.withContext(function($ctx4) {
  32277. $1=$recv(category).__eq("*".__comma(name));
  32278. if($core.assert($1)){
  32279. return $recv(map)._at_put_(category,methods);
  32280. }
  32281. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3,3)});
  32282. }));
  32283. return $recv(result)._addAll_($recv($recv($recv(map)._keys())._sorted_((function(a,b){
  32284. return $core.withContext(function($ctx4) {
  32285. return $recv(a).__lt_eq(b);
  32286. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3,5)});
  32287. })))._collect_((function(category){
  32288. return $core.withContext(function($ctx4) {
  32289. return $recv($globals.MethodCategory)._name_theClass_methods_(category,aClass,$recv(map)._at_(category));
  32290. }, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3,6)});
  32291. })));
  32292. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2,2)});
  32293. }));
  32294. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32295. }));
  32296. return result;
  32297. }, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{aPackage:aPackage,name:name,map:map,result:result})});
  32298. },
  32299. args: ["aPackage"],
  32300. 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",
  32301. referencedClasses: ["OrderedCollection", "Package", "Smalltalk", "Dictionary", "MethodCategory"],
  32302. pragmas: [],
  32303. messageSends: ["name", "new", "do:", "sortedClasses:", "classes", "includingPossibleMetaDo:", "protocolsDo:", "ifTrue:", "=", ",", "at:put:", "addAll:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  32304. }),
  32305. $globals.ChunkExporter);
  32306. $core.addMethod(
  32307. $core.method({
  32308. selector: "ownCategoriesOfClass:",
  32309. protocol: "accessing",
  32310. fn: function (aClass){
  32311. var self=this,$self=this;
  32312. var map;
  32313. return $core.withContext(function($ctx1) {
  32314. var $1;
  32315. map=$recv($globals.Dictionary)._new();
  32316. $recv(aClass)._protocolsDo_((function(each,methods){
  32317. return $core.withContext(function($ctx2) {
  32318. $1=$recv(each)._match_("^\x5c*");
  32319. if(!$core.assert($1)){
  32320. return $recv(map)._at_put_(each,methods);
  32321. }
  32322. }, function($ctx2) {$ctx2.fillBlock({each:each,methods:methods},$ctx1,1)});
  32323. }));
  32324. return $recv($recv($recv(map)._keys())._sorted_((function(a,b){
  32325. return $core.withContext(function($ctx2) {
  32326. return $recv(a).__lt_eq(b);
  32327. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  32328. })))._collect_((function(each){
  32329. return $core.withContext(function($ctx2) {
  32330. return $recv($globals.MethodCategory)._name_theClass_methods_(each,aClass,$recv(map)._at_(each));
  32331. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  32332. }));
  32333. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map})});
  32334. },
  32335. args: ["aClass"],
  32336. 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) ]",
  32337. referencedClasses: ["Dictionary", "MethodCategory"],
  32338. pragmas: [],
  32339. messageSends: ["new", "protocolsDo:", "ifFalse:", "match:", "at:put:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  32340. }),
  32341. $globals.ChunkExporter);
  32342. $core.addMethod(
  32343. $core.method({
  32344. selector: "ownCategoriesOfMetaClass:",
  32345. protocol: "accessing",
  32346. fn: function (aClass){
  32347. var self=this,$self=this;
  32348. return $core.withContext(function($ctx1) {
  32349. return $self._ownCategoriesOfClass_($recv(aClass)._theMetaClass());
  32350. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfMetaClass:",{aClass:aClass})});
  32351. },
  32352. args: ["aClass"],
  32353. source: "ownCategoriesOfMetaClass: aClass\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09^ self ownCategoriesOfClass: aClass theMetaClass",
  32354. referencedClasses: [],
  32355. pragmas: [],
  32356. messageSends: ["ownCategoriesOfClass:", "theMetaClass"]
  32357. }),
  32358. $globals.ChunkExporter);
  32359. $core.addMethod(
  32360. $core.method({
  32361. selector: "ownMethodProtocolsOfClass:",
  32362. protocol: "accessing",
  32363. fn: function (aClass){
  32364. var self=this,$self=this;
  32365. return $core.withContext(function($ctx1) {
  32366. return $recv($recv(aClass)._ownProtocols())._collect_((function(each){
  32367. return $core.withContext(function($ctx2) {
  32368. return $recv($globals.ExportMethodProtocol)._name_theClass_(each,aClass);
  32369. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32370. }));
  32371. }, function($ctx1) {$ctx1.fill(self,"ownMethodProtocolsOfClass:",{aClass:aClass})});
  32372. },
  32373. args: ["aClass"],
  32374. 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 ]",
  32375. referencedClasses: ["ExportMethodProtocol"],
  32376. pragmas: [],
  32377. messageSends: ["collect:", "ownProtocols", "name:theClass:"]
  32378. }),
  32379. $globals.ChunkExporter);
  32380. $core.addClass("Exporter", $globals.AbstractExporter, [], "Platform-ImportExport");
  32381. $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.).";
  32382. $core.addMethod(
  32383. $core.method({
  32384. selector: "exportBehavior:on:",
  32385. protocol: "output",
  32386. fn: function (aBehavior,aStream){
  32387. var self=this,$self=this;
  32388. return $core.withContext(function($ctx1) {
  32389. $recv(aBehavior)._exportBehaviorDefinitionTo_using_(aStream,self);
  32390. $recv($recv(aBehavior)._ownMethods())._do_((function(method){
  32391. return $core.withContext(function($ctx2) {
  32392. return $self._exportMethod_on_(method,aStream);
  32393. }, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1,1)});
  32394. }));
  32395. return self;
  32396. }, function($ctx1) {$ctx1.fill(self,"exportBehavior:on:",{aBehavior:aBehavior,aStream:aStream})});
  32397. },
  32398. args: ["aBehavior", "aStream"],
  32399. source: "exportBehavior: aBehavior on: aStream\x0a\x09aBehavior exportBehaviorDefinitionTo: aStream using: self.\x0a\x09aBehavior ownMethods do: [ :method |\x0a\x09\x09self exportMethod: method on: aStream ]",
  32400. referencedClasses: [],
  32401. pragmas: [],
  32402. messageSends: ["exportBehaviorDefinitionTo:using:", "do:", "ownMethods", "exportMethod:on:"]
  32403. }),
  32404. $globals.Exporter);
  32405. $core.addMethod(
  32406. $core.method({
  32407. selector: "exportDefinitionOf:on:",
  32408. protocol: "output",
  32409. fn: function (aClass,aStream){
  32410. var self=this,$self=this;
  32411. return $core.withContext(function($ctx1) {
  32412. var $2,$4,$3,$5,$6,$1,$7,$9,$8,$receiver;
  32413. $recv(aStream)._lf();
  32414. $ctx1.sendIdx["lf"]=1;
  32415. $2=$recv($recv(aClass)._name())._asJavaScriptSource();
  32416. $ctx1.sendIdx["asJavaScriptSource"]=1;
  32417. $4=$recv(aClass)._superclass();
  32418. if(($receiver = $4) == null || $receiver.a$nil){
  32419. $3="null";
  32420. } else {
  32421. var superclass;
  32422. superclass=$receiver;
  32423. $3=$recv(superclass)._asJavaScriptSource();
  32424. $ctx1.sendIdx["asJavaScriptSource"]=2;
  32425. }
  32426. $5=$recv($recv(aClass)._instanceVariableNames())._asJavaScriptSource();
  32427. $ctx1.sendIdx["asJavaScriptSource"]=3;
  32428. $6=$recv($recv(aClass)._category())._asJavaScriptSource();
  32429. $ctx1.sendIdx["asJavaScriptSource"]=4;
  32430. $1=["$core.addClass(",$2,", ",$3,", ",$5,", ",$6,");"];
  32431. $recv(aStream)._write_($1);
  32432. $ctx1.sendIdx["write:"]=1;
  32433. $7=$recv(aClass)._comment();
  32434. $ctx1.sendIdx["comment"]=1;
  32435. $recv($7)._ifNotEmpty_((function(){
  32436. return $core.withContext(function($ctx2) {
  32437. $recv(aStream)._lf();
  32438. $ctx2.sendIdx["lf"]=2;
  32439. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  32440. $ctx2.sendIdx["write:"]=2;
  32441. $recv(aStream)._lf();
  32442. $ctx2.sendIdx["lf"]=3;
  32443. $9=$recv(aClass)._asJavaScriptSource();
  32444. $ctx2.sendIdx["asJavaScriptSource"]=5;
  32445. $8=[$9,".comment=",$recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavaScriptSource(),";"];
  32446. $recv(aStream)._write_($8);
  32447. $ctx2.sendIdx["write:"]=3;
  32448. $recv(aStream)._lf();
  32449. $ctx2.sendIdx["lf"]=4;
  32450. return $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  32451. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  32452. }));
  32453. $recv(aStream)._lf();
  32454. return self;
  32455. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream})});
  32456. },
  32457. args: ["aClass", "aStream"],
  32458. 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",
  32459. referencedClasses: [],
  32460. pragmas: [],
  32461. messageSends: ["lf", "write:", "asJavaScriptSource", "name", "ifNil:ifNotNil:", "superclass", "instanceVariableNames", "category", "ifNotEmpty:", "comment", "crlfSanitized"]
  32462. }),
  32463. $globals.Exporter);
  32464. $core.addMethod(
  32465. $core.method({
  32466. selector: "exportMetaDefinitionOf:on:",
  32467. protocol: "output",
  32468. fn: function (aClass,aStream){
  32469. var self=this,$self=this;
  32470. return $core.withContext(function($ctx1) {
  32471. var $2,$1,$4,$3;
  32472. $recv(aStream)._lf();
  32473. $ctx1.sendIdx["lf"]=1;
  32474. $2=$recv(aClass)._theMetaClass();
  32475. $ctx1.sendIdx["theMetaClass"]=1;
  32476. $1=$recv($2)._instanceVariableNames();
  32477. $recv($1)._ifNotEmpty_((function(classIvars){
  32478. return $core.withContext(function($ctx2) {
  32479. $4=$recv($recv(aClass)._theMetaClass())._asJavaScriptSource();
  32480. $ctx2.sendIdx["asJavaScriptSource"]=1;
  32481. $3=["$core.setSlots(",$4,", ",$recv(classIvars)._asJavaScriptSource(),");"];
  32482. $recv(aStream)._write_($3);
  32483. return $recv(aStream)._lf();
  32484. }, function($ctx2) {$ctx2.fillBlock({classIvars:classIvars},$ctx1,1)});
  32485. }));
  32486. return self;
  32487. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream})});
  32488. },
  32489. args: ["aClass", "aStream"],
  32490. 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 ]",
  32491. referencedClasses: [],
  32492. pragmas: [],
  32493. messageSends: ["lf", "ifNotEmpty:", "instanceVariableNames", "theMetaClass", "write:", "asJavaScriptSource"]
  32494. }),
  32495. $globals.Exporter);
  32496. $core.addMethod(
  32497. $core.method({
  32498. selector: "exportMethod:on:",
  32499. protocol: "output",
  32500. fn: function (aMethod,aStream){
  32501. var self=this,$self=this;
  32502. return $core.withContext(function($ctx1) {
  32503. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13;
  32504. $recv(aStream)._write_("$core.addMethod(");
  32505. $ctx1.sendIdx["write:"]=1;
  32506. $recv(aStream)._lf();
  32507. $ctx1.sendIdx["lf"]=1;
  32508. $recv(aStream)._write_("$core.method({");
  32509. $ctx1.sendIdx["write:"]=2;
  32510. $recv(aStream)._lf();
  32511. $ctx1.sendIdx["lf"]=2;
  32512. $2=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  32513. $ctx1.sendIdx["asJavaScriptSource"]=1;
  32514. $1=["selector: ",$2,","];
  32515. $recv(aStream)._write_($1);
  32516. $ctx1.sendIdx["write:"]=3;
  32517. $recv(aStream)._lf();
  32518. $ctx1.sendIdx["lf"]=3;
  32519. $4=$recv($recv(aMethod)._protocol())._asJavaScriptSource();
  32520. $ctx1.sendIdx["asJavaScriptSource"]=2;
  32521. $3=["protocol: ",$4,","];
  32522. $recv(aStream)._write_($3);
  32523. $ctx1.sendIdx["write:"]=4;
  32524. $recv(aStream)._lf();
  32525. $ctx1.sendIdx["lf"]=4;
  32526. $recv(aStream)._write_(["fn: ",$recv($recv(aMethod)._fn())._compiledSource(),","]);
  32527. $ctx1.sendIdx["write:"]=5;
  32528. $recv(aStream)._lf();
  32529. $ctx1.sendIdx["lf"]=5;
  32530. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  32531. $ctx1.sendIdx["write:"]=6;
  32532. $recv(aStream)._lf();
  32533. $ctx1.sendIdx["lf"]=6;
  32534. $6=$recv($recv(aMethod)._arguments())._asJavaScriptSource();
  32535. $ctx1.sendIdx["asJavaScriptSource"]=3;
  32536. $5=["args: ",$6,","];
  32537. $recv(aStream)._write_($5);
  32538. $ctx1.sendIdx["write:"]=7;
  32539. $recv(aStream)._lf();
  32540. $ctx1.sendIdx["lf"]=7;
  32541. $8=$recv($recv(aMethod)._source())._asJavaScriptSource();
  32542. $ctx1.sendIdx["asJavaScriptSource"]=4;
  32543. $7=["source: ",$8,","];
  32544. $recv(aStream)._write_($7);
  32545. $ctx1.sendIdx["write:"]=8;
  32546. $recv(aStream)._lf();
  32547. $ctx1.sendIdx["lf"]=8;
  32548. $10=$recv($recv(aMethod)._referencedClasses())._asJavaScriptSource();
  32549. $ctx1.sendIdx["asJavaScriptSource"]=5;
  32550. $9=["referencedClasses: ",$10,","];
  32551. $recv(aStream)._write_($9);
  32552. $ctx1.sendIdx["write:"]=9;
  32553. $recv(aStream)._lf();
  32554. $ctx1.sendIdx["lf"]=9;
  32555. $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  32556. $ctx1.sendIdx["write:"]=10;
  32557. $recv(aStream)._lf();
  32558. $ctx1.sendIdx["lf"]=10;
  32559. $12=$recv($recv(aMethod)._basicPragmas())._asJavaScriptSource();
  32560. $ctx1.sendIdx["asJavaScriptSource"]=6;
  32561. $11=["pragmas: ",$12,","];
  32562. $recv(aStream)._write_($11);
  32563. $ctx1.sendIdx["write:"]=11;
  32564. $recv(aStream)._lf();
  32565. $ctx1.sendIdx["lf"]=11;
  32566. $14=$recv($recv(aMethod)._messageSends())._asJavaScriptSource();
  32567. $ctx1.sendIdx["asJavaScriptSource"]=7;
  32568. $13=["messageSends: ",$14];
  32569. $recv(aStream)._write_($13);
  32570. $ctx1.sendIdx["write:"]=12;
  32571. $recv(aStream)._lf();
  32572. $ctx1.sendIdx["lf"]=12;
  32573. $recv(aStream)._write_("}),");
  32574. $ctx1.sendIdx["write:"]=13;
  32575. $recv(aStream)._lf();
  32576. $ctx1.sendIdx["lf"]=13;
  32577. $recv(aStream)._write_([$recv($recv(aMethod)._origin())._asJavaScriptSource(),");"]);
  32578. $recv(aStream)._lf();
  32579. $ctx1.sendIdx["lf"]=14;
  32580. $recv(aStream)._lf();
  32581. return self;
  32582. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream})});
  32583. },
  32584. args: ["aMethod", "aStream"],
  32585. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09write: '$core.addMethod('; lf;\x0a\x09\x09write: '$core.method({'; lf;\x0a\x09\x09write: { 'selector: '. aMethod selector asJavaScriptSource. ',' }; lf;\x0a\x09\x09write: { 'protocol: '. aMethod protocol asJavaScriptSource. ',' }; lf;\x0a\x09\x09write: { 'fn: '. aMethod fn compiledSource. ',' }; lf;\x0a\x09\x09write: '//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);'; lf;\x0a\x09\x09write: { 'args: '. aMethod arguments asJavaScriptSource. ',' }; lf;\x0a\x09\x09write: { 'source: '. aMethod source asJavaScriptSource. ',' }; lf;\x0a\x09\x09write: { 'referencedClasses: '. aMethod referencedClasses asJavaScriptSource. ',' }; lf;\x0a\x09\x09write: '//>>excludeEnd(\x22ide\x22);'; lf;\x0a\x09\x09write: { 'pragmas: '. aMethod basicPragmas asJavaScriptSource. ',' }; lf;\x0a\x09\x09write: { 'messageSends: '. aMethod messageSends asJavaScriptSource }; lf;\x0a\x09\x09write: '}),'; lf;\x0a\x09\x09write: { aMethod origin asJavaScriptSource. ');' }; lf; lf",
  32586. referencedClasses: [],
  32587. pragmas: [],
  32588. messageSends: ["write:", "lf", "asJavaScriptSource", "selector", "protocol", "compiledSource", "fn", "arguments", "source", "referencedClasses", "basicPragmas", "messageSends", "origin"]
  32589. }),
  32590. $globals.Exporter);
  32591. $core.addMethod(
  32592. $core.method({
  32593. selector: "exportPackage:on:",
  32594. protocol: "output",
  32595. fn: function (aPackage,aStream){
  32596. var self=this,$self=this;
  32597. return $core.withContext(function($ctx1) {
  32598. $self._exportPackagePrologueOf_on_(aPackage,aStream);
  32599. $self._exportPackageDefinitionOf_on_(aPackage,aStream);
  32600. $self._exportPackageContextOf_on_(aPackage,aStream);
  32601. $self._exportPackageImportsOf_on_(aPackage,aStream);
  32602. $self._exportPackageTransportOf_on_(aPackage,aStream);
  32603. $recv($recv(aPackage)._sortedClasses())._do_((function(eachClass){
  32604. return $core.withContext(function($ctx2) {
  32605. return $recv(eachClass)._includingPossibleMetaDo_((function(each){
  32606. return $core.withContext(function($ctx3) {
  32607. return $self._exportBehavior_on_(each,aStream);
  32608. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  32609. }));
  32610. }, function($ctx2) {$ctx2.fillBlock({eachClass:eachClass},$ctx1,1)});
  32611. }));
  32612. $ctx1.sendIdx["do:"]=1;
  32613. $self._exportPackageTraitCompositionsOf_on_(aPackage,aStream);
  32614. $recv($self._extensionMethodsOfPackage_(aPackage))._do_((function(each){
  32615. return $core.withContext(function($ctx2) {
  32616. return $self._exportMethod_on_(each,aStream);
  32617. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  32618. }));
  32619. $self._exportPackageEpilogueOf_on_(aPackage,aStream);
  32620. return self;
  32621. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream})});
  32622. },
  32623. args: ["aPackage", "aStream"],
  32624. 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",
  32625. referencedClasses: [],
  32626. pragmas: [],
  32627. messageSends: ["exportPackagePrologueOf:on:", "exportPackageDefinitionOf:on:", "exportPackageContextOf:on:", "exportPackageImportsOf:on:", "exportPackageTransportOf:on:", "do:", "sortedClasses", "includingPossibleMetaDo:", "exportBehavior:on:", "exportPackageTraitCompositionsOf:on:", "extensionMethodsOfPackage:", "exportMethod:on:", "exportPackageEpilogueOf:on:"]
  32628. }),
  32629. $globals.Exporter);
  32630. $core.addMethod(
  32631. $core.method({
  32632. selector: "exportPackageBodyBlockPrologueOf:on:",
  32633. protocol: "output",
  32634. fn: function (aPackage,aStream){
  32635. var self=this,$self=this;
  32636. return $core.withContext(function($ctx1) {
  32637. $recv(aStream)._write_("var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;");
  32638. $recv(aStream)._lf();
  32639. return self;
  32640. }, function($ctx1) {$ctx1.fill(self,"exportPackageBodyBlockPrologueOf:on:",{aPackage:aPackage,aStream:aStream})});
  32641. },
  32642. args: ["aPackage", "aStream"],
  32643. 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",
  32644. referencedClasses: [],
  32645. pragmas: [],
  32646. messageSends: ["write:", "lf"]
  32647. }),
  32648. $globals.Exporter);
  32649. $core.addMethod(
  32650. $core.method({
  32651. selector: "exportPackageContextOf:on:",
  32652. protocol: "output",
  32653. fn: function (aPackage,aStream){
  32654. var self=this,$self=this;
  32655. return $core.withContext(function($ctx1) {
  32656. $recv(aStream)._write_("$pkg.innerEval = function (expr) { return eval(expr); };");
  32657. $recv(aStream)._lf();
  32658. return self;
  32659. }, function($ctx1) {$ctx1.fill(self,"exportPackageContextOf:on:",{aPackage:aPackage,aStream:aStream})});
  32660. },
  32661. args: ["aPackage", "aStream"],
  32662. source: "exportPackageContextOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: '$pkg.innerEval = function (expr) { return eval(expr); };';\x0a\x09\x09lf",
  32663. referencedClasses: [],
  32664. pragmas: [],
  32665. messageSends: ["write:", "lf"]
  32666. }),
  32667. $globals.Exporter);
  32668. $core.addMethod(
  32669. $core.method({
  32670. selector: "exportPackageDefinitionOf:on:",
  32671. protocol: "output",
  32672. fn: function (aPackage,aStream){
  32673. var self=this,$self=this;
  32674. return $core.withContext(function($ctx1) {
  32675. $recv(aStream)._write_(["var $pkg = $core.addPackage(",$recv($recv(aPackage)._name())._asJavaScriptSource(),");"]);
  32676. $recv(aStream)._lf();
  32677. return self;
  32678. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream})});
  32679. },
  32680. args: ["aPackage", "aStream"],
  32681. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: { 'var $pkg = $core.addPackage('. aPackage name asJavaScriptSource. ');' };\x0a\x09\x09lf",
  32682. referencedClasses: [],
  32683. pragmas: [],
  32684. messageSends: ["write:", "asJavaScriptSource", "name", "lf"]
  32685. }),
  32686. $globals.Exporter);
  32687. $core.addMethod(
  32688. $core.method({
  32689. selector: "exportPackageEpilogueOf:on:",
  32690. protocol: "output",
  32691. fn: function (aPackage,aStream){
  32692. var self=this,$self=this;
  32693. return $core.withContext(function($ctx1) {
  32694. $self._subclassResponsibility();
  32695. return self;
  32696. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream})});
  32697. },
  32698. args: ["aPackage", "aStream"],
  32699. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  32700. referencedClasses: [],
  32701. pragmas: [],
  32702. messageSends: ["subclassResponsibility"]
  32703. }),
  32704. $globals.Exporter);
  32705. $core.addMethod(
  32706. $core.method({
  32707. selector: "exportPackageImportsOf:on:",
  32708. protocol: "output",
  32709. fn: function (aPackage,aStream){
  32710. var self=this,$self=this;
  32711. return $core.withContext(function($ctx1) {
  32712. $recv($recv(aPackage)._importsAsJson())._ifNotEmpty_((function(imports){
  32713. return $core.withContext(function($ctx2) {
  32714. $recv(aStream)._write_(["$pkg.imports = ",$recv(imports)._asJavaScriptSource(),";"]);
  32715. return $recv(aStream)._lf();
  32716. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  32717. }));
  32718. return self;
  32719. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream})});
  32720. },
  32721. args: ["aPackage", "aStream"],
  32722. 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 ]",
  32723. referencedClasses: [],
  32724. pragmas: [],
  32725. messageSends: ["ifNotEmpty:", "importsAsJson", "write:", "asJavaScriptSource", "lf"]
  32726. }),
  32727. $globals.Exporter);
  32728. $core.addMethod(
  32729. $core.method({
  32730. selector: "exportPackagePrologueOf:on:",
  32731. protocol: "output",
  32732. fn: function (aPackage,aStream){
  32733. var self=this,$self=this;
  32734. return $core.withContext(function($ctx1) {
  32735. $self._subclassResponsibility();
  32736. return self;
  32737. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream})});
  32738. },
  32739. args: ["aPackage", "aStream"],
  32740. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  32741. referencedClasses: [],
  32742. pragmas: [],
  32743. messageSends: ["subclassResponsibility"]
  32744. }),
  32745. $globals.Exporter);
  32746. $core.addMethod(
  32747. $core.method({
  32748. selector: "exportPackageTraitCompositionsOf:on:",
  32749. protocol: "output",
  32750. fn: function (aPackage,aStream){
  32751. var self=this,$self=this;
  32752. return $core.withContext(function($ctx1) {
  32753. $recv($recv(aPackage)._traitCompositions())._ifNotEmpty_((function(traitCompositions){
  32754. return $core.withContext(function($ctx2) {
  32755. $recv(traitCompositions)._keysAndValuesDo_((function(key,value){
  32756. return $core.withContext(function($ctx3) {
  32757. return $self._exportTraitComposition_of_on_(value,key,aStream);
  32758. }, function($ctx3) {$ctx3.fillBlock({key:key,value:value},$ctx2,2)});
  32759. }));
  32760. return $recv(aStream)._lf();
  32761. }, function($ctx2) {$ctx2.fillBlock({traitCompositions:traitCompositions},$ctx1,1)});
  32762. }));
  32763. return self;
  32764. }, function($ctx1) {$ctx1.fill(self,"exportPackageTraitCompositionsOf:on:",{aPackage:aPackage,aStream:aStream})});
  32765. },
  32766. args: ["aPackage", "aStream"],
  32767. 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 ]",
  32768. referencedClasses: [],
  32769. pragmas: [],
  32770. messageSends: ["ifNotEmpty:", "traitCompositions", "keysAndValuesDo:", "exportTraitComposition:of:on:", "lf"]
  32771. }),
  32772. $globals.Exporter);
  32773. $core.addMethod(
  32774. $core.method({
  32775. selector: "exportPackageTransportOf:on:",
  32776. protocol: "output",
  32777. fn: function (aPackage,aStream){
  32778. var self=this,$self=this;
  32779. return $core.withContext(function($ctx1) {
  32780. $recv(aStream)._write_(["$pkg.transport = ",$recv($recv(aPackage)._transport())._asJSONString(),";"]);
  32781. $recv(aStream)._lf();
  32782. return self;
  32783. }, function($ctx1) {$ctx1.fill(self,"exportPackageTransportOf:on:",{aPackage:aPackage,aStream:aStream})});
  32784. },
  32785. args: ["aPackage", "aStream"],
  32786. source: "exportPackageTransportOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: { '$pkg.transport = '. aPackage transport asJSONString. ';' };\x0a\x09\x09lf",
  32787. referencedClasses: [],
  32788. pragmas: [],
  32789. messageSends: ["write:", "asJSONString", "transport", "lf"]
  32790. }),
  32791. $globals.Exporter);
  32792. $core.addMethod(
  32793. $core.method({
  32794. selector: "exportTraitComposition:of:on:",
  32795. protocol: "output",
  32796. fn: function (aTraitComposition,aBehavior,aStream){
  32797. var self=this,$self=this;
  32798. return $core.withContext(function($ctx1) {
  32799. var $2,$1;
  32800. $2=$recv(aTraitComposition)._asJavaScriptSource();
  32801. $ctx1.sendIdx["asJavaScriptSource"]=1;
  32802. $1=["$core.setTraitComposition(",$2,", ",$recv(aBehavior)._asJavaScriptSource(),");"];
  32803. $recv(aStream)._write_($1);
  32804. $recv(aStream)._lf();
  32805. return self;
  32806. }, function($ctx1) {$ctx1.fill(self,"exportTraitComposition:of:on:",{aTraitComposition:aTraitComposition,aBehavior:aBehavior,aStream:aStream})});
  32807. },
  32808. args: ["aTraitComposition", "aBehavior", "aStream"],
  32809. 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",
  32810. referencedClasses: [],
  32811. pragmas: [],
  32812. messageSends: ["write:", "asJavaScriptSource", "lf"]
  32813. }),
  32814. $globals.Exporter);
  32815. $core.addMethod(
  32816. $core.method({
  32817. selector: "exportTraitDefinitionOf:on:",
  32818. protocol: "output",
  32819. fn: function (aClass,aStream){
  32820. var self=this,$self=this;
  32821. return $core.withContext(function($ctx1) {
  32822. var $2,$3,$1,$4,$6,$5;
  32823. $recv(aStream)._lf();
  32824. $ctx1.sendIdx["lf"]=1;
  32825. $2=$recv($recv(aClass)._name())._asJavaScriptSource();
  32826. $ctx1.sendIdx["asJavaScriptSource"]=1;
  32827. $3=$recv($recv(aClass)._category())._asJavaScriptSource();
  32828. $ctx1.sendIdx["asJavaScriptSource"]=2;
  32829. $1=["$core.addTrait(",$2,", ",$3,");"];
  32830. $recv(aStream)._write_($1);
  32831. $ctx1.sendIdx["write:"]=1;
  32832. $4=$recv(aClass)._comment();
  32833. $ctx1.sendIdx["comment"]=1;
  32834. $recv($4)._ifNotEmpty_((function(){
  32835. return $core.withContext(function($ctx2) {
  32836. $recv(aStream)._lf();
  32837. $ctx2.sendIdx["lf"]=2;
  32838. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  32839. $ctx2.sendIdx["write:"]=2;
  32840. $recv(aStream)._lf();
  32841. $ctx2.sendIdx["lf"]=3;
  32842. $6=$recv(aClass)._asJavaScriptSource();
  32843. $ctx2.sendIdx["asJavaScriptSource"]=3;
  32844. $5=[$6,".comment=",$recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavaScriptSource(),";"];
  32845. $recv(aStream)._write_($5);
  32846. $ctx2.sendIdx["write:"]=3;
  32847. $recv(aStream)._lf();
  32848. $ctx2.sendIdx["lf"]=4;
  32849. return $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  32850. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32851. }));
  32852. $recv(aStream)._lf();
  32853. return self;
  32854. }, function($ctx1) {$ctx1.fill(self,"exportTraitDefinitionOf:on:",{aClass:aClass,aStream:aStream})});
  32855. },
  32856. args: ["aClass", "aStream"],
  32857. 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",
  32858. referencedClasses: [],
  32859. pragmas: [],
  32860. messageSends: ["lf", "write:", "asJavaScriptSource", "name", "category", "ifNotEmpty:", "comment", "crlfSanitized"]
  32861. }),
  32862. $globals.Exporter);
  32863. $core.addMethod(
  32864. $core.method({
  32865. selector: "ownMethodsOfClass:",
  32866. protocol: "accessing",
  32867. fn: function (aClass){
  32868. var self=this,$self=this;
  32869. return $core.withContext(function($ctx1) {
  32870. var $1;
  32871. return $recv($recv($recv($recv(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  32872. return $core.withContext(function($ctx2) {
  32873. $1=$recv(a)._selector();
  32874. $ctx2.sendIdx["selector"]=1;
  32875. return $recv($1).__lt_eq($recv(b)._selector());
  32876. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  32877. })))._reject_((function(each){
  32878. return $core.withContext(function($ctx2) {
  32879. return $recv($recv(each)._protocol())._match_("^\x5c*");
  32880. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  32881. }));
  32882. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfClass:",{aClass:aClass})});
  32883. },
  32884. args: ["aClass"],
  32885. 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*') ]",
  32886. referencedClasses: [],
  32887. pragmas: [],
  32888. messageSends: ["reject:", "sorted:", "values", "methodDictionary", "<=", "selector", "match:", "protocol"]
  32889. }),
  32890. $globals.Exporter);
  32891. $core.addMethod(
  32892. $core.method({
  32893. selector: "ownMethodsOfMetaClass:",
  32894. protocol: "accessing",
  32895. fn: function (aClass){
  32896. var self=this,$self=this;
  32897. return $core.withContext(function($ctx1) {
  32898. return $self._ownMethodsOfClass_($recv(aClass)._theMetaClass());
  32899. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfMetaClass:",{aClass:aClass})});
  32900. },
  32901. args: ["aClass"],
  32902. source: "ownMethodsOfMetaClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^ self ownMethodsOfClass: aClass theMetaClass",
  32903. referencedClasses: [],
  32904. pragmas: [],
  32905. messageSends: ["ownMethodsOfClass:", "theMetaClass"]
  32906. }),
  32907. $globals.Exporter);
  32908. $core.addClass("AmdExporter", $globals.Exporter, ["namespace"], "Platform-ImportExport");
  32909. $globals.AmdExporter.comment="I am used to export Packages in an AMD (Asynchronous Module Definition) JavaScript format.";
  32910. $core.addMethod(
  32911. $core.method({
  32912. selector: "amdNamesOfPackages:",
  32913. protocol: "private",
  32914. fn: function (anArray){
  32915. var self=this,$self=this;
  32916. return $core.withContext(function($ctx1) {
  32917. var $1;
  32918. return $recv($recv(anArray)._select_((function(each){
  32919. return $core.withContext(function($ctx2) {
  32920. $1=$self._amdNamespaceOfPackage_(each);
  32921. $ctx2.sendIdx["amdNamespaceOfPackage:"]=1;
  32922. return $recv($1)._notNil();
  32923. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32924. })))._collect_((function(each){
  32925. return $core.withContext(function($ctx2) {
  32926. return $recv($recv($self._amdNamespaceOfPackage_(each)).__comma("/")).__comma($recv(each)._name());
  32927. $ctx2.sendIdx[","]=1;
  32928. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  32929. }));
  32930. }, function($ctx1) {$ctx1.fill(self,"amdNamesOfPackages:",{anArray:anArray})});
  32931. },
  32932. args: ["anArray"],
  32933. source: "amdNamesOfPackages: anArray\x0a\x09^ (anArray\x0a\x09\x09select: [ :each | (self amdNamespaceOfPackage: each) notNil ])\x0a\x09\x09collect: [ :each | (self amdNamespaceOfPackage: each), '/', each name ]",
  32934. referencedClasses: [],
  32935. pragmas: [],
  32936. messageSends: ["collect:", "select:", "notNil", "amdNamespaceOfPackage:", ",", "name"]
  32937. }),
  32938. $globals.AmdExporter);
  32939. $core.addMethod(
  32940. $core.method({
  32941. selector: "amdNamespaceOfPackage:",
  32942. protocol: "private",
  32943. fn: function (aPackage){
  32944. var self=this,$self=this;
  32945. return $core.withContext(function($ctx1) {
  32946. var $3,$2,$1;
  32947. $3=$recv(aPackage)._transport();
  32948. $ctx1.sendIdx["transport"]=1;
  32949. $2=$recv($3)._type();
  32950. $1=$recv($2).__eq("amd");
  32951. if($core.assert($1)){
  32952. return $recv($recv(aPackage)._transport())._namespace();
  32953. } else {
  32954. return nil;
  32955. }
  32956. }, function($ctx1) {$ctx1.fill(self,"amdNamespaceOfPackage:",{aPackage:aPackage})});
  32957. },
  32958. args: ["aPackage"],
  32959. source: "amdNamespaceOfPackage: aPackage\x0a\x09^ (aPackage transport type = 'amd')\x0a\x09\x09ifTrue: [ aPackage transport namespace ]\x0a\x09\x09ifFalse: [ nil ]",
  32960. referencedClasses: [],
  32961. pragmas: [],
  32962. messageSends: ["ifTrue:ifFalse:", "=", "type", "transport", "namespace"]
  32963. }),
  32964. $globals.AmdExporter);
  32965. $core.addMethod(
  32966. $core.method({
  32967. selector: "exportPackageEpilogueOf:on:",
  32968. protocol: "output",
  32969. fn: function (aPackage,aStream){
  32970. var self=this,$self=this;
  32971. return $core.withContext(function($ctx1) {
  32972. $recv(aStream)._write_("});");
  32973. $recv(aStream)._lf();
  32974. return self;
  32975. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream})});
  32976. },
  32977. args: ["aPackage", "aStream"],
  32978. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: '});';\x0a\x09\x09lf",
  32979. referencedClasses: [],
  32980. pragmas: [],
  32981. messageSends: ["write:", "lf"]
  32982. }),
  32983. $globals.AmdExporter);
  32984. $core.addMethod(
  32985. $core.method({
  32986. selector: "exportPackageImportsOf:on:",
  32987. protocol: "output",
  32988. fn: function (aPackage,aStream){
  32989. var self=this,$self=this;
  32990. var importsForOutput,pragmaStart,pragmaEnd;
  32991. return $core.withContext(function($ctx1) {
  32992. var $1,$2,$4,$3,$6,$10,$9,$11,$8,$7,$12,$5;
  32993. $1=$recv($globals.String)._lf();
  32994. $ctx1.sendIdx["lf"]=1;
  32995. pragmaStart="//>>excludeStart(\x22imports\x22, pragmas.excludeImports);".__comma($1);
  32996. $ctx1.sendIdx[","]=1;
  32997. $2=$recv($globals.String)._lf();
  32998. $ctx1.sendIdx["lf"]=2;
  32999. pragmaEnd="//>>excludeEnd(\x22imports\x22);".__comma($2);
  33000. $ctx1.sendIdx[","]=2;
  33001. (
  33002. $ctx1.supercall = true,
  33003. ($globals.AmdExporter.superclass||$boot.nilAsClass).fn.prototype._exportPackageImportsOf_on_.apply($self, [aPackage,aStream]));
  33004. $ctx1.supercall = false;
  33005. importsForOutput=$self._importsForOutput_(aPackage);
  33006. $recv($recv(importsForOutput)._value())._ifNotEmpty_((function(imports){
  33007. var vars;
  33008. return $core.withContext(function($ctx2) {
  33009. $recv(aStream)._write_(pragmaStart);
  33010. $ctx2.sendIdx["write:"]=1;
  33011. vars=$recv(importsForOutput)._key();
  33012. $recv(vars)._ifNotEmpty_((function(){
  33013. return $core.withContext(function($ctx3) {
  33014. $4=","._join_(vars);
  33015. $ctx3.sendIdx["join:"]=1;
  33016. $3=["var ",$4,";"];
  33017. $recv(aStream)._write_($3);
  33018. $ctx3.sendIdx["write:"]=2;
  33019. return $recv(aStream)._lf();
  33020. $ctx3.sendIdx["lf"]=3;
  33021. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  33022. }));
  33023. $6=$recv(imports)._asJavaScriptSource();
  33024. $10=$recv(vars)._size();
  33025. $ctx2.sendIdx["size"]=1;
  33026. $9=(1)._to_($10);
  33027. $ctx2.sendIdx["to:"]=1;
  33028. $8=$recv($9)._collect_((function(each){
  33029. return $core.withContext(function($ctx3) {
  33030. $11=$recv(each)._asString();
  33031. $ctx3.sendIdx["asString"]=1;
  33032. return "$".__comma($11);
  33033. $ctx3.sendIdx[","]=3;
  33034. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)});
  33035. }));
  33036. $ctx2.sendIdx["collect:"]=1;
  33037. $7=","._join_($8);
  33038. $5=["$pkg.isReady = new Promise(function (resolve, reject) { requirejs(",$6,", function (",$7,") {",$recv((1)._to_($recv(vars)._size()))._collect_((function(each){
  33039. return $core.withContext(function($ctx3) {
  33040. $12=$recv($recv($recv(vars)._at_(each)).__comma("=$")).__comma($recv(each)._asString());
  33041. $ctx3.sendIdx[","]=5;
  33042. return $recv($12).__comma("; ");
  33043. $ctx3.sendIdx[","]=4;
  33044. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,4)});
  33045. })),"resolve();}, reject); });"];
  33046. $recv(aStream)._write_($5);
  33047. $ctx2.sendIdx["write:"]=3;
  33048. $recv(aStream)._lf();
  33049. return $recv(aStream)._write_(pragmaEnd);
  33050. }, function($ctx2) {$ctx2.fillBlock({imports:imports,vars:vars},$ctx1,1)});
  33051. }));
  33052. $ctx1.sendIdx["ifNotEmpty:"]=1;
  33053. return self;
  33054. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream,importsForOutput:importsForOutput,pragmaStart:pragmaStart,pragmaEnd:pragmaEnd})});
  33055. },
  33056. args: ["aPackage", "aStream"],
  33057. 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 ]",
  33058. referencedClasses: ["String"],
  33059. pragmas: [],
  33060. messageSends: [",", "lf", "exportPackageImportsOf:on:", "importsForOutput:", "ifNotEmpty:", "value", "write:", "key", "join:", "asJavaScriptSource", "collect:", "to:", "size", "asString", "at:"]
  33061. }),
  33062. $globals.AmdExporter);
  33063. $core.addMethod(
  33064. $core.method({
  33065. selector: "exportPackagePrologueOf:on:",
  33066. protocol: "output",
  33067. fn: function (aPackage,aStream){
  33068. var self=this,$self=this;
  33069. var loadDependencies,pragmaStart,pragmaEnd;
  33070. return $core.withContext(function($ctx1) {
  33071. var $1,$2;
  33072. $1=$recv($globals.String)._lf();
  33073. $ctx1.sendIdx["lf"]=1;
  33074. pragmaStart="//>>excludeStart(\x22imports\x22, pragmas.excludeImports);".__comma($1);
  33075. $ctx1.sendIdx[","]=1;
  33076. $2=$recv($globals.String)._lf();
  33077. $ctx1.sendIdx["lf"]=2;
  33078. pragmaEnd="//>>excludeEnd(\x22imports\x22);".__comma($2);
  33079. $ctx1.sendIdx[","]=2;
  33080. loadDependencies=$self._amdNamesOfPackages_($recv(aPackage)._loadDependencies());
  33081. $recv(aStream)._write_(["define(",$recv(["amber/boot", "require"].__comma($recv($recv(loadDependencies)._asArray())._sorted()))._asJavaScriptSource(),", function($boot,requirejs){\x22use strict\x22;"]);
  33082. $recv(aStream)._lf();
  33083. $self._exportPackageBodyBlockPrologueOf_on_(aPackage,aStream);
  33084. return self;
  33085. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream,loadDependencies:loadDependencies,pragmaStart:pragmaStart,pragmaEnd:pragmaEnd})});
  33086. },
  33087. args: ["aPackage", "aStream"],
  33088. 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",
  33089. referencedClasses: ["String"],
  33090. pragmas: [],
  33091. messageSends: [",", "lf", "amdNamesOfPackages:", "loadDependencies", "write:", "asJavaScriptSource", "sorted", "asArray", "exportPackageBodyBlockPrologueOf:on:"]
  33092. }),
  33093. $globals.AmdExporter);
  33094. $core.addMethod(
  33095. $core.method({
  33096. selector: "importsForOutput:",
  33097. protocol: "private",
  33098. fn: function (aPackage){
  33099. var self=this,$self=this;
  33100. var namedImports,anonImports,importVarNames;
  33101. return $core.withContext(function($ctx1) {
  33102. var $1;
  33103. namedImports=[];
  33104. anonImports=[];
  33105. importVarNames=[];
  33106. $recv($recv(aPackage)._imports())._do_((function(each){
  33107. return $core.withContext(function($ctx2) {
  33108. $1=$recv(each)._isString();
  33109. if($core.assert($1)){
  33110. return $recv(anonImports)._add_(each);
  33111. $ctx2.sendIdx["add:"]=1;
  33112. } else {
  33113. $recv(namedImports)._add_($recv(each)._value());
  33114. $ctx2.sendIdx["add:"]=2;
  33115. return $recv(importVarNames)._add_($recv(each)._key());
  33116. }
  33117. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33118. }));
  33119. return $recv(importVarNames).__minus_gt($recv(namedImports).__comma(anonImports));
  33120. }, function($ctx1) {$ctx1.fill(self,"importsForOutput:",{aPackage:aPackage,namedImports:namedImports,anonImports:anonImports,importVarNames:importVarNames})});
  33121. },
  33122. args: ["aPackage"],
  33123. 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)",
  33124. referencedClasses: [],
  33125. pragmas: [],
  33126. messageSends: ["do:", "imports", "ifTrue:ifFalse:", "isString", "add:", "value", "key", "->", ","]
  33127. }),
  33128. $globals.AmdExporter);
  33129. $core.addClass("ChunkParser", $globals.Object, ["stream", "last"], "Platform-ImportExport");
  33130. $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";
  33131. $core.addMethod(
  33132. $core.method({
  33133. selector: "last",
  33134. protocol: "accessing",
  33135. fn: function (){
  33136. var self=this,$self=this;
  33137. return $self.last;
  33138. },
  33139. args: [],
  33140. source: "last\x0a\x09^ last",
  33141. referencedClasses: [],
  33142. pragmas: [],
  33143. messageSends: []
  33144. }),
  33145. $globals.ChunkParser);
  33146. $core.addMethod(
  33147. $core.method({
  33148. selector: "nextChunk",
  33149. protocol: "reading",
  33150. fn: function (){
  33151. var self=this,$self=this;
  33152. var char,result,chunk;
  33153. return $core.withContext(function($ctx1) {
  33154. var $1,$2,$3,$4;
  33155. var $early={};
  33156. try {
  33157. result=""._writeStream();
  33158. $recv((function(){
  33159. return $core.withContext(function($ctx2) {
  33160. char=$recv($self.stream)._next();
  33161. $ctx2.sendIdx["next"]=1;
  33162. return $recv(char)._notNil();
  33163. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33164. }))._whileTrue_((function(){
  33165. return $core.withContext(function($ctx2) {
  33166. $1=$recv(char).__eq("!");
  33167. $ctx2.sendIdx["="]=1;
  33168. if($core.assert($1)){
  33169. $2=$recv($recv($self.stream)._peek()).__eq("!");
  33170. if($core.assert($2)){
  33171. $recv($self.stream)._next();
  33172. } else {
  33173. $self.last=$recv($recv(result)._contents())._trimBoth();
  33174. $3=$self.last;
  33175. throw $early=[$3];
  33176. }
  33177. }
  33178. return $recv(result)._nextPut_(char);
  33179. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  33180. }));
  33181. $self.last=nil;
  33182. $4=$self.last;
  33183. return $4;
  33184. }
  33185. catch(e) {if(e===$early)return e[0]; throw e}
  33186. }, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk})});
  33187. },
  33188. args: [],
  33189. 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",
  33190. referencedClasses: [],
  33191. pragmas: [],
  33192. messageSends: ["writeStream", "whileTrue:", "next", "notNil", "ifTrue:", "=", "ifTrue:ifFalse:", "peek", "trimBoth", "contents", "nextPut:"]
  33193. }),
  33194. $globals.ChunkParser);
  33195. $core.addMethod(
  33196. $core.method({
  33197. selector: "stream:",
  33198. protocol: "accessing",
  33199. fn: function (aStream){
  33200. var self=this,$self=this;
  33201. $self.stream=aStream;
  33202. return self;
  33203. },
  33204. args: ["aStream"],
  33205. source: "stream: aStream\x0a\x09stream := aStream",
  33206. referencedClasses: [],
  33207. pragmas: [],
  33208. messageSends: []
  33209. }),
  33210. $globals.ChunkParser);
  33211. $core.addMethod(
  33212. $core.method({
  33213. selector: "on:",
  33214. protocol: "instance creation",
  33215. fn: function (aStream){
  33216. var self=this,$self=this;
  33217. return $core.withContext(function($ctx1) {
  33218. return $recv($self._new())._stream_(aStream);
  33219. }, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream})});
  33220. },
  33221. args: ["aStream"],
  33222. source: "on: aStream\x0a\x09^ self new stream: aStream",
  33223. referencedClasses: [],
  33224. pragmas: [],
  33225. messageSends: ["stream:", "new"]
  33226. }),
  33227. $globals.ChunkParser.a$cls);
  33228. $core.addClass("ClassCommentReader", $globals.Object, ["class"], "Platform-ImportExport");
  33229. $globals.ClassCommentReader.comment="I provide a mechanism for retrieving class comments stored on a file.\x0a\x0aSee also `ClassCategoryReader`.";
  33230. $core.addMethod(
  33231. $core.method({
  33232. selector: "class:",
  33233. protocol: "accessing",
  33234. fn: function (aClass){
  33235. var self=this,$self=this;
  33236. $self.class=aClass;
  33237. return self;
  33238. },
  33239. args: ["aClass"],
  33240. source: "class: aClass\x0a\x09class := aClass",
  33241. referencedClasses: [],
  33242. pragmas: [],
  33243. messageSends: []
  33244. }),
  33245. $globals.ClassCommentReader);
  33246. $core.addMethod(
  33247. $core.method({
  33248. selector: "initialize",
  33249. protocol: "initialization",
  33250. fn: function (){
  33251. var self=this,$self=this;
  33252. return $core.withContext(function($ctx1) {
  33253. (
  33254. $ctx1.supercall = true,
  33255. ($globals.ClassCommentReader.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  33256. $ctx1.supercall = false;
  33257. return self;
  33258. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  33259. },
  33260. args: [],
  33261. source: "initialize\x0a\x09super initialize.",
  33262. referencedClasses: [],
  33263. pragmas: [],
  33264. messageSends: ["initialize"]
  33265. }),
  33266. $globals.ClassCommentReader);
  33267. $core.addMethod(
  33268. $core.method({
  33269. selector: "scanFrom:",
  33270. protocol: "fileIn",
  33271. fn: function (aChunkParser){
  33272. var self=this,$self=this;
  33273. var chunk;
  33274. return $core.withContext(function($ctx1) {
  33275. chunk=$recv(aChunkParser)._nextChunk();
  33276. $recv(chunk)._ifNotEmpty_((function(){
  33277. return $core.withContext(function($ctx2) {
  33278. return $self._setComment_(chunk);
  33279. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33280. }));
  33281. return self;
  33282. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk})});
  33283. },
  33284. args: ["aChunkParser"],
  33285. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk ifNotEmpty: [\x0a\x09\x09self setComment: chunk ].",
  33286. referencedClasses: [],
  33287. pragmas: [],
  33288. messageSends: ["nextChunk", "ifNotEmpty:", "setComment:"]
  33289. }),
  33290. $globals.ClassCommentReader);
  33291. $core.addMethod(
  33292. $core.method({
  33293. selector: "setComment:",
  33294. protocol: "private",
  33295. fn: function (aString){
  33296. var self=this,$self=this;
  33297. return $core.withContext(function($ctx1) {
  33298. $recv($self.class)._comment_(aString);
  33299. return self;
  33300. }, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString})});
  33301. },
  33302. args: ["aString"],
  33303. source: "setComment: aString\x0a\x09class comment: aString",
  33304. referencedClasses: [],
  33305. pragmas: [],
  33306. messageSends: ["comment:"]
  33307. }),
  33308. $globals.ClassCommentReader);
  33309. $core.addClass("ClassProtocolReader", $globals.Object, ["class", "category"], "Platform-ImportExport");
  33310. $globals.ClassProtocolReader.comment="I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format.";
  33311. $core.addMethod(
  33312. $core.method({
  33313. selector: "class:category:",
  33314. protocol: "accessing",
  33315. fn: function (aClass,aString){
  33316. var self=this,$self=this;
  33317. $self.class=aClass;
  33318. $self.category=aString;
  33319. return self;
  33320. },
  33321. args: ["aClass", "aString"],
  33322. source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
  33323. referencedClasses: [],
  33324. pragmas: [],
  33325. messageSends: []
  33326. }),
  33327. $globals.ClassProtocolReader);
  33328. $core.addMethod(
  33329. $core.method({
  33330. selector: "compileMethod:",
  33331. protocol: "private",
  33332. fn: function (aString){
  33333. var self=this,$self=this;
  33334. return $core.withContext(function($ctx1) {
  33335. $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,$self.class,$self.category);
  33336. return self;
  33337. }, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString})});
  33338. },
  33339. args: ["aString"],
  33340. source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class protocol: category",
  33341. referencedClasses: ["Compiler"],
  33342. pragmas: [],
  33343. messageSends: ["install:forClass:protocol:", "new"]
  33344. }),
  33345. $globals.ClassProtocolReader);
  33346. $core.addMethod(
  33347. $core.method({
  33348. selector: "initialize",
  33349. protocol: "initialization",
  33350. fn: function (){
  33351. var self=this,$self=this;
  33352. return $core.withContext(function($ctx1) {
  33353. (
  33354. $ctx1.supercall = true,
  33355. ($globals.ClassProtocolReader.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  33356. $ctx1.supercall = false;
  33357. return self;
  33358. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  33359. },
  33360. args: [],
  33361. source: "initialize\x0a\x09super initialize.",
  33362. referencedClasses: [],
  33363. pragmas: [],
  33364. messageSends: ["initialize"]
  33365. }),
  33366. $globals.ClassProtocolReader);
  33367. $core.addMethod(
  33368. $core.method({
  33369. selector: "scanFrom:",
  33370. protocol: "fileIn",
  33371. fn: function (aChunkParser){
  33372. var self=this,$self=this;
  33373. var chunk;
  33374. return $core.withContext(function($ctx1) {
  33375. $recv((function(){
  33376. return $core.withContext(function($ctx2) {
  33377. chunk=$recv(aChunkParser)._nextChunk();
  33378. return $recv(chunk)._isEmpty();
  33379. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33380. }))._whileFalse_((function(){
  33381. return $core.withContext(function($ctx2) {
  33382. return $self._compileMethod_(chunk);
  33383. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  33384. }));
  33385. return self;
  33386. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk})});
  33387. },
  33388. args: ["aChunkParser"],
  33389. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09[ chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ] whileFalse: [\x0a\x09\x09self compileMethod: chunk ]",
  33390. referencedClasses: [],
  33391. pragmas: [],
  33392. messageSends: ["whileFalse:", "nextChunk", "isEmpty", "compileMethod:"]
  33393. }),
  33394. $globals.ClassProtocolReader);
  33395. $core.addClass("ExportMethodProtocol", $globals.Object, ["name", "theClass"], "Platform-ImportExport");
  33396. $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.";
  33397. $core.addMethod(
  33398. $core.method({
  33399. selector: "methods",
  33400. protocol: "accessing",
  33401. fn: function (){
  33402. var self=this,$self=this;
  33403. return $core.withContext(function($ctx1) {
  33404. var $1;
  33405. return $recv($recv($self._theClass())._methodsInProtocol_($self._name()))._sorted_((function(a,b){
  33406. return $core.withContext(function($ctx2) {
  33407. $1=$recv(a)._selector();
  33408. $ctx2.sendIdx["selector"]=1;
  33409. return $recv($1).__lt_eq($recv(b)._selector());
  33410. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  33411. }));
  33412. }, function($ctx1) {$ctx1.fill(self,"methods",{})});
  33413. },
  33414. args: [],
  33415. source: "methods\x0a\x09^ (self theClass methodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  33416. referencedClasses: [],
  33417. pragmas: [],
  33418. messageSends: ["sorted:", "methodsInProtocol:", "theClass", "name", "<=", "selector"]
  33419. }),
  33420. $globals.ExportMethodProtocol);
  33421. $core.addMethod(
  33422. $core.method({
  33423. selector: "name",
  33424. protocol: "accessing",
  33425. fn: function (){
  33426. var self=this,$self=this;
  33427. return $self.name;
  33428. },
  33429. args: [],
  33430. source: "name\x0a\x09^ name",
  33431. referencedClasses: [],
  33432. pragmas: [],
  33433. messageSends: []
  33434. }),
  33435. $globals.ExportMethodProtocol);
  33436. $core.addMethod(
  33437. $core.method({
  33438. selector: "name:",
  33439. protocol: "accessing",
  33440. fn: function (aString){
  33441. var self=this,$self=this;
  33442. $self.name=aString;
  33443. return self;
  33444. },
  33445. args: ["aString"],
  33446. source: "name: aString\x0a\x09name := aString",
  33447. referencedClasses: [],
  33448. pragmas: [],
  33449. messageSends: []
  33450. }),
  33451. $globals.ExportMethodProtocol);
  33452. $core.addMethod(
  33453. $core.method({
  33454. selector: "ownMethods",
  33455. protocol: "accessing",
  33456. fn: function (){
  33457. var self=this,$self=this;
  33458. return $core.withContext(function($ctx1) {
  33459. var $1;
  33460. return $recv($recv($self._theClass())._ownMethodsInProtocol_($self._name()))._sorted_((function(a,b){
  33461. return $core.withContext(function($ctx2) {
  33462. $1=$recv(a)._selector();
  33463. $ctx2.sendIdx["selector"]=1;
  33464. return $recv($1).__lt_eq($recv(b)._selector());
  33465. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  33466. }));
  33467. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{})});
  33468. },
  33469. args: [],
  33470. source: "ownMethods\x0a\x09^ (self theClass ownMethodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  33471. referencedClasses: [],
  33472. pragmas: [],
  33473. messageSends: ["sorted:", "ownMethodsInProtocol:", "theClass", "name", "<=", "selector"]
  33474. }),
  33475. $globals.ExportMethodProtocol);
  33476. $core.addMethod(
  33477. $core.method({
  33478. selector: "theClass",
  33479. protocol: "accessing",
  33480. fn: function (){
  33481. var self=this,$self=this;
  33482. return $self.theClass;
  33483. },
  33484. args: [],
  33485. source: "theClass\x0a\x09^ theClass",
  33486. referencedClasses: [],
  33487. pragmas: [],
  33488. messageSends: []
  33489. }),
  33490. $globals.ExportMethodProtocol);
  33491. $core.addMethod(
  33492. $core.method({
  33493. selector: "theClass:",
  33494. protocol: "accessing",
  33495. fn: function (aClass){
  33496. var self=this,$self=this;
  33497. $self.theClass=aClass;
  33498. return self;
  33499. },
  33500. args: ["aClass"],
  33501. source: "theClass: aClass\x0a\x09theClass := aClass",
  33502. referencedClasses: [],
  33503. pragmas: [],
  33504. messageSends: []
  33505. }),
  33506. $globals.ExportMethodProtocol);
  33507. $core.addMethod(
  33508. $core.method({
  33509. selector: "name:theClass:",
  33510. protocol: "instance creation",
  33511. fn: function (aString,aClass){
  33512. var self=this,$self=this;
  33513. return $core.withContext(function($ctx1) {
  33514. var $1;
  33515. $1=$self._new();
  33516. $recv($1)._name_(aString);
  33517. $recv($1)._theClass_(aClass);
  33518. return $recv($1)._yourself();
  33519. }, function($ctx1) {$ctx1.fill(self,"name:theClass:",{aString:aString,aClass:aClass})});
  33520. },
  33521. args: ["aString", "aClass"],
  33522. source: "name: aString theClass: aClass\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  33523. referencedClasses: [],
  33524. pragmas: [],
  33525. messageSends: ["name:", "new", "theClass:", "yourself"]
  33526. }),
  33527. $globals.ExportMethodProtocol.a$cls);
  33528. $core.addClass("Importer", $globals.Object, ["lastSection", "lastChunk"], "Platform-ImportExport");
  33529. $globals.Importer.comment="I can import Amber code from a string in the chunk format.\x0a\x0a## API\x0a\x0a Importer new import: aString";
  33530. $core.addMethod(
  33531. $core.method({
  33532. selector: "import:",
  33533. protocol: "fileIn",
  33534. fn: function (aStream){
  33535. var self=this,$self=this;
  33536. var chunk,result,parser,lastEmpty;
  33537. return $core.withContext(function($ctx1) {
  33538. var $1;
  33539. parser=$recv($globals.ChunkParser)._on_(aStream);
  33540. lastEmpty=false;
  33541. $self.lastSection="n/a, not started";
  33542. $self.lastChunk=nil;
  33543. $recv((function(){
  33544. return $core.withContext(function($ctx2) {
  33545. $recv((function(){
  33546. return $core.withContext(function($ctx3) {
  33547. chunk=$recv(parser)._nextChunk();
  33548. return $recv(chunk)._isNil();
  33549. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  33550. }))._whileFalse_((function(){
  33551. return $core.withContext(function($ctx3) {
  33552. return $recv(chunk)._ifEmpty_ifNotEmpty_((function(){
  33553. lastEmpty=true;
  33554. return lastEmpty;
  33555. }),(function(){
  33556. return $core.withContext(function($ctx4) {
  33557. $self.lastSection=chunk;
  33558. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_(chunk);
  33559. $1=lastEmpty;
  33560. if($core.assert($1)){
  33561. lastEmpty=false;
  33562. return $recv(result)._scanFrom_(parser);
  33563. }
  33564. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,5)});
  33565. }));
  33566. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  33567. }));
  33568. $self.lastSection="n/a, finished";
  33569. return $self.lastSection;
  33570. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33571. }))._on_do_($globals.Error,(function(e){
  33572. return $core.withContext(function($ctx2) {
  33573. $self.lastChunk=$recv(parser)._last();
  33574. return $recv(e)._pass();
  33575. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,7)});
  33576. }));
  33577. return self;
  33578. }, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty})});
  33579. },
  33580. args: ["aStream"],
  33581. 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 ].",
  33582. referencedClasses: ["ChunkParser", "Compiler", "Error"],
  33583. pragmas: [],
  33584. messageSends: ["on:", "on:do:", "whileFalse:", "nextChunk", "isNil", "ifEmpty:ifNotEmpty:", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "last", "pass"]
  33585. }),
  33586. $globals.Importer);
  33587. $core.addMethod(
  33588. $core.method({
  33589. selector: "lastChunk",
  33590. protocol: "accessing",
  33591. fn: function (){
  33592. var self=this,$self=this;
  33593. return $self.lastChunk;
  33594. },
  33595. args: [],
  33596. source: "lastChunk\x0a\x09^ lastChunk",
  33597. referencedClasses: [],
  33598. pragmas: [],
  33599. messageSends: []
  33600. }),
  33601. $globals.Importer);
  33602. $core.addMethod(
  33603. $core.method({
  33604. selector: "lastSection",
  33605. protocol: "accessing",
  33606. fn: function (){
  33607. var self=this,$self=this;
  33608. return $self.lastSection;
  33609. },
  33610. args: [],
  33611. source: "lastSection\x0a\x09^ lastSection",
  33612. referencedClasses: [],
  33613. pragmas: [],
  33614. messageSends: []
  33615. }),
  33616. $globals.Importer);
  33617. $core.addClass("PackageCommitError", $globals.Error, [], "Platform-ImportExport");
  33618. $globals.PackageCommitError.comment="I get signaled when an attempt to commit a package has failed.";
  33619. $core.addClass("PackageHandler", $globals.Object, [], "Platform-ImportExport");
  33620. $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.";
  33621. $core.addMethod(
  33622. $core.method({
  33623. selector: "ajaxPutAt:data:onSuccess:onError:",
  33624. protocol: "private",
  33625. fn: function (aURL,aString,aBlock,anotherBlock){
  33626. var self=this,$self=this;
  33627. var xhr;
  33628. return $core.withContext(function($ctx1) {
  33629. var $1,$4,$3,$2;
  33630. xhr=$recv($globals.Platform)._newXhr();
  33631. $recv(xhr)._open_url_async_("PUT",aURL,true);
  33632. $recv(xhr)._onreadystatechange_((function(){
  33633. return $core.withContext(function($ctx2) {
  33634. $1=$recv($recv(xhr)._readyState()).__eq((4));
  33635. if($core.assert($1)){
  33636. $4=$recv(xhr)._status();
  33637. $ctx2.sendIdx["status"]=1;
  33638. $3=$recv($4).__gt_eq((200));
  33639. $2=$recv($3)._and_((function(){
  33640. return $core.withContext(function($ctx3) {
  33641. return $recv($recv(xhr)._status()).__lt((300));
  33642. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  33643. }));
  33644. return $recv($2)._ifTrue_ifFalse_(aBlock,anotherBlock);
  33645. }
  33646. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33647. }));
  33648. $recv(xhr)._send_(aString);
  33649. return self;
  33650. }, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:onSuccess:onError:",{aURL:aURL,aString:aString,aBlock:aBlock,anotherBlock:anotherBlock,xhr:xhr})});
  33651. },
  33652. args: ["aURL", "aString", "aBlock", "anotherBlock"],
  33653. 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",
  33654. referencedClasses: ["Platform"],
  33655. pragmas: [],
  33656. messageSends: ["newXhr", "open:url:async:", "onreadystatechange:", "ifTrue:", "=", "readyState", "ifTrue:ifFalse:", "and:", ">=", "status", "<", "send:"]
  33657. }),
  33658. $globals.PackageHandler);
  33659. $core.addMethod(
  33660. $core.method({
  33661. selector: "chunkContentsFor:",
  33662. protocol: "accessing",
  33663. fn: function (aPackage){
  33664. var self=this,$self=this;
  33665. return $core.withContext(function($ctx1) {
  33666. return $recv($globals.String)._streamContents_((function(str){
  33667. return $core.withContext(function($ctx2) {
  33668. return $recv($self._chunkExporter())._exportPackage_on_(aPackage,str);
  33669. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  33670. }));
  33671. }, function($ctx1) {$ctx1.fill(self,"chunkContentsFor:",{aPackage:aPackage})});
  33672. },
  33673. args: ["aPackage"],
  33674. source: "chunkContentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self chunkExporter exportPackage: aPackage on: str ]",
  33675. referencedClasses: ["String"],
  33676. pragmas: [],
  33677. messageSends: ["streamContents:", "exportPackage:on:", "chunkExporter"]
  33678. }),
  33679. $globals.PackageHandler);
  33680. $core.addMethod(
  33681. $core.method({
  33682. selector: "chunkExporter",
  33683. protocol: "factory",
  33684. fn: function (){
  33685. var self=this,$self=this;
  33686. return $core.withContext(function($ctx1) {
  33687. return $recv($self._chunkExporterClass())._new();
  33688. }, function($ctx1) {$ctx1.fill(self,"chunkExporter",{})});
  33689. },
  33690. args: [],
  33691. source: "chunkExporter\x0a\x09^ self chunkExporterClass new",
  33692. referencedClasses: [],
  33693. pragmas: [],
  33694. messageSends: ["new", "chunkExporterClass"]
  33695. }),
  33696. $globals.PackageHandler);
  33697. $core.addMethod(
  33698. $core.method({
  33699. selector: "chunkExporterClass",
  33700. protocol: "accessing",
  33701. fn: function (){
  33702. var self=this,$self=this;
  33703. return $globals.ChunkExporter;
  33704. },
  33705. args: [],
  33706. source: "chunkExporterClass\x0a\x09^ ChunkExporter",
  33707. referencedClasses: ["ChunkExporter"],
  33708. pragmas: [],
  33709. messageSends: []
  33710. }),
  33711. $globals.PackageHandler);
  33712. $core.addMethod(
  33713. $core.method({
  33714. selector: "commit:",
  33715. protocol: "committing",
  33716. fn: function (aPackage){
  33717. var self=this,$self=this;
  33718. return $core.withContext(function($ctx1) {
  33719. var $1,$2;
  33720. $self._commit_onSuccess_onError_(aPackage,(function(){
  33721. }),(function(error){
  33722. return $core.withContext(function($ctx2) {
  33723. $1=$recv($globals.PackageCommitError)._new();
  33724. $2=$recv("Commiting failed with reason: \x22".__comma($recv(error)._responseText())).__comma("\x22");
  33725. $ctx2.sendIdx[","]=1;
  33726. $recv($1)._messageText_($2);
  33727. return $recv($1)._signal();
  33728. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  33729. }));
  33730. return self;
  33731. }, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage})});
  33732. },
  33733. args: ["aPackage"],
  33734. 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 ]",
  33735. referencedClasses: ["PackageCommitError"],
  33736. pragmas: [],
  33737. messageSends: ["commit:onSuccess:onError:", "messageText:", "new", ",", "responseText", "signal"]
  33738. }),
  33739. $globals.PackageHandler);
  33740. $core.addMethod(
  33741. $core.method({
  33742. selector: "commit:onSuccess:onError:",
  33743. protocol: "committing",
  33744. fn: function (aPackage,aBlock,anotherBlock){
  33745. var self=this,$self=this;
  33746. return $core.withContext(function($ctx1) {
  33747. $self._commitJsFileFor_onSuccess_onError_(aPackage,(function(){
  33748. return $core.withContext(function($ctx2) {
  33749. return $self._commitStFileFor_onSuccess_onError_(aPackage,(function(){
  33750. return $core.withContext(function($ctx3) {
  33751. $recv(aPackage)._beClean();
  33752. return $recv(aBlock)._value();
  33753. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  33754. }),anotherBlock);
  33755. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33756. }),anotherBlock);
  33757. return self;
  33758. }, function($ctx1) {$ctx1.fill(self,"commit:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock})});
  33759. },
  33760. args: ["aPackage", "aBlock", "anotherBlock"],
  33761. 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",
  33762. referencedClasses: [],
  33763. pragmas: [],
  33764. messageSends: ["commitJsFileFor:onSuccess:onError:", "commitStFileFor:onSuccess:onError:", "beClean", "value"]
  33765. }),
  33766. $globals.PackageHandler);
  33767. $core.addMethod(
  33768. $core.method({
  33769. selector: "commitJsFileFor:onSuccess:onError:",
  33770. protocol: "committing",
  33771. fn: function (aPackage,aBlock,anotherBlock){
  33772. var self=this,$self=this;
  33773. return $core.withContext(function($ctx1) {
  33774. var $2,$1;
  33775. $2=$recv($recv($self._commitPathJsFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  33776. $ctx1.sendIdx[","]=2;
  33777. $1=$recv($2).__comma(".js");
  33778. $ctx1.sendIdx[","]=1;
  33779. $self._ajaxPutAt_data_onSuccess_onError_($1,$self._contentsFor_(aPackage),aBlock,anotherBlock);
  33780. return self;
  33781. }, function($ctx1) {$ctx1.fill(self,"commitJsFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock})});
  33782. },
  33783. args: ["aPackage", "aBlock", "anotherBlock"],
  33784. 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",
  33785. referencedClasses: [],
  33786. pragmas: [],
  33787. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathJsFor:", "name", "contentsFor:"]
  33788. }),
  33789. $globals.PackageHandler);
  33790. $core.addMethod(
  33791. $core.method({
  33792. selector: "commitPathJsFor:",
  33793. protocol: "accessing",
  33794. fn: function (aPackage){
  33795. var self=this,$self=this;
  33796. return $core.withContext(function($ctx1) {
  33797. $self._subclassResponsibility();
  33798. return self;
  33799. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage})});
  33800. },
  33801. args: ["aPackage"],
  33802. source: "commitPathJsFor: aPackage\x0a\x09self subclassResponsibility",
  33803. referencedClasses: [],
  33804. pragmas: [],
  33805. messageSends: ["subclassResponsibility"]
  33806. }),
  33807. $globals.PackageHandler);
  33808. $core.addMethod(
  33809. $core.method({
  33810. selector: "commitPathStFor:",
  33811. protocol: "accessing",
  33812. fn: function (aPackage){
  33813. var self=this,$self=this;
  33814. return $core.withContext(function($ctx1) {
  33815. $self._subclassResponsibility();
  33816. return self;
  33817. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage})});
  33818. },
  33819. args: ["aPackage"],
  33820. source: "commitPathStFor: aPackage\x0a\x09self subclassResponsibility",
  33821. referencedClasses: [],
  33822. pragmas: [],
  33823. messageSends: ["subclassResponsibility"]
  33824. }),
  33825. $globals.PackageHandler);
  33826. $core.addMethod(
  33827. $core.method({
  33828. selector: "commitStFileFor:onSuccess:onError:",
  33829. protocol: "committing",
  33830. fn: function (aPackage,aBlock,anotherBlock){
  33831. var self=this,$self=this;
  33832. return $core.withContext(function($ctx1) {
  33833. var $2,$1;
  33834. $2=$recv($recv($self._commitPathStFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  33835. $ctx1.sendIdx[","]=2;
  33836. $1=$recv($2).__comma(".st");
  33837. $ctx1.sendIdx[","]=1;
  33838. $self._ajaxPutAt_data_onSuccess_onError_($1,$self._chunkContentsFor_(aPackage),aBlock,anotherBlock);
  33839. return self;
  33840. }, function($ctx1) {$ctx1.fill(self,"commitStFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock})});
  33841. },
  33842. args: ["aPackage", "aBlock", "anotherBlock"],
  33843. 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",
  33844. referencedClasses: [],
  33845. pragmas: [],
  33846. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathStFor:", "name", "chunkContentsFor:"]
  33847. }),
  33848. $globals.PackageHandler);
  33849. $core.addMethod(
  33850. $core.method({
  33851. selector: "contentsFor:",
  33852. protocol: "accessing",
  33853. fn: function (aPackage){
  33854. var self=this,$self=this;
  33855. return $core.withContext(function($ctx1) {
  33856. return $recv($globals.String)._streamContents_((function(str){
  33857. return $core.withContext(function($ctx2) {
  33858. return $recv($self._exporter())._exportPackage_on_(aPackage,str);
  33859. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  33860. }));
  33861. }, function($ctx1) {$ctx1.fill(self,"contentsFor:",{aPackage:aPackage})});
  33862. },
  33863. args: ["aPackage"],
  33864. source: "contentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self exporter exportPackage: aPackage on: str ]",
  33865. referencedClasses: ["String"],
  33866. pragmas: [],
  33867. messageSends: ["streamContents:", "exportPackage:on:", "exporter"]
  33868. }),
  33869. $globals.PackageHandler);
  33870. $core.addMethod(
  33871. $core.method({
  33872. selector: "exporter",
  33873. protocol: "factory",
  33874. fn: function (){
  33875. var self=this,$self=this;
  33876. return $core.withContext(function($ctx1) {
  33877. return $recv($self._exporterClass())._new();
  33878. }, function($ctx1) {$ctx1.fill(self,"exporter",{})});
  33879. },
  33880. args: [],
  33881. source: "exporter\x0a\x09^ self exporterClass new",
  33882. referencedClasses: [],
  33883. pragmas: [],
  33884. messageSends: ["new", "exporterClass"]
  33885. }),
  33886. $globals.PackageHandler);
  33887. $core.addMethod(
  33888. $core.method({
  33889. selector: "exporterClass",
  33890. protocol: "accessing",
  33891. fn: function (){
  33892. var self=this,$self=this;
  33893. return $core.withContext(function($ctx1) {
  33894. $self._subclassResponsibility();
  33895. return self;
  33896. }, function($ctx1) {$ctx1.fill(self,"exporterClass",{})});
  33897. },
  33898. args: [],
  33899. source: "exporterClass\x0a\x09self subclassResponsibility",
  33900. referencedClasses: [],
  33901. pragmas: [],
  33902. messageSends: ["subclassResponsibility"]
  33903. }),
  33904. $globals.PackageHandler);
  33905. $core.addMethod(
  33906. $core.method({
  33907. selector: "load:",
  33908. protocol: "loading",
  33909. fn: function (aPackage){
  33910. var self=this,$self=this;
  33911. return $core.withContext(function($ctx1) {
  33912. $self._subclassResponsibility();
  33913. return self;
  33914. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage})});
  33915. },
  33916. args: ["aPackage"],
  33917. source: "load: aPackage\x0a\x09\x22Should return a TThenable\x22\x0a\x09self subclassResponsibility",
  33918. referencedClasses: [],
  33919. pragmas: [],
  33920. messageSends: ["subclassResponsibility"]
  33921. }),
  33922. $globals.PackageHandler);
  33923. $core.addMethod(
  33924. $core.method({
  33925. selector: "onCommitError:",
  33926. protocol: "error handling",
  33927. fn: function (anError){
  33928. var self=this,$self=this;
  33929. return $core.withContext(function($ctx1) {
  33930. var $1,$2;
  33931. $1=$recv($globals.PackageCommitError)._new();
  33932. $2=$recv("Commiting failed with reason: \x22".__comma($recv(anError)._responseText())).__comma("\x22");
  33933. $ctx1.sendIdx[","]=1;
  33934. $recv($1)._messageText_($2);
  33935. $recv($1)._signal();
  33936. return self;
  33937. }, function($ctx1) {$ctx1.fill(self,"onCommitError:",{anError:anError})});
  33938. },
  33939. args: ["anError"],
  33940. source: "onCommitError: anError\x0a\x09PackageCommitError new\x0a\x09\x09messageText: 'Commiting failed with reason: \x22' , (anError responseText) , '\x22';\x0a\x09\x09signal",
  33941. referencedClasses: ["PackageCommitError"],
  33942. pragmas: [],
  33943. messageSends: ["messageText:", "new", ",", "responseText", "signal"]
  33944. }),
  33945. $globals.PackageHandler);
  33946. $core.addMethod(
  33947. $core.method({
  33948. selector: "setPath:forPackage:",
  33949. protocol: "accessing",
  33950. fn: function (aString,aPackage){
  33951. var self=this,$self=this;
  33952. return $core.withContext(function($ctx1) {
  33953. $self._subclassResponsibility();
  33954. return self;
  33955. }, function($ctx1) {$ctx1.fill(self,"setPath:forPackage:",{aString:aString,aPackage:aPackage})});
  33956. },
  33957. args: ["aString", "aPackage"],
  33958. source: "setPath: aString forPackage: aPackage\x0a\x09self subclassResponsibility",
  33959. referencedClasses: [],
  33960. pragmas: [],
  33961. messageSends: ["subclassResponsibility"]
  33962. }),
  33963. $globals.PackageHandler);
  33964. $core.addClass("AmdPackageHandler", $globals.PackageHandler, [], "Platform-ImportExport");
  33965. $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.";
  33966. $core.addMethod(
  33967. $core.method({
  33968. selector: "commitPathJsFor:",
  33969. protocol: "accessing",
  33970. fn: function (aPackage){
  33971. var self=this,$self=this;
  33972. return $core.withContext(function($ctx1) {
  33973. return $self._toUrl_($self._namespaceFor_(aPackage));
  33974. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage})});
  33975. },
  33976. args: ["aPackage"],
  33977. source: "commitPathJsFor: aPackage\x0a\x09^ self toUrl: (self namespaceFor: aPackage)",
  33978. referencedClasses: [],
  33979. pragmas: [],
  33980. messageSends: ["toUrl:", "namespaceFor:"]
  33981. }),
  33982. $globals.AmdPackageHandler);
  33983. $core.addMethod(
  33984. $core.method({
  33985. selector: "commitPathStFor:",
  33986. protocol: "accessing",
  33987. fn: function (aPackage){
  33988. var self=this,$self=this;
  33989. var path,pathWithout;
  33990. return $core.withContext(function($ctx1) {
  33991. var $1,$2;
  33992. $1=$recv($self._namespaceFor_(aPackage)).__comma("/_source");
  33993. $ctx1.sendIdx[","]=1;
  33994. path=$self._toUrl_($1);
  33995. pathWithout=$self._commitPathJsFor_(aPackage);
  33996. $2=$recv(path).__eq($recv(pathWithout).__comma("/_source"));
  33997. if($core.assert($2)){
  33998. return pathWithout;
  33999. } else {
  34000. return path;
  34001. }
  34002. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage,path:path,pathWithout:pathWithout})});
  34003. },
  34004. args: ["aPackage"],
  34005. 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 ]",
  34006. referencedClasses: [],
  34007. pragmas: [],
  34008. messageSends: ["toUrl:", ",", "namespaceFor:", "commitPathJsFor:", "ifTrue:ifFalse:", "="]
  34009. }),
  34010. $globals.AmdPackageHandler);
  34011. $core.addMethod(
  34012. $core.method({
  34013. selector: "exporterClass",
  34014. protocol: "accessing",
  34015. fn: function (){
  34016. var self=this,$self=this;
  34017. return $globals.AmdExporter;
  34018. },
  34019. args: [],
  34020. source: "exporterClass\x0a\x09^ AmdExporter",
  34021. referencedClasses: ["AmdExporter"],
  34022. pragmas: [],
  34023. messageSends: []
  34024. }),
  34025. $globals.AmdPackageHandler);
  34026. $core.addMethod(
  34027. $core.method({
  34028. selector: "load:",
  34029. protocol: "loading",
  34030. fn: function (aPackage){
  34031. var self=this,$self=this;
  34032. return $core.withContext(function($ctx1) {
  34033. var $1,$3,$2,$receiver;
  34034. return $recv($globals.Promise)._new_((function(model){
  34035. return $core.withContext(function($ctx2) {
  34036. $1=$recv($globals.Smalltalk)._amdRequire();
  34037. if(($receiver = $1) == null || $receiver.a$nil){
  34038. return $self._error_("AMD loader not present");
  34039. } else {
  34040. var require;
  34041. require=$receiver;
  34042. $3=$recv($recv($self._namespaceFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  34043. $ctx2.sendIdx[","]=1;
  34044. $2=[$3];
  34045. return $recv(require)._value_value_value_($2,(function(result){
  34046. return $core.withContext(function($ctx3) {
  34047. return $recv(model)._value_(result);
  34048. }, function($ctx3) {$ctx3.fillBlock({result:result},$ctx2,4)});
  34049. }),(function(error){
  34050. return $core.withContext(function($ctx3) {
  34051. return $recv(model)._signal_(error);
  34052. }, function($ctx3) {$ctx3.fillBlock({error:error},$ctx2,5)});
  34053. }));
  34054. }
  34055. }, function($ctx2) {$ctx2.fillBlock({model:model},$ctx1,1)});
  34056. }));
  34057. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage})});
  34058. },
  34059. args: ["aPackage"],
  34060. 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 ] ] ]",
  34061. referencedClasses: ["Promise", "Smalltalk"],
  34062. pragmas: [],
  34063. messageSends: ["new:", "ifNil:ifNotNil:", "amdRequire", "error:", "value:value:value:", ",", "namespaceFor:", "name", "value:", "signal:"]
  34064. }),
  34065. $globals.AmdPackageHandler);
  34066. $core.addMethod(
  34067. $core.method({
  34068. selector: "namespaceFor:",
  34069. protocol: "committing",
  34070. fn: function (aPackage){
  34071. var self=this,$self=this;
  34072. return $core.withContext(function($ctx1) {
  34073. return $recv($recv(aPackage)._transport())._namespace();
  34074. }, function($ctx1) {$ctx1.fill(self,"namespaceFor:",{aPackage:aPackage})});
  34075. },
  34076. args: ["aPackage"],
  34077. source: "namespaceFor: aPackage\x0a\x09^ aPackage transport namespace",
  34078. referencedClasses: [],
  34079. pragmas: [],
  34080. messageSends: ["namespace", "transport"]
  34081. }),
  34082. $globals.AmdPackageHandler);
  34083. $core.addMethod(
  34084. $core.method({
  34085. selector: "setPath:forPackage:",
  34086. protocol: "accessing",
  34087. fn: function (aString,aPackage){
  34088. var self=this,$self=this;
  34089. return $core.withContext(function($ctx1) {
  34090. $recv($recv(require)._provided())._config_($globals.HashedCollection._newFromPairs_(["paths",$globals.HashedCollection._newFromPairs_([$self._namespaceFor_(aPackage),aString])]));
  34091. return self;
  34092. }, function($ctx1) {$ctx1.fill(self,"setPath:forPackage:",{aString:aString,aPackage:aPackage})});
  34093. },
  34094. args: ["aString", "aPackage"],
  34095. 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",
  34096. referencedClasses: [],
  34097. pragmas: [],
  34098. messageSends: ["config:", "provided", "namespaceFor:"]
  34099. }),
  34100. $globals.AmdPackageHandler);
  34101. $core.addMethod(
  34102. $core.method({
  34103. selector: "toUrl:",
  34104. protocol: "private",
  34105. fn: function (aString){
  34106. var self=this,$self=this;
  34107. return $core.withContext(function($ctx1) {
  34108. var $1,$receiver;
  34109. $1=$recv($globals.Smalltalk)._amdRequire();
  34110. if(($receiver = $1) == null || $receiver.a$nil){
  34111. return $self._error_("AMD loader not present");
  34112. } else {
  34113. var require;
  34114. require=$receiver;
  34115. return $recv($recv(require)._provided())._toUrl_(aString);
  34116. }
  34117. }, function($ctx1) {$ctx1.fill(self,"toUrl:",{aString:aString})});
  34118. },
  34119. args: ["aString"],
  34120. source: "toUrl: aString\x0a\x09^ Smalltalk amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require | require provided toUrl: aString ]",
  34121. referencedClasses: ["Smalltalk"],
  34122. pragmas: [],
  34123. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "toUrl:", "provided"]
  34124. }),
  34125. $globals.AmdPackageHandler);
  34126. $core.addMethod(
  34127. $core.method({
  34128. selector: "defaultNamespace",
  34129. protocol: "commit paths",
  34130. fn: function (){
  34131. var self=this,$self=this;
  34132. return $core.withContext(function($ctx1) {
  34133. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  34134. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{})});
  34135. },
  34136. args: [],
  34137. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  34138. referencedClasses: ["Smalltalk"],
  34139. pragmas: [],
  34140. messageSends: ["defaultAmdNamespace"]
  34141. }),
  34142. $globals.AmdPackageHandler.a$cls);
  34143. $core.addMethod(
  34144. $core.method({
  34145. selector: "defaultNamespace:",
  34146. protocol: "commit paths",
  34147. fn: function (aString){
  34148. var self=this,$self=this;
  34149. return $core.withContext(function($ctx1) {
  34150. $recv($globals.Smalltalk)._defaultAmdNamespace_(aString);
  34151. return self;
  34152. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace:",{aString:aString})});
  34153. },
  34154. args: ["aString"],
  34155. source: "defaultNamespace: aString\x0a\x09Smalltalk defaultAmdNamespace: aString",
  34156. referencedClasses: ["Smalltalk"],
  34157. pragmas: [],
  34158. messageSends: ["defaultAmdNamespace:"]
  34159. }),
  34160. $globals.AmdPackageHandler.a$cls);
  34161. $core.addClass("PackageTransport", $globals.Object, ["package"], "Platform-ImportExport");
  34162. $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.";
  34163. $core.addMethod(
  34164. $core.method({
  34165. selector: "asJavaScriptObject",
  34166. protocol: "converting",
  34167. fn: function (){
  34168. var self=this,$self=this;
  34169. return $core.withContext(function($ctx1) {
  34170. return $globals.HashedCollection._newFromPairs_(["type",$self._type()]);
  34171. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{})});
  34172. },
  34173. args: [],
  34174. source: "asJavaScriptObject\x0a\x09^ #{ 'type' -> self type }",
  34175. referencedClasses: [],
  34176. pragmas: [],
  34177. messageSends: ["type"]
  34178. }),
  34179. $globals.PackageTransport);
  34180. $core.addMethod(
  34181. $core.method({
  34182. selector: "commit",
  34183. protocol: "committing",
  34184. fn: function (){
  34185. var self=this,$self=this;
  34186. return $core.withContext(function($ctx1) {
  34187. $recv($self._commitHandler())._commit_($self._package());
  34188. return self;
  34189. }, function($ctx1) {$ctx1.fill(self,"commit",{})});
  34190. },
  34191. args: [],
  34192. source: "commit\x0a\x09self commitHandler commit: self package",
  34193. referencedClasses: [],
  34194. pragmas: [],
  34195. messageSends: ["commit:", "commitHandler", "package"]
  34196. }),
  34197. $globals.PackageTransport);
  34198. $core.addMethod(
  34199. $core.method({
  34200. selector: "commitHandler",
  34201. protocol: "factory",
  34202. fn: function (){
  34203. var self=this,$self=this;
  34204. return $core.withContext(function($ctx1) {
  34205. return $recv($self._commitHandlerClass())._new();
  34206. }, function($ctx1) {$ctx1.fill(self,"commitHandler",{})});
  34207. },
  34208. args: [],
  34209. source: "commitHandler\x0a\x09^ self commitHandlerClass new",
  34210. referencedClasses: [],
  34211. pragmas: [],
  34212. messageSends: ["new", "commitHandlerClass"]
  34213. }),
  34214. $globals.PackageTransport);
  34215. $core.addMethod(
  34216. $core.method({
  34217. selector: "commitHandlerClass",
  34218. protocol: "accessing",
  34219. fn: function (){
  34220. var self=this,$self=this;
  34221. return $core.withContext(function($ctx1) {
  34222. $self._subclassResponsibility();
  34223. return self;
  34224. }, function($ctx1) {$ctx1.fill(self,"commitHandlerClass",{})});
  34225. },
  34226. args: [],
  34227. source: "commitHandlerClass\x0a\x09self subclassResponsibility",
  34228. referencedClasses: [],
  34229. pragmas: [],
  34230. messageSends: ["subclassResponsibility"]
  34231. }),
  34232. $globals.PackageTransport);
  34233. $core.addMethod(
  34234. $core.method({
  34235. selector: "commitOnSuccess:onError:",
  34236. protocol: "committing",
  34237. fn: function (aBlock,anotherBlock){
  34238. var self=this,$self=this;
  34239. return $core.withContext(function($ctx1) {
  34240. $recv($self._commitHandler())._commit_onSuccess_onError_($self._package(),aBlock,anotherBlock);
  34241. return self;
  34242. }, function($ctx1) {$ctx1.fill(self,"commitOnSuccess:onError:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  34243. },
  34244. args: ["aBlock", "anotherBlock"],
  34245. source: "commitOnSuccess: aBlock onError: anotherBlock\x0a\x09self commitHandler \x0a\x09\x09commit: self package\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  34246. referencedClasses: [],
  34247. pragmas: [],
  34248. messageSends: ["commit:onSuccess:onError:", "commitHandler", "package"]
  34249. }),
  34250. $globals.PackageTransport);
  34251. $core.addMethod(
  34252. $core.method({
  34253. selector: "definition",
  34254. protocol: "accessing",
  34255. fn: function (){
  34256. var self=this,$self=this;
  34257. return "";
  34258. },
  34259. args: [],
  34260. source: "definition\x0a\x09^ ''",
  34261. referencedClasses: [],
  34262. pragmas: [],
  34263. messageSends: []
  34264. }),
  34265. $globals.PackageTransport);
  34266. $core.addMethod(
  34267. $core.method({
  34268. selector: "load",
  34269. protocol: "loading",
  34270. fn: function (){
  34271. var self=this,$self=this;
  34272. return $core.withContext(function($ctx1) {
  34273. return $recv($recv($self._commitHandler())._load_($self._package()))._then_((function(){
  34274. return $core.withContext(function($ctx2) {
  34275. return $recv($globals.Smalltalk)._postLoad();
  34276. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34277. }));
  34278. }, function($ctx1) {$ctx1.fill(self,"load",{})});
  34279. },
  34280. args: [],
  34281. source: "load\x0a\x09^ (self commitHandler load: self package)\x0a\x09\x09then: [ Smalltalk postLoad ]",
  34282. referencedClasses: ["Smalltalk"],
  34283. pragmas: [],
  34284. messageSends: ["then:", "load:", "commitHandler", "package", "postLoad"]
  34285. }),
  34286. $globals.PackageTransport);
  34287. $core.addMethod(
  34288. $core.method({
  34289. selector: "package",
  34290. protocol: "accessing",
  34291. fn: function (){
  34292. var self=this,$self=this;
  34293. return $self.package;
  34294. },
  34295. args: [],
  34296. source: "package\x0a\x09^ package",
  34297. referencedClasses: [],
  34298. pragmas: [],
  34299. messageSends: []
  34300. }),
  34301. $globals.PackageTransport);
  34302. $core.addMethod(
  34303. $core.method({
  34304. selector: "package:",
  34305. protocol: "accessing",
  34306. fn: function (aPackage){
  34307. var self=this,$self=this;
  34308. $self.package=aPackage;
  34309. return self;
  34310. },
  34311. args: ["aPackage"],
  34312. source: "package: aPackage\x0a\x09package := aPackage",
  34313. referencedClasses: [],
  34314. pragmas: [],
  34315. messageSends: []
  34316. }),
  34317. $globals.PackageTransport);
  34318. $core.addMethod(
  34319. $core.method({
  34320. selector: "setPath:",
  34321. protocol: "actions",
  34322. fn: function (aString){
  34323. var self=this,$self=this;
  34324. return $core.withContext(function($ctx1) {
  34325. $recv($self._commitHandler())._setPath_forPackage_(aString,$self.package);
  34326. return self;
  34327. }, function($ctx1) {$ctx1.fill(self,"setPath:",{aString:aString})});
  34328. },
  34329. args: ["aString"],
  34330. source: "setPath: aString\x0a\x09\x22Set the commit path for the package\x22\x0a\x0a\x09self commitHandler setPath: aString forPackage: package",
  34331. referencedClasses: [],
  34332. pragmas: [],
  34333. messageSends: ["setPath:forPackage:", "commitHandler"]
  34334. }),
  34335. $globals.PackageTransport);
  34336. $core.addMethod(
  34337. $core.method({
  34338. selector: "setupFromJson:",
  34339. protocol: "initialization",
  34340. fn: function (anObject){
  34341. var self=this,$self=this;
  34342. return self;
  34343. },
  34344. args: ["anObject"],
  34345. source: "setupFromJson: anObject\x0a\x09\x22no op. override if needed in subclasses\x22",
  34346. referencedClasses: [],
  34347. pragmas: [],
  34348. messageSends: []
  34349. }),
  34350. $globals.PackageTransport);
  34351. $core.addMethod(
  34352. $core.method({
  34353. selector: "type",
  34354. protocol: "accessing",
  34355. fn: function (){
  34356. var self=this,$self=this;
  34357. return $core.withContext(function($ctx1) {
  34358. return $recv($self._class())._type();
  34359. }, function($ctx1) {$ctx1.fill(self,"type",{})});
  34360. },
  34361. args: [],
  34362. source: "type\x0a\x09^ self class type",
  34363. referencedClasses: [],
  34364. pragmas: [],
  34365. messageSends: ["type", "class"]
  34366. }),
  34367. $globals.PackageTransport);
  34368. $core.setSlots($globals.PackageTransport.a$cls, ["registry"]);
  34369. $core.addMethod(
  34370. $core.method({
  34371. selector: "classRegisteredFor:",
  34372. protocol: "accessing",
  34373. fn: function (aString){
  34374. var self=this,$self=this;
  34375. return $core.withContext(function($ctx1) {
  34376. return $recv($self.registry)._at_(aString);
  34377. }, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString})});
  34378. },
  34379. args: ["aString"],
  34380. source: "classRegisteredFor: aString\x0a\x09^ registry at: aString",
  34381. referencedClasses: [],
  34382. pragmas: [],
  34383. messageSends: ["at:"]
  34384. }),
  34385. $globals.PackageTransport.a$cls);
  34386. $core.addMethod(
  34387. $core.method({
  34388. selector: "defaultType",
  34389. protocol: "accessing",
  34390. fn: function (){
  34391. var self=this,$self=this;
  34392. return $core.withContext(function($ctx1) {
  34393. return $recv($globals.AmdPackageTransport)._type();
  34394. }, function($ctx1) {$ctx1.fill(self,"defaultType",{})});
  34395. },
  34396. args: [],
  34397. source: "defaultType\x0a\x09^ AmdPackageTransport type",
  34398. referencedClasses: ["AmdPackageTransport"],
  34399. pragmas: [],
  34400. messageSends: ["type"]
  34401. }),
  34402. $globals.PackageTransport.a$cls);
  34403. $core.addMethod(
  34404. $core.method({
  34405. selector: "for:",
  34406. protocol: "instance creation",
  34407. fn: function (aString){
  34408. var self=this,$self=this;
  34409. return $core.withContext(function($ctx1) {
  34410. return $recv($self._classRegisteredFor_(aString))._new();
  34411. }, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString})});
  34412. },
  34413. args: ["aString"],
  34414. source: "for: aString\x0a\x09^ (self classRegisteredFor: aString) new",
  34415. referencedClasses: [],
  34416. pragmas: [],
  34417. messageSends: ["new", "classRegisteredFor:"]
  34418. }),
  34419. $globals.PackageTransport.a$cls);
  34420. $core.addMethod(
  34421. $core.method({
  34422. selector: "fromJson:",
  34423. protocol: "instance creation",
  34424. fn: function (anObject){
  34425. var self=this,$self=this;
  34426. return $core.withContext(function($ctx1) {
  34427. var $1,$2,$receiver;
  34428. if(($receiver = anObject) == null || $receiver.a$nil){
  34429. $1=$self._for_($self._defaultType());
  34430. $ctx1.sendIdx["for:"]=1;
  34431. return $1;
  34432. } else {
  34433. anObject;
  34434. }
  34435. $2=$self._for_($recv(anObject)._type());
  34436. $recv($2)._setupFromJson_(anObject);
  34437. return $recv($2)._yourself();
  34438. }, function($ctx1) {$ctx1.fill(self,"fromJson:",{anObject:anObject})});
  34439. },
  34440. args: ["anObject"],
  34441. 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",
  34442. referencedClasses: [],
  34443. pragmas: [],
  34444. messageSends: ["ifNil:", "for:", "defaultType", "setupFromJson:", "type", "yourself"]
  34445. }),
  34446. $globals.PackageTransport.a$cls);
  34447. $core.addMethod(
  34448. $core.method({
  34449. selector: "initialize",
  34450. protocol: "initialization",
  34451. fn: function (){
  34452. var self=this,$self=this;
  34453. return $core.withContext(function($ctx1) {
  34454. var $1;
  34455. (
  34456. $ctx1.supercall = true,
  34457. ($globals.PackageTransport.a$cls.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  34458. $ctx1.supercall = false;
  34459. $1=$self.__eq_eq($globals.PackageTransport);
  34460. if($core.assert($1)){
  34461. $self.registry=$globals.HashedCollection._newFromPairs_([]);
  34462. $self.registry;
  34463. } else {
  34464. $self._register();
  34465. }
  34466. return self;
  34467. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  34468. },
  34469. args: [],
  34470. source: "initialize\x0a\x09super initialize.\x0a\x09self == PackageTransport\x0a\x09\x09ifTrue: [ registry := #{} ]\x0a\x09\x09ifFalse: [ self register ]",
  34471. referencedClasses: ["PackageTransport"],
  34472. pragmas: [],
  34473. messageSends: ["initialize", "ifTrue:ifFalse:", "==", "register"]
  34474. }),
  34475. $globals.PackageTransport.a$cls);
  34476. $core.addMethod(
  34477. $core.method({
  34478. selector: "register",
  34479. protocol: "registration",
  34480. fn: function (){
  34481. var self=this,$self=this;
  34482. return $core.withContext(function($ctx1) {
  34483. $recv($globals.PackageTransport)._register_(self);
  34484. return self;
  34485. }, function($ctx1) {$ctx1.fill(self,"register",{})});
  34486. },
  34487. args: [],
  34488. source: "register\x0a\x09PackageTransport register: self",
  34489. referencedClasses: ["PackageTransport"],
  34490. pragmas: [],
  34491. messageSends: ["register:"]
  34492. }),
  34493. $globals.PackageTransport.a$cls);
  34494. $core.addMethod(
  34495. $core.method({
  34496. selector: "register:",
  34497. protocol: "registration",
  34498. fn: function (aClass){
  34499. var self=this,$self=this;
  34500. return $core.withContext(function($ctx1) {
  34501. var $1,$receiver;
  34502. $1=$recv(aClass)._type();
  34503. $ctx1.sendIdx["type"]=1;
  34504. if(($receiver = $1) == null || $receiver.a$nil){
  34505. $1;
  34506. } else {
  34507. $recv($self.registry)._at_put_($recv(aClass)._type(),aClass);
  34508. }
  34509. return self;
  34510. }, function($ctx1) {$ctx1.fill(self,"register:",{aClass:aClass})});
  34511. },
  34512. args: ["aClass"],
  34513. source: "register: aClass\x0a\x09aClass type ifNotNil: [\x0a\x09\x09registry at: aClass type put: aClass ]",
  34514. referencedClasses: [],
  34515. pragmas: [],
  34516. messageSends: ["ifNotNil:", "type", "at:put:"]
  34517. }),
  34518. $globals.PackageTransport.a$cls);
  34519. $core.addMethod(
  34520. $core.method({
  34521. selector: "type",
  34522. protocol: "accessing",
  34523. fn: function (){
  34524. var self=this,$self=this;
  34525. return nil;
  34526. },
  34527. args: [],
  34528. source: "type\x0a\x09\x22Override in subclasses\x22\x0a\x09^ nil",
  34529. referencedClasses: [],
  34530. pragmas: [],
  34531. messageSends: []
  34532. }),
  34533. $globals.PackageTransport.a$cls);
  34534. $core.addClass("AmdPackageTransport", $globals.PackageTransport, ["namespace"], "Platform-ImportExport");
  34535. $globals.AmdPackageTransport.comment="I am the default transport for committing packages.\x0a\x0aSee `AmdExporter` and `AmdPackageHandler`.";
  34536. $core.addMethod(
  34537. $core.method({
  34538. selector: "asJavaScriptObject",
  34539. protocol: "converting",
  34540. fn: function (){
  34541. var self=this,$self=this;
  34542. return $core.withContext(function($ctx1) {
  34543. var $1;
  34544. $1=(
  34545. $ctx1.supercall = true,
  34546. ($globals.AmdPackageTransport.superclass||$boot.nilAsClass).fn.prototype._asJavaScriptObject.apply($self, []));
  34547. $ctx1.supercall = false;
  34548. $recv($1)._at_put_("amdNamespace",$self._namespace());
  34549. return $recv($1)._yourself();
  34550. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{})});
  34551. },
  34552. args: [],
  34553. source: "asJavaScriptObject\x0a\x09^ super asJavaScriptObject\x0a\x09\x09at: 'amdNamespace' put: self namespace;\x0a\x09\x09yourself",
  34554. referencedClasses: [],
  34555. pragmas: [],
  34556. messageSends: ["at:put:", "asJavaScriptObject", "namespace", "yourself"]
  34557. }),
  34558. $globals.AmdPackageTransport);
  34559. $core.addMethod(
  34560. $core.method({
  34561. selector: "commitHandlerClass",
  34562. protocol: "accessing",
  34563. fn: function (){
  34564. var self=this,$self=this;
  34565. return $globals.AmdPackageHandler;
  34566. },
  34567. args: [],
  34568. source: "commitHandlerClass\x0a\x09^ AmdPackageHandler",
  34569. referencedClasses: ["AmdPackageHandler"],
  34570. pragmas: [],
  34571. messageSends: []
  34572. }),
  34573. $globals.AmdPackageTransport);
  34574. $core.addMethod(
  34575. $core.method({
  34576. selector: "defaultNamespace",
  34577. protocol: "defaults",
  34578. fn: function (){
  34579. var self=this,$self=this;
  34580. return $core.withContext(function($ctx1) {
  34581. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  34582. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{})});
  34583. },
  34584. args: [],
  34585. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  34586. referencedClasses: ["Smalltalk"],
  34587. pragmas: [],
  34588. messageSends: ["defaultAmdNamespace"]
  34589. }),
  34590. $globals.AmdPackageTransport);
  34591. $core.addMethod(
  34592. $core.method({
  34593. selector: "definition",
  34594. protocol: "accessing",
  34595. fn: function (){
  34596. var self=this,$self=this;
  34597. return $core.withContext(function($ctx1) {
  34598. return $recv($globals.String)._streamContents_((function(stream){
  34599. return $core.withContext(function($ctx2) {
  34600. $recv(stream)._write_([$recv($self._class())._name()," namespace: "]);
  34601. return $recv(stream)._print_($self._namespace());
  34602. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  34603. }));
  34604. }, function($ctx1) {$ctx1.fill(self,"definition",{})});
  34605. },
  34606. args: [],
  34607. source: "definition\x0a\x09^ String streamContents: [ :stream | stream \x0a\x09\x09write: { self class name. ' namespace: ' }; print: self namespace ]",
  34608. referencedClasses: ["String"],
  34609. pragmas: [],
  34610. messageSends: ["streamContents:", "write:", "name", "class", "print:", "namespace"]
  34611. }),
  34612. $globals.AmdPackageTransport);
  34613. $core.addMethod(
  34614. $core.method({
  34615. selector: "namespace",
  34616. protocol: "accessing",
  34617. fn: function (){
  34618. var self=this,$self=this;
  34619. return $core.withContext(function($ctx1) {
  34620. var $1,$receiver;
  34621. $1=$self.namespace;
  34622. if(($receiver = $1) == null || $receiver.a$nil){
  34623. return $self._defaultNamespace();
  34624. } else {
  34625. return $1;
  34626. }
  34627. }, function($ctx1) {$ctx1.fill(self,"namespace",{})});
  34628. },
  34629. args: [],
  34630. source: "namespace\x0a\x09^ namespace ifNil: [ self defaultNamespace ]",
  34631. referencedClasses: [],
  34632. pragmas: [],
  34633. messageSends: ["ifNil:", "defaultNamespace"]
  34634. }),
  34635. $globals.AmdPackageTransport);
  34636. $core.addMethod(
  34637. $core.method({
  34638. selector: "namespace:",
  34639. protocol: "accessing",
  34640. fn: function (aString){
  34641. var self=this,$self=this;
  34642. $self.namespace=aString;
  34643. return self;
  34644. },
  34645. args: ["aString"],
  34646. source: "namespace: aString\x0a\x09namespace := aString",
  34647. referencedClasses: [],
  34648. pragmas: [],
  34649. messageSends: []
  34650. }),
  34651. $globals.AmdPackageTransport);
  34652. $core.addMethod(
  34653. $core.method({
  34654. selector: "printOn:",
  34655. protocol: "printing",
  34656. fn: function (aStream){
  34657. var self=this,$self=this;
  34658. return $core.withContext(function($ctx1) {
  34659. (
  34660. $ctx1.supercall = true,
  34661. ($globals.AmdPackageTransport.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  34662. $ctx1.supercall = false;
  34663. $recv(aStream)._nextPutAll_(" (AMD Namespace: ");
  34664. $ctx1.sendIdx["nextPutAll:"]=1;
  34665. $recv(aStream)._nextPutAll_($self._namespace());
  34666. $ctx1.sendIdx["nextPutAll:"]=2;
  34667. $recv(aStream)._nextPutAll_(")");
  34668. return self;
  34669. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  34670. },
  34671. args: ["aStream"],
  34672. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: ' (AMD Namespace: ';\x0a\x09\x09nextPutAll: self namespace;\x0a\x09\x09nextPutAll: ')'",
  34673. referencedClasses: [],
  34674. pragmas: [],
  34675. messageSends: ["printOn:", "nextPutAll:", "namespace"]
  34676. }),
  34677. $globals.AmdPackageTransport);
  34678. $core.addMethod(
  34679. $core.method({
  34680. selector: "setupFromJson:",
  34681. protocol: "initialization",
  34682. fn: function (anObject){
  34683. var self=this,$self=this;
  34684. return $core.withContext(function($ctx1) {
  34685. $self._namespace_($recv(anObject)._at_("amdNamespace"));
  34686. return self;
  34687. }, function($ctx1) {$ctx1.fill(self,"setupFromJson:",{anObject:anObject})});
  34688. },
  34689. args: ["anObject"],
  34690. source: "setupFromJson: anObject\x0a\x09self namespace: (anObject at: 'amdNamespace')",
  34691. referencedClasses: [],
  34692. pragmas: [],
  34693. messageSends: ["namespace:", "at:"]
  34694. }),
  34695. $globals.AmdPackageTransport);
  34696. $core.addMethod(
  34697. $core.method({
  34698. selector: "namespace:",
  34699. protocol: "instance creation",
  34700. fn: function (aString){
  34701. var self=this,$self=this;
  34702. return $core.withContext(function($ctx1) {
  34703. var $1;
  34704. $1=$self._new();
  34705. $recv($1)._namespace_(aString);
  34706. return $recv($1)._yourself();
  34707. }, function($ctx1) {$ctx1.fill(self,"namespace:",{aString:aString})});
  34708. },
  34709. args: ["aString"],
  34710. source: "namespace: aString\x0a\x09^ self new\x0a\x09\x09namespace: aString;\x0a\x09\x09yourself",
  34711. referencedClasses: [],
  34712. pragmas: [],
  34713. messageSends: ["namespace:", "new", "yourself"]
  34714. }),
  34715. $globals.AmdPackageTransport.a$cls);
  34716. $core.addMethod(
  34717. $core.method({
  34718. selector: "type",
  34719. protocol: "accessing",
  34720. fn: function (){
  34721. var self=this,$self=this;
  34722. return "amd";
  34723. },
  34724. args: [],
  34725. source: "type\x0a\x09^ 'amd'",
  34726. referencedClasses: [],
  34727. pragmas: [],
  34728. messageSends: []
  34729. }),
  34730. $globals.AmdPackageTransport.a$cls);
  34731. $core.addMethod(
  34732. $core.method({
  34733. selector: "exportBehaviorDefinitionTo:using:",
  34734. protocol: "*Platform-ImportExport",
  34735. fn: function (aStream,anExporter){
  34736. var self=this,$self=this;
  34737. return $core.withContext(function($ctx1) {
  34738. $recv(anExporter)._exportDefinitionOf_on_(self,aStream);
  34739. return self;
  34740. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter})});
  34741. },
  34742. args: ["aStream", "anExporter"],
  34743. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportDefinitionOf: self on: aStream",
  34744. referencedClasses: [],
  34745. pragmas: [],
  34746. messageSends: ["exportDefinitionOf:on:"]
  34747. }),
  34748. $globals.Class);
  34749. $core.addMethod(
  34750. $core.method({
  34751. selector: "exportBehaviorDefinitionTo:using:",
  34752. protocol: "*Platform-ImportExport",
  34753. fn: function (aStream,anExporter){
  34754. var self=this,$self=this;
  34755. return $core.withContext(function($ctx1) {
  34756. $recv(anExporter)._exportMetaDefinitionOf_on_($self._instanceClass(),aStream);
  34757. return self;
  34758. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter})});
  34759. },
  34760. args: ["aStream", "anExporter"],
  34761. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportMetaDefinitionOf: self instanceClass on: aStream",
  34762. referencedClasses: [],
  34763. pragmas: [],
  34764. messageSends: ["exportMetaDefinitionOf:on:", "instanceClass"]
  34765. }),
  34766. $globals.Metaclass);
  34767. $core.addMethod(
  34768. $core.method({
  34769. selector: "commit",
  34770. protocol: "*Platform-ImportExport",
  34771. fn: function (){
  34772. var self=this,$self=this;
  34773. return $core.withContext(function($ctx1) {
  34774. return $recv($self._transport())._commit();
  34775. }, function($ctx1) {$ctx1.fill(self,"commit",{})});
  34776. },
  34777. args: [],
  34778. source: "commit\x0a\x09^ self transport commit",
  34779. referencedClasses: [],
  34780. pragmas: [],
  34781. messageSends: ["commit", "transport"]
  34782. }),
  34783. $globals.Package);
  34784. $core.addMethod(
  34785. $core.method({
  34786. selector: "load",
  34787. protocol: "*Platform-ImportExport",
  34788. fn: function (){
  34789. var self=this,$self=this;
  34790. return $core.withContext(function($ctx1) {
  34791. return $recv($self._transport())._load();
  34792. }, function($ctx1) {$ctx1.fill(self,"load",{})});
  34793. },
  34794. args: [],
  34795. source: "load\x0a\x09^ self transport load",
  34796. referencedClasses: [],
  34797. pragmas: [],
  34798. messageSends: ["load", "transport"]
  34799. }),
  34800. $globals.Package);
  34801. $core.addMethod(
  34802. $core.method({
  34803. selector: "loadFromNamespace:",
  34804. protocol: "*Platform-ImportExport",
  34805. fn: function (aString){
  34806. var self=this,$self=this;
  34807. return $core.withContext(function($ctx1) {
  34808. var $1;
  34809. $1=$self._transport();
  34810. $recv($1)._namespace_(aString);
  34811. return $recv($1)._load();
  34812. }, function($ctx1) {$ctx1.fill(self,"loadFromNamespace:",{aString:aString})});
  34813. },
  34814. args: ["aString"],
  34815. source: "loadFromNamespace: aString\x0a\x09^ self transport\x0a\x09\x09namespace: aString;\x0a\x09\x09load",
  34816. referencedClasses: [],
  34817. pragmas: [],
  34818. messageSends: ["namespace:", "transport", "load"]
  34819. }),
  34820. $globals.Package);
  34821. $core.addMethod(
  34822. $core.method({
  34823. selector: "load:",
  34824. protocol: "*Platform-ImportExport",
  34825. fn: function (aPackageName){
  34826. var self=this,$self=this;
  34827. return $core.withContext(function($ctx1) {
  34828. return $recv($self._named_(aPackageName))._load();
  34829. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackageName:aPackageName})});
  34830. },
  34831. args: ["aPackageName"],
  34832. source: "load: aPackageName\x0a\x09^ (self named: aPackageName) load",
  34833. referencedClasses: [],
  34834. pragmas: [],
  34835. messageSends: ["load", "named:"]
  34836. }),
  34837. $globals.Package.a$cls);
  34838. $core.addMethod(
  34839. $core.method({
  34840. selector: "load:fromNamespace:",
  34841. protocol: "*Platform-ImportExport",
  34842. fn: function (aPackageName,aString){
  34843. var self=this,$self=this;
  34844. return $core.withContext(function($ctx1) {
  34845. return $recv($self._named_(aPackageName))._loadFromNamespace_(aString);
  34846. }, function($ctx1) {$ctx1.fill(self,"load:fromNamespace:",{aPackageName:aPackageName,aString:aString})});
  34847. },
  34848. args: ["aPackageName", "aString"],
  34849. source: "load: aPackageName fromNamespace: aString\x0a\x09^ (self named: aPackageName) loadFromNamespace: aString",
  34850. referencedClasses: [],
  34851. pragmas: [],
  34852. messageSends: ["loadFromNamespace:", "named:"]
  34853. }),
  34854. $globals.Package.a$cls);
  34855. $core.addMethod(
  34856. $core.method({
  34857. selector: "methodsFor:",
  34858. protocol: "*Platform-ImportExport",
  34859. fn: function (aString){
  34860. var self=this,$self=this;
  34861. return $core.withContext(function($ctx1) {
  34862. var $1;
  34863. $1=$recv($globals.ClassProtocolReader)._new();
  34864. $recv($1)._class_category_(self,aString);
  34865. return $recv($1)._yourself();
  34866. }, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString})});
  34867. },
  34868. args: ["aString"],
  34869. source: "methodsFor: aString\x0a\x09^ ClassProtocolReader new\x0a\x09\x09class: self category: aString;\x0a\x09\x09yourself",
  34870. referencedClasses: ["ClassProtocolReader"],
  34871. pragmas: [],
  34872. messageSends: ["class:category:", "new", "yourself"]
  34873. }),
  34874. $globals.TBehaviorProvider);
  34875. $core.addMethod(
  34876. $core.method({
  34877. selector: "methodsFor:stamp:",
  34878. protocol: "*Platform-ImportExport",
  34879. fn: function (aString,aStamp){
  34880. var self=this,$self=this;
  34881. return $core.withContext(function($ctx1) {
  34882. return $self._methodsFor_(aString);
  34883. }, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp})});
  34884. },
  34885. args: ["aString", "aStamp"],
  34886. source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for file-in compatibility, ignores stamp.\x22\x0a\x09^ self methodsFor: aString",
  34887. referencedClasses: [],
  34888. pragmas: [],
  34889. messageSends: ["methodsFor:"]
  34890. }),
  34891. $globals.TBehaviorProvider);
  34892. $core.addMethod(
  34893. $core.method({
  34894. selector: "commentStamp",
  34895. protocol: "*Platform-ImportExport",
  34896. fn: function (){
  34897. var self=this,$self=this;
  34898. return $core.withContext(function($ctx1) {
  34899. var $1;
  34900. $1=$recv($globals.ClassCommentReader)._new();
  34901. $recv($1)._class_(self);
  34902. return $recv($1)._yourself();
  34903. }, function($ctx1) {$ctx1.fill(self,"commentStamp",{})});
  34904. },
  34905. args: [],
  34906. source: "commentStamp\x0a\x09^ ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
  34907. referencedClasses: ["ClassCommentReader"],
  34908. pragmas: [],
  34909. messageSends: ["class:", "new", "yourself"]
  34910. }),
  34911. $globals.TMasterBehavior);
  34912. $core.addMethod(
  34913. $core.method({
  34914. selector: "commentStamp:prior:",
  34915. protocol: "*Platform-ImportExport",
  34916. fn: function (aStamp,prior){
  34917. var self=this,$self=this;
  34918. return $core.withContext(function($ctx1) {
  34919. return $self._commentStamp();
  34920. }, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior})});
  34921. },
  34922. args: ["aStamp", "prior"],
  34923. source: "commentStamp: aStamp prior: prior\x0a\x09\x09^ self commentStamp",
  34924. referencedClasses: [],
  34925. pragmas: [],
  34926. messageSends: ["commentStamp"]
  34927. }),
  34928. $globals.TMasterBehavior);
  34929. $core.addMethod(
  34930. $core.method({
  34931. selector: "exportBehaviorDefinitionTo:using:",
  34932. protocol: "*Platform-ImportExport",
  34933. fn: function (aStream,anExporter){
  34934. var self=this,$self=this;
  34935. return $core.withContext(function($ctx1) {
  34936. $recv(anExporter)._exportTraitDefinitionOf_on_(self,aStream);
  34937. return self;
  34938. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter})});
  34939. },
  34940. args: ["aStream", "anExporter"],
  34941. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportTraitDefinitionOf: self on: aStream",
  34942. referencedClasses: [],
  34943. pragmas: [],
  34944. messageSends: ["exportTraitDefinitionOf:on:"]
  34945. }),
  34946. $globals.Trait);
  34947. });
  34948. define('amber/core/Compiler-Core',["amber/boot", "require", "amber/core/Kernel-Collections", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  34949. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  34950. var $pkg = $core.addPackage("Compiler-Core");
  34951. $pkg.innerEval = function (expr) { return eval(expr); };
  34952. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  34953. $core.addClass("AbstractCodeGenerator", $globals.Object, ["currentClass", "currentPackage", "source"], "Compiler-Core");
  34954. $globals.AbstractCodeGenerator.comment="I am the abstract super class of all code generators and provide their common API.";
  34955. $core.addMethod(
  34956. $core.method({
  34957. selector: "compileNode:",
  34958. protocol: "compiling",
  34959. fn: function (aNode){
  34960. var self=this,$self=this;
  34961. return $core.withContext(function($ctx1) {
  34962. return $recv($self._transformers())._inject_into_(aNode,(function(input,transformer){
  34963. return $core.withContext(function($ctx2) {
  34964. return $recv(transformer)._value_(input);
  34965. }, function($ctx2) {$ctx2.fillBlock({input:input,transformer:transformer},$ctx1,1)});
  34966. }));
  34967. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode})});
  34968. },
  34969. args: ["aNode"],
  34970. source: "compileNode: aNode\x0a\x09^ self transformers\x0a\x09\x09inject: aNode\x0a\x09\x09into: [ :input :transformer | transformer value: input ]",
  34971. referencedClasses: [],
  34972. pragmas: [],
  34973. messageSends: ["inject:into:", "transformers", "value:"]
  34974. }),
  34975. $globals.AbstractCodeGenerator);
  34976. $core.addMethod(
  34977. $core.method({
  34978. selector: "currentClass",
  34979. protocol: "accessing",
  34980. fn: function (){
  34981. var self=this,$self=this;
  34982. return $self.currentClass;
  34983. },
  34984. args: [],
  34985. source: "currentClass\x0a\x09^ currentClass",
  34986. referencedClasses: [],
  34987. pragmas: [],
  34988. messageSends: []
  34989. }),
  34990. $globals.AbstractCodeGenerator);
  34991. $core.addMethod(
  34992. $core.method({
  34993. selector: "currentClass:",
  34994. protocol: "accessing",
  34995. fn: function (aClass){
  34996. var self=this,$self=this;
  34997. $self.currentClass=aClass;
  34998. return self;
  34999. },
  35000. args: ["aClass"],
  35001. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  35002. referencedClasses: [],
  35003. pragmas: [],
  35004. messageSends: []
  35005. }),
  35006. $globals.AbstractCodeGenerator);
  35007. $core.addMethod(
  35008. $core.method({
  35009. selector: "currentPackage",
  35010. protocol: "accessing",
  35011. fn: function (){
  35012. var self=this,$self=this;
  35013. return $self.currentPackage;
  35014. },
  35015. args: [],
  35016. source: "currentPackage\x0a\x09^ currentPackage",
  35017. referencedClasses: [],
  35018. pragmas: [],
  35019. messageSends: []
  35020. }),
  35021. $globals.AbstractCodeGenerator);
  35022. $core.addMethod(
  35023. $core.method({
  35024. selector: "currentPackage:",
  35025. protocol: "accessing",
  35026. fn: function (anObject){
  35027. var self=this,$self=this;
  35028. $self.currentPackage=anObject;
  35029. return self;
  35030. },
  35031. args: ["anObject"],
  35032. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  35033. referencedClasses: [],
  35034. pragmas: [],
  35035. messageSends: []
  35036. }),
  35037. $globals.AbstractCodeGenerator);
  35038. $core.addMethod(
  35039. $core.method({
  35040. selector: "pseudoVariables",
  35041. protocol: "accessing",
  35042. fn: function (){
  35043. var self=this,$self=this;
  35044. return $core.withContext(function($ctx1) {
  35045. return $recv($globals.Smalltalk)._pseudoVariableNames();
  35046. }, function($ctx1) {$ctx1.fill(self,"pseudoVariables",{})});
  35047. },
  35048. args: [],
  35049. source: "pseudoVariables\x0a\x09^ Smalltalk pseudoVariableNames",
  35050. referencedClasses: ["Smalltalk"],
  35051. pragmas: [],
  35052. messageSends: ["pseudoVariableNames"]
  35053. }),
  35054. $globals.AbstractCodeGenerator);
  35055. $core.addMethod(
  35056. $core.method({
  35057. selector: "source",
  35058. protocol: "accessing",
  35059. fn: function (){
  35060. var self=this,$self=this;
  35061. return $core.withContext(function($ctx1) {
  35062. var $1,$receiver;
  35063. $1=$self.source;
  35064. if(($receiver = $1) == null || $receiver.a$nil){
  35065. return "";
  35066. } else {
  35067. return $1;
  35068. }
  35069. }, function($ctx1) {$ctx1.fill(self,"source",{})});
  35070. },
  35071. args: [],
  35072. source: "source\x0a\x09^ source ifNil: [ '' ]",
  35073. referencedClasses: [],
  35074. pragmas: [],
  35075. messageSends: ["ifNil:"]
  35076. }),
  35077. $globals.AbstractCodeGenerator);
  35078. $core.addMethod(
  35079. $core.method({
  35080. selector: "source:",
  35081. protocol: "accessing",
  35082. fn: function (aString){
  35083. var self=this,$self=this;
  35084. $self.source=aString;
  35085. return self;
  35086. },
  35087. args: ["aString"],
  35088. source: "source: aString\x0a\x09source := aString",
  35089. referencedClasses: [],
  35090. pragmas: [],
  35091. messageSends: []
  35092. }),
  35093. $globals.AbstractCodeGenerator);
  35094. $core.addMethod(
  35095. $core.method({
  35096. selector: "transformers",
  35097. protocol: "compiling",
  35098. fn: function (){
  35099. var self=this,$self=this;
  35100. var dict;
  35101. return $core.withContext(function($ctx1) {
  35102. dict=$self._transformersDictionary();
  35103. return $recv($recv($recv($recv(dict)._keys())._asArray())._sort())._collect_((function(each){
  35104. return $core.withContext(function($ctx2) {
  35105. return $recv(dict)._at_(each);
  35106. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35107. }));
  35108. }, function($ctx1) {$ctx1.fill(self,"transformers",{dict:dict})});
  35109. },
  35110. args: [],
  35111. source: "transformers\x0a\x09| dict |\x0a\x09dict := self transformersDictionary.\x0a\x09^ dict keys asArray sort collect: [ :each | dict at: each ]",
  35112. referencedClasses: [],
  35113. pragmas: [],
  35114. messageSends: ["transformersDictionary", "collect:", "sort", "asArray", "keys", "at:"]
  35115. }),
  35116. $globals.AbstractCodeGenerator);
  35117. $core.addMethod(
  35118. $core.method({
  35119. selector: "transformersDictionary",
  35120. protocol: "compiling",
  35121. fn: function (){
  35122. var self=this,$self=this;
  35123. return $core.withContext(function($ctx1) {
  35124. $self._subclassResponsibility();
  35125. return self;
  35126. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{})});
  35127. },
  35128. args: [],
  35129. source: "transformersDictionary\x0a\x09self subclassResponsibility",
  35130. referencedClasses: [],
  35131. pragmas: [],
  35132. messageSends: ["subclassResponsibility"]
  35133. }),
  35134. $globals.AbstractCodeGenerator);
  35135. $core.addClass("CodeGenerator", $globals.AbstractCodeGenerator, ["transformersDictionary"], "Compiler-Core");
  35136. $globals.CodeGenerator.comment="I am a basic code generator. I generate a valid JavaScript output, but no not perform any inlining.\x0aSee `InliningCodeGenerator` for an optimized JavaScript code generation.";
  35137. $core.addMethod(
  35138. $core.method({
  35139. selector: "earlyAstPragmator",
  35140. protocol: "compiling",
  35141. fn: function (){
  35142. var self=this,$self=this;
  35143. return $core.withContext(function($ctx1) {
  35144. return $recv($globals.AstEarlyPragmator)._new();
  35145. }, function($ctx1) {$ctx1.fill(self,"earlyAstPragmator",{})});
  35146. },
  35147. args: [],
  35148. source: "earlyAstPragmator\x0a\x09^ AstEarlyPragmator new",
  35149. referencedClasses: ["AstEarlyPragmator"],
  35150. pragmas: [],
  35151. messageSends: ["new"]
  35152. }),
  35153. $globals.CodeGenerator);
  35154. $core.addMethod(
  35155. $core.method({
  35156. selector: "irTranslator",
  35157. protocol: "compiling",
  35158. fn: function (){
  35159. var self=this,$self=this;
  35160. return $core.withContext(function($ctx1) {
  35161. var $1;
  35162. $1=$recv($self._irTranslatorClass())._new();
  35163. $recv($1)._currentClass_($self._currentClass());
  35164. return $recv($1)._yourself();
  35165. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{})});
  35166. },
  35167. args: [],
  35168. source: "irTranslator\x0a\x09^ self irTranslatorClass new\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09yourself",
  35169. referencedClasses: [],
  35170. pragmas: [],
  35171. messageSends: ["currentClass:", "new", "irTranslatorClass", "currentClass", "yourself"]
  35172. }),
  35173. $globals.CodeGenerator);
  35174. $core.addMethod(
  35175. $core.method({
  35176. selector: "irTranslatorClass",
  35177. protocol: "compiling",
  35178. fn: function (){
  35179. var self=this,$self=this;
  35180. return $globals.IRJSTranslator;
  35181. },
  35182. args: [],
  35183. source: "irTranslatorClass\x0a\x09^ IRJSTranslator",
  35184. referencedClasses: ["IRJSTranslator"],
  35185. pragmas: [],
  35186. messageSends: []
  35187. }),
  35188. $globals.CodeGenerator);
  35189. $core.addMethod(
  35190. $core.method({
  35191. selector: "semanticAnalyzer",
  35192. protocol: "compiling",
  35193. fn: function (){
  35194. var self=this,$self=this;
  35195. return $core.withContext(function($ctx1) {
  35196. var $1;
  35197. $1=$recv($globals.SemanticAnalyzer)._on_($self._currentClass());
  35198. $recv($1)._thePackage_($self._currentPackage());
  35199. return $recv($1)._yourself();
  35200. }, function($ctx1) {$ctx1.fill(self,"semanticAnalyzer",{})});
  35201. },
  35202. args: [],
  35203. source: "semanticAnalyzer\x0a\x09^ (SemanticAnalyzer on: self currentClass)\x0a\x09\x09thePackage: self currentPackage;\x0a\x09\x09yourself",
  35204. referencedClasses: ["SemanticAnalyzer"],
  35205. pragmas: [],
  35206. messageSends: ["thePackage:", "on:", "currentClass", "currentPackage", "yourself"]
  35207. }),
  35208. $globals.CodeGenerator);
  35209. $core.addMethod(
  35210. $core.method({
  35211. selector: "transformersDictionary",
  35212. protocol: "compiling",
  35213. fn: function (){
  35214. var self=this,$self=this;
  35215. return $core.withContext(function($ctx1) {
  35216. var $1,$2,$receiver;
  35217. $1=$self.transformersDictionary;
  35218. if(($receiver = $1) == null || $receiver.a$nil){
  35219. $2=$recv($globals.Dictionary)._new();
  35220. $recv($2)._at_put_("1000-earlyPragmas",$self._earlyAstPragmator());
  35221. $ctx1.sendIdx["at:put:"]=1;
  35222. $recv($2)._at_put_("2000-semantic",$self._semanticAnalyzer());
  35223. $ctx1.sendIdx["at:put:"]=2;
  35224. $recv($2)._at_put_("5000-astToIr",$self._translator());
  35225. $ctx1.sendIdx["at:put:"]=3;
  35226. $recv($2)._at_put_("8000-irToJs",$self._irTranslator());
  35227. $self.transformersDictionary=$recv($2)._yourself();
  35228. return $self.transformersDictionary;
  35229. } else {
  35230. return $1;
  35231. }
  35232. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{})});
  35233. },
  35234. args: [],
  35235. source: "transformersDictionary\x0a\x09^ transformersDictionary ifNil: [ transformersDictionary := Dictionary new\x0a\x09\x09at: '1000-earlyPragmas' put: self earlyAstPragmator;\x0a\x09\x09at: '2000-semantic' put: self semanticAnalyzer;\x0a\x09\x09at: '5000-astToIr' put: self translator;\x0a\x09\x09at: '8000-irToJs' put: self irTranslator;\x0a\x09\x09yourself ]",
  35236. referencedClasses: ["Dictionary"],
  35237. pragmas: [],
  35238. messageSends: ["ifNil:", "at:put:", "new", "earlyAstPragmator", "semanticAnalyzer", "translator", "irTranslator", "yourself"]
  35239. }),
  35240. $globals.CodeGenerator);
  35241. $core.addMethod(
  35242. $core.method({
  35243. selector: "translator",
  35244. protocol: "compiling",
  35245. fn: function (){
  35246. var self=this,$self=this;
  35247. return $core.withContext(function($ctx1) {
  35248. var $1;
  35249. $1=$recv($globals.IRASTTranslator)._new();
  35250. $recv($1)._source_($self._source());
  35251. $recv($1)._theClass_($self._currentClass());
  35252. return $recv($1)._yourself();
  35253. }, function($ctx1) {$ctx1.fill(self,"translator",{})});
  35254. },
  35255. args: [],
  35256. source: "translator\x0a\x09^ IRASTTranslator new\x0a\x09\x09source: self source;\x0a\x09\x09theClass: self currentClass;\x0a\x09\x09yourself",
  35257. referencedClasses: ["IRASTTranslator"],
  35258. pragmas: [],
  35259. messageSends: ["source:", "new", "source", "theClass:", "currentClass", "yourself"]
  35260. }),
  35261. $globals.CodeGenerator);
  35262. $core.addClass("Compiler", $globals.Object, ["currentClass", "currentPackage", "source", "codeGeneratorClass", "codeGenerator"], "Compiler-Core");
  35263. $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`";
  35264. $core.addMethod(
  35265. $core.method({
  35266. selector: "ast:forClass:protocol:",
  35267. protocol: "compiling",
  35268. fn: function (aString,aClass,anotherString){
  35269. var self=this,$self=this;
  35270. return $core.withContext(function($ctx1) {
  35271. var $early={};
  35272. try {
  35273. $self._source_(aString);
  35274. $self._forClass_protocol_(aClass,anotherString);
  35275. $recv($recv($self._codeGenerator())._transformersDictionary())._at_put_("2500-astCheckpoint",(function(x){
  35276. throw $early=[x];
  35277. }));
  35278. $self._compileNode_($self._parse_(aString));
  35279. $recv($globals.CompilerError)._signal_("AST transformation failed.");
  35280. return self;
  35281. }
  35282. catch(e) {if(e===$early)return e[0]; throw e}
  35283. }, function($ctx1) {$ctx1.fill(self,"ast:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString})});
  35284. },
  35285. args: ["aString", "aClass", "anotherString"],
  35286. source: "ast: aString forClass: aClass protocol: anotherString\x0a\x09self\x0a\x09\x09source: aString;\x0a\x09\x09forClass: aClass protocol: anotherString.\x0a\x0a\x09self codeGenerator transformersDictionary at: '2500-astCheckpoint' put: [ :x | ^x ].\x0a\x09\x0a\x09self compileNode: (self parse: aString).\x0a\x0a\x09CompilerError signal: 'AST transformation failed.'",
  35287. referencedClasses: ["CompilerError"],
  35288. pragmas: [],
  35289. messageSends: ["source:", "forClass:protocol:", "at:put:", "transformersDictionary", "codeGenerator", "compileNode:", "parse:", "signal:"]
  35290. }),
  35291. $globals.Compiler);
  35292. $core.addMethod(
  35293. $core.method({
  35294. selector: "cleanCodeGenerator",
  35295. protocol: "accessing",
  35296. fn: function (){
  35297. var self=this,$self=this;
  35298. $self.codeGenerator=nil;
  35299. return self;
  35300. },
  35301. args: [],
  35302. source: "cleanCodeGenerator\x0a\x09codeGenerator := nil",
  35303. referencedClasses: [],
  35304. pragmas: [],
  35305. messageSends: []
  35306. }),
  35307. $globals.Compiler);
  35308. $core.addMethod(
  35309. $core.method({
  35310. selector: "codeGenerator",
  35311. protocol: "accessing",
  35312. fn: function (){
  35313. var self=this,$self=this;
  35314. return $core.withContext(function($ctx1) {
  35315. var $1,$2,$receiver;
  35316. $1=$self.codeGenerator;
  35317. if(($receiver = $1) == null || $receiver.a$nil){
  35318. $2=$recv($self._codeGeneratorClass())._new();
  35319. $recv($2)._source_($self._source());
  35320. $recv($2)._currentClass_($self._currentClass());
  35321. $recv($2)._currentPackage_($self._currentPackage());
  35322. $self.codeGenerator=$recv($2)._yourself();
  35323. return $self.codeGenerator;
  35324. } else {
  35325. return $1;
  35326. }
  35327. }, function($ctx1) {$ctx1.fill(self,"codeGenerator",{})});
  35328. },
  35329. args: [],
  35330. source: "codeGenerator\x0a\x09^ codeGenerator ifNil: [ codeGenerator := self codeGeneratorClass new\x0a\x09\x09\x09source: self source;\x0a\x09\x09\x09currentClass: self currentClass;\x0a\x09\x09\x09currentPackage: self currentPackage;\x0a\x09\x09\x09yourself ]",
  35331. referencedClasses: [],
  35332. pragmas: [],
  35333. messageSends: ["ifNil:", "source:", "new", "codeGeneratorClass", "source", "currentClass:", "currentClass", "currentPackage:", "currentPackage", "yourself"]
  35334. }),
  35335. $globals.Compiler);
  35336. $core.addMethod(
  35337. $core.method({
  35338. selector: "codeGeneratorClass",
  35339. protocol: "accessing",
  35340. fn: function (){
  35341. var self=this,$self=this;
  35342. return $core.withContext(function($ctx1) {
  35343. var $1,$receiver;
  35344. $1=$self.codeGeneratorClass;
  35345. if(($receiver = $1) == null || $receiver.a$nil){
  35346. return $globals.InliningCodeGenerator;
  35347. } else {
  35348. return $1;
  35349. }
  35350. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{})});
  35351. },
  35352. args: [],
  35353. source: "codeGeneratorClass\x0a\x09^ codeGeneratorClass ifNil: [ InliningCodeGenerator ]",
  35354. referencedClasses: ["InliningCodeGenerator"],
  35355. pragmas: [],
  35356. messageSends: ["ifNil:"]
  35357. }),
  35358. $globals.Compiler);
  35359. $core.addMethod(
  35360. $core.method({
  35361. selector: "codeGeneratorClass:",
  35362. protocol: "accessing",
  35363. fn: function (aClass){
  35364. var self=this,$self=this;
  35365. $self.codeGeneratorClass=aClass;
  35366. return self;
  35367. },
  35368. args: ["aClass"],
  35369. source: "codeGeneratorClass: aClass\x0a\x09codeGeneratorClass := aClass",
  35370. referencedClasses: [],
  35371. pragmas: [],
  35372. messageSends: []
  35373. }),
  35374. $globals.Compiler);
  35375. $core.addMethod(
  35376. $core.method({
  35377. selector: "compile:forClass:protocol:",
  35378. protocol: "compiling",
  35379. fn: function (aString,aClass,anotherString){
  35380. var self=this,$self=this;
  35381. var compilationResult,result,pragmas,closure;
  35382. return $core.withContext(function($ctx1) {
  35383. var $1,$2;
  35384. compilationResult=$self._compileSource_forClass_protocol_(aString,aClass,anotherString);
  35385. pragmas=$recv(compilationResult)._at_("pragmas");
  35386. $ctx1.sendIdx["at:"]=1;
  35387. closure=$self._eval_forPackage_($recv(compilationResult)._at_("fn"),$self._currentPackage());
  35388. $1=compilationResult;
  35389. $recv($1)._removeKey_("fn");
  35390. $ctx1.sendIdx["removeKey:"]=1;
  35391. $recv($1)._removeKey_("pragmas");
  35392. result=$recv($recv($globals.Smalltalk)._core())._method_(compilationResult);
  35393. $2=result;
  35394. $recv($2)._protocol_(anotherString);
  35395. $recv($2)._pragmas_(pragmas);
  35396. $recv($2)._fn_(closure);
  35397. return result;
  35398. }, function($ctx1) {$ctx1.fill(self,"compile:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString,compilationResult:compilationResult,result:result,pragmas:pragmas,closure:closure})});
  35399. },
  35400. args: ["aString", "aClass", "anotherString"],
  35401. source: "compile: aString forClass: aClass protocol: anotherString\x0a\x09| compilationResult result pragmas closure |\x0a\x09compilationResult :=\x0a\x09\x09self compileSource: aString forClass: aClass protocol: anotherString.\x0a\x09pragmas := compilationResult at: #pragmas.\x0a\x09closure := self eval: (compilationResult at: #fn) forPackage: self currentPackage.\x0a\x09compilationResult removeKey: #fn; removeKey: #pragmas.\x0a\x09result := Smalltalk core method: compilationResult.\x0a\x09result protocol: anotherString; pragmas: pragmas; fn: closure.\x0a\x09^ result",
  35402. referencedClasses: ["Smalltalk"],
  35403. pragmas: [],
  35404. messageSends: ["compileSource:forClass:protocol:", "at:", "eval:forPackage:", "currentPackage", "removeKey:", "method:", "core", "protocol:", "pragmas:", "fn:"]
  35405. }),
  35406. $globals.Compiler);
  35407. $core.addMethod(
  35408. $core.method({
  35409. selector: "compileExpression:on:",
  35410. protocol: "compiling",
  35411. fn: function (aString,anObject){
  35412. var self=this,$self=this;
  35413. return $core.withContext(function($ctx1) {
  35414. var $1;
  35415. $1=$recv("xxxDoIt ^ [ ".__comma(aString)).__comma(" ] value");
  35416. $ctx1.sendIdx[","]=1;
  35417. return $self._compile_forClass_protocol_($1,$recv(anObject)._class(),"**xxxDoIt");
  35418. }, function($ctx1) {$ctx1.fill(self,"compileExpression:on:",{aString:aString,anObject:anObject})});
  35419. },
  35420. args: ["aString", "anObject"],
  35421. source: "compileExpression: aString on: anObject\x0a\x09^ self\x0a\x09\x09compile: 'xxxDoIt ^ [ ', aString, ' ] value'\x0a\x09\x09forClass: anObject class\x0a\x09\x09protocol: '**xxxDoIt'",
  35422. referencedClasses: [],
  35423. pragmas: [],
  35424. messageSends: ["compile:forClass:protocol:", ",", "class"]
  35425. }),
  35426. $globals.Compiler);
  35427. $core.addMethod(
  35428. $core.method({
  35429. selector: "compileNode:",
  35430. protocol: "compiling",
  35431. fn: function (aNode){
  35432. var self=this,$self=this;
  35433. var result;
  35434. return $core.withContext(function($ctx1) {
  35435. result=$recv($self._codeGenerator())._compileNode_(aNode);
  35436. $self._cleanCodeGenerator();
  35437. return result;
  35438. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,result:result})});
  35439. },
  35440. args: ["aNode"],
  35441. source: "compileNode: aNode\x0a | result |\x0a\x09result := self codeGenerator compileNode: aNode.\x0a\x09self cleanCodeGenerator.\x0a\x09^ result",
  35442. referencedClasses: [],
  35443. pragmas: [],
  35444. messageSends: ["compileNode:", "codeGenerator", "cleanCodeGenerator"]
  35445. }),
  35446. $globals.Compiler);
  35447. $core.addMethod(
  35448. $core.method({
  35449. selector: "compileSource:forClass:protocol:",
  35450. protocol: "compiling",
  35451. fn: function (aString,aClass,anotherString){
  35452. var self=this,$self=this;
  35453. return $core.withContext(function($ctx1) {
  35454. $self._source_(aString);
  35455. $self._forClass_protocol_(aClass,anotherString);
  35456. return $self._compileNode_($self._parse_(aString));
  35457. }, function($ctx1) {$ctx1.fill(self,"compileSource:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString})});
  35458. },
  35459. args: ["aString", "aClass", "anotherString"],
  35460. source: "compileSource: aString forClass: aClass protocol: anotherString\x0a\x09^ self\x0a\x09\x09source: aString;\x0a\x09\x09forClass: aClass protocol: anotherString;\x0a\x09\x09compileNode: (self parse: aString)",
  35461. referencedClasses: [],
  35462. pragmas: [],
  35463. messageSends: ["source:", "forClass:protocol:", "compileNode:", "parse:"]
  35464. }),
  35465. $globals.Compiler);
  35466. $core.addMethod(
  35467. $core.method({
  35468. selector: "currentClass",
  35469. protocol: "accessing",
  35470. fn: function (){
  35471. var self=this,$self=this;
  35472. return $self.currentClass;
  35473. },
  35474. args: [],
  35475. source: "currentClass\x0a\x09^ currentClass",
  35476. referencedClasses: [],
  35477. pragmas: [],
  35478. messageSends: []
  35479. }),
  35480. $globals.Compiler);
  35481. $core.addMethod(
  35482. $core.method({
  35483. selector: "currentClass:",
  35484. protocol: "accessing",
  35485. fn: function (aClass){
  35486. var self=this,$self=this;
  35487. $self.currentClass=aClass;
  35488. return self;
  35489. },
  35490. args: ["aClass"],
  35491. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  35492. referencedClasses: [],
  35493. pragmas: [],
  35494. messageSends: []
  35495. }),
  35496. $globals.Compiler);
  35497. $core.addMethod(
  35498. $core.method({
  35499. selector: "currentPackage",
  35500. protocol: "accessing",
  35501. fn: function (){
  35502. var self=this,$self=this;
  35503. return $self.currentPackage;
  35504. },
  35505. args: [],
  35506. source: "currentPackage\x0a\x09^ currentPackage",
  35507. referencedClasses: [],
  35508. pragmas: [],
  35509. messageSends: []
  35510. }),
  35511. $globals.Compiler);
  35512. $core.addMethod(
  35513. $core.method({
  35514. selector: "currentPackage:",
  35515. protocol: "accessing",
  35516. fn: function (anObject){
  35517. var self=this,$self=this;
  35518. $self.currentPackage=anObject;
  35519. return self;
  35520. },
  35521. args: ["anObject"],
  35522. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  35523. referencedClasses: [],
  35524. pragmas: [],
  35525. messageSends: []
  35526. }),
  35527. $globals.Compiler);
  35528. $core.addMethod(
  35529. $core.method({
  35530. selector: "eval:",
  35531. protocol: "compiling",
  35532. fn: function (aString){
  35533. var self=this,$self=this;
  35534. return $core.withContext(function($ctx1) {
  35535. return eval(aString);
  35536. return self;
  35537. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString})});
  35538. },
  35539. args: ["aString"],
  35540. source: "eval: aString\x0a\x09<inlineJS: 'return eval(aString)'>",
  35541. referencedClasses: [],
  35542. pragmas: [["inlineJS:", ["return eval(aString)"]]],
  35543. messageSends: []
  35544. }),
  35545. $globals.Compiler);
  35546. $core.addMethod(
  35547. $core.method({
  35548. selector: "eval:forPackage:",
  35549. protocol: "compiling",
  35550. fn: function (aString,aPackage){
  35551. var self=this,$self=this;
  35552. return $core.withContext(function($ctx1) {
  35553. var $receiver;
  35554. if(($receiver = aPackage) == null || $receiver.a$nil){
  35555. return $self._eval_(aString);
  35556. $ctx1.sendIdx["eval:"]=1;
  35557. } else {
  35558. return $recv(aPackage)._eval_(aString);
  35559. }
  35560. }, function($ctx1) {$ctx1.fill(self,"eval:forPackage:",{aString:aString,aPackage:aPackage})});
  35561. },
  35562. args: ["aString", "aPackage"],
  35563. source: "eval: aString forPackage: aPackage\x0a\x09^ aPackage\x0a\x09\x09ifNil: [ self eval: aString ]\x0a\x09\x09ifNotNil: [ aPackage eval: aString ]",
  35564. referencedClasses: [],
  35565. pragmas: [],
  35566. messageSends: ["ifNil:ifNotNil:", "eval:"]
  35567. }),
  35568. $globals.Compiler);
  35569. $core.addMethod(
  35570. $core.method({
  35571. selector: "evaluateExpression:",
  35572. protocol: "compiling",
  35573. fn: function (aString){
  35574. var self=this,$self=this;
  35575. return $core.withContext(function($ctx1) {
  35576. return $self._evaluateExpression_on_(aString,$recv($globals.DoIt)._new());
  35577. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:",{aString:aString})});
  35578. },
  35579. args: ["aString"],
  35580. 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",
  35581. referencedClasses: ["DoIt"],
  35582. pragmas: [],
  35583. messageSends: ["evaluateExpression:on:", "new"]
  35584. }),
  35585. $globals.Compiler);
  35586. $core.addMethod(
  35587. $core.method({
  35588. selector: "evaluateExpression:on:",
  35589. protocol: "compiling",
  35590. fn: function (aString,anObject){
  35591. var self=this,$self=this;
  35592. var result,method;
  35593. return $core.withContext(function($ctx1) {
  35594. var $1;
  35595. method=$self._compileExpression_on_(aString,anObject);
  35596. $1=$recv(anObject)._class();
  35597. $ctx1.sendIdx["class"]=1;
  35598. $recv($1)._addCompiledMethod_(method);
  35599. result=$recv(anObject)._xxxDoIt();
  35600. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  35601. return result;
  35602. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:on:",{aString:aString,anObject:anObject,result:result,method:method})});
  35603. },
  35604. args: ["aString", "anObject"],
  35605. 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 compileExpression: aString on: anObject.\x0a\x09anObject class addCompiledMethod: method.\x0a\x09result := anObject xxxDoIt.\x0a\x09anObject class removeCompiledMethod: method.\x0a\x09^ result",
  35606. referencedClasses: [],
  35607. pragmas: [],
  35608. messageSends: ["compileExpression:on:", "addCompiledMethod:", "class", "xxxDoIt", "removeCompiledMethod:"]
  35609. }),
  35610. $globals.Compiler);
  35611. $core.addMethod(
  35612. $core.method({
  35613. selector: "forClass:protocol:",
  35614. protocol: "compiling",
  35615. fn: function (aClass,anotherString){
  35616. var self=this,$self=this;
  35617. return $core.withContext(function($ctx1) {
  35618. $self._currentPackage_($recv(aClass)._packageOfProtocol_(anotherString));
  35619. $self._currentClass_(aClass);
  35620. return self;
  35621. }, function($ctx1) {$ctx1.fill(self,"forClass:protocol:",{aClass:aClass,anotherString:anotherString})});
  35622. },
  35623. args: ["aClass", "anotherString"],
  35624. source: "forClass: aClass protocol: anotherString\x0a\x09self\x0a\x09\x09currentPackage: (aClass packageOfProtocol: anotherString);\x0a\x09\x09currentClass: aClass",
  35625. referencedClasses: [],
  35626. pragmas: [],
  35627. messageSends: ["currentPackage:", "packageOfProtocol:", "currentClass:"]
  35628. }),
  35629. $globals.Compiler);
  35630. $core.addMethod(
  35631. $core.method({
  35632. selector: "install:forClass:protocol:",
  35633. protocol: "compiling",
  35634. fn: function (aString,aBehavior,anotherString){
  35635. var self=this,$self=this;
  35636. var compiledMethod;
  35637. return $core.withContext(function($ctx1) {
  35638. compiledMethod=$self._compile_forClass_protocol_(aString,aBehavior,anotherString);
  35639. $recv(aBehavior)._addCompiledMethod_(compiledMethod);
  35640. return compiledMethod;
  35641. }, function($ctx1) {$ctx1.fill(self,"install:forClass:protocol:",{aString:aString,aBehavior:aBehavior,anotherString:anotherString,compiledMethod:compiledMethod})});
  35642. },
  35643. args: ["aString", "aBehavior", "anotherString"],
  35644. 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",
  35645. referencedClasses: [],
  35646. pragmas: [],
  35647. messageSends: ["compile:forClass:protocol:", "addCompiledMethod:"]
  35648. }),
  35649. $globals.Compiler);
  35650. $core.addMethod(
  35651. $core.method({
  35652. selector: "parse:",
  35653. protocol: "compiling",
  35654. fn: function (aString){
  35655. var self=this,$self=this;
  35656. return $core.withContext(function($ctx1) {
  35657. return $recv($globals.Smalltalk)._parse_(aString);
  35658. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString})});
  35659. },
  35660. args: ["aString"],
  35661. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  35662. referencedClasses: ["Smalltalk"],
  35663. pragmas: [],
  35664. messageSends: ["parse:"]
  35665. }),
  35666. $globals.Compiler);
  35667. $core.addMethod(
  35668. $core.method({
  35669. selector: "parseExpression:",
  35670. protocol: "compiling",
  35671. fn: function (aString){
  35672. var self=this,$self=this;
  35673. return $core.withContext(function($ctx1) {
  35674. var $1;
  35675. $1=$recv("doIt ^ [ ".__comma(aString)).__comma(" ] value");
  35676. $ctx1.sendIdx[","]=1;
  35677. return $self._parse_($1);
  35678. }, function($ctx1) {$ctx1.fill(self,"parseExpression:",{aString:aString})});
  35679. },
  35680. args: ["aString"],
  35681. source: "parseExpression: aString\x0a\x09^ self parse: 'doIt ^ [ ', aString, ' ] value'",
  35682. referencedClasses: [],
  35683. pragmas: [],
  35684. messageSends: ["parse:", ","]
  35685. }),
  35686. $globals.Compiler);
  35687. $core.addMethod(
  35688. $core.method({
  35689. selector: "recompile:",
  35690. protocol: "compiling",
  35691. fn: function (aClass){
  35692. var self=this,$self=this;
  35693. return $core.withContext(function($ctx1) {
  35694. var $1;
  35695. $recv(aClass)._includingPossibleMetaDo_((function(eachSide){
  35696. return $core.withContext(function($ctx2) {
  35697. return $recv($recv($recv(eachSide)._methodDictionary())._values())._do_displayingProgress_((function(each){
  35698. return $core.withContext(function($ctx3) {
  35699. $1=$recv($recv(each)._origin()).__eq(eachSide);
  35700. if($core.assert($1)){
  35701. return $self._install_forClass_protocol_($recv(each)._source(),eachSide,$recv(each)._protocol());
  35702. }
  35703. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  35704. }),"Recompiling ".__comma($recv(eachSide)._name()));
  35705. }, function($ctx2) {$ctx2.fillBlock({eachSide:eachSide},$ctx1,1)});
  35706. }));
  35707. return self;
  35708. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass})});
  35709. },
  35710. args: ["aClass"],
  35711. 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 ]",
  35712. referencedClasses: [],
  35713. pragmas: [],
  35714. messageSends: ["includingPossibleMetaDo:", "do:displayingProgress:", "values", "methodDictionary", "ifTrue:", "=", "origin", "install:forClass:protocol:", "source", "protocol", ",", "name"]
  35715. }),
  35716. $globals.Compiler);
  35717. $core.addMethod(
  35718. $core.method({
  35719. selector: "recompileAll",
  35720. protocol: "compiling",
  35721. fn: function (){
  35722. var self=this,$self=this;
  35723. return $core.withContext(function($ctx1) {
  35724. $recv($recv($globals.Smalltalk)._classes())._do_displayingProgress_((function(each){
  35725. return $core.withContext(function($ctx2) {
  35726. return $self._recompile_(each);
  35727. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35728. }),"Compiling all classes...");
  35729. return self;
  35730. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{})});
  35731. },
  35732. args: [],
  35733. source: "recompileAll\x0a\x09Smalltalk classes \x0a\x09\x09do: [ :each | self recompile: each ]\x0a\x09\x09displayingProgress: 'Compiling all classes...'",
  35734. referencedClasses: ["Smalltalk"],
  35735. pragmas: [],
  35736. messageSends: ["do:displayingProgress:", "classes", "recompile:"]
  35737. }),
  35738. $globals.Compiler);
  35739. $core.addMethod(
  35740. $core.method({
  35741. selector: "source",
  35742. protocol: "accessing",
  35743. fn: function (){
  35744. var self=this,$self=this;
  35745. return $core.withContext(function($ctx1) {
  35746. var $1,$receiver;
  35747. $1=$self.source;
  35748. if(($receiver = $1) == null || $receiver.a$nil){
  35749. return "";
  35750. } else {
  35751. return $1;
  35752. }
  35753. }, function($ctx1) {$ctx1.fill(self,"source",{})});
  35754. },
  35755. args: [],
  35756. source: "source\x0a\x09^ source ifNil: [ '' ]",
  35757. referencedClasses: [],
  35758. pragmas: [],
  35759. messageSends: ["ifNil:"]
  35760. }),
  35761. $globals.Compiler);
  35762. $core.addMethod(
  35763. $core.method({
  35764. selector: "source:",
  35765. protocol: "accessing",
  35766. fn: function (aString){
  35767. var self=this,$self=this;
  35768. $self.source=aString;
  35769. return self;
  35770. },
  35771. args: ["aString"],
  35772. source: "source: aString\x0a\x09source := aString",
  35773. referencedClasses: [],
  35774. pragmas: [],
  35775. messageSends: []
  35776. }),
  35777. $globals.Compiler);
  35778. $core.addMethod(
  35779. $core.method({
  35780. selector: "eval:",
  35781. protocol: "evaluating",
  35782. fn: function (aString){
  35783. var self=this,$self=this;
  35784. return $core.withContext(function($ctx1) {
  35785. return $recv($self._new())._eval_(aString);
  35786. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString})});
  35787. },
  35788. args: ["aString"],
  35789. source: "eval: aString\x0a\x09^ self new eval: aString",
  35790. referencedClasses: [],
  35791. pragmas: [],
  35792. messageSends: ["eval:", "new"]
  35793. }),
  35794. $globals.Compiler.a$cls);
  35795. $core.addMethod(
  35796. $core.method({
  35797. selector: "recompile:",
  35798. protocol: "compiling",
  35799. fn: function (aClass){
  35800. var self=this,$self=this;
  35801. return $core.withContext(function($ctx1) {
  35802. $recv($self._new())._recompile_(aClass);
  35803. return self;
  35804. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass})});
  35805. },
  35806. args: ["aClass"],
  35807. source: "recompile: aClass\x0a\x09self new recompile: aClass",
  35808. referencedClasses: [],
  35809. pragmas: [],
  35810. messageSends: ["recompile:", "new"]
  35811. }),
  35812. $globals.Compiler.a$cls);
  35813. $core.addMethod(
  35814. $core.method({
  35815. selector: "recompileAll",
  35816. protocol: "compiling",
  35817. fn: function (){
  35818. var self=this,$self=this;
  35819. return $core.withContext(function($ctx1) {
  35820. $recv($recv($globals.Smalltalk)._classes())._do_((function(each){
  35821. return $core.withContext(function($ctx2) {
  35822. return $self._recompile_(each);
  35823. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35824. }));
  35825. return self;
  35826. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{})});
  35827. },
  35828. args: [],
  35829. source: "recompileAll\x0a\x09Smalltalk classes do: [ :each |\x0a\x09\x09self recompile: each ]",
  35830. referencedClasses: ["Smalltalk"],
  35831. pragmas: [],
  35832. messageSends: ["do:", "classes", "recompile:"]
  35833. }),
  35834. $globals.Compiler.a$cls);
  35835. $core.addClass("DoIt", $globals.Object, [], "Compiler-Core");
  35836. $globals.DoIt.comment="`DoIt` is the class used to compile and evaluate expressions. See `Compiler >> evaluateExpression:`.";
  35837. $core.addClass("Evaluator", $globals.Object, [], "Compiler-Core");
  35838. $globals.Evaluator.comment="I evaluate code against a receiver, dispatching #evaluate:on: to the receiver.";
  35839. $core.addMethod(
  35840. $core.method({
  35841. selector: "evaluate:context:",
  35842. protocol: "evaluating",
  35843. fn: function (aString,aContext){
  35844. var self=this,$self=this;
  35845. var compiler,ast;
  35846. return $core.withContext(function($ctx1) {
  35847. var $1;
  35848. var $early={};
  35849. try {
  35850. compiler=$recv($globals.Compiler)._new();
  35851. $recv((function(){
  35852. return $core.withContext(function($ctx2) {
  35853. ast=$recv(compiler)._parseExpression_(aString);
  35854. return ast;
  35855. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35856. }))._on_do_($globals.Error,(function(ex){
  35857. return $core.withContext(function($ctx2) {
  35858. throw $early=[$recv($globals.Terminal)._alert_($recv(ex)._messageText())];
  35859. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  35860. }));
  35861. $1=$recv($globals.AISemanticAnalyzer)._on_($recv($recv(aContext)._receiver())._class());
  35862. $recv($1)._context_(aContext);
  35863. $recv($1)._visit_(ast);
  35864. return $recv(aContext)._evaluateNode_(ast);
  35865. }
  35866. catch(e) {if(e===$early)return e[0]; throw e}
  35867. }, function($ctx1) {$ctx1.fill(self,"evaluate:context:",{aString:aString,aContext:aContext,compiler:compiler,ast:ast})});
  35868. },
  35869. args: ["aString", "aContext"],
  35870. 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",
  35871. referencedClasses: ["Compiler", "Error", "Terminal", "AISemanticAnalyzer"],
  35872. pragmas: [],
  35873. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "context:", "on:", "class", "receiver", "visit:", "evaluateNode:"]
  35874. }),
  35875. $globals.Evaluator);
  35876. $core.addMethod(
  35877. $core.method({
  35878. selector: "evaluate:for:",
  35879. protocol: "evaluating",
  35880. fn: function (aString,anObject){
  35881. var self=this,$self=this;
  35882. return $core.withContext(function($ctx1) {
  35883. return $recv(anObject)._evaluate_on_(aString,self);
  35884. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject})});
  35885. },
  35886. args: ["aString", "anObject"],
  35887. source: "evaluate: aString for: anObject\x0a\x09^ anObject evaluate: aString on: self",
  35888. referencedClasses: [],
  35889. pragmas: [],
  35890. messageSends: ["evaluate:on:"]
  35891. }),
  35892. $globals.Evaluator);
  35893. $core.addMethod(
  35894. $core.method({
  35895. selector: "evaluate:receiver:",
  35896. protocol: "evaluating",
  35897. fn: function (aString,anObject){
  35898. var self=this,$self=this;
  35899. var compiler;
  35900. return $core.withContext(function($ctx1) {
  35901. var $early={};
  35902. try {
  35903. compiler=$recv($globals.Compiler)._new();
  35904. $recv((function(){
  35905. return $core.withContext(function($ctx2) {
  35906. return $recv(compiler)._parseExpression_(aString);
  35907. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35908. }))._on_do_($globals.Error,(function(ex){
  35909. return $core.withContext(function($ctx2) {
  35910. throw $early=[$recv($globals.Terminal)._alert_($recv(ex)._messageText())];
  35911. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  35912. }));
  35913. return $recv(compiler)._evaluateExpression_on_(aString,anObject);
  35914. }
  35915. catch(e) {if(e===$early)return e[0]; throw e}
  35916. }, function($ctx1) {$ctx1.fill(self,"evaluate:receiver:",{aString:aString,anObject:anObject,compiler:compiler})});
  35917. },
  35918. args: ["aString", "anObject"],
  35919. 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",
  35920. referencedClasses: ["Compiler", "Error", "Terminal"],
  35921. pragmas: [],
  35922. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "evaluateExpression:on:"]
  35923. }),
  35924. $globals.Evaluator);
  35925. $core.addMethod(
  35926. $core.method({
  35927. selector: "evaluate:for:",
  35928. protocol: "instance creation",
  35929. fn: function (aString,anObject){
  35930. var self=this,$self=this;
  35931. return $core.withContext(function($ctx1) {
  35932. return $recv($self._new())._evaluate_for_(aString,anObject);
  35933. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject})});
  35934. },
  35935. args: ["aString", "anObject"],
  35936. source: "evaluate: aString for: anObject\x0a\x09^ self new evaluate: aString for: anObject",
  35937. referencedClasses: [],
  35938. pragmas: [],
  35939. messageSends: ["evaluate:for:", "new"]
  35940. }),
  35941. $globals.Evaluator.a$cls);
  35942. $core.addMethod(
  35943. $core.method({
  35944. selector: "asVariableName",
  35945. protocol: "*Compiler-Core",
  35946. fn: function (){
  35947. var self=this,$self=this;
  35948. return $core.withContext(function($ctx1) {
  35949. var $1;
  35950. $1=$recv($recv($globals.Smalltalk)._reservedWords())._includes_(self);
  35951. if($core.assert($1)){
  35952. return $self.__comma("_");
  35953. } else {
  35954. return self;
  35955. }
  35956. }, function($ctx1) {$ctx1.fill(self,"asVariableName",{})});
  35957. },
  35958. args: [],
  35959. source: "asVariableName\x0a\x09^ (Smalltalk reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]",
  35960. referencedClasses: ["Smalltalk"],
  35961. pragmas: [],
  35962. messageSends: ["ifTrue:ifFalse:", "includes:", "reservedWords", ","]
  35963. }),
  35964. $globals.String);
  35965. });
  35966. define('amber/core/Compiler-AST',["amber/boot", "require", "amber/core/Kernel-Dag", "amber/core/Kernel-Exceptions", "amber/core/Kernel-Helpers", "amber/core/Kernel-Methods"], function($boot,requirejs){"use strict";
  35967. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  35968. var $pkg = $core.addPackage("Compiler-AST");
  35969. $pkg.innerEval = function (expr) { return eval(expr); };
  35970. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  35971. $core.addClass("ASTNode", $globals.DagParentNode, ["parent", "position", "source", "shouldBeAliased"], "Compiler-AST");
  35972. $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.";
  35973. $core.addMethod(
  35974. $core.method({
  35975. selector: "inPosition:",
  35976. protocol: "testing",
  35977. fn: function (aPoint){
  35978. var self=this,$self=this;
  35979. return $core.withContext(function($ctx1) {
  35980. return $recv($recv($self._positionStart()).__lt_eq(aPoint))._and_((function(){
  35981. return $core.withContext(function($ctx2) {
  35982. return $recv($self._positionEnd()).__gt_eq(aPoint);
  35983. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35984. }));
  35985. }, function($ctx1) {$ctx1.fill(self,"inPosition:",{aPoint:aPoint})});
  35986. },
  35987. args: ["aPoint"],
  35988. source: "inPosition: aPoint\x0a\x09^ (self positionStart <= aPoint and: [\x0a\x09\x09self positionEnd >= aPoint ])",
  35989. referencedClasses: [],
  35990. pragmas: [],
  35991. messageSends: ["and:", "<=", "positionStart", ">=", "positionEnd"]
  35992. }),
  35993. $globals.ASTNode);
  35994. $core.addMethod(
  35995. $core.method({
  35996. selector: "isAssignmentNode",
  35997. protocol: "testing",
  35998. fn: function (){
  35999. var self=this,$self=this;
  36000. return false;
  36001. },
  36002. args: [],
  36003. source: "isAssignmentNode\x0a\x09^ false",
  36004. referencedClasses: [],
  36005. pragmas: [],
  36006. messageSends: []
  36007. }),
  36008. $globals.ASTNode);
  36009. $core.addMethod(
  36010. $core.method({
  36011. selector: "isBlockNode",
  36012. protocol: "testing",
  36013. fn: function (){
  36014. var self=this,$self=this;
  36015. return false;
  36016. },
  36017. args: [],
  36018. source: "isBlockNode\x0a\x09^ false",
  36019. referencedClasses: [],
  36020. pragmas: [],
  36021. messageSends: []
  36022. }),
  36023. $globals.ASTNode);
  36024. $core.addMethod(
  36025. $core.method({
  36026. selector: "isBlockSequenceNode",
  36027. protocol: "testing",
  36028. fn: function (){
  36029. var self=this,$self=this;
  36030. return false;
  36031. },
  36032. args: [],
  36033. source: "isBlockSequenceNode\x0a\x09^ false",
  36034. referencedClasses: [],
  36035. pragmas: [],
  36036. messageSends: []
  36037. }),
  36038. $globals.ASTNode);
  36039. $core.addMethod(
  36040. $core.method({
  36041. selector: "isCascadeNode",
  36042. protocol: "testing",
  36043. fn: function (){
  36044. var self=this,$self=this;
  36045. return false;
  36046. },
  36047. args: [],
  36048. source: "isCascadeNode\x0a\x09^ false",
  36049. referencedClasses: [],
  36050. pragmas: [],
  36051. messageSends: []
  36052. }),
  36053. $globals.ASTNode);
  36054. $core.addMethod(
  36055. $core.method({
  36056. selector: "isImmutable",
  36057. protocol: "testing",
  36058. fn: function (){
  36059. var self=this,$self=this;
  36060. return false;
  36061. },
  36062. args: [],
  36063. source: "isImmutable\x0a\x09^ false",
  36064. referencedClasses: [],
  36065. pragmas: [],
  36066. messageSends: []
  36067. }),
  36068. $globals.ASTNode);
  36069. $core.addMethod(
  36070. $core.method({
  36071. selector: "isJSStatementNode",
  36072. protocol: "testing",
  36073. fn: function (){
  36074. var self=this,$self=this;
  36075. return false;
  36076. },
  36077. args: [],
  36078. source: "isJSStatementNode\x0a\x09^ false",
  36079. referencedClasses: [],
  36080. pragmas: [],
  36081. messageSends: []
  36082. }),
  36083. $globals.ASTNode);
  36084. $core.addMethod(
  36085. $core.method({
  36086. selector: "isNavigationNode",
  36087. protocol: "testing",
  36088. fn: function (){
  36089. var self=this,$self=this;
  36090. return false;
  36091. },
  36092. args: [],
  36093. source: "isNavigationNode\x0a\x09\x22Answer true if the node can be navigated to\x22\x0a\x09\x0a\x09^ false",
  36094. referencedClasses: [],
  36095. pragmas: [],
  36096. messageSends: []
  36097. }),
  36098. $globals.ASTNode);
  36099. $core.addMethod(
  36100. $core.method({
  36101. selector: "isReturnNode",
  36102. protocol: "testing",
  36103. fn: function (){
  36104. var self=this,$self=this;
  36105. return false;
  36106. },
  36107. args: [],
  36108. source: "isReturnNode\x0a\x09^ false",
  36109. referencedClasses: [],
  36110. pragmas: [],
  36111. messageSends: []
  36112. }),
  36113. $globals.ASTNode);
  36114. $core.addMethod(
  36115. $core.method({
  36116. selector: "isSendNode",
  36117. protocol: "testing",
  36118. fn: function (){
  36119. var self=this,$self=this;
  36120. return false;
  36121. },
  36122. args: [],
  36123. source: "isSendNode\x0a\x09^ false",
  36124. referencedClasses: [],
  36125. pragmas: [],
  36126. messageSends: []
  36127. }),
  36128. $globals.ASTNode);
  36129. $core.addMethod(
  36130. $core.method({
  36131. selector: "isSequenceNode",
  36132. protocol: "testing",
  36133. fn: function (){
  36134. var self=this,$self=this;
  36135. return false;
  36136. },
  36137. args: [],
  36138. source: "isSequenceNode\x0a\x09^ false",
  36139. referencedClasses: [],
  36140. pragmas: [],
  36141. messageSends: []
  36142. }),
  36143. $globals.ASTNode);
  36144. $core.addMethod(
  36145. $core.method({
  36146. selector: "isSuperKeyword",
  36147. protocol: "testing",
  36148. fn: function (){
  36149. var self=this,$self=this;
  36150. return false;
  36151. },
  36152. args: [],
  36153. source: "isSuperKeyword\x0a\x09^ false",
  36154. referencedClasses: [],
  36155. pragmas: [],
  36156. messageSends: []
  36157. }),
  36158. $globals.ASTNode);
  36159. $core.addMethod(
  36160. $core.method({
  36161. selector: "isValueNode",
  36162. protocol: "testing",
  36163. fn: function (){
  36164. var self=this,$self=this;
  36165. return false;
  36166. },
  36167. args: [],
  36168. source: "isValueNode\x0a\x09^ false",
  36169. referencedClasses: [],
  36170. pragmas: [],
  36171. messageSends: []
  36172. }),
  36173. $globals.ASTNode);
  36174. $core.addMethod(
  36175. $core.method({
  36176. selector: "isVariableNode",
  36177. protocol: "testing",
  36178. fn: function (){
  36179. var self=this,$self=this;
  36180. return false;
  36181. },
  36182. args: [],
  36183. source: "isVariableNode\x0a\x09^ false",
  36184. referencedClasses: [],
  36185. pragmas: [],
  36186. messageSends: []
  36187. }),
  36188. $globals.ASTNode);
  36189. $core.addMethod(
  36190. $core.method({
  36191. selector: "location:",
  36192. protocol: "accessing",
  36193. fn: function (aLocation){
  36194. var self=this,$self=this;
  36195. return $core.withContext(function($ctx1) {
  36196. var $3,$2,$1;
  36197. $3=$recv(aLocation)._start();
  36198. $ctx1.sendIdx["start"]=1;
  36199. $2=$recv($3)._line();
  36200. $1=$recv($2).__at($recv($recv(aLocation)._start())._column());
  36201. $self._position_($1);
  36202. return self;
  36203. }, function($ctx1) {$ctx1.fill(self,"location:",{aLocation:aLocation})});
  36204. },
  36205. args: ["aLocation"],
  36206. source: "location: aLocation\x0a\x09self position: aLocation start line @ aLocation start column",
  36207. referencedClasses: [],
  36208. pragmas: [],
  36209. messageSends: ["position:", "@", "line", "start", "column"]
  36210. }),
  36211. $globals.ASTNode);
  36212. $core.addMethod(
  36213. $core.method({
  36214. selector: "method",
  36215. protocol: "accessing",
  36216. fn: function (){
  36217. var self=this,$self=this;
  36218. return $core.withContext(function($ctx1) {
  36219. var $1,$receiver;
  36220. $1=$self._parent();
  36221. if(($receiver = $1) == null || $receiver.a$nil){
  36222. return $1;
  36223. } else {
  36224. var node;
  36225. node=$receiver;
  36226. return $recv(node)._method();
  36227. }
  36228. }, function($ctx1) {$ctx1.fill(self,"method",{})});
  36229. },
  36230. args: [],
  36231. source: "method\x0a\x09^ self parent ifNotNil: [ :node | node method ]",
  36232. referencedClasses: [],
  36233. pragmas: [],
  36234. messageSends: ["ifNotNil:", "parent", "method"]
  36235. }),
  36236. $globals.ASTNode);
  36237. $core.addMethod(
  36238. $core.method({
  36239. selector: "navigationNodeAt:ifAbsent:",
  36240. protocol: "accessing",
  36241. fn: function (aPoint,aBlock){
  36242. var self=this,$self=this;
  36243. var children;
  36244. return $core.withContext(function($ctx1) {
  36245. var $2,$1;
  36246. var $early={};
  36247. try {
  36248. children=$recv($self._allDagChildren())._select_((function(each){
  36249. return $core.withContext(function($ctx2) {
  36250. return $recv($recv(each)._isNavigationNode())._and_((function(){
  36251. return $core.withContext(function($ctx3) {
  36252. return $recv(each)._inPosition_(aPoint);
  36253. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  36254. }));
  36255. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36256. }));
  36257. $recv(children)._ifEmpty_((function(){
  36258. return $core.withContext(function($ctx2) {
  36259. throw $early=[$recv(aBlock)._value()];
  36260. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  36261. }));
  36262. return $recv($recv($recv(children)._asArray())._sort_((function(a,b){
  36263. return $core.withContext(function($ctx2) {
  36264. $2=$recv(a)._positionStart();
  36265. $ctx2.sendIdx["positionStart"]=1;
  36266. $1=$recv($2)._dist_(aPoint);
  36267. $ctx2.sendIdx["dist:"]=1;
  36268. return $recv($1).__lt_eq($recv($recv(b)._positionStart())._dist_(aPoint));
  36269. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,4)});
  36270. })))._first();
  36271. }
  36272. catch(e) {if(e===$early)return e[0]; throw e}
  36273. }, function($ctx1) {$ctx1.fill(self,"navigationNodeAt:ifAbsent:",{aPoint:aPoint,aBlock:aBlock,children:children})});
  36274. },
  36275. args: ["aPoint", "aBlock"],
  36276. 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",
  36277. referencedClasses: [],
  36278. pragmas: [],
  36279. messageSends: ["select:", "allDagChildren", "and:", "isNavigationNode", "inPosition:", "ifEmpty:", "value", "first", "sort:", "asArray", "<=", "dist:", "positionStart"]
  36280. }),
  36281. $globals.ASTNode);
  36282. $core.addMethod(
  36283. $core.method({
  36284. selector: "parent",
  36285. protocol: "accessing",
  36286. fn: function (){
  36287. var self=this,$self=this;
  36288. return $self.parent;
  36289. },
  36290. args: [],
  36291. source: "parent\x0a\x09^ parent",
  36292. referencedClasses: [],
  36293. pragmas: [],
  36294. messageSends: []
  36295. }),
  36296. $globals.ASTNode);
  36297. $core.addMethod(
  36298. $core.method({
  36299. selector: "parent:",
  36300. protocol: "accessing",
  36301. fn: function (aNode){
  36302. var self=this,$self=this;
  36303. $self.parent=aNode;
  36304. return self;
  36305. },
  36306. args: ["aNode"],
  36307. source: "parent: aNode\x0a\x09parent := aNode",
  36308. referencedClasses: [],
  36309. pragmas: [],
  36310. messageSends: []
  36311. }),
  36312. $globals.ASTNode);
  36313. $core.addMethod(
  36314. $core.method({
  36315. selector: "position",
  36316. protocol: "accessing",
  36317. fn: function (){
  36318. var self=this,$self=this;
  36319. return $core.withContext(function($ctx1) {
  36320. var $1,$2,$receiver;
  36321. $1=$self.position;
  36322. if(($receiver = $1) == null || $receiver.a$nil){
  36323. $2=$self._parent();
  36324. if(($receiver = $2) == null || $receiver.a$nil){
  36325. return $2;
  36326. } else {
  36327. var node;
  36328. node=$receiver;
  36329. return $recv(node)._position();
  36330. }
  36331. } else {
  36332. return $1;
  36333. }
  36334. }, function($ctx1) {$ctx1.fill(self,"position",{})});
  36335. },
  36336. args: [],
  36337. 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 ] ]",
  36338. referencedClasses: [],
  36339. pragmas: [],
  36340. messageSends: ["ifNil:", "ifNotNil:", "parent", "position"]
  36341. }),
  36342. $globals.ASTNode);
  36343. $core.addMethod(
  36344. $core.method({
  36345. selector: "position:",
  36346. protocol: "accessing",
  36347. fn: function (aPosition){
  36348. var self=this,$self=this;
  36349. $self.position=aPosition;
  36350. return self;
  36351. },
  36352. args: ["aPosition"],
  36353. source: "position: aPosition\x0a\x09position := aPosition",
  36354. referencedClasses: [],
  36355. pragmas: [],
  36356. messageSends: []
  36357. }),
  36358. $globals.ASTNode);
  36359. $core.addMethod(
  36360. $core.method({
  36361. selector: "positionEnd",
  36362. protocol: "accessing",
  36363. fn: function (){
  36364. var self=this,$self=this;
  36365. return $core.withContext(function($ctx1) {
  36366. var $1,$6,$5,$4,$3,$2;
  36367. $1=$self._positionStart();
  36368. $6=$self._source();
  36369. $ctx1.sendIdx["source"]=1;
  36370. $5=$recv($6)._lines();
  36371. $ctx1.sendIdx["lines"]=1;
  36372. $4=$recv($5)._size();
  36373. $ctx1.sendIdx["size"]=1;
  36374. $3=$recv($4).__minus((1));
  36375. $ctx1.sendIdx["-"]=1;
  36376. $2=$recv($3).__at($recv($recv($recv($recv($self._source())._lines())._last())._size()).__minus((1)));
  36377. return $recv($1).__plus($2);
  36378. }, function($ctx1) {$ctx1.fill(self,"positionEnd",{})});
  36379. },
  36380. args: [],
  36381. source: "positionEnd\x0a\x09^ self positionStart + ((self source lines size - 1) @ (self source lines last size - 1))",
  36382. referencedClasses: [],
  36383. pragmas: [],
  36384. messageSends: ["+", "positionStart", "@", "-", "size", "lines", "source", "last"]
  36385. }),
  36386. $globals.ASTNode);
  36387. $core.addMethod(
  36388. $core.method({
  36389. selector: "positionStart",
  36390. protocol: "accessing",
  36391. fn: function (){
  36392. var self=this,$self=this;
  36393. return $core.withContext(function($ctx1) {
  36394. return $self._position();
  36395. }, function($ctx1) {$ctx1.fill(self,"positionStart",{})});
  36396. },
  36397. args: [],
  36398. source: "positionStart\x0a\x09^ self position",
  36399. referencedClasses: [],
  36400. pragmas: [],
  36401. messageSends: ["position"]
  36402. }),
  36403. $globals.ASTNode);
  36404. $core.addMethod(
  36405. $core.method({
  36406. selector: "requiresSmalltalkContext",
  36407. protocol: "testing",
  36408. fn: function (){
  36409. var self=this,$self=this;
  36410. return $core.withContext(function($ctx1) {
  36411. return $recv($recv($self._dagChildren())._detect_ifNone_((function(each){
  36412. return $core.withContext(function($ctx2) {
  36413. return $recv(each)._requiresSmalltalkContext();
  36414. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36415. }),(function(){
  36416. return nil;
  36417. })))._notNil();
  36418. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{})});
  36419. },
  36420. args: [],
  36421. source: "requiresSmalltalkContext\x0a\x09\x22Answer true if the receiver requires a smalltalk context.\x0a\x09Only send nodes require a context.\x0a\x09\x0a\x09If no node requires a context, the method will be compiled without one.\x0a\x09See `IRJSTranslator` and `JSStream` for context creation\x22\x0a\x09\x0a\x09^ (self dagChildren \x0a\x09\x09detect: [ :each | each requiresSmalltalkContext ]\x0a\x09\x09ifNone: [ nil ]) notNil",
  36422. referencedClasses: [],
  36423. pragmas: [],
  36424. messageSends: ["notNil", "detect:ifNone:", "dagChildren", "requiresSmalltalkContext"]
  36425. }),
  36426. $globals.ASTNode);
  36427. $core.addMethod(
  36428. $core.method({
  36429. selector: "shouldBeAliased",
  36430. protocol: "accessing",
  36431. fn: function (){
  36432. var self=this,$self=this;
  36433. return $core.withContext(function($ctx1) {
  36434. var $1,$receiver;
  36435. $1=$self.shouldBeAliased;
  36436. if(($receiver = $1) == null || $receiver.a$nil){
  36437. return false;
  36438. } else {
  36439. return $1;
  36440. }
  36441. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{})});
  36442. },
  36443. args: [],
  36444. source: "shouldBeAliased\x0a\x09^ shouldBeAliased ifNil: [ false ]",
  36445. referencedClasses: [],
  36446. pragmas: [],
  36447. messageSends: ["ifNil:"]
  36448. }),
  36449. $globals.ASTNode);
  36450. $core.addMethod(
  36451. $core.method({
  36452. selector: "shouldBeAliased:",
  36453. protocol: "accessing",
  36454. fn: function (aBoolean){
  36455. var self=this,$self=this;
  36456. $self.shouldBeAliased=aBoolean;
  36457. return self;
  36458. },
  36459. args: ["aBoolean"],
  36460. source: "shouldBeAliased: aBoolean\x0a\x09shouldBeAliased := aBoolean",
  36461. referencedClasses: [],
  36462. pragmas: [],
  36463. messageSends: []
  36464. }),
  36465. $globals.ASTNode);
  36466. $core.addMethod(
  36467. $core.method({
  36468. selector: "size",
  36469. protocol: "accessing",
  36470. fn: function (){
  36471. var self=this,$self=this;
  36472. return $core.withContext(function($ctx1) {
  36473. return $recv($self._source())._size();
  36474. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  36475. },
  36476. args: [],
  36477. source: "size\x0a\x09^ self source size",
  36478. referencedClasses: [],
  36479. pragmas: [],
  36480. messageSends: ["size", "source"]
  36481. }),
  36482. $globals.ASTNode);
  36483. $core.addMethod(
  36484. $core.method({
  36485. selector: "source",
  36486. protocol: "accessing",
  36487. fn: function (){
  36488. var self=this,$self=this;
  36489. return $core.withContext(function($ctx1) {
  36490. var $1,$receiver;
  36491. $1=$self.source;
  36492. if(($receiver = $1) == null || $receiver.a$nil){
  36493. return "";
  36494. } else {
  36495. return $1;
  36496. }
  36497. }, function($ctx1) {$ctx1.fill(self,"source",{})});
  36498. },
  36499. args: [],
  36500. source: "source\x0a\x09^ source ifNil: [ '' ]",
  36501. referencedClasses: [],
  36502. pragmas: [],
  36503. messageSends: ["ifNil:"]
  36504. }),
  36505. $globals.ASTNode);
  36506. $core.addMethod(
  36507. $core.method({
  36508. selector: "source:",
  36509. protocol: "accessing",
  36510. fn: function (aString){
  36511. var self=this,$self=this;
  36512. $self.source=aString;
  36513. return self;
  36514. },
  36515. args: ["aString"],
  36516. source: "source: aString\x0a\x09source := aString",
  36517. referencedClasses: [],
  36518. pragmas: [],
  36519. messageSends: []
  36520. }),
  36521. $globals.ASTNode);
  36522. $core.addMethod(
  36523. $core.method({
  36524. selector: "withTail:",
  36525. protocol: "building",
  36526. fn: function (aCollection){
  36527. var self=this,$self=this;
  36528. return $core.withContext(function($ctx1) {
  36529. var $1;
  36530. return $recv(aCollection)._inject_into_(self,(function(receiver,send){
  36531. return $core.withContext(function($ctx2) {
  36532. $1=$recv($globals.SendNode)._new();
  36533. $recv($1)._position_($recv(send)._position());
  36534. $recv($1)._source_($recv(send)._source());
  36535. $recv($1)._receiver_(receiver);
  36536. $recv($1)._selector_($recv(send)._selector());
  36537. $recv($1)._arguments_($recv(send)._arguments());
  36538. return $recv($1)._yourself();
  36539. }, function($ctx2) {$ctx2.fillBlock({receiver:receiver,send:send},$ctx1,1)});
  36540. }));
  36541. }, function($ctx1) {$ctx1.fill(self,"withTail:",{aCollection:aCollection})});
  36542. },
  36543. args: ["aCollection"],
  36544. 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 ]",
  36545. referencedClasses: ["SendNode"],
  36546. pragmas: [],
  36547. messageSends: ["inject:into:", "position:", "new", "position", "source:", "source", "receiver:", "selector:", "selector", "arguments:", "arguments", "yourself"]
  36548. }),
  36549. $globals.ASTNode);
  36550. $core.addClass("AssignmentNode", $globals.ASTNode, ["left", "right"], "Compiler-AST");
  36551. $globals.AssignmentNode.comment="I represent an assignment node.";
  36552. $core.addMethod(
  36553. $core.method({
  36554. selector: "acceptDagVisitor:",
  36555. protocol: "visiting",
  36556. fn: function (aVisitor){
  36557. var self=this,$self=this;
  36558. return $core.withContext(function($ctx1) {
  36559. return $recv(aVisitor)._visitAssignmentNode_(self);
  36560. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  36561. },
  36562. args: ["aVisitor"],
  36563. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitAssignmentNode: self",
  36564. referencedClasses: [],
  36565. pragmas: [],
  36566. messageSends: ["visitAssignmentNode:"]
  36567. }),
  36568. $globals.AssignmentNode);
  36569. $core.addMethod(
  36570. $core.method({
  36571. selector: "dagChildren",
  36572. protocol: "accessing",
  36573. fn: function (){
  36574. var self=this,$self=this;
  36575. return $core.withContext(function($ctx1) {
  36576. return $recv($globals.Array)._with_with_($self._left(),$self._right());
  36577. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{})});
  36578. },
  36579. args: [],
  36580. source: "dagChildren\x0a\x09^ Array with: self left with: self right",
  36581. referencedClasses: ["Array"],
  36582. pragmas: [],
  36583. messageSends: ["with:with:", "left", "right"]
  36584. }),
  36585. $globals.AssignmentNode);
  36586. $core.addMethod(
  36587. $core.method({
  36588. selector: "isAssignmentNode",
  36589. protocol: "testing",
  36590. fn: function (){
  36591. var self=this,$self=this;
  36592. return true;
  36593. },
  36594. args: [],
  36595. source: "isAssignmentNode\x0a\x09^ true",
  36596. referencedClasses: [],
  36597. pragmas: [],
  36598. messageSends: []
  36599. }),
  36600. $globals.AssignmentNode);
  36601. $core.addMethod(
  36602. $core.method({
  36603. selector: "left",
  36604. protocol: "accessing",
  36605. fn: function (){
  36606. var self=this,$self=this;
  36607. return $self.left;
  36608. },
  36609. args: [],
  36610. source: "left\x0a\x09^ left",
  36611. referencedClasses: [],
  36612. pragmas: [],
  36613. messageSends: []
  36614. }),
  36615. $globals.AssignmentNode);
  36616. $core.addMethod(
  36617. $core.method({
  36618. selector: "left:",
  36619. protocol: "accessing",
  36620. fn: function (aNode){
  36621. var self=this,$self=this;
  36622. $self.left=aNode;
  36623. return self;
  36624. },
  36625. args: ["aNode"],
  36626. source: "left: aNode\x0a\x09left := aNode",
  36627. referencedClasses: [],
  36628. pragmas: [],
  36629. messageSends: []
  36630. }),
  36631. $globals.AssignmentNode);
  36632. $core.addMethod(
  36633. $core.method({
  36634. selector: "right",
  36635. protocol: "accessing",
  36636. fn: function (){
  36637. var self=this,$self=this;
  36638. return $self.right;
  36639. },
  36640. args: [],
  36641. source: "right\x0a\x09^ right",
  36642. referencedClasses: [],
  36643. pragmas: [],
  36644. messageSends: []
  36645. }),
  36646. $globals.AssignmentNode);
  36647. $core.addMethod(
  36648. $core.method({
  36649. selector: "right:",
  36650. protocol: "accessing",
  36651. fn: function (aNode){
  36652. var self=this,$self=this;
  36653. $self.right=aNode;
  36654. return self;
  36655. },
  36656. args: ["aNode"],
  36657. source: "right: aNode\x0a\x09right := aNode",
  36658. referencedClasses: [],
  36659. pragmas: [],
  36660. messageSends: []
  36661. }),
  36662. $globals.AssignmentNode);
  36663. $core.addClass("BlockNode", $globals.ASTNode, ["parameters", "scope"], "Compiler-AST");
  36664. $globals.BlockNode.comment="I represent an block closure node.";
  36665. $core.addMethod(
  36666. $core.method({
  36667. selector: "acceptDagVisitor:",
  36668. protocol: "visiting",
  36669. fn: function (aVisitor){
  36670. var self=this,$self=this;
  36671. return $core.withContext(function($ctx1) {
  36672. return $recv(aVisitor)._visitBlockNode_(self);
  36673. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  36674. },
  36675. args: ["aVisitor"],
  36676. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitBlockNode: self",
  36677. referencedClasses: [],
  36678. pragmas: [],
  36679. messageSends: ["visitBlockNode:"]
  36680. }),
  36681. $globals.BlockNode);
  36682. $core.addMethod(
  36683. $core.method({
  36684. selector: "isBlockNode",
  36685. protocol: "testing",
  36686. fn: function (){
  36687. var self=this,$self=this;
  36688. return true;
  36689. },
  36690. args: [],
  36691. source: "isBlockNode\x0a\x09^ true",
  36692. referencedClasses: [],
  36693. pragmas: [],
  36694. messageSends: []
  36695. }),
  36696. $globals.BlockNode);
  36697. $core.addMethod(
  36698. $core.method({
  36699. selector: "parameters",
  36700. protocol: "accessing",
  36701. fn: function (){
  36702. var self=this,$self=this;
  36703. return $core.withContext(function($ctx1) {
  36704. var $1,$receiver;
  36705. $1=$self.parameters;
  36706. if(($receiver = $1) == null || $receiver.a$nil){
  36707. $self.parameters=$recv($globals.Array)._new();
  36708. return $self.parameters;
  36709. } else {
  36710. return $1;
  36711. }
  36712. }, function($ctx1) {$ctx1.fill(self,"parameters",{})});
  36713. },
  36714. args: [],
  36715. source: "parameters\x0a\x09^ parameters ifNil: [ parameters := Array new ]",
  36716. referencedClasses: ["Array"],
  36717. pragmas: [],
  36718. messageSends: ["ifNil:", "new"]
  36719. }),
  36720. $globals.BlockNode);
  36721. $core.addMethod(
  36722. $core.method({
  36723. selector: "parameters:",
  36724. protocol: "accessing",
  36725. fn: function (aCollection){
  36726. var self=this,$self=this;
  36727. $self.parameters=aCollection;
  36728. return self;
  36729. },
  36730. args: ["aCollection"],
  36731. source: "parameters: aCollection\x0a\x09parameters := aCollection",
  36732. referencedClasses: [],
  36733. pragmas: [],
  36734. messageSends: []
  36735. }),
  36736. $globals.BlockNode);
  36737. $core.addMethod(
  36738. $core.method({
  36739. selector: "scope",
  36740. protocol: "accessing",
  36741. fn: function (){
  36742. var self=this,$self=this;
  36743. return $self.scope;
  36744. },
  36745. args: [],
  36746. source: "scope\x0a\x09^ scope",
  36747. referencedClasses: [],
  36748. pragmas: [],
  36749. messageSends: []
  36750. }),
  36751. $globals.BlockNode);
  36752. $core.addMethod(
  36753. $core.method({
  36754. selector: "scope:",
  36755. protocol: "accessing",
  36756. fn: function (aLexicalScope){
  36757. var self=this,$self=this;
  36758. $self.scope=aLexicalScope;
  36759. return self;
  36760. },
  36761. args: ["aLexicalScope"],
  36762. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  36763. referencedClasses: [],
  36764. pragmas: [],
  36765. messageSends: []
  36766. }),
  36767. $globals.BlockNode);
  36768. $core.addClass("CascadeNode", $globals.ASTNode, ["receiver"], "Compiler-AST");
  36769. $globals.CascadeNode.comment="I represent an cascade node.";
  36770. $core.addMethod(
  36771. $core.method({
  36772. selector: "acceptDagVisitor:",
  36773. protocol: "visiting",
  36774. fn: function (aVisitor){
  36775. var self=this,$self=this;
  36776. return $core.withContext(function($ctx1) {
  36777. return $recv(aVisitor)._visitCascadeNode_(self);
  36778. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  36779. },
  36780. args: ["aVisitor"],
  36781. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitCascadeNode: self",
  36782. referencedClasses: [],
  36783. pragmas: [],
  36784. messageSends: ["visitCascadeNode:"]
  36785. }),
  36786. $globals.CascadeNode);
  36787. $core.addMethod(
  36788. $core.method({
  36789. selector: "isCascadeNode",
  36790. protocol: "testing",
  36791. fn: function (){
  36792. var self=this,$self=this;
  36793. return true;
  36794. },
  36795. args: [],
  36796. source: "isCascadeNode\x0a\x09^ true",
  36797. referencedClasses: [],
  36798. pragmas: [],
  36799. messageSends: []
  36800. }),
  36801. $globals.CascadeNode);
  36802. $core.addMethod(
  36803. $core.method({
  36804. selector: "receiver",
  36805. protocol: "accessing",
  36806. fn: function (){
  36807. var self=this,$self=this;
  36808. return $self.receiver;
  36809. },
  36810. args: [],
  36811. source: "receiver\x0a\x09^ receiver",
  36812. referencedClasses: [],
  36813. pragmas: [],
  36814. messageSends: []
  36815. }),
  36816. $globals.CascadeNode);
  36817. $core.addMethod(
  36818. $core.method({
  36819. selector: "receiver:",
  36820. protocol: "accessing",
  36821. fn: function (aNode){
  36822. var self=this,$self=this;
  36823. $self.receiver=aNode;
  36824. return self;
  36825. },
  36826. args: ["aNode"],
  36827. source: "receiver: aNode\x0a\x09receiver := aNode",
  36828. referencedClasses: [],
  36829. pragmas: [],
  36830. messageSends: []
  36831. }),
  36832. $globals.CascadeNode);
  36833. $core.addClass("DynamicArrayNode", $globals.ASTNode, [], "Compiler-AST");
  36834. $globals.DynamicArrayNode.comment="I represent an dynamic array node.";
  36835. $core.addMethod(
  36836. $core.method({
  36837. selector: "acceptDagVisitor:",
  36838. protocol: "visiting",
  36839. fn: function (aVisitor){
  36840. var self=this,$self=this;
  36841. return $core.withContext(function($ctx1) {
  36842. return $recv(aVisitor)._visitDynamicArrayNode_(self);
  36843. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  36844. },
  36845. args: ["aVisitor"],
  36846. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDynamicArrayNode: self",
  36847. referencedClasses: [],
  36848. pragmas: [],
  36849. messageSends: ["visitDynamicArrayNode:"]
  36850. }),
  36851. $globals.DynamicArrayNode);
  36852. $core.addClass("DynamicDictionaryNode", $globals.ASTNode, [], "Compiler-AST");
  36853. $globals.DynamicDictionaryNode.comment="I represent an dynamic dictionary node.";
  36854. $core.addMethod(
  36855. $core.method({
  36856. selector: "acceptDagVisitor:",
  36857. protocol: "visiting",
  36858. fn: function (aVisitor){
  36859. var self=this,$self=this;
  36860. return $core.withContext(function($ctx1) {
  36861. return $recv(aVisitor)._visitDynamicDictionaryNode_(self);
  36862. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  36863. },
  36864. args: ["aVisitor"],
  36865. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDynamicDictionaryNode: self",
  36866. referencedClasses: [],
  36867. pragmas: [],
  36868. messageSends: ["visitDynamicDictionaryNode:"]
  36869. }),
  36870. $globals.DynamicDictionaryNode);
  36871. $core.addClass("JSStatementNode", $globals.ASTNode, [], "Compiler-AST");
  36872. $globals.JSStatementNode.comment="I represent an JavaScript statement node.";
  36873. $core.addMethod(
  36874. $core.method({
  36875. selector: "acceptDagVisitor:",
  36876. protocol: "visiting",
  36877. fn: function (aVisitor){
  36878. var self=this,$self=this;
  36879. return $core.withContext(function($ctx1) {
  36880. return $recv(aVisitor)._visitJSStatementNode_(self);
  36881. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  36882. },
  36883. args: ["aVisitor"],
  36884. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitJSStatementNode: self",
  36885. referencedClasses: [],
  36886. pragmas: [],
  36887. messageSends: ["visitJSStatementNode:"]
  36888. }),
  36889. $globals.JSStatementNode);
  36890. $core.addMethod(
  36891. $core.method({
  36892. selector: "isJSStatementNode",
  36893. protocol: "testing",
  36894. fn: function (){
  36895. var self=this,$self=this;
  36896. return true;
  36897. },
  36898. args: [],
  36899. source: "isJSStatementNode\x0a\x09^ true",
  36900. referencedClasses: [],
  36901. pragmas: [],
  36902. messageSends: []
  36903. }),
  36904. $globals.JSStatementNode);
  36905. $core.addMethod(
  36906. $core.method({
  36907. selector: "requiresSmalltalkContext",
  36908. protocol: "testing",
  36909. fn: function (){
  36910. var self=this,$self=this;
  36911. return true;
  36912. },
  36913. args: [],
  36914. source: "requiresSmalltalkContext\x0a\x09^ true",
  36915. referencedClasses: [],
  36916. pragmas: [],
  36917. messageSends: []
  36918. }),
  36919. $globals.JSStatementNode);
  36920. $core.addClass("MethodNode", $globals.ASTNode, ["selector", "arguments", "source", "pragmas", "scope", "classReferences", "sendIndexes"], "Compiler-AST");
  36921. $globals.MethodNode.comment="I represent an method node.\x0a\x0aA method node must be the root and only method node of a valid AST.";
  36922. $core.addMethod(
  36923. $core.method({
  36924. selector: "acceptDagVisitor:",
  36925. protocol: "visiting",
  36926. fn: function (aVisitor){
  36927. var self=this,$self=this;
  36928. return $core.withContext(function($ctx1) {
  36929. return $recv(aVisitor)._visitMethodNode_(self);
  36930. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  36931. },
  36932. args: ["aVisitor"],
  36933. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitMethodNode: self",
  36934. referencedClasses: [],
  36935. pragmas: [],
  36936. messageSends: ["visitMethodNode:"]
  36937. }),
  36938. $globals.MethodNode);
  36939. $core.addMethod(
  36940. $core.method({
  36941. selector: "arguments",
  36942. protocol: "accessing",
  36943. fn: function (){
  36944. var self=this,$self=this;
  36945. return $core.withContext(function($ctx1) {
  36946. var $1,$receiver;
  36947. $1=$self.arguments;
  36948. if(($receiver = $1) == null || $receiver.a$nil){
  36949. return [];
  36950. } else {
  36951. return $1;
  36952. }
  36953. }, function($ctx1) {$ctx1.fill(self,"arguments",{})});
  36954. },
  36955. args: [],
  36956. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  36957. referencedClasses: [],
  36958. pragmas: [],
  36959. messageSends: ["ifNil:"]
  36960. }),
  36961. $globals.MethodNode);
  36962. $core.addMethod(
  36963. $core.method({
  36964. selector: "arguments:",
  36965. protocol: "accessing",
  36966. fn: function (aCollection){
  36967. var self=this,$self=this;
  36968. $self.arguments=aCollection;
  36969. return self;
  36970. },
  36971. args: ["aCollection"],
  36972. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  36973. referencedClasses: [],
  36974. pragmas: [],
  36975. messageSends: []
  36976. }),
  36977. $globals.MethodNode);
  36978. $core.addMethod(
  36979. $core.method({
  36980. selector: "classReferences",
  36981. protocol: "accessing",
  36982. fn: function (){
  36983. var self=this,$self=this;
  36984. return $self.classReferences;
  36985. },
  36986. args: [],
  36987. source: "classReferences\x0a\x09^ classReferences",
  36988. referencedClasses: [],
  36989. pragmas: [],
  36990. messageSends: []
  36991. }),
  36992. $globals.MethodNode);
  36993. $core.addMethod(
  36994. $core.method({
  36995. selector: "classReferences:",
  36996. protocol: "accessing",
  36997. fn: function (aCollection){
  36998. var self=this,$self=this;
  36999. $self.classReferences=aCollection;
  37000. return self;
  37001. },
  37002. args: ["aCollection"],
  37003. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  37004. referencedClasses: [],
  37005. pragmas: [],
  37006. messageSends: []
  37007. }),
  37008. $globals.MethodNode);
  37009. $core.addMethod(
  37010. $core.method({
  37011. selector: "messageSends",
  37012. protocol: "accessing",
  37013. fn: function (){
  37014. var self=this,$self=this;
  37015. return $core.withContext(function($ctx1) {
  37016. return $recv($self._sendIndexes())._keys();
  37017. }, function($ctx1) {$ctx1.fill(self,"messageSends",{})});
  37018. },
  37019. args: [],
  37020. source: "messageSends\x0a\x09^ self sendIndexes keys",
  37021. referencedClasses: [],
  37022. pragmas: [],
  37023. messageSends: ["keys", "sendIndexes"]
  37024. }),
  37025. $globals.MethodNode);
  37026. $core.addMethod(
  37027. $core.method({
  37028. selector: "method",
  37029. protocol: "accessing",
  37030. fn: function (){
  37031. var self=this,$self=this;
  37032. return self;
  37033. },
  37034. args: [],
  37035. source: "method\x0a\x09^ self",
  37036. referencedClasses: [],
  37037. pragmas: [],
  37038. messageSends: []
  37039. }),
  37040. $globals.MethodNode);
  37041. $core.addMethod(
  37042. $core.method({
  37043. selector: "pragmas",
  37044. protocol: "accessing",
  37045. fn: function (){
  37046. var self=this,$self=this;
  37047. return $core.withContext(function($ctx1) {
  37048. var $1,$receiver;
  37049. $1=$self.pragmas;
  37050. if(($receiver = $1) == null || $receiver.a$nil){
  37051. return [];
  37052. } else {
  37053. return $1;
  37054. }
  37055. }, function($ctx1) {$ctx1.fill(self,"pragmas",{})});
  37056. },
  37057. args: [],
  37058. source: "pragmas\x0a\x09^ pragmas ifNil: [ #() ]",
  37059. referencedClasses: [],
  37060. pragmas: [],
  37061. messageSends: ["ifNil:"]
  37062. }),
  37063. $globals.MethodNode);
  37064. $core.addMethod(
  37065. $core.method({
  37066. selector: "pragmas:",
  37067. protocol: "accessing",
  37068. fn: function (aCollection){
  37069. var self=this,$self=this;
  37070. $self.pragmas=aCollection;
  37071. return self;
  37072. },
  37073. args: ["aCollection"],
  37074. source: "pragmas: aCollection\x0a\x09pragmas := aCollection",
  37075. referencedClasses: [],
  37076. pragmas: [],
  37077. messageSends: []
  37078. }),
  37079. $globals.MethodNode);
  37080. $core.addMethod(
  37081. $core.method({
  37082. selector: "scope",
  37083. protocol: "accessing",
  37084. fn: function (){
  37085. var self=this,$self=this;
  37086. return $self.scope;
  37087. },
  37088. args: [],
  37089. source: "scope\x0a\x09^ scope",
  37090. referencedClasses: [],
  37091. pragmas: [],
  37092. messageSends: []
  37093. }),
  37094. $globals.MethodNode);
  37095. $core.addMethod(
  37096. $core.method({
  37097. selector: "scope:",
  37098. protocol: "accessing",
  37099. fn: function (aMethodScope){
  37100. var self=this,$self=this;
  37101. $self.scope=aMethodScope;
  37102. return self;
  37103. },
  37104. args: ["aMethodScope"],
  37105. source: "scope: aMethodScope\x0a\x09scope := aMethodScope",
  37106. referencedClasses: [],
  37107. pragmas: [],
  37108. messageSends: []
  37109. }),
  37110. $globals.MethodNode);
  37111. $core.addMethod(
  37112. $core.method({
  37113. selector: "selector",
  37114. protocol: "accessing",
  37115. fn: function (){
  37116. var self=this,$self=this;
  37117. return $self.selector;
  37118. },
  37119. args: [],
  37120. source: "selector\x0a\x09^ selector",
  37121. referencedClasses: [],
  37122. pragmas: [],
  37123. messageSends: []
  37124. }),
  37125. $globals.MethodNode);
  37126. $core.addMethod(
  37127. $core.method({
  37128. selector: "selector:",
  37129. protocol: "accessing",
  37130. fn: function (aString){
  37131. var self=this,$self=this;
  37132. $self.selector=aString;
  37133. return self;
  37134. },
  37135. args: ["aString"],
  37136. source: "selector: aString\x0a\x09selector := aString",
  37137. referencedClasses: [],
  37138. pragmas: [],
  37139. messageSends: []
  37140. }),
  37141. $globals.MethodNode);
  37142. $core.addMethod(
  37143. $core.method({
  37144. selector: "sendIndexes",
  37145. protocol: "accessing",
  37146. fn: function (){
  37147. var self=this,$self=this;
  37148. return $self.sendIndexes;
  37149. },
  37150. args: [],
  37151. source: "sendIndexes\x0a\x09^ sendIndexes",
  37152. referencedClasses: [],
  37153. pragmas: [],
  37154. messageSends: []
  37155. }),
  37156. $globals.MethodNode);
  37157. $core.addMethod(
  37158. $core.method({
  37159. selector: "sendIndexes:",
  37160. protocol: "accessing",
  37161. fn: function (aDictionary){
  37162. var self=this,$self=this;
  37163. $self.sendIndexes=aDictionary;
  37164. return self;
  37165. },
  37166. args: ["aDictionary"],
  37167. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  37168. referencedClasses: [],
  37169. pragmas: [],
  37170. messageSends: []
  37171. }),
  37172. $globals.MethodNode);
  37173. $core.addMethod(
  37174. $core.method({
  37175. selector: "sequenceNode",
  37176. protocol: "accessing",
  37177. fn: function (){
  37178. var self=this,$self=this;
  37179. return $core.withContext(function($ctx1) {
  37180. var $1;
  37181. var $early={};
  37182. try {
  37183. $recv($self._dagChildren())._do_((function(each){
  37184. return $core.withContext(function($ctx2) {
  37185. $1=$recv(each)._isSequenceNode();
  37186. if($core.assert($1)){
  37187. throw $early=[each];
  37188. }
  37189. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  37190. }));
  37191. return nil;
  37192. }
  37193. catch(e) {if(e===$early)return e[0]; throw e}
  37194. }, function($ctx1) {$ctx1.fill(self,"sequenceNode",{})});
  37195. },
  37196. args: [],
  37197. source: "sequenceNode\x0a\x09self dagChildren do: [ :each |\x0a\x09\x09each isSequenceNode ifTrue: [ ^ each ] ].\x0a\x09\x09\x0a\x09^ nil",
  37198. referencedClasses: [],
  37199. pragmas: [],
  37200. messageSends: ["do:", "dagChildren", "ifTrue:", "isSequenceNode"]
  37201. }),
  37202. $globals.MethodNode);
  37203. $core.addMethod(
  37204. $core.method({
  37205. selector: "source",
  37206. protocol: "accessing",
  37207. fn: function (){
  37208. var self=this,$self=this;
  37209. return $self.source;
  37210. },
  37211. args: [],
  37212. source: "source\x0a\x09^ source",
  37213. referencedClasses: [],
  37214. pragmas: [],
  37215. messageSends: []
  37216. }),
  37217. $globals.MethodNode);
  37218. $core.addMethod(
  37219. $core.method({
  37220. selector: "source:",
  37221. protocol: "accessing",
  37222. fn: function (aString){
  37223. var self=this,$self=this;
  37224. $self.source=aString;
  37225. return self;
  37226. },
  37227. args: ["aString"],
  37228. source: "source: aString\x0a\x09source := aString",
  37229. referencedClasses: [],
  37230. pragmas: [],
  37231. messageSends: []
  37232. }),
  37233. $globals.MethodNode);
  37234. $core.addClass("ReturnNode", $globals.ASTNode, ["scope"], "Compiler-AST");
  37235. $globals.ReturnNode.comment="I represent an return node. At the AST level, there is not difference between a local return or non-local return.";
  37236. $core.addMethod(
  37237. $core.method({
  37238. selector: "acceptDagVisitor:",
  37239. protocol: "visiting",
  37240. fn: function (aVisitor){
  37241. var self=this,$self=this;
  37242. return $core.withContext(function($ctx1) {
  37243. return $recv(aVisitor)._visitReturnNode_(self);
  37244. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  37245. },
  37246. args: ["aVisitor"],
  37247. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitReturnNode: self",
  37248. referencedClasses: [],
  37249. pragmas: [],
  37250. messageSends: ["visitReturnNode:"]
  37251. }),
  37252. $globals.ReturnNode);
  37253. $core.addMethod(
  37254. $core.method({
  37255. selector: "isReturnNode",
  37256. protocol: "testing",
  37257. fn: function (){
  37258. var self=this,$self=this;
  37259. return true;
  37260. },
  37261. args: [],
  37262. source: "isReturnNode\x0a\x09^ true",
  37263. referencedClasses: [],
  37264. pragmas: [],
  37265. messageSends: []
  37266. }),
  37267. $globals.ReturnNode);
  37268. $core.addMethod(
  37269. $core.method({
  37270. selector: "nonLocalReturn",
  37271. protocol: "testing",
  37272. fn: function (){
  37273. var self=this,$self=this;
  37274. return $core.withContext(function($ctx1) {
  37275. return $recv($recv($self._scope())._isMethodScope())._not();
  37276. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturn",{})});
  37277. },
  37278. args: [],
  37279. source: "nonLocalReturn\x0a\x09^ self scope isMethodScope not",
  37280. referencedClasses: [],
  37281. pragmas: [],
  37282. messageSends: ["not", "isMethodScope", "scope"]
  37283. }),
  37284. $globals.ReturnNode);
  37285. $core.addMethod(
  37286. $core.method({
  37287. selector: "scope",
  37288. protocol: "accessing",
  37289. fn: function (){
  37290. var self=this,$self=this;
  37291. return $self.scope;
  37292. },
  37293. args: [],
  37294. source: "scope\x0a\x09^ scope",
  37295. referencedClasses: [],
  37296. pragmas: [],
  37297. messageSends: []
  37298. }),
  37299. $globals.ReturnNode);
  37300. $core.addMethod(
  37301. $core.method({
  37302. selector: "scope:",
  37303. protocol: "accessing",
  37304. fn: function (aLexicalScope){
  37305. var self=this,$self=this;
  37306. $self.scope=aLexicalScope;
  37307. return self;
  37308. },
  37309. args: ["aLexicalScope"],
  37310. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  37311. referencedClasses: [],
  37312. pragmas: [],
  37313. messageSends: []
  37314. }),
  37315. $globals.ReturnNode);
  37316. $core.addClass("SendNode", $globals.ASTNode, ["selector", "arguments", "receiver", "index", "shouldBeInlined"], "Compiler-AST");
  37317. $globals.SendNode.comment="I represent an message send node.";
  37318. $core.addMethod(
  37319. $core.method({
  37320. selector: "acceptDagVisitor:",
  37321. protocol: "visiting",
  37322. fn: function (aVisitor){
  37323. var self=this,$self=this;
  37324. return $core.withContext(function($ctx1) {
  37325. return $recv(aVisitor)._visitSendNode_(self);
  37326. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  37327. },
  37328. args: ["aVisitor"],
  37329. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitSendNode: self",
  37330. referencedClasses: [],
  37331. pragmas: [],
  37332. messageSends: ["visitSendNode:"]
  37333. }),
  37334. $globals.SendNode);
  37335. $core.addMethod(
  37336. $core.method({
  37337. selector: "arguments",
  37338. protocol: "accessing",
  37339. fn: function (){
  37340. var self=this,$self=this;
  37341. return $core.withContext(function($ctx1) {
  37342. var $1,$receiver;
  37343. $1=$self.arguments;
  37344. if(($receiver = $1) == null || $receiver.a$nil){
  37345. $self.arguments=[];
  37346. return $self.arguments;
  37347. } else {
  37348. return $1;
  37349. }
  37350. }, function($ctx1) {$ctx1.fill(self,"arguments",{})});
  37351. },
  37352. args: [],
  37353. source: "arguments\x0a\x09^ arguments ifNil: [ arguments := #() ]",
  37354. referencedClasses: [],
  37355. pragmas: [],
  37356. messageSends: ["ifNil:"]
  37357. }),
  37358. $globals.SendNode);
  37359. $core.addMethod(
  37360. $core.method({
  37361. selector: "arguments:",
  37362. protocol: "accessing",
  37363. fn: function (aCollection){
  37364. var self=this,$self=this;
  37365. $self.arguments=aCollection;
  37366. return self;
  37367. },
  37368. args: ["aCollection"],
  37369. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  37370. referencedClasses: [],
  37371. pragmas: [],
  37372. messageSends: []
  37373. }),
  37374. $globals.SendNode);
  37375. $core.addMethod(
  37376. $core.method({
  37377. selector: "dagChildren",
  37378. protocol: "accessing",
  37379. fn: function (){
  37380. var self=this,$self=this;
  37381. return $core.withContext(function($ctx1) {
  37382. var $1,$2,$3,$receiver;
  37383. $1=$self._receiver();
  37384. $ctx1.sendIdx["receiver"]=1;
  37385. if(($receiver = $1) == null || $receiver.a$nil){
  37386. $2=$self._arguments();
  37387. $ctx1.sendIdx["arguments"]=1;
  37388. return $recv($2)._copy();
  37389. } else {
  37390. $1;
  37391. }
  37392. $3=$recv($globals.Array)._with_($self._receiver());
  37393. $recv($3)._addAll_($self._arguments());
  37394. return $recv($3)._yourself();
  37395. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{})});
  37396. },
  37397. args: [],
  37398. source: "dagChildren\x0a\x09self receiver ifNil: [ ^ self arguments copy ].\x0a\x09\x0a\x09^ (Array with: self receiver)\x0a\x09\x09addAll: self arguments;\x0a\x09\x09yourself",
  37399. referencedClasses: ["Array"],
  37400. pragmas: [],
  37401. messageSends: ["ifNil:", "receiver", "copy", "arguments", "addAll:", "with:", "yourself"]
  37402. }),
  37403. $globals.SendNode);
  37404. $core.addMethod(
  37405. $core.method({
  37406. selector: "index",
  37407. protocol: "accessing",
  37408. fn: function (){
  37409. var self=this,$self=this;
  37410. return $self.index;
  37411. },
  37412. args: [],
  37413. source: "index\x0a\x09^ index",
  37414. referencedClasses: [],
  37415. pragmas: [],
  37416. messageSends: []
  37417. }),
  37418. $globals.SendNode);
  37419. $core.addMethod(
  37420. $core.method({
  37421. selector: "index:",
  37422. protocol: "accessing",
  37423. fn: function (anInteger){
  37424. var self=this,$self=this;
  37425. $self.index=anInteger;
  37426. return self;
  37427. },
  37428. args: ["anInteger"],
  37429. source: "index: anInteger\x0a\x09index := anInteger",
  37430. referencedClasses: [],
  37431. pragmas: [],
  37432. messageSends: []
  37433. }),
  37434. $globals.SendNode);
  37435. $core.addMethod(
  37436. $core.method({
  37437. selector: "isNavigationNode",
  37438. protocol: "testing",
  37439. fn: function (){
  37440. var self=this,$self=this;
  37441. return true;
  37442. },
  37443. args: [],
  37444. source: "isNavigationNode\x0a\x09^ true",
  37445. referencedClasses: [],
  37446. pragmas: [],
  37447. messageSends: []
  37448. }),
  37449. $globals.SendNode);
  37450. $core.addMethod(
  37451. $core.method({
  37452. selector: "isSendNode",
  37453. protocol: "testing",
  37454. fn: function (){
  37455. var self=this,$self=this;
  37456. return true;
  37457. },
  37458. args: [],
  37459. source: "isSendNode\x0a\x09^ true",
  37460. referencedClasses: [],
  37461. pragmas: [],
  37462. messageSends: []
  37463. }),
  37464. $globals.SendNode);
  37465. $core.addMethod(
  37466. $core.method({
  37467. selector: "navigationLink",
  37468. protocol: "accessing",
  37469. fn: function (){
  37470. var self=this,$self=this;
  37471. return $core.withContext(function($ctx1) {
  37472. return $self._selector();
  37473. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{})});
  37474. },
  37475. args: [],
  37476. source: "navigationLink\x0a\x09^ self selector",
  37477. referencedClasses: [],
  37478. pragmas: [],
  37479. messageSends: ["selector"]
  37480. }),
  37481. $globals.SendNode);
  37482. $core.addMethod(
  37483. $core.method({
  37484. selector: "receiver",
  37485. protocol: "accessing",
  37486. fn: function (){
  37487. var self=this,$self=this;
  37488. return $self.receiver;
  37489. },
  37490. args: [],
  37491. source: "receiver\x0a\x09^ receiver",
  37492. referencedClasses: [],
  37493. pragmas: [],
  37494. messageSends: []
  37495. }),
  37496. $globals.SendNode);
  37497. $core.addMethod(
  37498. $core.method({
  37499. selector: "receiver:",
  37500. protocol: "accessing",
  37501. fn: function (aNode){
  37502. var self=this,$self=this;
  37503. $self.receiver=aNode;
  37504. return self;
  37505. },
  37506. args: ["aNode"],
  37507. source: "receiver: aNode\x0a\x09receiver := aNode",
  37508. referencedClasses: [],
  37509. pragmas: [],
  37510. messageSends: []
  37511. }),
  37512. $globals.SendNode);
  37513. $core.addMethod(
  37514. $core.method({
  37515. selector: "requiresSmalltalkContext",
  37516. protocol: "testing",
  37517. fn: function (){
  37518. var self=this,$self=this;
  37519. return true;
  37520. },
  37521. args: [],
  37522. source: "requiresSmalltalkContext\x0a\x09^ true",
  37523. referencedClasses: [],
  37524. pragmas: [],
  37525. messageSends: []
  37526. }),
  37527. $globals.SendNode);
  37528. $core.addMethod(
  37529. $core.method({
  37530. selector: "selector",
  37531. protocol: "accessing",
  37532. fn: function (){
  37533. var self=this,$self=this;
  37534. return $self.selector;
  37535. },
  37536. args: [],
  37537. source: "selector\x0a\x09^ selector",
  37538. referencedClasses: [],
  37539. pragmas: [],
  37540. messageSends: []
  37541. }),
  37542. $globals.SendNode);
  37543. $core.addMethod(
  37544. $core.method({
  37545. selector: "selector:",
  37546. protocol: "accessing",
  37547. fn: function (aString){
  37548. var self=this,$self=this;
  37549. $self.selector=aString;
  37550. return self;
  37551. },
  37552. args: ["aString"],
  37553. source: "selector: aString\x0a\x09selector := aString",
  37554. referencedClasses: [],
  37555. pragmas: [],
  37556. messageSends: []
  37557. }),
  37558. $globals.SendNode);
  37559. $core.addMethod(
  37560. $core.method({
  37561. selector: "shouldBeInlined",
  37562. protocol: "accessing",
  37563. fn: function (){
  37564. var self=this,$self=this;
  37565. return $core.withContext(function($ctx1) {
  37566. var $1,$receiver;
  37567. $1=$self.shouldBeInlined;
  37568. if(($receiver = $1) == null || $receiver.a$nil){
  37569. return false;
  37570. } else {
  37571. return $1;
  37572. }
  37573. }, function($ctx1) {$ctx1.fill(self,"shouldBeInlined",{})});
  37574. },
  37575. args: [],
  37576. source: "shouldBeInlined\x0a\x09^ shouldBeInlined ifNil: [ false ]",
  37577. referencedClasses: [],
  37578. pragmas: [],
  37579. messageSends: ["ifNil:"]
  37580. }),
  37581. $globals.SendNode);
  37582. $core.addMethod(
  37583. $core.method({
  37584. selector: "shouldBeInlined:",
  37585. protocol: "accessing",
  37586. fn: function (aBoolean){
  37587. var self=this,$self=this;
  37588. $self.shouldBeInlined=aBoolean;
  37589. return self;
  37590. },
  37591. args: ["aBoolean"],
  37592. source: "shouldBeInlined: aBoolean\x0a\x09shouldBeInlined := aBoolean",
  37593. referencedClasses: [],
  37594. pragmas: [],
  37595. messageSends: []
  37596. }),
  37597. $globals.SendNode);
  37598. $core.addMethod(
  37599. $core.method({
  37600. selector: "superSend",
  37601. protocol: "accessing",
  37602. fn: function (){
  37603. var self=this,$self=this;
  37604. return $core.withContext(function($ctx1) {
  37605. var $2,$1;
  37606. $2=$self._receiver();
  37607. $ctx1.sendIdx["receiver"]=1;
  37608. $1=$recv($2)._notNil();
  37609. return $recv($1)._and_((function(){
  37610. return $core.withContext(function($ctx2) {
  37611. return $recv($self._receiver())._isSuperKeyword();
  37612. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37613. }));
  37614. }, function($ctx1) {$ctx1.fill(self,"superSend",{})});
  37615. },
  37616. args: [],
  37617. source: "superSend\x0a\x09^ self receiver notNil and: [ self receiver isSuperKeyword ]",
  37618. referencedClasses: [],
  37619. pragmas: [],
  37620. messageSends: ["and:", "notNil", "receiver", "isSuperKeyword"]
  37621. }),
  37622. $globals.SendNode);
  37623. $core.addClass("SequenceNode", $globals.ASTNode, ["temps", "scope"], "Compiler-AST");
  37624. $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).";
  37625. $core.addMethod(
  37626. $core.method({
  37627. selector: "acceptDagVisitor:",
  37628. protocol: "visiting",
  37629. fn: function (aVisitor){
  37630. var self=this,$self=this;
  37631. return $core.withContext(function($ctx1) {
  37632. return $recv(aVisitor)._visitSequenceNode_(self);
  37633. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  37634. },
  37635. args: ["aVisitor"],
  37636. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitSequenceNode: self",
  37637. referencedClasses: [],
  37638. pragmas: [],
  37639. messageSends: ["visitSequenceNode:"]
  37640. }),
  37641. $globals.SequenceNode);
  37642. $core.addMethod(
  37643. $core.method({
  37644. selector: "isSequenceNode",
  37645. protocol: "testing",
  37646. fn: function (){
  37647. var self=this,$self=this;
  37648. return true;
  37649. },
  37650. args: [],
  37651. source: "isSequenceNode\x0a\x09^ true",
  37652. referencedClasses: [],
  37653. pragmas: [],
  37654. messageSends: []
  37655. }),
  37656. $globals.SequenceNode);
  37657. $core.addMethod(
  37658. $core.method({
  37659. selector: "scope",
  37660. protocol: "accessing",
  37661. fn: function (){
  37662. var self=this,$self=this;
  37663. return $self.scope;
  37664. },
  37665. args: [],
  37666. source: "scope\x0a\x09^ scope",
  37667. referencedClasses: [],
  37668. pragmas: [],
  37669. messageSends: []
  37670. }),
  37671. $globals.SequenceNode);
  37672. $core.addMethod(
  37673. $core.method({
  37674. selector: "scope:",
  37675. protocol: "accessing",
  37676. fn: function (aLexicalScope){
  37677. var self=this,$self=this;
  37678. $self.scope=aLexicalScope;
  37679. return self;
  37680. },
  37681. args: ["aLexicalScope"],
  37682. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  37683. referencedClasses: [],
  37684. pragmas: [],
  37685. messageSends: []
  37686. }),
  37687. $globals.SequenceNode);
  37688. $core.addMethod(
  37689. $core.method({
  37690. selector: "temps",
  37691. protocol: "accessing",
  37692. fn: function (){
  37693. var self=this,$self=this;
  37694. return $core.withContext(function($ctx1) {
  37695. var $1,$receiver;
  37696. $1=$self.temps;
  37697. if(($receiver = $1) == null || $receiver.a$nil){
  37698. return [];
  37699. } else {
  37700. return $1;
  37701. }
  37702. }, function($ctx1) {$ctx1.fill(self,"temps",{})});
  37703. },
  37704. args: [],
  37705. source: "temps\x0a\x09^ temps ifNil: [ #() ]",
  37706. referencedClasses: [],
  37707. pragmas: [],
  37708. messageSends: ["ifNil:"]
  37709. }),
  37710. $globals.SequenceNode);
  37711. $core.addMethod(
  37712. $core.method({
  37713. selector: "temps:",
  37714. protocol: "accessing",
  37715. fn: function (aCollection){
  37716. var self=this,$self=this;
  37717. $self.temps=aCollection;
  37718. return self;
  37719. },
  37720. args: ["aCollection"],
  37721. source: "temps: aCollection\x0a\x09temps := aCollection",
  37722. referencedClasses: [],
  37723. pragmas: [],
  37724. messageSends: []
  37725. }),
  37726. $globals.SequenceNode);
  37727. $core.addClass("BlockSequenceNode", $globals.SequenceNode, [], "Compiler-AST");
  37728. $globals.BlockSequenceNode.comment="I represent an special sequence node for block scopes.";
  37729. $core.addMethod(
  37730. $core.method({
  37731. selector: "acceptDagVisitor:",
  37732. protocol: "visiting",
  37733. fn: function (aVisitor){
  37734. var self=this,$self=this;
  37735. return $core.withContext(function($ctx1) {
  37736. return $recv(aVisitor)._visitBlockSequenceNode_(self);
  37737. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  37738. },
  37739. args: ["aVisitor"],
  37740. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitBlockSequenceNode: self",
  37741. referencedClasses: [],
  37742. pragmas: [],
  37743. messageSends: ["visitBlockSequenceNode:"]
  37744. }),
  37745. $globals.BlockSequenceNode);
  37746. $core.addMethod(
  37747. $core.method({
  37748. selector: "isBlockSequenceNode",
  37749. protocol: "testing",
  37750. fn: function (){
  37751. var self=this,$self=this;
  37752. return true;
  37753. },
  37754. args: [],
  37755. source: "isBlockSequenceNode\x0a\x09^ true",
  37756. referencedClasses: [],
  37757. pragmas: [],
  37758. messageSends: []
  37759. }),
  37760. $globals.BlockSequenceNode);
  37761. $core.addClass("ValueNode", $globals.ASTNode, ["value"], "Compiler-AST");
  37762. $globals.ValueNode.comment="I represent a value node.";
  37763. $core.addMethod(
  37764. $core.method({
  37765. selector: "acceptDagVisitor:",
  37766. protocol: "visiting",
  37767. fn: function (aVisitor){
  37768. var self=this,$self=this;
  37769. return $core.withContext(function($ctx1) {
  37770. return $recv(aVisitor)._visitValueNode_(self);
  37771. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  37772. },
  37773. args: ["aVisitor"],
  37774. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitValueNode: self",
  37775. referencedClasses: [],
  37776. pragmas: [],
  37777. messageSends: ["visitValueNode:"]
  37778. }),
  37779. $globals.ValueNode);
  37780. $core.addMethod(
  37781. $core.method({
  37782. selector: "isImmutable",
  37783. protocol: "testing",
  37784. fn: function (){
  37785. var self=this,$self=this;
  37786. return $core.withContext(function($ctx1) {
  37787. return $recv($self._value())._isImmutable();
  37788. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{})});
  37789. },
  37790. args: [],
  37791. source: "isImmutable\x0a\x09^ self value isImmutable",
  37792. referencedClasses: [],
  37793. pragmas: [],
  37794. messageSends: ["isImmutable", "value"]
  37795. }),
  37796. $globals.ValueNode);
  37797. $core.addMethod(
  37798. $core.method({
  37799. selector: "isValueNode",
  37800. protocol: "testing",
  37801. fn: function (){
  37802. var self=this,$self=this;
  37803. return true;
  37804. },
  37805. args: [],
  37806. source: "isValueNode\x0a\x09^ true",
  37807. referencedClasses: [],
  37808. pragmas: [],
  37809. messageSends: []
  37810. }),
  37811. $globals.ValueNode);
  37812. $core.addMethod(
  37813. $core.method({
  37814. selector: "value",
  37815. protocol: "accessing",
  37816. fn: function (){
  37817. var self=this,$self=this;
  37818. return $self.value;
  37819. },
  37820. args: [],
  37821. source: "value\x0a\x09^ value",
  37822. referencedClasses: [],
  37823. pragmas: [],
  37824. messageSends: []
  37825. }),
  37826. $globals.ValueNode);
  37827. $core.addMethod(
  37828. $core.method({
  37829. selector: "value:",
  37830. protocol: "accessing",
  37831. fn: function (anObject){
  37832. var self=this,$self=this;
  37833. $self.value=anObject;
  37834. return self;
  37835. },
  37836. args: ["anObject"],
  37837. source: "value: anObject\x0a\x09value := anObject",
  37838. referencedClasses: [],
  37839. pragmas: [],
  37840. messageSends: []
  37841. }),
  37842. $globals.ValueNode);
  37843. $core.addClass("VariableNode", $globals.ValueNode, ["assigned", "binding"], "Compiler-AST");
  37844. $globals.VariableNode.comment="I represent an variable node.";
  37845. $core.addMethod(
  37846. $core.method({
  37847. selector: "acceptDagVisitor:",
  37848. protocol: "visiting",
  37849. fn: function (aVisitor){
  37850. var self=this,$self=this;
  37851. return $core.withContext(function($ctx1) {
  37852. return $recv(aVisitor)._visitVariableNode_(self);
  37853. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  37854. },
  37855. args: ["aVisitor"],
  37856. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitVariableNode: self",
  37857. referencedClasses: [],
  37858. pragmas: [],
  37859. messageSends: ["visitVariableNode:"]
  37860. }),
  37861. $globals.VariableNode);
  37862. $core.addMethod(
  37863. $core.method({
  37864. selector: "alias",
  37865. protocol: "accessing",
  37866. fn: function (){
  37867. var self=this,$self=this;
  37868. return $core.withContext(function($ctx1) {
  37869. return $recv($self._binding())._alias();
  37870. }, function($ctx1) {$ctx1.fill(self,"alias",{})});
  37871. },
  37872. args: [],
  37873. source: "alias\x0a\x09^ self binding alias",
  37874. referencedClasses: [],
  37875. pragmas: [],
  37876. messageSends: ["alias", "binding"]
  37877. }),
  37878. $globals.VariableNode);
  37879. $core.addMethod(
  37880. $core.method({
  37881. selector: "assigned",
  37882. protocol: "accessing",
  37883. fn: function (){
  37884. var self=this,$self=this;
  37885. return $core.withContext(function($ctx1) {
  37886. var $1,$receiver;
  37887. $1=$self.assigned;
  37888. if(($receiver = $1) == null || $receiver.a$nil){
  37889. return false;
  37890. } else {
  37891. return $1;
  37892. }
  37893. }, function($ctx1) {$ctx1.fill(self,"assigned",{})});
  37894. },
  37895. args: [],
  37896. source: "assigned\x0a\x09^ assigned ifNil: [ false ]",
  37897. referencedClasses: [],
  37898. pragmas: [],
  37899. messageSends: ["ifNil:"]
  37900. }),
  37901. $globals.VariableNode);
  37902. $core.addMethod(
  37903. $core.method({
  37904. selector: "assigned:",
  37905. protocol: "accessing",
  37906. fn: function (aBoolean){
  37907. var self=this,$self=this;
  37908. $self.assigned=aBoolean;
  37909. return self;
  37910. },
  37911. args: ["aBoolean"],
  37912. source: "assigned: aBoolean\x0a\x09assigned := aBoolean",
  37913. referencedClasses: [],
  37914. pragmas: [],
  37915. messageSends: []
  37916. }),
  37917. $globals.VariableNode);
  37918. $core.addMethod(
  37919. $core.method({
  37920. selector: "beAssigned",
  37921. protocol: "accessing",
  37922. fn: function (){
  37923. var self=this,$self=this;
  37924. return $core.withContext(function($ctx1) {
  37925. $recv($self._binding())._validateAssignment();
  37926. $self.assigned=true;
  37927. return self;
  37928. }, function($ctx1) {$ctx1.fill(self,"beAssigned",{})});
  37929. },
  37930. args: [],
  37931. source: "beAssigned\x0a\x09self binding validateAssignment.\x0a\x09assigned := true",
  37932. referencedClasses: [],
  37933. pragmas: [],
  37934. messageSends: ["validateAssignment", "binding"]
  37935. }),
  37936. $globals.VariableNode);
  37937. $core.addMethod(
  37938. $core.method({
  37939. selector: "binding",
  37940. protocol: "accessing",
  37941. fn: function (){
  37942. var self=this,$self=this;
  37943. return $self.binding;
  37944. },
  37945. args: [],
  37946. source: "binding\x0a\x09^ binding",
  37947. referencedClasses: [],
  37948. pragmas: [],
  37949. messageSends: []
  37950. }),
  37951. $globals.VariableNode);
  37952. $core.addMethod(
  37953. $core.method({
  37954. selector: "binding:",
  37955. protocol: "accessing",
  37956. fn: function (aScopeVar){
  37957. var self=this,$self=this;
  37958. $self.binding=aScopeVar;
  37959. return self;
  37960. },
  37961. args: ["aScopeVar"],
  37962. source: "binding: aScopeVar\x0a\x09binding := aScopeVar",
  37963. referencedClasses: [],
  37964. pragmas: [],
  37965. messageSends: []
  37966. }),
  37967. $globals.VariableNode);
  37968. $core.addMethod(
  37969. $core.method({
  37970. selector: "isArgument",
  37971. protocol: "testing",
  37972. fn: function (){
  37973. var self=this,$self=this;
  37974. return $core.withContext(function($ctx1) {
  37975. return $recv($self._binding())._isArgVar();
  37976. }, function($ctx1) {$ctx1.fill(self,"isArgument",{})});
  37977. },
  37978. args: [],
  37979. source: "isArgument\x0a\x09^ self binding isArgVar",
  37980. referencedClasses: [],
  37981. pragmas: [],
  37982. messageSends: ["isArgVar", "binding"]
  37983. }),
  37984. $globals.VariableNode);
  37985. $core.addMethod(
  37986. $core.method({
  37987. selector: "isImmutable",
  37988. protocol: "testing",
  37989. fn: function (){
  37990. var self=this,$self=this;
  37991. return $core.withContext(function($ctx1) {
  37992. return $recv($self._binding())._isImmutable();
  37993. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{})});
  37994. },
  37995. args: [],
  37996. source: "isImmutable\x0a\x09^ self binding isImmutable",
  37997. referencedClasses: [],
  37998. pragmas: [],
  37999. messageSends: ["isImmutable", "binding"]
  38000. }),
  38001. $globals.VariableNode);
  38002. $core.addMethod(
  38003. $core.method({
  38004. selector: "isNavigationNode",
  38005. protocol: "testing",
  38006. fn: function (){
  38007. var self=this,$self=this;
  38008. return true;
  38009. },
  38010. args: [],
  38011. source: "isNavigationNode\x0a\x09^ true",
  38012. referencedClasses: [],
  38013. pragmas: [],
  38014. messageSends: []
  38015. }),
  38016. $globals.VariableNode);
  38017. $core.addMethod(
  38018. $core.method({
  38019. selector: "isSuperKeyword",
  38020. protocol: "testing",
  38021. fn: function (){
  38022. var self=this,$self=this;
  38023. return $core.withContext(function($ctx1) {
  38024. return $recv($self._value()).__eq("super");
  38025. }, function($ctx1) {$ctx1.fill(self,"isSuperKeyword",{})});
  38026. },
  38027. args: [],
  38028. source: "isSuperKeyword\x0a\x09^ self value = 'super'",
  38029. referencedClasses: [],
  38030. pragmas: [],
  38031. messageSends: ["=", "value"]
  38032. }),
  38033. $globals.VariableNode);
  38034. $core.addMethod(
  38035. $core.method({
  38036. selector: "isVariableNode",
  38037. protocol: "testing",
  38038. fn: function (){
  38039. var self=this,$self=this;
  38040. return true;
  38041. },
  38042. args: [],
  38043. source: "isVariableNode\x0a\x09^ true",
  38044. referencedClasses: [],
  38045. pragmas: [],
  38046. messageSends: []
  38047. }),
  38048. $globals.VariableNode);
  38049. $core.addMethod(
  38050. $core.method({
  38051. selector: "navigationLink",
  38052. protocol: "accessing",
  38053. fn: function (){
  38054. var self=this,$self=this;
  38055. return $core.withContext(function($ctx1) {
  38056. return $self._value();
  38057. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{})});
  38058. },
  38059. args: [],
  38060. source: "navigationLink\x0a\x09^ self value",
  38061. referencedClasses: [],
  38062. pragmas: [],
  38063. messageSends: ["value"]
  38064. }),
  38065. $globals.VariableNode);
  38066. $core.addClass("CompilerError", $globals.Error, [], "Compiler-AST");
  38067. $globals.CompilerError.comment="I am the common superclass of all compiling errors.";
  38068. $core.addClass("ParentFakingPathDagVisitor", $globals.PathDagVisitor, ["setParentSelector"], "Compiler-AST");
  38069. $globals.ParentFakingPathDagVisitor.comment="I am base class of `DagNode` visitor.\x0a\x0aI hold the path of ancestors up to actual node\x0ain `self path`.";
  38070. $core.addMethod(
  38071. $core.method({
  38072. selector: "visit:",
  38073. protocol: "visiting",
  38074. fn: function (aNode){
  38075. var self=this,$self=this;
  38076. return $core.withContext(function($ctx1) {
  38077. var $1;
  38078. $recv($self._path())._ifNotEmpty_((function(p){
  38079. return $core.withContext(function($ctx2) {
  38080. return $recv(aNode)._parent_($recv(p)._last());
  38081. }, function($ctx2) {$ctx2.fillBlock({p:p},$ctx1,1)});
  38082. }));
  38083. $1=(
  38084. $ctx1.supercall = true,
  38085. ($globals.ParentFakingPathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
  38086. $ctx1.supercall = false;
  38087. return $1;
  38088. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode})});
  38089. },
  38090. args: ["aNode"],
  38091. source: "visit: aNode\x0a\x09self path ifNotEmpty: [ :p | aNode parent: p last ].\x0a\x09^ super visit: aNode",
  38092. referencedClasses: [],
  38093. pragmas: [],
  38094. messageSends: ["ifNotEmpty:", "path", "parent:", "last", "visit:"]
  38095. }),
  38096. $globals.ParentFakingPathDagVisitor);
  38097. $core.addClass("NodeVisitor", $globals.ParentFakingPathDagVisitor, [], "Compiler-AST");
  38098. $globals.NodeVisitor.comment="I am the abstract super class of all AST node visitors.";
  38099. $core.addMethod(
  38100. $core.method({
  38101. selector: "visitAssignmentNode:",
  38102. protocol: "visiting",
  38103. fn: function (aNode){
  38104. var self=this,$self=this;
  38105. return $core.withContext(function($ctx1) {
  38106. return $self._visitDagNode_(aNode);
  38107. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode})});
  38108. },
  38109. args: ["aNode"],
  38110. source: "visitAssignmentNode: aNode\x0a\x09^ self visitDagNode: aNode",
  38111. referencedClasses: [],
  38112. pragmas: [],
  38113. messageSends: ["visitDagNode:"]
  38114. }),
  38115. $globals.NodeVisitor);
  38116. $core.addMethod(
  38117. $core.method({
  38118. selector: "visitBlockNode:",
  38119. protocol: "visiting",
  38120. fn: function (aNode){
  38121. var self=this,$self=this;
  38122. return $core.withContext(function($ctx1) {
  38123. return $self._visitDagNode_(aNode);
  38124. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode})});
  38125. },
  38126. args: ["aNode"],
  38127. source: "visitBlockNode: aNode\x0a\x09^ self visitDagNode: aNode",
  38128. referencedClasses: [],
  38129. pragmas: [],
  38130. messageSends: ["visitDagNode:"]
  38131. }),
  38132. $globals.NodeVisitor);
  38133. $core.addMethod(
  38134. $core.method({
  38135. selector: "visitBlockSequenceNode:",
  38136. protocol: "visiting",
  38137. fn: function (aNode){
  38138. var self=this,$self=this;
  38139. return $core.withContext(function($ctx1) {
  38140. return $self._visitSequenceNode_(aNode);
  38141. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode})});
  38142. },
  38143. args: ["aNode"],
  38144. source: "visitBlockSequenceNode: aNode\x0a\x09^ self visitSequenceNode: aNode",
  38145. referencedClasses: [],
  38146. pragmas: [],
  38147. messageSends: ["visitSequenceNode:"]
  38148. }),
  38149. $globals.NodeVisitor);
  38150. $core.addMethod(
  38151. $core.method({
  38152. selector: "visitCascadeNode:",
  38153. protocol: "visiting",
  38154. fn: function (aNode){
  38155. var self=this,$self=this;
  38156. return $core.withContext(function($ctx1) {
  38157. return $self._visitDagNode_(aNode);
  38158. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode})});
  38159. },
  38160. args: ["aNode"],
  38161. source: "visitCascadeNode: aNode\x0a\x09^ self visitDagNode: aNode",
  38162. referencedClasses: [],
  38163. pragmas: [],
  38164. messageSends: ["visitDagNode:"]
  38165. }),
  38166. $globals.NodeVisitor);
  38167. $core.addMethod(
  38168. $core.method({
  38169. selector: "visitDagNode:",
  38170. protocol: "visiting",
  38171. fn: function (aNode){
  38172. var self=this,$self=this;
  38173. return $core.withContext(function($ctx1) {
  38174. return $self._visitDagNodeVariantSimple_(aNode);
  38175. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode})});
  38176. },
  38177. args: ["aNode"],
  38178. source: "visitDagNode: aNode\x0a\x09^ self visitDagNodeVariantSimple: aNode",
  38179. referencedClasses: [],
  38180. pragmas: [],
  38181. messageSends: ["visitDagNodeVariantSimple:"]
  38182. }),
  38183. $globals.NodeVisitor);
  38184. $core.addMethod(
  38185. $core.method({
  38186. selector: "visitDynamicArrayNode:",
  38187. protocol: "visiting",
  38188. fn: function (aNode){
  38189. var self=this,$self=this;
  38190. return $core.withContext(function($ctx1) {
  38191. return $self._visitDagNode_(aNode);
  38192. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode})});
  38193. },
  38194. args: ["aNode"],
  38195. source: "visitDynamicArrayNode: aNode\x0a\x09^ self visitDagNode: aNode",
  38196. referencedClasses: [],
  38197. pragmas: [],
  38198. messageSends: ["visitDagNode:"]
  38199. }),
  38200. $globals.NodeVisitor);
  38201. $core.addMethod(
  38202. $core.method({
  38203. selector: "visitDynamicDictionaryNode:",
  38204. protocol: "visiting",
  38205. fn: function (aNode){
  38206. var self=this,$self=this;
  38207. return $core.withContext(function($ctx1) {
  38208. return $self._visitDagNode_(aNode);
  38209. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode})});
  38210. },
  38211. args: ["aNode"],
  38212. source: "visitDynamicDictionaryNode: aNode\x0a\x09^ self visitDagNode: aNode",
  38213. referencedClasses: [],
  38214. pragmas: [],
  38215. messageSends: ["visitDagNode:"]
  38216. }),
  38217. $globals.NodeVisitor);
  38218. $core.addMethod(
  38219. $core.method({
  38220. selector: "visitJSStatementNode:",
  38221. protocol: "visiting",
  38222. fn: function (aNode){
  38223. var self=this,$self=this;
  38224. return $core.withContext(function($ctx1) {
  38225. return $self._visitDagNode_(aNode);
  38226. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode})});
  38227. },
  38228. args: ["aNode"],
  38229. source: "visitJSStatementNode: aNode\x0a\x09^ self visitDagNode: aNode",
  38230. referencedClasses: [],
  38231. pragmas: [],
  38232. messageSends: ["visitDagNode:"]
  38233. }),
  38234. $globals.NodeVisitor);
  38235. $core.addMethod(
  38236. $core.method({
  38237. selector: "visitMethodNode:",
  38238. protocol: "visiting",
  38239. fn: function (aNode){
  38240. var self=this,$self=this;
  38241. return $core.withContext(function($ctx1) {
  38242. return $self._visitDagNode_(aNode);
  38243. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode})});
  38244. },
  38245. args: ["aNode"],
  38246. source: "visitMethodNode: aNode\x0a\x09^ self visitDagNode: aNode",
  38247. referencedClasses: [],
  38248. pragmas: [],
  38249. messageSends: ["visitDagNode:"]
  38250. }),
  38251. $globals.NodeVisitor);
  38252. $core.addMethod(
  38253. $core.method({
  38254. selector: "visitReturnNode:",
  38255. protocol: "visiting",
  38256. fn: function (aNode){
  38257. var self=this,$self=this;
  38258. return $core.withContext(function($ctx1) {
  38259. return $self._visitDagNode_(aNode);
  38260. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode})});
  38261. },
  38262. args: ["aNode"],
  38263. source: "visitReturnNode: aNode\x0a\x09^ self visitDagNode: aNode",
  38264. referencedClasses: [],
  38265. pragmas: [],
  38266. messageSends: ["visitDagNode:"]
  38267. }),
  38268. $globals.NodeVisitor);
  38269. $core.addMethod(
  38270. $core.method({
  38271. selector: "visitSendNode:",
  38272. protocol: "visiting",
  38273. fn: function (aNode){
  38274. var self=this,$self=this;
  38275. return $core.withContext(function($ctx1) {
  38276. return $self._visitDagNode_(aNode);
  38277. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode})});
  38278. },
  38279. args: ["aNode"],
  38280. source: "visitSendNode: aNode\x0a\x09^ self visitDagNode: aNode",
  38281. referencedClasses: [],
  38282. pragmas: [],
  38283. messageSends: ["visitDagNode:"]
  38284. }),
  38285. $globals.NodeVisitor);
  38286. $core.addMethod(
  38287. $core.method({
  38288. selector: "visitSequenceNode:",
  38289. protocol: "visiting",
  38290. fn: function (aNode){
  38291. var self=this,$self=this;
  38292. return $core.withContext(function($ctx1) {
  38293. return $self._visitDagNode_(aNode);
  38294. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode})});
  38295. },
  38296. args: ["aNode"],
  38297. source: "visitSequenceNode: aNode\x0a\x09^ self visitDagNode: aNode",
  38298. referencedClasses: [],
  38299. pragmas: [],
  38300. messageSends: ["visitDagNode:"]
  38301. }),
  38302. $globals.NodeVisitor);
  38303. $core.addMethod(
  38304. $core.method({
  38305. selector: "visitValueNode:",
  38306. protocol: "visiting",
  38307. fn: function (aNode){
  38308. var self=this,$self=this;
  38309. return $core.withContext(function($ctx1) {
  38310. return $self._visitDagNode_(aNode);
  38311. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode})});
  38312. },
  38313. args: ["aNode"],
  38314. source: "visitValueNode: aNode\x0a\x09^ self visitDagNode: aNode",
  38315. referencedClasses: [],
  38316. pragmas: [],
  38317. messageSends: ["visitDagNode:"]
  38318. }),
  38319. $globals.NodeVisitor);
  38320. $core.addMethod(
  38321. $core.method({
  38322. selector: "visitVariableNode:",
  38323. protocol: "visiting",
  38324. fn: function (aNode){
  38325. var self=this,$self=this;
  38326. return $core.withContext(function($ctx1) {
  38327. return $self._visitDagNode_(aNode);
  38328. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode})});
  38329. },
  38330. args: ["aNode"],
  38331. source: "visitVariableNode: aNode\x0a\x09^ self visitDagNode: aNode",
  38332. referencedClasses: [],
  38333. pragmas: [],
  38334. messageSends: ["visitDagNode:"]
  38335. }),
  38336. $globals.NodeVisitor);
  38337. $core.addClass("AstPragmator", $globals.NodeVisitor, ["methodNode"], "Compiler-AST");
  38338. $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.";
  38339. $core.addMethod(
  38340. $core.method({
  38341. selector: "methodNode",
  38342. protocol: "accessing",
  38343. fn: function (){
  38344. var self=this,$self=this;
  38345. return $self.methodNode;
  38346. },
  38347. args: [],
  38348. source: "methodNode\x0a\x09^ methodNode",
  38349. referencedClasses: [],
  38350. pragmas: [],
  38351. messageSends: []
  38352. }),
  38353. $globals.AstPragmator);
  38354. $core.addMethod(
  38355. $core.method({
  38356. selector: "methodNode:",
  38357. protocol: "accessing",
  38358. fn: function (anObject){
  38359. var self=this,$self=this;
  38360. $self.methodNode=anObject;
  38361. return self;
  38362. },
  38363. args: ["anObject"],
  38364. source: "methodNode: anObject\x0a\x09methodNode := anObject",
  38365. referencedClasses: [],
  38366. pragmas: [],
  38367. messageSends: []
  38368. }),
  38369. $globals.AstPragmator);
  38370. $core.addMethod(
  38371. $core.method({
  38372. selector: "visitMethodNode:",
  38373. protocol: "visiting",
  38374. fn: function (aNode){
  38375. var self=this,$self=this;
  38376. return $core.withContext(function($ctx1) {
  38377. var $1;
  38378. $self._methodNode_(aNode);
  38379. $self._processPragmas_($recv(aNode)._pragmas());
  38380. $1=(
  38381. $ctx1.supercall = true,
  38382. ($globals.AstPragmator.superclass||$boot.nilAsClass).fn.prototype._visitMethodNode_.apply($self, [aNode]));
  38383. $ctx1.supercall = false;
  38384. return $1;
  38385. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode})});
  38386. },
  38387. args: ["aNode"],
  38388. source: "visitMethodNode: aNode\x0a\x09self methodNode: aNode.\x0a\x09self processPragmas: aNode pragmas.\x0a\x09^ super visitMethodNode: aNode",
  38389. referencedClasses: [],
  38390. pragmas: [],
  38391. messageSends: ["methodNode:", "processPragmas:", "pragmas", "visitMethodNode:"]
  38392. }),
  38393. $globals.AstPragmator);
  38394. $core.addClass("AstEarlyPragmator", $globals.AstPragmator, [], "Compiler-AST");
  38395. $core.addMethod(
  38396. $core.method({
  38397. selector: "inlineJS:",
  38398. protocol: "pragmas",
  38399. fn: function (aString){
  38400. var self=this,$self=this;
  38401. return $core.withContext(function($ctx1) {
  38402. var $3,$2,$1,$4,$6,$5;
  38403. $3=$self._methodNode();
  38404. $ctx1.sendIdx["methodNode"]=1;
  38405. $2=$recv($3)._sequenceNode();
  38406. $ctx1.sendIdx["sequenceNode"]=1;
  38407. $1=$recv($2)._dagChildren();
  38408. $recv($1)._ifNotEmpty_((function(){
  38409. return $core.withContext(function($ctx2) {
  38410. return $recv($globals.CompilerError)._signal_("There must be no other code or code generator pragma than a lone inlineJS:");
  38411. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38412. }));
  38413. $4=$recv($self._methodNode())._sequenceNode();
  38414. $6=$recv($globals.JSStatementNode)._new();
  38415. $recv($6)._source_(aString);
  38416. $5=$recv($6)._yourself();
  38417. $recv($4)._addDagChild_($5);
  38418. return self;
  38419. }, function($ctx1) {$ctx1.fill(self,"inlineJS:",{aString:aString})});
  38420. },
  38421. args: ["aString"],
  38422. 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)",
  38423. referencedClasses: ["CompilerError", "JSStatementNode"],
  38424. pragmas: [],
  38425. messageSends: ["ifNotEmpty:", "dagChildren", "sequenceNode", "methodNode", "signal:", "addDagChild:", "source:", "new", "yourself"]
  38426. }),
  38427. $globals.AstEarlyPragmator);
  38428. $core.setTraitComposition([{trait: $globals.TPragmator}], $globals.AstPragmator);
  38429. $core.addMethod(
  38430. $core.method({
  38431. selector: "ast",
  38432. protocol: "*Compiler-AST",
  38433. fn: function (){
  38434. var self=this,$self=this;
  38435. return $core.withContext(function($ctx1) {
  38436. var $1;
  38437. $1=$self._source();
  38438. $ctx1.sendIdx["source"]=1;
  38439. $recv($1)._ifEmpty_((function(){
  38440. return $core.withContext(function($ctx2) {
  38441. return $recv($globals.CompilerError)._signal_("Method source is empty");
  38442. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38443. }));
  38444. return $recv($recv($globals.Compiler)._new())._ast_forClass_protocol_($self._source(),$self._origin(),$self._protocol());
  38445. }, function($ctx1) {$ctx1.fill(self,"ast",{})});
  38446. },
  38447. args: [],
  38448. 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",
  38449. referencedClasses: ["CompilerError", "Compiler"],
  38450. pragmas: [],
  38451. messageSends: ["ifEmpty:", "source", "signal:", "ast:forClass:protocol:", "new", "origin", "protocol"]
  38452. }),
  38453. $globals.CompiledMethod);
  38454. });
  38455. define('amber/core/Compiler-Semantic',["amber/boot", "require", "amber/core/Compiler-AST", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  38456. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  38457. var $pkg = $core.addPackage("Compiler-Semantic");
  38458. $pkg.innerEval = function (expr) { return eval(expr); };
  38459. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  38460. $core.addClass("LexicalScope", $globals.Object, ["node", "instruction", "temps", "args", "outerScope", "blockIndex"], "Compiler-Semantic");
  38461. $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.";
  38462. $core.addMethod(
  38463. $core.method({
  38464. selector: "addArg:",
  38465. protocol: "adding",
  38466. fn: function (aString){
  38467. var self=this,$self=this;
  38468. return $core.withContext(function($ctx1) {
  38469. var $1;
  38470. $1=$self._args();
  38471. $ctx1.sendIdx["args"]=1;
  38472. $recv($1)._at_put_(aString,$recv($globals.ArgVar)._on_(aString));
  38473. $recv($recv($self._args())._at_(aString))._scope_(self);
  38474. return self;
  38475. }, function($ctx1) {$ctx1.fill(self,"addArg:",{aString:aString})});
  38476. },
  38477. args: ["aString"],
  38478. source: "addArg: aString\x0a\x09self args at: aString put: (ArgVar on: aString).\x0a\x09(self args at: aString) scope: self",
  38479. referencedClasses: ["ArgVar"],
  38480. pragmas: [],
  38481. messageSends: ["at:put:", "args", "on:", "scope:", "at:"]
  38482. }),
  38483. $globals.LexicalScope);
  38484. $core.addMethod(
  38485. $core.method({
  38486. selector: "addTemp:",
  38487. protocol: "adding",
  38488. fn: function (aString){
  38489. var self=this,$self=this;
  38490. return $core.withContext(function($ctx1) {
  38491. var $1;
  38492. $1=$self._temps();
  38493. $ctx1.sendIdx["temps"]=1;
  38494. $recv($1)._at_put_(aString,$recv($globals.TempVar)._on_(aString));
  38495. $recv($recv($self._temps())._at_(aString))._scope_(self);
  38496. return self;
  38497. }, function($ctx1) {$ctx1.fill(self,"addTemp:",{aString:aString})});
  38498. },
  38499. args: ["aString"],
  38500. source: "addTemp: aString\x0a\x09self temps at: aString put: (TempVar on: aString).\x0a\x09(self temps at: aString) scope: self",
  38501. referencedClasses: ["TempVar"],
  38502. pragmas: [],
  38503. messageSends: ["at:put:", "temps", "on:", "scope:", "at:"]
  38504. }),
  38505. $globals.LexicalScope);
  38506. $core.addMethod(
  38507. $core.method({
  38508. selector: "alias",
  38509. protocol: "accessing",
  38510. fn: function (){
  38511. var self=this,$self=this;
  38512. return $core.withContext(function($ctx1) {
  38513. return "$ctx".__comma($recv($self._scopeLevel())._asString());
  38514. }, function($ctx1) {$ctx1.fill(self,"alias",{})});
  38515. },
  38516. args: [],
  38517. source: "alias\x0a\x09^ '$ctx', self scopeLevel asString",
  38518. referencedClasses: [],
  38519. pragmas: [],
  38520. messageSends: [",", "asString", "scopeLevel"]
  38521. }),
  38522. $globals.LexicalScope);
  38523. $core.addMethod(
  38524. $core.method({
  38525. selector: "allVariableNames",
  38526. protocol: "accessing",
  38527. fn: function (){
  38528. var self=this,$self=this;
  38529. return $core.withContext(function($ctx1) {
  38530. var $1;
  38531. $1=$recv($self._args())._keys();
  38532. $ctx1.sendIdx["keys"]=1;
  38533. return $recv($1).__comma($recv($self._temps())._keys());
  38534. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{})});
  38535. },
  38536. args: [],
  38537. source: "allVariableNames\x0a\x09^ self args keys, self temps keys",
  38538. referencedClasses: [],
  38539. pragmas: [],
  38540. messageSends: [",", "keys", "args", "temps"]
  38541. }),
  38542. $globals.LexicalScope);
  38543. $core.addMethod(
  38544. $core.method({
  38545. selector: "args",
  38546. protocol: "accessing",
  38547. fn: function (){
  38548. var self=this,$self=this;
  38549. return $core.withContext(function($ctx1) {
  38550. var $1,$receiver;
  38551. $1=$self.args;
  38552. if(($receiver = $1) == null || $receiver.a$nil){
  38553. $self.args=$recv($globals.Dictionary)._new();
  38554. return $self.args;
  38555. } else {
  38556. return $1;
  38557. }
  38558. }, function($ctx1) {$ctx1.fill(self,"args",{})});
  38559. },
  38560. args: [],
  38561. source: "args\x0a\x09^ args ifNil: [ args := Dictionary new ]",
  38562. referencedClasses: ["Dictionary"],
  38563. pragmas: [],
  38564. messageSends: ["ifNil:", "new"]
  38565. }),
  38566. $globals.LexicalScope);
  38567. $core.addMethod(
  38568. $core.method({
  38569. selector: "bindingFor:",
  38570. protocol: "accessing",
  38571. fn: function (aStringOrNode){
  38572. var self=this,$self=this;
  38573. return $core.withContext(function($ctx1) {
  38574. var $2,$3,$4,$5,$1;
  38575. $2=$self._pseudoVars();
  38576. $3=$recv(aStringOrNode)._value();
  38577. $ctx1.sendIdx["value"]=1;
  38578. $1=$recv($2)._at_ifAbsent_($3,(function(){
  38579. return $core.withContext(function($ctx2) {
  38580. $4=$self._args();
  38581. $5=$recv(aStringOrNode)._value();
  38582. $ctx2.sendIdx["value"]=2;
  38583. return $recv($4)._at_ifAbsent_($5,(function(){
  38584. return $core.withContext(function($ctx3) {
  38585. return $recv($self._temps())._at_ifAbsent_($recv(aStringOrNode)._value(),(function(){
  38586. return nil;
  38587. }));
  38588. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  38589. }));
  38590. $ctx2.sendIdx["at:ifAbsent:"]=2;
  38591. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38592. }));
  38593. $ctx1.sendIdx["at:ifAbsent:"]=1;
  38594. return $1;
  38595. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aStringOrNode:aStringOrNode})});
  38596. },
  38597. args: ["aStringOrNode"],
  38598. source: "bindingFor: aStringOrNode\x0a\x09^ self pseudoVars at: aStringOrNode value ifAbsent: [\x0a\x09\x09self args at: aStringOrNode value ifAbsent: [\x0a\x09\x09\x09self temps at: aStringOrNode value ifAbsent: [ nil ]]]",
  38599. referencedClasses: [],
  38600. pragmas: [],
  38601. messageSends: ["at:ifAbsent:", "pseudoVars", "value", "args", "temps"]
  38602. }),
  38603. $globals.LexicalScope);
  38604. $core.addMethod(
  38605. $core.method({
  38606. selector: "blockIndex",
  38607. protocol: "accessing",
  38608. fn: function (){
  38609. var self=this,$self=this;
  38610. return $core.withContext(function($ctx1) {
  38611. var $1,$receiver;
  38612. $1=$self.blockIndex;
  38613. if(($receiver = $1) == null || $receiver.a$nil){
  38614. return (0);
  38615. } else {
  38616. return $1;
  38617. }
  38618. }, function($ctx1) {$ctx1.fill(self,"blockIndex",{})});
  38619. },
  38620. args: [],
  38621. source: "blockIndex\x0a\x09^ blockIndex ifNil: [ 0 ]",
  38622. referencedClasses: [],
  38623. pragmas: [],
  38624. messageSends: ["ifNil:"]
  38625. }),
  38626. $globals.LexicalScope);
  38627. $core.addMethod(
  38628. $core.method({
  38629. selector: "blockIndex:",
  38630. protocol: "accessing",
  38631. fn: function (anInteger){
  38632. var self=this,$self=this;
  38633. $self.blockIndex=anInteger;
  38634. return self;
  38635. },
  38636. args: ["anInteger"],
  38637. source: "blockIndex: anInteger \x0a\x09blockIndex := anInteger",
  38638. referencedClasses: [],
  38639. pragmas: [],
  38640. messageSends: []
  38641. }),
  38642. $globals.LexicalScope);
  38643. $core.addMethod(
  38644. $core.method({
  38645. selector: "canInlineNonLocalReturns",
  38646. protocol: "testing",
  38647. fn: function (){
  38648. var self=this,$self=this;
  38649. return $core.withContext(function($ctx1) {
  38650. return $recv($self._isInlined())._and_((function(){
  38651. return $core.withContext(function($ctx2) {
  38652. return $recv($self._outerScope())._canInlineNonLocalReturns();
  38653. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38654. }));
  38655. }, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{})});
  38656. },
  38657. args: [],
  38658. source: "canInlineNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]",
  38659. referencedClasses: [],
  38660. pragmas: [],
  38661. messageSends: ["and:", "isInlined", "canInlineNonLocalReturns", "outerScope"]
  38662. }),
  38663. $globals.LexicalScope);
  38664. $core.addMethod(
  38665. $core.method({
  38666. selector: "instruction",
  38667. protocol: "accessing",
  38668. fn: function (){
  38669. var self=this,$self=this;
  38670. return $self.instruction;
  38671. },
  38672. args: [],
  38673. source: "instruction\x0a\x09^ instruction",
  38674. referencedClasses: [],
  38675. pragmas: [],
  38676. messageSends: []
  38677. }),
  38678. $globals.LexicalScope);
  38679. $core.addMethod(
  38680. $core.method({
  38681. selector: "instruction:",
  38682. protocol: "accessing",
  38683. fn: function (anIRInstruction){
  38684. var self=this,$self=this;
  38685. $self.instruction=anIRInstruction;
  38686. return self;
  38687. },
  38688. args: ["anIRInstruction"],
  38689. source: "instruction: anIRInstruction\x0a\x09instruction := anIRInstruction",
  38690. referencedClasses: [],
  38691. pragmas: [],
  38692. messageSends: []
  38693. }),
  38694. $globals.LexicalScope);
  38695. $core.addMethod(
  38696. $core.method({
  38697. selector: "isBlockScope",
  38698. protocol: "testing",
  38699. fn: function (){
  38700. var self=this,$self=this;
  38701. return $core.withContext(function($ctx1) {
  38702. return $recv($self._isMethodScope())._not();
  38703. }, function($ctx1) {$ctx1.fill(self,"isBlockScope",{})});
  38704. },
  38705. args: [],
  38706. source: "isBlockScope\x0a\x09^ self isMethodScope not",
  38707. referencedClasses: [],
  38708. pragmas: [],
  38709. messageSends: ["not", "isMethodScope"]
  38710. }),
  38711. $globals.LexicalScope);
  38712. $core.addMethod(
  38713. $core.method({
  38714. selector: "isInlined",
  38715. protocol: "testing",
  38716. fn: function (){
  38717. var self=this,$self=this;
  38718. return $core.withContext(function($ctx1) {
  38719. var $2,$1;
  38720. $2=$self._instruction();
  38721. $ctx1.sendIdx["instruction"]=1;
  38722. $1=$recv($2)._notNil();
  38723. return $recv($1)._and_((function(){
  38724. return $core.withContext(function($ctx2) {
  38725. return $recv($self._instruction())._isInlined();
  38726. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38727. }));
  38728. }, function($ctx1) {$ctx1.fill(self,"isInlined",{})});
  38729. },
  38730. args: [],
  38731. source: "isInlined\x0a\x09^ self instruction notNil and: [\x0a\x09\x09self instruction isInlined ]",
  38732. referencedClasses: [],
  38733. pragmas: [],
  38734. messageSends: ["and:", "notNil", "instruction", "isInlined"]
  38735. }),
  38736. $globals.LexicalScope);
  38737. $core.addMethod(
  38738. $core.method({
  38739. selector: "isMethodScope",
  38740. protocol: "testing",
  38741. fn: function (){
  38742. var self=this,$self=this;
  38743. return false;
  38744. },
  38745. args: [],
  38746. source: "isMethodScope\x0a\x09^ false",
  38747. referencedClasses: [],
  38748. pragmas: [],
  38749. messageSends: []
  38750. }),
  38751. $globals.LexicalScope);
  38752. $core.addMethod(
  38753. $core.method({
  38754. selector: "lookupVariable:",
  38755. protocol: "accessing",
  38756. fn: function (aNode){
  38757. var self=this,$self=this;
  38758. var lookup;
  38759. return $core.withContext(function($ctx1) {
  38760. var $1,$2,$receiver;
  38761. lookup=$self._bindingFor_(aNode);
  38762. $1=lookup;
  38763. if(($receiver = $1) == null || $receiver.a$nil){
  38764. $2=$self._outerScope();
  38765. $ctx1.sendIdx["outerScope"]=1;
  38766. if(($receiver = $2) == null || $receiver.a$nil){
  38767. lookup=$2;
  38768. } else {
  38769. lookup=$recv($self._outerScope())._lookupVariable_(aNode);
  38770. }
  38771. lookup;
  38772. } else {
  38773. $1;
  38774. }
  38775. return lookup;
  38776. }, function($ctx1) {$ctx1.fill(self,"lookupVariable:",{aNode:aNode,lookup:lookup})});
  38777. },
  38778. args: ["aNode"],
  38779. source: "lookupVariable: aNode\x0a\x09| lookup |\x0a\x09lookup := (self bindingFor: aNode).\x0a\x09lookup ifNil: [\x0a\x09\x09lookup := self outerScope ifNotNil: [\x0a\x09\x09\x09(self outerScope lookupVariable: aNode) ]].\x0a\x09^ lookup",
  38780. referencedClasses: [],
  38781. pragmas: [],
  38782. messageSends: ["bindingFor:", "ifNil:", "ifNotNil:", "outerScope", "lookupVariable:"]
  38783. }),
  38784. $globals.LexicalScope);
  38785. $core.addMethod(
  38786. $core.method({
  38787. selector: "methodScope",
  38788. protocol: "accessing",
  38789. fn: function (){
  38790. var self=this,$self=this;
  38791. return $core.withContext(function($ctx1) {
  38792. var $1,$receiver;
  38793. $1=$self._outerScope();
  38794. $ctx1.sendIdx["outerScope"]=1;
  38795. if(($receiver = $1) == null || $receiver.a$nil){
  38796. return $1;
  38797. } else {
  38798. return $recv($self._outerScope())._methodScope();
  38799. }
  38800. }, function($ctx1) {$ctx1.fill(self,"methodScope",{})});
  38801. },
  38802. args: [],
  38803. source: "methodScope\x0a\x09^ self outerScope ifNotNil: [\x0a\x09\x09self outerScope methodScope ]",
  38804. referencedClasses: [],
  38805. pragmas: [],
  38806. messageSends: ["ifNotNil:", "outerScope", "methodScope"]
  38807. }),
  38808. $globals.LexicalScope);
  38809. $core.addMethod(
  38810. $core.method({
  38811. selector: "node",
  38812. protocol: "accessing",
  38813. fn: function (){
  38814. var self=this,$self=this;
  38815. return $self.node;
  38816. },
  38817. args: [],
  38818. source: "node\x0a\x09\x22Answer the node in which I am defined\x22\x0a\x09\x0a\x09^ node",
  38819. referencedClasses: [],
  38820. pragmas: [],
  38821. messageSends: []
  38822. }),
  38823. $globals.LexicalScope);
  38824. $core.addMethod(
  38825. $core.method({
  38826. selector: "node:",
  38827. protocol: "accessing",
  38828. fn: function (aNode){
  38829. var self=this,$self=this;
  38830. $self.node=aNode;
  38831. return self;
  38832. },
  38833. args: ["aNode"],
  38834. source: "node: aNode\x0a\x09node := aNode",
  38835. referencedClasses: [],
  38836. pragmas: [],
  38837. messageSends: []
  38838. }),
  38839. $globals.LexicalScope);
  38840. $core.addMethod(
  38841. $core.method({
  38842. selector: "outerScope",
  38843. protocol: "accessing",
  38844. fn: function (){
  38845. var self=this,$self=this;
  38846. return $self.outerScope;
  38847. },
  38848. args: [],
  38849. source: "outerScope\x0a\x09^ outerScope",
  38850. referencedClasses: [],
  38851. pragmas: [],
  38852. messageSends: []
  38853. }),
  38854. $globals.LexicalScope);
  38855. $core.addMethod(
  38856. $core.method({
  38857. selector: "outerScope:",
  38858. protocol: "accessing",
  38859. fn: function (aLexicalScope){
  38860. var self=this,$self=this;
  38861. $self.outerScope=aLexicalScope;
  38862. return self;
  38863. },
  38864. args: ["aLexicalScope"],
  38865. source: "outerScope: aLexicalScope\x0a\x09outerScope := aLexicalScope",
  38866. referencedClasses: [],
  38867. pragmas: [],
  38868. messageSends: []
  38869. }),
  38870. $globals.LexicalScope);
  38871. $core.addMethod(
  38872. $core.method({
  38873. selector: "pseudoVars",
  38874. protocol: "accessing",
  38875. fn: function (){
  38876. var self=this,$self=this;
  38877. return $core.withContext(function($ctx1) {
  38878. return $recv($self._methodScope())._pseudoVars();
  38879. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{})});
  38880. },
  38881. args: [],
  38882. source: "pseudoVars\x0a\x09^ self methodScope pseudoVars",
  38883. referencedClasses: [],
  38884. pragmas: [],
  38885. messageSends: ["pseudoVars", "methodScope"]
  38886. }),
  38887. $globals.LexicalScope);
  38888. $core.addMethod(
  38889. $core.method({
  38890. selector: "scopeLevel",
  38891. protocol: "accessing",
  38892. fn: function (){
  38893. var self=this,$self=this;
  38894. return $core.withContext(function($ctx1) {
  38895. var $1,$2,$4,$3,$receiver;
  38896. $1=$self._outerScope();
  38897. $ctx1.sendIdx["outerScope"]=1;
  38898. if(($receiver = $1) == null || $receiver.a$nil){
  38899. return (1);
  38900. } else {
  38901. $1;
  38902. }
  38903. $2=$self._isInlined();
  38904. if($core.assert($2)){
  38905. $4=$self._outerScope();
  38906. $ctx1.sendIdx["outerScope"]=2;
  38907. $3=$recv($4)._scopeLevel();
  38908. $ctx1.sendIdx["scopeLevel"]=1;
  38909. return $3;
  38910. }
  38911. return $recv($recv($self._outerScope())._scopeLevel()).__plus((1));
  38912. }, function($ctx1) {$ctx1.fill(self,"scopeLevel",{})});
  38913. },
  38914. args: [],
  38915. source: "scopeLevel\x0a\x09self outerScope ifNil: [ ^ 1 ].\x0a\x09self isInlined ifTrue: [ ^ self outerScope scopeLevel ].\x0a\x09\x0a\x09^ self outerScope scopeLevel + 1",
  38916. referencedClasses: [],
  38917. pragmas: [],
  38918. messageSends: ["ifNil:", "outerScope", "ifTrue:", "isInlined", "scopeLevel", "+"]
  38919. }),
  38920. $globals.LexicalScope);
  38921. $core.addMethod(
  38922. $core.method({
  38923. selector: "temps",
  38924. protocol: "accessing",
  38925. fn: function (){
  38926. var self=this,$self=this;
  38927. return $core.withContext(function($ctx1) {
  38928. var $1,$receiver;
  38929. $1=$self.temps;
  38930. if(($receiver = $1) == null || $receiver.a$nil){
  38931. $self.temps=$recv($globals.Dictionary)._new();
  38932. return $self.temps;
  38933. } else {
  38934. return $1;
  38935. }
  38936. }, function($ctx1) {$ctx1.fill(self,"temps",{})});
  38937. },
  38938. args: [],
  38939. source: "temps\x0a\x09^ temps ifNil: [ temps := Dictionary new ]",
  38940. referencedClasses: ["Dictionary"],
  38941. pragmas: [],
  38942. messageSends: ["ifNil:", "new"]
  38943. }),
  38944. $globals.LexicalScope);
  38945. $core.addClass("MethodLexicalScope", $globals.LexicalScope, ["iVars", "pseudoVars", "unknownVariables", "localReturn", "nonLocalReturns"], "Compiler-Semantic");
  38946. $globals.MethodLexicalScope.comment="I represent a method scope.";
  38947. $core.addMethod(
  38948. $core.method({
  38949. selector: "addIVar:",
  38950. protocol: "adding",
  38951. fn: function (aString){
  38952. var self=this,$self=this;
  38953. return $core.withContext(function($ctx1) {
  38954. var $1;
  38955. $1=$self._iVars();
  38956. $ctx1.sendIdx["iVars"]=1;
  38957. $recv($1)._at_put_(aString,$recv($globals.InstanceVar)._on_(aString));
  38958. $recv($recv($self._iVars())._at_(aString))._scope_(self);
  38959. return self;
  38960. }, function($ctx1) {$ctx1.fill(self,"addIVar:",{aString:aString})});
  38961. },
  38962. args: ["aString"],
  38963. source: "addIVar: aString\x0a\x09self iVars at: aString put: (InstanceVar on: aString).\x0a\x09(self iVars at: aString) scope: self",
  38964. referencedClasses: ["InstanceVar"],
  38965. pragmas: [],
  38966. messageSends: ["at:put:", "iVars", "on:", "scope:", "at:"]
  38967. }),
  38968. $globals.MethodLexicalScope);
  38969. $core.addMethod(
  38970. $core.method({
  38971. selector: "addNonLocalReturn:",
  38972. protocol: "adding",
  38973. fn: function (aScope){
  38974. var self=this,$self=this;
  38975. return $core.withContext(function($ctx1) {
  38976. $recv($self._nonLocalReturns())._add_(aScope);
  38977. return self;
  38978. }, function($ctx1) {$ctx1.fill(self,"addNonLocalReturn:",{aScope:aScope})});
  38979. },
  38980. args: ["aScope"],
  38981. source: "addNonLocalReturn: aScope\x0a\x09self nonLocalReturns add: aScope",
  38982. referencedClasses: [],
  38983. pragmas: [],
  38984. messageSends: ["add:", "nonLocalReturns"]
  38985. }),
  38986. $globals.MethodLexicalScope);
  38987. $core.addMethod(
  38988. $core.method({
  38989. selector: "allVariableNames",
  38990. protocol: "accessing",
  38991. fn: function (){
  38992. var self=this,$self=this;
  38993. return $core.withContext(function($ctx1) {
  38994. var $1;
  38995. $1=(
  38996. $ctx1.supercall = true,
  38997. ($globals.MethodLexicalScope.superclass||$boot.nilAsClass).fn.prototype._allVariableNames.apply($self, []));
  38998. $ctx1.supercall = false;
  38999. return $recv($1).__comma($recv($self._iVars())._keys());
  39000. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{})});
  39001. },
  39002. args: [],
  39003. source: "allVariableNames\x0a\x09^ super allVariableNames, self iVars keys",
  39004. referencedClasses: [],
  39005. pragmas: [],
  39006. messageSends: [",", "allVariableNames", "keys", "iVars"]
  39007. }),
  39008. $globals.MethodLexicalScope);
  39009. $core.addMethod(
  39010. $core.method({
  39011. selector: "bindingFor:",
  39012. protocol: "accessing",
  39013. fn: function (aNode){
  39014. var self=this,$self=this;
  39015. return $core.withContext(function($ctx1) {
  39016. var $1,$receiver;
  39017. $1=(
  39018. $ctx1.supercall = true,
  39019. ($globals.MethodLexicalScope.superclass||$boot.nilAsClass).fn.prototype._bindingFor_.apply($self, [aNode]));
  39020. $ctx1.supercall = false;
  39021. if(($receiver = $1) == null || $receiver.a$nil){
  39022. return $recv($self._iVars())._at_ifAbsent_($recv(aNode)._value(),(function(){
  39023. return nil;
  39024. }));
  39025. } else {
  39026. return $1;
  39027. }
  39028. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aNode:aNode})});
  39029. },
  39030. args: ["aNode"],
  39031. source: "bindingFor: aNode\x0a\x09^ (super bindingFor: aNode) ifNil: [\x0a\x09\x09self iVars at: aNode value ifAbsent: [ nil ]]",
  39032. referencedClasses: [],
  39033. pragmas: [],
  39034. messageSends: ["ifNil:", "bindingFor:", "at:ifAbsent:", "iVars", "value"]
  39035. }),
  39036. $globals.MethodLexicalScope);
  39037. $core.addMethod(
  39038. $core.method({
  39039. selector: "canInlineNonLocalReturns",
  39040. protocol: "testing",
  39041. fn: function (){
  39042. var self=this,$self=this;
  39043. return true;
  39044. },
  39045. args: [],
  39046. source: "canInlineNonLocalReturns\x0a\x09^ true",
  39047. referencedClasses: [],
  39048. pragmas: [],
  39049. messageSends: []
  39050. }),
  39051. $globals.MethodLexicalScope);
  39052. $core.addMethod(
  39053. $core.method({
  39054. selector: "hasLocalReturn",
  39055. protocol: "testing",
  39056. fn: function (){
  39057. var self=this,$self=this;
  39058. return $core.withContext(function($ctx1) {
  39059. return $self._localReturn();
  39060. }, function($ctx1) {$ctx1.fill(self,"hasLocalReturn",{})});
  39061. },
  39062. args: [],
  39063. source: "hasLocalReturn\x0a\x09^ self localReturn",
  39064. referencedClasses: [],
  39065. pragmas: [],
  39066. messageSends: ["localReturn"]
  39067. }),
  39068. $globals.MethodLexicalScope);
  39069. $core.addMethod(
  39070. $core.method({
  39071. selector: "hasNonLocalReturn",
  39072. protocol: "testing",
  39073. fn: function (){
  39074. var self=this,$self=this;
  39075. return $core.withContext(function($ctx1) {
  39076. return $recv($self._nonLocalReturns())._notEmpty();
  39077. }, function($ctx1) {$ctx1.fill(self,"hasNonLocalReturn",{})});
  39078. },
  39079. args: [],
  39080. source: "hasNonLocalReturn\x0a\x09^ self nonLocalReturns notEmpty",
  39081. referencedClasses: [],
  39082. pragmas: [],
  39083. messageSends: ["notEmpty", "nonLocalReturns"]
  39084. }),
  39085. $globals.MethodLexicalScope);
  39086. $core.addMethod(
  39087. $core.method({
  39088. selector: "iVars",
  39089. protocol: "accessing",
  39090. fn: function (){
  39091. var self=this,$self=this;
  39092. return $core.withContext(function($ctx1) {
  39093. var $1,$receiver;
  39094. $1=$self.iVars;
  39095. if(($receiver = $1) == null || $receiver.a$nil){
  39096. $self.iVars=$recv($globals.Dictionary)._new();
  39097. return $self.iVars;
  39098. } else {
  39099. return $1;
  39100. }
  39101. }, function($ctx1) {$ctx1.fill(self,"iVars",{})});
  39102. },
  39103. args: [],
  39104. source: "iVars\x0a\x09^ iVars ifNil: [ iVars := Dictionary new ]",
  39105. referencedClasses: ["Dictionary"],
  39106. pragmas: [],
  39107. messageSends: ["ifNil:", "new"]
  39108. }),
  39109. $globals.MethodLexicalScope);
  39110. $core.addMethod(
  39111. $core.method({
  39112. selector: "isMethodScope",
  39113. protocol: "testing",
  39114. fn: function (){
  39115. var self=this,$self=this;
  39116. return true;
  39117. },
  39118. args: [],
  39119. source: "isMethodScope\x0a\x09^ true",
  39120. referencedClasses: [],
  39121. pragmas: [],
  39122. messageSends: []
  39123. }),
  39124. $globals.MethodLexicalScope);
  39125. $core.addMethod(
  39126. $core.method({
  39127. selector: "localReturn",
  39128. protocol: "accessing",
  39129. fn: function (){
  39130. var self=this,$self=this;
  39131. return $core.withContext(function($ctx1) {
  39132. var $1,$receiver;
  39133. $1=$self.localReturn;
  39134. if(($receiver = $1) == null || $receiver.a$nil){
  39135. return false;
  39136. } else {
  39137. return $1;
  39138. }
  39139. }, function($ctx1) {$ctx1.fill(self,"localReturn",{})});
  39140. },
  39141. args: [],
  39142. source: "localReturn\x0a\x09^ localReturn ifNil: [ false ]",
  39143. referencedClasses: [],
  39144. pragmas: [],
  39145. messageSends: ["ifNil:"]
  39146. }),
  39147. $globals.MethodLexicalScope);
  39148. $core.addMethod(
  39149. $core.method({
  39150. selector: "localReturn:",
  39151. protocol: "accessing",
  39152. fn: function (aBoolean){
  39153. var self=this,$self=this;
  39154. $self.localReturn=aBoolean;
  39155. return self;
  39156. },
  39157. args: ["aBoolean"],
  39158. source: "localReturn: aBoolean\x0a\x09localReturn := aBoolean",
  39159. referencedClasses: [],
  39160. pragmas: [],
  39161. messageSends: []
  39162. }),
  39163. $globals.MethodLexicalScope);
  39164. $core.addMethod(
  39165. $core.method({
  39166. selector: "methodScope",
  39167. protocol: "accessing",
  39168. fn: function (){
  39169. var self=this,$self=this;
  39170. return self;
  39171. },
  39172. args: [],
  39173. source: "methodScope\x0a\x09^ self",
  39174. referencedClasses: [],
  39175. pragmas: [],
  39176. messageSends: []
  39177. }),
  39178. $globals.MethodLexicalScope);
  39179. $core.addMethod(
  39180. $core.method({
  39181. selector: "nonLocalReturns",
  39182. protocol: "accessing",
  39183. fn: function (){
  39184. var self=this,$self=this;
  39185. return $core.withContext(function($ctx1) {
  39186. var $1,$receiver;
  39187. $1=$self.nonLocalReturns;
  39188. if(($receiver = $1) == null || $receiver.a$nil){
  39189. $self.nonLocalReturns=$recv($globals.OrderedCollection)._new();
  39190. return $self.nonLocalReturns;
  39191. } else {
  39192. return $1;
  39193. }
  39194. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturns",{})});
  39195. },
  39196. args: [],
  39197. source: "nonLocalReturns\x0a\x09^ nonLocalReturns ifNil: [ nonLocalReturns := OrderedCollection new ]",
  39198. referencedClasses: ["OrderedCollection"],
  39199. pragmas: [],
  39200. messageSends: ["ifNil:", "new"]
  39201. }),
  39202. $globals.MethodLexicalScope);
  39203. $core.addMethod(
  39204. $core.method({
  39205. selector: "pseudoVars",
  39206. protocol: "accessing",
  39207. fn: function (){
  39208. var self=this,$self=this;
  39209. return $core.withContext(function($ctx1) {
  39210. var $1,$2,$4,$3,$receiver;
  39211. $1=$self.pseudoVars;
  39212. if(($receiver = $1) == null || $receiver.a$nil){
  39213. $self.pseudoVars=$recv($globals.Dictionary)._new();
  39214. $recv($recv($globals.Smalltalk)._pseudoVariableNames())._do_((function(each){
  39215. return $core.withContext(function($ctx2) {
  39216. $2=$self.pseudoVars;
  39217. $4=$recv($globals.PseudoVar)._on_(each);
  39218. $recv($4)._scope_($self._methodScope());
  39219. $3=$recv($4)._yourself();
  39220. return $recv($2)._at_put_(each,$3);
  39221. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39222. }));
  39223. } else {
  39224. $1;
  39225. }
  39226. return $self.pseudoVars;
  39227. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{})});
  39228. },
  39229. args: [],
  39230. source: "pseudoVars\x0a\x09pseudoVars ifNil: [\x0a\x09\x09pseudoVars := Dictionary new.\x0a\x09\x09Smalltalk pseudoVariableNames do: [ :each |\x0a\x09\x09\x09pseudoVars at: each put: ((PseudoVar on: each)\x0a\x09\x09\x09\x09scope: self methodScope;\x0a\x09\x09\x09\x09yourself) ]].\x0a\x09^ pseudoVars",
  39231. referencedClasses: ["Dictionary", "Smalltalk", "PseudoVar"],
  39232. pragmas: [],
  39233. messageSends: ["ifNil:", "new", "do:", "pseudoVariableNames", "at:put:", "scope:", "on:", "methodScope", "yourself"]
  39234. }),
  39235. $globals.MethodLexicalScope);
  39236. $core.addMethod(
  39237. $core.method({
  39238. selector: "removeNonLocalReturn:",
  39239. protocol: "adding",
  39240. fn: function (aScope){
  39241. var self=this,$self=this;
  39242. return $core.withContext(function($ctx1) {
  39243. $recv($self._nonLocalReturns())._remove_ifAbsent_(aScope,(function(){
  39244. }));
  39245. return self;
  39246. }, function($ctx1) {$ctx1.fill(self,"removeNonLocalReturn:",{aScope:aScope})});
  39247. },
  39248. args: ["aScope"],
  39249. source: "removeNonLocalReturn: aScope\x0a\x09self nonLocalReturns remove: aScope ifAbsent: []",
  39250. referencedClasses: [],
  39251. pragmas: [],
  39252. messageSends: ["remove:ifAbsent:", "nonLocalReturns"]
  39253. }),
  39254. $globals.MethodLexicalScope);
  39255. $core.addMethod(
  39256. $core.method({
  39257. selector: "unknownVariables",
  39258. protocol: "accessing",
  39259. fn: function (){
  39260. var self=this,$self=this;
  39261. return $core.withContext(function($ctx1) {
  39262. var $1,$receiver;
  39263. $1=$self.unknownVariables;
  39264. if(($receiver = $1) == null || $receiver.a$nil){
  39265. $self.unknownVariables=$recv($globals.OrderedCollection)._new();
  39266. return $self.unknownVariables;
  39267. } else {
  39268. return $1;
  39269. }
  39270. }, function($ctx1) {$ctx1.fill(self,"unknownVariables",{})});
  39271. },
  39272. args: [],
  39273. source: "unknownVariables\x0a\x09^ unknownVariables ifNil: [ unknownVariables := OrderedCollection new ]",
  39274. referencedClasses: ["OrderedCollection"],
  39275. pragmas: [],
  39276. messageSends: ["ifNil:", "new"]
  39277. }),
  39278. $globals.MethodLexicalScope);
  39279. $core.addClass("ScopeVar", $globals.Object, ["scope", "name"], "Compiler-Semantic");
  39280. $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.";
  39281. $core.addMethod(
  39282. $core.method({
  39283. selector: "alias",
  39284. protocol: "accessing",
  39285. fn: function (){
  39286. var self=this,$self=this;
  39287. return $core.withContext(function($ctx1) {
  39288. return $recv($self._name())._asVariableName();
  39289. }, function($ctx1) {$ctx1.fill(self,"alias",{})});
  39290. },
  39291. args: [],
  39292. source: "alias\x0a\x09^ self name asVariableName",
  39293. referencedClasses: [],
  39294. pragmas: [],
  39295. messageSends: ["asVariableName", "name"]
  39296. }),
  39297. $globals.ScopeVar);
  39298. $core.addMethod(
  39299. $core.method({
  39300. selector: "isArgVar",
  39301. protocol: "testing",
  39302. fn: function (){
  39303. var self=this,$self=this;
  39304. return false;
  39305. },
  39306. args: [],
  39307. source: "isArgVar\x0a\x09^ false",
  39308. referencedClasses: [],
  39309. pragmas: [],
  39310. messageSends: []
  39311. }),
  39312. $globals.ScopeVar);
  39313. $core.addMethod(
  39314. $core.method({
  39315. selector: "isClassRefVar",
  39316. protocol: "testing",
  39317. fn: function (){
  39318. var self=this,$self=this;
  39319. return false;
  39320. },
  39321. args: [],
  39322. source: "isClassRefVar\x0a\x09^ false",
  39323. referencedClasses: [],
  39324. pragmas: [],
  39325. messageSends: []
  39326. }),
  39327. $globals.ScopeVar);
  39328. $core.addMethod(
  39329. $core.method({
  39330. selector: "isImmutable",
  39331. protocol: "testing",
  39332. fn: function (){
  39333. var self=this,$self=this;
  39334. return false;
  39335. },
  39336. args: [],
  39337. source: "isImmutable\x0a\x09^ false",
  39338. referencedClasses: [],
  39339. pragmas: [],
  39340. messageSends: []
  39341. }),
  39342. $globals.ScopeVar);
  39343. $core.addMethod(
  39344. $core.method({
  39345. selector: "isInstanceVar",
  39346. protocol: "testing",
  39347. fn: function (){
  39348. var self=this,$self=this;
  39349. return false;
  39350. },
  39351. args: [],
  39352. source: "isInstanceVar\x0a\x09^ false",
  39353. referencedClasses: [],
  39354. pragmas: [],
  39355. messageSends: []
  39356. }),
  39357. $globals.ScopeVar);
  39358. $core.addMethod(
  39359. $core.method({
  39360. selector: "isPseudoVar",
  39361. protocol: "testing",
  39362. fn: function (){
  39363. var self=this,$self=this;
  39364. return false;
  39365. },
  39366. args: [],
  39367. source: "isPseudoVar\x0a\x09^ false",
  39368. referencedClasses: [],
  39369. pragmas: [],
  39370. messageSends: []
  39371. }),
  39372. $globals.ScopeVar);
  39373. $core.addMethod(
  39374. $core.method({
  39375. selector: "isSelf",
  39376. protocol: "testing",
  39377. fn: function (){
  39378. var self=this,$self=this;
  39379. return false;
  39380. },
  39381. args: [],
  39382. source: "isSelf\x0a\x09^ false",
  39383. referencedClasses: [],
  39384. pragmas: [],
  39385. messageSends: []
  39386. }),
  39387. $globals.ScopeVar);
  39388. $core.addMethod(
  39389. $core.method({
  39390. selector: "isSuper",
  39391. protocol: "testing",
  39392. fn: function (){
  39393. var self=this,$self=this;
  39394. return false;
  39395. },
  39396. args: [],
  39397. source: "isSuper\x0a\x09^ false",
  39398. referencedClasses: [],
  39399. pragmas: [],
  39400. messageSends: []
  39401. }),
  39402. $globals.ScopeVar);
  39403. $core.addMethod(
  39404. $core.method({
  39405. selector: "isTempVar",
  39406. protocol: "testing",
  39407. fn: function (){
  39408. var self=this,$self=this;
  39409. return false;
  39410. },
  39411. args: [],
  39412. source: "isTempVar\x0a\x09^ false",
  39413. referencedClasses: [],
  39414. pragmas: [],
  39415. messageSends: []
  39416. }),
  39417. $globals.ScopeVar);
  39418. $core.addMethod(
  39419. $core.method({
  39420. selector: "isUnknownVar",
  39421. protocol: "testing",
  39422. fn: function (){
  39423. var self=this,$self=this;
  39424. return false;
  39425. },
  39426. args: [],
  39427. source: "isUnknownVar\x0a\x09^ false",
  39428. referencedClasses: [],
  39429. pragmas: [],
  39430. messageSends: []
  39431. }),
  39432. $globals.ScopeVar);
  39433. $core.addMethod(
  39434. $core.method({
  39435. selector: "name",
  39436. protocol: "accessing",
  39437. fn: function (){
  39438. var self=this,$self=this;
  39439. return $self.name;
  39440. },
  39441. args: [],
  39442. source: "name\x0a\x09^ name",
  39443. referencedClasses: [],
  39444. pragmas: [],
  39445. messageSends: []
  39446. }),
  39447. $globals.ScopeVar);
  39448. $core.addMethod(
  39449. $core.method({
  39450. selector: "name:",
  39451. protocol: "accessing",
  39452. fn: function (aString){
  39453. var self=this,$self=this;
  39454. $self.name=aString;
  39455. return self;
  39456. },
  39457. args: ["aString"],
  39458. source: "name: aString\x0a\x09name := aString",
  39459. referencedClasses: [],
  39460. pragmas: [],
  39461. messageSends: []
  39462. }),
  39463. $globals.ScopeVar);
  39464. $core.addMethod(
  39465. $core.method({
  39466. selector: "scope",
  39467. protocol: "accessing",
  39468. fn: function (){
  39469. var self=this,$self=this;
  39470. return $self.scope;
  39471. },
  39472. args: [],
  39473. source: "scope\x0a\x09^ scope",
  39474. referencedClasses: [],
  39475. pragmas: [],
  39476. messageSends: []
  39477. }),
  39478. $globals.ScopeVar);
  39479. $core.addMethod(
  39480. $core.method({
  39481. selector: "scope:",
  39482. protocol: "accessing",
  39483. fn: function (aScope){
  39484. var self=this,$self=this;
  39485. $self.scope=aScope;
  39486. return self;
  39487. },
  39488. args: ["aScope"],
  39489. source: "scope: aScope\x0a\x09scope := aScope",
  39490. referencedClasses: [],
  39491. pragmas: [],
  39492. messageSends: []
  39493. }),
  39494. $globals.ScopeVar);
  39495. $core.addMethod(
  39496. $core.method({
  39497. selector: "validateAssignment",
  39498. protocol: "testing",
  39499. fn: function (){
  39500. var self=this,$self=this;
  39501. return $core.withContext(function($ctx1) {
  39502. var $1,$2;
  39503. $1=$recv($self._isArgVar())._or_((function(){
  39504. return $core.withContext(function($ctx2) {
  39505. return $self._isPseudoVar();
  39506. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39507. }));
  39508. if($core.assert($1)){
  39509. $2=$recv($globals.InvalidAssignmentError)._new();
  39510. $recv($2)._variableName_($self._name());
  39511. $recv($2)._signal();
  39512. }
  39513. return self;
  39514. }, function($ctx1) {$ctx1.fill(self,"validateAssignment",{})});
  39515. },
  39516. args: [],
  39517. source: "validateAssignment\x0a\x09(self isArgVar or: [ self isPseudoVar ]) ifTrue: [\x0a\x09\x09InvalidAssignmentError new\x0a\x09\x09\x09variableName: self name;\x0a\x09\x09\x09signal]",
  39518. referencedClasses: ["InvalidAssignmentError"],
  39519. pragmas: [],
  39520. messageSends: ["ifTrue:", "or:", "isArgVar", "isPseudoVar", "variableName:", "new", "name", "signal"]
  39521. }),
  39522. $globals.ScopeVar);
  39523. $core.addMethod(
  39524. $core.method({
  39525. selector: "on:",
  39526. protocol: "instance creation",
  39527. fn: function (aString){
  39528. var self=this,$self=this;
  39529. return $core.withContext(function($ctx1) {
  39530. var $1;
  39531. $1=$self._new();
  39532. $recv($1)._name_(aString);
  39533. return $recv($1)._yourself();
  39534. }, function($ctx1) {$ctx1.fill(self,"on:",{aString:aString})});
  39535. },
  39536. args: ["aString"],
  39537. source: "on: aString\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  39538. referencedClasses: [],
  39539. pragmas: [],
  39540. messageSends: ["name:", "new", "yourself"]
  39541. }),
  39542. $globals.ScopeVar.a$cls);
  39543. $core.addClass("AliasVar", $globals.ScopeVar, ["node"], "Compiler-Semantic");
  39544. $globals.AliasVar.comment="I am an internally defined variable by the compiler";
  39545. $core.addMethod(
  39546. $core.method({
  39547. selector: "isImmutable",
  39548. protocol: "testing",
  39549. fn: function (){
  39550. var self=this,$self=this;
  39551. return true;
  39552. },
  39553. args: [],
  39554. source: "isImmutable\x0a\x09^ true",
  39555. referencedClasses: [],
  39556. pragmas: [],
  39557. messageSends: []
  39558. }),
  39559. $globals.AliasVar);
  39560. $core.addMethod(
  39561. $core.method({
  39562. selector: "node",
  39563. protocol: "accessing",
  39564. fn: function (){
  39565. var self=this,$self=this;
  39566. return $self.node;
  39567. },
  39568. args: [],
  39569. source: "node\x0a\x09^ node",
  39570. referencedClasses: [],
  39571. pragmas: [],
  39572. messageSends: []
  39573. }),
  39574. $globals.AliasVar);
  39575. $core.addMethod(
  39576. $core.method({
  39577. selector: "node:",
  39578. protocol: "accessing",
  39579. fn: function (aNode){
  39580. var self=this,$self=this;
  39581. $self.node=aNode;
  39582. return self;
  39583. },
  39584. args: ["aNode"],
  39585. source: "node: aNode\x0a\x09node := aNode",
  39586. referencedClasses: [],
  39587. pragmas: [],
  39588. messageSends: []
  39589. }),
  39590. $globals.AliasVar);
  39591. $core.addClass("ArgVar", $globals.ScopeVar, [], "Compiler-Semantic");
  39592. $globals.ArgVar.comment="I am an argument of a method or block.";
  39593. $core.addMethod(
  39594. $core.method({
  39595. selector: "isArgVar",
  39596. protocol: "testing",
  39597. fn: function (){
  39598. var self=this,$self=this;
  39599. return true;
  39600. },
  39601. args: [],
  39602. source: "isArgVar\x0a\x09^ true",
  39603. referencedClasses: [],
  39604. pragmas: [],
  39605. messageSends: []
  39606. }),
  39607. $globals.ArgVar);
  39608. $core.addMethod(
  39609. $core.method({
  39610. selector: "isImmutable",
  39611. protocol: "testing",
  39612. fn: function (){
  39613. var self=this,$self=this;
  39614. return true;
  39615. },
  39616. args: [],
  39617. source: "isImmutable\x0a\x09^ true",
  39618. referencedClasses: [],
  39619. pragmas: [],
  39620. messageSends: []
  39621. }),
  39622. $globals.ArgVar);
  39623. $core.addClass("ClassRefVar", $globals.ScopeVar, [], "Compiler-Semantic");
  39624. $globals.ClassRefVar.comment="I am an class reference variable";
  39625. $core.addMethod(
  39626. $core.method({
  39627. selector: "alias",
  39628. protocol: "accessing",
  39629. fn: function (){
  39630. var self=this,$self=this;
  39631. return $core.withContext(function($ctx1) {
  39632. return "$globals.".__comma($self._name());
  39633. }, function($ctx1) {$ctx1.fill(self,"alias",{})});
  39634. },
  39635. args: [],
  39636. source: "alias\x0a\x09\x22Fixes issue #190.\x0a\x09A function is created in the method definition, answering the class or nil.\x0a\x09See JSStream >> #nextPutClassRefFunction:\x22\x0a\x09\x0a\x09^ '$globals.', self name",
  39637. referencedClasses: [],
  39638. pragmas: [],
  39639. messageSends: [",", "name"]
  39640. }),
  39641. $globals.ClassRefVar);
  39642. $core.addMethod(
  39643. $core.method({
  39644. selector: "isClassRefVar",
  39645. protocol: "testing",
  39646. fn: function (){
  39647. var self=this,$self=this;
  39648. return true;
  39649. },
  39650. args: [],
  39651. source: "isClassRefVar\x0a\x09^ true",
  39652. referencedClasses: [],
  39653. pragmas: [],
  39654. messageSends: []
  39655. }),
  39656. $globals.ClassRefVar);
  39657. $core.addMethod(
  39658. $core.method({
  39659. selector: "isImmutable",
  39660. protocol: "testing",
  39661. fn: function (){
  39662. var self=this,$self=this;
  39663. return true;
  39664. },
  39665. args: [],
  39666. source: "isImmutable\x0a\x09^ true",
  39667. referencedClasses: [],
  39668. pragmas: [],
  39669. messageSends: []
  39670. }),
  39671. $globals.ClassRefVar);
  39672. $core.addClass("InstanceVar", $globals.ScopeVar, [], "Compiler-Semantic");
  39673. $globals.InstanceVar.comment="I am an instance variable of a method or block.";
  39674. $core.addMethod(
  39675. $core.method({
  39676. selector: "alias",
  39677. protocol: "testing",
  39678. fn: function (){
  39679. var self=this,$self=this;
  39680. return $core.withContext(function($ctx1) {
  39681. return "$self.".__comma($self._name());
  39682. }, function($ctx1) {$ctx1.fill(self,"alias",{})});
  39683. },
  39684. args: [],
  39685. source: "alias\x0a\x09^ '$self.', self name",
  39686. referencedClasses: [],
  39687. pragmas: [],
  39688. messageSends: [",", "name"]
  39689. }),
  39690. $globals.InstanceVar);
  39691. $core.addMethod(
  39692. $core.method({
  39693. selector: "isInstanceVar",
  39694. protocol: "testing",
  39695. fn: function (){
  39696. var self=this,$self=this;
  39697. return true;
  39698. },
  39699. args: [],
  39700. source: "isInstanceVar\x0a\x09^ true",
  39701. referencedClasses: [],
  39702. pragmas: [],
  39703. messageSends: []
  39704. }),
  39705. $globals.InstanceVar);
  39706. $core.addClass("PseudoVar", $globals.ScopeVar, [], "Compiler-Semantic");
  39707. $globals.PseudoVar.comment="I am an pseudo variable.\x0a\x0aThe five Smalltalk pseudo variables are: 'self', 'super', 'nil', 'true' and 'false'";
  39708. $core.addMethod(
  39709. $core.method({
  39710. selector: "alias",
  39711. protocol: "accessing",
  39712. fn: function (){
  39713. var self=this,$self=this;
  39714. return $core.withContext(function($ctx1) {
  39715. return $self._name();
  39716. }, function($ctx1) {$ctx1.fill(self,"alias",{})});
  39717. },
  39718. args: [],
  39719. source: "alias\x0a\x09^ self name",
  39720. referencedClasses: [],
  39721. pragmas: [],
  39722. messageSends: ["name"]
  39723. }),
  39724. $globals.PseudoVar);
  39725. $core.addMethod(
  39726. $core.method({
  39727. selector: "isImmutable",
  39728. protocol: "testing",
  39729. fn: function (){
  39730. var self=this,$self=this;
  39731. return true;
  39732. },
  39733. args: [],
  39734. source: "isImmutable\x0a\x09^ true",
  39735. referencedClasses: [],
  39736. pragmas: [],
  39737. messageSends: []
  39738. }),
  39739. $globals.PseudoVar);
  39740. $core.addMethod(
  39741. $core.method({
  39742. selector: "isPseudoVar",
  39743. protocol: "testing",
  39744. fn: function (){
  39745. var self=this,$self=this;
  39746. return true;
  39747. },
  39748. args: [],
  39749. source: "isPseudoVar\x0a\x09^ true",
  39750. referencedClasses: [],
  39751. pragmas: [],
  39752. messageSends: []
  39753. }),
  39754. $globals.PseudoVar);
  39755. $core.addMethod(
  39756. $core.method({
  39757. selector: "isSelf",
  39758. protocol: "testing",
  39759. fn: function (){
  39760. var self=this,$self=this;
  39761. return $core.withContext(function($ctx1) {
  39762. return $recv($self.name).__eq("self");
  39763. }, function($ctx1) {$ctx1.fill(self,"isSelf",{})});
  39764. },
  39765. args: [],
  39766. source: "isSelf\x0a\x09^ name = 'self'",
  39767. referencedClasses: [],
  39768. pragmas: [],
  39769. messageSends: ["="]
  39770. }),
  39771. $globals.PseudoVar);
  39772. $core.addMethod(
  39773. $core.method({
  39774. selector: "isSuper",
  39775. protocol: "testing",
  39776. fn: function (){
  39777. var self=this,$self=this;
  39778. return $core.withContext(function($ctx1) {
  39779. return $recv($self.name).__eq("super");
  39780. }, function($ctx1) {$ctx1.fill(self,"isSuper",{})});
  39781. },
  39782. args: [],
  39783. source: "isSuper\x0a\x09^ name = 'super'",
  39784. referencedClasses: [],
  39785. pragmas: [],
  39786. messageSends: ["="]
  39787. }),
  39788. $globals.PseudoVar);
  39789. $core.addClass("TempVar", $globals.ScopeVar, [], "Compiler-Semantic");
  39790. $globals.TempVar.comment="I am an temporary variable of a method or block.";
  39791. $core.addMethod(
  39792. $core.method({
  39793. selector: "isTempVar",
  39794. protocol: "testing",
  39795. fn: function (){
  39796. var self=this,$self=this;
  39797. return true;
  39798. },
  39799. args: [],
  39800. source: "isTempVar\x0a\x09^ true",
  39801. referencedClasses: [],
  39802. pragmas: [],
  39803. messageSends: []
  39804. }),
  39805. $globals.TempVar);
  39806. $core.addClass("UnknownVar", $globals.ScopeVar, [], "Compiler-Semantic");
  39807. $globals.UnknownVar.comment="I am an unknown variable. Amber uses unknown variables as JavaScript globals";
  39808. $core.addMethod(
  39809. $core.method({
  39810. selector: "isUnknownVar",
  39811. protocol: "testing",
  39812. fn: function (){
  39813. var self=this,$self=this;
  39814. return true;
  39815. },
  39816. args: [],
  39817. source: "isUnknownVar\x0a\x09^ true",
  39818. referencedClasses: [],
  39819. pragmas: [],
  39820. messageSends: []
  39821. }),
  39822. $globals.UnknownVar);
  39823. $core.addClass("SemanticAnalyzer", $globals.NodeVisitor, ["currentScope", "blockIndex", "thePackage", "theClass", "classReferences", "messageSends"], "Compiler-Semantic");
  39824. $globals.SemanticAnalyzer.comment="I semantically analyze the abstract syntax tree and annotate it with informations such as non local returns and variable scopes.";
  39825. $core.addMethod(
  39826. $core.method({
  39827. selector: "classReferences",
  39828. protocol: "accessing",
  39829. fn: function (){
  39830. var self=this,$self=this;
  39831. return $core.withContext(function($ctx1) {
  39832. var $1,$receiver;
  39833. $1=$self.classReferences;
  39834. if(($receiver = $1) == null || $receiver.a$nil){
  39835. $self.classReferences=$recv($globals.Set)._new();
  39836. return $self.classReferences;
  39837. } else {
  39838. return $1;
  39839. }
  39840. }, function($ctx1) {$ctx1.fill(self,"classReferences",{})});
  39841. },
  39842. args: [],
  39843. source: "classReferences\x0a\x09^ classReferences ifNil: [ classReferences := Set new ]",
  39844. referencedClasses: ["Set"],
  39845. pragmas: [],
  39846. messageSends: ["ifNil:", "new"]
  39847. }),
  39848. $globals.SemanticAnalyzer);
  39849. $core.addMethod(
  39850. $core.method({
  39851. selector: "errorShadowingVariable:",
  39852. protocol: "error handling",
  39853. fn: function (aString){
  39854. var self=this,$self=this;
  39855. return $core.withContext(function($ctx1) {
  39856. var $1;
  39857. $1=$recv($globals.ShadowingVariableError)._new();
  39858. $recv($1)._variableName_(aString);
  39859. $recv($1)._signal();
  39860. return self;
  39861. }, function($ctx1) {$ctx1.fill(self,"errorShadowingVariable:",{aString:aString})});
  39862. },
  39863. args: ["aString"],
  39864. source: "errorShadowingVariable: aString\x0a\x09ShadowingVariableError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal",
  39865. referencedClasses: ["ShadowingVariableError"],
  39866. pragmas: [],
  39867. messageSends: ["variableName:", "new", "signal"]
  39868. }),
  39869. $globals.SemanticAnalyzer);
  39870. $core.addMethod(
  39871. $core.method({
  39872. selector: "errorUnknownVariable:",
  39873. protocol: "error handling",
  39874. fn: function (aNode){
  39875. var self=this,$self=this;
  39876. var identifier;
  39877. return $core.withContext(function($ctx1) {
  39878. var $1,$2,$3;
  39879. identifier=$recv(aNode)._value();
  39880. $ctx1.sendIdx["value"]=1;
  39881. $1=$recv($recv($recv($recv($globals.Smalltalk)._globalJsVariables())._includes_(identifier))._not())._and_((function(){
  39882. return $core.withContext(function($ctx2) {
  39883. return $self._isVariableUndefined_inPackage_(identifier,$self._thePackage());
  39884. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39885. }));
  39886. if($core.assert($1)){
  39887. $2=$recv($globals.UnknownVariableError)._new();
  39888. $3=$recv(aNode)._value();
  39889. $ctx1.sendIdx["value"]=2;
  39890. $recv($2)._variableName_($3);
  39891. $recv($2)._signal();
  39892. } else {
  39893. $recv($recv($recv($self.currentScope)._methodScope())._unknownVariables())._add_($recv(aNode)._value());
  39894. }
  39895. return self;
  39896. }, function($ctx1) {$ctx1.fill(self,"errorUnknownVariable:",{aNode:aNode,identifier:identifier})});
  39897. },
  39898. args: ["aNode"],
  39899. source: "errorUnknownVariable: aNode\x0a\x09\x22Throw an error if the variable is undeclared in the global JS scope (i.e. window).\x0a\x09We allow all variables listed by Smalltalk>>#globalJsVariables.\x0a\x09This list includes: `window`, `document`, `process` and `global`\x0a\x09for nodejs and browser environments.\x0a\x09\x0a\x09This is only to make sure compilation works on both browser-based and nodejs environments.\x0a\x09The ideal solution would be to use a pragma instead\x22\x0a\x0a\x09| identifier |\x0a\x09identifier := aNode value.\x0a\x09\x0a\x09((Smalltalk globalJsVariables includes: identifier) not\x0a\x09\x09and: [ self isVariableUndefined: identifier inPackage: self thePackage ])\x0a\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09UnknownVariableError new\x0a\x09\x09\x09\x09\x09variableName: aNode value;\x0a\x09\x09\x09\x09\x09signal ]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09currentScope methodScope unknownVariables add: aNode value ]",
  39900. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  39901. pragmas: [],
  39902. messageSends: ["value", "ifTrue:ifFalse:", "and:", "not", "includes:", "globalJsVariables", "isVariableUndefined:inPackage:", "thePackage", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope"]
  39903. }),
  39904. $globals.SemanticAnalyzer);
  39905. $core.addMethod(
  39906. $core.method({
  39907. selector: "isVariableUndefined:inPackage:",
  39908. protocol: "testing",
  39909. fn: function (aString,aPackage){
  39910. var self=this,$self=this;
  39911. return $core.withContext(function($ctx1) {
  39912. var $1,$2,$receiver;
  39913. if(($receiver = aPackage) == null || $receiver.a$nil){
  39914. aPackage;
  39915. } else {
  39916. var packageKnownVars;
  39917. packageKnownVars=$recv($recv($recv(aPackage)._imports())._reject_("isString"))._collect_("key");
  39918. $1=$recv(packageKnownVars)._includes_(aString);
  39919. if($core.assert($1)){
  39920. return false;
  39921. }
  39922. }
  39923. $2=$recv("typeof ".__comma(aString)).__comma(" === \x22undefined\x22");
  39924. $ctx1.sendIdx[","]=1;
  39925. return $recv($globals.Compiler)._eval_($2);
  39926. }, function($ctx1) {$ctx1.fill(self,"isVariableUndefined:inPackage:",{aString:aString,aPackage:aPackage})});
  39927. },
  39928. args: ["aString", "aPackage"],
  39929. source: "isVariableUndefined: aString inPackage: aPackage\x0a\x09aPackage ifNotNil: [\x0a\x09\x09| packageKnownVars |\x0a\x09\x09packageKnownVars := (aPackage imports\x0a\x09\x09\x09reject: #isString)\x0a\x09\x09\x09collect: #key.\x0a\x09\x09(packageKnownVars includes: aString) ifTrue: [ ^ false ]].\x0a\x09^ Compiler eval: 'typeof ', aString, ' === \x22undefined\x22'",
  39930. referencedClasses: ["Compiler"],
  39931. pragmas: [],
  39932. messageSends: ["ifNotNil:", "collect:", "reject:", "imports", "ifTrue:", "includes:", "eval:", ","]
  39933. }),
  39934. $globals.SemanticAnalyzer);
  39935. $core.addMethod(
  39936. $core.method({
  39937. selector: "messageSends",
  39938. protocol: "accessing",
  39939. fn: function (){
  39940. var self=this,$self=this;
  39941. return $core.withContext(function($ctx1) {
  39942. var $1,$receiver;
  39943. $1=$self.messageSends;
  39944. if(($receiver = $1) == null || $receiver.a$nil){
  39945. $self.messageSends=$recv($globals.Dictionary)._new();
  39946. return $self.messageSends;
  39947. } else {
  39948. return $1;
  39949. }
  39950. }, function($ctx1) {$ctx1.fill(self,"messageSends",{})});
  39951. },
  39952. args: [],
  39953. source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Dictionary new ]",
  39954. referencedClasses: ["Dictionary"],
  39955. pragmas: [],
  39956. messageSends: ["ifNil:", "new"]
  39957. }),
  39958. $globals.SemanticAnalyzer);
  39959. $core.addMethod(
  39960. $core.method({
  39961. selector: "newBlockScope",
  39962. protocol: "factory",
  39963. fn: function (){
  39964. var self=this,$self=this;
  39965. return $core.withContext(function($ctx1) {
  39966. return $self._newScopeOfClass_($globals.LexicalScope);
  39967. }, function($ctx1) {$ctx1.fill(self,"newBlockScope",{})});
  39968. },
  39969. args: [],
  39970. source: "newBlockScope\x0a\x09^ self newScopeOfClass: LexicalScope",
  39971. referencedClasses: ["LexicalScope"],
  39972. pragmas: [],
  39973. messageSends: ["newScopeOfClass:"]
  39974. }),
  39975. $globals.SemanticAnalyzer);
  39976. $core.addMethod(
  39977. $core.method({
  39978. selector: "newMethodScope",
  39979. protocol: "factory",
  39980. fn: function (){
  39981. var self=this,$self=this;
  39982. return $core.withContext(function($ctx1) {
  39983. return $self._newScopeOfClass_($globals.MethodLexicalScope);
  39984. }, function($ctx1) {$ctx1.fill(self,"newMethodScope",{})});
  39985. },
  39986. args: [],
  39987. source: "newMethodScope\x0a\x09^ self newScopeOfClass: MethodLexicalScope",
  39988. referencedClasses: ["MethodLexicalScope"],
  39989. pragmas: [],
  39990. messageSends: ["newScopeOfClass:"]
  39991. }),
  39992. $globals.SemanticAnalyzer);
  39993. $core.addMethod(
  39994. $core.method({
  39995. selector: "newScopeOfClass:",
  39996. protocol: "factory",
  39997. fn: function (aLexicalScopeClass){
  39998. var self=this,$self=this;
  39999. return $core.withContext(function($ctx1) {
  40000. var $1;
  40001. $1=$recv(aLexicalScopeClass)._new();
  40002. $recv($1)._outerScope_($self.currentScope);
  40003. return $recv($1)._yourself();
  40004. }, function($ctx1) {$ctx1.fill(self,"newScopeOfClass:",{aLexicalScopeClass:aLexicalScopeClass})});
  40005. },
  40006. args: ["aLexicalScopeClass"],
  40007. source: "newScopeOfClass: aLexicalScopeClass\x0a\x09^ aLexicalScopeClass new\x0a\x09\x09outerScope: currentScope;\x0a\x09\x09yourself",
  40008. referencedClasses: [],
  40009. pragmas: [],
  40010. messageSends: ["outerScope:", "new", "yourself"]
  40011. }),
  40012. $globals.SemanticAnalyzer);
  40013. $core.addMethod(
  40014. $core.method({
  40015. selector: "nextBlockIndex",
  40016. protocol: "private",
  40017. fn: function (){
  40018. var self=this,$self=this;
  40019. return $core.withContext(function($ctx1) {
  40020. var $1,$receiver;
  40021. $1=$self.blockIndex;
  40022. if(($receiver = $1) == null || $receiver.a$nil){
  40023. $self.blockIndex=(0);
  40024. $self.blockIndex;
  40025. } else {
  40026. $1;
  40027. }
  40028. $self.blockIndex=$recv($self.blockIndex).__plus((1));
  40029. return $self.blockIndex;
  40030. }, function($ctx1) {$ctx1.fill(self,"nextBlockIndex",{})});
  40031. },
  40032. args: [],
  40033. source: "nextBlockIndex\x0a\x09blockIndex ifNil: [ blockIndex := 0 ].\x0a\x09\x0a\x09blockIndex := blockIndex + 1.\x0a\x09^ blockIndex",
  40034. referencedClasses: [],
  40035. pragmas: [],
  40036. messageSends: ["ifNil:", "+"]
  40037. }),
  40038. $globals.SemanticAnalyzer);
  40039. $core.addMethod(
  40040. $core.method({
  40041. selector: "popScope",
  40042. protocol: "scope",
  40043. fn: function (){
  40044. var self=this,$self=this;
  40045. return $core.withContext(function($ctx1) {
  40046. var $1,$receiver;
  40047. $1=$self.currentScope;
  40048. if(($receiver = $1) == null || $receiver.a$nil){
  40049. $1;
  40050. } else {
  40051. $self.currentScope=$recv($self.currentScope)._outerScope();
  40052. $self.currentScope;
  40053. }
  40054. return self;
  40055. }, function($ctx1) {$ctx1.fill(self,"popScope",{})});
  40056. },
  40057. args: [],
  40058. source: "popScope\x0a\x09currentScope ifNotNil: [\x0a\x09\x09currentScope := currentScope outerScope ]",
  40059. referencedClasses: [],
  40060. pragmas: [],
  40061. messageSends: ["ifNotNil:", "outerScope"]
  40062. }),
  40063. $globals.SemanticAnalyzer);
  40064. $core.addMethod(
  40065. $core.method({
  40066. selector: "pushScope:",
  40067. protocol: "scope",
  40068. fn: function (aScope){
  40069. var self=this,$self=this;
  40070. return $core.withContext(function($ctx1) {
  40071. $recv(aScope)._outerScope_($self.currentScope);
  40072. $self.currentScope=aScope;
  40073. return self;
  40074. }, function($ctx1) {$ctx1.fill(self,"pushScope:",{aScope:aScope})});
  40075. },
  40076. args: ["aScope"],
  40077. source: "pushScope: aScope\x0a\x09aScope outerScope: currentScope.\x0a\x09currentScope := aScope",
  40078. referencedClasses: [],
  40079. pragmas: [],
  40080. messageSends: ["outerScope:"]
  40081. }),
  40082. $globals.SemanticAnalyzer);
  40083. $core.addMethod(
  40084. $core.method({
  40085. selector: "theClass",
  40086. protocol: "accessing",
  40087. fn: function (){
  40088. var self=this,$self=this;
  40089. return $self.theClass;
  40090. },
  40091. args: [],
  40092. source: "theClass\x0a\x09^ theClass",
  40093. referencedClasses: [],
  40094. pragmas: [],
  40095. messageSends: []
  40096. }),
  40097. $globals.SemanticAnalyzer);
  40098. $core.addMethod(
  40099. $core.method({
  40100. selector: "theClass:",
  40101. protocol: "accessing",
  40102. fn: function (aClass){
  40103. var self=this,$self=this;
  40104. $self.theClass=aClass;
  40105. return self;
  40106. },
  40107. args: ["aClass"],
  40108. source: "theClass: aClass\x0a\x09theClass := aClass",
  40109. referencedClasses: [],
  40110. pragmas: [],
  40111. messageSends: []
  40112. }),
  40113. $globals.SemanticAnalyzer);
  40114. $core.addMethod(
  40115. $core.method({
  40116. selector: "thePackage",
  40117. protocol: "accessing",
  40118. fn: function (){
  40119. var self=this,$self=this;
  40120. return $self.thePackage;
  40121. },
  40122. args: [],
  40123. source: "thePackage\x0a\x09^ thePackage",
  40124. referencedClasses: [],
  40125. pragmas: [],
  40126. messageSends: []
  40127. }),
  40128. $globals.SemanticAnalyzer);
  40129. $core.addMethod(
  40130. $core.method({
  40131. selector: "thePackage:",
  40132. protocol: "accessing",
  40133. fn: function (aPackage){
  40134. var self=this,$self=this;
  40135. $self.thePackage=aPackage;
  40136. return self;
  40137. },
  40138. args: ["aPackage"],
  40139. source: "thePackage: aPackage\x0a\x09thePackage := aPackage",
  40140. referencedClasses: [],
  40141. pragmas: [],
  40142. messageSends: []
  40143. }),
  40144. $globals.SemanticAnalyzer);
  40145. $core.addMethod(
  40146. $core.method({
  40147. selector: "validateVariableScope:",
  40148. protocol: "scope",
  40149. fn: function (aString){
  40150. var self=this,$self=this;
  40151. return $core.withContext(function($ctx1) {
  40152. var $1,$receiver;
  40153. $1=$recv($self.currentScope)._lookupVariable_(aString);
  40154. if(($receiver = $1) == null || $receiver.a$nil){
  40155. $1;
  40156. } else {
  40157. $self._errorShadowingVariable_(aString);
  40158. }
  40159. return self;
  40160. }, function($ctx1) {$ctx1.fill(self,"validateVariableScope:",{aString:aString})});
  40161. },
  40162. args: ["aString"],
  40163. 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 ]",
  40164. referencedClasses: [],
  40165. pragmas: [],
  40166. messageSends: ["ifNotNil:", "lookupVariable:", "errorShadowingVariable:"]
  40167. }),
  40168. $globals.SemanticAnalyzer);
  40169. $core.addMethod(
  40170. $core.method({
  40171. selector: "visitAssignmentNode:",
  40172. protocol: "visiting",
  40173. fn: function (aNode){
  40174. var self=this,$self=this;
  40175. return $core.withContext(function($ctx1) {
  40176. (
  40177. $ctx1.supercall = true,
  40178. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitAssignmentNode_.apply($self, [aNode]));
  40179. $ctx1.supercall = false;
  40180. $recv($recv(aNode)._left())._beAssigned();
  40181. return self;
  40182. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode})});
  40183. },
  40184. args: ["aNode"],
  40185. source: "visitAssignmentNode: aNode\x0a\x09super visitAssignmentNode: aNode.\x0a\x09aNode left beAssigned",
  40186. referencedClasses: [],
  40187. pragmas: [],
  40188. messageSends: ["visitAssignmentNode:", "beAssigned", "left"]
  40189. }),
  40190. $globals.SemanticAnalyzer);
  40191. $core.addMethod(
  40192. $core.method({
  40193. selector: "visitBlockNode:",
  40194. protocol: "visiting",
  40195. fn: function (aNode){
  40196. var self=this,$self=this;
  40197. return $core.withContext(function($ctx1) {
  40198. $self._pushScope_($self._newBlockScope());
  40199. $recv(aNode)._scope_($self.currentScope);
  40200. $recv($self.currentScope)._node_(aNode);
  40201. $recv($self.currentScope)._blockIndex_($self._nextBlockIndex());
  40202. $recv($recv(aNode)._parameters())._do_((function(each){
  40203. return $core.withContext(function($ctx2) {
  40204. $self._validateVariableScope_(each);
  40205. return $recv($self.currentScope)._addArg_(each);
  40206. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40207. }));
  40208. (
  40209. $ctx1.supercall = true,
  40210. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitBlockNode_.apply($self, [aNode]));
  40211. $ctx1.supercall = false;
  40212. $self._popScope();
  40213. return self;
  40214. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode})});
  40215. },
  40216. args: ["aNode"],
  40217. 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",
  40218. referencedClasses: [],
  40219. pragmas: [],
  40220. messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "blockIndex:", "nextBlockIndex", "do:", "parameters", "validateVariableScope:", "addArg:", "visitBlockNode:", "popScope"]
  40221. }),
  40222. $globals.SemanticAnalyzer);
  40223. $core.addMethod(
  40224. $core.method({
  40225. selector: "visitCascadeNode:",
  40226. protocol: "visiting",
  40227. fn: function (aNode){
  40228. var self=this,$self=this;
  40229. return $core.withContext(function($ctx1) {
  40230. $recv(aNode)._receiver_($recv($recv($recv(aNode)._dagChildren())._first())._receiver());
  40231. (
  40232. $ctx1.supercall = true,
  40233. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitCascadeNode_.apply($self, [aNode]));
  40234. $ctx1.supercall = false;
  40235. return self;
  40236. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode})});
  40237. },
  40238. args: ["aNode"],
  40239. source: "visitCascadeNode: aNode\x0a\x09aNode receiver: aNode dagChildren first receiver.\x0a\x09super visitCascadeNode: aNode",
  40240. referencedClasses: [],
  40241. pragmas: [],
  40242. messageSends: ["receiver:", "receiver", "first", "dagChildren", "visitCascadeNode:"]
  40243. }),
  40244. $globals.SemanticAnalyzer);
  40245. $core.addMethod(
  40246. $core.method({
  40247. selector: "visitMethodNode:",
  40248. protocol: "visiting",
  40249. fn: function (aNode){
  40250. var self=this,$self=this;
  40251. return $core.withContext(function($ctx1) {
  40252. $self._pushScope_($self._newMethodScope());
  40253. $recv(aNode)._scope_($self.currentScope);
  40254. $recv($self.currentScope)._node_(aNode);
  40255. $recv($recv($self._theClass())._allInstanceVariableNames())._do_((function(each){
  40256. return $core.withContext(function($ctx2) {
  40257. return $recv($self.currentScope)._addIVar_(each);
  40258. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40259. }));
  40260. $ctx1.sendIdx["do:"]=1;
  40261. $recv($recv(aNode)._arguments())._do_((function(each){
  40262. return $core.withContext(function($ctx2) {
  40263. $self._validateVariableScope_(each);
  40264. return $recv($self.currentScope)._addArg_(each);
  40265. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  40266. }));
  40267. (
  40268. $ctx1.supercall = true,
  40269. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitMethodNode_.apply($self, [aNode]));
  40270. $ctx1.supercall = false;
  40271. $recv(aNode)._classReferences_($self._classReferences());
  40272. $recv(aNode)._sendIndexes_($self._messageSends());
  40273. $self._popScope();
  40274. return aNode;
  40275. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode})});
  40276. },
  40277. args: ["aNode"],
  40278. 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",
  40279. referencedClasses: [],
  40280. pragmas: [],
  40281. messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "allInstanceVariableNames", "theClass", "addIVar:", "arguments", "validateVariableScope:", "addArg:", "visitMethodNode:", "classReferences:", "classReferences", "sendIndexes:", "messageSends", "popScope"]
  40282. }),
  40283. $globals.SemanticAnalyzer);
  40284. $core.addMethod(
  40285. $core.method({
  40286. selector: "visitReturnNode:",
  40287. protocol: "visiting",
  40288. fn: function (aNode){
  40289. var self=this,$self=this;
  40290. return $core.withContext(function($ctx1) {
  40291. var $1;
  40292. $recv(aNode)._scope_($self.currentScope);
  40293. $1=$recv($self.currentScope)._isMethodScope();
  40294. if($core.assert($1)){
  40295. $recv($self.currentScope)._localReturn_(true);
  40296. } else {
  40297. $recv($recv($self.currentScope)._methodScope())._addNonLocalReturn_($self.currentScope);
  40298. }
  40299. (
  40300. $ctx1.supercall = true,
  40301. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitReturnNode_.apply($self, [aNode]));
  40302. $ctx1.supercall = false;
  40303. return self;
  40304. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode})});
  40305. },
  40306. args: ["aNode"],
  40307. 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",
  40308. referencedClasses: [],
  40309. pragmas: [],
  40310. messageSends: ["scope:", "ifTrue:ifFalse:", "isMethodScope", "localReturn:", "addNonLocalReturn:", "methodScope", "visitReturnNode:"]
  40311. }),
  40312. $globals.SemanticAnalyzer);
  40313. $core.addMethod(
  40314. $core.method({
  40315. selector: "visitSendNode:",
  40316. protocol: "visiting",
  40317. fn: function (aNode){
  40318. var self=this,$self=this;
  40319. var sends;
  40320. return $core.withContext(function($ctx1) {
  40321. sends=$recv($self._messageSends())._at_ifAbsentPut_($recv(aNode)._selector(),(function(){
  40322. return $core.withContext(function($ctx2) {
  40323. return $recv($globals.OrderedCollection)._new();
  40324. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40325. }));
  40326. $recv(sends)._add_(aNode);
  40327. $recv(aNode)._index_($recv(sends)._size());
  40328. (
  40329. $ctx1.supercall = true,
  40330. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  40331. $ctx1.supercall = false;
  40332. return self;
  40333. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,sends:sends})});
  40334. },
  40335. args: ["aNode"],
  40336. 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",
  40337. referencedClasses: ["OrderedCollection"],
  40338. pragmas: [],
  40339. messageSends: ["at:ifAbsentPut:", "messageSends", "selector", "new", "add:", "index:", "size", "visitSendNode:"]
  40340. }),
  40341. $globals.SemanticAnalyzer);
  40342. $core.addMethod(
  40343. $core.method({
  40344. selector: "visitSequenceNode:",
  40345. protocol: "visiting",
  40346. fn: function (aNode){
  40347. var self=this,$self=this;
  40348. return $core.withContext(function($ctx1) {
  40349. $recv($recv(aNode)._temps())._do_((function(each){
  40350. return $core.withContext(function($ctx2) {
  40351. $self._validateVariableScope_(each);
  40352. return $recv($self.currentScope)._addTemp_(each);
  40353. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40354. }));
  40355. (
  40356. $ctx1.supercall = true,
  40357. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($self, [aNode]));
  40358. $ctx1.supercall = false;
  40359. return self;
  40360. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode})});
  40361. },
  40362. args: ["aNode"],
  40363. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addTemp: each ].\x0a\x0a\x09super visitSequenceNode: aNode",
  40364. referencedClasses: [],
  40365. pragmas: [],
  40366. messageSends: ["do:", "temps", "validateVariableScope:", "addTemp:", "visitSequenceNode:"]
  40367. }),
  40368. $globals.SemanticAnalyzer);
  40369. $core.addMethod(
  40370. $core.method({
  40371. selector: "visitVariableNode:",
  40372. protocol: "visiting",
  40373. fn: function (aNode){
  40374. var self=this,$self=this;
  40375. var binding;
  40376. return $core.withContext(function($ctx1) {
  40377. var $1,$3,$2,$4,$5,$6,$7,$8,$receiver;
  40378. binding=$recv($self.currentScope)._lookupVariable_(aNode);
  40379. $1=binding;
  40380. if(($receiver = $1) == null || $receiver.a$nil){
  40381. $3=$recv(aNode)._value();
  40382. $ctx1.sendIdx["value"]=1;
  40383. $2=$recv($3)._isCapitalized();
  40384. if($core.assert($2)){
  40385. $4=$recv($globals.ClassRefVar)._new();
  40386. $ctx1.sendIdx["new"]=1;
  40387. $5=$recv(aNode)._value();
  40388. $ctx1.sendIdx["value"]=2;
  40389. $recv($4)._name_($5);
  40390. $ctx1.sendIdx["name:"]=1;
  40391. binding=$recv($4)._yourself();
  40392. $ctx1.sendIdx["yourself"]=1;
  40393. $6=$self._classReferences();
  40394. $7=$recv(aNode)._value();
  40395. $ctx1.sendIdx["value"]=3;
  40396. $recv($6)._add_($7);
  40397. } else {
  40398. $self._errorUnknownVariable_(aNode);
  40399. $8=$recv($globals.UnknownVar)._new();
  40400. $recv($8)._name_($recv(aNode)._value());
  40401. binding=$recv($8)._yourself();
  40402. binding;
  40403. }
  40404. } else {
  40405. $1;
  40406. }
  40407. $recv(aNode)._binding_(binding);
  40408. return self;
  40409. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode,binding:binding})});
  40410. },
  40411. args: ["aNode"],
  40412. source: "visitVariableNode: aNode\x0a\x09\x22Bind a ScopeVar to aNode by doing a lookup in the current scope.\x0a\x09If no ScopeVar is found, bind a UnknowVar and throw an error.\x22\x0a\x0a\x09| binding |\x0a\x09binding := currentScope lookupVariable: aNode.\x0a\x09\x0a\x09binding ifNil: [\x0a\x09\x09aNode value isCapitalized\x0a\x09\x09\x09ifTrue: [ \x22Capital letter variables might be globals.\x22\x0a\x09\x09\x09\x09binding := ClassRefVar new name: aNode value; yourself.\x0a\x09\x09\x09\x09self classReferences add: aNode value]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09self errorUnknownVariable: aNode.\x0a\x09\x09\x09\x09binding := UnknownVar new name: aNode value; yourself ] ].\x0a\x09\x09\x0a\x09aNode binding: binding.",
  40413. referencedClasses: ["ClassRefVar", "UnknownVar"],
  40414. pragmas: [],
  40415. messageSends: ["lookupVariable:", "ifNil:", "ifTrue:ifFalse:", "isCapitalized", "value", "name:", "new", "yourself", "add:", "classReferences", "errorUnknownVariable:", "binding:"]
  40416. }),
  40417. $globals.SemanticAnalyzer);
  40418. $core.addMethod(
  40419. $core.method({
  40420. selector: "on:",
  40421. protocol: "instance creation",
  40422. fn: function (aClass){
  40423. var self=this,$self=this;
  40424. return $core.withContext(function($ctx1) {
  40425. var $1;
  40426. $1=$self._new();
  40427. $recv($1)._theClass_(aClass);
  40428. return $recv($1)._yourself();
  40429. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass})});
  40430. },
  40431. args: ["aClass"],
  40432. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  40433. referencedClasses: [],
  40434. pragmas: [],
  40435. messageSends: ["theClass:", "new", "yourself"]
  40436. }),
  40437. $globals.SemanticAnalyzer.a$cls);
  40438. $core.addClass("SemanticError", $globals.CompilerError, [], "Compiler-Semantic");
  40439. $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";
  40440. $core.addClass("InvalidAssignmentError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  40441. $globals.InvalidAssignmentError.comment="I get signaled when a pseudo variable gets assigned.";
  40442. $core.addMethod(
  40443. $core.method({
  40444. selector: "messageText",
  40445. protocol: "accessing",
  40446. fn: function (){
  40447. var self=this,$self=this;
  40448. return $core.withContext(function($ctx1) {
  40449. return " Invalid assignment to variable: ".__comma($self._variableName());
  40450. }, function($ctx1) {$ctx1.fill(self,"messageText",{})});
  40451. },
  40452. args: [],
  40453. source: "messageText\x0a\x09^ ' Invalid assignment to variable: ', self variableName",
  40454. referencedClasses: [],
  40455. pragmas: [],
  40456. messageSends: [",", "variableName"]
  40457. }),
  40458. $globals.InvalidAssignmentError);
  40459. $core.addMethod(
  40460. $core.method({
  40461. selector: "variableName",
  40462. protocol: "accessing",
  40463. fn: function (){
  40464. var self=this,$self=this;
  40465. return $self.variableName;
  40466. },
  40467. args: [],
  40468. source: "variableName\x0a\x09^ variableName",
  40469. referencedClasses: [],
  40470. pragmas: [],
  40471. messageSends: []
  40472. }),
  40473. $globals.InvalidAssignmentError);
  40474. $core.addMethod(
  40475. $core.method({
  40476. selector: "variableName:",
  40477. protocol: "accessing",
  40478. fn: function (aString){
  40479. var self=this,$self=this;
  40480. $self.variableName=aString;
  40481. return self;
  40482. },
  40483. args: ["aString"],
  40484. source: "variableName: aString\x0a\x09variableName := aString",
  40485. referencedClasses: [],
  40486. pragmas: [],
  40487. messageSends: []
  40488. }),
  40489. $globals.InvalidAssignmentError);
  40490. $core.addClass("ShadowingVariableError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  40491. $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.";
  40492. $core.addMethod(
  40493. $core.method({
  40494. selector: "messageText",
  40495. protocol: "accessing",
  40496. fn: function (){
  40497. var self=this,$self=this;
  40498. return $core.withContext(function($ctx1) {
  40499. var $1;
  40500. $1=$recv("Variable shadowing error: ".__comma($self._variableName())).__comma(" is already defined");
  40501. $ctx1.sendIdx[","]=1;
  40502. return $1;
  40503. }, function($ctx1) {$ctx1.fill(self,"messageText",{})});
  40504. },
  40505. args: [],
  40506. source: "messageText\x0a\x09^ 'Variable shadowing error: ', self variableName, ' is already defined'",
  40507. referencedClasses: [],
  40508. pragmas: [],
  40509. messageSends: [",", "variableName"]
  40510. }),
  40511. $globals.ShadowingVariableError);
  40512. $core.addMethod(
  40513. $core.method({
  40514. selector: "variableName",
  40515. protocol: "accessing",
  40516. fn: function (){
  40517. var self=this,$self=this;
  40518. return $self.variableName;
  40519. },
  40520. args: [],
  40521. source: "variableName\x0a\x09^ variableName",
  40522. referencedClasses: [],
  40523. pragmas: [],
  40524. messageSends: []
  40525. }),
  40526. $globals.ShadowingVariableError);
  40527. $core.addMethod(
  40528. $core.method({
  40529. selector: "variableName:",
  40530. protocol: "accessing",
  40531. fn: function (aString){
  40532. var self=this,$self=this;
  40533. $self.variableName=aString;
  40534. return self;
  40535. },
  40536. args: ["aString"],
  40537. source: "variableName: aString\x0a\x09variableName := aString",
  40538. referencedClasses: [],
  40539. pragmas: [],
  40540. messageSends: []
  40541. }),
  40542. $globals.ShadowingVariableError);
  40543. $core.addClass("UnknownVariableError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  40544. $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.";
  40545. $core.addMethod(
  40546. $core.method({
  40547. selector: "messageText",
  40548. protocol: "accessing",
  40549. fn: function (){
  40550. var self=this,$self=this;
  40551. return $core.withContext(function($ctx1) {
  40552. var $1;
  40553. $1=$recv("Unknown Variable error: ".__comma($self._variableName())).__comma(" is not defined");
  40554. $ctx1.sendIdx[","]=1;
  40555. return $1;
  40556. }, function($ctx1) {$ctx1.fill(self,"messageText",{})});
  40557. },
  40558. args: [],
  40559. source: "messageText\x0a\x09^ 'Unknown Variable error: ', self variableName, ' is not defined'",
  40560. referencedClasses: [],
  40561. pragmas: [],
  40562. messageSends: [",", "variableName"]
  40563. }),
  40564. $globals.UnknownVariableError);
  40565. $core.addMethod(
  40566. $core.method({
  40567. selector: "variableName",
  40568. protocol: "accessing",
  40569. fn: function (){
  40570. var self=this,$self=this;
  40571. return $self.variableName;
  40572. },
  40573. args: [],
  40574. source: "variableName\x0a\x09^ variableName",
  40575. referencedClasses: [],
  40576. pragmas: [],
  40577. messageSends: []
  40578. }),
  40579. $globals.UnknownVariableError);
  40580. $core.addMethod(
  40581. $core.method({
  40582. selector: "variableName:",
  40583. protocol: "accessing",
  40584. fn: function (aString){
  40585. var self=this,$self=this;
  40586. $self.variableName=aString;
  40587. return self;
  40588. },
  40589. args: ["aString"],
  40590. source: "variableName: aString\x0a\x09variableName := aString",
  40591. referencedClasses: [],
  40592. pragmas: [],
  40593. messageSends: []
  40594. }),
  40595. $globals.UnknownVariableError);
  40596. });
  40597. define('amber/core/Compiler-IR',["amber/boot", "require", "amber/core/Compiler-AST", "amber/core/Kernel-Dag", "amber/core/Kernel-Methods", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  40598. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  40599. var $pkg = $core.addPackage("Compiler-IR");
  40600. $pkg.innerEval = function (expr) { return eval(expr); };
  40601. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  40602. $core.addClass("IRASTTranslator", $globals.NodeVisitor, ["source", "theClass", "method", "sequence", "nextAlias"], "Compiler-IR");
  40603. $globals.IRASTTranslator.comment="I am the AST (abstract syntax tree) visitor responsible for building the intermediate representation graph.";
  40604. $core.addMethod(
  40605. $core.method({
  40606. selector: "addToSequence:",
  40607. protocol: "visiting",
  40608. fn: function (anInstruction){
  40609. var self=this,$self=this;
  40610. return $core.withContext(function($ctx1) {
  40611. var $1,$receiver;
  40612. if(($receiver = anInstruction) == null || $receiver.a$nil){
  40613. anInstruction;
  40614. } else {
  40615. $1=$recv(anInstruction)._isVariable();
  40616. if(!$core.assert($1)){
  40617. $recv($self._sequence())._add_(anInstruction);
  40618. }
  40619. }
  40620. return anInstruction;
  40621. }, function($ctx1) {$ctx1.fill(self,"addToSequence:",{anInstruction:anInstruction})});
  40622. },
  40623. args: ["anInstruction"],
  40624. source: "addToSequence: anInstruction\x0a\x09anInstruction ifNotNil: [\x0a\x09\x09anInstruction isVariable ifFalse: [\x0a\x09\x09\x09self sequence add: anInstruction ] ].\x0a\x09^ anInstruction",
  40625. referencedClasses: [],
  40626. pragmas: [],
  40627. messageSends: ["ifNotNil:", "ifFalse:", "isVariable", "add:", "sequence"]
  40628. }),
  40629. $globals.IRASTTranslator);
  40630. $core.addMethod(
  40631. $core.method({
  40632. selector: "alias:",
  40633. protocol: "visiting",
  40634. fn: function (aNode){
  40635. var self=this,$self=this;
  40636. var variable;
  40637. return $core.withContext(function($ctx1) {
  40638. var $1,$2,$3,$5,$4,$7,$6;
  40639. $1=$recv(aNode)._isImmutable();
  40640. if($core.assert($1)){
  40641. $2=$self._visit_(aNode);
  40642. $ctx1.sendIdx["visit:"]=1;
  40643. return $2;
  40644. }
  40645. $3=$recv($globals.IRVariable)._new();
  40646. $ctx1.sendIdx["new"]=1;
  40647. $5=$recv($globals.AliasVar)._new();
  40648. $ctx1.sendIdx["new"]=2;
  40649. $4=$recv($5)._name_("$".__comma($self._nextAlias()));
  40650. $recv($3)._variable_($4);
  40651. variable=$recv($3)._yourself();
  40652. $ctx1.sendIdx["yourself"]=1;
  40653. $7=$recv($globals.IRAssignment)._new();
  40654. $recv($7)._add_(variable);
  40655. $ctx1.sendIdx["add:"]=1;
  40656. $recv($7)._add_($self._visit_(aNode));
  40657. $ctx1.sendIdx["add:"]=2;
  40658. $6=$recv($7)._yourself();
  40659. $self._addToSequence_($6);
  40660. $recv($recv($self._method())._internalVariables())._add_(variable);
  40661. return variable;
  40662. }, function($ctx1) {$ctx1.fill(self,"alias:",{aNode:aNode,variable:variable})});
  40663. },
  40664. args: ["aNode"],
  40665. source: "alias: aNode\x0a\x09| variable |\x0a\x0a\x09aNode isImmutable ifTrue: [ ^ self visit: aNode ].\x0a\x0a\x09variable := IRVariable new\x0a\x09\x09variable: (AliasVar new name: '$', self nextAlias);\x0a\x09\x09yourself.\x0a\x0a\x09self addToSequence: (IRAssignment new\x0a\x09\x09add: variable;\x0a\x09\x09add: (self visit: aNode);\x0a\x09\x09yourself).\x0a\x0a\x09self method internalVariables add: variable.\x0a\x0a\x09^ variable",
  40666. referencedClasses: ["IRVariable", "AliasVar", "IRAssignment"],
  40667. pragmas: [],
  40668. messageSends: ["ifTrue:", "isImmutable", "visit:", "variable:", "new", "name:", ",", "nextAlias", "yourself", "addToSequence:", "add:", "internalVariables", "method"]
  40669. }),
  40670. $globals.IRASTTranslator);
  40671. $core.addMethod(
  40672. $core.method({
  40673. selector: "aliasTemporally:",
  40674. protocol: "visiting",
  40675. fn: function (aCollection){
  40676. var self=this,$self=this;
  40677. var threshold,result;
  40678. return $core.withContext(function($ctx1) {
  40679. var $1,$2,$4,$3;
  40680. threshold=(0);
  40681. $recv(aCollection)._withIndexDo_((function(each,i){
  40682. return $core.withContext(function($ctx2) {
  40683. $1=$recv(each)._subtreeNeedsAliasing();
  40684. if($core.assert($1)){
  40685. threshold=i;
  40686. return threshold;
  40687. }
  40688. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  40689. }));
  40690. $ctx1.sendIdx["withIndexDo:"]=1;
  40691. result=$recv($globals.OrderedCollection)._new();
  40692. $recv(aCollection)._withIndexDo_((function(each,i){
  40693. return $core.withContext(function($ctx2) {
  40694. $2=result;
  40695. $4=$recv(i).__lt_eq(threshold);
  40696. if($core.assert($4)){
  40697. $3=$self._alias_(each);
  40698. } else {
  40699. $3=$self._visit_(each);
  40700. }
  40701. return $recv($2)._add_($3);
  40702. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  40703. }));
  40704. return result;
  40705. }, function($ctx1) {$ctx1.fill(self,"aliasTemporally:",{aCollection:aCollection,threshold:threshold,result:result})});
  40706. },
  40707. args: ["aCollection"],
  40708. source: "aliasTemporally: aCollection\x0a\x09\x22https://lolg.it/amber/amber/issues/296\x0a\x09\x0a\x09If a node is aliased, all preceding ones are aliased as well.\x0a\x09The tree is iterated twice. First we get the aliasing dependency,\x0a\x09then the aliasing itself is done\x22\x0a\x0a\x09| threshold result |\x0a\x09threshold := 0.\x0a\x09\x0a\x09aCollection withIndexDo: [ :each :i |\x0a\x09\x09each subtreeNeedsAliasing\x0a\x09\x09\x09ifTrue: [ threshold := i ] ].\x0a\x0a\x09result := OrderedCollection new.\x0a\x09aCollection withIndexDo: [ :each :i |\x0a\x09\x09result add: (i <= threshold\x0a\x09\x09\x09ifTrue: [ self alias: each ]\x0a\x09\x09\x09ifFalse: [ self visit: each ]) ].\x0a\x0a\x09^ result",
  40709. referencedClasses: ["OrderedCollection"],
  40710. pragmas: [],
  40711. messageSends: ["withIndexDo:", "ifTrue:", "subtreeNeedsAliasing", "new", "add:", "ifTrue:ifFalse:", "<=", "alias:", "visit:"]
  40712. }),
  40713. $globals.IRASTTranslator);
  40714. $core.addMethod(
  40715. $core.method({
  40716. selector: "method",
  40717. protocol: "accessing",
  40718. fn: function (){
  40719. var self=this,$self=this;
  40720. return $self.method;
  40721. },
  40722. args: [],
  40723. source: "method\x0a\x09^ method",
  40724. referencedClasses: [],
  40725. pragmas: [],
  40726. messageSends: []
  40727. }),
  40728. $globals.IRASTTranslator);
  40729. $core.addMethod(
  40730. $core.method({
  40731. selector: "method:",
  40732. protocol: "accessing",
  40733. fn: function (anIRMethod){
  40734. var self=this,$self=this;
  40735. $self.method=anIRMethod;
  40736. return self;
  40737. },
  40738. args: ["anIRMethod"],
  40739. source: "method: anIRMethod\x0a\x09method := anIRMethod",
  40740. referencedClasses: [],
  40741. pragmas: [],
  40742. messageSends: []
  40743. }),
  40744. $globals.IRASTTranslator);
  40745. $core.addMethod(
  40746. $core.method({
  40747. selector: "nextAlias",
  40748. protocol: "accessing",
  40749. fn: function (){
  40750. var self=this,$self=this;
  40751. return $core.withContext(function($ctx1) {
  40752. var $1,$receiver;
  40753. $1=$self.nextAlias;
  40754. if(($receiver = $1) == null || $receiver.a$nil){
  40755. $self.nextAlias=(0);
  40756. $self.nextAlias;
  40757. } else {
  40758. $1;
  40759. }
  40760. $self.nextAlias=$recv($self.nextAlias).__plus((1));
  40761. return $recv($self.nextAlias)._asString();
  40762. }, function($ctx1) {$ctx1.fill(self,"nextAlias",{})});
  40763. },
  40764. args: [],
  40765. source: "nextAlias\x0a\x09nextAlias ifNil: [ nextAlias := 0 ].\x0a\x09nextAlias := nextAlias + 1.\x0a\x09^ nextAlias asString",
  40766. referencedClasses: [],
  40767. pragmas: [],
  40768. messageSends: ["ifNil:", "+", "asString"]
  40769. }),
  40770. $globals.IRASTTranslator);
  40771. $core.addMethod(
  40772. $core.method({
  40773. selector: "sequence",
  40774. protocol: "accessing",
  40775. fn: function (){
  40776. var self=this,$self=this;
  40777. return $self.sequence;
  40778. },
  40779. args: [],
  40780. source: "sequence\x0a\x09^ sequence",
  40781. referencedClasses: [],
  40782. pragmas: [],
  40783. messageSends: []
  40784. }),
  40785. $globals.IRASTTranslator);
  40786. $core.addMethod(
  40787. $core.method({
  40788. selector: "sequence:",
  40789. protocol: "accessing",
  40790. fn: function (anIRSequence){
  40791. var self=this,$self=this;
  40792. $self.sequence=anIRSequence;
  40793. return self;
  40794. },
  40795. args: ["anIRSequence"],
  40796. source: "sequence: anIRSequence\x0a\x09sequence := anIRSequence",
  40797. referencedClasses: [],
  40798. pragmas: [],
  40799. messageSends: []
  40800. }),
  40801. $globals.IRASTTranslator);
  40802. $core.addMethod(
  40803. $core.method({
  40804. selector: "source",
  40805. protocol: "accessing",
  40806. fn: function (){
  40807. var self=this,$self=this;
  40808. return $self.source;
  40809. },
  40810. args: [],
  40811. source: "source\x0a\x09^ source",
  40812. referencedClasses: [],
  40813. pragmas: [],
  40814. messageSends: []
  40815. }),
  40816. $globals.IRASTTranslator);
  40817. $core.addMethod(
  40818. $core.method({
  40819. selector: "source:",
  40820. protocol: "accessing",
  40821. fn: function (aString){
  40822. var self=this,$self=this;
  40823. $self.source=aString;
  40824. return self;
  40825. },
  40826. args: ["aString"],
  40827. source: "source: aString\x0a\x09source := aString",
  40828. referencedClasses: [],
  40829. pragmas: [],
  40830. messageSends: []
  40831. }),
  40832. $globals.IRASTTranslator);
  40833. $core.addMethod(
  40834. $core.method({
  40835. selector: "theClass",
  40836. protocol: "accessing",
  40837. fn: function (){
  40838. var self=this,$self=this;
  40839. return $self.theClass;
  40840. },
  40841. args: [],
  40842. source: "theClass\x0a\x09^ theClass",
  40843. referencedClasses: [],
  40844. pragmas: [],
  40845. messageSends: []
  40846. }),
  40847. $globals.IRASTTranslator);
  40848. $core.addMethod(
  40849. $core.method({
  40850. selector: "theClass:",
  40851. protocol: "accessing",
  40852. fn: function (aClass){
  40853. var self=this,$self=this;
  40854. $self.theClass=aClass;
  40855. return self;
  40856. },
  40857. args: ["aClass"],
  40858. source: "theClass: aClass\x0a\x09theClass := aClass",
  40859. referencedClasses: [],
  40860. pragmas: [],
  40861. messageSends: []
  40862. }),
  40863. $globals.IRASTTranslator);
  40864. $core.addMethod(
  40865. $core.method({
  40866. selector: "visitAssignmentNode:",
  40867. protocol: "visiting",
  40868. fn: function (aNode){
  40869. var self=this,$self=this;
  40870. var left,right,assignment;
  40871. return $core.withContext(function($ctx1) {
  40872. var $2,$1;
  40873. right=$self._visit_($recv(aNode)._right());
  40874. $ctx1.sendIdx["visit:"]=1;
  40875. left=$self._visit_($recv(aNode)._left());
  40876. $2=$recv($globals.IRAssignment)._new();
  40877. $recv($2)._add_(left);
  40878. $ctx1.sendIdx["add:"]=1;
  40879. $recv($2)._add_(right);
  40880. $1=$recv($2)._yourself();
  40881. $self._addToSequence_($1);
  40882. return left;
  40883. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,left:left,right:right,assignment:assignment})});
  40884. },
  40885. args: ["aNode"],
  40886. 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",
  40887. referencedClasses: ["IRAssignment"],
  40888. pragmas: [],
  40889. messageSends: ["visit:", "right", "left", "addToSequence:", "add:", "new", "yourself"]
  40890. }),
  40891. $globals.IRASTTranslator);
  40892. $core.addMethod(
  40893. $core.method({
  40894. selector: "visitBlockNode:",
  40895. protocol: "visiting",
  40896. fn: function (aNode){
  40897. var self=this,$self=this;
  40898. var closure;
  40899. return $core.withContext(function($ctx1) {
  40900. var $1,$2,$4,$3,$5,$7,$6;
  40901. $1=$recv($globals.IRClosure)._new();
  40902. $ctx1.sendIdx["new"]=1;
  40903. $recv($1)._arguments_($recv(aNode)._parameters());
  40904. $recv($1)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  40905. $2=$recv(aNode)._scope();
  40906. $ctx1.sendIdx["scope"]=1;
  40907. $recv($1)._scope_($2);
  40908. $ctx1.sendIdx["scope:"]=1;
  40909. closure=$recv($1)._yourself();
  40910. $ctx1.sendIdx["yourself"]=1;
  40911. $4=$recv(aNode)._scope();
  40912. $ctx1.sendIdx["scope"]=2;
  40913. $3=$recv($4)._temps();
  40914. $recv($3)._do_((function(each){
  40915. return $core.withContext(function($ctx2) {
  40916. $5=closure;
  40917. $7=$recv($globals.IRTempDeclaration)._new();
  40918. $recv($7)._name_($recv(each)._name());
  40919. $recv($7)._scope_($recv(aNode)._scope());
  40920. $6=$recv($7)._yourself();
  40921. return $recv($5)._add_($6);
  40922. $ctx2.sendIdx["add:"]=1;
  40923. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40924. }));
  40925. $ctx1.sendIdx["do:"]=1;
  40926. $recv($recv(aNode)._dagChildren())._do_((function(each){
  40927. return $core.withContext(function($ctx2) {
  40928. return $recv(closure)._add_($self._visit_(each));
  40929. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  40930. }));
  40931. return closure;
  40932. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,closure:closure})});
  40933. },
  40934. args: ["aNode"],
  40935. source: "visitBlockNode: aNode\x0a\x09| closure |\x0a\x09closure := IRClosure new\x0a\x09\x09arguments: aNode parameters;\x0a\x09\x09requiresSmalltalkContext: aNode requiresSmalltalkContext;\x0a\x09\x09scope: aNode scope;\x0a\x09\x09yourself.\x0a\x09aNode scope temps do: [ :each |\x0a\x09\x09closure add: (IRTempDeclaration new\x0a\x09\x09\x09name: each name;\x0a\x09\x09\x09scope: aNode scope;\x0a\x09\x09\x09yourself) ].\x0a\x09aNode dagChildren do: [ :each | closure add: (self visit: each) ].\x0a\x09^ closure",
  40936. referencedClasses: ["IRClosure", "IRTempDeclaration"],
  40937. pragmas: [],
  40938. messageSends: ["arguments:", "new", "parameters", "requiresSmalltalkContext:", "requiresSmalltalkContext", "scope:", "scope", "yourself", "do:", "temps", "add:", "name:", "name", "dagChildren", "visit:"]
  40939. }),
  40940. $globals.IRASTTranslator);
  40941. $core.addMethod(
  40942. $core.method({
  40943. selector: "visitBlockSequenceNode:",
  40944. protocol: "visiting",
  40945. fn: function (aNode){
  40946. var self=this,$self=this;
  40947. return $core.withContext(function($ctx1) {
  40948. var $1,$2,$4,$3,$5,$8,$7,$6,$10,$13,$12,$11,$9;
  40949. $1=$recv($globals.IRBlockSequence)._new();
  40950. $ctx1.sendIdx["new"]=1;
  40951. return $self._withSequence_do_($1,(function(){
  40952. return $core.withContext(function($ctx2) {
  40953. $2=$recv(aNode)._dagChildren();
  40954. $ctx2.sendIdx["dagChildren"]=1;
  40955. return $recv($2)._ifNotEmpty_((function(){
  40956. return $core.withContext(function($ctx3) {
  40957. $4=$recv(aNode)._dagChildren();
  40958. $ctx3.sendIdx["dagChildren"]=2;
  40959. $3=$recv($4)._allButLast();
  40960. $recv($3)._do_((function(each){
  40961. return $core.withContext(function($ctx4) {
  40962. $5=$self._visitOrAlias_(each);
  40963. $ctx4.sendIdx["visitOrAlias:"]=1;
  40964. return $self._addToSequence_($5);
  40965. $ctx4.sendIdx["addToSequence:"]=1;
  40966. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  40967. }));
  40968. $8=$recv(aNode)._dagChildren();
  40969. $ctx3.sendIdx["dagChildren"]=3;
  40970. $7=$recv($8)._last();
  40971. $ctx3.sendIdx["last"]=1;
  40972. $6=$recv($7)._isReturnNode();
  40973. if($core.assert($6)){
  40974. return $self._addToSequence_($self._visitOrAlias_($recv($recv(aNode)._dagChildren())._last()));
  40975. } else {
  40976. $10=$recv($globals.IRBlockReturn)._new();
  40977. $13=$recv(aNode)._dagChildren();
  40978. $ctx3.sendIdx["dagChildren"]=4;
  40979. $12=$recv($13)._last();
  40980. $ctx3.sendIdx["last"]=2;
  40981. $11=$self._visitOrAlias_($12);
  40982. $ctx3.sendIdx["visitOrAlias:"]=2;
  40983. $recv($10)._add_($11);
  40984. $9=$recv($10)._yourself();
  40985. return $self._addToSequence_($9);
  40986. $ctx3.sendIdx["addToSequence:"]=2;
  40987. }
  40988. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  40989. }));
  40990. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40991. }));
  40992. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode})});
  40993. },
  40994. args: ["aNode"],
  40995. source: "visitBlockSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRBlockSequence new\x0a\x09\x09do: [\x0a\x09\x09\x09aNode dagChildren ifNotEmpty: [\x0a\x09\x09\x09\x09aNode dagChildren allButLast do: [ :each |\x0a\x09\x09\x09\x09\x09self addToSequence: (self visitOrAlias: each) ].\x0a\x09\x09\x09\x09aNode dagChildren last isReturnNode\x0a\x09\x09\x09\x09\x09ifFalse: [ self addToSequence: (IRBlockReturn new add: (self visitOrAlias: aNode dagChildren last); yourself) ]\x0a\x09\x09\x09\x09\x09ifTrue: [ self addToSequence: (self visitOrAlias: aNode dagChildren last) ] ]]",
  40996. referencedClasses: ["IRBlockSequence", "IRBlockReturn"],
  40997. pragmas: [],
  40998. messageSends: ["withSequence:do:", "new", "ifNotEmpty:", "dagChildren", "do:", "allButLast", "addToSequence:", "visitOrAlias:", "ifFalse:ifTrue:", "isReturnNode", "last", "add:", "yourself"]
  40999. }),
  41000. $globals.IRASTTranslator);
  41001. $core.addMethod(
  41002. $core.method({
  41003. selector: "visitCascadeNode:",
  41004. protocol: "visiting",
  41005. fn: function (aNode){
  41006. var self=this,$self=this;
  41007. var receiver;
  41008. return $core.withContext(function($ctx1) {
  41009. var $1,$2,$4,$3;
  41010. receiver=$recv(aNode)._receiver();
  41011. $1=$recv(receiver)._isImmutable();
  41012. if(!$core.assert($1)){
  41013. var alias;
  41014. alias=$self._alias_(receiver);
  41015. receiver=$recv($recv($globals.VariableNode)._new())._binding_($recv(alias)._variable());
  41016. receiver;
  41017. }
  41018. $2=$recv(aNode)._dagChildren();
  41019. $ctx1.sendIdx["dagChildren"]=1;
  41020. $recv($2)._do_((function(each){
  41021. return $core.withContext(function($ctx2) {
  41022. return $recv(each)._receiver_(receiver);
  41023. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  41024. }));
  41025. $ctx1.sendIdx["do:"]=1;
  41026. $4=$recv(aNode)._dagChildren();
  41027. $ctx1.sendIdx["dagChildren"]=2;
  41028. $3=$recv($4)._allButLast();
  41029. $recv($3)._do_((function(each){
  41030. return $core.withContext(function($ctx2) {
  41031. return $self._addToSequence_($self._visit_(each));
  41032. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  41033. }));
  41034. return $self._visitOrAlias_($recv($recv(aNode)._dagChildren())._last());
  41035. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode,receiver:receiver})});
  41036. },
  41037. args: ["aNode"],
  41038. source: "visitCascadeNode: aNode\x0a\x09| receiver |\x0a\x09receiver := aNode receiver.\x0a\x09receiver isImmutable ifFalse: [\x0a\x09\x09| alias |\x0a\x09\x09alias := self alias: receiver.\x0a\x09\x09receiver := VariableNode new binding: alias variable ].\x0a\x09aNode dagChildren do: [ :each | each receiver: receiver ].\x0a\x0a\x09aNode dagChildren allButLast do: [ :each |\x0a\x09\x09self addToSequence: (self visit: each) ].\x0a\x0a\x09^ self visitOrAlias: aNode dagChildren last",
  41039. referencedClasses: ["VariableNode"],
  41040. pragmas: [],
  41041. messageSends: ["receiver", "ifFalse:", "isImmutable", "alias:", "binding:", "new", "variable", "do:", "dagChildren", "receiver:", "allButLast", "addToSequence:", "visit:", "visitOrAlias:", "last"]
  41042. }),
  41043. $globals.IRASTTranslator);
  41044. $core.addMethod(
  41045. $core.method({
  41046. selector: "visitDynamicArrayNode:",
  41047. protocol: "visiting",
  41048. fn: function (aNode){
  41049. var self=this,$self=this;
  41050. var array;
  41051. return $core.withContext(function($ctx1) {
  41052. array=$recv($globals.IRDynamicArray)._new();
  41053. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  41054. return $core.withContext(function($ctx2) {
  41055. return $recv(array)._add_(each);
  41056. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41057. }));
  41058. return array;
  41059. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array})});
  41060. },
  41061. args: ["aNode"],
  41062. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09array := IRDynamicArray new.\x0a\x09(self aliasTemporally: aNode dagChildren) do: [ :each | array add: each ].\x0a\x09^ array",
  41063. referencedClasses: ["IRDynamicArray"],
  41064. pragmas: [],
  41065. messageSends: ["new", "do:", "aliasTemporally:", "dagChildren", "add:"]
  41066. }),
  41067. $globals.IRASTTranslator);
  41068. $core.addMethod(
  41069. $core.method({
  41070. selector: "visitDynamicDictionaryNode:",
  41071. protocol: "visiting",
  41072. fn: function (aNode){
  41073. var self=this,$self=this;
  41074. var dictionary;
  41075. return $core.withContext(function($ctx1) {
  41076. dictionary=$recv($globals.IRDynamicDictionary)._new();
  41077. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  41078. return $core.withContext(function($ctx2) {
  41079. return $recv(dictionary)._add_(each);
  41080. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41081. }));
  41082. return dictionary;
  41083. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,dictionary:dictionary})});
  41084. },
  41085. args: ["aNode"],
  41086. source: "visitDynamicDictionaryNode: aNode\x0a\x09| dictionary |\x0a\x09dictionary := IRDynamicDictionary new.\x0a\x09(self aliasTemporally: aNode dagChildren) do: [ :each | dictionary add: each ].\x0a\x09^ dictionary",
  41087. referencedClasses: ["IRDynamicDictionary"],
  41088. pragmas: [],
  41089. messageSends: ["new", "do:", "aliasTemporally:", "dagChildren", "add:"]
  41090. }),
  41091. $globals.IRASTTranslator);
  41092. $core.addMethod(
  41093. $core.method({
  41094. selector: "visitJSStatementNode:",
  41095. protocol: "visiting",
  41096. fn: function (aNode){
  41097. var self=this,$self=this;
  41098. return $core.withContext(function($ctx1) {
  41099. var $1;
  41100. $1=$recv($globals.IRVerbatim)._new();
  41101. $recv($1)._source_($recv($recv(aNode)._source())._crlfSanitized());
  41102. return $recv($1)._yourself();
  41103. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode})});
  41104. },
  41105. args: ["aNode"],
  41106. source: "visitJSStatementNode: aNode\x0a\x09^ IRVerbatim new\x0a\x09\x09source: aNode source crlfSanitized;\x0a\x09\x09yourself",
  41107. referencedClasses: ["IRVerbatim"],
  41108. pragmas: [],
  41109. messageSends: ["source:", "new", "crlfSanitized", "source", "yourself"]
  41110. }),
  41111. $globals.IRASTTranslator);
  41112. $core.addMethod(
  41113. $core.method({
  41114. selector: "visitMethodNode:",
  41115. protocol: "visiting",
  41116. fn: function (aNode){
  41117. var self=this,$self=this;
  41118. return $core.withContext(function($ctx1) {
  41119. var $2,$3,$5,$7,$8,$6,$4,$9,$10,$1,$12,$11,$13,$15,$16,$17,$14,$18,$20,$19,$21,$23,$25,$26,$24,$27,$22,$29,$28;
  41120. $2=$recv($globals.IRMethod)._new();
  41121. $ctx1.sendIdx["new"]=1;
  41122. $3=$recv($self._source())._crlfSanitized();
  41123. $ctx1.sendIdx["crlfSanitized"]=1;
  41124. $recv($2)._source_($3);
  41125. $ctx1.sendIdx["source:"]=1;
  41126. $4=$recv($recv(aNode)._pragmas())._collect_((function(each){
  41127. return $core.withContext(function($ctx2) {
  41128. $5=$recv(each)._selector();
  41129. $ctx2.sendIdx["selector"]=1;
  41130. $7=$recv(each)._arguments();
  41131. $ctx2.sendIdx["arguments"]=1;
  41132. $6=$recv($7)._collect_((function(eachArg){
  41133. return $core.withContext(function($ctx3) {
  41134. $8=$recv(eachArg)._isString();
  41135. if($core.assert($8)){
  41136. return $recv(eachArg)._crlfSanitized();
  41137. } else {
  41138. return eachArg;
  41139. }
  41140. }, function($ctx3) {$ctx3.fillBlock({eachArg:eachArg},$ctx2,2)});
  41141. }));
  41142. return $recv($globals.Message)._selector_arguments_($5,$6);
  41143. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41144. }));
  41145. $ctx1.sendIdx["collect:"]=1;
  41146. $recv($2)._pragmas_($4);
  41147. $recv($2)._theClass_($self._theClass());
  41148. $recv($2)._arguments_($recv(aNode)._arguments());
  41149. $recv($2)._selector_($recv(aNode)._selector());
  41150. $recv($2)._sendIndexes_($recv(aNode)._sendIndexes());
  41151. $recv($2)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  41152. $recv($2)._classReferences_($recv(aNode)._classReferences());
  41153. $9=$recv(aNode)._scope();
  41154. $ctx1.sendIdx["scope"]=1;
  41155. $recv($2)._scope_($9);
  41156. $ctx1.sendIdx["scope:"]=1;
  41157. $10=$recv($2)._yourself();
  41158. $ctx1.sendIdx["yourself"]=1;
  41159. $1=$10;
  41160. $self._method_($1);
  41161. $12=$recv(aNode)._scope();
  41162. $ctx1.sendIdx["scope"]=2;
  41163. $11=$recv($12)._temps();
  41164. $recv($11)._do_((function(each){
  41165. return $core.withContext(function($ctx2) {
  41166. $13=$self._method();
  41167. $ctx2.sendIdx["method"]=1;
  41168. $15=$recv($globals.IRTempDeclaration)._new();
  41169. $ctx2.sendIdx["new"]=2;
  41170. $recv($15)._name_($recv(each)._name());
  41171. $16=$recv(aNode)._scope();
  41172. $ctx2.sendIdx["scope"]=3;
  41173. $recv($15)._scope_($16);
  41174. $17=$recv($15)._yourself();
  41175. $ctx2.sendIdx["yourself"]=2;
  41176. $14=$17;
  41177. return $recv($13)._add_($14);
  41178. $ctx2.sendIdx["add:"]=1;
  41179. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)});
  41180. }));
  41181. $ctx1.sendIdx["do:"]=1;
  41182. $recv($recv(aNode)._dagChildren())._do_((function(each){
  41183. return $core.withContext(function($ctx2) {
  41184. $18=$self._method();
  41185. $ctx2.sendIdx["method"]=2;
  41186. return $recv($18)._add_($self._visit_(each));
  41187. $ctx2.sendIdx["add:"]=2;
  41188. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  41189. }));
  41190. $20=$recv(aNode)._scope();
  41191. $ctx1.sendIdx["scope"]=4;
  41192. $19=$recv($20)._hasLocalReturn();
  41193. if(!$core.assert($19)){
  41194. $21=$self._method();
  41195. $ctx1.sendIdx["method"]=3;
  41196. $23=$recv($globals.IRReturn)._new();
  41197. $ctx1.sendIdx["new"]=3;
  41198. $25=$recv($globals.IRVariable)._new();
  41199. $ctx1.sendIdx["new"]=4;
  41200. $recv($25)._variable_($recv($recv($recv(aNode)._scope())._pseudoVars())._at_("self"));
  41201. $26=$recv($25)._yourself();
  41202. $ctx1.sendIdx["yourself"]=3;
  41203. $24=$26;
  41204. $recv($23)._add_($24);
  41205. $ctx1.sendIdx["add:"]=4;
  41206. $27=$recv($23)._yourself();
  41207. $ctx1.sendIdx["yourself"]=4;
  41208. $22=$27;
  41209. $recv($21)._add_($22);
  41210. $ctx1.sendIdx["add:"]=3;
  41211. $29=$recv($globals.IRVerbatim)._new();
  41212. $recv($29)._source_(";".__comma($recv($globals.String)._lf()));
  41213. $28=$recv($29)._yourself();
  41214. $recv($21)._add_($28);
  41215. }
  41216. return $self._method();
  41217. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode})});
  41218. },
  41219. args: ["aNode"],
  41220. source: "visitMethodNode: aNode\x0a\x0a\x09self method: (IRMethod new\x0a\x09\x09source: self source crlfSanitized;\x0a\x09\x09pragmas: (aNode pragmas collect: [ :each |\x0a\x09\x09\x09Message\x0a\x09\x09\x09\x09selector: each\x0a\x09\x09\x09\x09selector arguments: (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\x09aNode dagChildren do: [ :each | self method add: (self visit: each) ].\x0a\x0a\x09aNode scope hasLocalReturn ifFalse: [self method\x0a\x09\x09add: (IRReturn new\x0a\x09\x09\x09add: (IRVariable new\x0a\x09\x09\x09\x09variable: (aNode scope pseudoVars at: 'self');\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself);\x0a\x09\x09add: (IRVerbatim new source: ';', String lf; yourself) ].\x0a\x0a\x09^ self method",
  41221. referencedClasses: ["IRMethod", "Message", "IRTempDeclaration", "IRReturn", "IRVariable", "IRVerbatim", "String"],
  41222. pragmas: [],
  41223. messageSends: ["method:", "source:", "new", "crlfSanitized", "source", "pragmas:", "collect:", "pragmas", "selector:arguments:", "selector", "arguments", "ifTrue:ifFalse:", "isString", "theClass:", "theClass", "arguments:", "selector:", "sendIndexes:", "sendIndexes", "requiresSmalltalkContext:", "requiresSmalltalkContext", "classReferences:", "classReferences", "scope:", "scope", "yourself", "do:", "temps", "add:", "method", "name:", "name", "dagChildren", "visit:", "ifFalse:", "hasLocalReturn", "variable:", "at:", "pseudoVars", ",", "lf"]
  41224. }),
  41225. $globals.IRASTTranslator);
  41226. $core.addMethod(
  41227. $core.method({
  41228. selector: "visitOrAlias:",
  41229. protocol: "visiting",
  41230. fn: function (aNode){
  41231. var self=this,$self=this;
  41232. return $core.withContext(function($ctx1) {
  41233. var $1;
  41234. $1=$recv(aNode)._shouldBeAliased();
  41235. if($core.assert($1)){
  41236. return $self._alias_(aNode);
  41237. } else {
  41238. return $self._visit_(aNode);
  41239. }
  41240. }, function($ctx1) {$ctx1.fill(self,"visitOrAlias:",{aNode:aNode})});
  41241. },
  41242. args: ["aNode"],
  41243. source: "visitOrAlias: aNode\x0a\x09^ aNode shouldBeAliased\x0a\x09\x09ifTrue: [ self alias: aNode ]\x0a\x09\x09ifFalse: [ self visit: aNode ]",
  41244. referencedClasses: [],
  41245. pragmas: [],
  41246. messageSends: ["ifTrue:ifFalse:", "shouldBeAliased", "alias:", "visit:"]
  41247. }),
  41248. $globals.IRASTTranslator);
  41249. $core.addMethod(
  41250. $core.method({
  41251. selector: "visitReturnNode:",
  41252. protocol: "visiting",
  41253. fn: function (aNode){
  41254. var self=this,$self=this;
  41255. var return_;
  41256. return $core.withContext(function($ctx1) {
  41257. var $1;
  41258. $1=$recv(aNode)._nonLocalReturn();
  41259. if($core.assert($1)){
  41260. return_=$recv($globals.IRNonLocalReturn)._new();
  41261. $ctx1.sendIdx["new"]=1;
  41262. } else {
  41263. return_=$recv($globals.IRReturn)._new();
  41264. }
  41265. $recv(return_)._scope_($recv(aNode)._scope());
  41266. $recv($recv(aNode)._dagChildren())._do_((function(each){
  41267. return $core.withContext(function($ctx2) {
  41268. return $recv(return_)._add_($self._visitOrAlias_(each));
  41269. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  41270. }));
  41271. return return_;
  41272. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode,return_:return_})});
  41273. },
  41274. args: ["aNode"],
  41275. source: "visitReturnNode: aNode\x0a\x09| return |\x0a\x09return := aNode nonLocalReturn\x0a\x09\x09ifTrue: [ IRNonLocalReturn new ]\x0a\x09\x09ifFalse: [ IRReturn new ].\x0a\x09return scope: aNode scope.\x0a\x09aNode dagChildren do: [ :each |\x0a\x09\x09return add: (self visitOrAlias: each) ].\x0a\x09^ return",
  41276. referencedClasses: ["IRNonLocalReturn", "IRReturn"],
  41277. pragmas: [],
  41278. messageSends: ["ifTrue:ifFalse:", "nonLocalReturn", "new", "scope:", "scope", "do:", "dagChildren", "add:", "visitOrAlias:"]
  41279. }),
  41280. $globals.IRASTTranslator);
  41281. $core.addMethod(
  41282. $core.method({
  41283. selector: "visitSendNode:",
  41284. protocol: "visiting",
  41285. fn: function (aNode){
  41286. var self=this,$self=this;
  41287. var send;
  41288. return $core.withContext(function($ctx1) {
  41289. var $1;
  41290. send=$recv($globals.IRSend)._new();
  41291. $1=send;
  41292. $recv($1)._selector_($recv(aNode)._selector());
  41293. $recv($1)._index_($recv(aNode)._index());
  41294. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  41295. return $core.withContext(function($ctx2) {
  41296. return $recv(send)._add_(each);
  41297. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41298. }));
  41299. return send;
  41300. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,send:send})});
  41301. },
  41302. args: ["aNode"],
  41303. source: "visitSendNode: aNode\x0a\x09| send |\x0a\x09send := IRSend new.\x0a\x09send\x0a\x09\x09selector: aNode selector;\x0a\x09\x09index: aNode index.\x0a\x09\x0a\x09(self aliasTemporally: aNode dagChildren) do: [ :each | send add: each ].\x0a\x0a\x09^ send",
  41304. referencedClasses: ["IRSend"],
  41305. pragmas: [],
  41306. messageSends: ["new", "selector:", "selector", "index:", "index", "do:", "aliasTemporally:", "dagChildren", "add:"]
  41307. }),
  41308. $globals.IRASTTranslator);
  41309. $core.addMethod(
  41310. $core.method({
  41311. selector: "visitSequenceNode:",
  41312. protocol: "visiting",
  41313. fn: function (aNode){
  41314. var self=this,$self=this;
  41315. return $core.withContext(function($ctx1) {
  41316. return $self._withSequence_do_($recv($globals.IRSequence)._new(),(function(){
  41317. return $core.withContext(function($ctx2) {
  41318. return $recv($recv(aNode)._dagChildren())._do_((function(each){
  41319. return $core.withContext(function($ctx3) {
  41320. return $self._addToSequence_($self._visitOrAlias_(each));
  41321. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  41322. }));
  41323. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41324. }));
  41325. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode})});
  41326. },
  41327. args: ["aNode"],
  41328. source: "visitSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRSequence new\x0a\x09\x09do: [ aNode dagChildren do: [ :each |\x0a\x09\x09\x09self addToSequence: (self visitOrAlias: each) ] ]",
  41329. referencedClasses: ["IRSequence"],
  41330. pragmas: [],
  41331. messageSends: ["withSequence:do:", "new", "do:", "dagChildren", "addToSequence:", "visitOrAlias:"]
  41332. }),
  41333. $globals.IRASTTranslator);
  41334. $core.addMethod(
  41335. $core.method({
  41336. selector: "visitValueNode:",
  41337. protocol: "visiting",
  41338. fn: function (aNode){
  41339. var self=this,$self=this;
  41340. return $core.withContext(function($ctx1) {
  41341. var $1;
  41342. $1=$recv($globals.IRValue)._new();
  41343. $recv($1)._value_($recv(aNode)._value());
  41344. return $recv($1)._yourself();
  41345. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode})});
  41346. },
  41347. args: ["aNode"],
  41348. source: "visitValueNode: aNode\x0a\x09^ IRValue new\x0a\x09\x09value: aNode value;\x0a\x09\x09yourself",
  41349. referencedClasses: ["IRValue"],
  41350. pragmas: [],
  41351. messageSends: ["value:", "new", "value", "yourself"]
  41352. }),
  41353. $globals.IRASTTranslator);
  41354. $core.addMethod(
  41355. $core.method({
  41356. selector: "visitVariableNode:",
  41357. protocol: "visiting",
  41358. fn: function (aNode){
  41359. var self=this,$self=this;
  41360. return $core.withContext(function($ctx1) {
  41361. var $1;
  41362. $1=$recv($globals.IRVariable)._new();
  41363. $recv($1)._variable_($recv(aNode)._binding());
  41364. return $recv($1)._yourself();
  41365. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode})});
  41366. },
  41367. args: ["aNode"],
  41368. source: "visitVariableNode: aNode\x0a\x09^ IRVariable new\x0a\x09\x09variable: aNode binding;\x0a\x09\x09yourself",
  41369. referencedClasses: ["IRVariable"],
  41370. pragmas: [],
  41371. messageSends: ["variable:", "new", "binding", "yourself"]
  41372. }),
  41373. $globals.IRASTTranslator);
  41374. $core.addMethod(
  41375. $core.method({
  41376. selector: "withSequence:do:",
  41377. protocol: "accessing",
  41378. fn: function (aSequence,aBlock){
  41379. var self=this,$self=this;
  41380. var outerSequence;
  41381. return $core.withContext(function($ctx1) {
  41382. outerSequence=$self._sequence();
  41383. $self._sequence_(aSequence);
  41384. $ctx1.sendIdx["sequence:"]=1;
  41385. $recv(aBlock)._value();
  41386. $self._sequence_(outerSequence);
  41387. return aSequence;
  41388. }, function($ctx1) {$ctx1.fill(self,"withSequence:do:",{aSequence:aSequence,aBlock:aBlock,outerSequence:outerSequence})});
  41389. },
  41390. args: ["aSequence", "aBlock"],
  41391. 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",
  41392. referencedClasses: [],
  41393. pragmas: [],
  41394. messageSends: ["sequence", "sequence:", "value"]
  41395. }),
  41396. $globals.IRASTTranslator);
  41397. $core.addClass("IRInstruction", $globals.DagParentNode, ["parent"], "Compiler-IR");
  41398. $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.";
  41399. $core.addMethod(
  41400. $core.method({
  41401. selector: "add:",
  41402. protocol: "building",
  41403. fn: function (anObject){
  41404. var self=this,$self=this;
  41405. return $core.withContext(function($ctx1) {
  41406. $recv(anObject)._parent_(self);
  41407. return $recv($self._dagChildren())._add_(anObject);
  41408. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject})});
  41409. },
  41410. args: ["anObject"],
  41411. source: "add: anObject\x0a\x09anObject parent: self.\x0a\x09^ self dagChildren add: anObject",
  41412. referencedClasses: [],
  41413. pragmas: [],
  41414. messageSends: ["parent:", "add:", "dagChildren"]
  41415. }),
  41416. $globals.IRInstruction);
  41417. $core.addMethod(
  41418. $core.method({
  41419. selector: "isClosure",
  41420. protocol: "testing",
  41421. fn: function (){
  41422. var self=this,$self=this;
  41423. return false;
  41424. },
  41425. args: [],
  41426. source: "isClosure\x0a\x09^ false",
  41427. referencedClasses: [],
  41428. pragmas: [],
  41429. messageSends: []
  41430. }),
  41431. $globals.IRInstruction);
  41432. $core.addMethod(
  41433. $core.method({
  41434. selector: "isInlined",
  41435. protocol: "testing",
  41436. fn: function (){
  41437. var self=this,$self=this;
  41438. return false;
  41439. },
  41440. args: [],
  41441. source: "isInlined\x0a\x09^ false",
  41442. referencedClasses: [],
  41443. pragmas: [],
  41444. messageSends: []
  41445. }),
  41446. $globals.IRInstruction);
  41447. $core.addMethod(
  41448. $core.method({
  41449. selector: "isMethod",
  41450. protocol: "testing",
  41451. fn: function (){
  41452. var self=this,$self=this;
  41453. return false;
  41454. },
  41455. args: [],
  41456. source: "isMethod\x0a\x09^ false",
  41457. referencedClasses: [],
  41458. pragmas: [],
  41459. messageSends: []
  41460. }),
  41461. $globals.IRInstruction);
  41462. $core.addMethod(
  41463. $core.method({
  41464. selector: "isSelf",
  41465. protocol: "testing",
  41466. fn: function (){
  41467. var self=this,$self=this;
  41468. return false;
  41469. },
  41470. args: [],
  41471. source: "isSelf\x0a\x09^ false",
  41472. referencedClasses: [],
  41473. pragmas: [],
  41474. messageSends: []
  41475. }),
  41476. $globals.IRInstruction);
  41477. $core.addMethod(
  41478. $core.method({
  41479. selector: "isSend",
  41480. protocol: "testing",
  41481. fn: function (){
  41482. var self=this,$self=this;
  41483. return false;
  41484. },
  41485. args: [],
  41486. source: "isSend\x0a\x09^ false",
  41487. referencedClasses: [],
  41488. pragmas: [],
  41489. messageSends: []
  41490. }),
  41491. $globals.IRInstruction);
  41492. $core.addMethod(
  41493. $core.method({
  41494. selector: "isSequence",
  41495. protocol: "testing",
  41496. fn: function (){
  41497. var self=this,$self=this;
  41498. return false;
  41499. },
  41500. args: [],
  41501. source: "isSequence\x0a\x09^ false",
  41502. referencedClasses: [],
  41503. pragmas: [],
  41504. messageSends: []
  41505. }),
  41506. $globals.IRInstruction);
  41507. $core.addMethod(
  41508. $core.method({
  41509. selector: "isSuper",
  41510. protocol: "testing",
  41511. fn: function (){
  41512. var self=this,$self=this;
  41513. return false;
  41514. },
  41515. args: [],
  41516. source: "isSuper\x0a\x09^ false",
  41517. referencedClasses: [],
  41518. pragmas: [],
  41519. messageSends: []
  41520. }),
  41521. $globals.IRInstruction);
  41522. $core.addMethod(
  41523. $core.method({
  41524. selector: "isTempDeclaration",
  41525. protocol: "testing",
  41526. fn: function (){
  41527. var self=this,$self=this;
  41528. return false;
  41529. },
  41530. args: [],
  41531. source: "isTempDeclaration\x0a\x09^ false",
  41532. referencedClasses: [],
  41533. pragmas: [],
  41534. messageSends: []
  41535. }),
  41536. $globals.IRInstruction);
  41537. $core.addMethod(
  41538. $core.method({
  41539. selector: "isVariable",
  41540. protocol: "testing",
  41541. fn: function (){
  41542. var self=this,$self=this;
  41543. return false;
  41544. },
  41545. args: [],
  41546. source: "isVariable\x0a\x09^ false",
  41547. referencedClasses: [],
  41548. pragmas: [],
  41549. messageSends: []
  41550. }),
  41551. $globals.IRInstruction);
  41552. $core.addMethod(
  41553. $core.method({
  41554. selector: "method",
  41555. protocol: "accessing",
  41556. fn: function (){
  41557. var self=this,$self=this;
  41558. return $core.withContext(function($ctx1) {
  41559. return $recv($self._parent())._method();
  41560. }, function($ctx1) {$ctx1.fill(self,"method",{})});
  41561. },
  41562. args: [],
  41563. source: "method\x0a\x09^ self parent method",
  41564. referencedClasses: [],
  41565. pragmas: [],
  41566. messageSends: ["method", "parent"]
  41567. }),
  41568. $globals.IRInstruction);
  41569. $core.addMethod(
  41570. $core.method({
  41571. selector: "needsBoxingAsReceiver",
  41572. protocol: "testing",
  41573. fn: function (){
  41574. var self=this,$self=this;
  41575. return true;
  41576. },
  41577. args: [],
  41578. source: "needsBoxingAsReceiver\x0a\x09^ true",
  41579. referencedClasses: [],
  41580. pragmas: [],
  41581. messageSends: []
  41582. }),
  41583. $globals.IRInstruction);
  41584. $core.addMethod(
  41585. $core.method({
  41586. selector: "parent",
  41587. protocol: "accessing",
  41588. fn: function (){
  41589. var self=this,$self=this;
  41590. return $self.parent;
  41591. },
  41592. args: [],
  41593. source: "parent\x0a\x09^ parent",
  41594. referencedClasses: [],
  41595. pragmas: [],
  41596. messageSends: []
  41597. }),
  41598. $globals.IRInstruction);
  41599. $core.addMethod(
  41600. $core.method({
  41601. selector: "parent:",
  41602. protocol: "accessing",
  41603. fn: function (anIRInstruction){
  41604. var self=this,$self=this;
  41605. $self.parent=anIRInstruction;
  41606. return self;
  41607. },
  41608. args: ["anIRInstruction"],
  41609. source: "parent: anIRInstruction\x0a\x09parent := anIRInstruction",
  41610. referencedClasses: [],
  41611. pragmas: [],
  41612. messageSends: []
  41613. }),
  41614. $globals.IRInstruction);
  41615. $core.addMethod(
  41616. $core.method({
  41617. selector: "remove:",
  41618. protocol: "building",
  41619. fn: function (anIRInstruction){
  41620. var self=this,$self=this;
  41621. return $core.withContext(function($ctx1) {
  41622. $recv($self._dagChildren())._remove_(anIRInstruction);
  41623. return self;
  41624. }, function($ctx1) {$ctx1.fill(self,"remove:",{anIRInstruction:anIRInstruction})});
  41625. },
  41626. args: ["anIRInstruction"],
  41627. source: "remove: anIRInstruction\x0a\x09self dagChildren remove: anIRInstruction",
  41628. referencedClasses: [],
  41629. pragmas: [],
  41630. messageSends: ["remove:", "dagChildren"]
  41631. }),
  41632. $globals.IRInstruction);
  41633. $core.addMethod(
  41634. $core.method({
  41635. selector: "replace:with:",
  41636. protocol: "building",
  41637. fn: function (anIRInstruction,anotherIRInstruction){
  41638. var self=this,$self=this;
  41639. return $core.withContext(function($ctx1) {
  41640. var $1;
  41641. $recv(anotherIRInstruction)._parent_(self);
  41642. $1=$self._dagChildren();
  41643. $ctx1.sendIdx["dagChildren"]=1;
  41644. $recv($1)._at_put_($recv($self._dagChildren())._indexOf_(anIRInstruction),anotherIRInstruction);
  41645. return self;
  41646. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction})});
  41647. },
  41648. args: ["anIRInstruction", "anotherIRInstruction"],
  41649. source: "replace: anIRInstruction with: anotherIRInstruction\x0a\x09anotherIRInstruction parent: self.\x0a\x09self dagChildren\x0a\x09\x09at: (self dagChildren indexOf: anIRInstruction)\x0a\x09\x09put: anotherIRInstruction",
  41650. referencedClasses: [],
  41651. pragmas: [],
  41652. messageSends: ["parent:", "at:put:", "dagChildren", "indexOf:"]
  41653. }),
  41654. $globals.IRInstruction);
  41655. $core.addMethod(
  41656. $core.method({
  41657. selector: "replaceWith:",
  41658. protocol: "building",
  41659. fn: function (anIRInstruction){
  41660. var self=this,$self=this;
  41661. return $core.withContext(function($ctx1) {
  41662. $recv($self._parent())._replace_with_(self,anIRInstruction);
  41663. return self;
  41664. }, function($ctx1) {$ctx1.fill(self,"replaceWith:",{anIRInstruction:anIRInstruction})});
  41665. },
  41666. args: ["anIRInstruction"],
  41667. source: "replaceWith: anIRInstruction\x0a\x09self parent replace: self with: anIRInstruction",
  41668. referencedClasses: [],
  41669. pragmas: [],
  41670. messageSends: ["replace:with:", "parent"]
  41671. }),
  41672. $globals.IRInstruction);
  41673. $core.addMethod(
  41674. $core.method({
  41675. selector: "scope",
  41676. protocol: "accessing",
  41677. fn: function (){
  41678. var self=this,$self=this;
  41679. return $core.withContext(function($ctx1) {
  41680. var $1,$receiver;
  41681. $1=$self._parent();
  41682. if(($receiver = $1) == null || $receiver.a$nil){
  41683. return $1;
  41684. } else {
  41685. var node;
  41686. node=$receiver;
  41687. return $recv(node)._scope();
  41688. }
  41689. }, function($ctx1) {$ctx1.fill(self,"scope",{})});
  41690. },
  41691. args: [],
  41692. source: "scope\x0a\x09^ self parent ifNotNil: [ :node | \x0a\x09\x09node scope ]",
  41693. referencedClasses: [],
  41694. pragmas: [],
  41695. messageSends: ["ifNotNil:", "parent", "scope"]
  41696. }),
  41697. $globals.IRInstruction);
  41698. $core.addMethod(
  41699. $core.method({
  41700. selector: "yieldsValue",
  41701. protocol: "testing",
  41702. fn: function (){
  41703. var self=this,$self=this;
  41704. return true;
  41705. },
  41706. args: [],
  41707. source: "yieldsValue\x0a\x09^ true",
  41708. referencedClasses: [],
  41709. pragmas: [],
  41710. messageSends: []
  41711. }),
  41712. $globals.IRInstruction);
  41713. $core.addMethod(
  41714. $core.method({
  41715. selector: "on:",
  41716. protocol: "instance creation",
  41717. fn: function (aBuilder){
  41718. var self=this,$self=this;
  41719. return $core.withContext(function($ctx1) {
  41720. var $1;
  41721. $1=$self._new();
  41722. $recv($1)._builder_(aBuilder);
  41723. return $recv($1)._yourself();
  41724. }, function($ctx1) {$ctx1.fill(self,"on:",{aBuilder:aBuilder})});
  41725. },
  41726. args: ["aBuilder"],
  41727. source: "on: aBuilder\x0a\x09^ self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself",
  41728. referencedClasses: [],
  41729. pragmas: [],
  41730. messageSends: ["builder:", "new", "yourself"]
  41731. }),
  41732. $globals.IRInstruction.a$cls);
  41733. $core.addClass("IRAssignment", $globals.IRInstruction, [], "Compiler-IR");
  41734. $core.addMethod(
  41735. $core.method({
  41736. selector: "acceptDagVisitor:",
  41737. protocol: "visiting",
  41738. fn: function (aVisitor){
  41739. var self=this,$self=this;
  41740. return $core.withContext(function($ctx1) {
  41741. return $recv(aVisitor)._visitIRAssignment_(self);
  41742. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  41743. },
  41744. args: ["aVisitor"],
  41745. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRAssignment: self",
  41746. referencedClasses: [],
  41747. pragmas: [],
  41748. messageSends: ["visitIRAssignment:"]
  41749. }),
  41750. $globals.IRAssignment);
  41751. $core.addMethod(
  41752. $core.method({
  41753. selector: "left",
  41754. protocol: "accessing",
  41755. fn: function (){
  41756. var self=this,$self=this;
  41757. return $core.withContext(function($ctx1) {
  41758. return $recv($self._dagChildren())._first();
  41759. }, function($ctx1) {$ctx1.fill(self,"left",{})});
  41760. },
  41761. args: [],
  41762. source: "left\x0a\x09^ self dagChildren first",
  41763. referencedClasses: [],
  41764. pragmas: [],
  41765. messageSends: ["first", "dagChildren"]
  41766. }),
  41767. $globals.IRAssignment);
  41768. $core.addMethod(
  41769. $core.method({
  41770. selector: "right",
  41771. protocol: "accessing",
  41772. fn: function (){
  41773. var self=this,$self=this;
  41774. return $core.withContext(function($ctx1) {
  41775. return $recv($self._dagChildren())._last();
  41776. }, function($ctx1) {$ctx1.fill(self,"right",{})});
  41777. },
  41778. args: [],
  41779. source: "right\x0a\x09^ self dagChildren last",
  41780. referencedClasses: [],
  41781. pragmas: [],
  41782. messageSends: ["last", "dagChildren"]
  41783. }),
  41784. $globals.IRAssignment);
  41785. $core.addClass("IRDynamicArray", $globals.IRInstruction, [], "Compiler-IR");
  41786. $core.addMethod(
  41787. $core.method({
  41788. selector: "acceptDagVisitor:",
  41789. protocol: "visiting",
  41790. fn: function (aVisitor){
  41791. var self=this,$self=this;
  41792. return $core.withContext(function($ctx1) {
  41793. return $recv(aVisitor)._visitIRDynamicArray_(self);
  41794. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  41795. },
  41796. args: ["aVisitor"],
  41797. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRDynamicArray: self",
  41798. referencedClasses: [],
  41799. pragmas: [],
  41800. messageSends: ["visitIRDynamicArray:"]
  41801. }),
  41802. $globals.IRDynamicArray);
  41803. $core.addClass("IRDynamicDictionary", $globals.IRInstruction, [], "Compiler-IR");
  41804. $core.addMethod(
  41805. $core.method({
  41806. selector: "acceptDagVisitor:",
  41807. protocol: "visiting",
  41808. fn: function (aVisitor){
  41809. var self=this,$self=this;
  41810. return $core.withContext(function($ctx1) {
  41811. return $recv(aVisitor)._visitIRDynamicDictionary_(self);
  41812. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  41813. },
  41814. args: ["aVisitor"],
  41815. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRDynamicDictionary: self",
  41816. referencedClasses: [],
  41817. pragmas: [],
  41818. messageSends: ["visitIRDynamicDictionary:"]
  41819. }),
  41820. $globals.IRDynamicDictionary);
  41821. $core.addClass("IRScopedInstruction", $globals.IRInstruction, ["scope"], "Compiler-IR");
  41822. $core.addMethod(
  41823. $core.method({
  41824. selector: "scope",
  41825. protocol: "accessing",
  41826. fn: function (){
  41827. var self=this,$self=this;
  41828. return $self.scope;
  41829. },
  41830. args: [],
  41831. source: "scope\x0a\x09^ scope",
  41832. referencedClasses: [],
  41833. pragmas: [],
  41834. messageSends: []
  41835. }),
  41836. $globals.IRScopedInstruction);
  41837. $core.addMethod(
  41838. $core.method({
  41839. selector: "scope:",
  41840. protocol: "accessing",
  41841. fn: function (aScope){
  41842. var self=this,$self=this;
  41843. $self.scope=aScope;
  41844. return self;
  41845. },
  41846. args: ["aScope"],
  41847. source: "scope: aScope\x0a\x09scope := aScope",
  41848. referencedClasses: [],
  41849. pragmas: [],
  41850. messageSends: []
  41851. }),
  41852. $globals.IRScopedInstruction);
  41853. $core.addClass("IRClosureInstruction", $globals.IRScopedInstruction, ["arguments", "requiresSmalltalkContext"], "Compiler-IR");
  41854. $core.addMethod(
  41855. $core.method({
  41856. selector: "arguments",
  41857. protocol: "accessing",
  41858. fn: function (){
  41859. var self=this,$self=this;
  41860. return $core.withContext(function($ctx1) {
  41861. var $1,$receiver;
  41862. $1=$self.arguments;
  41863. if(($receiver = $1) == null || $receiver.a$nil){
  41864. return [];
  41865. } else {
  41866. return $1;
  41867. }
  41868. }, function($ctx1) {$ctx1.fill(self,"arguments",{})});
  41869. },
  41870. args: [],
  41871. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  41872. referencedClasses: [],
  41873. pragmas: [],
  41874. messageSends: ["ifNil:"]
  41875. }),
  41876. $globals.IRClosureInstruction);
  41877. $core.addMethod(
  41878. $core.method({
  41879. selector: "arguments:",
  41880. protocol: "accessing",
  41881. fn: function (aCollection){
  41882. var self=this,$self=this;
  41883. $self.arguments=aCollection;
  41884. return self;
  41885. },
  41886. args: ["aCollection"],
  41887. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  41888. referencedClasses: [],
  41889. pragmas: [],
  41890. messageSends: []
  41891. }),
  41892. $globals.IRClosureInstruction);
  41893. $core.addMethod(
  41894. $core.method({
  41895. selector: "locals",
  41896. protocol: "accessing",
  41897. fn: function (){
  41898. var self=this,$self=this;
  41899. return $core.withContext(function($ctx1) {
  41900. var $1;
  41901. $1=$recv($self._arguments())._copy();
  41902. $recv($1)._addAll_($recv($self._tempDeclarations())._collect_((function(each){
  41903. return $core.withContext(function($ctx2) {
  41904. return $recv(each)._name();
  41905. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41906. })));
  41907. return $recv($1)._yourself();
  41908. }, function($ctx1) {$ctx1.fill(self,"locals",{})});
  41909. },
  41910. args: [],
  41911. source: "locals\x0a\x09^ self arguments copy\x0a\x09\x09addAll: (self tempDeclarations collect: [ :each | each name ]);\x0a\x09\x09yourself",
  41912. referencedClasses: [],
  41913. pragmas: [],
  41914. messageSends: ["addAll:", "copy", "arguments", "collect:", "tempDeclarations", "name", "yourself"]
  41915. }),
  41916. $globals.IRClosureInstruction);
  41917. $core.addMethod(
  41918. $core.method({
  41919. selector: "requiresSmalltalkContext",
  41920. protocol: "accessing",
  41921. fn: function (){
  41922. var self=this,$self=this;
  41923. return $core.withContext(function($ctx1) {
  41924. var $1,$receiver;
  41925. $1=$self.requiresSmalltalkContext;
  41926. if(($receiver = $1) == null || $receiver.a$nil){
  41927. return false;
  41928. } else {
  41929. return $1;
  41930. }
  41931. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{})});
  41932. },
  41933. args: [],
  41934. source: "requiresSmalltalkContext\x0a\x09^ requiresSmalltalkContext ifNil: [ false ]",
  41935. referencedClasses: [],
  41936. pragmas: [],
  41937. messageSends: ["ifNil:"]
  41938. }),
  41939. $globals.IRClosureInstruction);
  41940. $core.addMethod(
  41941. $core.method({
  41942. selector: "requiresSmalltalkContext:",
  41943. protocol: "accessing",
  41944. fn: function (anObject){
  41945. var self=this,$self=this;
  41946. $self.requiresSmalltalkContext=anObject;
  41947. return self;
  41948. },
  41949. args: ["anObject"],
  41950. source: "requiresSmalltalkContext: anObject\x0a\x09requiresSmalltalkContext := anObject",
  41951. referencedClasses: [],
  41952. pragmas: [],
  41953. messageSends: []
  41954. }),
  41955. $globals.IRClosureInstruction);
  41956. $core.addMethod(
  41957. $core.method({
  41958. selector: "scope:",
  41959. protocol: "accessing",
  41960. fn: function (aScope){
  41961. var self=this,$self=this;
  41962. return $core.withContext(function($ctx1) {
  41963. (
  41964. $ctx1.supercall = true,
  41965. ($globals.IRClosureInstruction.superclass||$boot.nilAsClass).fn.prototype._scope_.apply($self, [aScope]));
  41966. $ctx1.supercall = false;
  41967. $recv(aScope)._instruction_(self);
  41968. return self;
  41969. }, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope})});
  41970. },
  41971. args: ["aScope"],
  41972. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  41973. referencedClasses: [],
  41974. pragmas: [],
  41975. messageSends: ["scope:", "instruction:"]
  41976. }),
  41977. $globals.IRClosureInstruction);
  41978. $core.addMethod(
  41979. $core.method({
  41980. selector: "tempDeclarations",
  41981. protocol: "accessing",
  41982. fn: function (){
  41983. var self=this,$self=this;
  41984. return $core.withContext(function($ctx1) {
  41985. return $recv($self._dagChildren())._select_((function(each){
  41986. return $core.withContext(function($ctx2) {
  41987. return $recv(each)._isTempDeclaration();
  41988. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41989. }));
  41990. }, function($ctx1) {$ctx1.fill(self,"tempDeclarations",{})});
  41991. },
  41992. args: [],
  41993. source: "tempDeclarations\x0a\x09^ self dagChildren select: [ :each |\x0a\x09\x09each isTempDeclaration ]",
  41994. referencedClasses: [],
  41995. pragmas: [],
  41996. messageSends: ["select:", "dagChildren", "isTempDeclaration"]
  41997. }),
  41998. $globals.IRClosureInstruction);
  41999. $core.addClass("IRClosure", $globals.IRClosureInstruction, [], "Compiler-IR");
  42000. $core.addMethod(
  42001. $core.method({
  42002. selector: "acceptDagVisitor:",
  42003. protocol: "visiting",
  42004. fn: function (aVisitor){
  42005. var self=this,$self=this;
  42006. return $core.withContext(function($ctx1) {
  42007. return $recv(aVisitor)._visitIRClosure_(self);
  42008. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  42009. },
  42010. args: ["aVisitor"],
  42011. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRClosure: self",
  42012. referencedClasses: [],
  42013. pragmas: [],
  42014. messageSends: ["visitIRClosure:"]
  42015. }),
  42016. $globals.IRClosure);
  42017. $core.addMethod(
  42018. $core.method({
  42019. selector: "isClosure",
  42020. protocol: "testing",
  42021. fn: function (){
  42022. var self=this,$self=this;
  42023. return true;
  42024. },
  42025. args: [],
  42026. source: "isClosure\x0a\x09^ true",
  42027. referencedClasses: [],
  42028. pragmas: [],
  42029. messageSends: []
  42030. }),
  42031. $globals.IRClosure);
  42032. $core.addMethod(
  42033. $core.method({
  42034. selector: "sequence",
  42035. protocol: "accessing",
  42036. fn: function (){
  42037. var self=this,$self=this;
  42038. return $core.withContext(function($ctx1) {
  42039. return $recv($self._dagChildren())._last();
  42040. }, function($ctx1) {$ctx1.fill(self,"sequence",{})});
  42041. },
  42042. args: [],
  42043. source: "sequence\x0a\x09^ self dagChildren last",
  42044. referencedClasses: [],
  42045. pragmas: [],
  42046. messageSends: ["last", "dagChildren"]
  42047. }),
  42048. $globals.IRClosure);
  42049. $core.addClass("IRMethod", $globals.IRClosureInstruction, ["theClass", "source", "selector", "pragmas", "classReferences", "sendIndexes", "requiresSmalltalkContext", "internalVariables"], "Compiler-IR");
  42050. $globals.IRMethod.comment="I am a method instruction";
  42051. $core.addMethod(
  42052. $core.method({
  42053. selector: "acceptDagVisitor:",
  42054. protocol: "visiting",
  42055. fn: function (aVisitor){
  42056. var self=this,$self=this;
  42057. return $core.withContext(function($ctx1) {
  42058. return $recv(aVisitor)._visitIRMethod_(self);
  42059. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  42060. },
  42061. args: ["aVisitor"],
  42062. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRMethod: self",
  42063. referencedClasses: [],
  42064. pragmas: [],
  42065. messageSends: ["visitIRMethod:"]
  42066. }),
  42067. $globals.IRMethod);
  42068. $core.addMethod(
  42069. $core.method({
  42070. selector: "classReferences",
  42071. protocol: "accessing",
  42072. fn: function (){
  42073. var self=this,$self=this;
  42074. return $self.classReferences;
  42075. },
  42076. args: [],
  42077. source: "classReferences\x0a\x09^ classReferences",
  42078. referencedClasses: [],
  42079. pragmas: [],
  42080. messageSends: []
  42081. }),
  42082. $globals.IRMethod);
  42083. $core.addMethod(
  42084. $core.method({
  42085. selector: "classReferences:",
  42086. protocol: "accessing",
  42087. fn: function (aCollection){
  42088. var self=this,$self=this;
  42089. $self.classReferences=aCollection;
  42090. return self;
  42091. },
  42092. args: ["aCollection"],
  42093. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  42094. referencedClasses: [],
  42095. pragmas: [],
  42096. messageSends: []
  42097. }),
  42098. $globals.IRMethod);
  42099. $core.addMethod(
  42100. $core.method({
  42101. selector: "internalVariables",
  42102. protocol: "accessing",
  42103. fn: function (){
  42104. var self=this,$self=this;
  42105. return $core.withContext(function($ctx1) {
  42106. var $1,$receiver;
  42107. $1=$self.internalVariables;
  42108. if(($receiver = $1) == null || $receiver.a$nil){
  42109. $self.internalVariables=$recv($globals.Set)._new();
  42110. return $self.internalVariables;
  42111. } else {
  42112. return $1;
  42113. }
  42114. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{})});
  42115. },
  42116. args: [],
  42117. source: "internalVariables\x0a\x09^ internalVariables ifNil: [ internalVariables := Set new ]",
  42118. referencedClasses: ["Set"],
  42119. pragmas: [],
  42120. messageSends: ["ifNil:", "new"]
  42121. }),
  42122. $globals.IRMethod);
  42123. $core.addMethod(
  42124. $core.method({
  42125. selector: "isMethod",
  42126. protocol: "testing",
  42127. fn: function (){
  42128. var self=this,$self=this;
  42129. return true;
  42130. },
  42131. args: [],
  42132. source: "isMethod\x0a\x09^ true",
  42133. referencedClasses: [],
  42134. pragmas: [],
  42135. messageSends: []
  42136. }),
  42137. $globals.IRMethod);
  42138. $core.addMethod(
  42139. $core.method({
  42140. selector: "messageSends",
  42141. protocol: "accessing",
  42142. fn: function (){
  42143. var self=this,$self=this;
  42144. return $core.withContext(function($ctx1) {
  42145. return $recv($self._sendIndexes())._keys();
  42146. }, function($ctx1) {$ctx1.fill(self,"messageSends",{})});
  42147. },
  42148. args: [],
  42149. source: "messageSends\x0a\x09^ self sendIndexes keys",
  42150. referencedClasses: [],
  42151. pragmas: [],
  42152. messageSends: ["keys", "sendIndexes"]
  42153. }),
  42154. $globals.IRMethod);
  42155. $core.addMethod(
  42156. $core.method({
  42157. selector: "method",
  42158. protocol: "accessing",
  42159. fn: function (){
  42160. var self=this,$self=this;
  42161. return self;
  42162. },
  42163. args: [],
  42164. source: "method\x0a\x09^ self",
  42165. referencedClasses: [],
  42166. pragmas: [],
  42167. messageSends: []
  42168. }),
  42169. $globals.IRMethod);
  42170. $core.addMethod(
  42171. $core.method({
  42172. selector: "pragmas",
  42173. protocol: "accessing",
  42174. fn: function (){
  42175. var self=this,$self=this;
  42176. return $self.pragmas;
  42177. },
  42178. args: [],
  42179. source: "pragmas\x0a\x09^ pragmas",
  42180. referencedClasses: [],
  42181. pragmas: [],
  42182. messageSends: []
  42183. }),
  42184. $globals.IRMethod);
  42185. $core.addMethod(
  42186. $core.method({
  42187. selector: "pragmas:",
  42188. protocol: "accessing",
  42189. fn: function (aCollection){
  42190. var self=this,$self=this;
  42191. $self.pragmas=aCollection;
  42192. return self;
  42193. },
  42194. args: ["aCollection"],
  42195. source: "pragmas: aCollection\x0a\x09pragmas := aCollection",
  42196. referencedClasses: [],
  42197. pragmas: [],
  42198. messageSends: []
  42199. }),
  42200. $globals.IRMethod);
  42201. $core.addMethod(
  42202. $core.method({
  42203. selector: "selector",
  42204. protocol: "accessing",
  42205. fn: function (){
  42206. var self=this,$self=this;
  42207. return $self.selector;
  42208. },
  42209. args: [],
  42210. source: "selector\x0a\x09^ selector",
  42211. referencedClasses: [],
  42212. pragmas: [],
  42213. messageSends: []
  42214. }),
  42215. $globals.IRMethod);
  42216. $core.addMethod(
  42217. $core.method({
  42218. selector: "selector:",
  42219. protocol: "accessing",
  42220. fn: function (aString){
  42221. var self=this,$self=this;
  42222. $self.selector=aString;
  42223. return self;
  42224. },
  42225. args: ["aString"],
  42226. source: "selector: aString\x0a\x09selector := aString",
  42227. referencedClasses: [],
  42228. pragmas: [],
  42229. messageSends: []
  42230. }),
  42231. $globals.IRMethod);
  42232. $core.addMethod(
  42233. $core.method({
  42234. selector: "sendIndexes",
  42235. protocol: "accessing",
  42236. fn: function (){
  42237. var self=this,$self=this;
  42238. return $self.sendIndexes;
  42239. },
  42240. args: [],
  42241. source: "sendIndexes\x0a\x09^ sendIndexes",
  42242. referencedClasses: [],
  42243. pragmas: [],
  42244. messageSends: []
  42245. }),
  42246. $globals.IRMethod);
  42247. $core.addMethod(
  42248. $core.method({
  42249. selector: "sendIndexes:",
  42250. protocol: "accessing",
  42251. fn: function (aDictionary){
  42252. var self=this,$self=this;
  42253. $self.sendIndexes=aDictionary;
  42254. return self;
  42255. },
  42256. args: ["aDictionary"],
  42257. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  42258. referencedClasses: [],
  42259. pragmas: [],
  42260. messageSends: []
  42261. }),
  42262. $globals.IRMethod);
  42263. $core.addMethod(
  42264. $core.method({
  42265. selector: "source",
  42266. protocol: "accessing",
  42267. fn: function (){
  42268. var self=this,$self=this;
  42269. return $self.source;
  42270. },
  42271. args: [],
  42272. source: "source\x0a\x09^ source",
  42273. referencedClasses: [],
  42274. pragmas: [],
  42275. messageSends: []
  42276. }),
  42277. $globals.IRMethod);
  42278. $core.addMethod(
  42279. $core.method({
  42280. selector: "source:",
  42281. protocol: "accessing",
  42282. fn: function (aString){
  42283. var self=this,$self=this;
  42284. $self.source=aString;
  42285. return self;
  42286. },
  42287. args: ["aString"],
  42288. source: "source: aString\x0a\x09source := aString",
  42289. referencedClasses: [],
  42290. pragmas: [],
  42291. messageSends: []
  42292. }),
  42293. $globals.IRMethod);
  42294. $core.addMethod(
  42295. $core.method({
  42296. selector: "theClass",
  42297. protocol: "accessing",
  42298. fn: function (){
  42299. var self=this,$self=this;
  42300. return $self.theClass;
  42301. },
  42302. args: [],
  42303. source: "theClass\x0a\x09^ theClass",
  42304. referencedClasses: [],
  42305. pragmas: [],
  42306. messageSends: []
  42307. }),
  42308. $globals.IRMethod);
  42309. $core.addMethod(
  42310. $core.method({
  42311. selector: "theClass:",
  42312. protocol: "accessing",
  42313. fn: function (aClass){
  42314. var self=this,$self=this;
  42315. $self.theClass=aClass;
  42316. return self;
  42317. },
  42318. args: ["aClass"],
  42319. source: "theClass: aClass\x0a\x09theClass := aClass",
  42320. referencedClasses: [],
  42321. pragmas: [],
  42322. messageSends: []
  42323. }),
  42324. $globals.IRMethod);
  42325. $core.addClass("IRReturn", $globals.IRScopedInstruction, [], "Compiler-IR");
  42326. $globals.IRReturn.comment="I am a local return instruction.";
  42327. $core.addMethod(
  42328. $core.method({
  42329. selector: "acceptDagVisitor:",
  42330. protocol: "visiting",
  42331. fn: function (aVisitor){
  42332. var self=this,$self=this;
  42333. return $core.withContext(function($ctx1) {
  42334. return $recv(aVisitor)._visitIRReturn_(self);
  42335. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  42336. },
  42337. args: ["aVisitor"],
  42338. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRReturn: self",
  42339. referencedClasses: [],
  42340. pragmas: [],
  42341. messageSends: ["visitIRReturn:"]
  42342. }),
  42343. $globals.IRReturn);
  42344. $core.addMethod(
  42345. $core.method({
  42346. selector: "expression",
  42347. protocol: "accessing",
  42348. fn: function (){
  42349. var self=this,$self=this;
  42350. return $core.withContext(function($ctx1) {
  42351. return $recv($self._dagChildren())._single();
  42352. }, function($ctx1) {$ctx1.fill(self,"expression",{})});
  42353. },
  42354. args: [],
  42355. source: "expression\x0a\x09^ self dagChildren single",
  42356. referencedClasses: [],
  42357. pragmas: [],
  42358. messageSends: ["single", "dagChildren"]
  42359. }),
  42360. $globals.IRReturn);
  42361. $core.addMethod(
  42362. $core.method({
  42363. selector: "scope",
  42364. protocol: "accessing",
  42365. fn: function (){
  42366. var self=this,$self=this;
  42367. return $core.withContext(function($ctx1) {
  42368. var $1,$receiver;
  42369. $1=$self.scope;
  42370. if(($receiver = $1) == null || $receiver.a$nil){
  42371. return $recv($self._parent())._scope();
  42372. } else {
  42373. return $1;
  42374. }
  42375. }, function($ctx1) {$ctx1.fill(self,"scope",{})});
  42376. },
  42377. args: [],
  42378. source: "scope\x0a\x09^ scope ifNil: [ self parent scope ]",
  42379. referencedClasses: [],
  42380. pragmas: [],
  42381. messageSends: ["ifNil:", "scope", "parent"]
  42382. }),
  42383. $globals.IRReturn);
  42384. $core.addMethod(
  42385. $core.method({
  42386. selector: "yieldsValue",
  42387. protocol: "testing",
  42388. fn: function (){
  42389. var self=this,$self=this;
  42390. return false;
  42391. },
  42392. args: [],
  42393. source: "yieldsValue\x0a\x09^ false",
  42394. referencedClasses: [],
  42395. pragmas: [],
  42396. messageSends: []
  42397. }),
  42398. $globals.IRReturn);
  42399. $core.addClass("IRBlockReturn", $globals.IRReturn, [], "Compiler-IR");
  42400. $globals.IRBlockReturn.comment="Smalltalk blocks return their last statement. I am a implicit block return instruction.";
  42401. $core.addMethod(
  42402. $core.method({
  42403. selector: "acceptDagVisitor:",
  42404. protocol: "visiting",
  42405. fn: function (aVisitor){
  42406. var self=this,$self=this;
  42407. return $core.withContext(function($ctx1) {
  42408. return $recv(aVisitor)._visitIRBlockReturn_(self);
  42409. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  42410. },
  42411. args: ["aVisitor"],
  42412. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRBlockReturn: self",
  42413. referencedClasses: [],
  42414. pragmas: [],
  42415. messageSends: ["visitIRBlockReturn:"]
  42416. }),
  42417. $globals.IRBlockReturn);
  42418. $core.addClass("IRNonLocalReturn", $globals.IRReturn, [], "Compiler-IR");
  42419. $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.";
  42420. $core.addMethod(
  42421. $core.method({
  42422. selector: "acceptDagVisitor:",
  42423. protocol: "visiting",
  42424. fn: function (aVisitor){
  42425. var self=this,$self=this;
  42426. return $core.withContext(function($ctx1) {
  42427. return $recv(aVisitor)._visitIRNonLocalReturn_(self);
  42428. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  42429. },
  42430. args: ["aVisitor"],
  42431. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturn: self",
  42432. referencedClasses: [],
  42433. pragmas: [],
  42434. messageSends: ["visitIRNonLocalReturn:"]
  42435. }),
  42436. $globals.IRNonLocalReturn);
  42437. $core.addClass("IRTempDeclaration", $globals.IRScopedInstruction, ["name"], "Compiler-IR");
  42438. $core.addMethod(
  42439. $core.method({
  42440. selector: "acceptDagVisitor:",
  42441. protocol: "visiting",
  42442. fn: function (aVisitor){
  42443. var self=this,$self=this;
  42444. return $core.withContext(function($ctx1) {
  42445. return $recv(aVisitor)._visitIRTempDeclaration_(self);
  42446. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  42447. },
  42448. args: ["aVisitor"],
  42449. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self",
  42450. referencedClasses: [],
  42451. pragmas: [],
  42452. messageSends: ["visitIRTempDeclaration:"]
  42453. }),
  42454. $globals.IRTempDeclaration);
  42455. $core.addMethod(
  42456. $core.method({
  42457. selector: "isTempDeclaration",
  42458. protocol: "testing",
  42459. fn: function (){
  42460. var self=this,$self=this;
  42461. return true;
  42462. },
  42463. args: [],
  42464. source: "isTempDeclaration\x0a\x09^ true",
  42465. referencedClasses: [],
  42466. pragmas: [],
  42467. messageSends: []
  42468. }),
  42469. $globals.IRTempDeclaration);
  42470. $core.addMethod(
  42471. $core.method({
  42472. selector: "name",
  42473. protocol: "accessing",
  42474. fn: function (){
  42475. var self=this,$self=this;
  42476. return $self.name;
  42477. },
  42478. args: [],
  42479. source: "name\x0a\x09^ name",
  42480. referencedClasses: [],
  42481. pragmas: [],
  42482. messageSends: []
  42483. }),
  42484. $globals.IRTempDeclaration);
  42485. $core.addMethod(
  42486. $core.method({
  42487. selector: "name:",
  42488. protocol: "accessing",
  42489. fn: function (aString){
  42490. var self=this,$self=this;
  42491. $self.name=aString;
  42492. return self;
  42493. },
  42494. args: ["aString"],
  42495. source: "name: aString\x0a\x09name := aString",
  42496. referencedClasses: [],
  42497. pragmas: [],
  42498. messageSends: []
  42499. }),
  42500. $globals.IRTempDeclaration);
  42501. $core.addClass("IRSend", $globals.IRInstruction, ["selector", "javaScriptSelector", "index"], "Compiler-IR");
  42502. $globals.IRSend.comment="I am a message send instruction.";
  42503. $core.addMethod(
  42504. $core.method({
  42505. selector: "acceptDagVisitor:",
  42506. protocol: "visiting",
  42507. fn: function (aVisitor){
  42508. var self=this,$self=this;
  42509. return $core.withContext(function($ctx1) {
  42510. return $recv(aVisitor)._visitIRSend_(self);
  42511. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  42512. },
  42513. args: ["aVisitor"],
  42514. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRSend: self",
  42515. referencedClasses: [],
  42516. pragmas: [],
  42517. messageSends: ["visitIRSend:"]
  42518. }),
  42519. $globals.IRSend);
  42520. $core.addMethod(
  42521. $core.method({
  42522. selector: "arguments",
  42523. protocol: "accessing",
  42524. fn: function (){
  42525. var self=this,$self=this;
  42526. return $core.withContext(function($ctx1) {
  42527. return $recv($self._dagChildren())._allButFirst();
  42528. }, function($ctx1) {$ctx1.fill(self,"arguments",{})});
  42529. },
  42530. args: [],
  42531. source: "arguments\x0a\x09^ self dagChildren allButFirst",
  42532. referencedClasses: [],
  42533. pragmas: [],
  42534. messageSends: ["allButFirst", "dagChildren"]
  42535. }),
  42536. $globals.IRSend);
  42537. $core.addMethod(
  42538. $core.method({
  42539. selector: "index",
  42540. protocol: "accessing",
  42541. fn: function (){
  42542. var self=this,$self=this;
  42543. return $self.index;
  42544. },
  42545. args: [],
  42546. source: "index\x0a\x09^ index",
  42547. referencedClasses: [],
  42548. pragmas: [],
  42549. messageSends: []
  42550. }),
  42551. $globals.IRSend);
  42552. $core.addMethod(
  42553. $core.method({
  42554. selector: "index:",
  42555. protocol: "accessing",
  42556. fn: function (anInteger){
  42557. var self=this,$self=this;
  42558. $self.index=anInteger;
  42559. return self;
  42560. },
  42561. args: ["anInteger"],
  42562. source: "index: anInteger\x0a\x09index := anInteger",
  42563. referencedClasses: [],
  42564. pragmas: [],
  42565. messageSends: []
  42566. }),
  42567. $globals.IRSend);
  42568. $core.addMethod(
  42569. $core.method({
  42570. selector: "isSend",
  42571. protocol: "testing",
  42572. fn: function (){
  42573. var self=this,$self=this;
  42574. return true;
  42575. },
  42576. args: [],
  42577. source: "isSend\x0a\x09^ true",
  42578. referencedClasses: [],
  42579. pragmas: [],
  42580. messageSends: []
  42581. }),
  42582. $globals.IRSend);
  42583. $core.addMethod(
  42584. $core.method({
  42585. selector: "javaScriptSelector",
  42586. protocol: "accessing",
  42587. fn: function (){
  42588. var self=this,$self=this;
  42589. return $core.withContext(function($ctx1) {
  42590. var $1,$receiver;
  42591. $1=$self.javaScriptSelector;
  42592. if(($receiver = $1) == null || $receiver.a$nil){
  42593. $self.javaScriptSelector=$recv($self._selector())._asJavaScriptMethodName();
  42594. return $self.javaScriptSelector;
  42595. } else {
  42596. return $1;
  42597. }
  42598. }, function($ctx1) {$ctx1.fill(self,"javaScriptSelector",{})});
  42599. },
  42600. args: [],
  42601. source: "javaScriptSelector\x0a\x09^ javaScriptSelector ifNil: [ javaScriptSelector := self selector asJavaScriptMethodName ]",
  42602. referencedClasses: [],
  42603. pragmas: [],
  42604. messageSends: ["ifNil:", "asJavaScriptMethodName", "selector"]
  42605. }),
  42606. $globals.IRSend);
  42607. $core.addMethod(
  42608. $core.method({
  42609. selector: "javaScriptSelector:",
  42610. protocol: "accessing",
  42611. fn: function (aString){
  42612. var self=this,$self=this;
  42613. $self.javaScriptSelector=aString;
  42614. return self;
  42615. },
  42616. args: ["aString"],
  42617. source: "javaScriptSelector: aString\x0a\x09javaScriptSelector := aString",
  42618. referencedClasses: [],
  42619. pragmas: [],
  42620. messageSends: []
  42621. }),
  42622. $globals.IRSend);
  42623. $core.addMethod(
  42624. $core.method({
  42625. selector: "receiver",
  42626. protocol: "accessing",
  42627. fn: function (){
  42628. var self=this,$self=this;
  42629. return $core.withContext(function($ctx1) {
  42630. return $recv($self._dagChildren())._first();
  42631. }, function($ctx1) {$ctx1.fill(self,"receiver",{})});
  42632. },
  42633. args: [],
  42634. source: "receiver\x0a\x09^ self dagChildren first",
  42635. referencedClasses: [],
  42636. pragmas: [],
  42637. messageSends: ["first", "dagChildren"]
  42638. }),
  42639. $globals.IRSend);
  42640. $core.addMethod(
  42641. $core.method({
  42642. selector: "selector",
  42643. protocol: "accessing",
  42644. fn: function (){
  42645. var self=this,$self=this;
  42646. return $self.selector;
  42647. },
  42648. args: [],
  42649. source: "selector\x0a\x09^ selector",
  42650. referencedClasses: [],
  42651. pragmas: [],
  42652. messageSends: []
  42653. }),
  42654. $globals.IRSend);
  42655. $core.addMethod(
  42656. $core.method({
  42657. selector: "selector:",
  42658. protocol: "accessing",
  42659. fn: function (aString){
  42660. var self=this,$self=this;
  42661. $self.selector=aString;
  42662. return self;
  42663. },
  42664. args: ["aString"],
  42665. source: "selector: aString\x0a\x09selector := aString",
  42666. referencedClasses: [],
  42667. pragmas: [],
  42668. messageSends: []
  42669. }),
  42670. $globals.IRSend);
  42671. $core.addClass("IRSequence", $globals.IRInstruction, [], "Compiler-IR");
  42672. $core.addMethod(
  42673. $core.method({
  42674. selector: "acceptDagVisitor:",
  42675. protocol: "visiting",
  42676. fn: function (aVisitor){
  42677. var self=this,$self=this;
  42678. return $core.withContext(function($ctx1) {
  42679. return $recv(aVisitor)._visitIRSequence_(self);
  42680. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  42681. },
  42682. args: ["aVisitor"],
  42683. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRSequence: self",
  42684. referencedClasses: [],
  42685. pragmas: [],
  42686. messageSends: ["visitIRSequence:"]
  42687. }),
  42688. $globals.IRSequence);
  42689. $core.addMethod(
  42690. $core.method({
  42691. selector: "isSequence",
  42692. protocol: "testing",
  42693. fn: function (){
  42694. var self=this,$self=this;
  42695. return true;
  42696. },
  42697. args: [],
  42698. source: "isSequence\x0a\x09^ true",
  42699. referencedClasses: [],
  42700. pragmas: [],
  42701. messageSends: []
  42702. }),
  42703. $globals.IRSequence);
  42704. $core.addClass("IRBlockSequence", $globals.IRSequence, [], "Compiler-IR");
  42705. $core.addMethod(
  42706. $core.method({
  42707. selector: "acceptDagVisitor:",
  42708. protocol: "visiting",
  42709. fn: function (aVisitor){
  42710. var self=this,$self=this;
  42711. return $core.withContext(function($ctx1) {
  42712. return $recv(aVisitor)._visitIRBlockSequence_(self);
  42713. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  42714. },
  42715. args: ["aVisitor"],
  42716. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self",
  42717. referencedClasses: [],
  42718. pragmas: [],
  42719. messageSends: ["visitIRBlockSequence:"]
  42720. }),
  42721. $globals.IRBlockSequence);
  42722. $core.addClass("IRValue", $globals.IRInstruction, ["value"], "Compiler-IR");
  42723. $globals.IRValue.comment="I am the simplest possible instruction. I represent a value.";
  42724. $core.addMethod(
  42725. $core.method({
  42726. selector: "acceptDagVisitor:",
  42727. protocol: "visiting",
  42728. fn: function (aVisitor){
  42729. var self=this,$self=this;
  42730. return $core.withContext(function($ctx1) {
  42731. return $recv(aVisitor)._visitIRValue_(self);
  42732. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  42733. },
  42734. args: ["aVisitor"],
  42735. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRValue: self",
  42736. referencedClasses: [],
  42737. pragmas: [],
  42738. messageSends: ["visitIRValue:"]
  42739. }),
  42740. $globals.IRValue);
  42741. $core.addMethod(
  42742. $core.method({
  42743. selector: "needsBoxingAsReceiver",
  42744. protocol: "testing",
  42745. fn: function (){
  42746. var self=this,$self=this;
  42747. return false;
  42748. },
  42749. args: [],
  42750. source: "needsBoxingAsReceiver\x0a\x09^ false",
  42751. referencedClasses: [],
  42752. pragmas: [],
  42753. messageSends: []
  42754. }),
  42755. $globals.IRValue);
  42756. $core.addMethod(
  42757. $core.method({
  42758. selector: "value",
  42759. protocol: "accessing",
  42760. fn: function (){
  42761. var self=this,$self=this;
  42762. return $self.value;
  42763. },
  42764. args: [],
  42765. source: "value\x0a\x09^ value",
  42766. referencedClasses: [],
  42767. pragmas: [],
  42768. messageSends: []
  42769. }),
  42770. $globals.IRValue);
  42771. $core.addMethod(
  42772. $core.method({
  42773. selector: "value:",
  42774. protocol: "accessing",
  42775. fn: function (aString){
  42776. var self=this,$self=this;
  42777. $self.value=aString;
  42778. return self;
  42779. },
  42780. args: ["aString"],
  42781. source: "value: aString\x0a\x09value := aString",
  42782. referencedClasses: [],
  42783. pragmas: [],
  42784. messageSends: []
  42785. }),
  42786. $globals.IRValue);
  42787. $core.addClass("IRVariable", $globals.IRInstruction, ["variable"], "Compiler-IR");
  42788. $globals.IRVariable.comment="I am a variable instruction.";
  42789. $core.addMethod(
  42790. $core.method({
  42791. selector: "acceptDagVisitor:",
  42792. protocol: "visiting",
  42793. fn: function (aVisitor){
  42794. var self=this,$self=this;
  42795. return $core.withContext(function($ctx1) {
  42796. return $recv(aVisitor)._visitIRVariable_(self);
  42797. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  42798. },
  42799. args: ["aVisitor"],
  42800. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRVariable: self",
  42801. referencedClasses: [],
  42802. pragmas: [],
  42803. messageSends: ["visitIRVariable:"]
  42804. }),
  42805. $globals.IRVariable);
  42806. $core.addMethod(
  42807. $core.method({
  42808. selector: "isSelf",
  42809. protocol: "testing",
  42810. fn: function (){
  42811. var self=this,$self=this;
  42812. return $core.withContext(function($ctx1) {
  42813. return $recv($self._variable())._isSelf();
  42814. }, function($ctx1) {$ctx1.fill(self,"isSelf",{})});
  42815. },
  42816. args: [],
  42817. source: "isSelf\x0a\x09^ self variable isSelf",
  42818. referencedClasses: [],
  42819. pragmas: [],
  42820. messageSends: ["isSelf", "variable"]
  42821. }),
  42822. $globals.IRVariable);
  42823. $core.addMethod(
  42824. $core.method({
  42825. selector: "isSuper",
  42826. protocol: "testing",
  42827. fn: function (){
  42828. var self=this,$self=this;
  42829. return $core.withContext(function($ctx1) {
  42830. return $recv($self._variable())._isSuper();
  42831. }, function($ctx1) {$ctx1.fill(self,"isSuper",{})});
  42832. },
  42833. args: [],
  42834. source: "isSuper\x0a\x09^ self variable isSuper",
  42835. referencedClasses: [],
  42836. pragmas: [],
  42837. messageSends: ["isSuper", "variable"]
  42838. }),
  42839. $globals.IRVariable);
  42840. $core.addMethod(
  42841. $core.method({
  42842. selector: "isVariable",
  42843. protocol: "testing",
  42844. fn: function (){
  42845. var self=this,$self=this;
  42846. return true;
  42847. },
  42848. args: [],
  42849. source: "isVariable\x0a\x09^ true",
  42850. referencedClasses: [],
  42851. pragmas: [],
  42852. messageSends: []
  42853. }),
  42854. $globals.IRVariable);
  42855. $core.addMethod(
  42856. $core.method({
  42857. selector: "needsBoxingAsReceiver",
  42858. protocol: "testing",
  42859. fn: function (){
  42860. var self=this,$self=this;
  42861. return $core.withContext(function($ctx1) {
  42862. return $recv($recv($self._variable())._isPseudoVar())._not();
  42863. }, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{})});
  42864. },
  42865. args: [],
  42866. source: "needsBoxingAsReceiver\x0a\x09^ self variable isPseudoVar not",
  42867. referencedClasses: [],
  42868. pragmas: [],
  42869. messageSends: ["not", "isPseudoVar", "variable"]
  42870. }),
  42871. $globals.IRVariable);
  42872. $core.addMethod(
  42873. $core.method({
  42874. selector: "variable",
  42875. protocol: "accessing",
  42876. fn: function (){
  42877. var self=this,$self=this;
  42878. return $self.variable;
  42879. },
  42880. args: [],
  42881. source: "variable\x0a\x09^ variable",
  42882. referencedClasses: [],
  42883. pragmas: [],
  42884. messageSends: []
  42885. }),
  42886. $globals.IRVariable);
  42887. $core.addMethod(
  42888. $core.method({
  42889. selector: "variable:",
  42890. protocol: "accessing",
  42891. fn: function (aScopeVariable){
  42892. var self=this,$self=this;
  42893. $self.variable=aScopeVariable;
  42894. return self;
  42895. },
  42896. args: ["aScopeVariable"],
  42897. source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable",
  42898. referencedClasses: [],
  42899. pragmas: [],
  42900. messageSends: []
  42901. }),
  42902. $globals.IRVariable);
  42903. $core.addClass("IRVerbatim", $globals.IRInstruction, ["source"], "Compiler-IR");
  42904. $core.addMethod(
  42905. $core.method({
  42906. selector: "acceptDagVisitor:",
  42907. protocol: "visiting",
  42908. fn: function (aVisitor){
  42909. var self=this,$self=this;
  42910. return $core.withContext(function($ctx1) {
  42911. return $recv(aVisitor)._visitIRVerbatim_(self);
  42912. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  42913. },
  42914. args: ["aVisitor"],
  42915. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self",
  42916. referencedClasses: [],
  42917. pragmas: [],
  42918. messageSends: ["visitIRVerbatim:"]
  42919. }),
  42920. $globals.IRVerbatim);
  42921. $core.addMethod(
  42922. $core.method({
  42923. selector: "source",
  42924. protocol: "accessing",
  42925. fn: function (){
  42926. var self=this,$self=this;
  42927. return $self.source;
  42928. },
  42929. args: [],
  42930. source: "source\x0a\x09^ source",
  42931. referencedClasses: [],
  42932. pragmas: [],
  42933. messageSends: []
  42934. }),
  42935. $globals.IRVerbatim);
  42936. $core.addMethod(
  42937. $core.method({
  42938. selector: "source:",
  42939. protocol: "accessing",
  42940. fn: function (aString){
  42941. var self=this,$self=this;
  42942. $self.source=aString;
  42943. return self;
  42944. },
  42945. args: ["aString"],
  42946. source: "source: aString\x0a\x09source := aString",
  42947. referencedClasses: [],
  42948. pragmas: [],
  42949. messageSends: []
  42950. }),
  42951. $globals.IRVerbatim);
  42952. $core.addClass("IRVisitor", $globals.ParentFakingPathDagVisitor, [], "Compiler-IR");
  42953. $core.addMethod(
  42954. $core.method({
  42955. selector: "visitDagNode:",
  42956. protocol: "visiting",
  42957. fn: function (aNode){
  42958. var self=this,$self=this;
  42959. return $core.withContext(function($ctx1) {
  42960. return $self._visitDagNodeVariantSimple_(aNode);
  42961. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode})});
  42962. },
  42963. args: ["aNode"],
  42964. source: "visitDagNode: aNode\x0a\x09^ self visitDagNodeVariantSimple: aNode",
  42965. referencedClasses: [],
  42966. pragmas: [],
  42967. messageSends: ["visitDagNodeVariantSimple:"]
  42968. }),
  42969. $globals.IRVisitor);
  42970. $core.addMethod(
  42971. $core.method({
  42972. selector: "visitIRAssignment:",
  42973. protocol: "visiting",
  42974. fn: function (anIRAssignment){
  42975. var self=this,$self=this;
  42976. return $core.withContext(function($ctx1) {
  42977. return $self._visitDagNode_(anIRAssignment);
  42978. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment})});
  42979. },
  42980. args: ["anIRAssignment"],
  42981. source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitDagNode: anIRAssignment",
  42982. referencedClasses: [],
  42983. pragmas: [],
  42984. messageSends: ["visitDagNode:"]
  42985. }),
  42986. $globals.IRVisitor);
  42987. $core.addMethod(
  42988. $core.method({
  42989. selector: "visitIRBlockReturn:",
  42990. protocol: "visiting",
  42991. fn: function (anIRBlockReturn){
  42992. var self=this,$self=this;
  42993. return $core.withContext(function($ctx1) {
  42994. return $self._visitIRReturn_(anIRBlockReturn);
  42995. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockReturn:",{anIRBlockReturn:anIRBlockReturn})});
  42996. },
  42997. args: ["anIRBlockReturn"],
  42998. source: "visitIRBlockReturn: anIRBlockReturn\x0a\x09^ self visitIRReturn: anIRBlockReturn",
  42999. referencedClasses: [],
  43000. pragmas: [],
  43001. messageSends: ["visitIRReturn:"]
  43002. }),
  43003. $globals.IRVisitor);
  43004. $core.addMethod(
  43005. $core.method({
  43006. selector: "visitIRBlockSequence:",
  43007. protocol: "visiting",
  43008. fn: function (anIRBlockSequence){
  43009. var self=this,$self=this;
  43010. return $core.withContext(function($ctx1) {
  43011. return $self._visitIRSequence_(anIRBlockSequence);
  43012. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockSequence:",{anIRBlockSequence:anIRBlockSequence})});
  43013. },
  43014. args: ["anIRBlockSequence"],
  43015. source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence",
  43016. referencedClasses: [],
  43017. pragmas: [],
  43018. messageSends: ["visitIRSequence:"]
  43019. }),
  43020. $globals.IRVisitor);
  43021. $core.addMethod(
  43022. $core.method({
  43023. selector: "visitIRClosure:",
  43024. protocol: "visiting",
  43025. fn: function (anIRClosure){
  43026. var self=this,$self=this;
  43027. return $core.withContext(function($ctx1) {
  43028. return $self._visitDagNode_(anIRClosure);
  43029. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure})});
  43030. },
  43031. args: ["anIRClosure"],
  43032. source: "visitIRClosure: anIRClosure\x0a\x09^ self visitDagNode: anIRClosure",
  43033. referencedClasses: [],
  43034. pragmas: [],
  43035. messageSends: ["visitDagNode:"]
  43036. }),
  43037. $globals.IRVisitor);
  43038. $core.addMethod(
  43039. $core.method({
  43040. selector: "visitIRDynamicArray:",
  43041. protocol: "visiting",
  43042. fn: function (anIRDynamicArray){
  43043. var self=this,$self=this;
  43044. return $core.withContext(function($ctx1) {
  43045. return $self._visitDagNode_(anIRDynamicArray);
  43046. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray})});
  43047. },
  43048. args: ["anIRDynamicArray"],
  43049. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09^ self visitDagNode: anIRDynamicArray",
  43050. referencedClasses: [],
  43051. pragmas: [],
  43052. messageSends: ["visitDagNode:"]
  43053. }),
  43054. $globals.IRVisitor);
  43055. $core.addMethod(
  43056. $core.method({
  43057. selector: "visitIRDynamicDictionary:",
  43058. protocol: "visiting",
  43059. fn: function (anIRDynamicDictionary){
  43060. var self=this,$self=this;
  43061. return $core.withContext(function($ctx1) {
  43062. return $self._visitDagNode_(anIRDynamicDictionary);
  43063. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary})});
  43064. },
  43065. args: ["anIRDynamicDictionary"],
  43066. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09^ self visitDagNode: anIRDynamicDictionary",
  43067. referencedClasses: [],
  43068. pragmas: [],
  43069. messageSends: ["visitDagNode:"]
  43070. }),
  43071. $globals.IRVisitor);
  43072. $core.addMethod(
  43073. $core.method({
  43074. selector: "visitIRInlinedClosure:",
  43075. protocol: "visiting",
  43076. fn: function (anIRInlinedClosure){
  43077. var self=this,$self=this;
  43078. return $core.withContext(function($ctx1) {
  43079. return $self._visitIRClosure_(anIRInlinedClosure);
  43080. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure})});
  43081. },
  43082. args: ["anIRInlinedClosure"],
  43083. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09^ self visitIRClosure: anIRInlinedClosure",
  43084. referencedClasses: [],
  43085. pragmas: [],
  43086. messageSends: ["visitIRClosure:"]
  43087. }),
  43088. $globals.IRVisitor);
  43089. $core.addMethod(
  43090. $core.method({
  43091. selector: "visitIRInlinedSequence:",
  43092. protocol: "visiting",
  43093. fn: function (anIRInlinedSequence){
  43094. var self=this,$self=this;
  43095. return $core.withContext(function($ctx1) {
  43096. return $self._visitIRSequence_(anIRInlinedSequence);
  43097. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence})});
  43098. },
  43099. args: ["anIRInlinedSequence"],
  43100. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09^ self visitIRSequence: anIRInlinedSequence",
  43101. referencedClasses: [],
  43102. pragmas: [],
  43103. messageSends: ["visitIRSequence:"]
  43104. }),
  43105. $globals.IRVisitor);
  43106. $core.addMethod(
  43107. $core.method({
  43108. selector: "visitIRMethod:",
  43109. protocol: "visiting",
  43110. fn: function (anIRMethod){
  43111. var self=this,$self=this;
  43112. return $core.withContext(function($ctx1) {
  43113. return $self._visitDagNode_(anIRMethod);
  43114. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod})});
  43115. },
  43116. args: ["anIRMethod"],
  43117. source: "visitIRMethod: anIRMethod\x0a\x09^ self visitDagNode: anIRMethod",
  43118. referencedClasses: [],
  43119. pragmas: [],
  43120. messageSends: ["visitDagNode:"]
  43121. }),
  43122. $globals.IRVisitor);
  43123. $core.addMethod(
  43124. $core.method({
  43125. selector: "visitIRNonLocalReturn:",
  43126. protocol: "visiting",
  43127. fn: function (anIRNonLocalReturn){
  43128. var self=this,$self=this;
  43129. return $core.withContext(function($ctx1) {
  43130. return $self._visitDagNode_(anIRNonLocalReturn);
  43131. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn})});
  43132. },
  43133. args: ["anIRNonLocalReturn"],
  43134. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitDagNode: anIRNonLocalReturn",
  43135. referencedClasses: [],
  43136. pragmas: [],
  43137. messageSends: ["visitDagNode:"]
  43138. }),
  43139. $globals.IRVisitor);
  43140. $core.addMethod(
  43141. $core.method({
  43142. selector: "visitIRNonLocalReturnHandling:",
  43143. protocol: "visiting",
  43144. fn: function (anIRNonLocalReturnHandling){
  43145. var self=this,$self=this;
  43146. return $core.withContext(function($ctx1) {
  43147. return $self._visitDagNode_(anIRNonLocalReturnHandling);
  43148. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturnHandling:",{anIRNonLocalReturnHandling:anIRNonLocalReturnHandling})});
  43149. },
  43150. args: ["anIRNonLocalReturnHandling"],
  43151. source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitDagNode: anIRNonLocalReturnHandling",
  43152. referencedClasses: [],
  43153. pragmas: [],
  43154. messageSends: ["visitDagNode:"]
  43155. }),
  43156. $globals.IRVisitor);
  43157. $core.addMethod(
  43158. $core.method({
  43159. selector: "visitIRReturn:",
  43160. protocol: "visiting",
  43161. fn: function (anIRReturn){
  43162. var self=this,$self=this;
  43163. return $core.withContext(function($ctx1) {
  43164. return $self._visitDagNode_(anIRReturn);
  43165. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn})});
  43166. },
  43167. args: ["anIRReturn"],
  43168. source: "visitIRReturn: anIRReturn\x0a\x09^ self visitDagNode: anIRReturn",
  43169. referencedClasses: [],
  43170. pragmas: [],
  43171. messageSends: ["visitDagNode:"]
  43172. }),
  43173. $globals.IRVisitor);
  43174. $core.addMethod(
  43175. $core.method({
  43176. selector: "visitIRSend:",
  43177. protocol: "visiting",
  43178. fn: function (anIRSend){
  43179. var self=this,$self=this;
  43180. return $core.withContext(function($ctx1) {
  43181. return $self._visitDagNode_(anIRSend);
  43182. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend})});
  43183. },
  43184. args: ["anIRSend"],
  43185. source: "visitIRSend: anIRSend\x0a\x09^ self visitDagNode: anIRSend",
  43186. referencedClasses: [],
  43187. pragmas: [],
  43188. messageSends: ["visitDagNode:"]
  43189. }),
  43190. $globals.IRVisitor);
  43191. $core.addMethod(
  43192. $core.method({
  43193. selector: "visitIRSequence:",
  43194. protocol: "visiting",
  43195. fn: function (anIRSequence){
  43196. var self=this,$self=this;
  43197. return $core.withContext(function($ctx1) {
  43198. return $self._visitDagNode_(anIRSequence);
  43199. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence})});
  43200. },
  43201. args: ["anIRSequence"],
  43202. source: "visitIRSequence: anIRSequence\x0a\x09^ self visitDagNode: anIRSequence",
  43203. referencedClasses: [],
  43204. pragmas: [],
  43205. messageSends: ["visitDagNode:"]
  43206. }),
  43207. $globals.IRVisitor);
  43208. $core.addMethod(
  43209. $core.method({
  43210. selector: "visitIRTempDeclaration:",
  43211. protocol: "visiting",
  43212. fn: function (anIRTempDeclaration){
  43213. var self=this,$self=this;
  43214. return $core.withContext(function($ctx1) {
  43215. return $self._visitDagNode_(anIRTempDeclaration);
  43216. }, function($ctx1) {$ctx1.fill(self,"visitIRTempDeclaration:",{anIRTempDeclaration:anIRTempDeclaration})});
  43217. },
  43218. args: ["anIRTempDeclaration"],
  43219. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitDagNode: anIRTempDeclaration",
  43220. referencedClasses: [],
  43221. pragmas: [],
  43222. messageSends: ["visitDagNode:"]
  43223. }),
  43224. $globals.IRVisitor);
  43225. $core.addMethod(
  43226. $core.method({
  43227. selector: "visitIRValue:",
  43228. protocol: "visiting",
  43229. fn: function (anIRValue){
  43230. var self=this,$self=this;
  43231. return $core.withContext(function($ctx1) {
  43232. return $self._visitDagNode_(anIRValue);
  43233. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue})});
  43234. },
  43235. args: ["anIRValue"],
  43236. source: "visitIRValue: anIRValue\x0a\x09^ self visitDagNode: anIRValue",
  43237. referencedClasses: [],
  43238. pragmas: [],
  43239. messageSends: ["visitDagNode:"]
  43240. }),
  43241. $globals.IRVisitor);
  43242. $core.addMethod(
  43243. $core.method({
  43244. selector: "visitIRVariable:",
  43245. protocol: "visiting",
  43246. fn: function (anIRVariable){
  43247. var self=this,$self=this;
  43248. return $core.withContext(function($ctx1) {
  43249. return $self._visitDagNode_(anIRVariable);
  43250. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable})});
  43251. },
  43252. args: ["anIRVariable"],
  43253. source: "visitIRVariable: anIRVariable\x0a\x09^ self visitDagNode: anIRVariable",
  43254. referencedClasses: [],
  43255. pragmas: [],
  43256. messageSends: ["visitDagNode:"]
  43257. }),
  43258. $globals.IRVisitor);
  43259. $core.addMethod(
  43260. $core.method({
  43261. selector: "visitIRVerbatim:",
  43262. protocol: "visiting",
  43263. fn: function (anIRVerbatim){
  43264. var self=this,$self=this;
  43265. return $core.withContext(function($ctx1) {
  43266. return $self._visitDagNode_(anIRVerbatim);
  43267. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim})});
  43268. },
  43269. args: ["anIRVerbatim"],
  43270. source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitDagNode: anIRVerbatim",
  43271. referencedClasses: [],
  43272. pragmas: [],
  43273. messageSends: ["visitDagNode:"]
  43274. }),
  43275. $globals.IRVisitor);
  43276. $core.addClass("IRJSTranslator", $globals.IRVisitor, ["stream", "currentClass"], "Compiler-IR");
  43277. $core.addMethod(
  43278. $core.method({
  43279. selector: "buildMethodDeclaration:with:",
  43280. protocol: "building",
  43281. fn: function (aMethod,aBlock){
  43282. var self=this,$self=this;
  43283. return $core.withContext(function($ctx1) {
  43284. var $1,$2,$3,$4,$5,$6;
  43285. $1=$recv(aMethod)._selector();
  43286. $2=$recv(aMethod)._source();
  43287. $3=$recv(aMethod)._pragmas();
  43288. $4=$recv((function(){
  43289. return $core.withContext(function($ctx2) {
  43290. $recv(aBlock)._value();
  43291. $ctx2.sendIdx["value"]=2;
  43292. return $self._contents();
  43293. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43294. }))._value();
  43295. $ctx1.sendIdx["value"]=1;
  43296. $5=$recv($recv(aMethod)._messageSends())._asArray();
  43297. $ctx1.sendIdx["asArray"]=1;
  43298. $6=$recv($recv($recv(aMethod)._arguments())._collect_((function(each){
  43299. return $core.withContext(function($ctx2) {
  43300. return $recv(each)._value();
  43301. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  43302. })))._asArray();
  43303. $ctx1.sendIdx["asArray"]=2;
  43304. return $globals.HashedCollection._newFromPairs_(["selector",$1,"source",$2,"pragmas",$3,"fn",$4,"messageSends",$5,"args",$6,"referencedClasses",$recv($recv(aMethod)._classReferences())._asArray()]);
  43305. }, function($ctx1) {$ctx1.fill(self,"buildMethodDeclaration:with:",{aMethod:aMethod,aBlock:aBlock})});
  43306. },
  43307. args: ["aMethod", "aBlock"],
  43308. source: "buildMethodDeclaration: aMethod with: aBlock\x0a\x09^ #{\x0a\x09\x09#selector -> aMethod selector.\x0a\x09\x09#source -> aMethod source.\x0a\x09\x09#pragmas -> aMethod pragmas.\x0a\x09\x09#fn -> [ aBlock value. self contents ] value.\x0a\x09\x09#messageSends -> aMethod messageSends asArray.\x0a\x09\x09#args -> (aMethod arguments collect: [ :each | each value ]) asArray.\x0a\x09\x09#referencedClasses -> aMethod classReferences asArray.\x0a\x09}",
  43309. referencedClasses: [],
  43310. pragmas: [],
  43311. messageSends: ["selector", "source", "pragmas", "value", "contents", "asArray", "messageSends", "collect:", "arguments", "classReferences"]
  43312. }),
  43313. $globals.IRJSTranslator);
  43314. $core.addMethod(
  43315. $core.method({
  43316. selector: "contents",
  43317. protocol: "accessing",
  43318. fn: function (){
  43319. var self=this,$self=this;
  43320. return $core.withContext(function($ctx1) {
  43321. return $recv($self._stream())._contents();
  43322. }, function($ctx1) {$ctx1.fill(self,"contents",{})});
  43323. },
  43324. args: [],
  43325. source: "contents\x0a\x09^ self stream contents",
  43326. referencedClasses: [],
  43327. pragmas: [],
  43328. messageSends: ["contents", "stream"]
  43329. }),
  43330. $globals.IRJSTranslator);
  43331. $core.addMethod(
  43332. $core.method({
  43333. selector: "currentClass",
  43334. protocol: "accessing",
  43335. fn: function (){
  43336. var self=this,$self=this;
  43337. return $self.currentClass;
  43338. },
  43339. args: [],
  43340. source: "currentClass\x0a\x09^ currentClass",
  43341. referencedClasses: [],
  43342. pragmas: [],
  43343. messageSends: []
  43344. }),
  43345. $globals.IRJSTranslator);
  43346. $core.addMethod(
  43347. $core.method({
  43348. selector: "currentClass:",
  43349. protocol: "accessing",
  43350. fn: function (aClass){
  43351. var self=this,$self=this;
  43352. $self.currentClass=aClass;
  43353. return self;
  43354. },
  43355. args: ["aClass"],
  43356. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  43357. referencedClasses: [],
  43358. pragmas: [],
  43359. messageSends: []
  43360. }),
  43361. $globals.IRJSTranslator);
  43362. $core.addMethod(
  43363. $core.method({
  43364. selector: "initialize",
  43365. protocol: "initialization",
  43366. fn: function (){
  43367. var self=this,$self=this;
  43368. return $core.withContext(function($ctx1) {
  43369. (
  43370. $ctx1.supercall = true,
  43371. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  43372. $ctx1.supercall = false;
  43373. $self.stream=$recv($globals.JSStream)._new();
  43374. return self;
  43375. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  43376. },
  43377. args: [],
  43378. source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.",
  43379. referencedClasses: ["JSStream"],
  43380. pragmas: [],
  43381. messageSends: ["initialize", "new"]
  43382. }),
  43383. $globals.IRJSTranslator);
  43384. $core.addMethod(
  43385. $core.method({
  43386. selector: "stream",
  43387. protocol: "accessing",
  43388. fn: function (){
  43389. var self=this,$self=this;
  43390. return $self.stream;
  43391. },
  43392. args: [],
  43393. source: "stream\x0a\x09^ stream",
  43394. referencedClasses: [],
  43395. pragmas: [],
  43396. messageSends: []
  43397. }),
  43398. $globals.IRJSTranslator);
  43399. $core.addMethod(
  43400. $core.method({
  43401. selector: "stream:",
  43402. protocol: "accessing",
  43403. fn: function (aStream){
  43404. var self=this,$self=this;
  43405. $self.stream=aStream;
  43406. return self;
  43407. },
  43408. args: ["aStream"],
  43409. source: "stream: aStream\x0a\x09stream := aStream",
  43410. referencedClasses: [],
  43411. pragmas: [],
  43412. messageSends: []
  43413. }),
  43414. $globals.IRJSTranslator);
  43415. $core.addMethod(
  43416. $core.method({
  43417. selector: "visitIRAssignment:",
  43418. protocol: "visiting",
  43419. fn: function (anIRAssignment){
  43420. var self=this,$self=this;
  43421. return $core.withContext(function($ctx1) {
  43422. $recv($self._stream())._nextPutAssignLhs_rhs_((function(){
  43423. return $core.withContext(function($ctx2) {
  43424. return $self._visit_($recv(anIRAssignment)._left());
  43425. $ctx2.sendIdx["visit:"]=1;
  43426. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43427. }),(function(){
  43428. return $core.withContext(function($ctx2) {
  43429. return $self._visit_($recv(anIRAssignment)._right());
  43430. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43431. }));
  43432. return self;
  43433. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment})});
  43434. },
  43435. args: ["anIRAssignment"],
  43436. source: "visitIRAssignment: anIRAssignment\x0a\x09self stream\x0a\x09\x09nextPutAssignLhs: [self visit: anIRAssignment left]\x0a\x09\x09rhs: [self visit: anIRAssignment right].",
  43437. referencedClasses: [],
  43438. pragmas: [],
  43439. messageSends: ["nextPutAssignLhs:rhs:", "stream", "visit:", "left", "right"]
  43440. }),
  43441. $globals.IRJSTranslator);
  43442. $core.addMethod(
  43443. $core.method({
  43444. selector: "visitIRClosure:",
  43445. protocol: "visiting",
  43446. fn: function (anIRClosure){
  43447. var self=this,$self=this;
  43448. return $core.withContext(function($ctx1) {
  43449. var $1,$2;
  43450. $1=$self._stream();
  43451. $ctx1.sendIdx["stream"]=1;
  43452. $recv($1)._nextPutClosureWith_arguments_((function(){
  43453. return $core.withContext(function($ctx2) {
  43454. $2=$self._stream();
  43455. $ctx2.sendIdx["stream"]=2;
  43456. $recv($2)._nextPutVars_($recv($recv(anIRClosure)._tempDeclarations())._collect_((function(each){
  43457. return $core.withContext(function($ctx3) {
  43458. return $recv($recv(each)._name())._asVariableName();
  43459. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  43460. })));
  43461. return $recv($self._stream())._nextPutBlockContextFor_during_(anIRClosure,(function(){
  43462. return $core.withContext(function($ctx3) {
  43463. return (
  43464. $ctx3.supercall = true,
  43465. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRClosure_.apply($self, [anIRClosure]));
  43466. $ctx3.supercall = false;
  43467. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  43468. }));
  43469. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43470. }),$recv(anIRClosure)._arguments());
  43471. return self;
  43472. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure})});
  43473. },
  43474. args: ["anIRClosure"],
  43475. 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",
  43476. referencedClasses: [],
  43477. pragmas: [],
  43478. messageSends: ["nextPutClosureWith:arguments:", "stream", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutBlockContextFor:during:", "visitIRClosure:", "arguments"]
  43479. }),
  43480. $globals.IRJSTranslator);
  43481. $core.addMethod(
  43482. $core.method({
  43483. selector: "visitIRDynamicArray:",
  43484. protocol: "visiting",
  43485. fn: function (anIRDynamicArray){
  43486. var self=this,$self=this;
  43487. return $core.withContext(function($ctx1) {
  43488. $self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicArray)._dagChildren(),"[","]");
  43489. return self;
  43490. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray})});
  43491. },
  43492. args: ["anIRDynamicArray"],
  43493. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicArray dagChildren\x0a\x09\x09enclosedBetween: '[' and: ']'",
  43494. referencedClasses: [],
  43495. pragmas: [],
  43496. messageSends: ["visitInstructionList:enclosedBetween:and:", "dagChildren"]
  43497. }),
  43498. $globals.IRJSTranslator);
  43499. $core.addMethod(
  43500. $core.method({
  43501. selector: "visitIRDynamicDictionary:",
  43502. protocol: "visiting",
  43503. fn: function (anIRDynamicDictionary){
  43504. var self=this,$self=this;
  43505. return $core.withContext(function($ctx1) {
  43506. $self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicDictionary)._dagChildren(),"$globals.HashedCollection._newFromPairs_([","])");
  43507. return self;
  43508. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary})});
  43509. },
  43510. args: ["anIRDynamicDictionary"],
  43511. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicDictionary dagChildren\x0a\x09\x09enclosedBetween: '$globals.HashedCollection._newFromPairs_([' and: '])'",
  43512. referencedClasses: [],
  43513. pragmas: [],
  43514. messageSends: ["visitInstructionList:enclosedBetween:and:", "dagChildren"]
  43515. }),
  43516. $globals.IRJSTranslator);
  43517. $core.addMethod(
  43518. $core.method({
  43519. selector: "visitIRMethod:",
  43520. protocol: "visiting",
  43521. fn: function (anIRMethod){
  43522. var self=this,$self=this;
  43523. return $core.withContext(function($ctx1) {
  43524. var $1,$2,$3,$4,$5,$6;
  43525. return $self._buildMethodDeclaration_with_(anIRMethod,(function(){
  43526. return $core.withContext(function($ctx2) {
  43527. $1=$self._stream();
  43528. $ctx2.sendIdx["stream"]=1;
  43529. return $recv($1)._nextPutFunctionWith_arguments_((function(){
  43530. return $core.withContext(function($ctx3) {
  43531. $2=$self._stream();
  43532. $ctx3.sendIdx["stream"]=2;
  43533. $3=$recv($recv(anIRMethod)._tempDeclarations())._collect_((function(each){
  43534. return $core.withContext(function($ctx4) {
  43535. return $recv($recv(each)._name())._asVariableName();
  43536. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  43537. }));
  43538. $ctx3.sendIdx["collect:"]=1;
  43539. $recv($2)._nextPutVars_($3);
  43540. $ctx3.sendIdx["nextPutVars:"]=1;
  43541. $4=$self._stream();
  43542. $ctx3.sendIdx["stream"]=3;
  43543. return $recv($4)._nextPutContextFor_during_(anIRMethod,(function(){
  43544. return $core.withContext(function($ctx4) {
  43545. $recv($recv(anIRMethod)._internalVariables())._ifNotEmpty_((function(internalVars){
  43546. return $core.withContext(function($ctx5) {
  43547. $5=$self._stream();
  43548. $ctx5.sendIdx["stream"]=4;
  43549. return $recv($5)._nextPutVars_($recv($recv(internalVars)._asSet())._collect_((function(each){
  43550. return $core.withContext(function($ctx6) {
  43551. return $recv($recv(each)._variable())._alias();
  43552. }, function($ctx6) {$ctx6.fillBlock({each:each},$ctx5,6)});
  43553. })));
  43554. }, function($ctx5) {$ctx5.fillBlock({internalVars:internalVars},$ctx4,5)});
  43555. }));
  43556. $6=$recv($recv(anIRMethod)._scope())._hasNonLocalReturn();
  43557. if($core.assert($6)){
  43558. return $recv($self._stream())._nextPutNonLocalReturnHandlingWith_((function(){
  43559. return $core.withContext(function($ctx5) {
  43560. return (
  43561. $ctx5.supercall = true,
  43562. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRMethod_.apply($self, [anIRMethod]));
  43563. $ctx5.supercall = false;
  43564. $ctx5.sendIdx["visitIRMethod:"]=1;
  43565. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,8)});
  43566. }));
  43567. } else {
  43568. return (
  43569. $ctx4.supercall = true,
  43570. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRMethod_.apply($self, [anIRMethod]));
  43571. $ctx4.supercall = false;
  43572. }
  43573. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  43574. }));
  43575. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  43576. }),$recv(anIRMethod)._arguments());
  43577. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43578. }));
  43579. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod})});
  43580. },
  43581. args: ["anIRMethod"],
  43582. source: "visitIRMethod: anIRMethod\x0a\x0a\x09^ self\x0a\x09\x09buildMethodDeclaration: anIRMethod\x0a\x09\x09with: [ self stream\x0a\x09\x09\x09nextPutFunctionWith: [\x0a\x09\x09\x09\x09self stream nextPutVars: (anIRMethod tempDeclarations collect: [ :each |\x0a\x09\x09\x09\x09\x09each name asVariableName ]).\x0a\x09\x09\x09\x09self stream nextPutContextFor: anIRMethod during: [\x0a\x09\x09\x09\x09\x09anIRMethod internalVariables ifNotEmpty: [ :internalVars |\x0a\x09\x09\x09\x09\x09\x09self stream nextPutVars: \x0a\x09\x09\x09\x09\x09\x09\x09(internalVars asSet collect: [ :each | each variable alias ]) ].\x0a\x09\x09\x09\x09anIRMethod scope hasNonLocalReturn\x0a\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09self stream nextPutNonLocalReturnHandlingWith: [\x0a\x09\x09\x09\x09\x09\x09\x09super visitIRMethod: anIRMethod ] ]\x0a\x09\x09\x09\x09\x09ifFalse: [ super visitIRMethod: anIRMethod ] ]]\x0a\x09\x09\x09arguments: anIRMethod arguments ]",
  43583. referencedClasses: [],
  43584. pragmas: [],
  43585. messageSends: ["buildMethodDeclaration:with:", "nextPutFunctionWith:arguments:", "stream", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutContextFor:during:", "ifNotEmpty:", "internalVariables", "asSet", "alias", "variable", "ifTrue:ifFalse:", "hasNonLocalReturn", "scope", "nextPutNonLocalReturnHandlingWith:", "visitIRMethod:", "arguments"]
  43586. }),
  43587. $globals.IRJSTranslator);
  43588. $core.addMethod(
  43589. $core.method({
  43590. selector: "visitIRNonLocalReturn:",
  43591. protocol: "visiting",
  43592. fn: function (anIRNonLocalReturn){
  43593. var self=this,$self=this;
  43594. return $core.withContext(function($ctx1) {
  43595. $recv($self._stream())._nextPutNonLocalReturnWith_((function(){
  43596. return $core.withContext(function($ctx2) {
  43597. return (
  43598. $ctx2.supercall = true,
  43599. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRNonLocalReturn_.apply($self, [anIRNonLocalReturn]));
  43600. $ctx2.supercall = false;
  43601. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43602. }));
  43603. return self;
  43604. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn})});
  43605. },
  43606. args: ["anIRNonLocalReturn"],
  43607. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]",
  43608. referencedClasses: [],
  43609. pragmas: [],
  43610. messageSends: ["nextPutNonLocalReturnWith:", "stream", "visitIRNonLocalReturn:"]
  43611. }),
  43612. $globals.IRJSTranslator);
  43613. $core.addMethod(
  43614. $core.method({
  43615. selector: "visitIRReturn:",
  43616. protocol: "visiting",
  43617. fn: function (anIRReturn){
  43618. var self=this,$self=this;
  43619. return $core.withContext(function($ctx1) {
  43620. $recv($self._stream())._nextPutReturnWith_((function(){
  43621. return $core.withContext(function($ctx2) {
  43622. return (
  43623. $ctx2.supercall = true,
  43624. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRReturn_.apply($self, [anIRReturn]));
  43625. $ctx2.supercall = false;
  43626. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43627. }));
  43628. return self;
  43629. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn})});
  43630. },
  43631. args: ["anIRReturn"],
  43632. source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]",
  43633. referencedClasses: [],
  43634. pragmas: [],
  43635. messageSends: ["nextPutReturnWith:", "stream", "visitIRReturn:"]
  43636. }),
  43637. $globals.IRJSTranslator);
  43638. $core.addMethod(
  43639. $core.method({
  43640. selector: "visitIRSend:",
  43641. protocol: "visiting",
  43642. fn: function (anIRSend){
  43643. var self=this,$self=this;
  43644. var sends,superclass;
  43645. return $core.withContext(function($ctx1) {
  43646. var $1,$2;
  43647. sends=$recv($recv($recv($recv(anIRSend)._method())._sendIndexes())._at_($recv(anIRSend)._selector()))._size();
  43648. $1=$recv($recv(anIRSend)._receiver())._isSuper();
  43649. if($core.assert($1)){
  43650. $self._visitSuperSend_(anIRSend);
  43651. } else {
  43652. $self._visitSend_(anIRSend);
  43653. }
  43654. $2=$recv($recv(anIRSend)._index()).__lt(sends);
  43655. if($core.assert($2)){
  43656. $recv($self._stream())._nextPutSendIndexFor_(anIRSend);
  43657. }
  43658. return self;
  43659. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend,sends:sends,superclass:superclass})});
  43660. },
  43661. args: ["anIRSend"],
  43662. source: "visitIRSend: anIRSend\x0a\x09| sends superclass |\x0a\x09sends := (anIRSend method sendIndexes at: anIRSend selector) size.\x0a\x09\x0a\x09anIRSend receiver isSuper\x0a\x09\x09ifTrue: [ self visitSuperSend: anIRSend ]\x0a\x09\x09ifFalse: [ self visitSend: anIRSend ].\x0a\x09\x09\x0a\x09anIRSend index < sends\x0a\x09\x09ifTrue: [ self stream nextPutSendIndexFor: anIRSend ]",
  43663. referencedClasses: [],
  43664. pragmas: [],
  43665. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "ifTrue:ifFalse:", "isSuper", "receiver", "visitSuperSend:", "visitSend:", "ifTrue:", "<", "index", "nextPutSendIndexFor:", "stream"]
  43666. }),
  43667. $globals.IRJSTranslator);
  43668. $core.addMethod(
  43669. $core.method({
  43670. selector: "visitIRSequence:",
  43671. protocol: "visiting",
  43672. fn: function (anIRSequence){
  43673. var self=this,$self=this;
  43674. return $core.withContext(function($ctx1) {
  43675. $recv($recv(anIRSequence)._dagChildren())._do_((function(each){
  43676. return $core.withContext(function($ctx2) {
  43677. return $recv($self._stream())._nextPutStatementWith_((function(){
  43678. return $core.withContext(function($ctx3) {
  43679. return $self._visit_(each);
  43680. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  43681. }));
  43682. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43683. }));
  43684. return self;
  43685. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence})});
  43686. },
  43687. args: ["anIRSequence"],
  43688. source: "visitIRSequence: anIRSequence\x0a\x09anIRSequence dagChildren do: [ :each |\x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ] ]",
  43689. referencedClasses: [],
  43690. pragmas: [],
  43691. messageSends: ["do:", "dagChildren", "nextPutStatementWith:", "stream", "visit:"]
  43692. }),
  43693. $globals.IRJSTranslator);
  43694. $core.addMethod(
  43695. $core.method({
  43696. selector: "visitIRTempDeclaration:",
  43697. protocol: "visiting",
  43698. fn: function (anIRTempDeclaration){
  43699. var self=this,$self=this;
  43700. return self;
  43701. },
  43702. args: ["anIRTempDeclaration"],
  43703. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09\x22self stream\x0a\x09\x09nextPutAll: 'var ', anIRTempDeclaration name asVariableName, ';';\x0a\x09\x09lf\x22",
  43704. referencedClasses: [],
  43705. pragmas: [],
  43706. messageSends: []
  43707. }),
  43708. $globals.IRJSTranslator);
  43709. $core.addMethod(
  43710. $core.method({
  43711. selector: "visitIRValue:",
  43712. protocol: "visiting",
  43713. fn: function (anIRValue){
  43714. var self=this,$self=this;
  43715. return $core.withContext(function($ctx1) {
  43716. $recv($self._stream())._nextPutAll_($recv($recv(anIRValue)._value())._asJavaScriptSource());
  43717. return self;
  43718. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue})});
  43719. },
  43720. args: ["anIRValue"],
  43721. source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavaScriptSource",
  43722. referencedClasses: [],
  43723. pragmas: [],
  43724. messageSends: ["nextPutAll:", "stream", "asJavaScriptSource", "value"]
  43725. }),
  43726. $globals.IRJSTranslator);
  43727. $core.addMethod(
  43728. $core.method({
  43729. selector: "visitIRVariable:",
  43730. protocol: "visiting",
  43731. fn: function (anIRVariable){
  43732. var self=this,$self=this;
  43733. return $core.withContext(function($ctx1) {
  43734. var $3,$2,$1,$4;
  43735. $3=$recv(anIRVariable)._variable();
  43736. $ctx1.sendIdx["variable"]=1;
  43737. $2=$recv($3)._name();
  43738. $1=$recv($2).__eq("thisContext");
  43739. if($core.assert($1)){
  43740. $4=$self._stream();
  43741. $ctx1.sendIdx["stream"]=1;
  43742. $recv($4)._nextPutAll_("$core.getThisContext()");
  43743. $ctx1.sendIdx["nextPutAll:"]=1;
  43744. } else {
  43745. $recv($self._stream())._nextPutAll_($recv($recv(anIRVariable)._variable())._alias());
  43746. }
  43747. return self;
  43748. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable})});
  43749. },
  43750. args: ["anIRVariable"],
  43751. source: "visitIRVariable: anIRVariable\x0a\x09anIRVariable variable name = 'thisContext'\x0a\x09\x09ifTrue: [ self stream nextPutAll: '$core.getThisContext()' ]\x0a\x09\x09ifFalse: [ self stream nextPutAll: anIRVariable variable alias ]",
  43752. referencedClasses: [],
  43753. pragmas: [],
  43754. messageSends: ["ifTrue:ifFalse:", "=", "name", "variable", "nextPutAll:", "stream", "alias"]
  43755. }),
  43756. $globals.IRJSTranslator);
  43757. $core.addMethod(
  43758. $core.method({
  43759. selector: "visitIRVerbatim:",
  43760. protocol: "visiting",
  43761. fn: function (anIRVerbatim){
  43762. var self=this,$self=this;
  43763. return $core.withContext(function($ctx1) {
  43764. $recv($self._stream())._nextPutAll_($recv(anIRVerbatim)._source());
  43765. return self;
  43766. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim})});
  43767. },
  43768. args: ["anIRVerbatim"],
  43769. source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutAll: anIRVerbatim source",
  43770. referencedClasses: [],
  43771. pragmas: [],
  43772. messageSends: ["nextPutAll:", "stream", "source"]
  43773. }),
  43774. $globals.IRJSTranslator);
  43775. $core.addMethod(
  43776. $core.method({
  43777. selector: "visitInstructionList:enclosedBetween:and:",
  43778. protocol: "visiting",
  43779. fn: function (anArray,aString,anotherString){
  43780. var self=this,$self=this;
  43781. return $core.withContext(function($ctx1) {
  43782. var $1;
  43783. $1=$self._stream();
  43784. $ctx1.sendIdx["stream"]=1;
  43785. $recv($1)._nextPutAll_(aString);
  43786. $ctx1.sendIdx["nextPutAll:"]=1;
  43787. $recv(anArray)._do_separatedBy_((function(each){
  43788. return $core.withContext(function($ctx2) {
  43789. return $self._visit_(each);
  43790. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43791. }),(function(){
  43792. return $core.withContext(function($ctx2) {
  43793. return $recv($self._stream())._nextPutAll_(",");
  43794. $ctx2.sendIdx["nextPutAll:"]=2;
  43795. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43796. }));
  43797. $recv($self.stream)._nextPutAll_(anotherString);
  43798. return self;
  43799. }, function($ctx1) {$ctx1.fill(self,"visitInstructionList:enclosedBetween:and:",{anArray:anArray,aString:aString,anotherString:anotherString})});
  43800. },
  43801. args: ["anArray", "aString", "anotherString"],
  43802. 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",
  43803. referencedClasses: [],
  43804. pragmas: [],
  43805. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "visit:"]
  43806. }),
  43807. $globals.IRJSTranslator);
  43808. $core.addMethod(
  43809. $core.method({
  43810. selector: "visitReceiver:",
  43811. protocol: "visiting",
  43812. fn: function (anIRInstruction){
  43813. var self=this,$self=this;
  43814. var instr;
  43815. return $core.withContext(function($ctx1) {
  43816. var $1,$2,$4,$5,$3,$6,$7,$8;
  43817. $1=$recv(anIRInstruction)._isSelf();
  43818. if($core.assert($1)){
  43819. $2=$recv(anIRInstruction)._copy();
  43820. $ctx1.sendIdx["copy"]=1;
  43821. $4=$recv($recv(anIRInstruction)._variable())._copy();
  43822. $recv($4)._name_("$self");
  43823. $5=$recv($4)._yourself();
  43824. $ctx1.sendIdx["yourself"]=1;
  43825. $3=$5;
  43826. $recv($2)._variable_($3);
  43827. instr=$recv($2)._yourself();
  43828. instr;
  43829. } else {
  43830. instr=anIRInstruction;
  43831. instr;
  43832. }
  43833. $6=$recv(instr)._needsBoxingAsReceiver();
  43834. if(!$core.assert($6)){
  43835. $7=$self._visit_(instr);
  43836. $ctx1.sendIdx["visit:"]=1;
  43837. return $7;
  43838. }
  43839. $8=$self._stream();
  43840. $ctx1.sendIdx["stream"]=1;
  43841. $recv($8)._nextPutAll_("$recv(");
  43842. $ctx1.sendIdx["nextPutAll:"]=1;
  43843. $self._visit_(instr);
  43844. $recv($self._stream())._nextPutAll_(")");
  43845. return self;
  43846. }, function($ctx1) {$ctx1.fill(self,"visitReceiver:",{anIRInstruction:anIRInstruction,instr:instr})});
  43847. },
  43848. args: ["anIRInstruction"],
  43849. source: "visitReceiver: anIRInstruction\x0a\x09| instr |\x0a\x0a\x09anIRInstruction isSelf\x0a\x09\x09ifTrue: [ instr := anIRInstruction copy\x0a\x09\x09\x09variable: (anIRInstruction variable copy name: '$self'; yourself);\x0a\x09\x09\x09yourself ]\x0a\x09\x09ifFalse: [ instr := anIRInstruction ].\x0a\x09\x0a\x09instr needsBoxingAsReceiver ifFalse: [ ^ self visit: instr ].\x0a\x09\x0a\x09self stream nextPutAll: '$recv('.\x0a\x09self visit: instr.\x0a\x09self stream nextPutAll: ')'",
  43850. referencedClasses: [],
  43851. pragmas: [],
  43852. messageSends: ["ifTrue:ifFalse:", "isSelf", "variable:", "copy", "name:", "variable", "yourself", "ifFalse:", "needsBoxingAsReceiver", "visit:", "nextPutAll:", "stream"]
  43853. }),
  43854. $globals.IRJSTranslator);
  43855. $core.addMethod(
  43856. $core.method({
  43857. selector: "visitSend:",
  43858. protocol: "visiting",
  43859. fn: function (anIRSend){
  43860. var self=this,$self=this;
  43861. return $core.withContext(function($ctx1) {
  43862. $self._visitReceiver_($recv(anIRSend)._receiver());
  43863. $recv($self._stream())._nextPutAll_(".".__comma($recv(anIRSend)._javaScriptSelector()));
  43864. $self._visitInstructionList_enclosedBetween_and_($recv(anIRSend)._arguments(),"(",")");
  43865. return self;
  43866. }, function($ctx1) {$ctx1.fill(self,"visitSend:",{anIRSend:anIRSend})});
  43867. },
  43868. args: ["anIRSend"],
  43869. 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: ')'",
  43870. referencedClasses: [],
  43871. pragmas: [],
  43872. messageSends: ["visitReceiver:", "receiver", "nextPutAll:", "stream", ",", "javaScriptSelector", "visitInstructionList:enclosedBetween:and:", "arguments"]
  43873. }),
  43874. $globals.IRJSTranslator);
  43875. $core.addMethod(
  43876. $core.method({
  43877. selector: "visitSuperSend:",
  43878. protocol: "visiting",
  43879. fn: function (anIRSend){
  43880. var self=this,$self=this;
  43881. return $core.withContext(function($ctx1) {
  43882. var $1,$4,$3,$2,$5,$6,$7;
  43883. $1=$self._stream();
  43884. $ctx1.sendIdx["stream"]=1;
  43885. $recv($1)._nextPutAll_("(");
  43886. $ctx1.sendIdx["nextPutAll:"]=1;
  43887. $recv($1)._lf();
  43888. $ctx1.sendIdx["lf"]=1;
  43889. $recv($1)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  43890. $ctx1.sendIdx["nextPutAll:"]=2;
  43891. $recv($1)._lf();
  43892. $ctx1.sendIdx["lf"]=2;
  43893. $4=$recv(anIRSend)._scope();
  43894. $ctx1.sendIdx["scope"]=1;
  43895. $3=$recv($4)._alias();
  43896. $ctx1.sendIdx["alias"]=1;
  43897. $2=$recv($3).__comma(".supercall = true,");
  43898. $ctx1.sendIdx[","]=1;
  43899. $recv($1)._nextPutAll_($2);
  43900. $ctx1.sendIdx["nextPutAll:"]=3;
  43901. $recv($1)._lf();
  43902. $ctx1.sendIdx["lf"]=3;
  43903. $recv($1)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  43904. $ctx1.sendIdx["nextPutAll:"]=4;
  43905. $recv($1)._lf();
  43906. $ctx1.sendIdx["lf"]=4;
  43907. $5="(".__comma($recv($self._currentClass())._asJavaScriptSource());
  43908. $ctx1.sendIdx[","]=2;
  43909. $recv($1)._nextPutAll_($5);
  43910. $ctx1.sendIdx["nextPutAll:"]=5;
  43911. $recv($1)._nextPutAll_(".superclass||$boot.nilAsClass).fn.prototype.");
  43912. $ctx1.sendIdx["nextPutAll:"]=6;
  43913. $6=$recv($recv(anIRSend)._javaScriptSelector()).__comma(".apply(");
  43914. $ctx1.sendIdx[","]=3;
  43915. $recv($1)._nextPutAll_($6);
  43916. $ctx1.sendIdx["nextPutAll:"]=7;
  43917. $recv($1)._nextPutAll_("$self, ");
  43918. $ctx1.sendIdx["nextPutAll:"]=8;
  43919. $self._visitInstructionList_enclosedBetween_and_($recv(anIRSend)._arguments(),"[","]");
  43920. $7=$self._stream();
  43921. $recv($7)._nextPutAll_("));");
  43922. $ctx1.sendIdx["nextPutAll:"]=9;
  43923. $recv($7)._lf();
  43924. $ctx1.sendIdx["lf"]=5;
  43925. $recv($7)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  43926. $ctx1.sendIdx["nextPutAll:"]=10;
  43927. $recv($7)._lf();
  43928. $ctx1.sendIdx["lf"]=6;
  43929. $recv($7)._nextPutAll_($recv($recv($recv(anIRSend)._scope())._alias()).__comma(".supercall = false;"));
  43930. $ctx1.sendIdx["nextPutAll:"]=11;
  43931. $recv($7)._lf();
  43932. $recv($7)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  43933. return self;
  43934. }, function($ctx1) {$ctx1.fill(self,"visitSuperSend:",{anIRSend:anIRSend})});
  43935. },
  43936. args: ["anIRSend"],
  43937. source: "visitSuperSend: anIRSend\x0a\x09self stream\x0a\x09\x09nextPutAll: '('; lf;\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);'; lf;\x0a\x09\x09nextPutAll: anIRSend scope alias, '.supercall = true,'; lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'; lf;\x0a\x09\x09nextPutAll: '(', self currentClass asJavaScriptSource;\x0a\x09\x09nextPutAll: '.superclass||$boot.nilAsClass).fn.prototype.';\x0a\x09\x09nextPutAll: anIRSend javaScriptSelector, '.apply(';\x0a\x09\x09nextPutAll: '$self, '.\x0a\x09self\x0a\x09\x09visitInstructionList: anIRSend arguments\x0a\x09\x09enclosedBetween: '[' and: ']'.\x0a\x09self stream \x0a\x09\x09nextPutAll: '));'; lf;\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);'; lf;\x0a\x09\x09nextPutAll: anIRSend scope alias, '.supercall = false;'; lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'",
  43938. referencedClasses: [],
  43939. pragmas: [],
  43940. messageSends: ["nextPutAll:", "stream", "lf", ",", "alias", "scope", "asJavaScriptSource", "currentClass", "javaScriptSelector", "visitInstructionList:enclosedBetween:and:", "arguments"]
  43941. }),
  43942. $globals.IRJSTranslator);
  43943. $core.addClass("JSStream", $globals.Object, ["stream", "omitSemicolon"], "Compiler-IR");
  43944. $core.addMethod(
  43945. $core.method({
  43946. selector: "contents",
  43947. protocol: "accessing",
  43948. fn: function (){
  43949. var self=this,$self=this;
  43950. return $core.withContext(function($ctx1) {
  43951. return $recv($self.stream)._contents();
  43952. }, function($ctx1) {$ctx1.fill(self,"contents",{})});
  43953. },
  43954. args: [],
  43955. source: "contents\x0a\x09^ stream contents",
  43956. referencedClasses: [],
  43957. pragmas: [],
  43958. messageSends: ["contents"]
  43959. }),
  43960. $globals.JSStream);
  43961. $core.addMethod(
  43962. $core.method({
  43963. selector: "initialize",
  43964. protocol: "initialization",
  43965. fn: function (){
  43966. var self=this,$self=this;
  43967. return $core.withContext(function($ctx1) {
  43968. (
  43969. $ctx1.supercall = true,
  43970. ($globals.JSStream.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  43971. $ctx1.supercall = false;
  43972. $self.stream=""._writeStream();
  43973. return self;
  43974. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  43975. },
  43976. args: [],
  43977. source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.",
  43978. referencedClasses: [],
  43979. pragmas: [],
  43980. messageSends: ["initialize", "writeStream"]
  43981. }),
  43982. $globals.JSStream);
  43983. $core.addMethod(
  43984. $core.method({
  43985. selector: "lf",
  43986. protocol: "streaming",
  43987. fn: function (){
  43988. var self=this,$self=this;
  43989. return $core.withContext(function($ctx1) {
  43990. $recv($self.stream)._lf();
  43991. return self;
  43992. }, function($ctx1) {$ctx1.fill(self,"lf",{})});
  43993. },
  43994. args: [],
  43995. source: "lf\x0a\x09stream lf",
  43996. referencedClasses: [],
  43997. pragmas: [],
  43998. messageSends: ["lf"]
  43999. }),
  44000. $globals.JSStream);
  44001. $core.addMethod(
  44002. $core.method({
  44003. selector: "nextPut:",
  44004. protocol: "streaming",
  44005. fn: function (aString){
  44006. var self=this,$self=this;
  44007. return $core.withContext(function($ctx1) {
  44008. $recv($self.stream)._nextPut_(aString);
  44009. return self;
  44010. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString})});
  44011. },
  44012. args: ["aString"],
  44013. source: "nextPut: aString\x0a\x09stream nextPut: aString",
  44014. referencedClasses: [],
  44015. pragmas: [],
  44016. messageSends: ["nextPut:"]
  44017. }),
  44018. $globals.JSStream);
  44019. $core.addMethod(
  44020. $core.method({
  44021. selector: "nextPutAll:",
  44022. protocol: "streaming",
  44023. fn: function (aString){
  44024. var self=this,$self=this;
  44025. return $core.withContext(function($ctx1) {
  44026. $recv($self.stream)._nextPutAll_(aString);
  44027. return self;
  44028. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString})});
  44029. },
  44030. args: ["aString"],
  44031. source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString",
  44032. referencedClasses: [],
  44033. pragmas: [],
  44034. messageSends: ["nextPutAll:"]
  44035. }),
  44036. $globals.JSStream);
  44037. $core.addMethod(
  44038. $core.method({
  44039. selector: "nextPutAssignLhs:rhs:",
  44040. protocol: "streaming",
  44041. fn: function (aBlock,anotherBlock){
  44042. var self=this,$self=this;
  44043. return $core.withContext(function($ctx1) {
  44044. $recv(aBlock)._value();
  44045. $ctx1.sendIdx["value"]=1;
  44046. $recv($self.stream)._nextPutAll_("=");
  44047. $recv(anotherBlock)._value();
  44048. return self;
  44049. }, function($ctx1) {$ctx1.fill(self,"nextPutAssignLhs:rhs:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  44050. },
  44051. args: ["aBlock", "anotherBlock"],
  44052. source: "nextPutAssignLhs: aBlock rhs: anotherBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '='.\x0a\x09anotherBlock value",
  44053. referencedClasses: [],
  44054. pragmas: [],
  44055. messageSends: ["value", "nextPutAll:"]
  44056. }),
  44057. $globals.JSStream);
  44058. $core.addMethod(
  44059. $core.method({
  44060. selector: "nextPutBlockContextFor:during:",
  44061. protocol: "streaming",
  44062. fn: function (anIRClosure,aBlock){
  44063. var self=this,$self=this;
  44064. return $core.withContext(function($ctx1) {
  44065. var $1,$2,$6,$5,$4,$3,$10,$9,$8,$7,$13,$12,$11,$14,$20,$19,$18,$17,$16,$15;
  44066. $1=$recv(anIRClosure)._requiresSmalltalkContext();
  44067. if(!$core.assert($1)){
  44068. $2=$recv(aBlock)._value();
  44069. $ctx1.sendIdx["value"]=1;
  44070. return $2;
  44071. }
  44072. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  44073. $ctx1.sendIdx["nextPutAll:"]=1;
  44074. $self._lf();
  44075. $ctx1.sendIdx["lf"]=1;
  44076. $6=$recv(anIRClosure)._scope();
  44077. $ctx1.sendIdx["scope"]=1;
  44078. $5=$recv($6)._alias();
  44079. $ctx1.sendIdx["alias"]=1;
  44080. $4="return $core.withContext(function(".__comma($5);
  44081. $ctx1.sendIdx[","]=2;
  44082. $3=$recv($4).__comma(") {");
  44083. $ctx1.sendIdx[","]=1;
  44084. $self._nextPutAll_($3);
  44085. $ctx1.sendIdx["nextPutAll:"]=2;
  44086. $self._lf();
  44087. $ctx1.sendIdx["lf"]=2;
  44088. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  44089. $ctx1.sendIdx["nextPutAll:"]=3;
  44090. $self._lf();
  44091. $ctx1.sendIdx["lf"]=3;
  44092. $recv(aBlock)._value();
  44093. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  44094. $ctx1.sendIdx["nextPutAll:"]=4;
  44095. $self._lf();
  44096. $ctx1.sendIdx["lf"]=4;
  44097. $10=$recv(anIRClosure)._scope();
  44098. $ctx1.sendIdx["scope"]=2;
  44099. $9=$recv($10)._alias();
  44100. $ctx1.sendIdx["alias"]=2;
  44101. $8="}, function(".__comma($9);
  44102. $ctx1.sendIdx[","]=4;
  44103. $7=$recv($8).__comma(") {");
  44104. $ctx1.sendIdx[","]=3;
  44105. $self._nextPutAll_($7);
  44106. $ctx1.sendIdx["nextPutAll:"]=5;
  44107. $13=$recv(anIRClosure)._scope();
  44108. $ctx1.sendIdx["scope"]=3;
  44109. $12=$recv($13)._alias();
  44110. $ctx1.sendIdx["alias"]=3;
  44111. $11=$recv($12).__comma(".fillBlock({");
  44112. $ctx1.sendIdx[","]=5;
  44113. $self._nextPutAll_($11);
  44114. $ctx1.sendIdx["nextPutAll:"]=6;
  44115. $recv($recv(anIRClosure)._locals())._do_separatedBy_((function(each){
  44116. return $core.withContext(function($ctx2) {
  44117. $14=$recv(each)._asVariableName();
  44118. $ctx2.sendIdx["asVariableName"]=1;
  44119. $self._nextPutAll_($14);
  44120. $ctx2.sendIdx["nextPutAll:"]=7;
  44121. $self._nextPutAll_(":");
  44122. $ctx2.sendIdx["nextPutAll:"]=8;
  44123. return $self._nextPutAll_($recv(each)._asVariableName());
  44124. $ctx2.sendIdx["nextPutAll:"]=9;
  44125. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  44126. }),(function(){
  44127. return $core.withContext(function($ctx2) {
  44128. return $self._nextPutAll_(",");
  44129. $ctx2.sendIdx["nextPutAll:"]=10;
  44130. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  44131. }));
  44132. $self._nextPutAll_("},");
  44133. $ctx1.sendIdx["nextPutAll:"]=11;
  44134. $20=$recv(anIRClosure)._scope();
  44135. $ctx1.sendIdx["scope"]=4;
  44136. $19=$recv($20)._outerScope();
  44137. $18=$recv($19)._alias();
  44138. $17=$recv($18).__comma(",");
  44139. $16=$recv($17).__comma($recv($recv($recv(anIRClosure)._scope())._blockIndex())._asString());
  44140. $ctx1.sendIdx[","]=7;
  44141. $15=$recv($16).__comma(")});");
  44142. $ctx1.sendIdx[","]=6;
  44143. $self._nextPutAll_($15);
  44144. $ctx1.sendIdx["nextPutAll:"]=12;
  44145. $self._lf();
  44146. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  44147. return self;
  44148. }, function($ctx1) {$ctx1.fill(self,"nextPutBlockContextFor:during:",{anIRClosure:anIRClosure,aBlock:aBlock})});
  44149. },
  44150. args: ["anIRClosure", "aBlock"],
  44151. 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);'",
  44152. referencedClasses: [],
  44153. pragmas: [],
  44154. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "do:separatedBy:", "locals", "asVariableName", "outerScope", "asString", "blockIndex"]
  44155. }),
  44156. $globals.JSStream);
  44157. $core.addMethod(
  44158. $core.method({
  44159. selector: "nextPutClosureWith:arguments:",
  44160. protocol: "streaming",
  44161. fn: function (aBlock,anArray){
  44162. var self=this,$self=this;
  44163. return $core.withContext(function($ctx1) {
  44164. var $1,$2;
  44165. $recv($self.stream)._nextPutAll_("(function(");
  44166. $ctx1.sendIdx["nextPutAll:"]=1;
  44167. $recv(anArray)._do_separatedBy_((function(each){
  44168. return $core.withContext(function($ctx2) {
  44169. return $recv($self.stream)._nextPutAll_($recv(each)._asVariableName());
  44170. $ctx2.sendIdx["nextPutAll:"]=2;
  44171. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44172. }),(function(){
  44173. return $core.withContext(function($ctx2) {
  44174. return $recv($self.stream)._nextPut_(",");
  44175. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  44176. }));
  44177. $1=$self.stream;
  44178. $recv($1)._nextPutAll_("){");
  44179. $ctx1.sendIdx["nextPutAll:"]=3;
  44180. $recv($1)._lf();
  44181. $ctx1.sendIdx["lf"]=1;
  44182. $recv(aBlock)._value();
  44183. $2=$self.stream;
  44184. $recv($2)._lf();
  44185. $recv($2)._nextPutAll_("})");
  44186. return self;
  44187. }, function($ctx1) {$ctx1.fill(self,"nextPutClosureWith:arguments:",{aBlock:aBlock,anArray:anArray})});
  44188. },
  44189. args: ["aBlock", "anArray"],
  44190. 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: '})'",
  44191. referencedClasses: [],
  44192. pragmas: [],
  44193. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  44194. }),
  44195. $globals.JSStream);
  44196. $core.addMethod(
  44197. $core.method({
  44198. selector: "nextPutContextFor:during:",
  44199. protocol: "streaming",
  44200. fn: function (aMethod,aBlock){
  44201. var self=this,$self=this;
  44202. return $core.withContext(function($ctx1) {
  44203. var $1,$2,$6,$5,$4,$3,$11,$10,$9,$8,$7,$12,$13;
  44204. $1=$recv(aMethod)._requiresSmalltalkContext();
  44205. if(!$core.assert($1)){
  44206. $2=$recv(aBlock)._value();
  44207. $ctx1.sendIdx["value"]=1;
  44208. return $2;
  44209. }
  44210. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  44211. $ctx1.sendIdx["nextPutAll:"]=1;
  44212. $self._lf();
  44213. $ctx1.sendIdx["lf"]=1;
  44214. $6=$recv(aMethod)._scope();
  44215. $ctx1.sendIdx["scope"]=1;
  44216. $5=$recv($6)._alias();
  44217. $ctx1.sendIdx["alias"]=1;
  44218. $4="return $core.withContext(function(".__comma($5);
  44219. $ctx1.sendIdx[","]=2;
  44220. $3=$recv($4).__comma(") {");
  44221. $ctx1.sendIdx[","]=1;
  44222. $self._nextPutAll_($3);
  44223. $ctx1.sendIdx["nextPutAll:"]=2;
  44224. $self._lf();
  44225. $ctx1.sendIdx["lf"]=2;
  44226. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  44227. $ctx1.sendIdx["nextPutAll:"]=3;
  44228. $self._lf();
  44229. $ctx1.sendIdx["lf"]=3;
  44230. $recv(aBlock)._value();
  44231. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  44232. $ctx1.sendIdx["nextPutAll:"]=4;
  44233. $self._lf();
  44234. $ctx1.sendIdx["lf"]=4;
  44235. $11=$recv(aMethod)._scope();
  44236. $ctx1.sendIdx["scope"]=2;
  44237. $10=$recv($11)._alias();
  44238. $ctx1.sendIdx["alias"]=2;
  44239. $9="}, function(".__comma($10);
  44240. $ctx1.sendIdx[","]=5;
  44241. $8=$recv($9).__comma(") {");
  44242. $ctx1.sendIdx[","]=4;
  44243. $7=$recv($8).__comma($recv($recv(aMethod)._scope())._alias());
  44244. $ctx1.sendIdx[","]=3;
  44245. $self._nextPutAll_($7);
  44246. $ctx1.sendIdx["nextPutAll:"]=5;
  44247. $12=$recv(".fill(self,".__comma($recv($recv(aMethod)._selector())._asJavaScriptSource())).__comma(",{");
  44248. $ctx1.sendIdx[","]=6;
  44249. $self._nextPutAll_($12);
  44250. $ctx1.sendIdx["nextPutAll:"]=6;
  44251. $recv($recv(aMethod)._locals())._do_separatedBy_((function(each){
  44252. return $core.withContext(function($ctx2) {
  44253. $13=$recv(each)._asVariableName();
  44254. $ctx2.sendIdx["asVariableName"]=1;
  44255. $self._nextPutAll_($13);
  44256. $ctx2.sendIdx["nextPutAll:"]=7;
  44257. $self._nextPutAll_(":");
  44258. $ctx2.sendIdx["nextPutAll:"]=8;
  44259. return $self._nextPutAll_($recv(each)._asVariableName());
  44260. $ctx2.sendIdx["nextPutAll:"]=9;
  44261. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  44262. }),(function(){
  44263. return $core.withContext(function($ctx2) {
  44264. return $self._nextPutAll_(",");
  44265. $ctx2.sendIdx["nextPutAll:"]=10;
  44266. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  44267. }));
  44268. $self._nextPutAll_("})});");
  44269. $ctx1.sendIdx["nextPutAll:"]=11;
  44270. $self._lf();
  44271. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  44272. return self;
  44273. }, function($ctx1) {$ctx1.fill(self,"nextPutContextFor:during:",{aMethod:aMethod,aBlock:aBlock})});
  44274. },
  44275. args: ["aMethod", "aBlock"],
  44276. 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);'",
  44277. referencedClasses: [],
  44278. pragmas: [],
  44279. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "asJavaScriptSource", "selector", "do:separatedBy:", "locals", "asVariableName"]
  44280. }),
  44281. $globals.JSStream);
  44282. $core.addMethod(
  44283. $core.method({
  44284. selector: "nextPutFunctionWith:arguments:",
  44285. protocol: "streaming",
  44286. fn: function (aBlock,anArray){
  44287. var self=this,$self=this;
  44288. return $core.withContext(function($ctx1) {
  44289. var $1,$2,$3;
  44290. $recv($self.stream)._nextPutAll_("(function (");
  44291. $ctx1.sendIdx["nextPutAll:"]=1;
  44292. $recv(anArray)._do_separatedBy_((function(each){
  44293. return $core.withContext(function($ctx2) {
  44294. return $recv($self.stream)._nextPutAll_($recv(each)._asVariableName());
  44295. $ctx2.sendIdx["nextPutAll:"]=2;
  44296. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44297. }),(function(){
  44298. return $core.withContext(function($ctx2) {
  44299. return $recv($self.stream)._nextPut_(",");
  44300. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  44301. }));
  44302. $1=$self.stream;
  44303. $recv($1)._nextPutAll_("){");
  44304. $ctx1.sendIdx["nextPutAll:"]=3;
  44305. $recv($1)._lf();
  44306. $ctx1.sendIdx["lf"]=1;
  44307. $2=$self.stream;
  44308. $recv($2)._nextPutAll_("var self=this,$self=this;");
  44309. $ctx1.sendIdx["nextPutAll:"]=4;
  44310. $recv($2)._lf();
  44311. $ctx1.sendIdx["lf"]=2;
  44312. $recv(aBlock)._value();
  44313. $3=$self.stream;
  44314. $recv($3)._lf();
  44315. $recv($3)._nextPutAll_("})");
  44316. return self;
  44317. }, function($ctx1) {$ctx1.fill(self,"nextPutFunctionWith:arguments:",{aBlock:aBlock,anArray:anArray})});
  44318. },
  44319. args: ["aBlock", "anArray"],
  44320. 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: '})'",
  44321. referencedClasses: [],
  44322. pragmas: [],
  44323. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  44324. }),
  44325. $globals.JSStream);
  44326. $core.addMethod(
  44327. $core.method({
  44328. selector: "nextPutIf:then:",
  44329. protocol: "streaming",
  44330. fn: function (aBlock,anotherBlock){
  44331. var self=this,$self=this;
  44332. return $core.withContext(function($ctx1) {
  44333. var $1;
  44334. $recv($self.stream)._nextPutAll_("if(");
  44335. $ctx1.sendIdx["nextPutAll:"]=1;
  44336. $recv(aBlock)._value();
  44337. $ctx1.sendIdx["value"]=1;
  44338. $1=$self.stream;
  44339. $recv($1)._nextPutAll_("){");
  44340. $ctx1.sendIdx["nextPutAll:"]=2;
  44341. $recv($1)._lf();
  44342. $recv(anotherBlock)._value();
  44343. $recv($self.stream)._nextPutAll_("}");
  44344. $self._omitSemicolon_(true);
  44345. return self;
  44346. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  44347. },
  44348. args: ["aBlock", "anotherBlock"],
  44349. 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",
  44350. referencedClasses: [],
  44351. pragmas: [],
  44352. messageSends: ["nextPutAll:", "value", "lf", "omitSemicolon:"]
  44353. }),
  44354. $globals.JSStream);
  44355. $core.addMethod(
  44356. $core.method({
  44357. selector: "nextPutIf:then:else:",
  44358. protocol: "streaming",
  44359. fn: function (aBlock,ifBlock,elseBlock){
  44360. var self=this,$self=this;
  44361. return $core.withContext(function($ctx1) {
  44362. var $1,$2;
  44363. $recv($self.stream)._nextPutAll_("if(");
  44364. $ctx1.sendIdx["nextPutAll:"]=1;
  44365. $recv(aBlock)._value();
  44366. $ctx1.sendIdx["value"]=1;
  44367. $1=$self.stream;
  44368. $recv($1)._nextPutAll_("){");
  44369. $ctx1.sendIdx["nextPutAll:"]=2;
  44370. $recv($1)._lf();
  44371. $ctx1.sendIdx["lf"]=1;
  44372. $recv(ifBlock)._value();
  44373. $ctx1.sendIdx["value"]=2;
  44374. $2=$self.stream;
  44375. $recv($2)._nextPutAll_("} else {");
  44376. $ctx1.sendIdx["nextPutAll:"]=3;
  44377. $recv($2)._lf();
  44378. $recv(elseBlock)._value();
  44379. $recv($self.stream)._nextPutAll_("}");
  44380. $self._omitSemicolon_(true);
  44381. return self;
  44382. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:else:",{aBlock:aBlock,ifBlock:ifBlock,elseBlock:elseBlock})});
  44383. },
  44384. args: ["aBlock", "ifBlock", "elseBlock"],
  44385. 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",
  44386. referencedClasses: [],
  44387. pragmas: [],
  44388. messageSends: ["nextPutAll:", "value", "lf", "omitSemicolon:"]
  44389. }),
  44390. $globals.JSStream);
  44391. $core.addMethod(
  44392. $core.method({
  44393. selector: "nextPutMethodDeclaration:with:",
  44394. protocol: "streaming",
  44395. fn: function (aMethod,aBlock){
  44396. var self=this,$self=this;
  44397. return $core.withContext(function($ctx1) {
  44398. var $1,$4,$3,$2,$7,$6,$5,$8,$11,$10,$9,$14,$13,$12,$17,$16,$15,$18;
  44399. $1=$self.stream;
  44400. $recv($1)._nextPutAll_("$core.method({");
  44401. $ctx1.sendIdx["nextPutAll:"]=1;
  44402. $recv($1)._lf();
  44403. $ctx1.sendIdx["lf"]=1;
  44404. $4=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  44405. $ctx1.sendIdx["asJavaScriptSource"]=1;
  44406. $3="selector: ".__comma($4);
  44407. $ctx1.sendIdx[","]=2;
  44408. $2=$recv($3).__comma(",");
  44409. $ctx1.sendIdx[","]=1;
  44410. $recv($1)._nextPutAll_($2);
  44411. $ctx1.sendIdx["nextPutAll:"]=2;
  44412. $recv($1)._lf();
  44413. $ctx1.sendIdx["lf"]=2;
  44414. $7=$recv($recv(aMethod)._source())._asJavaScriptSource();
  44415. $ctx1.sendIdx["asJavaScriptSource"]=2;
  44416. $6="source: ".__comma($7);
  44417. $ctx1.sendIdx[","]=4;
  44418. $5=$recv($6).__comma(",");
  44419. $ctx1.sendIdx[","]=3;
  44420. $recv($1)._nextPutAll_($5);
  44421. $ctx1.sendIdx["nextPutAll:"]=3;
  44422. $recv($1)._lf();
  44423. $ctx1.sendIdx["lf"]=3;
  44424. $recv(aBlock)._value();
  44425. $ctx1.sendIdx["value"]=1;
  44426. $8=$self.stream;
  44427. $11=$recv($globals.String)._lf();
  44428. $ctx1.sendIdx["lf"]=4;
  44429. $10=",".__comma($11);
  44430. $ctx1.sendIdx[","]=6;
  44431. $9=$recv($10).__comma("messageSends: ");
  44432. $ctx1.sendIdx[","]=5;
  44433. $recv($8)._nextPutAll_($9);
  44434. $ctx1.sendIdx["nextPutAll:"]=4;
  44435. $14=$recv($recv(aMethod)._messageSends())._asArray();
  44436. $ctx1.sendIdx["asArray"]=1;
  44437. $13=$recv($14)._asJavaScriptSource();
  44438. $ctx1.sendIdx["asJavaScriptSource"]=3;
  44439. $12=$recv($13).__comma(",");
  44440. $ctx1.sendIdx[","]=7;
  44441. $recv($8)._nextPutAll_($12);
  44442. $ctx1.sendIdx["nextPutAll:"]=5;
  44443. $recv($8)._lf();
  44444. $ctx1.sendIdx["lf"]=5;
  44445. $17=$recv($recv($recv($recv(aMethod)._arguments())._collect_((function(each){
  44446. return $core.withContext(function($ctx2) {
  44447. return $recv(each)._value();
  44448. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44449. })))._asArray())._asJavaScriptSource();
  44450. $ctx1.sendIdx["asJavaScriptSource"]=4;
  44451. $16="args: ".__comma($17);
  44452. $15=$recv($16).__comma(",");
  44453. $ctx1.sendIdx[","]=8;
  44454. $recv($8)._nextPutAll_($15);
  44455. $ctx1.sendIdx["nextPutAll:"]=6;
  44456. $recv($8)._lf();
  44457. $recv($8)._nextPutAll_("referencedClasses: [");
  44458. $ctx1.sendIdx["nextPutAll:"]=7;
  44459. $recv($recv(aMethod)._classReferences())._do_separatedBy_((function(each){
  44460. return $core.withContext(function($ctx2) {
  44461. return $recv($self.stream)._nextPutAll_($recv(each)._asJavaScriptSource());
  44462. $ctx2.sendIdx["nextPutAll:"]=8;
  44463. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  44464. }),(function(){
  44465. return $core.withContext(function($ctx2) {
  44466. return $recv($self.stream)._nextPutAll_(",");
  44467. $ctx2.sendIdx["nextPutAll:"]=9;
  44468. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  44469. }));
  44470. $18=$self.stream;
  44471. $recv($18)._nextPutAll_("]");
  44472. $ctx1.sendIdx["nextPutAll:"]=10;
  44473. $recv($18)._nextPutAll_("})");
  44474. return self;
  44475. }, function($ctx1) {$ctx1.fill(self,"nextPutMethodDeclaration:with:",{aMethod:aMethod,aBlock:aBlock})});
  44476. },
  44477. args: ["aMethod", "aBlock"],
  44478. source: "nextPutMethodDeclaration: aMethod with: aBlock\x0a\x09stream\x0a\x09\x09nextPutAll: '$core.method({'; lf;\x0a\x09\x09nextPutAll: 'selector: ', aMethod selector asJavaScriptSource, ','; lf;\x0a\x09\x09nextPutAll: 'source: ', aMethod source asJavaScriptSource, ',';lf.\x0a\x09aBlock value.\x0a\x09stream\x0a\x09\x09nextPutAll: ',', String lf, 'messageSends: ';\x0a\x09\x09nextPutAll: aMethod messageSends asArray asJavaScriptSource, ','; lf;\x0a\x09\x09nextPutAll: 'args: ', (aMethod arguments collect: [ :each | each value ]) asArray asJavaScriptSource, ','; lf;\x0a\x09\x09nextPutAll: 'referencedClasses: ['.\x0a\x09aMethod classReferences\x0a\x09\x09do: [ :each | stream nextPutAll: each asJavaScriptSource ]\x0a\x09\x09separatedBy: [ stream nextPutAll: ',' ].\x0a\x09stream\x0a\x09\x09nextPutAll: ']';\x0a\x09\x09nextPutAll: '})'",
  44479. referencedClasses: ["String"],
  44480. pragmas: [],
  44481. messageSends: ["nextPutAll:", "lf", ",", "asJavaScriptSource", "selector", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"]
  44482. }),
  44483. $globals.JSStream);
  44484. $core.addMethod(
  44485. $core.method({
  44486. selector: "nextPutNonLocalReturnHandlingWith:",
  44487. protocol: "streaming",
  44488. fn: function (aBlock){
  44489. var self=this,$self=this;
  44490. return $core.withContext(function($ctx1) {
  44491. var $1,$2;
  44492. $1=$self.stream;
  44493. $recv($1)._nextPutAll_("var $early={};");
  44494. $ctx1.sendIdx["nextPutAll:"]=1;
  44495. $recv($1)._lf();
  44496. $ctx1.sendIdx["lf"]=1;
  44497. $recv($1)._nextPutAll_("try {");
  44498. $ctx1.sendIdx["nextPutAll:"]=2;
  44499. $recv($1)._lf();
  44500. $ctx1.sendIdx["lf"]=2;
  44501. $recv(aBlock)._value();
  44502. $2=$self.stream;
  44503. $recv($2)._nextPutAll_("}");
  44504. $ctx1.sendIdx["nextPutAll:"]=3;
  44505. $recv($2)._lf();
  44506. $ctx1.sendIdx["lf"]=3;
  44507. $recv($2)._nextPutAll_("catch(e) {if(e===$early)return e[0]; throw e}");
  44508. $recv($2)._lf();
  44509. return self;
  44510. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnHandlingWith:",{aBlock:aBlock})});
  44511. },
  44512. args: ["aBlock"],
  44513. 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",
  44514. referencedClasses: [],
  44515. pragmas: [],
  44516. messageSends: ["nextPutAll:", "lf", "value"]
  44517. }),
  44518. $globals.JSStream);
  44519. $core.addMethod(
  44520. $core.method({
  44521. selector: "nextPutNonLocalReturnWith:",
  44522. protocol: "streaming",
  44523. fn: function (aBlock){
  44524. var self=this,$self=this;
  44525. return $core.withContext(function($ctx1) {
  44526. $recv($self.stream)._nextPutAll_("throw $early=[");
  44527. $ctx1.sendIdx["nextPutAll:"]=1;
  44528. $recv(aBlock)._value();
  44529. $recv($self.stream)._nextPutAll_("]");
  44530. return self;
  44531. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnWith:",{aBlock:aBlock})});
  44532. },
  44533. args: ["aBlock"],
  44534. source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'",
  44535. referencedClasses: [],
  44536. pragmas: [],
  44537. messageSends: ["nextPutAll:", "value"]
  44538. }),
  44539. $globals.JSStream);
  44540. $core.addMethod(
  44541. $core.method({
  44542. selector: "nextPutReturnWith:",
  44543. protocol: "streaming",
  44544. fn: function (aBlock){
  44545. var self=this,$self=this;
  44546. return $core.withContext(function($ctx1) {
  44547. $recv($self.stream)._nextPutAll_("return ");
  44548. $recv(aBlock)._value();
  44549. return self;
  44550. }, function($ctx1) {$ctx1.fill(self,"nextPutReturnWith:",{aBlock:aBlock})});
  44551. },
  44552. args: ["aBlock"],
  44553. source: "nextPutReturnWith: aBlock\x0a\x09stream nextPutAll: 'return '.\x0a\x09aBlock value",
  44554. referencedClasses: [],
  44555. pragmas: [],
  44556. messageSends: ["nextPutAll:", "value"]
  44557. }),
  44558. $globals.JSStream);
  44559. $core.addMethod(
  44560. $core.method({
  44561. selector: "nextPutSendIndexFor:",
  44562. protocol: "streaming",
  44563. fn: function (anIRSend){
  44564. var self=this,$self=this;
  44565. return $core.withContext(function($ctx1) {
  44566. $self._nextPutAll_(";");
  44567. $ctx1.sendIdx["nextPutAll:"]=1;
  44568. $self._lf();
  44569. $ctx1.sendIdx["lf"]=1;
  44570. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  44571. $ctx1.sendIdx["nextPutAll:"]=2;
  44572. $self._lf();
  44573. $ctx1.sendIdx["lf"]=2;
  44574. $self._nextPutAll_($recv($recv(anIRSend)._scope())._alias());
  44575. $ctx1.sendIdx["nextPutAll:"]=3;
  44576. $self._nextPutAll_(".sendIdx[");
  44577. $ctx1.sendIdx["nextPutAll:"]=4;
  44578. $self._nextPutAll_($recv($recv(anIRSend)._selector())._asJavaScriptSource());
  44579. $ctx1.sendIdx["nextPutAll:"]=5;
  44580. $self._nextPutAll_("]=");
  44581. $ctx1.sendIdx["nextPutAll:"]=6;
  44582. $self._nextPutAll_($recv($recv(anIRSend)._index())._asString());
  44583. $ctx1.sendIdx["nextPutAll:"]=7;
  44584. $self._nextPutAll_(";");
  44585. $ctx1.sendIdx["nextPutAll:"]=8;
  44586. $self._lf();
  44587. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22)");
  44588. return self;
  44589. }, function($ctx1) {$ctx1.fill(self,"nextPutSendIndexFor:",{anIRSend:anIRSend})});
  44590. },
  44591. args: ["anIRSend"],
  44592. source: "nextPutSendIndexFor: anIRSend\x0a\x09self \x0a\x09\x09nextPutAll: ';'; lf;\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);'; lf;\x0a\x09\x09nextPutAll: anIRSend scope alias;\x0a\x09\x09nextPutAll: '.sendIdx[';\x0a\x09\x09nextPutAll: anIRSend selector asJavaScriptSource;\x0a\x09\x09nextPutAll: ']=';\x0a\x09\x09nextPutAll: anIRSend index asString;\x0a\x09\x09nextPutAll: ';'; lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22)'",
  44593. referencedClasses: [],
  44594. pragmas: [],
  44595. messageSends: ["nextPutAll:", "lf", "alias", "scope", "asJavaScriptSource", "selector", "asString", "index"]
  44596. }),
  44597. $globals.JSStream);
  44598. $core.addMethod(
  44599. $core.method({
  44600. selector: "nextPutStatementWith:",
  44601. protocol: "streaming",
  44602. fn: function (aBlock){
  44603. var self=this,$self=this;
  44604. return $core.withContext(function($ctx1) {
  44605. var $1;
  44606. $self._omitSemicolon_(false);
  44607. $ctx1.sendIdx["omitSemicolon:"]=1;
  44608. $recv(aBlock)._value();
  44609. $1=$self._omitSemicolon();
  44610. if(!$core.assert($1)){
  44611. $recv($self.stream)._nextPutAll_(";");
  44612. }
  44613. $self._omitSemicolon_(false);
  44614. $recv($self.stream)._lf();
  44615. return self;
  44616. }, function($ctx1) {$ctx1.fill(self,"nextPutStatementWith:",{aBlock:aBlock})});
  44617. },
  44618. args: ["aBlock"],
  44619. source: "nextPutStatementWith: aBlock\x0a\x09self omitSemicolon: false.\x0a\x09aBlock value.\x0a\x09self omitSemicolon ifFalse: [ stream nextPutAll: ';' ].\x0a\x09self omitSemicolon: false.\x0a\x09stream lf",
  44620. referencedClasses: [],
  44621. pragmas: [],
  44622. messageSends: ["omitSemicolon:", "value", "ifFalse:", "omitSemicolon", "nextPutAll:", "lf"]
  44623. }),
  44624. $globals.JSStream);
  44625. $core.addMethod(
  44626. $core.method({
  44627. selector: "nextPutVars:",
  44628. protocol: "streaming",
  44629. fn: function (aCollection){
  44630. var self=this,$self=this;
  44631. return $core.withContext(function($ctx1) {
  44632. var $1;
  44633. $recv(aCollection)._ifNotEmpty_((function(){
  44634. return $core.withContext(function($ctx2) {
  44635. $recv($self.stream)._nextPutAll_("var ");
  44636. $ctx2.sendIdx["nextPutAll:"]=1;
  44637. $recv(aCollection)._do_separatedBy_((function(each){
  44638. return $core.withContext(function($ctx3) {
  44639. return $recv($self.stream)._nextPutAll_(each);
  44640. $ctx3.sendIdx["nextPutAll:"]=2;
  44641. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  44642. }),(function(){
  44643. return $core.withContext(function($ctx3) {
  44644. return $recv($self.stream)._nextPutAll_(",");
  44645. $ctx3.sendIdx["nextPutAll:"]=3;
  44646. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  44647. }));
  44648. $1=$self.stream;
  44649. $recv($1)._nextPutAll_(";");
  44650. return $recv($1)._lf();
  44651. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44652. }));
  44653. return self;
  44654. }, function($ctx1) {$ctx1.fill(self,"nextPutVars:",{aCollection:aCollection})});
  44655. },
  44656. args: ["aCollection"],
  44657. 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 ]",
  44658. referencedClasses: [],
  44659. pragmas: [],
  44660. messageSends: ["ifNotEmpty:", "nextPutAll:", "do:separatedBy:", "lf"]
  44661. }),
  44662. $globals.JSStream);
  44663. $core.addMethod(
  44664. $core.method({
  44665. selector: "omitSemicolon",
  44666. protocol: "accessing",
  44667. fn: function (){
  44668. var self=this,$self=this;
  44669. return $self.omitSemicolon;
  44670. },
  44671. args: [],
  44672. source: "omitSemicolon\x0a\x09^ omitSemicolon",
  44673. referencedClasses: [],
  44674. pragmas: [],
  44675. messageSends: []
  44676. }),
  44677. $globals.JSStream);
  44678. $core.addMethod(
  44679. $core.method({
  44680. selector: "omitSemicolon:",
  44681. protocol: "accessing",
  44682. fn: function (aBoolean){
  44683. var self=this,$self=this;
  44684. $self.omitSemicolon=aBoolean;
  44685. return self;
  44686. },
  44687. args: ["aBoolean"],
  44688. source: "omitSemicolon: aBoolean\x0a\x09omitSemicolon := aBoolean",
  44689. referencedClasses: [],
  44690. pragmas: [],
  44691. messageSends: []
  44692. }),
  44693. $globals.JSStream);
  44694. $core.addMethod(
  44695. $core.method({
  44696. selector: "isReferenced",
  44697. protocol: "*Compiler-IR",
  44698. fn: function (){
  44699. var self=this,$self=this;
  44700. return $core.withContext(function($ctx1) {
  44701. var $2,$1,$4,$3,$6,$5;
  44702. $2=$self._parent();
  44703. $ctx1.sendIdx["parent"]=1;
  44704. $1=$recv($2)._isSequenceNode();
  44705. if($core.assert($1)){
  44706. return false;
  44707. }
  44708. $4=$self._parent();
  44709. $ctx1.sendIdx["parent"]=2;
  44710. $3=$recv($4)._isAssignmentNode();
  44711. if($core.assert($3)){
  44712. return false;
  44713. }
  44714. $6=$self._parent();
  44715. $ctx1.sendIdx["parent"]=3;
  44716. $5=$recv($6)._isCascadeNode();
  44717. if($core.assert($5)){
  44718. return $recv($self._parent())._isReferenced();
  44719. }
  44720. return true;
  44721. }, function($ctx1) {$ctx1.fill(self,"isReferenced",{})});
  44722. },
  44723. args: [],
  44724. source: "isReferenced\x0a\x09\x22Answer true if the receiver is referenced by other nodes.\x0a\x09Do not take sequences or assignments into account\x22\x0a\x09\x0a\x09self parent isSequenceNode ifTrue: [ ^ false ].\x0a\x09self parent isAssignmentNode ifTrue: [ ^ false ].\x0a\x09self parent isCascadeNode ifTrue: [ ^ self parent isReferenced ].\x0a\x09\x0a\x09^ true",
  44725. referencedClasses: [],
  44726. pragmas: [],
  44727. messageSends: ["ifTrue:", "isSequenceNode", "parent", "isAssignmentNode", "isCascadeNode", "isReferenced"]
  44728. }),
  44729. $globals.ASTNode);
  44730. $core.addMethod(
  44731. $core.method({
  44732. selector: "subtreeNeedsAliasing",
  44733. protocol: "*Compiler-IR",
  44734. fn: function (){
  44735. var self=this,$self=this;
  44736. return $core.withContext(function($ctx1) {
  44737. return $recv($self._shouldBeAliased())._or_((function(){
  44738. return $core.withContext(function($ctx2) {
  44739. return $recv($self._dagChildren())._anySatisfy_((function(each){
  44740. return $core.withContext(function($ctx3) {
  44741. return $recv(each)._subtreeNeedsAliasing();
  44742. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  44743. }));
  44744. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44745. }));
  44746. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{})});
  44747. },
  44748. args: [],
  44749. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased or: [\x0a\x09\x09self dagChildren anySatisfy: [ :each | each subtreeNeedsAliasing ] ]",
  44750. referencedClasses: [],
  44751. pragmas: [],
  44752. messageSends: ["or:", "shouldBeAliased", "anySatisfy:", "dagChildren", "subtreeNeedsAliasing"]
  44753. }),
  44754. $globals.ASTNode);
  44755. $core.addMethod(
  44756. $core.method({
  44757. selector: "shouldBeAliased",
  44758. protocol: "*Compiler-IR",
  44759. fn: function (){
  44760. var self=this,$self=this;
  44761. return $core.withContext(function($ctx1) {
  44762. var $1;
  44763. $1=(
  44764. $ctx1.supercall = true,
  44765. ($globals.AssignmentNode.superclass||$boot.nilAsClass).fn.prototype._shouldBeAliased.apply($self, []));
  44766. $ctx1.supercall = false;
  44767. return $recv($1)._or_((function(){
  44768. return $core.withContext(function($ctx2) {
  44769. return $self._isReferenced();
  44770. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44771. }));
  44772. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{})});
  44773. },
  44774. args: [],
  44775. source: "shouldBeAliased\x0a\x09^ super shouldBeAliased or: [ self isReferenced ]",
  44776. referencedClasses: [],
  44777. pragmas: [],
  44778. messageSends: ["or:", "shouldBeAliased", "isReferenced"]
  44779. }),
  44780. $globals.AssignmentNode);
  44781. $core.addMethod(
  44782. $core.method({
  44783. selector: "appendToInstruction:",
  44784. protocol: "*Compiler-IR",
  44785. fn: function (anIRInstruction){
  44786. var self=this,$self=this;
  44787. return $core.withContext(function($ctx1) {
  44788. $recv(anIRInstruction)._appendBlock_(self);
  44789. return self;
  44790. }, function($ctx1) {$ctx1.fill(self,"appendToInstruction:",{anIRInstruction:anIRInstruction})});
  44791. },
  44792. args: ["anIRInstruction"],
  44793. source: "appendToInstruction: anIRInstruction\x0a\x09anIRInstruction appendBlock: self",
  44794. referencedClasses: [],
  44795. pragmas: [],
  44796. messageSends: ["appendBlock:"]
  44797. }),
  44798. $globals.BlockClosure);
  44799. $core.addMethod(
  44800. $core.method({
  44801. selector: "subtreeNeedsAliasing",
  44802. protocol: "*Compiler-IR",
  44803. fn: function (){
  44804. var self=this,$self=this;
  44805. return $core.withContext(function($ctx1) {
  44806. return $self._shouldBeAliased();
  44807. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{})});
  44808. },
  44809. args: [],
  44810. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased",
  44811. referencedClasses: [],
  44812. pragmas: [],
  44813. messageSends: ["shouldBeAliased"]
  44814. }),
  44815. $globals.BlockNode);
  44816. $core.addMethod(
  44817. $core.method({
  44818. selector: "subtreeNeedsAliasing",
  44819. protocol: "*Compiler-IR",
  44820. fn: function (){
  44821. var self=this,$self=this;
  44822. return $core.withContext(function($ctx1) {
  44823. return $recv($recv($self._parent())._isSequenceNode())._not();
  44824. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{})});
  44825. },
  44826. args: [],
  44827. source: "subtreeNeedsAliasing\x0a\x09^ self parent isSequenceNode not",
  44828. referencedClasses: [],
  44829. pragmas: [],
  44830. messageSends: ["not", "isSequenceNode", "parent"]
  44831. }),
  44832. $globals.CascadeNode);
  44833. $core.addMethod(
  44834. $core.method({
  44835. selector: "shouldBeAliased",
  44836. protocol: "*Compiler-IR",
  44837. fn: function (){
  44838. var self=this,$self=this;
  44839. var sends;
  44840. return $core.withContext(function($ctx1) {
  44841. var $2,$1;
  44842. sends=$recv($recv($recv($self._method())._sendIndexes())._at_($self._selector()))._size();
  44843. $2=(
  44844. $ctx1.supercall = true,
  44845. ($globals.SendNode.superclass||$boot.nilAsClass).fn.prototype._shouldBeAliased.apply($self, []));
  44846. $ctx1.supercall = false;
  44847. $1=$recv($2)._or_((function(){
  44848. return $core.withContext(function($ctx2) {
  44849. return $recv($self._isReferenced())._and_((function(){
  44850. return $core.withContext(function($ctx3) {
  44851. return $recv($recv($self._index()).__lt(sends))._or_((function(){
  44852. return $core.withContext(function($ctx4) {
  44853. return $self._superSend();
  44854. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  44855. }));
  44856. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  44857. }));
  44858. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44859. }));
  44860. $ctx1.sendIdx["or:"]=1;
  44861. return $1;
  44862. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{sends:sends})});
  44863. },
  44864. args: [],
  44865. source: "shouldBeAliased\x0a\x09\x22Because we keep track of send indexes, some send nodes need additional care for aliasing. \x0a\x09See IRJSVisitor >> visitIRSend:\x22\x0a\x09\x0a\x09| sends |\x0a\x09\x0a\x09sends := (self method sendIndexes at: self selector) size.\x0a\x09\x0a\x09^ (super shouldBeAliased or: [\x0a\x09\x09self isReferenced and: [\x0a\x09\x09\x09self index < sends or: [\x0a\x09\x09\x09\x09self superSend ] ] ])",
  44866. referencedClasses: [],
  44867. pragmas: [],
  44868. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "or:", "shouldBeAliased", "and:", "isReferenced", "<", "index", "superSend"]
  44869. }),
  44870. $globals.SendNode);
  44871. $core.addMethod(
  44872. $core.method({
  44873. selector: "subtreeNeedsAliasing",
  44874. protocol: "*Compiler-IR",
  44875. fn: function (){
  44876. var self=this,$self=this;
  44877. return $core.withContext(function($ctx1) {
  44878. return $recv($self._shouldBeInlined())._or_((function(){
  44879. return $core.withContext(function($ctx2) {
  44880. return (
  44881. $ctx2.supercall = true,
  44882. ($globals.SendNode.superclass||$boot.nilAsClass).fn.prototype._subtreeNeedsAliasing.apply($self, []));
  44883. $ctx2.supercall = false;
  44884. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44885. }));
  44886. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{})});
  44887. },
  44888. args: [],
  44889. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeInlined or: [ super subtreeNeedsAliasing ]",
  44890. referencedClasses: [],
  44891. pragmas: [],
  44892. messageSends: ["or:", "shouldBeInlined", "subtreeNeedsAliasing"]
  44893. }),
  44894. $globals.SendNode);
  44895. });
  44896. 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";
  44897. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  44898. var $pkg = $core.addPackage("Compiler-Inlining");
  44899. $pkg.innerEval = function (expr) { return eval(expr); };
  44900. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  44901. $core.addClass("ASTPreInliner", $globals.NodeVisitor, [], "Compiler-Inlining");
  44902. $core.addMethod(
  44903. $core.method({
  44904. selector: "visitSendNode:",
  44905. protocol: "visiting",
  44906. fn: function (aNode){
  44907. var self=this,$self=this;
  44908. return $core.withContext(function($ctx1) {
  44909. var $1,$2,$3,$4,$receiver;
  44910. $1=$recv(aNode)._superSend();
  44911. if(!$core.assert($1)){
  44912. $2=$recv($recv($globals.IRSendInliner)._inlinedSelectors())._includes_($recv(aNode)._selector());
  44913. if($core.assert($2)){
  44914. $recv(aNode)._shouldBeInlined_(true);
  44915. $3=$recv(aNode)._receiver();
  44916. if(($receiver = $3) == null || $receiver.a$nil){
  44917. $3;
  44918. } else {
  44919. var receiver;
  44920. receiver=$receiver;
  44921. $recv(receiver)._shouldBeAliased_(true);
  44922. }
  44923. }
  44924. }
  44925. $4=(
  44926. $ctx1.supercall = true,
  44927. ($globals.ASTPreInliner.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  44928. $ctx1.supercall = false;
  44929. return $4;
  44930. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode})});
  44931. },
  44932. args: ["aNode"],
  44933. source: "visitSendNode: aNode\x0a\x0a\x09aNode superSend ifFalse: [ \x0a\x09\x09(IRSendInliner inlinedSelectors includes: aNode selector) ifTrue: [\x0a\x09\x09\x09aNode shouldBeInlined: true.\x0a\x09\x09\x09aNode receiver ifNotNil: [ :receiver |\x0a\x09\x09\x09\x09receiver shouldBeAliased: true ] ] ].\x0a\x0a\x09^ super visitSendNode: aNode",
  44934. referencedClasses: ["IRSendInliner"],
  44935. pragmas: [],
  44936. messageSends: ["ifFalse:", "superSend", "ifTrue:", "includes:", "inlinedSelectors", "selector", "shouldBeInlined:", "ifNotNil:", "receiver", "shouldBeAliased:", "visitSendNode:"]
  44937. }),
  44938. $globals.ASTPreInliner);
  44939. $core.addClass("IRInlinedClosure", $globals.IRClosure, [], "Compiler-Inlining");
  44940. $globals.IRInlinedClosure.comment="I represent an inlined closure instruction.";
  44941. $core.addMethod(
  44942. $core.method({
  44943. selector: "acceptDagVisitor:",
  44944. protocol: "visiting",
  44945. fn: function (aVisitor){
  44946. var self=this,$self=this;
  44947. return $core.withContext(function($ctx1) {
  44948. $recv(aVisitor)._visitIRInlinedClosure_(self);
  44949. return self;
  44950. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  44951. },
  44952. args: ["aVisitor"],
  44953. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedClosure: self",
  44954. referencedClasses: [],
  44955. pragmas: [],
  44956. messageSends: ["visitIRInlinedClosure:"]
  44957. }),
  44958. $globals.IRInlinedClosure);
  44959. $core.addMethod(
  44960. $core.method({
  44961. selector: "isInlined",
  44962. protocol: "testing",
  44963. fn: function (){
  44964. var self=this,$self=this;
  44965. return true;
  44966. },
  44967. args: [],
  44968. source: "isInlined\x0a\x09^ true",
  44969. referencedClasses: [],
  44970. pragmas: [],
  44971. messageSends: []
  44972. }),
  44973. $globals.IRInlinedClosure);
  44974. $core.addClass("IRInlinedSend", $globals.IRSend, [], "Compiler-Inlining");
  44975. $globals.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions.";
  44976. $core.addMethod(
  44977. $core.method({
  44978. selector: "acceptDagVisitor:",
  44979. protocol: "visiting",
  44980. fn: function (aVisitor){
  44981. var self=this,$self=this;
  44982. return $core.withContext(function($ctx1) {
  44983. $recv(aVisitor)._visitInlinedSend_(self);
  44984. return self;
  44985. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  44986. },
  44987. args: ["aVisitor"],
  44988. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitInlinedSend: self",
  44989. referencedClasses: [],
  44990. pragmas: [],
  44991. messageSends: ["visitInlinedSend:"]
  44992. }),
  44993. $globals.IRInlinedSend);
  44994. $core.addMethod(
  44995. $core.method({
  44996. selector: "internalVariables",
  44997. protocol: "accessing",
  44998. fn: function (){
  44999. var self=this,$self=this;
  45000. return [];
  45001. },
  45002. args: [],
  45003. source: "internalVariables\x0a\x09\x22Answer a collection of internal variables required \x0a\x09to perform the inlining\x22\x0a\x09\x0a\x09^ #()",
  45004. referencedClasses: [],
  45005. pragmas: [],
  45006. messageSends: []
  45007. }),
  45008. $globals.IRInlinedSend);
  45009. $core.addMethod(
  45010. $core.method({
  45011. selector: "isInlined",
  45012. protocol: "testing",
  45013. fn: function (){
  45014. var self=this,$self=this;
  45015. return true;
  45016. },
  45017. args: [],
  45018. source: "isInlined\x0a\x09^ true",
  45019. referencedClasses: [],
  45020. pragmas: [],
  45021. messageSends: []
  45022. }),
  45023. $globals.IRInlinedSend);
  45024. $core.addClass("IRInlinedIfFalse", $globals.IRInlinedSend, [], "Compiler-Inlining");
  45025. $globals.IRInlinedIfFalse.comment="I represent an inlined `#ifFalse:` message send instruction.";
  45026. $core.addMethod(
  45027. $core.method({
  45028. selector: "acceptDagVisitor:",
  45029. protocol: "visiting",
  45030. fn: function (aVisitor){
  45031. var self=this,$self=this;
  45032. return $core.withContext(function($ctx1) {
  45033. $recv(aVisitor)._visitIRInlinedIfFalse_(self);
  45034. return self;
  45035. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  45036. },
  45037. args: ["aVisitor"],
  45038. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfFalse: self",
  45039. referencedClasses: [],
  45040. pragmas: [],
  45041. messageSends: ["visitIRInlinedIfFalse:"]
  45042. }),
  45043. $globals.IRInlinedIfFalse);
  45044. $core.addClass("IRInlinedIfNilIfNotNil", $globals.IRInlinedSend, [], "Compiler-Inlining");
  45045. $globals.IRInlinedIfNilIfNotNil.comment="I represent an inlined `#ifNil:ifNotNil:` message send instruction.";
  45046. $core.addMethod(
  45047. $core.method({
  45048. selector: "acceptDagVisitor:",
  45049. protocol: "visiting",
  45050. fn: function (aVisitor){
  45051. var self=this,$self=this;
  45052. return $core.withContext(function($ctx1) {
  45053. $recv(aVisitor)._visitIRInlinedIfNilIfNotNil_(self);
  45054. return self;
  45055. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  45056. },
  45057. args: ["aVisitor"],
  45058. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfNilIfNotNil: self",
  45059. referencedClasses: [],
  45060. pragmas: [],
  45061. messageSends: ["visitIRInlinedIfNilIfNotNil:"]
  45062. }),
  45063. $globals.IRInlinedIfNilIfNotNil);
  45064. $core.addMethod(
  45065. $core.method({
  45066. selector: "internalVariables",
  45067. protocol: "accessing",
  45068. fn: function (){
  45069. var self=this,$self=this;
  45070. return $core.withContext(function($ctx1) {
  45071. return $recv($globals.Array)._with_($self._receiverInternalVariable());
  45072. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{})});
  45073. },
  45074. args: [],
  45075. source: "internalVariables\x0a\x09^ Array with: self receiverInternalVariable",
  45076. referencedClasses: ["Array"],
  45077. pragmas: [],
  45078. messageSends: ["with:", "receiverInternalVariable"]
  45079. }),
  45080. $globals.IRInlinedIfNilIfNotNil);
  45081. $core.addMethod(
  45082. $core.method({
  45083. selector: "receiverInternalVariable",
  45084. protocol: "accessing",
  45085. fn: function (){
  45086. var self=this,$self=this;
  45087. return $core.withContext(function($ctx1) {
  45088. var $1;
  45089. $1=$recv($globals.IRVariable)._new();
  45090. $ctx1.sendIdx["new"]=1;
  45091. $recv($1)._variable_($recv($recv($globals.AliasVar)._new())._name_($self._receiverInternalVariableName()));
  45092. return $recv($1)._yourself();
  45093. }, function($ctx1) {$ctx1.fill(self,"receiverInternalVariable",{})});
  45094. },
  45095. args: [],
  45096. source: "receiverInternalVariable\x0a\x09^ IRVariable new\x0a\x09\x09variable: (AliasVar new name: self receiverInternalVariableName);\x0a\x09\x09yourself.",
  45097. referencedClasses: ["IRVariable", "AliasVar"],
  45098. pragmas: [],
  45099. messageSends: ["variable:", "new", "name:", "receiverInternalVariableName", "yourself"]
  45100. }),
  45101. $globals.IRInlinedIfNilIfNotNil);
  45102. $core.addMethod(
  45103. $core.method({
  45104. selector: "receiverInternalVariableName",
  45105. protocol: "accessing",
  45106. fn: function (){
  45107. var self=this,$self=this;
  45108. return "$receiver";
  45109. },
  45110. args: [],
  45111. source: "receiverInternalVariableName\x0a\x09^ '$receiver'",
  45112. referencedClasses: [],
  45113. pragmas: [],
  45114. messageSends: []
  45115. }),
  45116. $globals.IRInlinedIfNilIfNotNil);
  45117. $core.addClass("IRInlinedIfTrue", $globals.IRInlinedSend, [], "Compiler-Inlining");
  45118. $globals.IRInlinedIfTrue.comment="I represent an inlined `#ifTrue:` message send instruction.";
  45119. $core.addMethod(
  45120. $core.method({
  45121. selector: "acceptDagVisitor:",
  45122. protocol: "visiting",
  45123. fn: function (aVisitor){
  45124. var self=this,$self=this;
  45125. return $core.withContext(function($ctx1) {
  45126. $recv(aVisitor)._visitIRInlinedIfTrue_(self);
  45127. return self;
  45128. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  45129. },
  45130. args: ["aVisitor"],
  45131. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrue: self",
  45132. referencedClasses: [],
  45133. pragmas: [],
  45134. messageSends: ["visitIRInlinedIfTrue:"]
  45135. }),
  45136. $globals.IRInlinedIfTrue);
  45137. $core.addClass("IRInlinedIfTrueIfFalse", $globals.IRInlinedSend, [], "Compiler-Inlining");
  45138. $globals.IRInlinedIfTrueIfFalse.comment="I represent an inlined `#ifTrue:ifFalse:` message send instruction.";
  45139. $core.addMethod(
  45140. $core.method({
  45141. selector: "acceptDagVisitor:",
  45142. protocol: "visiting",
  45143. fn: function (aVisitor){
  45144. var self=this,$self=this;
  45145. return $core.withContext(function($ctx1) {
  45146. $recv(aVisitor)._visitIRInlinedIfTrueIfFalse_(self);
  45147. return self;
  45148. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  45149. },
  45150. args: ["aVisitor"],
  45151. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrueIfFalse: self",
  45152. referencedClasses: [],
  45153. pragmas: [],
  45154. messageSends: ["visitIRInlinedIfTrueIfFalse:"]
  45155. }),
  45156. $globals.IRInlinedIfTrueIfFalse);
  45157. $core.addClass("IRInlinedSequence", $globals.IRBlockSequence, [], "Compiler-Inlining");
  45158. $globals.IRInlinedSequence.comment="I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`).";
  45159. $core.addMethod(
  45160. $core.method({
  45161. selector: "acceptDagVisitor:",
  45162. protocol: "visiting",
  45163. fn: function (aVisitor){
  45164. var self=this,$self=this;
  45165. return $core.withContext(function($ctx1) {
  45166. $recv(aVisitor)._visitIRInlinedSequence_(self);
  45167. return self;
  45168. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  45169. },
  45170. args: ["aVisitor"],
  45171. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedSequence: self",
  45172. referencedClasses: [],
  45173. pragmas: [],
  45174. messageSends: ["visitIRInlinedSequence:"]
  45175. }),
  45176. $globals.IRInlinedSequence);
  45177. $core.addMethod(
  45178. $core.method({
  45179. selector: "isInlined",
  45180. protocol: "testing",
  45181. fn: function (){
  45182. var self=this,$self=this;
  45183. return true;
  45184. },
  45185. args: [],
  45186. source: "isInlined\x0a\x09^ true",
  45187. referencedClasses: [],
  45188. pragmas: [],
  45189. messageSends: []
  45190. }),
  45191. $globals.IRInlinedSequence);
  45192. $core.addClass("IRInliner", $globals.IRVisitor, [], "Compiler-Inlining");
  45193. $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`";
  45194. $core.addMethod(
  45195. $core.method({
  45196. selector: "assignmentInliner",
  45197. protocol: "factory",
  45198. fn: function (){
  45199. var self=this,$self=this;
  45200. return $core.withContext(function($ctx1) {
  45201. var $1;
  45202. $1=$recv($globals.IRAssignmentInliner)._new();
  45203. $recv($1)._translator_(self);
  45204. return $recv($1)._yourself();
  45205. }, function($ctx1) {$ctx1.fill(self,"assignmentInliner",{})});
  45206. },
  45207. args: [],
  45208. source: "assignmentInliner\x0a\x09^ IRAssignmentInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  45209. referencedClasses: ["IRAssignmentInliner"],
  45210. pragmas: [],
  45211. messageSends: ["translator:", "new", "yourself"]
  45212. }),
  45213. $globals.IRInliner);
  45214. $core.addMethod(
  45215. $core.method({
  45216. selector: "returnInliner",
  45217. protocol: "factory",
  45218. fn: function (){
  45219. var self=this,$self=this;
  45220. return $core.withContext(function($ctx1) {
  45221. var $1;
  45222. $1=$recv($globals.IRReturnInliner)._new();
  45223. $recv($1)._translator_(self);
  45224. return $recv($1)._yourself();
  45225. }, function($ctx1) {$ctx1.fill(self,"returnInliner",{})});
  45226. },
  45227. args: [],
  45228. source: "returnInliner\x0a\x09^ IRReturnInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  45229. referencedClasses: ["IRReturnInliner"],
  45230. pragmas: [],
  45231. messageSends: ["translator:", "new", "yourself"]
  45232. }),
  45233. $globals.IRInliner);
  45234. $core.addMethod(
  45235. $core.method({
  45236. selector: "sendInliner",
  45237. protocol: "factory",
  45238. fn: function (){
  45239. var self=this,$self=this;
  45240. return $core.withContext(function($ctx1) {
  45241. var $1;
  45242. $1=$recv($globals.IRSendInliner)._new();
  45243. $recv($1)._translator_(self);
  45244. return $recv($1)._yourself();
  45245. }, function($ctx1) {$ctx1.fill(self,"sendInliner",{})});
  45246. },
  45247. args: [],
  45248. source: "sendInliner\x0a\x09^ IRSendInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  45249. referencedClasses: ["IRSendInliner"],
  45250. pragmas: [],
  45251. messageSends: ["translator:", "new", "yourself"]
  45252. }),
  45253. $globals.IRInliner);
  45254. $core.addMethod(
  45255. $core.method({
  45256. selector: "shouldInlineAssignment:",
  45257. protocol: "testing",
  45258. fn: function (anIRAssignment){
  45259. var self=this,$self=this;
  45260. return $core.withContext(function($ctx1) {
  45261. var $3,$2,$1;
  45262. $1=$recv($recv($recv(anIRAssignment)._isInlined())._not())._and_((function(){
  45263. return $core.withContext(function($ctx2) {
  45264. $3=$recv(anIRAssignment)._right();
  45265. $ctx2.sendIdx["right"]=1;
  45266. $2=$recv($3)._isSend();
  45267. return $recv($2)._and_((function(){
  45268. return $core.withContext(function($ctx3) {
  45269. return $self._shouldInlineSend_($recv(anIRAssignment)._right());
  45270. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  45271. }));
  45272. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45273. }));
  45274. $ctx1.sendIdx["and:"]=1;
  45275. return $1;
  45276. }, function($ctx1) {$ctx1.fill(self,"shouldInlineAssignment:",{anIRAssignment:anIRAssignment})});
  45277. },
  45278. args: ["anIRAssignment"],
  45279. source: "shouldInlineAssignment: anIRAssignment\x0a\x09^ anIRAssignment isInlined not and: [\x0a\x09\x09anIRAssignment right isSend and: [\x0a\x09\x09\x09self shouldInlineSend: anIRAssignment right ]]",
  45280. referencedClasses: [],
  45281. pragmas: [],
  45282. messageSends: ["and:", "not", "isInlined", "isSend", "right", "shouldInlineSend:"]
  45283. }),
  45284. $globals.IRInliner);
  45285. $core.addMethod(
  45286. $core.method({
  45287. selector: "shouldInlineReturn:",
  45288. protocol: "testing",
  45289. fn: function (anIRReturn){
  45290. var self=this,$self=this;
  45291. return $core.withContext(function($ctx1) {
  45292. var $3,$2,$1;
  45293. $1=$recv($recv($recv(anIRReturn)._isInlined())._not())._and_((function(){
  45294. return $core.withContext(function($ctx2) {
  45295. $3=$recv(anIRReturn)._expression();
  45296. $ctx2.sendIdx["expression"]=1;
  45297. $2=$recv($3)._isSend();
  45298. return $recv($2)._and_((function(){
  45299. return $core.withContext(function($ctx3) {
  45300. return $self._shouldInlineSend_($recv(anIRReturn)._expression());
  45301. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  45302. }));
  45303. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45304. }));
  45305. $ctx1.sendIdx["and:"]=1;
  45306. return $1;
  45307. }, function($ctx1) {$ctx1.fill(self,"shouldInlineReturn:",{anIRReturn:anIRReturn})});
  45308. },
  45309. args: ["anIRReturn"],
  45310. source: "shouldInlineReturn: anIRReturn\x0a\x09^ anIRReturn isInlined not and: [\x0a\x09\x09anIRReturn expression isSend and: [\x0a\x09\x09\x09self shouldInlineSend: anIRReturn expression ]]",
  45311. referencedClasses: [],
  45312. pragmas: [],
  45313. messageSends: ["and:", "not", "isInlined", "isSend", "expression", "shouldInlineSend:"]
  45314. }),
  45315. $globals.IRInliner);
  45316. $core.addMethod(
  45317. $core.method({
  45318. selector: "shouldInlineSend:",
  45319. protocol: "testing",
  45320. fn: function (anIRSend){
  45321. var self=this,$self=this;
  45322. return $core.withContext(function($ctx1) {
  45323. return $recv($recv($recv(anIRSend)._isInlined())._not())._and_((function(){
  45324. return $core.withContext(function($ctx2) {
  45325. return $recv($globals.IRSendInliner)._shouldInline_(anIRSend);
  45326. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45327. }));
  45328. }, function($ctx1) {$ctx1.fill(self,"shouldInlineSend:",{anIRSend:anIRSend})});
  45329. },
  45330. args: ["anIRSend"],
  45331. source: "shouldInlineSend: anIRSend\x0a\x09^ anIRSend isInlined not and: [\x0a\x09\x09IRSendInliner shouldInline: anIRSend ]",
  45332. referencedClasses: ["IRSendInliner"],
  45333. pragmas: [],
  45334. messageSends: ["and:", "not", "isInlined", "shouldInline:"]
  45335. }),
  45336. $globals.IRInliner);
  45337. $core.addMethod(
  45338. $core.method({
  45339. selector: "visitIRAssignment:",
  45340. protocol: "visiting",
  45341. fn: function (anIRAssignment){
  45342. var self=this,$self=this;
  45343. return $core.withContext(function($ctx1) {
  45344. var $1;
  45345. $1=$self._shouldInlineAssignment_(anIRAssignment);
  45346. if($core.assert($1)){
  45347. return $recv($self._assignmentInliner())._inlineAssignment_(anIRAssignment);
  45348. } else {
  45349. return (
  45350. $ctx1.supercall = true,
  45351. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRAssignment_.apply($self, [anIRAssignment]));
  45352. $ctx1.supercall = false;
  45353. }
  45354. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment})});
  45355. },
  45356. args: ["anIRAssignment"],
  45357. source: "visitIRAssignment: anIRAssignment\x0a\x09^ (self shouldInlineAssignment: anIRAssignment)\x0a\x09\x09ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]\x0a\x09\x09ifFalse: [ super visitIRAssignment: anIRAssignment ]",
  45358. referencedClasses: [],
  45359. pragmas: [],
  45360. messageSends: ["ifTrue:ifFalse:", "shouldInlineAssignment:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:"]
  45361. }),
  45362. $globals.IRInliner);
  45363. $core.addMethod(
  45364. $core.method({
  45365. selector: "visitIRNonLocalReturn:",
  45366. protocol: "visiting",
  45367. fn: function (anIRNonLocalReturn){
  45368. var self=this,$self=this;
  45369. var localReturn;
  45370. return $core.withContext(function($ctx1) {
  45371. var $2,$1,$4,$3,$5,$6,$7;
  45372. $2=$recv(anIRNonLocalReturn)._scope();
  45373. $ctx1.sendIdx["scope"]=1;
  45374. $1=$recv($2)._canInlineNonLocalReturns();
  45375. if($core.assert($1)){
  45376. $4=$recv(anIRNonLocalReturn)._scope();
  45377. $ctx1.sendIdx["scope"]=2;
  45378. $3=$recv($4)._methodScope();
  45379. $5=$recv(anIRNonLocalReturn)._scope();
  45380. $ctx1.sendIdx["scope"]=3;
  45381. $recv($3)._removeNonLocalReturn_($5);
  45382. $6=$recv($globals.IRReturn)._new();
  45383. $recv($6)._scope_($recv(anIRNonLocalReturn)._scope());
  45384. localReturn=$recv($6)._yourself();
  45385. $recv($recv(anIRNonLocalReturn)._dagChildren())._do_((function(each){
  45386. return $core.withContext(function($ctx2) {
  45387. return $recv(localReturn)._add_(each);
  45388. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  45389. }));
  45390. $recv(anIRNonLocalReturn)._replaceWith_(localReturn);
  45391. return $self._visitIRReturn_(localReturn);
  45392. }
  45393. $7=(
  45394. $ctx1.supercall = true,
  45395. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRNonLocalReturn_.apply($self, [anIRNonLocalReturn]));
  45396. $ctx1.supercall = false;
  45397. return $7;
  45398. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn,localReturn:localReturn})});
  45399. },
  45400. args: ["anIRNonLocalReturn"],
  45401. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09| localReturn |\x0a\x09anIRNonLocalReturn scope canInlineNonLocalReturns ifTrue: [\x0a\x09\x09anIRNonLocalReturn scope methodScope removeNonLocalReturn: anIRNonLocalReturn scope.\x0a\x09\x09localReturn := IRReturn new\x0a\x09\x09\x09scope: anIRNonLocalReturn scope;\x0a\x09\x09\x09yourself.\x0a\x09\x09anIRNonLocalReturn dagChildren do: [ :each |\x0a\x09\x09\x09localReturn add: each ].\x0a\x09\x09anIRNonLocalReturn replaceWith: localReturn.\x0a\x09\x09^ self visitIRReturn: localReturn ].\x0a\x09^ super visitIRNonLocalReturn: anIRNonLocalReturn",
  45402. referencedClasses: ["IRReturn"],
  45403. pragmas: [],
  45404. messageSends: ["ifTrue:", "canInlineNonLocalReturns", "scope", "removeNonLocalReturn:", "methodScope", "scope:", "new", "yourself", "do:", "dagChildren", "add:", "replaceWith:", "visitIRReturn:", "visitIRNonLocalReturn:"]
  45405. }),
  45406. $globals.IRInliner);
  45407. $core.addMethod(
  45408. $core.method({
  45409. selector: "visitIRReturn:",
  45410. protocol: "visiting",
  45411. fn: function (anIRReturn){
  45412. var self=this,$self=this;
  45413. return $core.withContext(function($ctx1) {
  45414. var $1;
  45415. $1=$self._shouldInlineReturn_(anIRReturn);
  45416. if($core.assert($1)){
  45417. return $recv($self._returnInliner())._inlineReturn_(anIRReturn);
  45418. } else {
  45419. return (
  45420. $ctx1.supercall = true,
  45421. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRReturn_.apply($self, [anIRReturn]));
  45422. $ctx1.supercall = false;
  45423. }
  45424. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn})});
  45425. },
  45426. args: ["anIRReturn"],
  45427. source: "visitIRReturn: anIRReturn\x0a\x09^ (self shouldInlineReturn: anIRReturn)\x0a\x09\x09ifTrue: [ self returnInliner inlineReturn: anIRReturn ]\x0a\x09\x09ifFalse: [ super visitIRReturn: anIRReturn ]",
  45428. referencedClasses: [],
  45429. pragmas: [],
  45430. messageSends: ["ifTrue:ifFalse:", "shouldInlineReturn:", "inlineReturn:", "returnInliner", "visitIRReturn:"]
  45431. }),
  45432. $globals.IRInliner);
  45433. $core.addMethod(
  45434. $core.method({
  45435. selector: "visitIRSend:",
  45436. protocol: "visiting",
  45437. fn: function (anIRSend){
  45438. var self=this,$self=this;
  45439. return $core.withContext(function($ctx1) {
  45440. var $1;
  45441. $1=$self._shouldInlineSend_(anIRSend);
  45442. if($core.assert($1)){
  45443. return $recv($self._sendInliner())._inlineSend_(anIRSend);
  45444. } else {
  45445. return (
  45446. $ctx1.supercall = true,
  45447. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRSend_.apply($self, [anIRSend]));
  45448. $ctx1.supercall = false;
  45449. }
  45450. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend})});
  45451. },
  45452. args: ["anIRSend"],
  45453. source: "visitIRSend: anIRSend\x0a\x09^ (self shouldInlineSend: anIRSend)\x0a\x09\x09ifTrue: [ self sendInliner inlineSend: anIRSend ]\x0a\x09\x09ifFalse: [ super visitIRSend: anIRSend ]",
  45454. referencedClasses: [],
  45455. pragmas: [],
  45456. messageSends: ["ifTrue:ifFalse:", "shouldInlineSend:", "inlineSend:", "sendInliner", "visitIRSend:"]
  45457. }),
  45458. $globals.IRInliner);
  45459. $core.addClass("IRInliningJSTranslator", $globals.IRJSTranslator, [], "Compiler-Inlining");
  45460. $globals.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance).";
  45461. $core.addMethod(
  45462. $core.method({
  45463. selector: "visitIRInlinedClosure:",
  45464. protocol: "visiting",
  45465. fn: function (anIRInlinedClosure){
  45466. var self=this,$self=this;
  45467. return $core.withContext(function($ctx1) {
  45468. $recv($self._stream())._nextPutVars_($recv($recv(anIRInlinedClosure)._tempDeclarations())._collect_((function(each){
  45469. return $core.withContext(function($ctx2) {
  45470. return $recv($recv(each)._name())._asVariableName();
  45471. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  45472. })));
  45473. $self._visitAll_($recv(anIRInlinedClosure)._dagChildren());
  45474. return self;
  45475. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure})});
  45476. },
  45477. args: ["anIRInlinedClosure"],
  45478. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09self stream nextPutVars: (anIRInlinedClosure tempDeclarations collect: [ :each |\x0a\x09\x09each name asVariableName ]).\x0a\x09self visitAll: anIRInlinedClosure dagChildren",
  45479. referencedClasses: [],
  45480. pragmas: [],
  45481. messageSends: ["nextPutVars:", "stream", "collect:", "tempDeclarations", "asVariableName", "name", "visitAll:", "dagChildren"]
  45482. }),
  45483. $globals.IRInliningJSTranslator);
  45484. $core.addMethod(
  45485. $core.method({
  45486. selector: "visitIRInlinedIfFalse:",
  45487. protocol: "visiting",
  45488. fn: function (anIRInlinedIfFalse){
  45489. var self=this,$self=this;
  45490. return $core.withContext(function($ctx1) {
  45491. var $1,$2,$4,$3;
  45492. $1=$self._stream();
  45493. $ctx1.sendIdx["stream"]=1;
  45494. $recv($1)._nextPutIf_then_((function(){
  45495. return $core.withContext(function($ctx2) {
  45496. $2=$self._stream();
  45497. $ctx2.sendIdx["stream"]=2;
  45498. $recv($2)._nextPutAll_("!$core.assert(");
  45499. $ctx2.sendIdx["nextPutAll:"]=1;
  45500. $4=$recv(anIRInlinedIfFalse)._dagChildren();
  45501. $ctx2.sendIdx["dagChildren"]=1;
  45502. $3=$recv($4)._first();
  45503. $self._visit_($3);
  45504. $ctx2.sendIdx["visit:"]=1;
  45505. return $recv($self._stream())._nextPutAll_(")");
  45506. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45507. }),(function(){
  45508. return $core.withContext(function($ctx2) {
  45509. return $self._visit_($recv($recv(anIRInlinedIfFalse)._dagChildren())._last());
  45510. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45511. }));
  45512. return self;
  45513. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfFalse:",{anIRInlinedIfFalse:anIRInlinedIfFalse})});
  45514. },
  45515. args: ["anIRInlinedIfFalse"],
  45516. 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 ]",
  45517. referencedClasses: [],
  45518. pragmas: [],
  45519. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "last"]
  45520. }),
  45521. $globals.IRInliningJSTranslator);
  45522. $core.addMethod(
  45523. $core.method({
  45524. selector: "visitIRInlinedIfNilIfNotNil:",
  45525. protocol: "visiting",
  45526. fn: function (anIRInlinedIfNilIfNotNil){
  45527. var self=this,$self=this;
  45528. return $core.withContext(function($ctx1) {
  45529. var $1,$2,$4,$3,$6,$5,$7,$8,$10,$9;
  45530. $1=$self._stream();
  45531. $ctx1.sendIdx["stream"]=1;
  45532. $recv($1)._nextPutIf_then_else_((function(){
  45533. var recvVarName;
  45534. return $core.withContext(function($ctx2) {
  45535. recvVarName=$recv(anIRInlinedIfNilIfNotNil)._receiverInternalVariableName();
  45536. $2=$self._stream();
  45537. $ctx2.sendIdx["stream"]=2;
  45538. $4="(".__comma(recvVarName);
  45539. $ctx2.sendIdx[","]=2;
  45540. $3=$recv($4).__comma(" = ");
  45541. $ctx2.sendIdx[","]=1;
  45542. $recv($2)._nextPutAll_($3);
  45543. $ctx2.sendIdx["nextPutAll:"]=1;
  45544. $6=$recv(anIRInlinedIfNilIfNotNil)._dagChildren();
  45545. $ctx2.sendIdx["dagChildren"]=1;
  45546. $5=$recv($6)._first();
  45547. $self._visit_($5);
  45548. $ctx2.sendIdx["visit:"]=1;
  45549. $7=$self._stream();
  45550. $8=$recv(") == null || ".__comma(recvVarName)).__comma(".a$nil");
  45551. $ctx2.sendIdx[","]=3;
  45552. return $recv($7)._nextPutAll_($8);
  45553. }, function($ctx2) {$ctx2.fillBlock({recvVarName:recvVarName},$ctx1,1)});
  45554. }),(function(){
  45555. return $core.withContext(function($ctx2) {
  45556. $10=$recv(anIRInlinedIfNilIfNotNil)._dagChildren();
  45557. $ctx2.sendIdx["dagChildren"]=2;
  45558. $9=$recv($10)._second();
  45559. return $self._visit_($9);
  45560. $ctx2.sendIdx["visit:"]=2;
  45561. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45562. }),(function(){
  45563. return $core.withContext(function($ctx2) {
  45564. return $self._visit_($recv($recv(anIRInlinedIfNilIfNotNil)._dagChildren())._third());
  45565. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  45566. }));
  45567. return self;
  45568. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNilIfNotNil:",{anIRInlinedIfNilIfNotNil:anIRInlinedIfNilIfNotNil})});
  45569. },
  45570. args: ["anIRInlinedIfNilIfNotNil"],
  45571. source: "visitIRInlinedIfNilIfNotNil: anIRInlinedIfNilIfNotNil\x0a\x09self stream\x0a\x09\x09nextPutIf: [\x0a\x09\x09\x09| recvVarName |\x0a\x09\x09\x09recvVarName := anIRInlinedIfNilIfNotNil receiverInternalVariableName.\x0a\x09\x09\x09self stream nextPutAll: '(', recvVarName, ' = '.\x0a\x09\x09\x09self visit: anIRInlinedIfNilIfNotNil dagChildren first.\x0a\x09\x09\x09self stream nextPutAll: ') == null || ', recvVarName, '.a$nil' ]\x0a\x09\x09then: [ self visit: anIRInlinedIfNilIfNotNil dagChildren second ]\x0a\x09\x09else: [ self visit: anIRInlinedIfNilIfNotNil dagChildren third ]",
  45572. referencedClasses: [],
  45573. pragmas: [],
  45574. messageSends: ["nextPutIf:then:else:", "stream", "receiverInternalVariableName", "nextPutAll:", ",", "visit:", "first", "dagChildren", "second", "third"]
  45575. }),
  45576. $globals.IRInliningJSTranslator);
  45577. $core.addMethod(
  45578. $core.method({
  45579. selector: "visitIRInlinedIfTrue:",
  45580. protocol: "visiting",
  45581. fn: function (anIRInlinedIfTrue){
  45582. var self=this,$self=this;
  45583. return $core.withContext(function($ctx1) {
  45584. var $1,$2,$4,$3;
  45585. $1=$self._stream();
  45586. $ctx1.sendIdx["stream"]=1;
  45587. $recv($1)._nextPutIf_then_((function(){
  45588. return $core.withContext(function($ctx2) {
  45589. $2=$self._stream();
  45590. $ctx2.sendIdx["stream"]=2;
  45591. $recv($2)._nextPutAll_("$core.assert(");
  45592. $ctx2.sendIdx["nextPutAll:"]=1;
  45593. $4=$recv(anIRInlinedIfTrue)._dagChildren();
  45594. $ctx2.sendIdx["dagChildren"]=1;
  45595. $3=$recv($4)._first();
  45596. $self._visit_($3);
  45597. $ctx2.sendIdx["visit:"]=1;
  45598. return $recv($self._stream())._nextPutAll_(")");
  45599. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45600. }),(function(){
  45601. return $core.withContext(function($ctx2) {
  45602. return $self._visit_($recv($recv(anIRInlinedIfTrue)._dagChildren())._last());
  45603. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45604. }));
  45605. return self;
  45606. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrue:",{anIRInlinedIfTrue:anIRInlinedIfTrue})});
  45607. },
  45608. args: ["anIRInlinedIfTrue"],
  45609. 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 ]",
  45610. referencedClasses: [],
  45611. pragmas: [],
  45612. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "last"]
  45613. }),
  45614. $globals.IRInliningJSTranslator);
  45615. $core.addMethod(
  45616. $core.method({
  45617. selector: "visitIRInlinedIfTrueIfFalse:",
  45618. protocol: "visiting",
  45619. fn: function (anIRInlinedIfTrueIfFalse){
  45620. var self=this,$self=this;
  45621. return $core.withContext(function($ctx1) {
  45622. var $1,$2,$4,$3,$6,$5;
  45623. $1=$self._stream();
  45624. $ctx1.sendIdx["stream"]=1;
  45625. $recv($1)._nextPutIf_then_else_((function(){
  45626. return $core.withContext(function($ctx2) {
  45627. $2=$self._stream();
  45628. $ctx2.sendIdx["stream"]=2;
  45629. $recv($2)._nextPutAll_("$core.assert(");
  45630. $ctx2.sendIdx["nextPutAll:"]=1;
  45631. $4=$recv(anIRInlinedIfTrueIfFalse)._dagChildren();
  45632. $ctx2.sendIdx["dagChildren"]=1;
  45633. $3=$recv($4)._first();
  45634. $self._visit_($3);
  45635. $ctx2.sendIdx["visit:"]=1;
  45636. return $recv($self._stream())._nextPutAll_(")");
  45637. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45638. }),(function(){
  45639. return $core.withContext(function($ctx2) {
  45640. $6=$recv(anIRInlinedIfTrueIfFalse)._dagChildren();
  45641. $ctx2.sendIdx["dagChildren"]=2;
  45642. $5=$recv($6)._second();
  45643. return $self._visit_($5);
  45644. $ctx2.sendIdx["visit:"]=2;
  45645. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45646. }),(function(){
  45647. return $core.withContext(function($ctx2) {
  45648. return $self._visit_($recv($recv(anIRInlinedIfTrueIfFalse)._dagChildren())._third());
  45649. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  45650. }));
  45651. return self;
  45652. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrueIfFalse:",{anIRInlinedIfTrueIfFalse:anIRInlinedIfTrueIfFalse})});
  45653. },
  45654. args: ["anIRInlinedIfTrueIfFalse"],
  45655. 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 ]",
  45656. referencedClasses: [],
  45657. pragmas: [],
  45658. messageSends: ["nextPutIf:then:else:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "second", "third"]
  45659. }),
  45660. $globals.IRInliningJSTranslator);
  45661. $core.addClass("IRSendInliner", $globals.Object, ["send", "translator"], "Compiler-Inlining");
  45662. $globals.IRSendInliner.comment="I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods.";
  45663. $core.addMethod(
  45664. $core.method({
  45665. selector: "ifFalse:",
  45666. protocol: "inlining",
  45667. fn: function (anIRInstruction){
  45668. var self=this,$self=this;
  45669. return $core.withContext(function($ctx1) {
  45670. return $self._inlinedSend_withBlock_($recv($globals.IRInlinedIfFalse)._new(),anIRInstruction);
  45671. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{anIRInstruction:anIRInstruction})});
  45672. },
  45673. args: ["anIRInstruction"],
  45674. source: "ifFalse: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfFalse new withBlock: anIRInstruction",
  45675. referencedClasses: ["IRInlinedIfFalse"],
  45676. pragmas: [],
  45677. messageSends: ["inlinedSend:withBlock:", "new"]
  45678. }),
  45679. $globals.IRSendInliner);
  45680. $core.addMethod(
  45681. $core.method({
  45682. selector: "ifFalse:ifTrue:",
  45683. protocol: "inlining",
  45684. fn: function (anIRInstruction,anotherIRInstruction){
  45685. var self=this,$self=this;
  45686. return $core.withContext(function($ctx1) {
  45687. return $self._perform_withArguments_("ifTrue:ifFalse:",[anotherIRInstruction,anIRInstruction]);
  45688. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction})});
  45689. },
  45690. args: ["anIRInstruction", "anotherIRInstruction"],
  45691. source: "ifFalse: anIRInstruction ifTrue: anotherIRInstruction\x0a\x09^ self perform: #ifTrue:ifFalse: withArguments: { anotherIRInstruction. anIRInstruction }",
  45692. referencedClasses: [],
  45693. pragmas: [],
  45694. messageSends: ["perform:withArguments:"]
  45695. }),
  45696. $globals.IRSendInliner);
  45697. $core.addMethod(
  45698. $core.method({
  45699. selector: "ifNil:",
  45700. protocol: "inlining",
  45701. fn: function (anIRInstruction){
  45702. var self=this,$self=this;
  45703. return $core.withContext(function($ctx1) {
  45704. var $1,$3,$5,$6,$4,$2;
  45705. $1=$recv($globals.IRInlinedIfNilIfNotNil)._new();
  45706. $ctx1.sendIdx["new"]=1;
  45707. $3=$recv($globals.IRClosure)._new();
  45708. $ctx1.sendIdx["new"]=2;
  45709. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  45710. $5=$recv($globals.IRBlockSequence)._new();
  45711. $recv($5)._add_($recv($self._send())._receiver());
  45712. $6=$recv($5)._yourself();
  45713. $ctx1.sendIdx["yourself"]=1;
  45714. $4=$6;
  45715. $recv($3)._add_($4);
  45716. $ctx1.sendIdx["add:"]=1;
  45717. $2=$recv($3)._yourself();
  45718. return $self._inlinedSend_withBlock_withBlock_($1,anIRInstruction,$2);
  45719. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{anIRInstruction:anIRInstruction})});
  45720. },
  45721. args: ["anIRInstruction"],
  45722. source: "ifNil: anIRInstruction\x0a\x09^ self\x0a\x09\x09inlinedSend: IRInlinedIfNilIfNotNil new\x0a\x09\x09withBlock: anIRInstruction\x0a\x09\x09withBlock: (IRClosure new\x0a\x09\x09\x09scope: anIRInstruction scope copy;\x0a\x09\x09\x09add: (IRBlockSequence new\x0a\x09\x09\x09\x09add: self send receiver;\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself)",
  45723. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  45724. pragmas: [],
  45725. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "receiver", "send", "yourself"]
  45726. }),
  45727. $globals.IRSendInliner);
  45728. $core.addMethod(
  45729. $core.method({
  45730. selector: "ifNil:ifNotNil:",
  45731. protocol: "inlining",
  45732. fn: function (anIRInstruction,anotherIRInstruction){
  45733. var self=this,$self=this;
  45734. return $core.withContext(function($ctx1) {
  45735. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anIRInstruction,anotherIRInstruction);
  45736. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction})});
  45737. },
  45738. args: ["anIRInstruction", "anotherIRInstruction"],
  45739. source: "ifNil: anIRInstruction ifNotNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  45740. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  45741. pragmas: [],
  45742. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  45743. }),
  45744. $globals.IRSendInliner);
  45745. $core.addMethod(
  45746. $core.method({
  45747. selector: "ifNotNil:",
  45748. protocol: "inlining",
  45749. fn: function (anIRInstruction){
  45750. var self=this,$self=this;
  45751. return $core.withContext(function($ctx1) {
  45752. var $1,$3,$5,$6,$4,$2;
  45753. $1=$recv($globals.IRInlinedIfNilIfNotNil)._new();
  45754. $ctx1.sendIdx["new"]=1;
  45755. $3=$recv($globals.IRClosure)._new();
  45756. $ctx1.sendIdx["new"]=2;
  45757. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  45758. $5=$recv($globals.IRBlockSequence)._new();
  45759. $recv($5)._add_($recv($self._send())._receiver());
  45760. $6=$recv($5)._yourself();
  45761. $ctx1.sendIdx["yourself"]=1;
  45762. $4=$6;
  45763. $recv($3)._add_($4);
  45764. $ctx1.sendIdx["add:"]=1;
  45765. $2=$recv($3)._yourself();
  45766. return $self._inlinedSend_withBlock_withBlock_($1,$2,anIRInstruction);
  45767. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{anIRInstruction:anIRInstruction})});
  45768. },
  45769. args: ["anIRInstruction"],
  45770. source: "ifNotNil: anIRInstruction\x0a\x09^ self\x0a\x09\x09inlinedSend: IRInlinedIfNilIfNotNil new\x0a\x09\x09withBlock: (IRClosure new\x0a\x09\x09\x09scope: anIRInstruction scope copy;\x0a\x09\x09\x09add: (IRBlockSequence new\x0a\x09\x09\x09\x09add: self send receiver;\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself)\x0a\x09\x09withBlock: anIRInstruction",
  45771. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  45772. pragmas: [],
  45773. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "receiver", "send", "yourself"]
  45774. }),
  45775. $globals.IRSendInliner);
  45776. $core.addMethod(
  45777. $core.method({
  45778. selector: "ifNotNil:ifNil:",
  45779. protocol: "inlining",
  45780. fn: function (anIRInstruction,anotherIRInstruction){
  45781. var self=this,$self=this;
  45782. return $core.withContext(function($ctx1) {
  45783. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anotherIRInstruction,anIRInstruction);
  45784. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction})});
  45785. },
  45786. args: ["anIRInstruction", "anotherIRInstruction"],
  45787. source: "ifNotNil: anIRInstruction ifNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anotherIRInstruction withBlock: anIRInstruction",
  45788. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  45789. pragmas: [],
  45790. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  45791. }),
  45792. $globals.IRSendInliner);
  45793. $core.addMethod(
  45794. $core.method({
  45795. selector: "ifTrue:",
  45796. protocol: "inlining",
  45797. fn: function (anIRInstruction){
  45798. var self=this,$self=this;
  45799. return $core.withContext(function($ctx1) {
  45800. return $self._inlinedSend_withBlock_($recv($globals.IRInlinedIfTrue)._new(),anIRInstruction);
  45801. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{anIRInstruction:anIRInstruction})});
  45802. },
  45803. args: ["anIRInstruction"],
  45804. source: "ifTrue: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrue new withBlock: anIRInstruction",
  45805. referencedClasses: ["IRInlinedIfTrue"],
  45806. pragmas: [],
  45807. messageSends: ["inlinedSend:withBlock:", "new"]
  45808. }),
  45809. $globals.IRSendInliner);
  45810. $core.addMethod(
  45811. $core.method({
  45812. selector: "ifTrue:ifFalse:",
  45813. protocol: "inlining",
  45814. fn: function (anIRInstruction,anotherIRInstruction){
  45815. var self=this,$self=this;
  45816. return $core.withContext(function($ctx1) {
  45817. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfTrueIfFalse)._new(),anIRInstruction,anotherIRInstruction);
  45818. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction})});
  45819. },
  45820. args: ["anIRInstruction", "anotherIRInstruction"],
  45821. source: "ifTrue: anIRInstruction ifFalse: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrueIfFalse new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  45822. referencedClasses: ["IRInlinedIfTrueIfFalse"],
  45823. pragmas: [],
  45824. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  45825. }),
  45826. $globals.IRSendInliner);
  45827. $core.addMethod(
  45828. $core.method({
  45829. selector: "inlineClosure:",
  45830. protocol: "inlining",
  45831. fn: function (anIRClosure){
  45832. var self=this,$self=this;
  45833. var inlinedClosure,sequence,statements;
  45834. return $core.withContext(function($ctx1) {
  45835. var $1,$2,$3,$5,$6,$4,$7,$9,$11,$13,$14,$15,$12,$10,$17,$19,$20,$18,$16,$8;
  45836. inlinedClosure=$self._inlinedClosure();
  45837. $1=inlinedClosure;
  45838. $2=$recv(anIRClosure)._scope();
  45839. $ctx1.sendIdx["scope"]=1;
  45840. $recv($1)._scope_($2);
  45841. $ctx1.sendIdx["scope:"]=1;
  45842. $recv($1)._parent_($recv(anIRClosure)._parent());
  45843. $recv($recv(anIRClosure)._tempDeclarations())._do_((function(each){
  45844. return $core.withContext(function($ctx2) {
  45845. return $recv(inlinedClosure)._add_(each);
  45846. $ctx2.sendIdx["add:"]=1;
  45847. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  45848. }));
  45849. $ctx1.sendIdx["do:"]=1;
  45850. sequence=$self._inlinedSequence();
  45851. $recv($recv(anIRClosure)._arguments())._do_((function(each){
  45852. return $core.withContext(function($ctx2) {
  45853. $3=inlinedClosure;
  45854. $5=$recv($globals.IRTempDeclaration)._new();
  45855. $ctx2.sendIdx["new"]=1;
  45856. $recv($5)._name_(each);
  45857. $ctx2.sendIdx["name:"]=1;
  45858. $6=$recv($5)._yourself();
  45859. $ctx2.sendIdx["yourself"]=1;
  45860. $4=$6;
  45861. $recv($3)._add_($4);
  45862. $ctx2.sendIdx["add:"]=2;
  45863. $7=sequence;
  45864. $9=$recv($globals.IRAssignment)._new();
  45865. $ctx2.sendIdx["new"]=2;
  45866. $11=$recv($globals.IRVariable)._new();
  45867. $ctx2.sendIdx["new"]=3;
  45868. $13=$recv($globals.AliasVar)._new();
  45869. $ctx2.sendIdx["new"]=4;
  45870. $14=$recv(inlinedClosure)._scope();
  45871. $ctx2.sendIdx["scope"]=2;
  45872. $recv($13)._scope_($14);
  45873. $ctx2.sendIdx["scope:"]=2;
  45874. $recv($13)._name_(each);
  45875. $ctx2.sendIdx["name:"]=2;
  45876. $15=$recv($13)._yourself();
  45877. $ctx2.sendIdx["yourself"]=2;
  45878. $12=$15;
  45879. $10=$recv($11)._variable_($12);
  45880. $ctx2.sendIdx["variable:"]=1;
  45881. $recv($9)._add_($10);
  45882. $ctx2.sendIdx["add:"]=4;
  45883. $17=$recv($globals.IRVariable)._new();
  45884. $ctx2.sendIdx["new"]=5;
  45885. $19=$recv($globals.AliasVar)._new();
  45886. $recv($19)._scope_($recv(inlinedClosure)._scope());
  45887. $recv($19)._name_("$receiver");
  45888. $20=$recv($19)._yourself();
  45889. $ctx2.sendIdx["yourself"]=3;
  45890. $18=$20;
  45891. $16=$recv($17)._variable_($18);
  45892. $recv($9)._add_($16);
  45893. $ctx2.sendIdx["add:"]=5;
  45894. $8=$recv($9)._yourself();
  45895. return $recv($7)._add_($8);
  45896. $ctx2.sendIdx["add:"]=3;
  45897. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  45898. }));
  45899. $ctx1.sendIdx["do:"]=2;
  45900. $recv(inlinedClosure)._add_(sequence);
  45901. $ctx1.sendIdx["add:"]=6;
  45902. statements=$recv($recv(anIRClosure)._sequence())._dagChildren();
  45903. $recv(statements)._ifNotEmpty_((function(){
  45904. return $core.withContext(function($ctx2) {
  45905. $recv($recv(statements)._allButLast())._do_((function(each){
  45906. return $core.withContext(function($ctx3) {
  45907. return $recv(sequence)._add_(each);
  45908. $ctx3.sendIdx["add:"]=7;
  45909. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,4)});
  45910. }));
  45911. return $recv(sequence)._add_($recv($recv(statements)._last())._asInlinedBlockResult());
  45912. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  45913. }));
  45914. return inlinedClosure;
  45915. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,sequence:sequence,statements:statements})});
  45916. },
  45917. args: ["anIRClosure"],
  45918. source: "inlineClosure: anIRClosure\x0a\x09| inlinedClosure sequence statements |\x0a\x0a\x09inlinedClosure := self inlinedClosure.\x0a\x09inlinedClosure \x0a\x09\x09scope: anIRClosure scope;\x0a\x09\x09parent: anIRClosure parent.\x0a\x0a\x09\x22Add the possible temp declarations\x22\x0a\x09anIRClosure tempDeclarations do: [ :each |\x0a\x09\x09\x09inlinedClosure add: each ].\x0a\x0a\x09\x22Add a block sequence\x22\x0a\x09sequence := self inlinedSequence.\x0a\x0a\x09\x22Map the closure arguments to the receiver of the message send\x22\x0a\x09anIRClosure arguments do: [ :each |\x0a\x09\x09inlinedClosure add: (IRTempDeclaration new name: each; yourself).\x0a\x09\x09sequence add: (IRAssignment new\x0a\x09\x09\x09add: (IRVariable new variable: (AliasVar new scope: inlinedClosure scope; name: each; yourself));\x0a\x09\x09\x09add: (IRVariable new variable: (AliasVar new scope: inlinedClosure scope; name: '$receiver'; yourself));\x0a\x09\x09\x09yourself) ].\x0a\x09\x09\x09\x0a\x09\x22To ensure the correct order of the closure instructions: first the temps then the sequence\x22\x0a\x09inlinedClosure add: sequence.\x0a\x0a\x09\x22Get all the statements\x22\x0a\x09statements := anIRClosure sequence dagChildren.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09statements allButLast do: [ :each | sequence add: each ].\x0a\x0a\x09\x09\x22Inlined closures change local returns into result value itself\x22\x0a\x09\x09sequence add: statements last asInlinedBlockResult ].\x0a\x0a\x09^ inlinedClosure",
  45919. referencedClasses: ["IRTempDeclaration", "IRAssignment", "IRVariable", "AliasVar"],
  45920. pragmas: [],
  45921. messageSends: ["inlinedClosure", "scope:", "scope", "parent:", "parent", "do:", "tempDeclarations", "add:", "inlinedSequence", "arguments", "name:", "new", "yourself", "variable:", "dagChildren", "sequence", "ifNotEmpty:", "allButLast", "asInlinedBlockResult", "last"]
  45922. }),
  45923. $globals.IRSendInliner);
  45924. $core.addMethod(
  45925. $core.method({
  45926. selector: "inlineSend:",
  45927. protocol: "inlining",
  45928. fn: function (anIRSend){
  45929. var self=this,$self=this;
  45930. return $core.withContext(function($ctx1) {
  45931. var $2,$1;
  45932. $self._send_(anIRSend);
  45933. $2=$self._send();
  45934. $ctx1.sendIdx["send"]=1;
  45935. $1=$recv($2)._selector();
  45936. return $self._perform_withArguments_($1,$recv($self._send())._arguments());
  45937. }, function($ctx1) {$ctx1.fill(self,"inlineSend:",{anIRSend:anIRSend})});
  45938. },
  45939. args: ["anIRSend"],
  45940. source: "inlineSend: anIRSend\x0a\x09self send: anIRSend.\x0a\x09^ self\x0a\x09\x09perform: self send selector\x0a\x09\x09withArguments: self send arguments",
  45941. referencedClasses: [],
  45942. pragmas: [],
  45943. messageSends: ["send:", "perform:withArguments:", "selector", "send", "arguments"]
  45944. }),
  45945. $globals.IRSendInliner);
  45946. $core.addMethod(
  45947. $core.method({
  45948. selector: "inlineSend:andReplace:",
  45949. protocol: "private",
  45950. fn: function (anIRSend,anIRInstruction){
  45951. var self=this,$self=this;
  45952. return $core.withContext(function($ctx1) {
  45953. $recv(anIRInstruction)._replaceWith_(anIRSend);
  45954. return $self._inlineSend_(anIRSend);
  45955. }, function($ctx1) {$ctx1.fill(self,"inlineSend:andReplace:",{anIRSend:anIRSend,anIRInstruction:anIRInstruction})});
  45956. },
  45957. args: ["anIRSend", "anIRInstruction"],
  45958. source: "inlineSend: anIRSend andReplace: anIRInstruction\x0a\x09anIRInstruction replaceWith: anIRSend.\x0a\x09^ self inlineSend: anIRSend",
  45959. referencedClasses: [],
  45960. pragmas: [],
  45961. messageSends: ["replaceWith:", "inlineSend:"]
  45962. }),
  45963. $globals.IRSendInliner);
  45964. $core.addMethod(
  45965. $core.method({
  45966. selector: "inlinedClosure",
  45967. protocol: "factory",
  45968. fn: function (){
  45969. var self=this,$self=this;
  45970. return $core.withContext(function($ctx1) {
  45971. return $recv($globals.IRInlinedClosure)._new();
  45972. }, function($ctx1) {$ctx1.fill(self,"inlinedClosure",{})});
  45973. },
  45974. args: [],
  45975. source: "inlinedClosure\x0a\x09^ IRInlinedClosure new",
  45976. referencedClasses: ["IRInlinedClosure"],
  45977. pragmas: [],
  45978. messageSends: ["new"]
  45979. }),
  45980. $globals.IRSendInliner);
  45981. $core.addMethod(
  45982. $core.method({
  45983. selector: "inlinedSend:withBlock:",
  45984. protocol: "private",
  45985. fn: function (inlinedSend,anIRInstruction){
  45986. var self=this,$self=this;
  45987. var inlinedClosure;
  45988. return $core.withContext(function($ctx1) {
  45989. var $1,$2,$4,$3,$5;
  45990. $1=$recv(anIRInstruction)._isClosure();
  45991. if(!$core.assert($1)){
  45992. $self._inliningError_("Message argument should be a block");
  45993. $ctx1.sendIdx["inliningError:"]=1;
  45994. }
  45995. $2=$recv($recv($recv(anIRInstruction)._arguments())._size()).__eq((0));
  45996. if(!$core.assert($2)){
  45997. $self._inliningError_("Inlined block should have zero argument");
  45998. }
  45999. inlinedClosure=$recv($self._translator())._visit_($self._inlineClosure_(anIRInstruction));
  46000. $4=$self._send();
  46001. $ctx1.sendIdx["send"]=1;
  46002. $3=$recv($4)._receiver();
  46003. $recv(inlinedSend)._add_($3);
  46004. $ctx1.sendIdx["add:"]=1;
  46005. $recv(inlinedSend)._add_(inlinedClosure);
  46006. $recv($self._send())._replaceWith_(inlinedSend);
  46007. $5=$recv($recv(inlinedSend)._method())._internalVariables();
  46008. $ctx1.sendIdx["internalVariables"]=1;
  46009. $recv($5)._addAll_($recv(inlinedSend)._internalVariables());
  46010. return inlinedSend;
  46011. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,inlinedClosure:inlinedClosure})});
  46012. },
  46013. args: ["inlinedSend", "anIRInstruction"],
  46014. source: "inlinedSend: inlinedSend withBlock: anIRInstruction\x0a\x09| inlinedClosure |\x0a\x0a\x09anIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x09anIRInstruction arguments size = 0 ifFalse: [ self inliningError: 'Inlined block should have zero argument' ].\x0a\x0a\x09inlinedClosure := self translator visit: (self inlineClosure: anIRInstruction).\x0a\x0a\x09inlinedSend\x0a\x09\x09add: self send receiver;\x0a\x09\x09add: inlinedClosure.\x0a\x0a\x09self send replaceWith: inlinedSend.\x0a\x09inlinedSend method internalVariables \x0a\x09\x09addAll: inlinedSend internalVariables.\x0a\x0a\x09^ inlinedSend",
  46015. referencedClasses: [],
  46016. pragmas: [],
  46017. messageSends: ["ifFalse:", "isClosure", "inliningError:", "=", "size", "arguments", "visit:", "translator", "inlineClosure:", "add:", "receiver", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  46018. }),
  46019. $globals.IRSendInliner);
  46020. $core.addMethod(
  46021. $core.method({
  46022. selector: "inlinedSend:withBlock:withBlock:",
  46023. protocol: "private",
  46024. fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){
  46025. var self=this,$self=this;
  46026. var inlinedClosure1,inlinedClosure2;
  46027. return $core.withContext(function($ctx1) {
  46028. var $1,$2,$3,$4,$6,$5,$7;
  46029. $1=$recv(anIRInstruction)._isClosure();
  46030. $ctx1.sendIdx["isClosure"]=1;
  46031. if(!$core.assert($1)){
  46032. $self._inliningError_("Message argument should be a block");
  46033. $ctx1.sendIdx["inliningError:"]=1;
  46034. }
  46035. $2=$recv(anotherIRInstruction)._isClosure();
  46036. if(!$core.assert($2)){
  46037. $self._inliningError_("Message argument should be a block");
  46038. }
  46039. $3=$self._translator();
  46040. $ctx1.sendIdx["translator"]=1;
  46041. $4=$self._inlineClosure_(anIRInstruction);
  46042. $ctx1.sendIdx["inlineClosure:"]=1;
  46043. inlinedClosure1=$recv($3)._visit_($4);
  46044. $ctx1.sendIdx["visit:"]=1;
  46045. inlinedClosure2=$recv($self._translator())._visit_($self._inlineClosure_(anotherIRInstruction));
  46046. $6=$self._send();
  46047. $ctx1.sendIdx["send"]=1;
  46048. $5=$recv($6)._receiver();
  46049. $recv(inlinedSend)._add_($5);
  46050. $ctx1.sendIdx["add:"]=1;
  46051. $recv(inlinedSend)._add_(inlinedClosure1);
  46052. $ctx1.sendIdx["add:"]=2;
  46053. $recv(inlinedSend)._add_(inlinedClosure2);
  46054. $recv($self._send())._replaceWith_(inlinedSend);
  46055. $7=$recv($recv(inlinedSend)._method())._internalVariables();
  46056. $ctx1.sendIdx["internalVariables"]=1;
  46057. $recv($7)._addAll_($recv(inlinedSend)._internalVariables());
  46058. return inlinedSend;
  46059. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction,inlinedClosure1:inlinedClosure1,inlinedClosure2:inlinedClosure2})});
  46060. },
  46061. args: ["inlinedSend", "anIRInstruction", "anotherIRInstruction"],
  46062. source: "inlinedSend: inlinedSend withBlock: anIRInstruction withBlock: anotherIRInstruction\x0a\x09| inlinedClosure1 inlinedClosure2 |\x0a\x0a\x09anIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x09anotherIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x0a\x09inlinedClosure1 := self translator visit: (self inlineClosure: anIRInstruction).\x0a\x09inlinedClosure2 := self translator visit: (self inlineClosure: anotherIRInstruction).\x0a\x0a\x09inlinedSend\x0a\x09\x09add: self send receiver;\x0a\x09\x09add: inlinedClosure1;\x0a\x09\x09add: inlinedClosure2.\x0a\x0a\x09self send replaceWith: inlinedSend.\x0a\x09inlinedSend method internalVariables \x0a\x09\x09addAll: inlinedSend internalVariables.\x0a\x09\x09\x0a\x09^ inlinedSend",
  46063. referencedClasses: [],
  46064. pragmas: [],
  46065. messageSends: ["ifFalse:", "isClosure", "inliningError:", "visit:", "translator", "inlineClosure:", "add:", "receiver", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  46066. }),
  46067. $globals.IRSendInliner);
  46068. $core.addMethod(
  46069. $core.method({
  46070. selector: "inlinedSequence",
  46071. protocol: "factory",
  46072. fn: function (){
  46073. var self=this,$self=this;
  46074. return $core.withContext(function($ctx1) {
  46075. return $recv($globals.IRInlinedSequence)._new();
  46076. }, function($ctx1) {$ctx1.fill(self,"inlinedSequence",{})});
  46077. },
  46078. args: [],
  46079. source: "inlinedSequence\x0a\x09^ IRInlinedSequence new",
  46080. referencedClasses: ["IRInlinedSequence"],
  46081. pragmas: [],
  46082. messageSends: ["new"]
  46083. }),
  46084. $globals.IRSendInliner);
  46085. $core.addMethod(
  46086. $core.method({
  46087. selector: "inliningError:",
  46088. protocol: "error handling",
  46089. fn: function (aString){
  46090. var self=this,$self=this;
  46091. return $core.withContext(function($ctx1) {
  46092. $recv($globals.InliningError)._signal_(aString);
  46093. return self;
  46094. }, function($ctx1) {$ctx1.fill(self,"inliningError:",{aString:aString})});
  46095. },
  46096. args: ["aString"],
  46097. source: "inliningError: aString\x0a\x09InliningError signal: aString",
  46098. referencedClasses: ["InliningError"],
  46099. pragmas: [],
  46100. messageSends: ["signal:"]
  46101. }),
  46102. $globals.IRSendInliner);
  46103. $core.addMethod(
  46104. $core.method({
  46105. selector: "send",
  46106. protocol: "accessing",
  46107. fn: function (){
  46108. var self=this,$self=this;
  46109. return $self.send;
  46110. },
  46111. args: [],
  46112. source: "send\x0a\x09^ send",
  46113. referencedClasses: [],
  46114. pragmas: [],
  46115. messageSends: []
  46116. }),
  46117. $globals.IRSendInliner);
  46118. $core.addMethod(
  46119. $core.method({
  46120. selector: "send:",
  46121. protocol: "accessing",
  46122. fn: function (anIRSend){
  46123. var self=this,$self=this;
  46124. $self.send=anIRSend;
  46125. return self;
  46126. },
  46127. args: ["anIRSend"],
  46128. source: "send: anIRSend\x0a\x09send := anIRSend",
  46129. referencedClasses: [],
  46130. pragmas: [],
  46131. messageSends: []
  46132. }),
  46133. $globals.IRSendInliner);
  46134. $core.addMethod(
  46135. $core.method({
  46136. selector: "translator",
  46137. protocol: "accessing",
  46138. fn: function (){
  46139. var self=this,$self=this;
  46140. return $self.translator;
  46141. },
  46142. args: [],
  46143. source: "translator\x0a\x09^ translator",
  46144. referencedClasses: [],
  46145. pragmas: [],
  46146. messageSends: []
  46147. }),
  46148. $globals.IRSendInliner);
  46149. $core.addMethod(
  46150. $core.method({
  46151. selector: "translator:",
  46152. protocol: "accessing",
  46153. fn: function (anASTTranslator){
  46154. var self=this,$self=this;
  46155. $self.translator=anASTTranslator;
  46156. return self;
  46157. },
  46158. args: ["anASTTranslator"],
  46159. source: "translator: anASTTranslator\x0a\x09translator := anASTTranslator",
  46160. referencedClasses: [],
  46161. pragmas: [],
  46162. messageSends: []
  46163. }),
  46164. $globals.IRSendInliner);
  46165. $core.addMethod(
  46166. $core.method({
  46167. selector: "inlinedSelectors",
  46168. protocol: "accessing",
  46169. fn: function (){
  46170. var self=this,$self=this;
  46171. return ["ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:", "ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"];
  46172. },
  46173. args: [],
  46174. source: "inlinedSelectors\x0a\x09^ #('ifTrue:' 'ifFalse:' 'ifTrue:ifFalse:' 'ifFalse:ifTrue:' 'ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil:')",
  46175. referencedClasses: [],
  46176. pragmas: [],
  46177. messageSends: []
  46178. }),
  46179. $globals.IRSendInliner.a$cls);
  46180. $core.addMethod(
  46181. $core.method({
  46182. selector: "shouldInline:",
  46183. protocol: "accessing",
  46184. fn: function (anIRSend){
  46185. var self=this,$self=this;
  46186. return $core.withContext(function($ctx1) {
  46187. var $1;
  46188. $1=$recv($self._inlinedSelectors())._includes_($recv(anIRSend)._selector());
  46189. if(!$core.assert($1)){
  46190. return false;
  46191. }
  46192. return $recv($recv(anIRSend)._arguments())._allSatisfy_((function(each){
  46193. return $core.withContext(function($ctx2) {
  46194. return $recv(each)._isClosure();
  46195. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  46196. }));
  46197. }, function($ctx1) {$ctx1.fill(self,"shouldInline:",{anIRSend:anIRSend})});
  46198. },
  46199. args: ["anIRSend"],
  46200. source: "shouldInline: anIRSend\x0a\x09(self inlinedSelectors includes: anIRSend selector) ifFalse: [ ^ false ].\x0a\x09^ anIRSend arguments allSatisfy: [ :each | each isClosure ]",
  46201. referencedClasses: [],
  46202. pragmas: [],
  46203. messageSends: ["ifFalse:", "includes:", "inlinedSelectors", "selector", "allSatisfy:", "arguments", "isClosure"]
  46204. }),
  46205. $globals.IRSendInliner.a$cls);
  46206. $core.addClass("IRAssignmentInliner", $globals.IRSendInliner, ["target"], "Compiler-Inlining");
  46207. $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};";
  46208. $core.addMethod(
  46209. $core.method({
  46210. selector: "inlineAssignment:",
  46211. protocol: "inlining",
  46212. fn: function (anIRAssignment){
  46213. var self=this,$self=this;
  46214. return $core.withContext(function($ctx1) {
  46215. $self._target_($recv(anIRAssignment)._left());
  46216. return $self._inlineSend_andReplace_($recv(anIRAssignment)._right(),anIRAssignment);
  46217. }, function($ctx1) {$ctx1.fill(self,"inlineAssignment:",{anIRAssignment:anIRAssignment})});
  46218. },
  46219. args: ["anIRAssignment"],
  46220. source: "inlineAssignment: anIRAssignment\x0a\x09self target: anIRAssignment left.\x0a\x09^ self inlineSend: anIRAssignment right andReplace: anIRAssignment",
  46221. referencedClasses: [],
  46222. pragmas: [],
  46223. messageSends: ["target:", "left", "inlineSend:andReplace:", "right"]
  46224. }),
  46225. $globals.IRAssignmentInliner);
  46226. $core.addMethod(
  46227. $core.method({
  46228. selector: "inlineClosure:",
  46229. protocol: "inlining",
  46230. fn: function (anIRClosure){
  46231. var self=this,$self=this;
  46232. var closure,sequence,statements;
  46233. return $core.withContext(function($ctx1) {
  46234. var $1,$2,$3,$5,$4;
  46235. closure=(
  46236. $ctx1.supercall = true,
  46237. ($globals.IRAssignmentInliner.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.apply($self, [anIRClosure]));
  46238. $ctx1.supercall = false;
  46239. sequence=$recv(closure)._sequence();
  46240. statements=$recv(sequence)._dagChildren();
  46241. $recv(statements)._ifNotEmpty_((function(){
  46242. var final;
  46243. return $core.withContext(function($ctx2) {
  46244. final=$recv(statements)._last();
  46245. $1=$recv(final)._yieldsValue();
  46246. if($core.assert($1)){
  46247. $2=sequence;
  46248. $3=final;
  46249. $5=$recv($globals.IRAssignment)._new();
  46250. $recv($5)._add_($self._target());
  46251. $ctx2.sendIdx["add:"]=1;
  46252. $recv($5)._add_($recv(final)._copy());
  46253. $4=$recv($5)._yourself();
  46254. return $recv($2)._replace_with_($3,$4);
  46255. }
  46256. }, function($ctx2) {$ctx2.fillBlock({final:final},$ctx1,1)});
  46257. }));
  46258. return closure;
  46259. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,sequence:sequence,statements:statements})});
  46260. },
  46261. args: ["anIRClosure"],
  46262. source: "inlineClosure: anIRClosure\x0a\x09| closure sequence statements |\x0a\x0a\x09closure := super inlineClosure: anIRClosure.\x0a\x09sequence := closure sequence.\x0a\x09statements := sequence dagChildren.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09| final |\x0a\x09\x09final := statements last.\x0a\x09\x09final yieldsValue ifTrue: [\x0a\x09\x09\x09sequence replace: final with: (IRAssignment new\x0a\x09\x09\x09\x09add: self target;\x0a\x09\x09\x09\x09add: final copy;\x0a\x09\x09\x09\x09yourself) ] ].\x0a\x0a\x09^ closure",
  46263. referencedClasses: ["IRAssignment"],
  46264. pragmas: [],
  46265. messageSends: ["inlineClosure:", "sequence", "dagChildren", "ifNotEmpty:", "last", "ifTrue:", "yieldsValue", "replace:with:", "add:", "new", "target", "copy", "yourself"]
  46266. }),
  46267. $globals.IRAssignmentInliner);
  46268. $core.addMethod(
  46269. $core.method({
  46270. selector: "target",
  46271. protocol: "accessing",
  46272. fn: function (){
  46273. var self=this,$self=this;
  46274. return $self.target;
  46275. },
  46276. args: [],
  46277. source: "target\x0a\x09^ target",
  46278. referencedClasses: [],
  46279. pragmas: [],
  46280. messageSends: []
  46281. }),
  46282. $globals.IRAssignmentInliner);
  46283. $core.addMethod(
  46284. $core.method({
  46285. selector: "target:",
  46286. protocol: "accessing",
  46287. fn: function (anObject){
  46288. var self=this,$self=this;
  46289. $self.target=anObject;
  46290. return self;
  46291. },
  46292. args: ["anObject"],
  46293. source: "target: anObject\x0a\x09target := anObject",
  46294. referencedClasses: [],
  46295. pragmas: [],
  46296. messageSends: []
  46297. }),
  46298. $globals.IRAssignmentInliner);
  46299. $core.addClass("IRReturnInliner", $globals.IRSendInliner, [], "Compiler-Inlining");
  46300. $globals.IRReturnInliner.comment="I inline message sends with inlined closure together with a return instruction.";
  46301. $core.addMethod(
  46302. $core.method({
  46303. selector: "inlineClosure:",
  46304. protocol: "inlining",
  46305. fn: function (anIRClosure){
  46306. var self=this,$self=this;
  46307. var closure,sequence,statements;
  46308. return $core.withContext(function($ctx1) {
  46309. var $1,$2,$3,$5,$4;
  46310. closure=(
  46311. $ctx1.supercall = true,
  46312. ($globals.IRReturnInliner.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.apply($self, [anIRClosure]));
  46313. $ctx1.supercall = false;
  46314. sequence=$recv(closure)._sequence();
  46315. statements=$recv(sequence)._dagChildren();
  46316. $recv(statements)._ifNotEmpty_((function(){
  46317. var final;
  46318. return $core.withContext(function($ctx2) {
  46319. final=$recv(statements)._last();
  46320. $1=$recv(final)._yieldsValue();
  46321. if($core.assert($1)){
  46322. $2=sequence;
  46323. $3=final;
  46324. $5=$recv($globals.IRReturn)._new();
  46325. $recv($5)._add_($recv(final)._copy());
  46326. $4=$recv($5)._yourself();
  46327. return $recv($2)._replace_with_($3,$4);
  46328. }
  46329. }, function($ctx2) {$ctx2.fillBlock({final:final},$ctx1,1)});
  46330. }));
  46331. return closure;
  46332. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,sequence:sequence,statements:statements})});
  46333. },
  46334. args: ["anIRClosure"],
  46335. source: "inlineClosure: anIRClosure\x0a\x09| closure sequence statements |\x0a\x0a\x09closure := super inlineClosure: anIRClosure.\x0a\x09sequence := closure sequence.\x0a\x09statements := sequence dagChildren.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09| final |\x0a\x09\x09final := statements last.\x0a\x09\x09final yieldsValue ifTrue: [\x0a\x09\x09\x09sequence replace: final with: (IRReturn new\x0a\x09\x09\x09\x09add: final copy;\x0a\x09\x09\x09\x09yourself) ] ].\x0a\x0a\x09^ closure",
  46336. referencedClasses: ["IRReturn"],
  46337. pragmas: [],
  46338. messageSends: ["inlineClosure:", "sequence", "dagChildren", "ifNotEmpty:", "last", "ifTrue:", "yieldsValue", "replace:with:", "add:", "new", "copy", "yourself"]
  46339. }),
  46340. $globals.IRReturnInliner);
  46341. $core.addMethod(
  46342. $core.method({
  46343. selector: "inlineReturn:",
  46344. protocol: "inlining",
  46345. fn: function (anIRReturn){
  46346. var self=this,$self=this;
  46347. return $core.withContext(function($ctx1) {
  46348. return $self._inlineSend_andReplace_($recv(anIRReturn)._expression(),anIRReturn);
  46349. }, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn})});
  46350. },
  46351. args: ["anIRReturn"],
  46352. source: "inlineReturn: anIRReturn\x0a\x09^ self inlineSend: anIRReturn expression andReplace: anIRReturn",
  46353. referencedClasses: [],
  46354. pragmas: [],
  46355. messageSends: ["inlineSend:andReplace:", "expression"]
  46356. }),
  46357. $globals.IRReturnInliner);
  46358. $core.addClass("InliningCodeGenerator", $globals.CodeGenerator, [], "Compiler-Inlining");
  46359. $globals.InliningCodeGenerator.comment="I am a specialized code generator that uses inlining to produce more optimized JavaScript output";
  46360. $core.addMethod(
  46361. $core.method({
  46362. selector: "inliner",
  46363. protocol: "compiling",
  46364. fn: function (){
  46365. var self=this,$self=this;
  46366. return $core.withContext(function($ctx1) {
  46367. return $recv($globals.IRInliner)._new();
  46368. }, function($ctx1) {$ctx1.fill(self,"inliner",{})});
  46369. },
  46370. args: [],
  46371. source: "inliner\x0a\x09^ IRInliner new",
  46372. referencedClasses: ["IRInliner"],
  46373. pragmas: [],
  46374. messageSends: ["new"]
  46375. }),
  46376. $globals.InliningCodeGenerator);
  46377. $core.addMethod(
  46378. $core.method({
  46379. selector: "irTranslatorClass",
  46380. protocol: "compiling",
  46381. fn: function (){
  46382. var self=this,$self=this;
  46383. return $globals.IRInliningJSTranslator;
  46384. },
  46385. args: [],
  46386. source: "irTranslatorClass\x0a\x09^ IRInliningJSTranslator",
  46387. referencedClasses: ["IRInliningJSTranslator"],
  46388. pragmas: [],
  46389. messageSends: []
  46390. }),
  46391. $globals.InliningCodeGenerator);
  46392. $core.addMethod(
  46393. $core.method({
  46394. selector: "preInliner",
  46395. protocol: "compiling",
  46396. fn: function (){
  46397. var self=this,$self=this;
  46398. return $core.withContext(function($ctx1) {
  46399. return $recv($globals.ASTPreInliner)._new();
  46400. }, function($ctx1) {$ctx1.fill(self,"preInliner",{})});
  46401. },
  46402. args: [],
  46403. source: "preInliner\x0a\x09^ ASTPreInliner new",
  46404. referencedClasses: ["ASTPreInliner"],
  46405. pragmas: [],
  46406. messageSends: ["new"]
  46407. }),
  46408. $globals.InliningCodeGenerator);
  46409. $core.addMethod(
  46410. $core.method({
  46411. selector: "transformersDictionary",
  46412. protocol: "compiling",
  46413. fn: function (){
  46414. var self=this,$self=this;
  46415. return $core.withContext(function($ctx1) {
  46416. var $1,$2,$receiver;
  46417. $1=$self.transformersDictionary;
  46418. if(($receiver = $1) == null || $receiver.a$nil){
  46419. $2=(
  46420. $ctx1.supercall = true,
  46421. ($globals.InliningCodeGenerator.superclass||$boot.nilAsClass).fn.prototype._transformersDictionary.apply($self, []));
  46422. $ctx1.supercall = false;
  46423. $recv($2)._at_put_("3000-inlinerTagging",$self._preInliner());
  46424. $ctx1.sendIdx["at:put:"]=1;
  46425. $recv($2)._at_put_("6000-inliner",$self._inliner());
  46426. $ctx1.sendIdx["at:put:"]=2;
  46427. $recv($2)._at_put_("8000-irToJs",$self._irTranslator());
  46428. $self.transformersDictionary=$recv($2)._yourself();
  46429. return $self.transformersDictionary;
  46430. } else {
  46431. return $1;
  46432. }
  46433. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{})});
  46434. },
  46435. args: [],
  46436. 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 ]",
  46437. referencedClasses: [],
  46438. pragmas: [],
  46439. messageSends: ["ifNil:", "at:put:", "transformersDictionary", "preInliner", "inliner", "irTranslator", "yourself"]
  46440. }),
  46441. $globals.InliningCodeGenerator);
  46442. $core.addClass("InliningError", $globals.SemanticError, [], "Compiler-Inlining");
  46443. $globals.InliningError.comment="Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`.";
  46444. $core.addMethod(
  46445. $core.method({
  46446. selector: "asInlinedBlockResult",
  46447. protocol: "*Compiler-Inlining",
  46448. fn: function (){
  46449. var self=this,$self=this;
  46450. return $core.withContext(function($ctx1) {
  46451. return $self._expression();
  46452. }, function($ctx1) {$ctx1.fill(self,"asInlinedBlockResult",{})});
  46453. },
  46454. args: [],
  46455. source: "asInlinedBlockResult\x0a\x09^ self expression",
  46456. referencedClasses: [],
  46457. pragmas: [],
  46458. messageSends: ["expression"]
  46459. }),
  46460. $globals.IRBlockReturn);
  46461. $core.addMethod(
  46462. $core.method({
  46463. selector: "asInlinedBlockResult",
  46464. protocol: "*Compiler-Inlining",
  46465. fn: function (){
  46466. var self=this,$self=this;
  46467. return self;
  46468. },
  46469. args: [],
  46470. source: "asInlinedBlockResult\x0a\x09^ self",
  46471. referencedClasses: [],
  46472. pragmas: [],
  46473. messageSends: []
  46474. }),
  46475. $globals.IRInstruction);
  46476. });
  46477. define('amber/core/Compiler-Interpreter',["amber/boot", "require", "amber/core/Compiler-AST", "amber/core/Compiler-Semantic", "amber/core/Kernel-Exceptions", "amber/core/Kernel-Methods", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  46478. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  46479. var $pkg = $core.addPackage("Compiler-Interpreter");
  46480. $pkg.innerEval = function (expr) { return eval(expr); };
  46481. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  46482. $core.addClass("AIBlockClosure", $globals.BlockClosure, ["node", "outerContext"], "Compiler-Interpreter");
  46483. $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`).";
  46484. $core.addMethod(
  46485. $core.method({
  46486. selector: "applyTo:arguments:",
  46487. protocol: "evaluating",
  46488. fn: function (anObject,aCollection){
  46489. var self=this,$self=this;
  46490. return $core.withContext(function($ctx1) {
  46491. $self._interpreterError();
  46492. return self;
  46493. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection})});
  46494. },
  46495. args: ["anObject", "aCollection"],
  46496. source: "applyTo: anObject arguments: aCollection\x0a\x09self interpreterError",
  46497. referencedClasses: [],
  46498. pragmas: [],
  46499. messageSends: ["interpreterError"]
  46500. }),
  46501. $globals.AIBlockClosure);
  46502. $core.addMethod(
  46503. $core.method({
  46504. selector: "compiledSource",
  46505. protocol: "accessing",
  46506. fn: function (){
  46507. var self=this,$self=this;
  46508. return "[ AST Block closure ]";
  46509. },
  46510. args: [],
  46511. source: "compiledSource\x0a\x09\x22Unlike blocks, the receiver doesn't represent a JS function\x22\x0a\x09\x0a\x09^ '[ AST Block closure ]'",
  46512. referencedClasses: [],
  46513. pragmas: [],
  46514. messageSends: []
  46515. }),
  46516. $globals.AIBlockClosure);
  46517. $core.addMethod(
  46518. $core.method({
  46519. selector: "currySelf",
  46520. protocol: "converting",
  46521. fn: function (){
  46522. var self=this,$self=this;
  46523. return $core.withContext(function($ctx1) {
  46524. $self._interpreterError();
  46525. return self;
  46526. }, function($ctx1) {$ctx1.fill(self,"currySelf",{})});
  46527. },
  46528. args: [],
  46529. source: "currySelf\x0a\x09self interpreterError",
  46530. referencedClasses: [],
  46531. pragmas: [],
  46532. messageSends: ["interpreterError"]
  46533. }),
  46534. $globals.AIBlockClosure);
  46535. $core.addMethod(
  46536. $core.method({
  46537. selector: "initializeWithContext:node:",
  46538. protocol: "initialization",
  46539. fn: function (aContext,aNode){
  46540. var self=this,$self=this;
  46541. $self.node=aNode;
  46542. $self.outerContext=aContext;
  46543. return self;
  46544. },
  46545. args: ["aContext", "aNode"],
  46546. source: "initializeWithContext: aContext node: aNode\x0a\x09node := aNode.\x0a\x09outerContext := aContext",
  46547. referencedClasses: [],
  46548. pragmas: [],
  46549. messageSends: []
  46550. }),
  46551. $globals.AIBlockClosure);
  46552. $core.addMethod(
  46553. $core.method({
  46554. selector: "interpreterError",
  46555. protocol: "error handling",
  46556. fn: function (){
  46557. var self=this,$self=this;
  46558. return $core.withContext(function($ctx1) {
  46559. $recv($globals.ASTInterpreterError)._signal_("Method cannot be interpreted by the interpreter.");
  46560. return self;
  46561. }, function($ctx1) {$ctx1.fill(self,"interpreterError",{})});
  46562. },
  46563. args: [],
  46564. source: "interpreterError\x0a\x09ASTInterpreterError signal: 'Method cannot be interpreted by the interpreter.'",
  46565. referencedClasses: ["ASTInterpreterError"],
  46566. pragmas: [],
  46567. messageSends: ["signal:"]
  46568. }),
  46569. $globals.AIBlockClosure);
  46570. $core.addMethod(
  46571. $core.method({
  46572. selector: "numArgs",
  46573. protocol: "accessing",
  46574. fn: function (){
  46575. var self=this,$self=this;
  46576. return $core.withContext(function($ctx1) {
  46577. return $recv($recv($self.node)._temps())._size();
  46578. }, function($ctx1) {$ctx1.fill(self,"numArgs",{})});
  46579. },
  46580. args: [],
  46581. source: "numArgs\x0a\x09^ node temps size",
  46582. referencedClasses: [],
  46583. pragmas: [],
  46584. messageSends: ["size", "temps"]
  46585. }),
  46586. $globals.AIBlockClosure);
  46587. $core.addMethod(
  46588. $core.method({
  46589. selector: "value",
  46590. protocol: "evaluating",
  46591. fn: function (){
  46592. var self=this,$self=this;
  46593. return $core.withContext(function($ctx1) {
  46594. return $self._valueWithPossibleArguments_([]);
  46595. }, function($ctx1) {$ctx1.fill(self,"value",{})});
  46596. },
  46597. args: [],
  46598. source: "value\x0a\x09^ self valueWithPossibleArguments: #()",
  46599. referencedClasses: [],
  46600. pragmas: [],
  46601. messageSends: ["valueWithPossibleArguments:"]
  46602. }),
  46603. $globals.AIBlockClosure);
  46604. $core.addMethod(
  46605. $core.method({
  46606. selector: "value:",
  46607. protocol: "evaluating",
  46608. fn: function (anArgument){
  46609. var self=this,$self=this;
  46610. return $core.withContext(function($ctx1) {
  46611. return $self._valueWithPossibleArguments_([anArgument]);
  46612. }, function($ctx1) {$ctx1.fill(self,"value:",{anArgument:anArgument})});
  46613. },
  46614. args: ["anArgument"],
  46615. source: "value: anArgument\x0a\x09^ self valueWithPossibleArguments: {anArgument}",
  46616. referencedClasses: [],
  46617. pragmas: [],
  46618. messageSends: ["valueWithPossibleArguments:"]
  46619. }),
  46620. $globals.AIBlockClosure);
  46621. $core.addMethod(
  46622. $core.method({
  46623. selector: "value:value:",
  46624. protocol: "evaluating",
  46625. fn: function (firstArgument,secondArgument){
  46626. var self=this,$self=this;
  46627. return $core.withContext(function($ctx1) {
  46628. return $self._valueWithPossibleArguments_([firstArgument,secondArgument]);
  46629. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument})});
  46630. },
  46631. args: ["firstArgument", "secondArgument"],
  46632. source: "value: firstArgument value: secondArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument}",
  46633. referencedClasses: [],
  46634. pragmas: [],
  46635. messageSends: ["valueWithPossibleArguments:"]
  46636. }),
  46637. $globals.AIBlockClosure);
  46638. $core.addMethod(
  46639. $core.method({
  46640. selector: "value:value:value:",
  46641. protocol: "evaluating",
  46642. fn: function (firstArgument,secondArgument,thirdArgument){
  46643. var self=this,$self=this;
  46644. return $core.withContext(function($ctx1) {
  46645. return $self._valueWithPossibleArguments_([firstArgument,secondArgument,thirdArgument]);
  46646. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument})});
  46647. },
  46648. args: ["firstArgument", "secondArgument", "thirdArgument"],
  46649. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument . thirdArgument}",
  46650. referencedClasses: [],
  46651. pragmas: [],
  46652. messageSends: ["valueWithPossibleArguments:"]
  46653. }),
  46654. $globals.AIBlockClosure);
  46655. $core.addMethod(
  46656. $core.method({
  46657. selector: "valueWithPossibleArguments:",
  46658. protocol: "evaluating",
  46659. fn: function (aCollection){
  46660. var self=this,$self=this;
  46661. var context,sequenceNode;
  46662. return $core.withContext(function($ctx1) {
  46663. var $1,$2,$3;
  46664. context=$recv($self.outerContext)._newInnerContext();
  46665. $1=$recv($recv($recv($self.node)._dagChildren())._first())._copy();
  46666. $recv($1)._parent_(nil);
  46667. sequenceNode=$recv($1)._yourself();
  46668. $recv($recv(sequenceNode)._temps())._do_((function(each){
  46669. return $core.withContext(function($ctx2) {
  46670. return $recv(context)._defineLocal_(each);
  46671. $ctx2.sendIdx["defineLocal:"]=1;
  46672. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46673. }));
  46674. $recv($recv($self.node)._parameters())._withIndexDo_((function(each,index){
  46675. return $core.withContext(function($ctx2) {
  46676. $recv(context)._defineLocal_(each);
  46677. return $recv(context)._localAt_put_(each,$recv(aCollection)._at_ifAbsent_(index,(function(){
  46678. return nil;
  46679. })));
  46680. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,2)});
  46681. }));
  46682. $2=$recv(context)._interpreter();
  46683. $ctx1.sendIdx["interpreter"]=1;
  46684. $recv($2)._node_(sequenceNode);
  46685. $recv($2)._enterNode();
  46686. $recv($2)._proceed();
  46687. $3=$recv($self.outerContext)._interpreter();
  46688. $ctx1.sendIdx["interpreter"]=2;
  46689. $recv($3)._setNonLocalReturnFromContext_(context);
  46690. return $recv($recv(context)._interpreter())._pop();
  46691. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection,context:context,sequenceNode:sequenceNode})});
  46692. },
  46693. args: ["aCollection"],
  46694. source: "valueWithPossibleArguments: aCollection\x0a\x09| context sequenceNode |\x0a\x09context := outerContext newInnerContext.\x0a\x0a\x09\x22Interpret a copy of the sequence node to avoid creating a new AIBlockClosure\x22\x0a\x09sequenceNode := node dagChildren first copy\x0a\x09\x09parent: nil;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09\x22Define locals in the context\x22\x0a\x09sequenceNode temps do: [ :each |\x0a\x09\x09context defineLocal: each ].\x0a\x09\x09\x0a\x09\x22Populate the arguments into the context locals\x22\x09\x0a\x09node parameters withIndexDo: [ :each :index |\x0a\x09\x09context defineLocal: each.\x0a\x09\x09context localAt: each put: (aCollection at: index ifAbsent: [ nil ]) ].\x0a\x0a\x09\x22Interpret the first node of the BlockSequenceNode\x22\x0a\x09context interpreter\x0a\x09\x09node: sequenceNode;\x0a\x09\x09enterNode;\x0a\x09\x09proceed.\x0a\x09\x09\x0a\x09outerContext interpreter\x0a\x09\x09setNonLocalReturnFromContext: context.\x0a\x09\x09\x0a\x09^ context interpreter pop",
  46695. referencedClasses: [],
  46696. pragmas: [],
  46697. messageSends: ["newInnerContext", "parent:", "copy", "first", "dagChildren", "yourself", "do:", "temps", "defineLocal:", "withIndexDo:", "parameters", "localAt:put:", "at:ifAbsent:", "node:", "interpreter", "enterNode", "proceed", "setNonLocalReturnFromContext:", "pop"]
  46698. }),
  46699. $globals.AIBlockClosure);
  46700. $core.addMethod(
  46701. $core.method({
  46702. selector: "forContext:node:",
  46703. protocol: "instance creation",
  46704. fn: function (aContext,aNode){
  46705. var self=this,$self=this;
  46706. return $core.withContext(function($ctx1) {
  46707. var $1;
  46708. $1=$self._new();
  46709. $recv($1)._initializeWithContext_node_(aContext,aNode);
  46710. return $recv($1)._yourself();
  46711. }, function($ctx1) {$ctx1.fill(self,"forContext:node:",{aContext:aContext,aNode:aNode})});
  46712. },
  46713. args: ["aContext", "aNode"],
  46714. source: "forContext: aContext node: aNode\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext node: aNode;\x0a\x09\x09yourself",
  46715. referencedClasses: [],
  46716. pragmas: [],
  46717. messageSends: ["initializeWithContext:node:", "new", "yourself"]
  46718. }),
  46719. $globals.AIBlockClosure.a$cls);
  46720. $core.addClass("AIContext", $globals.Object, ["outerContext", "innerContext", "pc", "locals", "selector", "index", "sendIndexes", "evaluatedSelector", "ast", "interpreter", "supercall"], "Compiler-Interpreter");
  46721. $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)";
  46722. $core.addMethod(
  46723. $core.method({
  46724. selector: "arguments",
  46725. protocol: "interpreting",
  46726. fn: function (){
  46727. var self=this,$self=this;
  46728. return $core.withContext(function($ctx1) {
  46729. return $recv($recv($self._ast())._arguments())._collect_((function(each){
  46730. return $core.withContext(function($ctx2) {
  46731. return $self._localAt_ifAbsent_(each,(function(){
  46732. return $core.withContext(function($ctx3) {
  46733. return $self._error_("Argument not in context");
  46734. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  46735. }));
  46736. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46737. }));
  46738. }, function($ctx1) {$ctx1.fill(self,"arguments",{})});
  46739. },
  46740. args: [],
  46741. source: "arguments\x0a\x09^ self ast arguments collect: [ :each |\x0a\x09\x09self localAt: each ifAbsent: [ self error: 'Argument not in context' ] ]",
  46742. referencedClasses: [],
  46743. pragmas: [],
  46744. messageSends: ["collect:", "arguments", "ast", "localAt:ifAbsent:", "error:"]
  46745. }),
  46746. $globals.AIContext);
  46747. $core.addMethod(
  46748. $core.method({
  46749. selector: "ast",
  46750. protocol: "interpreting",
  46751. fn: function (){
  46752. var self=this,$self=this;
  46753. return $core.withContext(function($ctx1) {
  46754. var $1,$2,$3,$receiver;
  46755. $1=$self._isBlockContext();
  46756. if($core.assert($1)){
  46757. $2=$self._outerContext();
  46758. if(($receiver = $2) == null || $receiver.a$nil){
  46759. return $2;
  46760. } else {
  46761. var context;
  46762. context=$receiver;
  46763. return $recv(context)._ast();
  46764. }
  46765. }
  46766. $3=$self.ast;
  46767. if(($receiver = $3) == null || $receiver.a$nil){
  46768. $self._initializeAST();
  46769. } else {
  46770. $3;
  46771. }
  46772. return $self.ast;
  46773. }, function($ctx1) {$ctx1.fill(self,"ast",{})});
  46774. },
  46775. args: [],
  46776. source: "ast\x0a\x09self isBlockContext ifTrue: [ \x0a\x09\x09^ self outerContext ifNotNil: [ :context | context ast ] ].\x0a\x0a\x09ast ifNil: [ self initializeAST ].\x0a\x09^ ast",
  46777. referencedClasses: [],
  46778. pragmas: [],
  46779. messageSends: ["ifTrue:", "isBlockContext", "ifNotNil:", "outerContext", "ast", "ifNil:", "initializeAST"]
  46780. }),
  46781. $globals.AIContext);
  46782. $core.addMethod(
  46783. $core.method({
  46784. selector: "basicLocalAt:",
  46785. protocol: "private",
  46786. fn: function (aString){
  46787. var self=this,$self=this;
  46788. return $core.withContext(function($ctx1) {
  46789. return $recv($self._locals())._at_(aString);
  46790. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:",{aString:aString})});
  46791. },
  46792. args: ["aString"],
  46793. source: "basicLocalAt: aString\x0a\x09^ self locals at: aString",
  46794. referencedClasses: [],
  46795. pragmas: [],
  46796. messageSends: ["at:", "locals"]
  46797. }),
  46798. $globals.AIContext);
  46799. $core.addMethod(
  46800. $core.method({
  46801. selector: "basicLocalAt:put:",
  46802. protocol: "private",
  46803. fn: function (aString,anObject){
  46804. var self=this,$self=this;
  46805. return $core.withContext(function($ctx1) {
  46806. $recv($self._locals())._at_put_(aString,anObject);
  46807. return self;
  46808. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:put:",{aString:aString,anObject:anObject})});
  46809. },
  46810. args: ["aString", "anObject"],
  46811. source: "basicLocalAt: aString put: anObject\x0a\x09self locals at: aString put: anObject",
  46812. referencedClasses: [],
  46813. pragmas: [],
  46814. messageSends: ["at:put:", "locals"]
  46815. }),
  46816. $globals.AIContext);
  46817. $core.addMethod(
  46818. $core.method({
  46819. selector: "basicReceiver",
  46820. protocol: "interpreting",
  46821. fn: function (){
  46822. var self=this,$self=this;
  46823. return $core.withContext(function($ctx1) {
  46824. return $self._localAt_("self");
  46825. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{})});
  46826. },
  46827. args: [],
  46828. source: "basicReceiver\x0a\x09^ self localAt: 'self'",
  46829. referencedClasses: [],
  46830. pragmas: [],
  46831. messageSends: ["localAt:"]
  46832. }),
  46833. $globals.AIContext);
  46834. $core.addMethod(
  46835. $core.method({
  46836. selector: "defineLocal:",
  46837. protocol: "accessing",
  46838. fn: function (aString){
  46839. var self=this,$self=this;
  46840. return $core.withContext(function($ctx1) {
  46841. $recv($self._locals())._at_put_(aString,nil);
  46842. return self;
  46843. }, function($ctx1) {$ctx1.fill(self,"defineLocal:",{aString:aString})});
  46844. },
  46845. args: ["aString"],
  46846. source: "defineLocal: aString\x0a\x09self locals at: aString put: nil",
  46847. referencedClasses: [],
  46848. pragmas: [],
  46849. messageSends: ["at:put:", "locals"]
  46850. }),
  46851. $globals.AIContext);
  46852. $core.addMethod(
  46853. $core.method({
  46854. selector: "evaluate:on:",
  46855. protocol: "evaluating",
  46856. fn: function (aString,anEvaluator){
  46857. var self=this,$self=this;
  46858. return $core.withContext(function($ctx1) {
  46859. return $recv(anEvaluator)._evaluate_context_(aString,self);
  46860. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator})});
  46861. },
  46862. args: ["aString", "anEvaluator"],
  46863. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString context: self",
  46864. referencedClasses: [],
  46865. pragmas: [],
  46866. messageSends: ["evaluate:context:"]
  46867. }),
  46868. $globals.AIContext);
  46869. $core.addMethod(
  46870. $core.method({
  46871. selector: "evaluateNode:",
  46872. protocol: "evaluating",
  46873. fn: function (aNode){
  46874. var self=this,$self=this;
  46875. return $core.withContext(function($ctx1) {
  46876. var $1;
  46877. $1=$recv($globals.ASTInterpreter)._new();
  46878. $recv($1)._context_(self);
  46879. $recv($1)._node_(aNode);
  46880. $recv($1)._enterNode();
  46881. $recv($1)._proceed();
  46882. return $recv($1)._result();
  46883. }, function($ctx1) {$ctx1.fill(self,"evaluateNode:",{aNode:aNode})});
  46884. },
  46885. args: ["aNode"],
  46886. source: "evaluateNode: aNode\x0a\x09^ ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09node: aNode;\x0a\x09\x09enterNode;\x0a\x09\x09proceed;\x0a\x09\x09result",
  46887. referencedClasses: ["ASTInterpreter"],
  46888. pragmas: [],
  46889. messageSends: ["context:", "new", "node:", "enterNode", "proceed", "result"]
  46890. }),
  46891. $globals.AIContext);
  46892. $core.addMethod(
  46893. $core.method({
  46894. selector: "evaluatedSelector",
  46895. protocol: "accessing",
  46896. fn: function (){
  46897. var self=this,$self=this;
  46898. return $self.evaluatedSelector;
  46899. },
  46900. args: [],
  46901. source: "evaluatedSelector\x0a\x09^ evaluatedSelector",
  46902. referencedClasses: [],
  46903. pragmas: [],
  46904. messageSends: []
  46905. }),
  46906. $globals.AIContext);
  46907. $core.addMethod(
  46908. $core.method({
  46909. selector: "evaluatedSelector:",
  46910. protocol: "accessing",
  46911. fn: function (aString){
  46912. var self=this,$self=this;
  46913. $self.evaluatedSelector=aString;
  46914. return self;
  46915. },
  46916. args: ["aString"],
  46917. source: "evaluatedSelector: aString\x0a\x09evaluatedSelector := aString",
  46918. referencedClasses: [],
  46919. pragmas: [],
  46920. messageSends: []
  46921. }),
  46922. $globals.AIContext);
  46923. $core.addMethod(
  46924. $core.method({
  46925. selector: "home",
  46926. protocol: "accessing",
  46927. fn: function (){
  46928. var self=this,$self=this;
  46929. return nil;
  46930. },
  46931. args: [],
  46932. source: "home\x0a\x09^ nil",
  46933. referencedClasses: [],
  46934. pragmas: [],
  46935. messageSends: []
  46936. }),
  46937. $globals.AIContext);
  46938. $core.addMethod(
  46939. $core.method({
  46940. selector: "index",
  46941. protocol: "accessing",
  46942. fn: function (){
  46943. var self=this,$self=this;
  46944. return $core.withContext(function($ctx1) {
  46945. var $1,$receiver;
  46946. $1=$self.index;
  46947. if(($receiver = $1) == null || $receiver.a$nil){
  46948. return (0);
  46949. } else {
  46950. return $1;
  46951. }
  46952. }, function($ctx1) {$ctx1.fill(self,"index",{})});
  46953. },
  46954. args: [],
  46955. source: "index\x0a\x09^ index ifNil: [ 0 ]",
  46956. referencedClasses: [],
  46957. pragmas: [],
  46958. messageSends: ["ifNil:"]
  46959. }),
  46960. $globals.AIContext);
  46961. $core.addMethod(
  46962. $core.method({
  46963. selector: "index:",
  46964. protocol: "accessing",
  46965. fn: function (anInteger){
  46966. var self=this,$self=this;
  46967. $self.index=anInteger;
  46968. return self;
  46969. },
  46970. args: ["anInteger"],
  46971. source: "index: anInteger\x0a\x09index := anInteger",
  46972. referencedClasses: [],
  46973. pragmas: [],
  46974. messageSends: []
  46975. }),
  46976. $globals.AIContext);
  46977. $core.addMethod(
  46978. $core.method({
  46979. selector: "initializeAST",
  46980. protocol: "initialization",
  46981. fn: function (){
  46982. var self=this,$self=this;
  46983. return $core.withContext(function($ctx1) {
  46984. var $1;
  46985. $1=$self._method();
  46986. $ctx1.sendIdx["method"]=1;
  46987. $self.ast=$recv($1)._ast();
  46988. $recv($recv($globals.SemanticAnalyzer)._on_($recv($self._method())._origin()))._visit_($self.ast);
  46989. return self;
  46990. }, function($ctx1) {$ctx1.fill(self,"initializeAST",{})});
  46991. },
  46992. args: [],
  46993. source: "initializeAST\x0a\x09ast := self method ast.\x0a\x09(SemanticAnalyzer on: self method origin)\x0a\x09\x09visit: ast",
  46994. referencedClasses: ["SemanticAnalyzer"],
  46995. pragmas: [],
  46996. messageSends: ["ast", "method", "visit:", "on:", "origin"]
  46997. }),
  46998. $globals.AIContext);
  46999. $core.addMethod(
  47000. $core.method({
  47001. selector: "initializeFromMethodContext:",
  47002. protocol: "initialization",
  47003. fn: function (aMethodContext){
  47004. var self=this,$self=this;
  47005. return $core.withContext(function($ctx1) {
  47006. var $1,$2,$3,$receiver;
  47007. $self._evaluatedSelector_($recv(aMethodContext)._evaluatedSelector());
  47008. $self._index_($recv(aMethodContext)._index());
  47009. $self._sendIndexes_($recv(aMethodContext)._sendIndexes());
  47010. $self._receiver_($recv(aMethodContext)._receiver());
  47011. $self._supercall_($recv(aMethodContext)._supercall());
  47012. $self._selector_($recv(aMethodContext)._selector());
  47013. $1=$recv(aMethodContext)._outerContext();
  47014. $ctx1.sendIdx["outerContext"]=1;
  47015. if(($receiver = $1) == null || $receiver.a$nil){
  47016. $1;
  47017. } else {
  47018. var outer;
  47019. outer=$receiver;
  47020. $2=$recv(outer)._methodContext();
  47021. if(($receiver = $2) == null || $receiver.a$nil){
  47022. $2;
  47023. } else {
  47024. $self._outerContext_($recv($self._class())._fromMethodContext_($recv(aMethodContext)._outerContext()));
  47025. }
  47026. $3=$recv(aMethodContext)._locals();
  47027. $ctx1.sendIdx["locals"]=1;
  47028. $recv($3)._keysAndValuesDo_((function(key,value){
  47029. return $core.withContext(function($ctx2) {
  47030. return $recv($self._locals())._at_put_(key,value);
  47031. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  47032. }));
  47033. }
  47034. return self;
  47035. }, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext})});
  47036. },
  47037. args: ["aMethodContext"],
  47038. 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 ] ]",
  47039. referencedClasses: [],
  47040. pragmas: [],
  47041. messageSends: ["evaluatedSelector:", "evaluatedSelector", "index:", "index", "sendIndexes:", "sendIndexes", "receiver:", "receiver", "supercall:", "supercall", "selector:", "selector", "ifNotNil:", "outerContext", "methodContext", "outerContext:", "fromMethodContext:", "class", "keysAndValuesDo:", "locals", "at:put:"]
  47042. }),
  47043. $globals.AIContext);
  47044. $core.addMethod(
  47045. $core.method({
  47046. selector: "initializeInterpreter",
  47047. protocol: "initialization",
  47048. fn: function (){
  47049. var self=this,$self=this;
  47050. return $core.withContext(function($ctx1) {
  47051. var $1,$2,$receiver;
  47052. $1=$recv($globals.ASTInterpreter)._new();
  47053. $recv($1)._context_(self);
  47054. $self.interpreter=$recv($1)._yourself();
  47055. $2=$self._innerContext();
  47056. if(($receiver = $2) == null || $receiver.a$nil){
  47057. $2;
  47058. } else {
  47059. $self._setupInterpreter_($self.interpreter);
  47060. }
  47061. return self;
  47062. }, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{})});
  47063. },
  47064. args: [],
  47065. source: "initializeInterpreter\x0a\x09interpreter := ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09yourself.\x0a\x09\x0a\x09self innerContext ifNotNil: [\x0a\x09\x09self setupInterpreter: interpreter ]",
  47066. referencedClasses: ["ASTInterpreter"],
  47067. pragmas: [],
  47068. messageSends: ["context:", "new", "yourself", "ifNotNil:", "innerContext", "setupInterpreter:"]
  47069. }),
  47070. $globals.AIContext);
  47071. $core.addMethod(
  47072. $core.method({
  47073. selector: "initializeLocals",
  47074. protocol: "initialization",
  47075. fn: function (){
  47076. var self=this,$self=this;
  47077. return $core.withContext(function($ctx1) {
  47078. $self.locals=$recv($globals.Dictionary)._new();
  47079. $recv($self.locals)._at_put_("thisContext",self);
  47080. return self;
  47081. }, function($ctx1) {$ctx1.fill(self,"initializeLocals",{})});
  47082. },
  47083. args: [],
  47084. source: "initializeLocals\x0a\x09locals := Dictionary new.\x0a\x09locals at: 'thisContext' put: self.",
  47085. referencedClasses: ["Dictionary"],
  47086. pragmas: [],
  47087. messageSends: ["new", "at:put:"]
  47088. }),
  47089. $globals.AIContext);
  47090. $core.addMethod(
  47091. $core.method({
  47092. selector: "innerContext",
  47093. protocol: "accessing",
  47094. fn: function (){
  47095. var self=this,$self=this;
  47096. return $self.innerContext;
  47097. },
  47098. args: [],
  47099. source: "innerContext\x0a\x09^ innerContext",
  47100. referencedClasses: [],
  47101. pragmas: [],
  47102. messageSends: []
  47103. }),
  47104. $globals.AIContext);
  47105. $core.addMethod(
  47106. $core.method({
  47107. selector: "innerContext:",
  47108. protocol: "accessing",
  47109. fn: function (anAIContext){
  47110. var self=this,$self=this;
  47111. $self.innerContext=anAIContext;
  47112. return self;
  47113. },
  47114. args: ["anAIContext"],
  47115. source: "innerContext: anAIContext\x0a\x09innerContext := anAIContext",
  47116. referencedClasses: [],
  47117. pragmas: [],
  47118. messageSends: []
  47119. }),
  47120. $globals.AIContext);
  47121. $core.addMethod(
  47122. $core.method({
  47123. selector: "interpreter",
  47124. protocol: "interpreting",
  47125. fn: function (){
  47126. var self=this,$self=this;
  47127. return $core.withContext(function($ctx1) {
  47128. var $1,$receiver;
  47129. $1=$self.interpreter;
  47130. if(($receiver = $1) == null || $receiver.a$nil){
  47131. $self._initializeInterpreter();
  47132. } else {
  47133. $1;
  47134. }
  47135. return $self.interpreter;
  47136. }, function($ctx1) {$ctx1.fill(self,"interpreter",{})});
  47137. },
  47138. args: [],
  47139. source: "interpreter\x0a\x09interpreter ifNil: [ self initializeInterpreter ].\x0a\x09^ interpreter",
  47140. referencedClasses: [],
  47141. pragmas: [],
  47142. messageSends: ["ifNil:", "initializeInterpreter"]
  47143. }),
  47144. $globals.AIContext);
  47145. $core.addMethod(
  47146. $core.method({
  47147. selector: "interpreter:",
  47148. protocol: "interpreting",
  47149. fn: function (anInterpreter){
  47150. var self=this,$self=this;
  47151. $self.interpreter=anInterpreter;
  47152. return self;
  47153. },
  47154. args: ["anInterpreter"],
  47155. source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter",
  47156. referencedClasses: [],
  47157. pragmas: [],
  47158. messageSends: []
  47159. }),
  47160. $globals.AIContext);
  47161. $core.addMethod(
  47162. $core.method({
  47163. selector: "isTopContext",
  47164. protocol: "testing",
  47165. fn: function (){
  47166. var self=this,$self=this;
  47167. return $core.withContext(function($ctx1) {
  47168. return $recv($self._innerContext())._isNil();
  47169. }, function($ctx1) {$ctx1.fill(self,"isTopContext",{})});
  47170. },
  47171. args: [],
  47172. source: "isTopContext\x0a\x09^ self innerContext isNil",
  47173. referencedClasses: [],
  47174. pragmas: [],
  47175. messageSends: ["isNil", "innerContext"]
  47176. }),
  47177. $globals.AIContext);
  47178. $core.addMethod(
  47179. $core.method({
  47180. selector: "localAt:",
  47181. protocol: "accessing",
  47182. fn: function (aString){
  47183. var self=this,$self=this;
  47184. var context;
  47185. return $core.withContext(function($ctx1) {
  47186. context=$self._lookupContextForLocal_(aString);
  47187. return $recv(context)._basicLocalAt_(aString);
  47188. }, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString,context:context})});
  47189. },
  47190. args: ["aString"],
  47191. 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",
  47192. referencedClasses: [],
  47193. pragmas: [],
  47194. messageSends: ["lookupContextForLocal:", "basicLocalAt:"]
  47195. }),
  47196. $globals.AIContext);
  47197. $core.addMethod(
  47198. $core.method({
  47199. selector: "localAt:ifAbsent:",
  47200. protocol: "accessing",
  47201. fn: function (aString,aBlock){
  47202. var self=this,$self=this;
  47203. var context;
  47204. return $core.withContext(function($ctx1) {
  47205. var $early={};
  47206. try {
  47207. context=$self._lookupContextForLocal_ifNone_(aString,(function(){
  47208. return $core.withContext(function($ctx2) {
  47209. throw $early=[$recv(aBlock)._value()];
  47210. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47211. }));
  47212. return $recv(context)._basicLocalAt_(aString);
  47213. }
  47214. catch(e) {if(e===$early)return e[0]; throw e}
  47215. }, function($ctx1) {$ctx1.fill(self,"localAt:ifAbsent:",{aString:aString,aBlock:aBlock,context:context})});
  47216. },
  47217. args: ["aString", "aBlock"],
  47218. 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",
  47219. referencedClasses: [],
  47220. pragmas: [],
  47221. messageSends: ["lookupContextForLocal:ifNone:", "value", "basicLocalAt:"]
  47222. }),
  47223. $globals.AIContext);
  47224. $core.addMethod(
  47225. $core.method({
  47226. selector: "localAt:put:",
  47227. protocol: "accessing",
  47228. fn: function (aString,anObject){
  47229. var self=this,$self=this;
  47230. var context;
  47231. return $core.withContext(function($ctx1) {
  47232. context=$self._lookupContextForLocal_(aString);
  47233. $recv(context)._basicLocalAt_put_(aString,anObject);
  47234. return self;
  47235. }, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject,context:context})});
  47236. },
  47237. args: ["aString", "anObject"],
  47238. source: "localAt: aString put: anObject\x0a\x09| context |\x0a\x09\x0a\x09context := self lookupContextForLocal: aString.\x0a\x09context basicLocalAt: aString put: anObject",
  47239. referencedClasses: [],
  47240. pragmas: [],
  47241. messageSends: ["lookupContextForLocal:", "basicLocalAt:put:"]
  47242. }),
  47243. $globals.AIContext);
  47244. $core.addMethod(
  47245. $core.method({
  47246. selector: "locals",
  47247. protocol: "accessing",
  47248. fn: function (){
  47249. var self=this,$self=this;
  47250. return $core.withContext(function($ctx1) {
  47251. var $1,$receiver;
  47252. $1=$self.locals;
  47253. if(($receiver = $1) == null || $receiver.a$nil){
  47254. $self._initializeLocals();
  47255. } else {
  47256. $1;
  47257. }
  47258. return $self.locals;
  47259. }, function($ctx1) {$ctx1.fill(self,"locals",{})});
  47260. },
  47261. args: [],
  47262. source: "locals\x0a\x09locals ifNil: [ self initializeLocals ].\x0a\x09\x0a\x09^ locals",
  47263. referencedClasses: [],
  47264. pragmas: [],
  47265. messageSends: ["ifNil:", "initializeLocals"]
  47266. }),
  47267. $globals.AIContext);
  47268. $core.addMethod(
  47269. $core.method({
  47270. selector: "lookupContextForLocal:",
  47271. protocol: "private",
  47272. fn: function (aString){
  47273. var self=this,$self=this;
  47274. return $core.withContext(function($ctx1) {
  47275. return $self._lookupContextForLocal_ifNone_(aString,(function(){
  47276. return $core.withContext(function($ctx2) {
  47277. return $self._variableNotFound();
  47278. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47279. }));
  47280. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:",{aString:aString})});
  47281. },
  47282. args: ["aString"],
  47283. 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 ]",
  47284. referencedClasses: [],
  47285. pragmas: [],
  47286. messageSends: ["lookupContextForLocal:ifNone:", "variableNotFound"]
  47287. }),
  47288. $globals.AIContext);
  47289. $core.addMethod(
  47290. $core.method({
  47291. selector: "lookupContextForLocal:ifNone:",
  47292. protocol: "private",
  47293. fn: function (aString,aBlock){
  47294. var self=this,$self=this;
  47295. return $core.withContext(function($ctx1) {
  47296. var $1;
  47297. return $recv($self._locals())._at_ifPresent_ifAbsent_(aString,(function(){
  47298. return self;
  47299. }),(function(){
  47300. return $core.withContext(function($ctx2) {
  47301. $1=$self._outerContext();
  47302. return $recv($1)._ifNil_ifNotNil_(aBlock,(function(context){
  47303. return $core.withContext(function($ctx3) {
  47304. return $recv(context)._lookupContextForLocal_(aString);
  47305. }, function($ctx3) {$ctx3.fillBlock({context:context},$ctx2,3)});
  47306. }));
  47307. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47308. }));
  47309. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:ifNone:",{aString:aString,aBlock:aBlock})});
  47310. },
  47311. args: ["aString", "aBlock"],
  47312. 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 ] ]",
  47313. referencedClasses: [],
  47314. pragmas: [],
  47315. messageSends: ["at:ifPresent:ifAbsent:", "locals", "ifNil:ifNotNil:", "outerContext", "lookupContextForLocal:"]
  47316. }),
  47317. $globals.AIContext);
  47318. $core.addMethod(
  47319. $core.method({
  47320. selector: "newInnerContext",
  47321. protocol: "factory",
  47322. fn: function (){
  47323. var self=this,$self=this;
  47324. return $core.withContext(function($ctx1) {
  47325. var $1;
  47326. $1=$recv($self._class())._new();
  47327. $recv($1)._outerContext_(self);
  47328. return $recv($1)._yourself();
  47329. }, function($ctx1) {$ctx1.fill(self,"newInnerContext",{})});
  47330. },
  47331. args: [],
  47332. source: "newInnerContext\x0a\x09^ self class new\x0a\x09\x09outerContext: self;\x0a\x09\x09yourself",
  47333. referencedClasses: [],
  47334. pragmas: [],
  47335. messageSends: ["outerContext:", "new", "class", "yourself"]
  47336. }),
  47337. $globals.AIContext);
  47338. $core.addMethod(
  47339. $core.method({
  47340. selector: "outerContext",
  47341. protocol: "accessing",
  47342. fn: function (){
  47343. var self=this,$self=this;
  47344. return $self.outerContext;
  47345. },
  47346. args: [],
  47347. source: "outerContext\x0a\x09^ outerContext",
  47348. referencedClasses: [],
  47349. pragmas: [],
  47350. messageSends: []
  47351. }),
  47352. $globals.AIContext);
  47353. $core.addMethod(
  47354. $core.method({
  47355. selector: "outerContext:",
  47356. protocol: "accessing",
  47357. fn: function (anAIContext){
  47358. var self=this,$self=this;
  47359. return $core.withContext(function($ctx1) {
  47360. var $1,$receiver;
  47361. $self.outerContext=anAIContext;
  47362. $1=$self.outerContext;
  47363. if(($receiver = $1) == null || $receiver.a$nil){
  47364. $1;
  47365. } else {
  47366. var context;
  47367. context=$receiver;
  47368. $recv(context)._innerContext_(self);
  47369. }
  47370. return self;
  47371. }, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext})});
  47372. },
  47373. args: ["anAIContext"],
  47374. source: "outerContext: anAIContext\x0a\x09outerContext := anAIContext.\x0a\x09outerContext ifNotNil: [ :context | \x0a\x09\x09context innerContext: self ]",
  47375. referencedClasses: [],
  47376. pragmas: [],
  47377. messageSends: ["ifNotNil:", "innerContext:"]
  47378. }),
  47379. $globals.AIContext);
  47380. $core.addMethod(
  47381. $core.method({
  47382. selector: "receiver:",
  47383. protocol: "interpreting",
  47384. fn: function (anObject){
  47385. var self=this,$self=this;
  47386. return $core.withContext(function($ctx1) {
  47387. $recv($self._locals())._at_put_("self",anObject);
  47388. return self;
  47389. }, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject})});
  47390. },
  47391. args: ["anObject"],
  47392. source: "receiver: anObject\x0a\x09self locals at: 'self' put: anObject",
  47393. referencedClasses: [],
  47394. pragmas: [],
  47395. messageSends: ["at:put:", "locals"]
  47396. }),
  47397. $globals.AIContext);
  47398. $core.addMethod(
  47399. $core.method({
  47400. selector: "selector",
  47401. protocol: "accessing",
  47402. fn: function (){
  47403. var self=this,$self=this;
  47404. return $self.selector;
  47405. },
  47406. args: [],
  47407. source: "selector\x0a\x09^ selector",
  47408. referencedClasses: [],
  47409. pragmas: [],
  47410. messageSends: []
  47411. }),
  47412. $globals.AIContext);
  47413. $core.addMethod(
  47414. $core.method({
  47415. selector: "selector:",
  47416. protocol: "accessing",
  47417. fn: function (aString){
  47418. var self=this,$self=this;
  47419. $self.selector=aString;
  47420. return self;
  47421. },
  47422. args: ["aString"],
  47423. source: "selector: aString\x0a\x09selector := aString",
  47424. referencedClasses: [],
  47425. pragmas: [],
  47426. messageSends: []
  47427. }),
  47428. $globals.AIContext);
  47429. $core.addMethod(
  47430. $core.method({
  47431. selector: "sendIndexAt:",
  47432. protocol: "accessing",
  47433. fn: function (aString){
  47434. var self=this,$self=this;
  47435. return $core.withContext(function($ctx1) {
  47436. return $recv($self._sendIndexes())._at_ifAbsent_(aString,(function(){
  47437. return (0);
  47438. }));
  47439. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aString:aString})});
  47440. },
  47441. args: ["aString"],
  47442. source: "sendIndexAt: aString\x0a\x09^ self sendIndexes at: aString ifAbsent: [ 0 ]",
  47443. referencedClasses: [],
  47444. pragmas: [],
  47445. messageSends: ["at:ifAbsent:", "sendIndexes"]
  47446. }),
  47447. $globals.AIContext);
  47448. $core.addMethod(
  47449. $core.method({
  47450. selector: "sendIndexes",
  47451. protocol: "accessing",
  47452. fn: function (){
  47453. var self=this,$self=this;
  47454. return $core.withContext(function($ctx1) {
  47455. var $1,$receiver;
  47456. $1=$self.sendIndexes;
  47457. if(($receiver = $1) == null || $receiver.a$nil){
  47458. return $recv($globals.Dictionary)._new();
  47459. } else {
  47460. return $1;
  47461. }
  47462. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{})});
  47463. },
  47464. args: [],
  47465. source: "sendIndexes\x0a\x09^ sendIndexes ifNil: [ Dictionary new ]",
  47466. referencedClasses: ["Dictionary"],
  47467. pragmas: [],
  47468. messageSends: ["ifNil:", "new"]
  47469. }),
  47470. $globals.AIContext);
  47471. $core.addMethod(
  47472. $core.method({
  47473. selector: "sendIndexes:",
  47474. protocol: "accessing",
  47475. fn: function (aDictionary){
  47476. var self=this,$self=this;
  47477. $self.sendIndexes=aDictionary;
  47478. return self;
  47479. },
  47480. args: ["aDictionary"],
  47481. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  47482. referencedClasses: [],
  47483. pragmas: [],
  47484. messageSends: []
  47485. }),
  47486. $globals.AIContext);
  47487. $core.addMethod(
  47488. $core.method({
  47489. selector: "setupInterpreter:",
  47490. protocol: "interpreting",
  47491. fn: function (anInterpreter){
  47492. var self=this,$self=this;
  47493. var currentNode;
  47494. return $core.withContext(function($ctx1) {
  47495. var $1,$2,$3,$4,$7,$6,$5,$receiver;
  47496. $1=$recv($globals.ASTPCNodeVisitor)._new();
  47497. $2=$self._evaluatedSelector();
  47498. $ctx1.sendIdx["evaluatedSelector"]=1;
  47499. $recv($1)._selector_($2);
  47500. $recv($1)._index_($self._sendIndexAt_($self._evaluatedSelector()));
  47501. $3=$self._ast();
  47502. $ctx1.sendIdx["ast"]=1;
  47503. $recv($1)._visit_($3);
  47504. currentNode=$recv($1)._currentNode();
  47505. $4=$recv($self._ast())._sequenceNode();
  47506. if(($receiver = $4) == null || $receiver.a$nil){
  47507. $4;
  47508. } else {
  47509. var sequence;
  47510. sequence=$receiver;
  47511. $recv($recv(sequence)._temps())._do_((function(each){
  47512. return $core.withContext(function($ctx2) {
  47513. return $self._defineLocal_(each);
  47514. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  47515. }));
  47516. $ctx1.sendIdx["do:"]=1;
  47517. }
  47518. $recv(anInterpreter)._node_(currentNode);
  47519. $7=$self._innerContext();
  47520. $ctx1.sendIdx["innerContext"]=1;
  47521. $6=$recv($7)._arguments();
  47522. $5=$recv($6)._reversed();
  47523. $recv($5)._do_((function(each){
  47524. return $core.withContext(function($ctx2) {
  47525. return $recv(anInterpreter)._push_(each);
  47526. $ctx2.sendIdx["push:"]=1;
  47527. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  47528. }));
  47529. $recv(anInterpreter)._push_($recv($self._innerContext())._receiver());
  47530. return self;
  47531. }, function($ctx1) {$ctx1.fill(self,"setupInterpreter:",{anInterpreter:anInterpreter,currentNode:currentNode})});
  47532. },
  47533. args: ["anInterpreter"],
  47534. 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)",
  47535. referencedClasses: ["ASTPCNodeVisitor"],
  47536. pragmas: [],
  47537. messageSends: ["selector:", "new", "evaluatedSelector", "index:", "sendIndexAt:", "visit:", "ast", "currentNode", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "node:", "reversed", "arguments", "innerContext", "push:", "receiver"]
  47538. }),
  47539. $globals.AIContext);
  47540. $core.addMethod(
  47541. $core.method({
  47542. selector: "supercall",
  47543. protocol: "interpreting",
  47544. fn: function (){
  47545. var self=this,$self=this;
  47546. return $core.withContext(function($ctx1) {
  47547. var $1,$receiver;
  47548. $1=$self.supercall;
  47549. if(($receiver = $1) == null || $receiver.a$nil){
  47550. return false;
  47551. } else {
  47552. return $1;
  47553. }
  47554. }, function($ctx1) {$ctx1.fill(self,"supercall",{})});
  47555. },
  47556. args: [],
  47557. source: "supercall\x0a\x09^ supercall ifNil: [ false ]",
  47558. referencedClasses: [],
  47559. pragmas: [],
  47560. messageSends: ["ifNil:"]
  47561. }),
  47562. $globals.AIContext);
  47563. $core.addMethod(
  47564. $core.method({
  47565. selector: "supercall:",
  47566. protocol: "interpreting",
  47567. fn: function (aBoolean){
  47568. var self=this,$self=this;
  47569. $self.supercall=aBoolean;
  47570. return self;
  47571. },
  47572. args: ["aBoolean"],
  47573. source: "supercall: aBoolean\x0a\x09supercall := aBoolean",
  47574. referencedClasses: [],
  47575. pragmas: [],
  47576. messageSends: []
  47577. }),
  47578. $globals.AIContext);
  47579. $core.addMethod(
  47580. $core.method({
  47581. selector: "variableNotFound",
  47582. protocol: "error handling",
  47583. fn: function (){
  47584. var self=this,$self=this;
  47585. return $core.withContext(function($ctx1) {
  47586. $self._error_("Variable missing");
  47587. return self;
  47588. }, function($ctx1) {$ctx1.fill(self,"variableNotFound",{})});
  47589. },
  47590. args: [],
  47591. source: "variableNotFound\x0a\x09\x22Error thrown whenever a variable lookup fails\x22\x0a\x09\x0a\x09self error: 'Variable missing'",
  47592. referencedClasses: [],
  47593. pragmas: [],
  47594. messageSends: ["error:"]
  47595. }),
  47596. $globals.AIContext);
  47597. $core.addMethod(
  47598. $core.method({
  47599. selector: "fromMethodContext:",
  47600. protocol: "instance creation",
  47601. fn: function (aMethodContext){
  47602. var self=this,$self=this;
  47603. return $core.withContext(function($ctx1) {
  47604. var $1;
  47605. $1=$self._new();
  47606. $recv($1)._initializeFromMethodContext_(aMethodContext);
  47607. return $recv($1)._yourself();
  47608. }, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext})});
  47609. },
  47610. args: ["aMethodContext"],
  47611. source: "fromMethodContext: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromMethodContext: aMethodContext;\x0a\x09\x09yourself",
  47612. referencedClasses: [],
  47613. pragmas: [],
  47614. messageSends: ["initializeFromMethodContext:", "new", "yourself"]
  47615. }),
  47616. $globals.AIContext.a$cls);
  47617. $core.addClass("AISemanticAnalyzer", $globals.SemanticAnalyzer, ["context"], "Compiler-Interpreter");
  47618. $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.";
  47619. $core.addMethod(
  47620. $core.method({
  47621. selector: "context",
  47622. protocol: "accessing",
  47623. fn: function (){
  47624. var self=this,$self=this;
  47625. return $self.context;
  47626. },
  47627. args: [],
  47628. source: "context\x0a\x09^ context",
  47629. referencedClasses: [],
  47630. pragmas: [],
  47631. messageSends: []
  47632. }),
  47633. $globals.AISemanticAnalyzer);
  47634. $core.addMethod(
  47635. $core.method({
  47636. selector: "context:",
  47637. protocol: "accessing",
  47638. fn: function (anAIContext){
  47639. var self=this,$self=this;
  47640. $self.context=anAIContext;
  47641. return self;
  47642. },
  47643. args: ["anAIContext"],
  47644. source: "context: anAIContext\x0a\x09context := anAIContext",
  47645. referencedClasses: [],
  47646. pragmas: [],
  47647. messageSends: []
  47648. }),
  47649. $globals.AISemanticAnalyzer);
  47650. $core.addMethod(
  47651. $core.method({
  47652. selector: "visitVariableNode:",
  47653. protocol: "visiting",
  47654. fn: function (aNode){
  47655. var self=this,$self=this;
  47656. return $core.withContext(function($ctx1) {
  47657. var $1;
  47658. var $early={};
  47659. try {
  47660. $recv($self._context())._localAt_ifAbsent_($recv(aNode)._value(),(function(){
  47661. return $core.withContext(function($ctx2) {
  47662. $1=(
  47663. $ctx2.supercall = true,
  47664. ($globals.AISemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitVariableNode_.apply($self, [aNode]));
  47665. $ctx2.supercall = false;
  47666. throw $early=[$1];
  47667. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47668. }));
  47669. $recv(aNode)._binding_($recv($globals.ASTContextVar)._new());
  47670. return self;
  47671. }
  47672. catch(e) {if(e===$early)return e[0]; throw e}
  47673. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode})});
  47674. },
  47675. args: ["aNode"],
  47676. source: "visitVariableNode: aNode\x0a\x09self context \x0a\x09\x09localAt: aNode value \x0a\x09\x09ifAbsent: [ ^ super visitVariableNode: aNode ].\x0a\x0a\x09aNode binding: ASTContextVar new",
  47677. referencedClasses: ["ASTContextVar"],
  47678. pragmas: [],
  47679. messageSends: ["localAt:ifAbsent:", "context", "value", "visitVariableNode:", "binding:", "new"]
  47680. }),
  47681. $globals.AISemanticAnalyzer);
  47682. $core.addClass("ASTContextVar", $globals.ScopeVar, ["context"], "Compiler-Interpreter");
  47683. $globals.ASTContextVar.comment="I am a variable defined in a `context`.";
  47684. $core.addMethod(
  47685. $core.method({
  47686. selector: "context",
  47687. protocol: "accessing",
  47688. fn: function (){
  47689. var self=this,$self=this;
  47690. return $self.context;
  47691. },
  47692. args: [],
  47693. source: "context\x0a\x09^ context",
  47694. referencedClasses: [],
  47695. pragmas: [],
  47696. messageSends: []
  47697. }),
  47698. $globals.ASTContextVar);
  47699. $core.addMethod(
  47700. $core.method({
  47701. selector: "context:",
  47702. protocol: "accessing",
  47703. fn: function (anObject){
  47704. var self=this,$self=this;
  47705. $self.context=anObject;
  47706. return self;
  47707. },
  47708. args: ["anObject"],
  47709. source: "context: anObject\x0a\x09context := anObject",
  47710. referencedClasses: [],
  47711. pragmas: [],
  47712. messageSends: []
  47713. }),
  47714. $globals.ASTContextVar);
  47715. $core.addClass("ASTDebugger", $globals.Object, ["interpreter", "context", "result"], "Compiler-Interpreter");
  47716. $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.";
  47717. $core.addMethod(
  47718. $core.method({
  47719. selector: "atEnd",
  47720. protocol: "testing",
  47721. fn: function (){
  47722. var self=this,$self=this;
  47723. return $core.withContext(function($ctx1) {
  47724. var $1,$receiver;
  47725. $1=$self._context();
  47726. $ctx1.sendIdx["context"]=1;
  47727. if(($receiver = $1) == null || $receiver.a$nil){
  47728. return true;
  47729. } else {
  47730. $1;
  47731. }
  47732. return $recv($recv($self._interpreter())._atEnd())._and_((function(){
  47733. return $core.withContext(function($ctx2) {
  47734. return $recv($self._context())._isTopContext();
  47735. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47736. }));
  47737. }, function($ctx1) {$ctx1.fill(self,"atEnd",{})});
  47738. },
  47739. args: [],
  47740. source: "atEnd\x09\x0a\x09self context ifNil: [ ^ true ].\x0a\x09\x0a\x09^ self interpreter atEnd and: [ \x0a\x09\x09self context isTopContext ]",
  47741. referencedClasses: [],
  47742. pragmas: [],
  47743. messageSends: ["ifNil:", "context", "and:", "atEnd", "interpreter", "isTopContext"]
  47744. }),
  47745. $globals.ASTDebugger);
  47746. $core.addMethod(
  47747. $core.method({
  47748. selector: "context",
  47749. protocol: "accessing",
  47750. fn: function (){
  47751. var self=this,$self=this;
  47752. return $self.context;
  47753. },
  47754. args: [],
  47755. source: "context\x0a\x09^ context",
  47756. referencedClasses: [],
  47757. pragmas: [],
  47758. messageSends: []
  47759. }),
  47760. $globals.ASTDebugger);
  47761. $core.addMethod(
  47762. $core.method({
  47763. selector: "context:",
  47764. protocol: "accessing",
  47765. fn: function (aContext){
  47766. var self=this,$self=this;
  47767. $self.context=aContext;
  47768. return self;
  47769. },
  47770. args: ["aContext"],
  47771. source: "context: aContext\x0a\x09context := aContext",
  47772. referencedClasses: [],
  47773. pragmas: [],
  47774. messageSends: []
  47775. }),
  47776. $globals.ASTDebugger);
  47777. $core.addMethod(
  47778. $core.method({
  47779. selector: "flushInnerContexts",
  47780. protocol: "actions",
  47781. fn: function (){
  47782. var self=this,$self=this;
  47783. return $core.withContext(function($ctx1) {
  47784. var $1,$receiver;
  47785. $1=$self._context();
  47786. if(($receiver = $1) == null || $receiver.a$nil){
  47787. $1;
  47788. } else {
  47789. var cxt;
  47790. cxt=$receiver;
  47791. $recv(cxt)._innerContext_(nil);
  47792. }
  47793. return self;
  47794. }, function($ctx1) {$ctx1.fill(self,"flushInnerContexts",{})});
  47795. },
  47796. args: [],
  47797. 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 ]",
  47798. referencedClasses: [],
  47799. pragmas: [],
  47800. messageSends: ["ifNotNil:", "context", "innerContext:"]
  47801. }),
  47802. $globals.ASTDebugger);
  47803. $core.addMethod(
  47804. $core.method({
  47805. selector: "interpreter",
  47806. protocol: "accessing",
  47807. fn: function (){
  47808. var self=this,$self=this;
  47809. return $core.withContext(function($ctx1) {
  47810. var $1,$receiver;
  47811. $1=$self._context();
  47812. if(($receiver = $1) == null || $receiver.a$nil){
  47813. return $1;
  47814. } else {
  47815. var ctx;
  47816. ctx=$receiver;
  47817. return $recv(ctx)._interpreter();
  47818. }
  47819. }, function($ctx1) {$ctx1.fill(self,"interpreter",{})});
  47820. },
  47821. args: [],
  47822. source: "interpreter\x0a\x09^ self context ifNotNil: [ :ctx | \x0a\x09\x09ctx interpreter ]",
  47823. referencedClasses: [],
  47824. pragmas: [],
  47825. messageSends: ["ifNotNil:", "context", "interpreter"]
  47826. }),
  47827. $globals.ASTDebugger);
  47828. $core.addMethod(
  47829. $core.method({
  47830. selector: "method",
  47831. protocol: "accessing",
  47832. fn: function (){
  47833. var self=this,$self=this;
  47834. return $core.withContext(function($ctx1) {
  47835. return $recv($self._context())._method();
  47836. }, function($ctx1) {$ctx1.fill(self,"method",{})});
  47837. },
  47838. args: [],
  47839. source: "method\x0a\x09^ self context method",
  47840. referencedClasses: [],
  47841. pragmas: [],
  47842. messageSends: ["method", "context"]
  47843. }),
  47844. $globals.ASTDebugger);
  47845. $core.addMethod(
  47846. $core.method({
  47847. selector: "node",
  47848. protocol: "accessing",
  47849. fn: function (){
  47850. var self=this,$self=this;
  47851. return $core.withContext(function($ctx1) {
  47852. var $1,$receiver;
  47853. $1=$self._interpreter();
  47854. $ctx1.sendIdx["interpreter"]=1;
  47855. if(($receiver = $1) == null || $receiver.a$nil){
  47856. return $1;
  47857. } else {
  47858. return $recv($self._interpreter())._node();
  47859. }
  47860. }, function($ctx1) {$ctx1.fill(self,"node",{})});
  47861. },
  47862. args: [],
  47863. source: "node\x0a\x09^ self interpreter ifNotNil: [\x0a\x09\x09self interpreter node ]",
  47864. referencedClasses: [],
  47865. pragmas: [],
  47866. messageSends: ["ifNotNil:", "interpreter", "node"]
  47867. }),
  47868. $globals.ASTDebugger);
  47869. $core.addMethod(
  47870. $core.method({
  47871. selector: "onStep",
  47872. protocol: "private",
  47873. fn: function (){
  47874. var self=this,$self=this;
  47875. return $core.withContext(function($ctx1) {
  47876. var $1,$3,$2,$4,$6,$5,$receiver;
  47877. $1=$self._interpreter();
  47878. $ctx1.sendIdx["interpreter"]=1;
  47879. $self.result=$recv($1)._result();
  47880. $3=$self._interpreter();
  47881. $ctx1.sendIdx["interpreter"]=2;
  47882. $2=$recv($3)._atEnd();
  47883. $ctx1.sendIdx["atEnd"]=1;
  47884. if($core.assert($2)){
  47885. $4=$recv($self._context())._outerContext();
  47886. if(($receiver = $4) == null || $receiver.a$nil){
  47887. $4;
  47888. } else {
  47889. var outerContext;
  47890. outerContext=$receiver;
  47891. $self._context_(outerContext);
  47892. }
  47893. $6=$self._interpreter();
  47894. $ctx1.sendIdx["interpreter"]=3;
  47895. $5=$recv($6)._atEnd();
  47896. if(!$core.assert($5)){
  47897. $recv($self._interpreter())._skip();
  47898. }
  47899. }
  47900. $self._flushInnerContexts();
  47901. return self;
  47902. }, function($ctx1) {$ctx1.fill(self,"onStep",{})});
  47903. },
  47904. args: [],
  47905. 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",
  47906. referencedClasses: [],
  47907. pragmas: [],
  47908. messageSends: ["result", "interpreter", "ifTrue:", "atEnd", "ifNotNil:", "outerContext", "context", "context:", "ifFalse:", "skip", "flushInnerContexts"]
  47909. }),
  47910. $globals.ASTDebugger);
  47911. $core.addMethod(
  47912. $core.method({
  47913. selector: "proceed",
  47914. protocol: "stepping",
  47915. fn: function (){
  47916. var self=this,$self=this;
  47917. return $core.withContext(function($ctx1) {
  47918. $recv((function(){
  47919. return $core.withContext(function($ctx2) {
  47920. return $self._atEnd();
  47921. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47922. }))._whileFalse_((function(){
  47923. return $core.withContext(function($ctx2) {
  47924. return $self._stepOver();
  47925. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47926. }));
  47927. return self;
  47928. }, function($ctx1) {$ctx1.fill(self,"proceed",{})});
  47929. },
  47930. args: [],
  47931. source: "proceed\x0a\x09[ self atEnd ] whileFalse: [ self stepOver ]",
  47932. referencedClasses: [],
  47933. pragmas: [],
  47934. messageSends: ["whileFalse:", "atEnd", "stepOver"]
  47935. }),
  47936. $globals.ASTDebugger);
  47937. $core.addMethod(
  47938. $core.method({
  47939. selector: "restart",
  47940. protocol: "stepping",
  47941. fn: function (){
  47942. var self=this,$self=this;
  47943. return $core.withContext(function($ctx1) {
  47944. $recv($self._interpreter())._restart();
  47945. $self._flushInnerContexts();
  47946. return self;
  47947. }, function($ctx1) {$ctx1.fill(self,"restart",{})});
  47948. },
  47949. args: [],
  47950. source: "restart\x0a\x09self interpreter restart.\x0a\x09self flushInnerContexts",
  47951. referencedClasses: [],
  47952. pragmas: [],
  47953. messageSends: ["restart", "interpreter", "flushInnerContexts"]
  47954. }),
  47955. $globals.ASTDebugger);
  47956. $core.addMethod(
  47957. $core.method({
  47958. selector: "result",
  47959. protocol: "accessing",
  47960. fn: function (){
  47961. var self=this,$self=this;
  47962. return $self.result;
  47963. },
  47964. args: [],
  47965. source: "result\x0a\x09^ result",
  47966. referencedClasses: [],
  47967. pragmas: [],
  47968. messageSends: []
  47969. }),
  47970. $globals.ASTDebugger);
  47971. $core.addMethod(
  47972. $core.method({
  47973. selector: "stepInto",
  47974. protocol: "stepping",
  47975. fn: function (){
  47976. var self=this,$self=this;
  47977. return $core.withContext(function($ctx1) {
  47978. $self._shouldBeImplemented();
  47979. return self;
  47980. }, function($ctx1) {$ctx1.fill(self,"stepInto",{})});
  47981. },
  47982. args: [],
  47983. source: "stepInto\x0a\x09self shouldBeImplemented",
  47984. referencedClasses: [],
  47985. pragmas: [],
  47986. messageSends: ["shouldBeImplemented"]
  47987. }),
  47988. $globals.ASTDebugger);
  47989. $core.addMethod(
  47990. $core.method({
  47991. selector: "stepOver",
  47992. protocol: "stepping",
  47993. fn: function (){
  47994. var self=this,$self=this;
  47995. return $core.withContext(function($ctx1) {
  47996. var $1,$2;
  47997. $1=$recv($self._context())._isTopContext();
  47998. if($core.assert($1)){
  47999. $recv($self._interpreter())._stepOver();
  48000. } else {
  48001. $2=$self._interpreter();
  48002. $ctx1.sendIdx["interpreter"]=1;
  48003. $recv($2)._skip();
  48004. }
  48005. $self._onStep();
  48006. return self;
  48007. }, function($ctx1) {$ctx1.fill(self,"stepOver",{})});
  48008. },
  48009. args: [],
  48010. source: "stepOver\x0a\x09self context isTopContext \x0a\x09\x09ifFalse: [ self interpreter skip ]\x0a\x09\x09ifTrue: [ self interpreter stepOver ].\x0a\x09self onStep",
  48011. referencedClasses: [],
  48012. pragmas: [],
  48013. messageSends: ["ifFalse:ifTrue:", "isTopContext", "context", "skip", "interpreter", "stepOver", "onStep"]
  48014. }),
  48015. $globals.ASTDebugger);
  48016. $core.addMethod(
  48017. $core.method({
  48018. selector: "context:",
  48019. protocol: "instance creation",
  48020. fn: function (aContext){
  48021. var self=this,$self=this;
  48022. return $core.withContext(function($ctx1) {
  48023. var $1;
  48024. $1=$self._new();
  48025. $recv($1)._context_(aContext);
  48026. return $recv($1)._yourself();
  48027. }, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext})});
  48028. },
  48029. args: ["aContext"],
  48030. source: "context: aContext\x0a\x09^ self new\x0a\x09\x09context: aContext;\x0a\x09\x09yourself",
  48031. referencedClasses: [],
  48032. pragmas: [],
  48033. messageSends: ["context:", "new", "yourself"]
  48034. }),
  48035. $globals.ASTDebugger.a$cls);
  48036. $core.addClass("ASTEnterNode", $globals.NodeVisitor, ["interpreter"], "Compiler-Interpreter");
  48037. $core.addMethod(
  48038. $core.method({
  48039. selector: "interpreter",
  48040. protocol: "accessing",
  48041. fn: function (){
  48042. var self=this,$self=this;
  48043. return $self.interpreter;
  48044. },
  48045. args: [],
  48046. source: "interpreter\x0a\x09^ interpreter",
  48047. referencedClasses: [],
  48048. pragmas: [],
  48049. messageSends: []
  48050. }),
  48051. $globals.ASTEnterNode);
  48052. $core.addMethod(
  48053. $core.method({
  48054. selector: "interpreter:",
  48055. protocol: "accessing",
  48056. fn: function (anObject){
  48057. var self=this,$self=this;
  48058. $self.interpreter=anObject;
  48059. return self;
  48060. },
  48061. args: ["anObject"],
  48062. source: "interpreter: anObject\x0a\x09interpreter := anObject",
  48063. referencedClasses: [],
  48064. pragmas: [],
  48065. messageSends: []
  48066. }),
  48067. $globals.ASTEnterNode);
  48068. $core.addMethod(
  48069. $core.method({
  48070. selector: "visitBlockNode:",
  48071. protocol: "visiting",
  48072. fn: function (aNode){
  48073. var self=this,$self=this;
  48074. return aNode;
  48075. },
  48076. args: ["aNode"],
  48077. source: "visitBlockNode: aNode\x0a\x09\x22Answer the node as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ aNode",
  48078. referencedClasses: [],
  48079. pragmas: [],
  48080. messageSends: []
  48081. }),
  48082. $globals.ASTEnterNode);
  48083. $core.addMethod(
  48084. $core.method({
  48085. selector: "visitDagNode:",
  48086. protocol: "visiting",
  48087. fn: function (aNode){
  48088. var self=this,$self=this;
  48089. return $core.withContext(function($ctx1) {
  48090. return $recv($recv(aNode)._dagChildren())._ifEmpty_ifNotEmpty_((function(){
  48091. return aNode;
  48092. }),(function(nodes){
  48093. return $core.withContext(function($ctx2) {
  48094. return $self._visit_($recv(nodes)._first());
  48095. }, function($ctx2) {$ctx2.fillBlock({nodes:nodes},$ctx1,2)});
  48096. }));
  48097. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode})});
  48098. },
  48099. args: ["aNode"],
  48100. source: "visitDagNode: aNode\x0a\x09^ aNode dagChildren\x0a\x09\x09ifEmpty: [ aNode ]\x0a\x09\x09ifNotEmpty: [ :nodes | self visit: nodes first ]",
  48101. referencedClasses: [],
  48102. pragmas: [],
  48103. messageSends: ["ifEmpty:ifNotEmpty:", "dagChildren", "visit:", "first"]
  48104. }),
  48105. $globals.ASTEnterNode);
  48106. $core.addMethod(
  48107. $core.method({
  48108. selector: "visitSequenceNode:",
  48109. protocol: "visiting",
  48110. fn: function (aNode){
  48111. var self=this,$self=this;
  48112. return $core.withContext(function($ctx1) {
  48113. var $1;
  48114. $recv($recv(aNode)._temps())._do_((function(each){
  48115. return $core.withContext(function($ctx2) {
  48116. return $recv($recv($self._interpreter())._context())._defineLocal_(each);
  48117. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48118. }));
  48119. $1=(
  48120. $ctx1.supercall = true,
  48121. ($globals.ASTEnterNode.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($self, [aNode]));
  48122. $ctx1.supercall = false;
  48123. return $1;
  48124. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode})});
  48125. },
  48126. args: ["aNode"],
  48127. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self interpreter context defineLocal: each ].\x0a\x09^ super visitSequenceNode: aNode",
  48128. referencedClasses: [],
  48129. pragmas: [],
  48130. messageSends: ["do:", "temps", "defineLocal:", "context", "interpreter", "visitSequenceNode:"]
  48131. }),
  48132. $globals.ASTEnterNode);
  48133. $core.addMethod(
  48134. $core.method({
  48135. selector: "on:",
  48136. protocol: "instance creation",
  48137. fn: function (anInterpreter){
  48138. var self=this,$self=this;
  48139. return $core.withContext(function($ctx1) {
  48140. var $1;
  48141. $1=$self._new();
  48142. $recv($1)._interpreter_(anInterpreter);
  48143. return $recv($1)._yourself();
  48144. }, function($ctx1) {$ctx1.fill(self,"on:",{anInterpreter:anInterpreter})});
  48145. },
  48146. args: ["anInterpreter"],
  48147. source: "on: anInterpreter\x0a\x09^ self new\x0a\x09\x09interpreter: anInterpreter;\x0a\x09\x09yourself",
  48148. referencedClasses: [],
  48149. pragmas: [],
  48150. messageSends: ["interpreter:", "new", "yourself"]
  48151. }),
  48152. $globals.ASTEnterNode.a$cls);
  48153. $core.addClass("ASTInterpreter", $globals.NodeVisitor, ["node", "context", "stack", "returnValue", "returned", "forceAtEnd"], "Compiler-Interpreter");
  48154. $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";
  48155. $core.addMethod(
  48156. $core.method({
  48157. selector: "assign:to:",
  48158. protocol: "private",
  48159. fn: function (aNode,anObject){
  48160. var self=this,$self=this;
  48161. return $core.withContext(function($ctx1) {
  48162. var $1,$3,$2,$4;
  48163. $1=$recv($recv(aNode)._binding())._isInstanceVar();
  48164. if($core.assert($1)){
  48165. $3=$self._context();
  48166. $ctx1.sendIdx["context"]=1;
  48167. $2=$recv($3)._receiver();
  48168. $4=$recv(aNode)._value();
  48169. $ctx1.sendIdx["value"]=1;
  48170. $recv($2)._instVarAt_put_($4,anObject);
  48171. } else {
  48172. $recv($self._context())._localAt_put_($recv(aNode)._value(),anObject);
  48173. }
  48174. return self;
  48175. }, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject})});
  48176. },
  48177. args: ["aNode", "anObject"],
  48178. source: "assign: aNode to: anObject\x0a\x09aNode binding isInstanceVar\x0a\x09\x09ifTrue: [ self context receiver instVarAt: aNode value put: anObject ]\x0a\x09\x09ifFalse: [ self context localAt: aNode value put: anObject ]",
  48179. referencedClasses: [],
  48180. pragmas: [],
  48181. messageSends: ["ifTrue:ifFalse:", "isInstanceVar", "binding", "instVarAt:put:", "receiver", "context", "value", "localAt:put:"]
  48182. }),
  48183. $globals.ASTInterpreter);
  48184. $core.addMethod(
  48185. $core.method({
  48186. selector: "atEnd",
  48187. protocol: "testing",
  48188. fn: function (){
  48189. var self=this,$self=this;
  48190. return $core.withContext(function($ctx1) {
  48191. var $1;
  48192. $1=$self.forceAtEnd;
  48193. if($core.assert($1)){
  48194. return true;
  48195. }
  48196. return $recv($self._hasReturned())._or_((function(){
  48197. return $core.withContext(function($ctx2) {
  48198. return $recv($self._node())._isNil();
  48199. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  48200. }));
  48201. }, function($ctx1) {$ctx1.fill(self,"atEnd",{})});
  48202. },
  48203. args: [],
  48204. source: "atEnd\x0a\x09forceAtEnd ifTrue: [ ^ true ].\x0a\x09\x0a\x09^ self hasReturned or: [ self node isNil ]",
  48205. referencedClasses: [],
  48206. pragmas: [],
  48207. messageSends: ["ifTrue:", "or:", "hasReturned", "isNil", "node"]
  48208. }),
  48209. $globals.ASTInterpreter);
  48210. $core.addMethod(
  48211. $core.method({
  48212. selector: "context",
  48213. protocol: "accessing",
  48214. fn: function (){
  48215. var self=this,$self=this;
  48216. return $self.context;
  48217. },
  48218. args: [],
  48219. source: "context\x0a\x09^ context",
  48220. referencedClasses: [],
  48221. pragmas: [],
  48222. messageSends: []
  48223. }),
  48224. $globals.ASTInterpreter);
  48225. $core.addMethod(
  48226. $core.method({
  48227. selector: "context:",
  48228. protocol: "accessing",
  48229. fn: function (aContext){
  48230. var self=this,$self=this;
  48231. $self.context=aContext;
  48232. return self;
  48233. },
  48234. args: ["aContext"],
  48235. source: "context: aContext\x0a\x09context := aContext",
  48236. referencedClasses: [],
  48237. pragmas: [],
  48238. messageSends: []
  48239. }),
  48240. $globals.ASTInterpreter);
  48241. $core.addMethod(
  48242. $core.method({
  48243. selector: "enterNode",
  48244. protocol: "interpreting",
  48245. fn: function (){
  48246. var self=this,$self=this;
  48247. return $core.withContext(function($ctx1) {
  48248. $self._node_($recv($recv($globals.ASTEnterNode)._on_(self))._visit_($self._node()));
  48249. return self;
  48250. }, function($ctx1) {$ctx1.fill(self,"enterNode",{})});
  48251. },
  48252. args: [],
  48253. source: "enterNode\x0a\x09self node: ((ASTEnterNode on: self) visit: self node)",
  48254. referencedClasses: ["ASTEnterNode"],
  48255. pragmas: [],
  48256. messageSends: ["node:", "visit:", "on:", "node"]
  48257. }),
  48258. $globals.ASTInterpreter);
  48259. $core.addMethod(
  48260. $core.method({
  48261. selector: "eval:",
  48262. protocol: "private",
  48263. fn: function (aString){
  48264. var self=this,$self=this;
  48265. var source,function_;
  48266. return $core.withContext(function($ctx1) {
  48267. var $3,$2,$1;
  48268. source=$recv($globals.String)._streamContents_((function(str){
  48269. return $core.withContext(function($ctx2) {
  48270. $recv(str)._nextPutAll_("0,(function(");
  48271. $ctx2.sendIdx["nextPutAll:"]=1;
  48272. $3=$self._context();
  48273. $ctx2.sendIdx["context"]=1;
  48274. $2=$recv($3)._locals();
  48275. $ctx2.sendIdx["locals"]=1;
  48276. $1=$recv($2)._keys();
  48277. $recv($1)._do_separatedBy_((function(each){
  48278. return $core.withContext(function($ctx3) {
  48279. return $recv(str)._nextPutAll_(each);
  48280. $ctx3.sendIdx["nextPutAll:"]=2;
  48281. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  48282. }),(function(){
  48283. return $core.withContext(function($ctx3) {
  48284. return $recv(str)._nextPutAll_(",");
  48285. $ctx3.sendIdx["nextPutAll:"]=3;
  48286. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  48287. }));
  48288. $recv(str)._nextPutAll_("){ return (function() {");
  48289. $ctx2.sendIdx["nextPutAll:"]=4;
  48290. $recv(str)._nextPutAll_(aString);
  48291. $ctx2.sendIdx["nextPutAll:"]=5;
  48292. return $recv(str)._nextPutAll_("})()})");
  48293. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  48294. }));
  48295. function_=$recv($globals.Compiler)._eval_(source);
  48296. return $recv(function_)._valueWithPossibleArguments_($recv($recv($self._context())._locals())._values());
  48297. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_})});
  48298. },
  48299. args: ["aString"],
  48300. 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",
  48301. referencedClasses: ["String", "Compiler"],
  48302. pragmas: [],
  48303. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "valueWithPossibleArguments:", "values"]
  48304. }),
  48305. $globals.ASTInterpreter);
  48306. $core.addMethod(
  48307. $core.method({
  48308. selector: "hasReturned",
  48309. protocol: "testing",
  48310. fn: function (){
  48311. var self=this,$self=this;
  48312. return $core.withContext(function($ctx1) {
  48313. var $1,$receiver;
  48314. $1=$self.returned;
  48315. if(($receiver = $1) == null || $receiver.a$nil){
  48316. return false;
  48317. } else {
  48318. return $1;
  48319. }
  48320. }, function($ctx1) {$ctx1.fill(self,"hasReturned",{})});
  48321. },
  48322. args: [],
  48323. source: "hasReturned\x0a\x09^ returned ifNil: [ false ]",
  48324. referencedClasses: [],
  48325. pragmas: [],
  48326. messageSends: ["ifNil:"]
  48327. }),
  48328. $globals.ASTInterpreter);
  48329. $core.addMethod(
  48330. $core.method({
  48331. selector: "initialize",
  48332. protocol: "initialization",
  48333. fn: function (){
  48334. var self=this,$self=this;
  48335. return $core.withContext(function($ctx1) {
  48336. (
  48337. $ctx1.supercall = true,
  48338. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  48339. $ctx1.supercall = false;
  48340. $self.forceAtEnd=false;
  48341. return self;
  48342. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  48343. },
  48344. args: [],
  48345. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09forceAtEnd := false",
  48346. referencedClasses: [],
  48347. pragmas: [],
  48348. messageSends: ["initialize"]
  48349. }),
  48350. $globals.ASTInterpreter);
  48351. $core.addMethod(
  48352. $core.method({
  48353. selector: "interpret",
  48354. protocol: "interpreting",
  48355. fn: function (){
  48356. var self=this,$self=this;
  48357. return $core.withContext(function($ctx1) {
  48358. $self._visit_($self._node());
  48359. return self;
  48360. }, function($ctx1) {$ctx1.fill(self,"interpret",{})});
  48361. },
  48362. args: [],
  48363. source: "interpret\x0a\x09\x22Interpret the next node to be evaluated\x22\x0a\x09\x0a\x09self visit: self node",
  48364. referencedClasses: [],
  48365. pragmas: [],
  48366. messageSends: ["visit:", "node"]
  48367. }),
  48368. $globals.ASTInterpreter);
  48369. $core.addMethod(
  48370. $core.method({
  48371. selector: "messageFromSendNode:arguments:",
  48372. protocol: "private",
  48373. fn: function (aSendNode,aCollection){
  48374. var self=this,$self=this;
  48375. return $core.withContext(function($ctx1) {
  48376. var $1;
  48377. $1=$recv($globals.Message)._new();
  48378. $recv($1)._selector_($recv(aSendNode)._selector());
  48379. $recv($1)._arguments_(aCollection);
  48380. return $recv($1)._yourself();
  48381. }, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:",{aSendNode:aSendNode,aCollection:aCollection})});
  48382. },
  48383. args: ["aSendNode", "aCollection"],
  48384. source: "messageFromSendNode: aSendNode arguments: aCollection\x0a\x09^ Message new\x0a\x09\x09selector: aSendNode selector;\x0a\x09\x09arguments: aCollection;\x0a\x09\x09yourself",
  48385. referencedClasses: ["Message"],
  48386. pragmas: [],
  48387. messageSends: ["selector:", "new", "selector", "arguments:", "yourself"]
  48388. }),
  48389. $globals.ASTInterpreter);
  48390. $core.addMethod(
  48391. $core.method({
  48392. selector: "messageNotUnderstood:receiver:",
  48393. protocol: "private",
  48394. fn: function (aMessage,anObject){
  48395. var self=this,$self=this;
  48396. return $core.withContext(function($ctx1) {
  48397. var $1;
  48398. $1=$recv($globals.MessageNotUnderstood)._new();
  48399. $recv($1)._message_(aMessage);
  48400. $recv($1)._receiver_(anObject);
  48401. $recv($1)._signal();
  48402. return self;
  48403. }, function($ctx1) {$ctx1.fill(self,"messageNotUnderstood:receiver:",{aMessage:aMessage,anObject:anObject})});
  48404. },
  48405. args: ["aMessage", "anObject"],
  48406. source: "messageNotUnderstood: aMessage receiver: anObject\x0a\x09MessageNotUnderstood new\x0a\x09\x09message: aMessage;\x0a\x09\x09receiver: anObject;\x0a\x09\x09signal",
  48407. referencedClasses: ["MessageNotUnderstood"],
  48408. pragmas: [],
  48409. messageSends: ["message:", "new", "receiver:", "signal"]
  48410. }),
  48411. $globals.ASTInterpreter);
  48412. $core.addMethod(
  48413. $core.method({
  48414. selector: "next",
  48415. protocol: "interpreting",
  48416. fn: function (){
  48417. var self=this,$self=this;
  48418. var nd,nextNode;
  48419. return $core.withContext(function($ctx1) {
  48420. var $1,$2,$receiver;
  48421. nd=$self._node();
  48422. $1=$recv(nd)._parent();
  48423. if(($receiver = $1) == null || $receiver.a$nil){
  48424. nextNode=$1;
  48425. } else {
  48426. var parent;
  48427. parent=$receiver;
  48428. $2=$recv(parent)._nextSiblingNode_(nd);
  48429. if(($receiver = $2) == null || $receiver.a$nil){
  48430. nextNode=parent;
  48431. } else {
  48432. var sibling;
  48433. sibling=$receiver;
  48434. nextNode=$recv($recv($globals.ASTEnterNode)._on_(self))._visit_(sibling);
  48435. }
  48436. }
  48437. $self._node_(nextNode);
  48438. return self;
  48439. }, function($ctx1) {$ctx1.fill(self,"next",{nd:nd,nextNode:nextNode})});
  48440. },
  48441. args: [],
  48442. source: "next\x0a\x09| nd nextNode |\x0a\x09nd := self node.\x0a\x09nextNode := nd parent ifNotNil: [ :parent |\x0a\x09\x09(parent nextSiblingNode: nd)\x0a\x09\x09\x09ifNil: [ parent ]\x0a\x09\x09\x09ifNotNil: [ :sibling | (ASTEnterNode on: self) visit: sibling ] ].\x0a\x09self node: nextNode",
  48443. referencedClasses: ["ASTEnterNode"],
  48444. pragmas: [],
  48445. messageSends: ["node", "ifNotNil:", "parent", "ifNil:ifNotNil:", "nextSiblingNode:", "visit:", "on:", "node:"]
  48446. }),
  48447. $globals.ASTInterpreter);
  48448. $core.addMethod(
  48449. $core.method({
  48450. selector: "node",
  48451. protocol: "accessing",
  48452. fn: function (){
  48453. var self=this,$self=this;
  48454. return $self.node;
  48455. },
  48456. args: [],
  48457. source: "node\x0a\x09\x22Answer the next node, ie the node to be evaluated in the next step\x22\x0a\x09\x0a\x09^ node",
  48458. referencedClasses: [],
  48459. pragmas: [],
  48460. messageSends: []
  48461. }),
  48462. $globals.ASTInterpreter);
  48463. $core.addMethod(
  48464. $core.method({
  48465. selector: "node:",
  48466. protocol: "accessing",
  48467. fn: function (aNode){
  48468. var self=this,$self=this;
  48469. $self.node=aNode;
  48470. return self;
  48471. },
  48472. args: ["aNode"],
  48473. source: "node: aNode\x0a\x09node := aNode",
  48474. referencedClasses: [],
  48475. pragmas: [],
  48476. messageSends: []
  48477. }),
  48478. $globals.ASTInterpreter);
  48479. $core.addMethod(
  48480. $core.method({
  48481. selector: "peek",
  48482. protocol: "stack",
  48483. fn: function (){
  48484. var self=this,$self=this;
  48485. return $core.withContext(function($ctx1) {
  48486. var $1;
  48487. var $early={};
  48488. try {
  48489. $1=$self._stack();
  48490. $ctx1.sendIdx["stack"]=1;
  48491. $recv($1)._ifEmpty_((function(){
  48492. throw $early=[nil];
  48493. }));
  48494. return $recv($self._stack())._last();
  48495. }
  48496. catch(e) {if(e===$early)return e[0]; throw e}
  48497. }, function($ctx1) {$ctx1.fill(self,"peek",{})});
  48498. },
  48499. args: [],
  48500. 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",
  48501. referencedClasses: [],
  48502. pragmas: [],
  48503. messageSends: ["ifEmpty:", "stack", "last"]
  48504. }),
  48505. $globals.ASTInterpreter);
  48506. $core.addMethod(
  48507. $core.method({
  48508. selector: "pop",
  48509. protocol: "stack",
  48510. fn: function (){
  48511. var self=this,$self=this;
  48512. var peekedValue;
  48513. return $core.withContext(function($ctx1) {
  48514. peekedValue=$self._peek();
  48515. $recv($self._stack())._removeLast();
  48516. return peekedValue;
  48517. }, function($ctx1) {$ctx1.fill(self,"pop",{peekedValue:peekedValue})});
  48518. },
  48519. args: [],
  48520. 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",
  48521. referencedClasses: [],
  48522. pragmas: [],
  48523. messageSends: ["peek", "removeLast", "stack"]
  48524. }),
  48525. $globals.ASTInterpreter);
  48526. $core.addMethod(
  48527. $core.method({
  48528. selector: "proceed",
  48529. protocol: "interpreting",
  48530. fn: function (){
  48531. var self=this,$self=this;
  48532. return $core.withContext(function($ctx1) {
  48533. $recv((function(){
  48534. return $core.withContext(function($ctx2) {
  48535. return $self._atEnd();
  48536. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48537. }))._whileFalse_((function(){
  48538. return $core.withContext(function($ctx2) {
  48539. return $self._step();
  48540. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  48541. }));
  48542. return self;
  48543. }, function($ctx1) {$ctx1.fill(self,"proceed",{})});
  48544. },
  48545. args: [],
  48546. source: "proceed\x0a\x09\x22Eagerly evaluate the ast\x22\x0a\x09\x0a\x09[ self atEnd ] \x0a\x09\x09whileFalse: [ self step ]",
  48547. referencedClasses: [],
  48548. pragmas: [],
  48549. messageSends: ["whileFalse:", "atEnd", "step"]
  48550. }),
  48551. $globals.ASTInterpreter);
  48552. $core.addMethod(
  48553. $core.method({
  48554. selector: "push:",
  48555. protocol: "stack",
  48556. fn: function (anObject){
  48557. var self=this,$self=this;
  48558. return $core.withContext(function($ctx1) {
  48559. return $recv($self._stack())._add_(anObject);
  48560. }, function($ctx1) {$ctx1.fill(self,"push:",{anObject:anObject})});
  48561. },
  48562. args: ["anObject"],
  48563. source: "push: anObject\x0a\x09\x22Push an object to the context stack\x22\x0a\x09\x0a\x09^ self stack add: anObject",
  48564. referencedClasses: [],
  48565. pragmas: [],
  48566. messageSends: ["add:", "stack"]
  48567. }),
  48568. $globals.ASTInterpreter);
  48569. $core.addMethod(
  48570. $core.method({
  48571. selector: "restart",
  48572. protocol: "interpreting",
  48573. fn: function (){
  48574. var self=this,$self=this;
  48575. return $core.withContext(function($ctx1) {
  48576. $self._node_($recv($self._context())._ast());
  48577. $self._enterNode();
  48578. return self;
  48579. }, function($ctx1) {$ctx1.fill(self,"restart",{})});
  48580. },
  48581. args: [],
  48582. source: "restart\x0a\x09self node: self context ast; enterNode",
  48583. referencedClasses: [],
  48584. pragmas: [],
  48585. messageSends: ["node:", "ast", "context", "enterNode"]
  48586. }),
  48587. $globals.ASTInterpreter);
  48588. $core.addMethod(
  48589. $core.method({
  48590. selector: "result",
  48591. protocol: "accessing",
  48592. fn: function (){
  48593. var self=this,$self=this;
  48594. return $core.withContext(function($ctx1) {
  48595. var $1;
  48596. $1=$self._hasReturned();
  48597. if($core.assert($1)){
  48598. return $self._returnValue();
  48599. } else {
  48600. return $recv($self._context())._receiver();
  48601. }
  48602. }, function($ctx1) {$ctx1.fill(self,"result",{})});
  48603. },
  48604. args: [],
  48605. source: "result\x0a\x09^ self hasReturned \x0a\x09\x09ifTrue: [ self returnValue ] \x0a\x09\x09ifFalse: [ self context receiver ]",
  48606. referencedClasses: [],
  48607. pragmas: [],
  48608. messageSends: ["ifTrue:ifFalse:", "hasReturned", "returnValue", "receiver", "context"]
  48609. }),
  48610. $globals.ASTInterpreter);
  48611. $core.addMethod(
  48612. $core.method({
  48613. selector: "returnValue",
  48614. protocol: "accessing",
  48615. fn: function (){
  48616. var self=this,$self=this;
  48617. return $self.returnValue;
  48618. },
  48619. args: [],
  48620. source: "returnValue\x0a\x09^ returnValue",
  48621. referencedClasses: [],
  48622. pragmas: [],
  48623. messageSends: []
  48624. }),
  48625. $globals.ASTInterpreter);
  48626. $core.addMethod(
  48627. $core.method({
  48628. selector: "returnValue:",
  48629. protocol: "accessing",
  48630. fn: function (anObject){
  48631. var self=this,$self=this;
  48632. $self.returnValue=anObject;
  48633. return self;
  48634. },
  48635. args: ["anObject"],
  48636. source: "returnValue: anObject\x0a\x09returnValue := anObject",
  48637. referencedClasses: [],
  48638. pragmas: [],
  48639. messageSends: []
  48640. }),
  48641. $globals.ASTInterpreter);
  48642. $core.addMethod(
  48643. $core.method({
  48644. selector: "sendMessage:to:superSend:",
  48645. protocol: "private",
  48646. fn: function (aMessage,anObject,aBoolean){
  48647. var self=this,$self=this;
  48648. var method;
  48649. return $core.withContext(function($ctx1) {
  48650. var $1,$2,$3,$receiver;
  48651. if(!$core.assert(aBoolean)){
  48652. return $recv(aMessage)._sendTo_(anObject);
  48653. }
  48654. $1=$recv($recv(anObject)._class())._superclass();
  48655. $ctx1.sendIdx["superclass"]=1;
  48656. if(($receiver = $1) == null || $receiver.a$nil){
  48657. $2=$self._messageNotUnderstood_receiver_(aMessage,anObject);
  48658. $ctx1.sendIdx["messageNotUnderstood:receiver:"]=1;
  48659. return $2;
  48660. } else {
  48661. $1;
  48662. }
  48663. $3=$recv($recv($recv($recv($self._context())._method())._methodClass())._superclass())._lookupSelector_($recv(aMessage)._selector());
  48664. if(($receiver = $3) == null || $receiver.a$nil){
  48665. return $self._messageNotUnderstood_receiver_(aMessage,anObject);
  48666. } else {
  48667. method=$3;
  48668. }
  48669. return $recv(method)._sendTo_arguments_(anObject,$recv(aMessage)._arguments());
  48670. }, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method})});
  48671. },
  48672. args: ["aMessage", "anObject", "aBoolean"],
  48673. source: "sendMessage: aMessage to: anObject superSend: aBoolean\x0a\x09| method |\x0a\x09\x0a\x09aBoolean ifFalse: [ ^ aMessage sendTo: anObject ].\x0a\x09anObject class superclass ifNil: [ ^ self messageNotUnderstood: aMessage receiver: anObject ].\x0a\x09\x0a\x09method := (self context method methodClass superclass lookupSelector: aMessage selector)\x0a\x09\x09ifNil: [ ^ self messageNotUnderstood: aMessage receiver: anObject ].\x0a\x09\x09\x0a\x09^ method sendTo: anObject arguments: aMessage arguments",
  48674. referencedClasses: [],
  48675. pragmas: [],
  48676. messageSends: ["ifFalse:", "sendTo:", "ifNil:", "superclass", "class", "messageNotUnderstood:receiver:", "lookupSelector:", "methodClass", "method", "context", "selector", "sendTo:arguments:", "arguments"]
  48677. }),
  48678. $globals.ASTInterpreter);
  48679. $core.addMethod(
  48680. $core.method({
  48681. selector: "setNonLocalReturnFromContext:",
  48682. protocol: "interpreting",
  48683. fn: function (aContext){
  48684. var self=this,$self=this;
  48685. return $core.withContext(function($ctx1) {
  48686. var $2,$1;
  48687. $2=$recv(aContext)._interpreter();
  48688. $ctx1.sendIdx["interpreter"]=1;
  48689. $1=$recv($2)._hasReturned();
  48690. if($core.assert($1)){
  48691. $self.returned=true;
  48692. $self._returnValue_($recv($recv(aContext)._interpreter())._returnValue());
  48693. }
  48694. return self;
  48695. }, function($ctx1) {$ctx1.fill(self,"setNonLocalReturnFromContext:",{aContext:aContext})});
  48696. },
  48697. args: ["aContext"],
  48698. source: "setNonLocalReturnFromContext: aContext\x0a\x09aContext interpreter hasReturned ifTrue: [\x0a\x09\x09returned := true.\x0a\x09\x09self returnValue: aContext interpreter returnValue ]",
  48699. referencedClasses: [],
  48700. pragmas: [],
  48701. messageSends: ["ifTrue:", "hasReturned", "interpreter", "returnValue:", "returnValue"]
  48702. }),
  48703. $globals.ASTInterpreter);
  48704. $core.addMethod(
  48705. $core.method({
  48706. selector: "skip",
  48707. protocol: "interpreting",
  48708. fn: function (){
  48709. var self=this,$self=this;
  48710. return $core.withContext(function($ctx1) {
  48711. $self._next();
  48712. return self;
  48713. }, function($ctx1) {$ctx1.fill(self,"skip",{})});
  48714. },
  48715. args: [],
  48716. source: "skip\x0a\x09self next",
  48717. referencedClasses: [],
  48718. pragmas: [],
  48719. messageSends: ["next"]
  48720. }),
  48721. $globals.ASTInterpreter);
  48722. $core.addMethod(
  48723. $core.method({
  48724. selector: "stack",
  48725. protocol: "accessing",
  48726. fn: function (){
  48727. var self=this,$self=this;
  48728. return $core.withContext(function($ctx1) {
  48729. var $1,$receiver;
  48730. $1=$self.stack;
  48731. if(($receiver = $1) == null || $receiver.a$nil){
  48732. $self.stack=$recv($globals.OrderedCollection)._new();
  48733. return $self.stack;
  48734. } else {
  48735. return $1;
  48736. }
  48737. }, function($ctx1) {$ctx1.fill(self,"stack",{})});
  48738. },
  48739. args: [],
  48740. source: "stack\x0a\x09^ stack ifNil: [ stack := OrderedCollection new ]",
  48741. referencedClasses: ["OrderedCollection"],
  48742. pragmas: [],
  48743. messageSends: ["ifNil:", "new"]
  48744. }),
  48745. $globals.ASTInterpreter);
  48746. $core.addMethod(
  48747. $core.method({
  48748. selector: "step",
  48749. protocol: "interpreting",
  48750. fn: function (){
  48751. var self=this,$self=this;
  48752. return $core.withContext(function($ctx1) {
  48753. $self._interpret();
  48754. $self._next();
  48755. return self;
  48756. }, function($ctx1) {$ctx1.fill(self,"step",{})});
  48757. },
  48758. args: [],
  48759. source: "step\x0a\x09self \x0a\x09\x09interpret; \x0a\x09\x09next",
  48760. referencedClasses: [],
  48761. pragmas: [],
  48762. messageSends: ["interpret", "next"]
  48763. }),
  48764. $globals.ASTInterpreter);
  48765. $core.addMethod(
  48766. $core.method({
  48767. selector: "stepOver",
  48768. protocol: "interpreting",
  48769. fn: function (){
  48770. var self=this,$self=this;
  48771. return $core.withContext(function($ctx1) {
  48772. var $2,$1;
  48773. $self._step();
  48774. $ctx1.sendIdx["step"]=1;
  48775. $recv((function(){
  48776. return $core.withContext(function($ctx2) {
  48777. $2=$self._node();
  48778. $ctx2.sendIdx["node"]=1;
  48779. $1=$recv($2)._isNil();
  48780. return $recv($1)._or_((function(){
  48781. return $core.withContext(function($ctx3) {
  48782. return $recv($self._node())._isSteppingNode();
  48783. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48784. }));
  48785. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48786. }))._whileFalse_((function(){
  48787. return $core.withContext(function($ctx2) {
  48788. return $self._step();
  48789. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  48790. }));
  48791. return self;
  48792. }, function($ctx1) {$ctx1.fill(self,"stepOver",{})});
  48793. },
  48794. args: [],
  48795. source: "stepOver\x0a\x09self step.\x0a\x09\x0a\x09[ self node isNil or: [ self node isSteppingNode ] ] whileFalse: [ \x0a\x09\x09self step ]",
  48796. referencedClasses: [],
  48797. pragmas: [],
  48798. messageSends: ["step", "whileFalse:", "or:", "isNil", "node", "isSteppingNode"]
  48799. }),
  48800. $globals.ASTInterpreter);
  48801. $core.addMethod(
  48802. $core.method({
  48803. selector: "visit:",
  48804. protocol: "visiting",
  48805. fn: function (aNode){
  48806. var self=this,$self=this;
  48807. return $core.withContext(function($ctx1) {
  48808. var $1;
  48809. $1=$self._hasReturned();
  48810. if(!$core.assert($1)){
  48811. (
  48812. $ctx1.supercall = true,
  48813. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
  48814. $ctx1.supercall = false;
  48815. }
  48816. return self;
  48817. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode})});
  48818. },
  48819. args: ["aNode"],
  48820. source: "visit: aNode\x0a\x09self hasReturned ifFalse: [ super visit: aNode ]",
  48821. referencedClasses: [],
  48822. pragmas: [],
  48823. messageSends: ["ifFalse:", "hasReturned", "visit:"]
  48824. }),
  48825. $globals.ASTInterpreter);
  48826. $core.addMethod(
  48827. $core.method({
  48828. selector: "visitAssignmentNode:",
  48829. protocol: "visiting",
  48830. fn: function (aNode){
  48831. var self=this,$self=this;
  48832. var poppedValue;
  48833. return $core.withContext(function($ctx1) {
  48834. poppedValue=$self._pop();
  48835. $ctx1.sendIdx["pop"]=1;
  48836. $self._pop();
  48837. $self._push_(poppedValue);
  48838. $self._assign_to_($recv(aNode)._left(),poppedValue);
  48839. return self;
  48840. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,poppedValue:poppedValue})});
  48841. },
  48842. args: ["aNode"],
  48843. 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",
  48844. referencedClasses: [],
  48845. pragmas: [],
  48846. messageSends: ["pop", "push:", "assign:to:", "left"]
  48847. }),
  48848. $globals.ASTInterpreter);
  48849. $core.addMethod(
  48850. $core.method({
  48851. selector: "visitBlockNode:",
  48852. protocol: "visiting",
  48853. fn: function (aNode){
  48854. var self=this,$self=this;
  48855. var block;
  48856. return $core.withContext(function($ctx1) {
  48857. block=$recv($globals.AIBlockClosure)._forContext_node_($self._context(),aNode);
  48858. $self._push_(block);
  48859. return self;
  48860. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,block:block})});
  48861. },
  48862. args: ["aNode"],
  48863. 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",
  48864. referencedClasses: ["AIBlockClosure"],
  48865. pragmas: [],
  48866. messageSends: ["forContext:node:", "context", "push:"]
  48867. }),
  48868. $globals.ASTInterpreter);
  48869. $core.addMethod(
  48870. $core.method({
  48871. selector: "visitBlockSequenceNode:",
  48872. protocol: "visiting",
  48873. fn: function (aNode){
  48874. var self=this,$self=this;
  48875. return $core.withContext(function($ctx1) {
  48876. (
  48877. $ctx1.supercall = true,
  48878. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._visitBlockSequenceNode_.apply($self, [aNode]));
  48879. $ctx1.supercall = false;
  48880. $self.forceAtEnd=true;
  48881. return self;
  48882. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode})});
  48883. },
  48884. args: ["aNode"],
  48885. 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",
  48886. referencedClasses: [],
  48887. pragmas: [],
  48888. messageSends: ["visitBlockSequenceNode:"]
  48889. }),
  48890. $globals.ASTInterpreter);
  48891. $core.addMethod(
  48892. $core.method({
  48893. selector: "visitDagNode:",
  48894. protocol: "visiting",
  48895. fn: function (aNode){
  48896. var self=this,$self=this;
  48897. return self;
  48898. },
  48899. args: ["aNode"],
  48900. source: "visitDagNode: aNode\x0a\x09\x22Do nothing by default. Especially, do not visit children recursively.\x22",
  48901. referencedClasses: [],
  48902. pragmas: [],
  48903. messageSends: []
  48904. }),
  48905. $globals.ASTInterpreter);
  48906. $core.addMethod(
  48907. $core.method({
  48908. selector: "visitDynamicArrayNode:",
  48909. protocol: "visiting",
  48910. fn: function (aNode){
  48911. var self=this,$self=this;
  48912. var array;
  48913. return $core.withContext(function($ctx1) {
  48914. array=[];
  48915. $recv($recv(aNode)._dagChildren())._do_((function(each){
  48916. return $core.withContext(function($ctx2) {
  48917. return $recv(array)._addFirst_($self._pop());
  48918. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48919. }));
  48920. $self._push_(array);
  48921. return self;
  48922. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array})});
  48923. },
  48924. args: ["aNode"],
  48925. 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",
  48926. referencedClasses: [],
  48927. pragmas: [],
  48928. messageSends: ["do:", "dagChildren", "addFirst:", "pop", "push:"]
  48929. }),
  48930. $globals.ASTInterpreter);
  48931. $core.addMethod(
  48932. $core.method({
  48933. selector: "visitDynamicDictionaryNode:",
  48934. protocol: "visiting",
  48935. fn: function (aNode){
  48936. var self=this,$self=this;
  48937. var keyValueList;
  48938. return $core.withContext(function($ctx1) {
  48939. keyValueList=$recv($globals.OrderedCollection)._new();
  48940. $recv($recv(aNode)._dagChildren())._do_((function(each){
  48941. return $core.withContext(function($ctx2) {
  48942. return $recv(keyValueList)._add_($self._pop());
  48943. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48944. }));
  48945. $self._push_($recv($globals.HashedCollection)._newFromPairs_($recv(keyValueList)._reversed()));
  48946. return self;
  48947. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,keyValueList:keyValueList})});
  48948. },
  48949. args: ["aNode"],
  48950. 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)",
  48951. referencedClasses: ["OrderedCollection", "HashedCollection"],
  48952. pragmas: [],
  48953. messageSends: ["new", "do:", "dagChildren", "add:", "pop", "push:", "newFromPairs:", "reversed"]
  48954. }),
  48955. $globals.ASTInterpreter);
  48956. $core.addMethod(
  48957. $core.method({
  48958. selector: "visitJSStatementNode:",
  48959. protocol: "visiting",
  48960. fn: function (aNode){
  48961. var self=this,$self=this;
  48962. return $core.withContext(function($ctx1) {
  48963. $self.returned=true;
  48964. $self._returnValue_($self._eval_($recv(aNode)._source()));
  48965. return self;
  48966. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode})});
  48967. },
  48968. args: ["aNode"],
  48969. source: "visitJSStatementNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: (self eval: aNode source)",
  48970. referencedClasses: [],
  48971. pragmas: [],
  48972. messageSends: ["returnValue:", "eval:", "source"]
  48973. }),
  48974. $globals.ASTInterpreter);
  48975. $core.addMethod(
  48976. $core.method({
  48977. selector: "visitReturnNode:",
  48978. protocol: "visiting",
  48979. fn: function (aNode){
  48980. var self=this,$self=this;
  48981. return $core.withContext(function($ctx1) {
  48982. $self.returned=true;
  48983. $self._returnValue_($self._pop());
  48984. return self;
  48985. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode})});
  48986. },
  48987. args: ["aNode"],
  48988. source: "visitReturnNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: self pop",
  48989. referencedClasses: [],
  48990. pragmas: [],
  48991. messageSends: ["returnValue:", "pop"]
  48992. }),
  48993. $globals.ASTInterpreter);
  48994. $core.addMethod(
  48995. $core.method({
  48996. selector: "visitSendNode:",
  48997. protocol: "visiting",
  48998. fn: function (aNode){
  48999. var self=this,$self=this;
  49000. var receiver,args,message,result;
  49001. return $core.withContext(function($ctx1) {
  49002. var $1;
  49003. args=$recv($recv(aNode)._arguments())._collect_((function(each){
  49004. return $core.withContext(function($ctx2) {
  49005. return $self._pop();
  49006. $ctx2.sendIdx["pop"]=1;
  49007. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49008. }));
  49009. receiver=$self._peek();
  49010. message=$self._messageFromSendNode_arguments_(aNode,$recv(args)._reversed());
  49011. result=$self._sendMessage_to_superSend_(message,receiver,$recv(aNode)._superSend());
  49012. $1=$recv($recv(aNode)._isCascadeSendNode())._and_((function(){
  49013. return $core.withContext(function($ctx2) {
  49014. return $recv($recv(aNode)._isLastChild())._not();
  49015. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  49016. }));
  49017. if(!$core.assert($1)){
  49018. $self._pop();
  49019. $self._push_(result);
  49020. }
  49021. return self;
  49022. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,receiver:receiver,args:args,message:message,result:result})});
  49023. },
  49024. args: ["aNode"],
  49025. source: "visitSendNode: aNode\x0a\x09| receiver args message result |\x0a\x09\x0a\x09args := aNode arguments collect: [ :each | self pop ].\x0a\x09receiver := self peek.\x0a\x09\x0a\x09message := self\x0a\x09\x09messageFromSendNode: aNode\x0a\x09\x09arguments: args reversed.\x0a\x09\x0a\x09result := self sendMessage: message to: receiver superSend: aNode superSend.\x0a\x09\x0a\x09\x22For cascade sends, push the reciever if the send is not the last one\x22\x0a\x09(aNode isCascadeSendNode and: [ aNode isLastChild not ])\x0a\x09\x09ifFalse: [ self pop; push: result ]",
  49026. referencedClasses: [],
  49027. pragmas: [],
  49028. messageSends: ["collect:", "arguments", "pop", "peek", "messageFromSendNode:arguments:", "reversed", "sendMessage:to:superSend:", "superSend", "ifFalse:", "and:", "isCascadeSendNode", "not", "isLastChild", "push:"]
  49029. }),
  49030. $globals.ASTInterpreter);
  49031. $core.addMethod(
  49032. $core.method({
  49033. selector: "visitValueNode:",
  49034. protocol: "visiting",
  49035. fn: function (aNode){
  49036. var self=this,$self=this;
  49037. return $core.withContext(function($ctx1) {
  49038. $self._push_($recv(aNode)._value());
  49039. return self;
  49040. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode})});
  49041. },
  49042. args: ["aNode"],
  49043. source: "visitValueNode: aNode\x0a\x09self push: aNode value",
  49044. referencedClasses: [],
  49045. pragmas: [],
  49046. messageSends: ["push:", "value"]
  49047. }),
  49048. $globals.ASTInterpreter);
  49049. $core.addMethod(
  49050. $core.method({
  49051. selector: "visitVariableNode:",
  49052. protocol: "visiting",
  49053. fn: function (aNode){
  49054. var self=this,$self=this;
  49055. return $core.withContext(function($ctx1) {
  49056. var $2,$1,$5,$6,$4,$3,$9,$8,$11,$10,$12,$13,$15,$14,$17,$16,$18,$19,$7;
  49057. $2=$recv(aNode)._binding();
  49058. $ctx1.sendIdx["binding"]=1;
  49059. $1=$recv($2)._isUnknownVar();
  49060. if($core.assert($1)){
  49061. $5=$recv($globals.Platform)._globals();
  49062. $ctx1.sendIdx["globals"]=1;
  49063. $6=$recv(aNode)._value();
  49064. $ctx1.sendIdx["value"]=1;
  49065. $4=$recv($5)._at_ifAbsent_($6,(function(){
  49066. return $core.withContext(function($ctx2) {
  49067. return $self._error_("Unknown variable");
  49068. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  49069. }));
  49070. $ctx1.sendIdx["at:ifAbsent:"]=1;
  49071. $3=$self._push_($4);
  49072. $ctx1.sendIdx["push:"]=1;
  49073. return $3;
  49074. }
  49075. $9=$recv(aNode)._binding();
  49076. $ctx1.sendIdx["binding"]=2;
  49077. $8=$recv($9)._isInstanceVar();
  49078. if($core.assert($8)){
  49079. $11=$self._context();
  49080. $ctx1.sendIdx["context"]=1;
  49081. $10=$recv($11)._receiver();
  49082. $12=$recv(aNode)._value();
  49083. $ctx1.sendIdx["value"]=2;
  49084. $7=$recv($10)._instVarAt_($12);
  49085. } else {
  49086. $13=$self._context();
  49087. $15=$recv($recv(aNode)._binding())._isSuper();
  49088. if($core.assert($15)){
  49089. $14="self";
  49090. } else {
  49091. $14=$recv(aNode)._value();
  49092. $ctx1.sendIdx["value"]=3;
  49093. }
  49094. $7=$recv($13)._localAt_ifAbsent_($14,(function(){
  49095. return $core.withContext(function($ctx2) {
  49096. $17=$recv(aNode)._value();
  49097. $ctx2.sendIdx["value"]=4;
  49098. $16=$recv($17)._isCapitalized();
  49099. if($core.assert($16)){
  49100. $18=$recv($globals.Smalltalk)._globals();
  49101. $ctx2.sendIdx["globals"]=2;
  49102. $19=$recv(aNode)._value();
  49103. $ctx2.sendIdx["value"]=5;
  49104. return $recv($18)._at_ifAbsent_($19,(function(){
  49105. return $core.withContext(function($ctx3) {
  49106. return $recv($recv($globals.Platform)._globals())._at_($recv(aNode)._value());
  49107. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,9)});
  49108. }));
  49109. }
  49110. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  49111. }));
  49112. }
  49113. $self._push_($7);
  49114. return self;
  49115. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode})});
  49116. },
  49117. args: ["aNode"],
  49118. source: "visitVariableNode: aNode\x0a\x09aNode binding isUnknownVar ifTrue: [\x0a\x09\x09^ self push: (Platform globals at: aNode value ifAbsent: [ self error: 'Unknown variable' ]) ].\x0a\x09\x09\x0a\x09self push: (aNode binding isInstanceVar\x0a\x09\x09ifTrue: [ self context receiver instVarAt: aNode value ]\x0a\x09\x09ifFalse: [ self context \x0a\x09\x09\x09localAt: (aNode binding isSuper ifTrue: [ 'self' ] ifFalse: [ aNode value ])\x0a\x09\x09\x09ifAbsent: [\x0a\x09\x09\x09\x09aNode value isCapitalized\x0a\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09Smalltalk globals \x0a\x09\x09\x09\x09\x09\x09\x09at: aNode value \x0a\x09\x09\x09\x09\x09\x09\x09ifAbsent: [ Platform globals at: aNode value ] ] ] ])",
  49119. referencedClasses: ["Platform", "Smalltalk"],
  49120. pragmas: [],
  49121. messageSends: ["ifTrue:", "isUnknownVar", "binding", "push:", "at:ifAbsent:", "globals", "value", "error:", "ifTrue:ifFalse:", "isInstanceVar", "instVarAt:", "receiver", "context", "localAt:ifAbsent:", "isSuper", "isCapitalized", "at:"]
  49122. }),
  49123. $globals.ASTInterpreter);
  49124. $core.addClass("ASTInterpreterError", $globals.Error, [], "Compiler-Interpreter");
  49125. $globals.ASTInterpreterError.comment="I get signaled when an AST interpreter is unable to interpret a node.";
  49126. $core.addClass("ASTPCNodeVisitor", $globals.NodeVisitor, ["index", "trackedIndex", "selector", "currentNode"], "Compiler-Interpreter");
  49127. $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`";
  49128. $core.addMethod(
  49129. $core.method({
  49130. selector: "currentNode",
  49131. protocol: "accessing",
  49132. fn: function (){
  49133. var self=this,$self=this;
  49134. return $self.currentNode;
  49135. },
  49136. args: [],
  49137. source: "currentNode\x0a\x09^ currentNode",
  49138. referencedClasses: [],
  49139. pragmas: [],
  49140. messageSends: []
  49141. }),
  49142. $globals.ASTPCNodeVisitor);
  49143. $core.addMethod(
  49144. $core.method({
  49145. selector: "increaseTrackedIndex",
  49146. protocol: "accessing",
  49147. fn: function (){
  49148. var self=this,$self=this;
  49149. return $core.withContext(function($ctx1) {
  49150. $self.trackedIndex=$recv($self._trackedIndex()).__plus((1));
  49151. return self;
  49152. }, function($ctx1) {$ctx1.fill(self,"increaseTrackedIndex",{})});
  49153. },
  49154. args: [],
  49155. source: "increaseTrackedIndex\x0a\x09trackedIndex := self trackedIndex + 1",
  49156. referencedClasses: [],
  49157. pragmas: [],
  49158. messageSends: ["+", "trackedIndex"]
  49159. }),
  49160. $globals.ASTPCNodeVisitor);
  49161. $core.addMethod(
  49162. $core.method({
  49163. selector: "index",
  49164. protocol: "accessing",
  49165. fn: function (){
  49166. var self=this,$self=this;
  49167. return $self.index;
  49168. },
  49169. args: [],
  49170. source: "index\x0a\x09^ index",
  49171. referencedClasses: [],
  49172. pragmas: [],
  49173. messageSends: []
  49174. }),
  49175. $globals.ASTPCNodeVisitor);
  49176. $core.addMethod(
  49177. $core.method({
  49178. selector: "index:",
  49179. protocol: "accessing",
  49180. fn: function (aNumber){
  49181. var self=this,$self=this;
  49182. $self.index=aNumber;
  49183. return self;
  49184. },
  49185. args: ["aNumber"],
  49186. source: "index: aNumber\x0a\x09index := aNumber",
  49187. referencedClasses: [],
  49188. pragmas: [],
  49189. messageSends: []
  49190. }),
  49191. $globals.ASTPCNodeVisitor);
  49192. $core.addMethod(
  49193. $core.method({
  49194. selector: "selector",
  49195. protocol: "accessing",
  49196. fn: function (){
  49197. var self=this,$self=this;
  49198. return $self.selector;
  49199. },
  49200. args: [],
  49201. source: "selector\x0a\x09^ selector",
  49202. referencedClasses: [],
  49203. pragmas: [],
  49204. messageSends: []
  49205. }),
  49206. $globals.ASTPCNodeVisitor);
  49207. $core.addMethod(
  49208. $core.method({
  49209. selector: "selector:",
  49210. protocol: "accessing",
  49211. fn: function (aString){
  49212. var self=this,$self=this;
  49213. $self.selector=aString;
  49214. return self;
  49215. },
  49216. args: ["aString"],
  49217. source: "selector: aString\x0a\x09selector := aString",
  49218. referencedClasses: [],
  49219. pragmas: [],
  49220. messageSends: []
  49221. }),
  49222. $globals.ASTPCNodeVisitor);
  49223. $core.addMethod(
  49224. $core.method({
  49225. selector: "trackedIndex",
  49226. protocol: "accessing",
  49227. fn: function (){
  49228. var self=this,$self=this;
  49229. return $core.withContext(function($ctx1) {
  49230. var $1,$receiver;
  49231. $1=$self.trackedIndex;
  49232. if(($receiver = $1) == null || $receiver.a$nil){
  49233. $self.trackedIndex=(0);
  49234. return $self.trackedIndex;
  49235. } else {
  49236. return $1;
  49237. }
  49238. }, function($ctx1) {$ctx1.fill(self,"trackedIndex",{})});
  49239. },
  49240. args: [],
  49241. source: "trackedIndex\x0a\x09^ trackedIndex ifNil: [ trackedIndex := 0 ]",
  49242. referencedClasses: [],
  49243. pragmas: [],
  49244. messageSends: ["ifNil:"]
  49245. }),
  49246. $globals.ASTPCNodeVisitor);
  49247. $core.addMethod(
  49248. $core.method({
  49249. selector: "visitJSStatementNode:",
  49250. protocol: "visiting",
  49251. fn: function (aNode){
  49252. var self=this,$self=this;
  49253. $self.currentNode=aNode;
  49254. return self;
  49255. },
  49256. args: ["aNode"],
  49257. 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",
  49258. referencedClasses: [],
  49259. pragmas: [],
  49260. messageSends: []
  49261. }),
  49262. $globals.ASTPCNodeVisitor);
  49263. $core.addMethod(
  49264. $core.method({
  49265. selector: "visitSendNode:",
  49266. protocol: "visiting",
  49267. fn: function (aNode){
  49268. var self=this,$self=this;
  49269. return $core.withContext(function($ctx1) {
  49270. var $2,$1,$3;
  49271. (
  49272. $ctx1.supercall = true,
  49273. ($globals.ASTPCNodeVisitor.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  49274. $ctx1.supercall = false;
  49275. $2=$self._selector();
  49276. $ctx1.sendIdx["selector"]=1;
  49277. $1=$recv($2).__eq($recv(aNode)._selector());
  49278. $ctx1.sendIdx["="]=1;
  49279. if($core.assert($1)){
  49280. $3=$recv($self._trackedIndex()).__eq($self._index());
  49281. if($core.assert($3)){
  49282. $self.currentNode=aNode;
  49283. $self.currentNode;
  49284. }
  49285. $self._increaseTrackedIndex();
  49286. }
  49287. return self;
  49288. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode})});
  49289. },
  49290. args: ["aNode"],
  49291. 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 ]",
  49292. referencedClasses: [],
  49293. pragmas: [],
  49294. messageSends: ["visitSendNode:", "ifTrue:", "=", "selector", "trackedIndex", "index", "increaseTrackedIndex"]
  49295. }),
  49296. $globals.ASTPCNodeVisitor);
  49297. $core.setTraitComposition([{trait: $globals.TMethodContext}], $globals.AIContext);
  49298. $core.addMethod(
  49299. $core.method({
  49300. selector: "isLastChild",
  49301. protocol: "*Compiler-Interpreter",
  49302. fn: function (){
  49303. var self=this,$self=this;
  49304. return $core.withContext(function($ctx1) {
  49305. return $recv($recv($recv($self._parent())._dagChildren())._last()).__eq(self);
  49306. }, function($ctx1) {$ctx1.fill(self,"isLastChild",{})});
  49307. },
  49308. args: [],
  49309. source: "isLastChild\x0a\x09^ self parent dagChildren last = self",
  49310. referencedClasses: [],
  49311. pragmas: [],
  49312. messageSends: ["=", "last", "dagChildren", "parent"]
  49313. }),
  49314. $globals.ASTNode);
  49315. $core.addMethod(
  49316. $core.method({
  49317. selector: "isSteppingNode",
  49318. protocol: "*Compiler-Interpreter",
  49319. fn: function (){
  49320. var self=this,$self=this;
  49321. return false;
  49322. },
  49323. args: [],
  49324. source: "isSteppingNode\x0a\x09^ false",
  49325. referencedClasses: [],
  49326. pragmas: [],
  49327. messageSends: []
  49328. }),
  49329. $globals.ASTNode);
  49330. $core.addMethod(
  49331. $core.method({
  49332. selector: "nextSiblingNode:",
  49333. protocol: "*Compiler-Interpreter",
  49334. fn: function (aNode){
  49335. var self=this,$self=this;
  49336. return $core.withContext(function($ctx1) {
  49337. var $1;
  49338. $1=$self._dagChildren();
  49339. $ctx1.sendIdx["dagChildren"]=1;
  49340. return $recv($1)._at_ifAbsent_($recv($recv($self._dagChildren())._indexOf_(aNode)).__plus((1)),(function(){
  49341. return nil;
  49342. }));
  49343. }, function($ctx1) {$ctx1.fill(self,"nextSiblingNode:",{aNode:aNode})});
  49344. },
  49345. args: ["aNode"],
  49346. 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 ]",
  49347. referencedClasses: [],
  49348. pragmas: [],
  49349. messageSends: ["at:ifAbsent:", "dagChildren", "+", "indexOf:"]
  49350. }),
  49351. $globals.ASTNode);
  49352. $core.addMethod(
  49353. $core.method({
  49354. selector: "isSteppingNode",
  49355. protocol: "*Compiler-Interpreter",
  49356. fn: function (){
  49357. var self=this,$self=this;
  49358. return true;
  49359. },
  49360. args: [],
  49361. source: "isSteppingNode\x0a\x09^ true",
  49362. referencedClasses: [],
  49363. pragmas: [],
  49364. messageSends: []
  49365. }),
  49366. $globals.AssignmentNode);
  49367. $core.addMethod(
  49368. $core.method({
  49369. selector: "isSteppingNode",
  49370. protocol: "*Compiler-Interpreter",
  49371. fn: function (){
  49372. var self=this,$self=this;
  49373. return true;
  49374. },
  49375. args: [],
  49376. source: "isSteppingNode\x0a\x09^ true",
  49377. referencedClasses: [],
  49378. pragmas: [],
  49379. messageSends: []
  49380. }),
  49381. $globals.BlockNode);
  49382. $core.addMethod(
  49383. $core.method({
  49384. selector: "nextSiblingNode:",
  49385. protocol: "*Compiler-Interpreter",
  49386. fn: function (aNode){
  49387. var self=this,$self=this;
  49388. return nil;
  49389. },
  49390. args: ["aNode"],
  49391. 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",
  49392. referencedClasses: [],
  49393. pragmas: [],
  49394. messageSends: []
  49395. }),
  49396. $globals.BlockNode);
  49397. $core.addMethod(
  49398. $core.method({
  49399. selector: "isSteppingNode",
  49400. protocol: "*Compiler-Interpreter",
  49401. fn: function (){
  49402. var self=this,$self=this;
  49403. return true;
  49404. },
  49405. args: [],
  49406. source: "isSteppingNode\x0a\x09^ true",
  49407. referencedClasses: [],
  49408. pragmas: [],
  49409. messageSends: []
  49410. }),
  49411. $globals.DynamicArrayNode);
  49412. $core.addMethod(
  49413. $core.method({
  49414. selector: "isSteppingNode",
  49415. protocol: "*Compiler-Interpreter",
  49416. fn: function (){
  49417. var self=this,$self=this;
  49418. return true;
  49419. },
  49420. args: [],
  49421. source: "isSteppingNode\x0a\x09^ true",
  49422. referencedClasses: [],
  49423. pragmas: [],
  49424. messageSends: []
  49425. }),
  49426. $globals.DynamicDictionaryNode);
  49427. $core.addMethod(
  49428. $core.method({
  49429. selector: "isSteppingNode",
  49430. protocol: "*Compiler-Interpreter",
  49431. fn: function (){
  49432. var self=this,$self=this;
  49433. return true;
  49434. },
  49435. args: [],
  49436. source: "isSteppingNode\x0a\x09^ true",
  49437. referencedClasses: [],
  49438. pragmas: [],
  49439. messageSends: []
  49440. }),
  49441. $globals.JSStatementNode);
  49442. $core.addMethod(
  49443. $core.method({
  49444. selector: "isCascadeSendNode",
  49445. protocol: "*Compiler-Interpreter",
  49446. fn: function (){
  49447. var self=this,$self=this;
  49448. return $core.withContext(function($ctx1) {
  49449. return $recv($self._parent())._isCascadeNode();
  49450. }, function($ctx1) {$ctx1.fill(self,"isCascadeSendNode",{})});
  49451. },
  49452. args: [],
  49453. source: "isCascadeSendNode\x0a\x09^ self parent isCascadeNode",
  49454. referencedClasses: [],
  49455. pragmas: [],
  49456. messageSends: ["isCascadeNode", "parent"]
  49457. }),
  49458. $globals.SendNode);
  49459. $core.addMethod(
  49460. $core.method({
  49461. selector: "isSteppingNode",
  49462. protocol: "*Compiler-Interpreter",
  49463. fn: function (){
  49464. var self=this,$self=this;
  49465. return true;
  49466. },
  49467. args: [],
  49468. source: "isSteppingNode\x0a\x09^ true",
  49469. referencedClasses: [],
  49470. pragmas: [],
  49471. messageSends: []
  49472. }),
  49473. $globals.SendNode);
  49474. });
  49475. define('amber/lang',[
  49476. './deploy',
  49477. './boot', // pre-fetch, dep of ./helpers
  49478. './helpers', // pre-fetch, dep of ./deploy
  49479. './parser',
  49480. // --- packages for the Amber reflection begin here ---
  49481. 'amber/core/Platform-ImportExport',
  49482. 'amber/core/Compiler-Core',
  49483. 'amber/core/Compiler-AST',
  49484. 'amber/core/Compiler-Semantic',
  49485. 'amber/core/Compiler-IR',
  49486. 'amber/core/Compiler-Inlining',
  49487. 'amber/core/Compiler-Interpreter'
  49488. // --- packages for the Amber reflection end here ---
  49489. ], function (amber) {
  49490. return amber;
  49491. });
  49492. 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";
  49493. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  49494. var $pkg = $core.addPackage("Platform-DOM");
  49495. $pkg.innerEval = function (expr) { return eval(expr); };
  49496. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  49497. $core.addClass("PlatformDom", $globals.Object, [], "Platform-DOM");
  49498. $core.addMethod(
  49499. $core.method({
  49500. selector: "isDomNode:",
  49501. protocol: "testing",
  49502. fn: function (anObject){
  49503. var self=this,$self=this;
  49504. return $core.withContext(function($ctx1) {
  49505. return anObject.nodeType > 0 &&
  49506. Object.prototype.toString.call(anObject) !== "[object Object]";
  49507. return self;
  49508. }, function($ctx1) {$ctx1.fill(self,"isDomNode:",{anObject:anObject})});
  49509. },
  49510. args: ["anObject"],
  49511. source: "isDomNode: anObject\x0a<inlineJS: '\x0a\x09return anObject.nodeType > 0 &&\x0a\x09\x09Object.prototype.toString.call(anObject) !== \x22[object Object]\x22\x0a'>",
  49512. referencedClasses: [],
  49513. pragmas: [["inlineJS:", ["\x0a\x09return anObject.nodeType > 0 &&\x0a\x09\x09Object.prototype.toString.call(anObject) !== \x22[object Object]\x22"]]],
  49514. messageSends: []
  49515. }),
  49516. $globals.PlatformDom.a$cls);
  49517. $core.addMethod(
  49518. $core.method({
  49519. selector: "isFeasible",
  49520. protocol: "testing",
  49521. fn: function (){
  49522. var self=this,$self=this;
  49523. return $core.withContext(function($ctx1) {
  49524. if (typeof document === "undefined") return false;
  49525. try {
  49526. var d = document.createElement("div"),
  49527. f = document.createDocumentFragment(),
  49528. t = document.createTextNode("Hello, Amber!");
  49529. f.appendChild(t);
  49530. d.insertBefore(f, null);
  49531. return d.innerHTML === "Hello, Amber!";
  49532. } catch (e) {
  49533. return false;
  49534. };
  49535. return self;
  49536. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{})});
  49537. },
  49538. args: [],
  49539. 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'>",
  49540. referencedClasses: [],
  49541. 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 }"]]],
  49542. messageSends: []
  49543. }),
  49544. $globals.PlatformDom.a$cls);
  49545. $core.addMethod(
  49546. $core.method({
  49547. selector: "newCustomEvent:detail:",
  49548. protocol: "creation",
  49549. fn: function (aString,anObject){
  49550. var self=this,$self=this;
  49551. return $core.withContext(function($ctx1) {
  49552. return new CustomEvent(aString, {detail: anObject});
  49553. return self;
  49554. }, function($ctx1) {$ctx1.fill(self,"newCustomEvent:detail:",{aString:aString,anObject:anObject})});
  49555. },
  49556. args: ["aString", "anObject"],
  49557. source: "newCustomEvent: aString detail: anObject\x0a<inlineJS: 'return new CustomEvent(aString, {detail: anObject})'>",
  49558. referencedClasses: [],
  49559. pragmas: [["inlineJS:", ["return new CustomEvent(aString, {detail: anObject})"]]],
  49560. messageSends: []
  49561. }),
  49562. $globals.PlatformDom.a$cls);
  49563. $core.addMethod(
  49564. $core.method({
  49565. selector: "toArray:",
  49566. protocol: "converting",
  49567. fn: function (aDomList){
  49568. var self=this,$self=this;
  49569. return $core.withContext(function($ctx1) {
  49570. return Array.prototype.slice.call(aDomList);
  49571. return self;
  49572. }, function($ctx1) {$ctx1.fill(self,"toArray:",{aDomList:aDomList})});
  49573. },
  49574. args: ["aDomList"],
  49575. source: "toArray: aDomList\x0a<inlineJS: 'return Array.prototype.slice.call(aDomList)'>",
  49576. referencedClasses: [],
  49577. pragmas: [["inlineJS:", ["return Array.prototype.slice.call(aDomList)"]]],
  49578. messageSends: []
  49579. }),
  49580. $globals.PlatformDom.a$cls);
  49581. $core.addMethod(
  49582. $core.method({
  49583. selector: "asDomNode",
  49584. protocol: "*Platform-DOM",
  49585. fn: function (){
  49586. var self=this,$self=this;
  49587. var fragment;
  49588. return $core.withContext(function($ctx1) {
  49589. fragment=$recv(document)._createDocumentFragment();
  49590. $self._do_((function(each){
  49591. return $core.withContext(function($ctx2) {
  49592. return $recv(fragment)._appendChild_($recv(each)._asDomNode());
  49593. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49594. }));
  49595. return fragment;
  49596. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{fragment:fragment})});
  49597. },
  49598. args: [],
  49599. source: "asDomNode\x0a\x09| fragment |\x0a\x09fragment := document createDocumentFragment.\x0a\x09self do: [ :each | fragment appendChild: each asDomNode ].\x0a\x09^ fragment",
  49600. referencedClasses: [],
  49601. pragmas: [],
  49602. messageSends: ["createDocumentFragment", "do:", "appendChild:", "asDomNode"]
  49603. }),
  49604. $globals.Collection);
  49605. $core.addMethod(
  49606. $core.method({
  49607. selector: "asDomNode",
  49608. protocol: "*Platform-DOM",
  49609. fn: function (){
  49610. var self=this,$self=this;
  49611. return $core.withContext(function($ctx1) {
  49612. var $1,$2;
  49613. $1=$recv($globals.PlatformDom)._isDomNode_($self.jsObject);
  49614. if($core.assert($1)){
  49615. return $self.jsObject;
  49616. } else {
  49617. $2=(
  49618. $ctx1.supercall = true,
  49619. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._asDomNode.apply($self, []));
  49620. $ctx1.supercall = false;
  49621. return $2;
  49622. }
  49623. return self;
  49624. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{})});
  49625. },
  49626. args: [],
  49627. source: "asDomNode\x0a\x09(PlatformDom isDomNode: jsObject)\x0a\x09\x09ifTrue: [ ^ jsObject ]\x0a\x09\x09ifFalse: [ ^ super asDomNode ]",
  49628. referencedClasses: ["PlatformDom"],
  49629. pragmas: [],
  49630. messageSends: ["ifTrue:ifFalse:", "isDomNode:", "asDomNode"]
  49631. }),
  49632. $globals.JSObjectProxy);
  49633. $core.addMethod(
  49634. $core.method({
  49635. selector: "asDomNode",
  49636. protocol: "*Platform-DOM",
  49637. fn: function (){
  49638. var self=this,$self=this;
  49639. return $core.withContext(function($ctx1) {
  49640. return $recv(document)._createTextNode_($self._asString());
  49641. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{})});
  49642. },
  49643. args: [],
  49644. source: "asDomNode\x0a\x09^ document createTextNode: self asString",
  49645. referencedClasses: [],
  49646. pragmas: [],
  49647. messageSends: ["createTextNode:", "asString"]
  49648. }),
  49649. $globals.String);
  49650. $core.addMethod(
  49651. $core.method({
  49652. selector: "htmlTextContent",
  49653. protocol: "*Platform-DOM",
  49654. fn: function (){
  49655. var self=this,$self=this;
  49656. return $core.withContext(function($ctx1) {
  49657. var d=document.createElement("div");d.innerHTML=self;return d.textContent||d.innerText;;
  49658. return self;
  49659. }, function($ctx1) {$ctx1.fill(self,"htmlTextContent",{})});
  49660. },
  49661. args: [],
  49662. source: "htmlTextContent\x0a<inlineJS: 'var d=document.createElement(\x22div\x22);d.innerHTML=self;return d.textContent||d.innerText;'>",
  49663. referencedClasses: [],
  49664. pragmas: [["inlineJS:", ["var d=document.createElement(\x22div\x22);d.innerHTML=self;return d.textContent||d.innerText;"]]],
  49665. messageSends: []
  49666. }),
  49667. $globals.String);
  49668. });
  49669. 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";
  49670. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  49671. var $pkg = $core.addPackage("SUnit");
  49672. $pkg.innerEval = function (expr) { return eval(expr); };
  49673. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  49674. $core.addClass("ResultAnnouncement", $globals.Object, ["result"], "SUnit");
  49675. $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.";
  49676. $core.addMethod(
  49677. $core.method({
  49678. selector: "result",
  49679. protocol: "accessing",
  49680. fn: function (){
  49681. var self=this,$self=this;
  49682. return $self.result;
  49683. },
  49684. args: [],
  49685. source: "result\x0a\x09^ result",
  49686. referencedClasses: [],
  49687. pragmas: [],
  49688. messageSends: []
  49689. }),
  49690. $globals.ResultAnnouncement);
  49691. $core.addMethod(
  49692. $core.method({
  49693. selector: "result:",
  49694. protocol: "accessing",
  49695. fn: function (aTestResult){
  49696. var self=this,$self=this;
  49697. $self.result=aTestResult;
  49698. return self;
  49699. },
  49700. args: ["aTestResult"],
  49701. source: "result: aTestResult\x0a\x09result := aTestResult",
  49702. referencedClasses: [],
  49703. pragmas: [],
  49704. messageSends: []
  49705. }),
  49706. $globals.ResultAnnouncement);
  49707. $core.addClass("TestCase", $globals.Object, ["testSelector", "asyncTimeout", "context"], "SUnit");
  49708. $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.";
  49709. $core.addMethod(
  49710. $core.method({
  49711. selector: "assert:",
  49712. protocol: "testing",
  49713. fn: function (aBoolean){
  49714. var self=this,$self=this;
  49715. return $core.withContext(function($ctx1) {
  49716. $self._assert_description_(aBoolean,"Assertion failed");
  49717. return self;
  49718. }, function($ctx1) {$ctx1.fill(self,"assert:",{aBoolean:aBoolean})});
  49719. },
  49720. args: ["aBoolean"],
  49721. source: "assert: aBoolean\x0a\x09self assert: aBoolean description: 'Assertion failed'",
  49722. referencedClasses: [],
  49723. pragmas: [],
  49724. messageSends: ["assert:description:"]
  49725. }),
  49726. $globals.TestCase);
  49727. $core.addMethod(
  49728. $core.method({
  49729. selector: "assert:description:",
  49730. protocol: "testing",
  49731. fn: function (aBoolean,aString){
  49732. var self=this,$self=this;
  49733. return $core.withContext(function($ctx1) {
  49734. if(!$core.assert(aBoolean)){
  49735. $self._signalFailure_(aString);
  49736. }
  49737. return self;
  49738. }, function($ctx1) {$ctx1.fill(self,"assert:description:",{aBoolean:aBoolean,aString:aString})});
  49739. },
  49740. args: ["aBoolean", "aString"],
  49741. source: "assert: aBoolean description: aString\x0a\x09aBoolean ifFalse: [ self signalFailure: aString ]",
  49742. referencedClasses: [],
  49743. pragmas: [],
  49744. messageSends: ["ifFalse:", "signalFailure:"]
  49745. }),
  49746. $globals.TestCase);
  49747. $core.addMethod(
  49748. $core.method({
  49749. selector: "assert:equals:",
  49750. protocol: "testing",
  49751. fn: function (actual,expected){
  49752. var self=this,$self=this;
  49753. return $core.withContext(function($ctx1) {
  49754. var $1,$5,$4,$3,$2;
  49755. $1=$recv(actual).__eq(expected);
  49756. $5=$recv(expected)._printString();
  49757. $ctx1.sendIdx["printString"]=1;
  49758. $4="Expected: ".__comma($5);
  49759. $3=$recv($4).__comma(" but was: ");
  49760. $ctx1.sendIdx[","]=2;
  49761. $2=$recv($3).__comma($recv(actual)._printString());
  49762. $ctx1.sendIdx[","]=1;
  49763. return $self._assert_description_($1,$2);
  49764. }, function($ctx1) {$ctx1.fill(self,"assert:equals:",{actual:actual,expected:expected})});
  49765. },
  49766. args: ["actual", "expected"],
  49767. source: "assert: actual equals: expected\x0a\x09^ self assert: (actual = expected) description: 'Expected: ', expected printString, ' but was: ', actual printString",
  49768. referencedClasses: [],
  49769. pragmas: [],
  49770. messageSends: ["assert:description:", "=", ",", "printString"]
  49771. }),
  49772. $globals.TestCase);
  49773. $core.addMethod(
  49774. $core.method({
  49775. selector: "async:",
  49776. protocol: "async",
  49777. fn: function (aBlock){
  49778. var self=this,$self=this;
  49779. var c;
  49780. return $core.withContext(function($ctx1) {
  49781. var $1;
  49782. $self._errorIfNotAsync_("#async");
  49783. c=$self.context;
  49784. return (function(){
  49785. return $core.withContext(function($ctx2) {
  49786. $1=$self._isAsync();
  49787. if($core.assert($1)){
  49788. return $recv(c)._execute_(aBlock);
  49789. }
  49790. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49791. });
  49792. }, function($ctx1) {$ctx1.fill(self,"async:",{aBlock:aBlock,c:c})});
  49793. },
  49794. args: ["aBlock"],
  49795. source: "async: aBlock\x0a\x09| c |\x0a\x09self errorIfNotAsync: '#async'.\x0a\x09c := context.\x0a\x09^ [ self isAsync ifTrue: [ c execute: aBlock ] ]",
  49796. referencedClasses: [],
  49797. pragmas: [],
  49798. messageSends: ["errorIfNotAsync:", "ifTrue:", "isAsync", "execute:"]
  49799. }),
  49800. $globals.TestCase);
  49801. $core.addMethod(
  49802. $core.method({
  49803. selector: "context:",
  49804. protocol: "accessing",
  49805. fn: function (aRunningTestContext){
  49806. var self=this,$self=this;
  49807. $self.context=aRunningTestContext;
  49808. return self;
  49809. },
  49810. args: ["aRunningTestContext"],
  49811. source: "context: aRunningTestContext\x0a\x09context := aRunningTestContext",
  49812. referencedClasses: [],
  49813. pragmas: [],
  49814. messageSends: []
  49815. }),
  49816. $globals.TestCase);
  49817. $core.addMethod(
  49818. $core.method({
  49819. selector: "deny:",
  49820. protocol: "testing",
  49821. fn: function (aBoolean){
  49822. var self=this,$self=this;
  49823. return $core.withContext(function($ctx1) {
  49824. $self._assert_($recv(aBoolean)._not());
  49825. return self;
  49826. }, function($ctx1) {$ctx1.fill(self,"deny:",{aBoolean:aBoolean})});
  49827. },
  49828. args: ["aBoolean"],
  49829. source: "deny: aBoolean\x0a\x09self assert: aBoolean not",
  49830. referencedClasses: [],
  49831. pragmas: [],
  49832. messageSends: ["assert:", "not"]
  49833. }),
  49834. $globals.TestCase);
  49835. $core.addMethod(
  49836. $core.method({
  49837. selector: "errorIfNotAsync:",
  49838. protocol: "error handling",
  49839. fn: function (aString){
  49840. var self=this,$self=this;
  49841. return $core.withContext(function($ctx1) {
  49842. var $1;
  49843. $1=$self._isAsync();
  49844. if(!$core.assert($1)){
  49845. $self._error_($recv(aString).__comma(" used without prior #timeout:"));
  49846. }
  49847. return self;
  49848. }, function($ctx1) {$ctx1.fill(self,"errorIfNotAsync:",{aString:aString})});
  49849. },
  49850. args: ["aString"],
  49851. source: "errorIfNotAsync: aString\x0a\x09self isAsync ifFalse: [\x0a\x09\x09self error: aString, ' used without prior #timeout:' ]",
  49852. referencedClasses: [],
  49853. pragmas: [],
  49854. messageSends: ["ifFalse:", "isAsync", "error:", ","]
  49855. }),
  49856. $globals.TestCase);
  49857. $core.addMethod(
  49858. $core.method({
  49859. selector: "finished",
  49860. protocol: "async",
  49861. fn: function (){
  49862. var self=this,$self=this;
  49863. return $core.withContext(function($ctx1) {
  49864. $self._errorIfNotAsync_("#finished");
  49865. $self.asyncTimeout=nil;
  49866. return self;
  49867. }, function($ctx1) {$ctx1.fill(self,"finished",{})});
  49868. },
  49869. args: [],
  49870. source: "finished\x0a\x09self errorIfNotAsync: '#finished'.\x0a\x09asyncTimeout := nil",
  49871. referencedClasses: [],
  49872. pragmas: [],
  49873. messageSends: ["errorIfNotAsync:"]
  49874. }),
  49875. $globals.TestCase);
  49876. $core.addMethod(
  49877. $core.method({
  49878. selector: "isAsync",
  49879. protocol: "testing",
  49880. fn: function (){
  49881. var self=this,$self=this;
  49882. return $core.withContext(function($ctx1) {
  49883. return $recv($self.asyncTimeout)._notNil();
  49884. }, function($ctx1) {$ctx1.fill(self,"isAsync",{})});
  49885. },
  49886. args: [],
  49887. source: "isAsync\x0a\x09^ asyncTimeout notNil",
  49888. referencedClasses: [],
  49889. pragmas: [],
  49890. messageSends: ["notNil"]
  49891. }),
  49892. $globals.TestCase);
  49893. $core.addMethod(
  49894. $core.method({
  49895. selector: "performTest",
  49896. protocol: "running",
  49897. fn: function (){
  49898. var self=this,$self=this;
  49899. return $core.withContext(function($ctx1) {
  49900. $self.asyncTimeout=nil;
  49901. $self._perform_($self._selector());
  49902. return self;
  49903. }, function($ctx1) {$ctx1.fill(self,"performTest",{})});
  49904. },
  49905. args: [],
  49906. source: "performTest\x0a\x09asyncTimeout := nil.\x0a\x09self perform: self selector",
  49907. referencedClasses: [],
  49908. pragmas: [],
  49909. messageSends: ["perform:", "selector"]
  49910. }),
  49911. $globals.TestCase);
  49912. $core.addMethod(
  49913. $core.method({
  49914. selector: "runCase",
  49915. protocol: "running",
  49916. fn: function (){
  49917. var self=this,$self=this;
  49918. return $core.withContext(function($ctx1) {
  49919. $recv($recv($globals.TestContext)._testCase_(self))._start();
  49920. return self;
  49921. }, function($ctx1) {$ctx1.fill(self,"runCase",{})});
  49922. },
  49923. args: [],
  49924. source: "runCase\x0a\x09\x22Runs a test case in isolated context, leaking all errors.\x22\x0a\x0a\x09(TestContext testCase: self) start",
  49925. referencedClasses: ["TestContext"],
  49926. pragmas: [],
  49927. messageSends: ["start", "testCase:"]
  49928. }),
  49929. $globals.TestCase);
  49930. $core.addMethod(
  49931. $core.method({
  49932. selector: "selector",
  49933. protocol: "accessing",
  49934. fn: function (){
  49935. var self=this,$self=this;
  49936. return $self.testSelector;
  49937. },
  49938. args: [],
  49939. source: "selector\x0a\x09^ testSelector",
  49940. referencedClasses: [],
  49941. pragmas: [],
  49942. messageSends: []
  49943. }),
  49944. $globals.TestCase);
  49945. $core.addMethod(
  49946. $core.method({
  49947. selector: "setTestSelector:",
  49948. protocol: "accessing",
  49949. fn: function (aSelector){
  49950. var self=this,$self=this;
  49951. $self.testSelector=aSelector;
  49952. return self;
  49953. },
  49954. args: ["aSelector"],
  49955. source: "setTestSelector: aSelector\x0a\x09testSelector := aSelector",
  49956. referencedClasses: [],
  49957. pragmas: [],
  49958. messageSends: []
  49959. }),
  49960. $globals.TestCase);
  49961. $core.addMethod(
  49962. $core.method({
  49963. selector: "setUp",
  49964. protocol: "running",
  49965. fn: function (){
  49966. var self=this,$self=this;
  49967. return self;
  49968. },
  49969. args: [],
  49970. source: "setUp",
  49971. referencedClasses: [],
  49972. pragmas: [],
  49973. messageSends: []
  49974. }),
  49975. $globals.TestCase);
  49976. $core.addMethod(
  49977. $core.method({
  49978. selector: "should:",
  49979. protocol: "testing",
  49980. fn: function (aBlock){
  49981. var self=this,$self=this;
  49982. return $core.withContext(function($ctx1) {
  49983. $self._assert_($recv(aBlock)._value());
  49984. return self;
  49985. }, function($ctx1) {$ctx1.fill(self,"should:",{aBlock:aBlock})});
  49986. },
  49987. args: ["aBlock"],
  49988. source: "should: aBlock\x0a\x09self assert: aBlock value",
  49989. referencedClasses: [],
  49990. pragmas: [],
  49991. messageSends: ["assert:", "value"]
  49992. }),
  49993. $globals.TestCase);
  49994. $core.addMethod(
  49995. $core.method({
  49996. selector: "should:raise:",
  49997. protocol: "testing",
  49998. fn: function (aBlock,anExceptionClass){
  49999. var self=this,$self=this;
  50000. return $core.withContext(function($ctx1) {
  50001. $self._assert_($recv((function(){
  50002. return $core.withContext(function($ctx2) {
  50003. $recv(aBlock)._value();
  50004. return false;
  50005. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50006. }))._on_do_(anExceptionClass,(function(ex){
  50007. return true;
  50008. })));
  50009. return self;
  50010. }, function($ctx1) {$ctx1.fill(self,"should:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass})});
  50011. },
  50012. args: ["aBlock", "anExceptionClass"],
  50013. source: "should: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. false ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | true ])",
  50014. referencedClasses: [],
  50015. pragmas: [],
  50016. messageSends: ["assert:", "on:do:", "value"]
  50017. }),
  50018. $globals.TestCase);
  50019. $core.addMethod(
  50020. $core.method({
  50021. selector: "shouldnt:raise:",
  50022. protocol: "testing",
  50023. fn: function (aBlock,anExceptionClass){
  50024. var self=this,$self=this;
  50025. return $core.withContext(function($ctx1) {
  50026. $self._assert_($recv((function(){
  50027. return $core.withContext(function($ctx2) {
  50028. $recv(aBlock)._value();
  50029. return true;
  50030. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50031. }))._on_do_(anExceptionClass,(function(ex){
  50032. return false;
  50033. })));
  50034. return self;
  50035. }, function($ctx1) {$ctx1.fill(self,"shouldnt:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass})});
  50036. },
  50037. args: ["aBlock", "anExceptionClass"],
  50038. source: "shouldnt: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. true ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | false ])",
  50039. referencedClasses: [],
  50040. pragmas: [],
  50041. messageSends: ["assert:", "on:do:", "value"]
  50042. }),
  50043. $globals.TestCase);
  50044. $core.addMethod(
  50045. $core.method({
  50046. selector: "signalFailure:",
  50047. protocol: "private",
  50048. fn: function (aString){
  50049. var self=this,$self=this;
  50050. return $core.withContext(function($ctx1) {
  50051. var $1;
  50052. $1=$recv($globals.TestFailure)._new();
  50053. $recv($1)._messageText_(aString);
  50054. $recv($1)._signal();
  50055. return self;
  50056. }, function($ctx1) {$ctx1.fill(self,"signalFailure:",{aString:aString})});
  50057. },
  50058. args: ["aString"],
  50059. source: "signalFailure: aString\x0a\x09TestFailure new\x0a\x09\x09messageText: aString;\x0a\x09\x09signal",
  50060. referencedClasses: ["TestFailure"],
  50061. pragmas: [],
  50062. messageSends: ["messageText:", "new", "signal"]
  50063. }),
  50064. $globals.TestCase);
  50065. $core.addMethod(
  50066. $core.method({
  50067. selector: "tearDown",
  50068. protocol: "running",
  50069. fn: function (){
  50070. var self=this,$self=this;
  50071. return self;
  50072. },
  50073. args: [],
  50074. source: "tearDown",
  50075. referencedClasses: [],
  50076. pragmas: [],
  50077. messageSends: []
  50078. }),
  50079. $globals.TestCase);
  50080. $core.addMethod(
  50081. $core.method({
  50082. selector: "timeout:",
  50083. protocol: "async",
  50084. fn: function (aNumber){
  50085. var self=this,$self=this;
  50086. return $core.withContext(function($ctx1) {
  50087. var $1,$receiver;
  50088. $1=$self.asyncTimeout;
  50089. if(($receiver = $1) == null || $receiver.a$nil){
  50090. $1;
  50091. } else {
  50092. $recv($self.asyncTimeout)._clearTimeout();
  50093. }
  50094. $self.asyncTimeout=(0);
  50095. $self.asyncTimeout=$recv($self._async_((function(){
  50096. return $core.withContext(function($ctx2) {
  50097. return $self._assert_description_(false,"SUnit grace time exhausted");
  50098. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  50099. })))._valueWithTimeout_(aNumber);
  50100. return self;
  50101. }, function($ctx1) {$ctx1.fill(self,"timeout:",{aNumber:aNumber})});
  50102. },
  50103. args: ["aNumber"],
  50104. 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",
  50105. referencedClasses: [],
  50106. pragmas: [],
  50107. messageSends: ["ifNotNil:", "clearTimeout", "valueWithTimeout:", "async:", "assert:description:"]
  50108. }),
  50109. $globals.TestCase);
  50110. $core.addMethod(
  50111. $core.method({
  50112. selector: "allTestSelectors",
  50113. protocol: "accessing",
  50114. fn: function (){
  50115. var self=this,$self=this;
  50116. var selectors;
  50117. return $core.withContext(function($ctx1) {
  50118. var $1;
  50119. selectors=$self._testSelectors();
  50120. $1=$self._shouldInheritSelectors();
  50121. if($core.assert($1)){
  50122. $recv(selectors)._addAll_($recv($self._superclass())._allTestSelectors());
  50123. }
  50124. return selectors;
  50125. }, function($ctx1) {$ctx1.fill(self,"allTestSelectors",{selectors:selectors})});
  50126. },
  50127. args: [],
  50128. source: "allTestSelectors\x0a\x09| selectors |\x0a\x09selectors := self testSelectors.\x0a\x09self shouldInheritSelectors ifTrue: [\x0a\x09\x09selectors addAll: self superclass allTestSelectors ].\x0a\x09^ selectors",
  50129. referencedClasses: [],
  50130. pragmas: [],
  50131. messageSends: ["testSelectors", "ifTrue:", "shouldInheritSelectors", "addAll:", "allTestSelectors", "superclass"]
  50132. }),
  50133. $globals.TestCase.a$cls);
  50134. $core.addMethod(
  50135. $core.method({
  50136. selector: "buildSuite",
  50137. protocol: "accessing",
  50138. fn: function (){
  50139. var self=this,$self=this;
  50140. return $core.withContext(function($ctx1) {
  50141. return $recv($self._allTestSelectors())._collect_((function(each){
  50142. return $core.withContext(function($ctx2) {
  50143. return $self._selector_(each);
  50144. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50145. }));
  50146. }, function($ctx1) {$ctx1.fill(self,"buildSuite",{})});
  50147. },
  50148. args: [],
  50149. source: "buildSuite\x0a\x09^ self allTestSelectors collect: [ :each | self selector: each ]",
  50150. referencedClasses: [],
  50151. pragmas: [],
  50152. messageSends: ["collect:", "allTestSelectors", "selector:"]
  50153. }),
  50154. $globals.TestCase.a$cls);
  50155. $core.addMethod(
  50156. $core.method({
  50157. selector: "classTag",
  50158. protocol: "accessing",
  50159. fn: function (){
  50160. var self=this,$self=this;
  50161. return "test";
  50162. },
  50163. args: [],
  50164. 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'",
  50165. referencedClasses: [],
  50166. pragmas: [],
  50167. messageSends: []
  50168. }),
  50169. $globals.TestCase.a$cls);
  50170. $core.addMethod(
  50171. $core.method({
  50172. selector: "isAbstract",
  50173. protocol: "testing",
  50174. fn: function (){
  50175. var self=this,$self=this;
  50176. return $core.withContext(function($ctx1) {
  50177. return $recv($self._name()).__eq("TestCase");
  50178. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{})});
  50179. },
  50180. args: [],
  50181. source: "isAbstract\x0a\x09^ self name = 'TestCase'",
  50182. referencedClasses: [],
  50183. pragmas: [],
  50184. messageSends: ["=", "name"]
  50185. }),
  50186. $globals.TestCase.a$cls);
  50187. $core.addMethod(
  50188. $core.method({
  50189. selector: "isTestClass",
  50190. protocol: "testing",
  50191. fn: function (){
  50192. var self=this,$self=this;
  50193. return $core.withContext(function($ctx1) {
  50194. return $recv($self._isAbstract())._not();
  50195. }, function($ctx1) {$ctx1.fill(self,"isTestClass",{})});
  50196. },
  50197. args: [],
  50198. source: "isTestClass\x0a\x09^ self isAbstract not",
  50199. referencedClasses: [],
  50200. pragmas: [],
  50201. messageSends: ["not", "isAbstract"]
  50202. }),
  50203. $globals.TestCase.a$cls);
  50204. $core.addMethod(
  50205. $core.method({
  50206. selector: "lookupHierarchyRoot",
  50207. protocol: "accessing",
  50208. fn: function (){
  50209. var self=this,$self=this;
  50210. return $globals.TestCase;
  50211. },
  50212. args: [],
  50213. source: "lookupHierarchyRoot\x0a\x09^ TestCase",
  50214. referencedClasses: ["TestCase"],
  50215. pragmas: [],
  50216. messageSends: []
  50217. }),
  50218. $globals.TestCase.a$cls);
  50219. $core.addMethod(
  50220. $core.method({
  50221. selector: "selector:",
  50222. protocol: "accessing",
  50223. fn: function (aSelector){
  50224. var self=this,$self=this;
  50225. return $core.withContext(function($ctx1) {
  50226. var $1;
  50227. $1=$self._new();
  50228. $recv($1)._setTestSelector_(aSelector);
  50229. return $recv($1)._yourself();
  50230. }, function($ctx1) {$ctx1.fill(self,"selector:",{aSelector:aSelector})});
  50231. },
  50232. args: ["aSelector"],
  50233. source: "selector: aSelector\x0a\x09^ self new\x0a\x09\x09setTestSelector: aSelector;\x0a\x09\x09yourself",
  50234. referencedClasses: [],
  50235. pragmas: [],
  50236. messageSends: ["setTestSelector:", "new", "yourself"]
  50237. }),
  50238. $globals.TestCase.a$cls);
  50239. $core.addMethod(
  50240. $core.method({
  50241. selector: "shouldInheritSelectors",
  50242. protocol: "testing",
  50243. fn: function (){
  50244. var self=this,$self=this;
  50245. return $core.withContext(function($ctx1) {
  50246. return $self.__tild_eq($self._lookupHierarchyRoot());
  50247. }, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{})});
  50248. },
  50249. args: [],
  50250. source: "shouldInheritSelectors\x0a\x09^ self ~= self lookupHierarchyRoot",
  50251. referencedClasses: [],
  50252. pragmas: [],
  50253. messageSends: ["~=", "lookupHierarchyRoot"]
  50254. }),
  50255. $globals.TestCase.a$cls);
  50256. $core.addMethod(
  50257. $core.method({
  50258. selector: "testSelectors",
  50259. protocol: "accessing",
  50260. fn: function (){
  50261. var self=this,$self=this;
  50262. return $core.withContext(function($ctx1) {
  50263. return $recv($recv($self._methodDictionary())._keys())._select_((function(each){
  50264. return $core.withContext(function($ctx2) {
  50265. return $recv(each)._match_("^test");
  50266. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50267. }));
  50268. }, function($ctx1) {$ctx1.fill(self,"testSelectors",{})});
  50269. },
  50270. args: [],
  50271. source: "testSelectors\x0a\x09^ self methodDictionary keys select: [ :each | each match: '^test' ]",
  50272. referencedClasses: [],
  50273. pragmas: [],
  50274. messageSends: ["select:", "keys", "methodDictionary", "match:"]
  50275. }),
  50276. $globals.TestCase.a$cls);
  50277. $core.addClass("TestContext", $globals.Object, ["testCase"], "SUnit");
  50278. $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).";
  50279. $core.addMethod(
  50280. $core.method({
  50281. selector: "execute:",
  50282. protocol: "running",
  50283. fn: function (aBlock){
  50284. var self=this,$self=this;
  50285. var failed;
  50286. return $core.withContext(function($ctx1) {
  50287. var $1,$2;
  50288. $recv($self.testCase)._context_(self);
  50289. $ctx1.sendIdx["context:"]=1;
  50290. $recv((function(){
  50291. return $core.withContext(function($ctx2) {
  50292. failed=true;
  50293. $recv(aBlock)._value();
  50294. failed=false;
  50295. return failed;
  50296. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50297. }))._ensure_((function(){
  50298. return $core.withContext(function($ctx2) {
  50299. $recv($self.testCase)._context_(nil);
  50300. $1=$recv(failed)._and_((function(){
  50301. return $core.withContext(function($ctx3) {
  50302. return $recv($self.testCase)._isAsync();
  50303. $ctx3.sendIdx["isAsync"]=1;
  50304. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  50305. }));
  50306. if($core.assert($1)){
  50307. $recv($self.testCase)._finished();
  50308. }
  50309. $2=$recv($self.testCase)._isAsync();
  50310. if(!$core.assert($2)){
  50311. return $recv($self.testCase)._tearDown();
  50312. }
  50313. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  50314. }));
  50315. return self;
  50316. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock,failed:failed})});
  50317. },
  50318. args: ["aBlock"],
  50319. 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 ] ]",
  50320. referencedClasses: [],
  50321. pragmas: [],
  50322. messageSends: ["context:", "ensure:", "value", "ifTrue:", "and:", "isAsync", "finished", "ifFalse:", "tearDown"]
  50323. }),
  50324. $globals.TestContext);
  50325. $core.addMethod(
  50326. $core.method({
  50327. selector: "start",
  50328. protocol: "running",
  50329. fn: function (){
  50330. var self=this,$self=this;
  50331. return $core.withContext(function($ctx1) {
  50332. $self._execute_((function(){
  50333. return $core.withContext(function($ctx2) {
  50334. $recv($self.testCase)._setUp();
  50335. return $recv($self.testCase)._performTest();
  50336. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50337. }));
  50338. return self;
  50339. }, function($ctx1) {$ctx1.fill(self,"start",{})});
  50340. },
  50341. args: [],
  50342. source: "start\x0a\x09self execute: [\x0a\x09\x09testCase setUp.\x0a\x09\x09testCase performTest ]",
  50343. referencedClasses: [],
  50344. pragmas: [],
  50345. messageSends: ["execute:", "setUp", "performTest"]
  50346. }),
  50347. $globals.TestContext);
  50348. $core.addMethod(
  50349. $core.method({
  50350. selector: "testCase:",
  50351. protocol: "accessing",
  50352. fn: function (aTestCase){
  50353. var self=this,$self=this;
  50354. $self.testCase=aTestCase;
  50355. return self;
  50356. },
  50357. args: ["aTestCase"],
  50358. source: "testCase: aTestCase\x0a\x09testCase := aTestCase",
  50359. referencedClasses: [],
  50360. pragmas: [],
  50361. messageSends: []
  50362. }),
  50363. $globals.TestContext);
  50364. $core.addMethod(
  50365. $core.method({
  50366. selector: "testCase:",
  50367. protocol: "instance creation",
  50368. fn: function (aTestCase){
  50369. var self=this,$self=this;
  50370. return $core.withContext(function($ctx1) {
  50371. var $1;
  50372. $1=$self._new();
  50373. $recv($1)._testCase_(aTestCase);
  50374. return $recv($1)._yourself();
  50375. }, function($ctx1) {$ctx1.fill(self,"testCase:",{aTestCase:aTestCase})});
  50376. },
  50377. args: ["aTestCase"],
  50378. source: "testCase: aTestCase\x0a\x09^ self new\x0a\x09\x09testCase: aTestCase;\x0a\x09\x09yourself",
  50379. referencedClasses: [],
  50380. pragmas: [],
  50381. messageSends: ["testCase:", "new", "yourself"]
  50382. }),
  50383. $globals.TestContext.a$cls);
  50384. $core.addClass("ReportingTestContext", $globals.TestContext, ["finished", "result"], "SUnit");
  50385. $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`.";
  50386. $core.addMethod(
  50387. $core.method({
  50388. selector: "execute:",
  50389. protocol: "running",
  50390. fn: function (aBlock){
  50391. var self=this,$self=this;
  50392. return $core.withContext(function($ctx1) {
  50393. var $1;
  50394. $recv((function(){
  50395. return $core.withContext(function($ctx2) {
  50396. return $self._withErrorReporting_((function(){
  50397. return $core.withContext(function($ctx3) {
  50398. return (
  50399. $ctx3.supercall = true,
  50400. ($globals.ReportingTestContext.superclass||$boot.nilAsClass).fn.prototype._execute_.apply($self, [aBlock]));
  50401. $ctx3.supercall = false;
  50402. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50403. }));
  50404. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50405. }))._ensure_((function(){
  50406. return $core.withContext(function($ctx2) {
  50407. $1=$recv($self.testCase)._isAsync();
  50408. if(!$core.assert($1)){
  50409. $recv($self.result)._increaseRuns();
  50410. return $recv($self.finished)._value();
  50411. }
  50412. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  50413. }));
  50414. return self;
  50415. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock})});
  50416. },
  50417. args: ["aBlock"],
  50418. 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 ] ]",
  50419. referencedClasses: [],
  50420. pragmas: [],
  50421. messageSends: ["ensure:", "withErrorReporting:", "execute:", "ifFalse:", "isAsync", "increaseRuns", "value"]
  50422. }),
  50423. $globals.ReportingTestContext);
  50424. $core.addMethod(
  50425. $core.method({
  50426. selector: "finished:",
  50427. protocol: "accessing",
  50428. fn: function (aBlock){
  50429. var self=this,$self=this;
  50430. $self.finished=aBlock;
  50431. return self;
  50432. },
  50433. args: ["aBlock"],
  50434. source: "finished: aBlock\x0a\x09finished := aBlock",
  50435. referencedClasses: [],
  50436. pragmas: [],
  50437. messageSends: []
  50438. }),
  50439. $globals.ReportingTestContext);
  50440. $core.addMethod(
  50441. $core.method({
  50442. selector: "result:",
  50443. protocol: "accessing",
  50444. fn: function (aTestResult){
  50445. var self=this,$self=this;
  50446. $self.result=aTestResult;
  50447. return self;
  50448. },
  50449. args: ["aTestResult"],
  50450. source: "result: aTestResult\x0a\x09result := aTestResult",
  50451. referencedClasses: [],
  50452. pragmas: [],
  50453. messageSends: []
  50454. }),
  50455. $globals.ReportingTestContext);
  50456. $core.addMethod(
  50457. $core.method({
  50458. selector: "withErrorReporting:",
  50459. protocol: "private",
  50460. fn: function (aBlock){
  50461. var self=this,$self=this;
  50462. return $core.withContext(function($ctx1) {
  50463. $recv((function(){
  50464. return $core.withContext(function($ctx2) {
  50465. return $recv(aBlock)._on_do_($globals.TestFailure,(function(ex){
  50466. return $core.withContext(function($ctx3) {
  50467. return $recv($self.result)._addFailure_($self.testCase);
  50468. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,2)});
  50469. }));
  50470. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50471. }))._on_do_($globals.Error,(function(ex){
  50472. return $core.withContext(function($ctx2) {
  50473. return $recv($self.result)._addError_($self.testCase);
  50474. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,3)});
  50475. }));
  50476. $ctx1.sendIdx["on:do:"]=1;
  50477. return self;
  50478. }, function($ctx1) {$ctx1.fill(self,"withErrorReporting:",{aBlock:aBlock})});
  50479. },
  50480. args: ["aBlock"],
  50481. 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 ]",
  50482. referencedClasses: ["TestFailure", "Error"],
  50483. pragmas: [],
  50484. messageSends: ["on:do:", "addFailure:", "addError:"]
  50485. }),
  50486. $globals.ReportingTestContext);
  50487. $core.addMethod(
  50488. $core.method({
  50489. selector: "testCase:result:finished:",
  50490. protocol: "instance creation",
  50491. fn: function (aTestCase,aTestResult,aBlock){
  50492. var self=this,$self=this;
  50493. return $core.withContext(function($ctx1) {
  50494. var $1;
  50495. $1=(
  50496. $ctx1.supercall = true,
  50497. ($globals.ReportingTestContext.a$cls.superclass||$boot.nilAsClass).fn.prototype._testCase_.apply($self, [aTestCase]));
  50498. $ctx1.supercall = false;
  50499. $recv($1)._result_(aTestResult);
  50500. $recv($1)._finished_(aBlock);
  50501. return $recv($1)._yourself();
  50502. }, function($ctx1) {$ctx1.fill(self,"testCase:result:finished:",{aTestCase:aTestCase,aTestResult:aTestResult,aBlock:aBlock})});
  50503. },
  50504. args: ["aTestCase", "aTestResult", "aBlock"],
  50505. source: "testCase: aTestCase result: aTestResult finished: aBlock\x0a\x09^ (super testCase: aTestCase)\x0a\x09\x09result: aTestResult;\x0a\x09\x09finished: aBlock;\x0a\x09\x09yourself",
  50506. referencedClasses: [],
  50507. pragmas: [],
  50508. messageSends: ["result:", "testCase:", "finished:", "yourself"]
  50509. }),
  50510. $globals.ReportingTestContext.a$cls);
  50511. $core.addClass("TestFailure", $globals.Error, [], "SUnit");
  50512. $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.";
  50513. $core.addClass("TestResult", $globals.Object, ["timestamp", "runs", "errors", "failures", "total"], "SUnit");
  50514. $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";
  50515. $core.addMethod(
  50516. $core.method({
  50517. selector: "addError:",
  50518. protocol: "accessing",
  50519. fn: function (anError){
  50520. var self=this,$self=this;
  50521. return $core.withContext(function($ctx1) {
  50522. $recv($self._errors())._add_(anError);
  50523. return self;
  50524. }, function($ctx1) {$ctx1.fill(self,"addError:",{anError:anError})});
  50525. },
  50526. args: ["anError"],
  50527. source: "addError: anError\x0a\x09self errors add: anError",
  50528. referencedClasses: [],
  50529. pragmas: [],
  50530. messageSends: ["add:", "errors"]
  50531. }),
  50532. $globals.TestResult);
  50533. $core.addMethod(
  50534. $core.method({
  50535. selector: "addFailure:",
  50536. protocol: "accessing",
  50537. fn: function (aFailure){
  50538. var self=this,$self=this;
  50539. return $core.withContext(function($ctx1) {
  50540. $recv($self._failures())._add_(aFailure);
  50541. return self;
  50542. }, function($ctx1) {$ctx1.fill(self,"addFailure:",{aFailure:aFailure})});
  50543. },
  50544. args: ["aFailure"],
  50545. source: "addFailure: aFailure\x0a\x09self failures add: aFailure",
  50546. referencedClasses: [],
  50547. pragmas: [],
  50548. messageSends: ["add:", "failures"]
  50549. }),
  50550. $globals.TestResult);
  50551. $core.addMethod(
  50552. $core.method({
  50553. selector: "errors",
  50554. protocol: "accessing",
  50555. fn: function (){
  50556. var self=this,$self=this;
  50557. return $self.errors;
  50558. },
  50559. args: [],
  50560. source: "errors\x0a\x09^ errors",
  50561. referencedClasses: [],
  50562. pragmas: [],
  50563. messageSends: []
  50564. }),
  50565. $globals.TestResult);
  50566. $core.addMethod(
  50567. $core.method({
  50568. selector: "failures",
  50569. protocol: "accessing",
  50570. fn: function (){
  50571. var self=this,$self=this;
  50572. return $self.failures;
  50573. },
  50574. args: [],
  50575. source: "failures\x0a\x09^ failures",
  50576. referencedClasses: [],
  50577. pragmas: [],
  50578. messageSends: []
  50579. }),
  50580. $globals.TestResult);
  50581. $core.addMethod(
  50582. $core.method({
  50583. selector: "increaseRuns",
  50584. protocol: "accessing",
  50585. fn: function (){
  50586. var self=this,$self=this;
  50587. return $core.withContext(function($ctx1) {
  50588. $self.runs=$recv($self.runs).__plus((1));
  50589. return self;
  50590. }, function($ctx1) {$ctx1.fill(self,"increaseRuns",{})});
  50591. },
  50592. args: [],
  50593. source: "increaseRuns\x0a\x09runs := runs + 1",
  50594. referencedClasses: [],
  50595. pragmas: [],
  50596. messageSends: ["+"]
  50597. }),
  50598. $globals.TestResult);
  50599. $core.addMethod(
  50600. $core.method({
  50601. selector: "initialize",
  50602. protocol: "initialization",
  50603. fn: function (){
  50604. var self=this,$self=this;
  50605. return $core.withContext(function($ctx1) {
  50606. (
  50607. $ctx1.supercall = true,
  50608. ($globals.TestResult.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  50609. $ctx1.supercall = false;
  50610. $self.timestamp=$recv($globals.Date)._now();
  50611. $self.runs=(0);
  50612. $self.errors=$recv($globals.Array)._new();
  50613. $ctx1.sendIdx["new"]=1;
  50614. $self.failures=$recv($globals.Array)._new();
  50615. $self.total=(0);
  50616. return self;
  50617. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  50618. },
  50619. args: [],
  50620. source: "initialize\x0a\x09super initialize.\x0a\x09timestamp := Date now.\x0a\x09runs := 0.\x0a\x09errors := Array new.\x0a\x09failures := Array new.\x0a\x09total := 0",
  50621. referencedClasses: ["Date", "Array"],
  50622. pragmas: [],
  50623. messageSends: ["initialize", "now", "new"]
  50624. }),
  50625. $globals.TestResult);
  50626. $core.addMethod(
  50627. $core.method({
  50628. selector: "nextRunDo:",
  50629. protocol: "running",
  50630. fn: function (aBlock){
  50631. var self=this,$self=this;
  50632. return $core.withContext(function($ctx1) {
  50633. var $2,$1;
  50634. $2=$self._runs();
  50635. $ctx1.sendIdx["runs"]=1;
  50636. $1=$recv($2).__eq_eq($self._total());
  50637. if(!$core.assert($1)){
  50638. return $recv(aBlock)._value_($recv($self._runs()).__plus((1)));
  50639. }
  50640. }, function($ctx1) {$ctx1.fill(self,"nextRunDo:",{aBlock:aBlock})});
  50641. },
  50642. args: ["aBlock"],
  50643. 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 ]",
  50644. referencedClasses: [],
  50645. pragmas: [],
  50646. messageSends: ["ifFalse:", "==", "runs", "total", "value:", "+"]
  50647. }),
  50648. $globals.TestResult);
  50649. $core.addMethod(
  50650. $core.method({
  50651. selector: "runCase:",
  50652. protocol: "running",
  50653. fn: function (aTestCase){
  50654. var self=this,$self=this;
  50655. return $core.withContext(function($ctx1) {
  50656. $recv((function(){
  50657. return $core.withContext(function($ctx2) {
  50658. return $recv((function(){
  50659. return $core.withContext(function($ctx3) {
  50660. $self._increaseRuns();
  50661. return $recv(aTestCase)._runCase();
  50662. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50663. }))._on_do_($globals.TestFailure,(function(ex){
  50664. return $core.withContext(function($ctx3) {
  50665. return $self._addFailure_(aTestCase);
  50666. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  50667. }));
  50668. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50669. }))._on_do_($globals.Error,(function(ex){
  50670. return $core.withContext(function($ctx2) {
  50671. return $self._addError_(aTestCase);
  50672. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,4)});
  50673. }));
  50674. $ctx1.sendIdx["on:do:"]=1;
  50675. return self;
  50676. }, function($ctx1) {$ctx1.fill(self,"runCase:",{aTestCase:aTestCase})});
  50677. },
  50678. args: ["aTestCase"],
  50679. 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 ]",
  50680. referencedClasses: ["TestFailure", "Error"],
  50681. pragmas: [],
  50682. messageSends: ["on:do:", "increaseRuns", "runCase", "addFailure:", "addError:"]
  50683. }),
  50684. $globals.TestResult);
  50685. $core.addMethod(
  50686. $core.method({
  50687. selector: "runs",
  50688. protocol: "accessing",
  50689. fn: function (){
  50690. var self=this,$self=this;
  50691. return $self.runs;
  50692. },
  50693. args: [],
  50694. source: "runs\x0a\x09^ runs",
  50695. referencedClasses: [],
  50696. pragmas: [],
  50697. messageSends: []
  50698. }),
  50699. $globals.TestResult);
  50700. $core.addMethod(
  50701. $core.method({
  50702. selector: "status",
  50703. protocol: "accessing",
  50704. fn: function (){
  50705. var self=this,$self=this;
  50706. return $core.withContext(function($ctx1) {
  50707. var $1;
  50708. $1=$recv($self._errors())._ifNotEmpty_ifEmpty_((function(){
  50709. return "error";
  50710. }),(function(){
  50711. return $core.withContext(function($ctx2) {
  50712. return $recv($self._failures())._ifNotEmpty_ifEmpty_((function(){
  50713. return "failure";
  50714. }),(function(){
  50715. return "success";
  50716. }));
  50717. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  50718. }));
  50719. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  50720. return $1;
  50721. }, function($ctx1) {$ctx1.fill(self,"status",{})});
  50722. },
  50723. args: [],
  50724. source: "status\x0a\x09^ self errors ifNotEmpty: [ 'error' ] ifEmpty: [\x0a\x09\x09self failures ifNotEmpty: [ 'failure' ] ifEmpty: [\x0a\x09\x09\x09'success' ]]",
  50725. referencedClasses: [],
  50726. pragmas: [],
  50727. messageSends: ["ifNotEmpty:ifEmpty:", "errors", "failures"]
  50728. }),
  50729. $globals.TestResult);
  50730. $core.addMethod(
  50731. $core.method({
  50732. selector: "timestamp",
  50733. protocol: "accessing",
  50734. fn: function (){
  50735. var self=this,$self=this;
  50736. return $self.timestamp;
  50737. },
  50738. args: [],
  50739. source: "timestamp\x0a\x09^ timestamp",
  50740. referencedClasses: [],
  50741. pragmas: [],
  50742. messageSends: []
  50743. }),
  50744. $globals.TestResult);
  50745. $core.addMethod(
  50746. $core.method({
  50747. selector: "total",
  50748. protocol: "accessing",
  50749. fn: function (){
  50750. var self=this,$self=this;
  50751. return $self.total;
  50752. },
  50753. args: [],
  50754. source: "total\x0a\x09^ total",
  50755. referencedClasses: [],
  50756. pragmas: [],
  50757. messageSends: []
  50758. }),
  50759. $globals.TestResult);
  50760. $core.addMethod(
  50761. $core.method({
  50762. selector: "total:",
  50763. protocol: "accessing",
  50764. fn: function (aNumber){
  50765. var self=this,$self=this;
  50766. $self.total=aNumber;
  50767. return self;
  50768. },
  50769. args: ["aNumber"],
  50770. source: "total: aNumber\x0a\x09total := aNumber",
  50771. referencedClasses: [],
  50772. pragmas: [],
  50773. messageSends: []
  50774. }),
  50775. $globals.TestResult);
  50776. $core.addClass("TestSuiteRunner", $globals.Object, ["suite", "result", "announcer", "runNextTest"], "SUnit");
  50777. $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`.";
  50778. $core.addMethod(
  50779. $core.method({
  50780. selector: "announcer",
  50781. protocol: "accessing",
  50782. fn: function (){
  50783. var self=this,$self=this;
  50784. return $self.announcer;
  50785. },
  50786. args: [],
  50787. source: "announcer\x0a\x09^ announcer",
  50788. referencedClasses: [],
  50789. pragmas: [],
  50790. messageSends: []
  50791. }),
  50792. $globals.TestSuiteRunner);
  50793. $core.addMethod(
  50794. $core.method({
  50795. selector: "contextOf:",
  50796. protocol: "private",
  50797. fn: function (anInteger){
  50798. var self=this,$self=this;
  50799. return $core.withContext(function($ctx1) {
  50800. return $recv($globals.ReportingTestContext)._testCase_result_finished_($recv($self.suite)._at_(anInteger),$self.result,(function(){
  50801. return $core.withContext(function($ctx2) {
  50802. return $self._resume();
  50803. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50804. }));
  50805. }, function($ctx1) {$ctx1.fill(self,"contextOf:",{anInteger:anInteger})});
  50806. },
  50807. args: ["anInteger"],
  50808. source: "contextOf: anInteger\x0a\x09^ ReportingTestContext testCase: (suite at: anInteger) result: result finished: [ self resume ]",
  50809. referencedClasses: ["ReportingTestContext"],
  50810. pragmas: [],
  50811. messageSends: ["testCase:result:finished:", "at:", "resume"]
  50812. }),
  50813. $globals.TestSuiteRunner);
  50814. $core.addMethod(
  50815. $core.method({
  50816. selector: "initialize",
  50817. protocol: "initialization",
  50818. fn: function (){
  50819. var self=this,$self=this;
  50820. return $core.withContext(function($ctx1) {
  50821. var $1;
  50822. (
  50823. $ctx1.supercall = true,
  50824. ($globals.TestSuiteRunner.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  50825. $ctx1.supercall = false;
  50826. $self.announcer=$recv($globals.Announcer)._new();
  50827. $ctx1.sendIdx["new"]=1;
  50828. $self.result=$recv($globals.TestResult)._new();
  50829. $self.runNextTest=(function(){
  50830. var runs;
  50831. return $core.withContext(function($ctx2) {
  50832. runs=$recv($self.result)._runs();
  50833. $1=$recv(runs).__lt($recv($self.result)._total());
  50834. if($core.assert($1)){
  50835. return $recv($self._contextOf_($recv(runs).__plus((1))))._start();
  50836. }
  50837. }, function($ctx2) {$ctx2.fillBlock({runs:runs},$ctx1,1)});
  50838. });
  50839. return self;
  50840. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  50841. },
  50842. args: [],
  50843. 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 ] ].",
  50844. referencedClasses: ["Announcer", "TestResult"],
  50845. pragmas: [],
  50846. messageSends: ["initialize", "new", "runs", "ifTrue:", "<", "total", "start", "contextOf:", "+"]
  50847. }),
  50848. $globals.TestSuiteRunner);
  50849. $core.addMethod(
  50850. $core.method({
  50851. selector: "result",
  50852. protocol: "accessing",
  50853. fn: function (){
  50854. var self=this,$self=this;
  50855. return $self.result;
  50856. },
  50857. args: [],
  50858. source: "result\x0a\x09^ result",
  50859. referencedClasses: [],
  50860. pragmas: [],
  50861. messageSends: []
  50862. }),
  50863. $globals.TestSuiteRunner);
  50864. $core.addMethod(
  50865. $core.method({
  50866. selector: "resume",
  50867. protocol: "actions",
  50868. fn: function (){
  50869. var self=this,$self=this;
  50870. return $core.withContext(function($ctx1) {
  50871. $recv($self.runNextTest)._fork();
  50872. $recv($self.announcer)._announce_($recv($recv($globals.ResultAnnouncement)._new())._result_($self.result));
  50873. return self;
  50874. }, function($ctx1) {$ctx1.fill(self,"resume",{})});
  50875. },
  50876. args: [],
  50877. source: "resume\x0a\x09runNextTest fork.\x0a\x09announcer announce: (ResultAnnouncement new result: result)",
  50878. referencedClasses: ["ResultAnnouncement"],
  50879. pragmas: [],
  50880. messageSends: ["fork", "announce:", "result:", "new"]
  50881. }),
  50882. $globals.TestSuiteRunner);
  50883. $core.addMethod(
  50884. $core.method({
  50885. selector: "run",
  50886. protocol: "actions",
  50887. fn: function (){
  50888. var self=this,$self=this;
  50889. return $core.withContext(function($ctx1) {
  50890. $recv($self.result)._total_($recv($self.suite)._size());
  50891. $self._resume();
  50892. return self;
  50893. }, function($ctx1) {$ctx1.fill(self,"run",{})});
  50894. },
  50895. args: [],
  50896. source: "run\x0a\x09result total: suite size.\x0a\x09self resume",
  50897. referencedClasses: [],
  50898. pragmas: [],
  50899. messageSends: ["total:", "size", "resume"]
  50900. }),
  50901. $globals.TestSuiteRunner);
  50902. $core.addMethod(
  50903. $core.method({
  50904. selector: "suite:",
  50905. protocol: "accessing",
  50906. fn: function (aCollection){
  50907. var self=this,$self=this;
  50908. $self.suite=aCollection;
  50909. return self;
  50910. },
  50911. args: ["aCollection"],
  50912. source: "suite: aCollection\x0a\x09suite := aCollection",
  50913. referencedClasses: [],
  50914. pragmas: [],
  50915. messageSends: []
  50916. }),
  50917. $globals.TestSuiteRunner);
  50918. $core.addMethod(
  50919. $core.method({
  50920. selector: "new",
  50921. protocol: "instance creation",
  50922. fn: function (){
  50923. var self=this,$self=this;
  50924. return $core.withContext(function($ctx1) {
  50925. $self._shouldNotImplement();
  50926. return self;
  50927. }, function($ctx1) {$ctx1.fill(self,"new",{})});
  50928. },
  50929. args: [],
  50930. source: "new\x0a\x09self shouldNotImplement",
  50931. referencedClasses: [],
  50932. pragmas: [],
  50933. messageSends: ["shouldNotImplement"]
  50934. }),
  50935. $globals.TestSuiteRunner.a$cls);
  50936. $core.addMethod(
  50937. $core.method({
  50938. selector: "on:",
  50939. protocol: "instance creation",
  50940. fn: function (aCollection){
  50941. var self=this,$self=this;
  50942. return $core.withContext(function($ctx1) {
  50943. var $1;
  50944. $1=(
  50945. $ctx1.supercall = true,
  50946. ($globals.TestSuiteRunner.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  50947. $ctx1.supercall = false;
  50948. return $recv($1)._suite_(aCollection);
  50949. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection})});
  50950. },
  50951. args: ["aCollection"],
  50952. source: "on: aCollection\x0a\x09^ super new suite: aCollection",
  50953. referencedClasses: [],
  50954. pragmas: [],
  50955. messageSends: ["suite:", "new"]
  50956. }),
  50957. $globals.TestSuiteRunner.a$cls);
  50958. $core.addMethod(
  50959. $core.method({
  50960. selector: "isTestPackage",
  50961. protocol: "*SUnit",
  50962. fn: function (){
  50963. var self=this,$self=this;
  50964. return $core.withContext(function($ctx1) {
  50965. return $recv($self._classes())._anySatisfy_((function(each){
  50966. return $core.withContext(function($ctx2) {
  50967. return $recv(each)._isTestClass();
  50968. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50969. }));
  50970. }, function($ctx1) {$ctx1.fill(self,"isTestPackage",{})});
  50971. },
  50972. args: [],
  50973. source: "isTestPackage\x0a\x09^ self classes anySatisfy: [ :each | each isTestClass ]",
  50974. referencedClasses: [],
  50975. pragmas: [],
  50976. messageSends: ["anySatisfy:", "classes", "isTestClass"]
  50977. }),
  50978. $globals.Package);
  50979. $core.addMethod(
  50980. $core.method({
  50981. selector: "isTestClass",
  50982. protocol: "*SUnit",
  50983. fn: function (){
  50984. var self=this,$self=this;
  50985. return false;
  50986. },
  50987. args: [],
  50988. source: "isTestClass\x0a\x09^ false",
  50989. referencedClasses: [],
  50990. pragmas: [],
  50991. messageSends: []
  50992. }),
  50993. $globals.TBehaviorDefaults);
  50994. });
  50995. define('amber/core/Compiler-Tests',["amber/boot", "require", "amber/core/SUnit"], function($boot,requirejs){"use strict";
  50996. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  50997. var $pkg = $core.addPackage("Compiler-Tests");
  50998. $pkg.innerEval = function (expr) { return eval(expr); };
  50999. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  51000. $core.addClass("ASTParsingTest", $globals.TestCase, [], "Compiler-Tests");
  51001. $core.addMethod(
  51002. $core.method({
  51003. selector: "parse:forClass:",
  51004. protocol: "parsing",
  51005. fn: function (aString,aClass){
  51006. var self=this,$self=this;
  51007. return $core.withContext(function($ctx1) {
  51008. return $recv($recv($globals.Compiler)._new())._ast_forClass_protocol_(aString,aClass,"test");
  51009. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass})});
  51010. },
  51011. args: ["aString", "aClass"],
  51012. source: "parse: aString forClass: aClass\x0a\x09^ Compiler new\x0a\x09\x09ast: aString\x0a\x09\x09forClass: aClass\x0a\x09\x09protocol: 'test'",
  51013. referencedClasses: ["Compiler"],
  51014. pragmas: [],
  51015. messageSends: ["ast:forClass:protocol:", "new"]
  51016. }),
  51017. $globals.ASTParsingTest);
  51018. $core.addClass("ASTPCNodeVisitorTest", $globals.ASTParsingTest, [], "Compiler-Tests");
  51019. $core.addMethod(
  51020. $core.method({
  51021. selector: "astPCNodeVisitor",
  51022. protocol: "factory",
  51023. fn: function (){
  51024. var self=this,$self=this;
  51025. return $core.withContext(function($ctx1) {
  51026. var $1;
  51027. $1=$recv($globals.ASTPCNodeVisitor)._new();
  51028. $recv($1)._index_((0));
  51029. return $recv($1)._yourself();
  51030. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitor",{})});
  51031. },
  51032. args: [],
  51033. source: "astPCNodeVisitor\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09index: 0;\x0a\x09\x09yourself",
  51034. referencedClasses: ["ASTPCNodeVisitor"],
  51035. pragmas: [],
  51036. messageSends: ["index:", "new", "yourself"]
  51037. }),
  51038. $globals.ASTPCNodeVisitorTest);
  51039. $core.addMethod(
  51040. $core.method({
  51041. selector: "astPCNodeVisitorForSelector:",
  51042. protocol: "factory",
  51043. fn: function (aString){
  51044. var self=this,$self=this;
  51045. return $core.withContext(function($ctx1) {
  51046. var $1;
  51047. $1=$recv($globals.ASTPCNodeVisitor)._new();
  51048. $recv($1)._selector_(aString);
  51049. $recv($1)._index_((0));
  51050. return $recv($1)._yourself();
  51051. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitorForSelector:",{aString:aString})});
  51052. },
  51053. args: ["aString"],
  51054. source: "astPCNodeVisitorForSelector: aString\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09selector: aString;\x0a\x09\x09index: 0;\x0a\x09\x09yourself",
  51055. referencedClasses: ["ASTPCNodeVisitor"],
  51056. pragmas: [],
  51057. messageSends: ["selector:", "new", "index:", "yourself"]
  51058. }),
  51059. $globals.ASTPCNodeVisitorTest);
  51060. $core.addMethod(
  51061. $core.method({
  51062. selector: "testJSStatementNode",
  51063. protocol: "tests",
  51064. fn: function (){
  51065. var self=this,$self=this;
  51066. var ast,visitor;
  51067. return $core.withContext(function($ctx1) {
  51068. var $3,$2,$1;
  51069. ast=$self._parse_forClass_("foo <inlineJS: 'consolee.log(1)'>",$globals.Object);
  51070. $3=$self._astPCNodeVisitor();
  51071. $recv($3)._visit_(ast);
  51072. $2=$recv($3)._currentNode();
  51073. $1=$recv($2)._isJSStatementNode();
  51074. $self._assert_($1);
  51075. return self;
  51076. }, function($ctx1) {$ctx1.fill(self,"testJSStatementNode",{ast:ast,visitor:visitor})});
  51077. },
  51078. args: [],
  51079. source: "testJSStatementNode\x0a\x09| ast visitor |\x0a\x09\x0a\x09ast := self parse: 'foo <inlineJS: ''consolee.log(1)''>' forClass: Object.\x0a\x09self assert: (self astPCNodeVisitor\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) isJSStatementNode",
  51080. referencedClasses: ["Object"],
  51081. pragmas: [],
  51082. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  51083. }),
  51084. $globals.ASTPCNodeVisitorTest);
  51085. $core.addMethod(
  51086. $core.method({
  51087. selector: "testMessageSend",
  51088. protocol: "tests",
  51089. fn: function (){
  51090. var self=this,$self=this;
  51091. var ast;
  51092. return $core.withContext(function($ctx1) {
  51093. var $3,$2,$1;
  51094. ast=$self._parse_forClass_("foo self asString yourself. ^ self asBoolean",$globals.Object);
  51095. $3=$self._astPCNodeVisitorForSelector_("yourself");
  51096. $recv($3)._visit_(ast);
  51097. $2=$recv($3)._currentNode();
  51098. $1=$recv($2)._selector();
  51099. $self._assert_equals_($1,"yourself");
  51100. return self;
  51101. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{ast:ast})});
  51102. },
  51103. args: [],
  51104. 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'",
  51105. referencedClasses: ["Object"],
  51106. pragmas: [],
  51107. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  51108. }),
  51109. $globals.ASTPCNodeVisitorTest);
  51110. $core.addMethod(
  51111. $core.method({
  51112. selector: "testMessageSendWithBlocks",
  51113. protocol: "tests",
  51114. fn: function (){
  51115. var self=this,$self=this;
  51116. var ast;
  51117. return $core.withContext(function($ctx1) {
  51118. var $3,$2,$1;
  51119. ast=$self._parse_forClass_("foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean",$globals.Object);
  51120. $3=$self._astPCNodeVisitorForSelector_("yourself");
  51121. $recv($3)._visit_(ast);
  51122. $2=$recv($3)._currentNode();
  51123. $1=$recv($2)._selector();
  51124. $self._assert_equals_($1,"yourself");
  51125. return self;
  51126. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithBlocks",{ast:ast})});
  51127. },
  51128. args: [],
  51129. 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'",
  51130. referencedClasses: ["Object"],
  51131. pragmas: [],
  51132. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  51133. }),
  51134. $globals.ASTPCNodeVisitorTest);
  51135. $core.addMethod(
  51136. $core.method({
  51137. selector: "testMessageSendWithInlining",
  51138. protocol: "tests",
  51139. fn: function (){
  51140. var self=this,$self=this;
  51141. var ast;
  51142. return $core.withContext(function($ctx1) {
  51143. var $3,$4,$2,$1,$7,$6,$5;
  51144. ast=$self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  51145. $ctx1.sendIdx["parse:forClass:"]=1;
  51146. $3=$self._astPCNodeVisitorForSelector_("yourself");
  51147. $ctx1.sendIdx["astPCNodeVisitorForSelector:"]=1;
  51148. $recv($3)._visit_(ast);
  51149. $ctx1.sendIdx["visit:"]=1;
  51150. $4=$recv($3)._currentNode();
  51151. $ctx1.sendIdx["currentNode"]=1;
  51152. $2=$4;
  51153. $1=$recv($2)._selector();
  51154. $ctx1.sendIdx["selector"]=1;
  51155. $self._assert_equals_($1,"yourself");
  51156. $ctx1.sendIdx["assert:equals:"]=1;
  51157. ast=$self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  51158. $7=$self._astPCNodeVisitorForSelector_("asBoolean");
  51159. $recv($7)._visit_(ast);
  51160. $6=$recv($7)._currentNode();
  51161. $5=$recv($6)._selector();
  51162. $self._assert_equals_($5,"asBoolean");
  51163. return self;
  51164. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithInlining",{ast:ast})});
  51165. },
  51166. args: [],
  51167. 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'",
  51168. referencedClasses: ["Object"],
  51169. pragmas: [],
  51170. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  51171. }),
  51172. $globals.ASTPCNodeVisitorTest);
  51173. $core.addMethod(
  51174. $core.method({
  51175. selector: "testNoMessageSend",
  51176. protocol: "tests",
  51177. fn: function (){
  51178. var self=this,$self=this;
  51179. var ast;
  51180. return $core.withContext(function($ctx1) {
  51181. var $3,$2,$1;
  51182. ast=$self._parse_forClass_("foo ^ self",$globals.Object);
  51183. $3=$self._astPCNodeVisitor();
  51184. $recv($3)._visit_(ast);
  51185. $2=$recv($3)._currentNode();
  51186. $1=$recv($2)._isNil();
  51187. $self._assert_($1);
  51188. return self;
  51189. }, function($ctx1) {$ctx1.fill(self,"testNoMessageSend",{ast:ast})});
  51190. },
  51191. args: [],
  51192. 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",
  51193. referencedClasses: ["Object"],
  51194. pragmas: [],
  51195. messageSends: ["parse:forClass:", "assert:", "isNil", "visit:", "astPCNodeVisitor", "currentNode"]
  51196. }),
  51197. $globals.ASTPCNodeVisitorTest);
  51198. $core.addClass("ASTPositionTest", $globals.ASTParsingTest, [], "Compiler-Tests");
  51199. $core.addMethod(
  51200. $core.method({
  51201. selector: "testNodeAtPosition",
  51202. protocol: "tests",
  51203. fn: function (){
  51204. var self=this,$self=this;
  51205. var node;
  51206. return $core.withContext(function($ctx1) {
  51207. var $3,$4,$2,$1,$7,$8,$6,$5;
  51208. node=$self._parse_forClass_("yourself\x0a\x09^ self",$globals.Object);
  51209. $ctx1.sendIdx["parse:forClass:"]=1;
  51210. $3=node;
  51211. $4=(2).__at((4));
  51212. $ctx1.sendIdx["@"]=1;
  51213. $2=$recv($3)._navigationNodeAt_ifAbsent_($4,(function(){
  51214. return nil;
  51215. }));
  51216. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=1;
  51217. $1=$recv($2)._source();
  51218. $self._assert_equals_($1,"self");
  51219. $ctx1.sendIdx["assert:equals:"]=1;
  51220. node=$self._parse_forClass_("foo\x0a\x09true ifTrue: [ 1 ]",$globals.Object);
  51221. $ctx1.sendIdx["parse:forClass:"]=2;
  51222. $7=node;
  51223. $8=(2).__at((7));
  51224. $ctx1.sendIdx["@"]=2;
  51225. $6=$recv($7)._navigationNodeAt_ifAbsent_($8,(function(){
  51226. return nil;
  51227. }));
  51228. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=2;
  51229. $5=$recv($6)._selector();
  51230. $ctx1.sendIdx["selector"]=1;
  51231. $self._assert_equals_($5,"ifTrue:");
  51232. $ctx1.sendIdx["assert:equals:"]=2;
  51233. node=$self._parse_forClass_("foo\x0a\x09self foo; bar; baz",$globals.Object);
  51234. $self._assert_equals_($recv($recv(node)._navigationNodeAt_ifAbsent_((2).__at((8)),(function(){
  51235. return nil;
  51236. })))._selector(),"foo");
  51237. return self;
  51238. }, function($ctx1) {$ctx1.fill(self,"testNodeAtPosition",{node:node})});
  51239. },
  51240. args: [],
  51241. 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'",
  51242. referencedClasses: ["Object"],
  51243. pragmas: [],
  51244. messageSends: ["parse:forClass:", "assert:equals:", "source", "navigationNodeAt:ifAbsent:", "@", "selector"]
  51245. }),
  51246. $globals.ASTPositionTest);
  51247. $core.addClass("CodeGeneratorTest", $globals.ASTParsingTest, ["receiver"], "Compiler-Tests");
  51248. $core.addMethod(
  51249. $core.method({
  51250. selector: "codeGeneratorClass",
  51251. protocol: "accessing",
  51252. fn: function (){
  51253. var self=this,$self=this;
  51254. return $globals.CodeGenerator;
  51255. },
  51256. args: [],
  51257. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  51258. referencedClasses: ["CodeGenerator"],
  51259. pragmas: [],
  51260. messageSends: []
  51261. }),
  51262. $globals.CodeGeneratorTest);
  51263. $core.addMethod(
  51264. $core.method({
  51265. selector: "compiler",
  51266. protocol: "factory",
  51267. fn: function (){
  51268. var self=this,$self=this;
  51269. return $core.withContext(function($ctx1) {
  51270. var $1;
  51271. $1=$recv($globals.Compiler)._new();
  51272. $recv($1)._codeGeneratorClass_($self._codeGeneratorClass());
  51273. return $recv($1)._yourself();
  51274. }, function($ctx1) {$ctx1.fill(self,"compiler",{})});
  51275. },
  51276. args: [],
  51277. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  51278. referencedClasses: ["Compiler"],
  51279. pragmas: [],
  51280. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  51281. }),
  51282. $globals.CodeGeneratorTest);
  51283. $core.addMethod(
  51284. $core.method({
  51285. selector: "setUp",
  51286. protocol: "initialization",
  51287. fn: function (){
  51288. var self=this,$self=this;
  51289. return $core.withContext(function($ctx1) {
  51290. $self.receiver=$recv($globals.DoIt)._new();
  51291. return self;
  51292. }, function($ctx1) {$ctx1.fill(self,"setUp",{})});
  51293. },
  51294. args: [],
  51295. source: "setUp\x0a\x09receiver := DoIt new",
  51296. referencedClasses: ["DoIt"],
  51297. pragmas: [],
  51298. messageSends: ["new"]
  51299. }),
  51300. $globals.CodeGeneratorTest);
  51301. $core.addMethod(
  51302. $core.method({
  51303. selector: "should:class:receiver:return:",
  51304. protocol: "testing",
  51305. fn: function (aString,aClass,anObject,aResult){
  51306. var self=this,$self=this;
  51307. var method,result;
  51308. return $core.withContext(function($ctx1) {
  51309. $self.receiver=anObject;
  51310. method=$recv($self._compiler())._install_forClass_protocol_(aString,aClass,"tests");
  51311. result=$recv($self.receiver)._perform_($recv(method)._selector());
  51312. $recv(aClass)._removeCompiledMethod_(method);
  51313. $self._assert_equals_(aResult,result);
  51314. return self;
  51315. }, function($ctx1) {$ctx1.fill(self,"should:class:receiver:return:",{aString:aString,aClass:aClass,anObject:anObject,aResult:aResult,method:method,result:result})});
  51316. },
  51317. args: ["aString", "aClass", "anObject", "aResult"],
  51318. source: "should: aString class: aClass receiver: anObject return: aResult\x0a\x09| method result |\x0a\x0a\x09receiver := anObject.\x0a\x09method := self compiler install: aString forClass: aClass protocol: 'tests'.\x0a\x09result := receiver perform: method selector.\x0a\x09aClass removeCompiledMethod: method.\x0a\x09self assert: aResult equals: result",
  51319. referencedClasses: [],
  51320. pragmas: [],
  51321. messageSends: ["install:forClass:protocol:", "compiler", "perform:", "selector", "removeCompiledMethod:", "assert:equals:"]
  51322. }),
  51323. $globals.CodeGeneratorTest);
  51324. $core.addMethod(
  51325. $core.method({
  51326. selector: "should:receiver:raise:",
  51327. protocol: "testing",
  51328. fn: function (aString,anObject,anErrorClass){
  51329. var self=this,$self=this;
  51330. var method,result;
  51331. return $core.withContext(function($ctx1) {
  51332. var $1,$2,$3,$receiver;
  51333. $self.receiver=anObject;
  51334. $recv((function(){
  51335. return $core.withContext(function($ctx2) {
  51336. return $self._should_raise_((function(){
  51337. return $core.withContext(function($ctx3) {
  51338. $1=$self._compiler();
  51339. $2=$recv(anObject)._class();
  51340. $ctx3.sendIdx["class"]=1;
  51341. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  51342. return $recv($self.receiver)._perform_($recv(method)._selector());
  51343. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  51344. }),anErrorClass);
  51345. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51346. }))._ensure_((function(){
  51347. return $core.withContext(function($ctx2) {
  51348. $3=method;
  51349. if(($receiver = $3) == null || $receiver.a$nil){
  51350. return $3;
  51351. } else {
  51352. return $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  51353. }
  51354. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  51355. }));
  51356. return self;
  51357. }, function($ctx1) {$ctx1.fill(self,"should:receiver:raise:",{aString:aString,anObject:anObject,anErrorClass:anErrorClass,method:method,result:result})});
  51358. },
  51359. args: ["aString", "anObject", "anErrorClass"],
  51360. source: "should: aString receiver: anObject raise: anErrorClass\x0a\x09| method result |\x0a\x0a\x09receiver := anObject.\x0a\x09[ self should: [\x0a\x09\x09method := self compiler install: aString forClass: anObject class protocol: 'tests'.\x0a\x09\x09receiver perform: method selector ] raise: anErrorClass ]\x0a\x09ensure: [ method ifNotNil: [ anObject class removeCompiledMethod: method ] ]",
  51361. referencedClasses: [],
  51362. pragmas: [],
  51363. messageSends: ["ensure:", "should:raise:", "install:forClass:protocol:", "compiler", "class", "perform:", "selector", "ifNotNil:", "removeCompiledMethod:"]
  51364. }),
  51365. $globals.CodeGeneratorTest);
  51366. $core.addMethod(
  51367. $core.method({
  51368. selector: "should:receiver:return:",
  51369. protocol: "testing",
  51370. fn: function (aString,anObject,aResult){
  51371. var self=this,$self=this;
  51372. return $core.withContext(function($ctx1) {
  51373. return $self._should_class_receiver_return_(aString,$recv(anObject)._class(),anObject,aResult);
  51374. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult})});
  51375. },
  51376. args: ["aString", "anObject", "aResult"],
  51377. source: "should: aString receiver: anObject return: aResult\x0a\x09^ self should: aString class: anObject class receiver: anObject return: aResult",
  51378. referencedClasses: [],
  51379. pragmas: [],
  51380. messageSends: ["should:class:receiver:return:", "class"]
  51381. }),
  51382. $globals.CodeGeneratorTest);
  51383. $core.addMethod(
  51384. $core.method({
  51385. selector: "should:return:",
  51386. protocol: "testing",
  51387. fn: function (aString,anObject){
  51388. var self=this,$self=this;
  51389. return $core.withContext(function($ctx1) {
  51390. return $self._should_receiver_return_(aString,$self.receiver,anObject);
  51391. }, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject})});
  51392. },
  51393. args: ["aString", "anObject"],
  51394. source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString \x0a\x09\x09receiver: receiver \x0a\x09\x09return: anObject",
  51395. referencedClasses: [],
  51396. pragmas: [],
  51397. messageSends: ["should:receiver:return:"]
  51398. }),
  51399. $globals.CodeGeneratorTest);
  51400. $core.addMethod(
  51401. $core.method({
  51402. selector: "tearDown",
  51403. protocol: "initialization",
  51404. fn: function (){
  51405. var self=this,$self=this;
  51406. return self;
  51407. },
  51408. args: [],
  51409. source: "tearDown\x0a\x09\x22receiver := nil\x22",
  51410. referencedClasses: [],
  51411. pragmas: [],
  51412. messageSends: []
  51413. }),
  51414. $globals.CodeGeneratorTest);
  51415. $core.addMethod(
  51416. $core.method({
  51417. selector: "testAssignment",
  51418. protocol: "tests",
  51419. fn: function (){
  51420. var self=this,$self=this;
  51421. return $core.withContext(function($ctx1) {
  51422. $self._should_return_("foo | a | a := true ifTrue: [ 1 ]. ^ a",(1));
  51423. $ctx1.sendIdx["should:return:"]=1;
  51424. $self._should_return_("foo | a | a := false ifTrue: [ 1 ]. ^ a",nil);
  51425. $ctx1.sendIdx["should:return:"]=2;
  51426. $self._should_return_("foo | a | ^ a := true ifTrue: [ 1 ]",(1));
  51427. return self;
  51428. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{})});
  51429. },
  51430. args: [],
  51431. 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",
  51432. referencedClasses: [],
  51433. pragmas: [],
  51434. messageSends: ["should:return:"]
  51435. }),
  51436. $globals.CodeGeneratorTest);
  51437. $core.addMethod(
  51438. $core.method({
  51439. selector: "testBackslashSelectors",
  51440. protocol: "tests",
  51441. fn: function (){
  51442. var self=this,$self=this;
  51443. return $core.withContext(function($ctx1) {
  51444. $self._should_return_("\x5c arg ^ 4",(4));
  51445. $ctx1.sendIdx["should:return:"]=1;
  51446. $self._should_return_("\x5c\x5c arg ^ 42",(42));
  51447. return self;
  51448. }, function($ctx1) {$ctx1.fill(self,"testBackslashSelectors",{})});
  51449. },
  51450. args: [],
  51451. source: "testBackslashSelectors\x0a\x09\x0a\x09self should: '\x5c arg ^ 4' return: 4.\x0a\x09self should: '\x5c\x5c arg ^ 42' return: 42",
  51452. referencedClasses: [],
  51453. pragmas: [],
  51454. messageSends: ["should:return:"]
  51455. }),
  51456. $globals.CodeGeneratorTest);
  51457. $core.addMethod(
  51458. $core.method({
  51459. selector: "testBlockReturn",
  51460. protocol: "tests",
  51461. fn: function (){
  51462. var self=this,$self=this;
  51463. return $core.withContext(function($ctx1) {
  51464. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]",[(2), (3), (4)]);
  51465. $ctx1.sendIdx["should:return:"]=1;
  51466. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]",[(2), (3), (4)]);
  51467. $ctx1.sendIdx["should:return:"]=2;
  51468. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]",[(2), (1), (4)]);
  51469. return self;
  51470. }, function($ctx1) {$ctx1.fill(self,"testBlockReturn",{})});
  51471. },
  51472. args: [],
  51473. 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).",
  51474. referencedClasses: [],
  51475. pragmas: [],
  51476. messageSends: ["should:return:"]
  51477. }),
  51478. $globals.CodeGeneratorTest);
  51479. $core.addMethod(
  51480. $core.method({
  51481. selector: "testCascades",
  51482. protocol: "tests",
  51483. fn: function (){
  51484. var self=this,$self=this;
  51485. return $core.withContext(function($ctx1) {
  51486. $self._should_return_("foo ^ Array new add: 3; add: 4; yourself",[(3), (4)]);
  51487. return self;
  51488. }, function($ctx1) {$ctx1.fill(self,"testCascades",{})});
  51489. },
  51490. args: [],
  51491. source: "testCascades\x0a\x09\x0a\x09self should: 'foo ^ Array new add: 3; add: 4; yourself' return: #(3 4)",
  51492. referencedClasses: [],
  51493. pragmas: [],
  51494. messageSends: ["should:return:"]
  51495. }),
  51496. $globals.CodeGeneratorTest);
  51497. $core.addMethod(
  51498. $core.method({
  51499. selector: "testCascadesInDynamicArray",
  51500. protocol: "tests",
  51501. fn: function (){
  51502. var self=this,$self=this;
  51503. return $core.withContext(function($ctx1) {
  51504. $self._should_return_("foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}",[(1), (2)]);
  51505. return self;
  51506. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicArray",{})});
  51507. },
  51508. args: [],
  51509. source: "testCascadesInDynamicArray\x0a\x09self should: 'foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}' return: #(1 2)",
  51510. referencedClasses: [],
  51511. pragmas: [],
  51512. messageSends: ["should:return:"]
  51513. }),
  51514. $globals.CodeGeneratorTest);
  51515. $core.addMethod(
  51516. $core.method({
  51517. selector: "testCascadesInDynamicDictioary",
  51518. protocol: "tests",
  51519. fn: function (){
  51520. var self=this,$self=this;
  51521. return $core.withContext(function($ctx1) {
  51522. $self._should_return_("foo | x | x := 1. ^ #{'one' -> x. 'two' -> ([x:=2] value; in: [x])}",$globals.HashedCollection._newFromPairs_(["one",(1),"two",(2)]));
  51523. return self;
  51524. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicDictioary",{})});
  51525. },
  51526. args: [],
  51527. source: "testCascadesInDynamicDictioary\x0a\x09self should: 'foo | x | x := 1. ^ #{''one'' -> x. ''two'' -> ([x:=2] value; in: [x])}' return: #{'one' -> 1. 'two' -> 2}",
  51528. referencedClasses: [],
  51529. pragmas: [],
  51530. messageSends: ["should:return:"]
  51531. }),
  51532. $globals.CodeGeneratorTest);
  51533. $core.addMethod(
  51534. $core.method({
  51535. selector: "testCascadesInSend",
  51536. protocol: "tests",
  51537. fn: function (){
  51538. var self=this,$self=this;
  51539. return $core.withContext(function($ctx1) {
  51540. $self._should_return_("foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])",[(1), (2)]);
  51541. return self;
  51542. }, function($ctx1) {$ctx1.fill(self,"testCascadesInSend",{})});
  51543. },
  51544. args: [],
  51545. source: "testCascadesInSend\x0a\x09self should: 'foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])' return: #(1 2)",
  51546. referencedClasses: [],
  51547. pragmas: [],
  51548. messageSends: ["should:return:"]
  51549. }),
  51550. $globals.CodeGeneratorTest);
  51551. $core.addMethod(
  51552. $core.method({
  51553. selector: "testCascadesWithInlining",
  51554. protocol: "tests",
  51555. fn: function (){
  51556. var self=this,$self=this;
  51557. return $core.withContext(function($ctx1) {
  51558. $self._should_return_("foo ^ true class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(1));
  51559. $ctx1.sendIdx["should:return:"]=1;
  51560. $self._should_return_("foo ^ false class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(2));
  51561. return self;
  51562. }, function($ctx1) {$ctx1.fill(self,"testCascadesWithInlining",{})});
  51563. },
  51564. args: [],
  51565. 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",
  51566. referencedClasses: [],
  51567. pragmas: [],
  51568. messageSends: ["should:return:"]
  51569. }),
  51570. $globals.CodeGeneratorTest);
  51571. $core.addMethod(
  51572. $core.method({
  51573. selector: "testDynamicArrayElementsOrdered",
  51574. protocol: "tests",
  51575. fn: function (){
  51576. var self=this,$self=this;
  51577. return $core.withContext(function($ctx1) {
  51578. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. x := 2 }\x0a",[(1), (2)]);
  51579. $ctx1.sendIdx["should:return:"]=1;
  51580. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a",[(1), (2)]);
  51581. return self;
  51582. }, function($ctx1) {$ctx1.fill(self,"testDynamicArrayElementsOrdered",{})});
  51583. },
  51584. args: [],
  51585. 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).",
  51586. referencedClasses: [],
  51587. pragmas: [],
  51588. messageSends: ["should:return:"]
  51589. }),
  51590. $globals.CodeGeneratorTest);
  51591. $core.addMethod(
  51592. $core.method({
  51593. selector: "testDynamicDictionaryElementsOrdered",
  51594. protocol: "tests",
  51595. fn: function (){
  51596. var self=this,$self=this;
  51597. return $core.withContext(function($ctx1) {
  51598. $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)]));
  51599. return self;
  51600. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryElementsOrdered",{})});
  51601. },
  51602. args: [],
  51603. 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}.",
  51604. referencedClasses: [],
  51605. pragmas: [],
  51606. messageSends: ["should:return:"]
  51607. }),
  51608. $globals.CodeGeneratorTest);
  51609. $core.addMethod(
  51610. $core.method({
  51611. selector: "testDynamicDictionaryWithMoreArrows",
  51612. protocol: "tests",
  51613. fn: function (){
  51614. var self=this,$self=this;
  51615. return $core.withContext(function($ctx1) {
  51616. var $2,$1;
  51617. $2=$recv((1).__minus_gt((2))).__minus_gt((3));
  51618. $ctx1.sendIdx["->"]=1;
  51619. $1=$recv($globals.HashedCollection)._with_($2);
  51620. $self._should_return_("foo ^ #{1->2->3}",$1);
  51621. return self;
  51622. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryWithMoreArrows",{})});
  51623. },
  51624. args: [],
  51625. source: "testDynamicDictionaryWithMoreArrows\x0a\x09self should: 'foo ^ #{1->2->3}' return: (HashedCollection with: 1->2->3)",
  51626. referencedClasses: ["HashedCollection"],
  51627. pragmas: [],
  51628. messageSends: ["should:return:", "with:", "->"]
  51629. }),
  51630. $globals.CodeGeneratorTest);
  51631. $core.addMethod(
  51632. $core.method({
  51633. selector: "testGlobalVar",
  51634. protocol: "tests",
  51635. fn: function (){
  51636. var self=this,$self=this;
  51637. return $core.withContext(function($ctx1) {
  51638. $self._should_return_("foo ^ eval class",$globals.BlockClosure);
  51639. $ctx1.sendIdx["should:return:"]=1;
  51640. $self._should_return_("foo ^ Math cos: 0",(1));
  51641. $ctx1.sendIdx["should:return:"]=2;
  51642. $self._should_return_("foo ^ NonExistingVar",nil);
  51643. return self;
  51644. }, function($ctx1) {$ctx1.fill(self,"testGlobalVar",{})});
  51645. },
  51646. args: [],
  51647. 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",
  51648. referencedClasses: ["BlockClosure"],
  51649. pragmas: [],
  51650. messageSends: ["should:return:"]
  51651. }),
  51652. $globals.CodeGeneratorTest);
  51653. $core.addMethod(
  51654. $core.method({
  51655. selector: "testInnerTemporalDependentElementsOrdered",
  51656. protocol: "tests",
  51657. fn: function (){
  51658. var self=this,$self=this;
  51659. return $core.withContext(function($ctx1) {
  51660. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$10;
  51661. $2="foo".__minus_gt($globals.Array);
  51662. $ctx1.sendIdx["->"]=1;
  51663. $3="bar".__minus_gt((2));
  51664. $ctx1.sendIdx["->"]=2;
  51665. $1=[$2,$3];
  51666. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(x := 2)\x0a",$1);
  51667. $ctx1.sendIdx["should:return:"]=1;
  51668. $5="foo".__minus_gt($globals.Array);
  51669. $ctx1.sendIdx["->"]=3;
  51670. $6="bar".__minus_gt((2));
  51671. $ctx1.sendIdx["->"]=4;
  51672. $4=[$5,$6];
  51673. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$4);
  51674. $ctx1.sendIdx["should:return:"]=2;
  51675. $8="foo".__minus_gt((1));
  51676. $ctx1.sendIdx["->"]=5;
  51677. $9="bar".__minus_gt((2));
  51678. $ctx1.sendIdx["->"]=6;
  51679. $7=[$8,$9];
  51680. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$7);
  51681. $ctx1.sendIdx["should:return:"]=3;
  51682. $11="foo".__minus_gt((1));
  51683. $ctx1.sendIdx["->"]=7;
  51684. $10=[$11,"bar".__minus_gt((2))];
  51685. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",$10);
  51686. $ctx1.sendIdx["should:return:"]=4;
  51687. $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)]));
  51688. return self;
  51689. }, function($ctx1) {$ctx1.fill(self,"testInnerTemporalDependentElementsOrdered",{})});
  51690. },
  51691. args: [],
  51692. 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}.",
  51693. referencedClasses: ["Array"],
  51694. pragmas: [],
  51695. messageSends: ["should:return:", "->"]
  51696. }),
  51697. $globals.CodeGeneratorTest);
  51698. $core.addMethod(
  51699. $core.method({
  51700. selector: "testLexicalScope",
  51701. protocol: "tests",
  51702. fn: function (){
  51703. var self=this,$self=this;
  51704. return $core.withContext(function($ctx1) {
  51705. $self._should_return_("foo | a | a := 1. [ a := 2 ] value. ^ a",(2));
  51706. return self;
  51707. }, function($ctx1) {$ctx1.fill(self,"testLexicalScope",{})});
  51708. },
  51709. args: [],
  51710. source: "testLexicalScope\x0a\x09self should: 'foo | a | a := 1. [ a := 2 ] value. ^ a' return: 2",
  51711. referencedClasses: [],
  51712. pragmas: [],
  51713. messageSends: ["should:return:"]
  51714. }),
  51715. $globals.CodeGeneratorTest);
  51716. $core.addMethod(
  51717. $core.method({
  51718. selector: "testLiterals",
  51719. protocol: "tests",
  51720. fn: function (){
  51721. var self=this,$self=this;
  51722. return $core.withContext(function($ctx1) {
  51723. $self._should_return_("foo ^ 1",(1));
  51724. $ctx1.sendIdx["should:return:"]=1;
  51725. $self._should_return_("foo ^ 'hello'","hello");
  51726. $ctx1.sendIdx["should:return:"]=2;
  51727. $self._should_return_("foo ^ #(1 2 3 4)",[(1), (2), (3), (4)]);
  51728. $ctx1.sendIdx["should:return:"]=3;
  51729. $self._should_return_("foo ^ {1. [:x | x ] value: 2. 3. [4] value}",[(1), (2), (3), (4)]);
  51730. $ctx1.sendIdx["should:return:"]=4;
  51731. $self._should_return_("foo ^ true",true);
  51732. $ctx1.sendIdx["should:return:"]=5;
  51733. $self._should_return_("foo ^ false",false);
  51734. $ctx1.sendIdx["should:return:"]=6;
  51735. $self._should_return_("foo ^ #{1->2. 3->4}",$globals.HashedCollection._newFromPairs_([(1),(2),(3),(4)]));
  51736. $ctx1.sendIdx["should:return:"]=7;
  51737. $self._should_return_("foo ^ #hello","hello");
  51738. $ctx1.sendIdx["should:return:"]=8;
  51739. $self._should_return_("foo ^ $h","h");
  51740. $ctx1.sendIdx["should:return:"]=9;
  51741. $self._should_return_("foo ^ -123.456",(-123.456));
  51742. $ctx1.sendIdx["should:return:"]=10;
  51743. $self._should_return_("foo ^ -2.5e4",(-25000));
  51744. return self;
  51745. }, function($ctx1) {$ctx1.fill(self,"testLiterals",{})});
  51746. },
  51747. args: [],
  51748. 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.",
  51749. referencedClasses: [],
  51750. pragmas: [],
  51751. messageSends: ["should:return:"]
  51752. }),
  51753. $globals.CodeGeneratorTest);
  51754. $core.addMethod(
  51755. $core.method({
  51756. selector: "testLocalReturn",
  51757. protocol: "tests",
  51758. fn: function (){
  51759. var self=this,$self=this;
  51760. return $core.withContext(function($ctx1) {
  51761. $self._should_return_("foo ^ 1",(1));
  51762. $ctx1.sendIdx["should:return:"]=1;
  51763. $self._should_return_("foo ^ 1 + 1",(2));
  51764. $ctx1.sendIdx["should:return:"]=2;
  51765. $self._should_return_("foo ",$self.receiver);
  51766. $ctx1.sendIdx["should:return:"]=3;
  51767. $self._should_return_("foo self asString",$self.receiver);
  51768. $ctx1.sendIdx["should:return:"]=4;
  51769. $self._should_return_("foo | a b | a := 1. b := 2. ^ a + b",(3));
  51770. return self;
  51771. }, function($ctx1) {$ctx1.fill(self,"testLocalReturn",{})});
  51772. },
  51773. args: [],
  51774. 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",
  51775. referencedClasses: [],
  51776. pragmas: [],
  51777. messageSends: ["should:return:"]
  51778. }),
  51779. $globals.CodeGeneratorTest);
  51780. $core.addMethod(
  51781. $core.method({
  51782. selector: "testMessageSends",
  51783. protocol: "tests",
  51784. fn: function (){
  51785. var self=this,$self=this;
  51786. return $core.withContext(function($ctx1) {
  51787. $self._should_return_("foo ^ 1 asString","1");
  51788. $ctx1.sendIdx["should:return:"]=1;
  51789. $self._should_return_("foo ^ 1 + 1",(2));
  51790. $ctx1.sendIdx["should:return:"]=2;
  51791. $self._should_return_("foo ^ 1 + 2 * 3",(9));
  51792. $ctx1.sendIdx["should:return:"]=3;
  51793. $self._should_return_("foo ^ 1 to: 3",[(1), (2), (3)]);
  51794. $ctx1.sendIdx["should:return:"]=4;
  51795. $self._should_return_("foo ^ 1 to: 5 by: 2",[(1), (3), (5)]);
  51796. return self;
  51797. }, function($ctx1) {$ctx1.fill(self,"testMessageSends",{})});
  51798. },
  51799. args: [],
  51800. 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)",
  51801. referencedClasses: [],
  51802. pragmas: [],
  51803. messageSends: ["should:return:"]
  51804. }),
  51805. $globals.CodeGeneratorTest);
  51806. $core.addMethod(
  51807. $core.method({
  51808. selector: "testMistypedPragmaJSStatement",
  51809. protocol: "tests",
  51810. fn: function (){
  51811. var self=this,$self=this;
  51812. return $core.withContext(function($ctx1) {
  51813. $self._should_receiver_raise_("foo < inlineJS: 'return 'foo'' >",$self.receiver,$globals.ParseError);
  51814. return self;
  51815. }, function($ctx1) {$ctx1.fill(self,"testMistypedPragmaJSStatement",{})});
  51816. },
  51817. args: [],
  51818. source: "testMistypedPragmaJSStatement\x0a\x09self should: 'foo < inlineJS: ''return ''foo'''' >' receiver: receiver raise: ParseError",
  51819. referencedClasses: ["ParseError"],
  51820. pragmas: [],
  51821. messageSends: ["should:receiver:raise:"]
  51822. }),
  51823. $globals.CodeGeneratorTest);
  51824. $core.addMethod(
  51825. $core.method({
  51826. selector: "testMultipleSequences",
  51827. protocol: "tests",
  51828. fn: function (){
  51829. var self=this,$self=this;
  51830. return $core.withContext(function($ctx1) {
  51831. $self._should_return_("foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6",(30));
  51832. return self;
  51833. }, function($ctx1) {$ctx1.fill(self,"testMultipleSequences",{})});
  51834. },
  51835. args: [],
  51836. source: "testMultipleSequences\x0a\x09self should: 'foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6' return: 30",
  51837. referencedClasses: [],
  51838. pragmas: [],
  51839. messageSends: ["should:return:"]
  51840. }),
  51841. $globals.CodeGeneratorTest);
  51842. $core.addMethod(
  51843. $core.method({
  51844. selector: "testMutableLiterals",
  51845. protocol: "tests",
  51846. fn: function (){
  51847. var self=this,$self=this;
  51848. return $core.withContext(function($ctx1) {
  51849. $self._should_return_("foo ^ #( 1 2 ) at: 1 put: 3; yourself",[(3), (2)]);
  51850. return self;
  51851. }, function($ctx1) {$ctx1.fill(self,"testMutableLiterals",{})});
  51852. },
  51853. args: [],
  51854. 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)",
  51855. referencedClasses: [],
  51856. pragmas: [],
  51857. messageSends: ["should:return:"]
  51858. }),
  51859. $globals.CodeGeneratorTest);
  51860. $core.addMethod(
  51861. $core.method({
  51862. selector: "testNestedIfTrue",
  51863. protocol: "tests",
  51864. fn: function (){
  51865. var self=this,$self=this;
  51866. return $core.withContext(function($ctx1) {
  51867. $self._should_return_("foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]",(1));
  51868. $ctx1.sendIdx["should:return:"]=1;
  51869. $self._should_return_("foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]",nil);
  51870. $ctx1.sendIdx["should:return:"]=2;
  51871. $self._should_return_("foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]",(1));
  51872. $ctx1.sendIdx["should:return:"]=3;
  51873. $self._should_return_("foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]",$self.receiver);
  51874. return self;
  51875. }, function($ctx1) {$ctx1.fill(self,"testNestedIfTrue",{})});
  51876. },
  51877. args: [],
  51878. 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.",
  51879. referencedClasses: [],
  51880. pragmas: [],
  51881. messageSends: ["should:return:"]
  51882. }),
  51883. $globals.CodeGeneratorTest);
  51884. $core.addMethod(
  51885. $core.method({
  51886. selector: "testNestedSends",
  51887. protocol: "tests",
  51888. fn: function (){
  51889. var self=this,$self=this;
  51890. return $core.withContext(function($ctx1) {
  51891. $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());
  51892. return self;
  51893. }, function($ctx1) {$ctx1.fill(self,"testNestedSends",{})});
  51894. },
  51895. args: [],
  51896. source: "testNestedSends\x0a\x09self should: 'foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString' return: (Point x: (2@3) y: 4) asString",
  51897. referencedClasses: ["Point"],
  51898. pragmas: [],
  51899. messageSends: ["should:return:", "asString", "x:y:", "@"]
  51900. }),
  51901. $globals.CodeGeneratorTest);
  51902. $core.addMethod(
  51903. $core.method({
  51904. selector: "testNonLocalReturn",
  51905. protocol: "tests",
  51906. fn: function (){
  51907. var self=this,$self=this;
  51908. return $core.withContext(function($ctx1) {
  51909. $self._should_return_("foo [ ^ 1 ] value",(1));
  51910. $ctx1.sendIdx["should:return:"]=1;
  51911. $self._should_return_("foo [ ^ 1 + 1 ] value",(2));
  51912. $ctx1.sendIdx["should:return:"]=2;
  51913. $self._should_return_("foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt",(3));
  51914. $ctx1.sendIdx["should:return:"]=3;
  51915. $self._should_return_("foo [ :x | ^ x + x ] value: 4. ^ 2",(8));
  51916. return self;
  51917. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{})});
  51918. },
  51919. args: [],
  51920. 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",
  51921. referencedClasses: [],
  51922. pragmas: [],
  51923. messageSends: ["should:return:"]
  51924. }),
  51925. $globals.CodeGeneratorTest);
  51926. $core.addMethod(
  51927. $core.method({
  51928. selector: "testPascalCaseGlobal",
  51929. protocol: "tests",
  51930. fn: function (){
  51931. var self=this,$self=this;
  51932. return $core.withContext(function($ctx1) {
  51933. $self._should_return_("foo ^Object",$recv($recv($globals.Smalltalk)._globals())._at_("Object"));
  51934. $ctx1.sendIdx["should:return:"]=1;
  51935. $self._should_return_("foo ^NonExistent",nil);
  51936. return self;
  51937. }, function($ctx1) {$ctx1.fill(self,"testPascalCaseGlobal",{})});
  51938. },
  51939. args: [],
  51940. source: "testPascalCaseGlobal\x0a\x09self should: 'foo ^Object' return: (Smalltalk globals at: 'Object').\x0a\x09self should: 'foo ^NonExistent' return: nil",
  51941. referencedClasses: ["Smalltalk"],
  51942. pragmas: [],
  51943. messageSends: ["should:return:", "at:", "globals"]
  51944. }),
  51945. $globals.CodeGeneratorTest);
  51946. $core.addMethod(
  51947. $core.method({
  51948. selector: "testPragmaInBlock",
  51949. protocol: "tests",
  51950. fn: function (){
  51951. var self=this,$self=this;
  51952. return $core.withContext(function($ctx1) {
  51953. $self._should_receiver_raise_("foo ^ [ < fooBar > 4 ] value",$self.receiver,$globals.ParseError);
  51954. return self;
  51955. }, function($ctx1) {$ctx1.fill(self,"testPragmaInBlock",{})});
  51956. },
  51957. args: [],
  51958. source: "testPragmaInBlock\x0a\x09self should: 'foo ^ [ < fooBar > 4 ] value' receiver: receiver raise: ParseError",
  51959. referencedClasses: ["ParseError"],
  51960. pragmas: [],
  51961. messageSends: ["should:receiver:raise:"]
  51962. }),
  51963. $globals.CodeGeneratorTest);
  51964. $core.addMethod(
  51965. $core.method({
  51966. selector: "testPragmaJSStatement",
  51967. protocol: "tests",
  51968. fn: function (){
  51969. var self=this,$self=this;
  51970. return $core.withContext(function($ctx1) {
  51971. $self._should_return_("foo < inlineJS: 'return 2+3' >",(5));
  51972. return self;
  51973. }, function($ctx1) {$ctx1.fill(self,"testPragmaJSStatement",{})});
  51974. },
  51975. args: [],
  51976. source: "testPragmaJSStatement\x0a\x09self should: 'foo < inlineJS: ''return 2+3'' >' return: 5",
  51977. referencedClasses: [],
  51978. pragmas: [],
  51979. messageSends: ["should:return:"]
  51980. }),
  51981. $globals.CodeGeneratorTest);
  51982. $core.addMethod(
  51983. $core.method({
  51984. selector: "testRootSuperSend",
  51985. protocol: "tests",
  51986. fn: function (){
  51987. var self=this,$self=this;
  51988. return $core.withContext(function($ctx1) {
  51989. $self._should_receiver_raise_("foo ^ super class",$recv($globals.ProtoObject)._new(),$globals.MessageNotUnderstood);
  51990. return self;
  51991. }, function($ctx1) {$ctx1.fill(self,"testRootSuperSend",{})});
  51992. },
  51993. args: [],
  51994. source: "testRootSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super class' \x0a\x09\x09receiver: ProtoObject new\x0a\x09\x09raise: MessageNotUnderstood",
  51995. referencedClasses: ["ProtoObject", "MessageNotUnderstood"],
  51996. pragmas: [],
  51997. messageSends: ["should:receiver:raise:", "new"]
  51998. }),
  51999. $globals.CodeGeneratorTest);
  52000. $core.addMethod(
  52001. $core.method({
  52002. selector: "testSendReceiverAndArgumentsOrdered",
  52003. protocol: "tests",
  52004. fn: function (){
  52005. var self=this,$self=this;
  52006. return $core.withContext(function($ctx1) {
  52007. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a",[(1), (2)]);
  52008. $ctx1.sendIdx["should:return:"]=1;
  52009. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a",[$globals.Array,(2)]);
  52010. return self;
  52011. }, function($ctx1) {$ctx1.fill(self,"testSendReceiverAndArgumentsOrdered",{})});
  52012. },
  52013. args: [],
  52014. 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}.",
  52015. referencedClasses: ["Array"],
  52016. pragmas: [],
  52017. messageSends: ["should:return:"]
  52018. }),
  52019. $globals.CodeGeneratorTest);
  52020. $core.addMethod(
  52021. $core.method({
  52022. selector: "testSuperSend",
  52023. protocol: "tests",
  52024. fn: function (){
  52025. var self=this,$self=this;
  52026. return $core.withContext(function($ctx1) {
  52027. $self._should_receiver_return_("foo ^ super isBoolean",true,false);
  52028. return self;
  52029. }, function($ctx1) {$ctx1.fill(self,"testSuperSend",{})});
  52030. },
  52031. args: [],
  52032. source: "testSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super isBoolean' \x0a\x09\x09receiver: true\x0a\x09\x09return: false",
  52033. referencedClasses: [],
  52034. pragmas: [],
  52035. messageSends: ["should:receiver:return:"]
  52036. }),
  52037. $globals.CodeGeneratorTest);
  52038. $core.addMethod(
  52039. $core.method({
  52040. selector: "testSuperSend2",
  52041. protocol: "tests",
  52042. fn: function (){
  52043. var self=this,$self=this;
  52044. return $core.withContext(function($ctx1) {
  52045. $self._should_receiver_return_("foo ^ super isNil",nil,false);
  52046. return self;
  52047. }, function($ctx1) {$ctx1.fill(self,"testSuperSend2",{})});
  52048. },
  52049. args: [],
  52050. source: "testSuperSend2\x0a\x09self \x0a\x09\x09should: 'foo ^ super isNil'\x0a\x09\x09receiver: nil\x0a\x09\x09return: false",
  52051. referencedClasses: [],
  52052. pragmas: [],
  52053. messageSends: ["should:receiver:return:"]
  52054. }),
  52055. $globals.CodeGeneratorTest);
  52056. $core.addMethod(
  52057. $core.method({
  52058. selector: "testSuperSend3",
  52059. protocol: "tests",
  52060. fn: function (){
  52061. var self=this,$self=this;
  52062. return $core.withContext(function($ctx1) {
  52063. $self._should_class_receiver_return_("doo ^ super isNil",$globals.Object,nil,false);
  52064. return self;
  52065. }, function($ctx1) {$ctx1.fill(self,"testSuperSend3",{})});
  52066. },
  52067. args: [],
  52068. source: "testSuperSend3\x0a\x09self \x0a\x09\x09should: 'doo ^ super isNil'\x0a\x09\x09class: Object\x0a\x09\x09receiver: nil\x0a\x09\x09return: false",
  52069. referencedClasses: ["Object"],
  52070. pragmas: [],
  52071. messageSends: ["should:class:receiver:return:"]
  52072. }),
  52073. $globals.CodeGeneratorTest);
  52074. $core.addMethod(
  52075. $core.method({
  52076. selector: "testSuperSend4",
  52077. protocol: "tests",
  52078. fn: function (){
  52079. var self=this,$self=this;
  52080. return $core.withContext(function($ctx1) {
  52081. $self._should_receiver_return_("foo ^ super asJavaScriptObject","me",["m", "e"]);
  52082. return self;
  52083. }, function($ctx1) {$ctx1.fill(self,"testSuperSend4",{})});
  52084. },
  52085. args: [],
  52086. source: "testSuperSend4\x0a\x09self \x0a\x09\x09should: 'foo ^ super asJavaScriptObject'\x0a\x09\x09receiver: 'me'\x0a\x09\x09return: #('m' 'e')",
  52087. referencedClasses: [],
  52088. pragmas: [],
  52089. messageSends: ["should:receiver:return:"]
  52090. }),
  52091. $globals.CodeGeneratorTest);
  52092. $core.addMethod(
  52093. $core.method({
  52094. selector: "testSuperSend5",
  52095. protocol: "tests",
  52096. fn: function (){
  52097. var self=this,$self=this;
  52098. return $core.withContext(function($ctx1) {
  52099. $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)]);
  52100. return self;
  52101. }, function($ctx1) {$ctx1.fill(self,"testSuperSend5",{})});
  52102. },
  52103. args: [],
  52104. 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)",
  52105. referencedClasses: ["SequenceableCollection"],
  52106. pragmas: [],
  52107. messageSends: ["should:class:receiver:return:"]
  52108. }),
  52109. $globals.CodeGeneratorTest);
  52110. $core.addMethod(
  52111. $core.method({
  52112. selector: "testTempVariables",
  52113. protocol: "tests",
  52114. fn: function (){
  52115. var self=this,$self=this;
  52116. return $core.withContext(function($ctx1) {
  52117. $self._should_return_("foo | a | ^ a",nil);
  52118. $ctx1.sendIdx["should:return:"]=1;
  52119. $self._should_return_("foo | AVariable | ^ AVariable",nil);
  52120. $ctx1.sendIdx["should:return:"]=2;
  52121. $self._should_return_("foo | a b c | ^ c",nil);
  52122. $ctx1.sendIdx["should:return:"]=3;
  52123. $self._should_return_("foo | a | [ | d | ^ d ] value",nil);
  52124. $ctx1.sendIdx["should:return:"]=4;
  52125. $self._should_return_("foo | a | a:= 1. ^ a",(1));
  52126. $ctx1.sendIdx["should:return:"]=5;
  52127. $self._should_return_("foo | AVariable | AVariable := 1. ^ AVariable",(1));
  52128. return self;
  52129. }, function($ctx1) {$ctx1.fill(self,"testTempVariables",{})});
  52130. },
  52131. args: [],
  52132. 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.",
  52133. referencedClasses: [],
  52134. pragmas: [],
  52135. messageSends: ["should:return:"]
  52136. }),
  52137. $globals.CodeGeneratorTest);
  52138. $core.addMethod(
  52139. $core.method({
  52140. selector: "testThisContext",
  52141. protocol: "tests",
  52142. fn: function (){
  52143. var self=this,$self=this;
  52144. return $core.withContext(function($ctx1) {
  52145. $self._should_return_("foo ^ [ thisContext ] value outerContext == thisContext",true);
  52146. return self;
  52147. }, function($ctx1) {$ctx1.fill(self,"testThisContext",{})});
  52148. },
  52149. args: [],
  52150. source: "testThisContext\x0a\x09self should: 'foo ^ [ thisContext ] value outerContext == thisContext' return: true",
  52151. referencedClasses: [],
  52152. pragmas: [],
  52153. messageSends: ["should:return:"]
  52154. }),
  52155. $globals.CodeGeneratorTest);
  52156. $core.addMethod(
  52157. $core.method({
  52158. selector: "testUnknownPragma",
  52159. protocol: "tests",
  52160. fn: function (){
  52161. var self=this,$self=this;
  52162. return $core.withContext(function($ctx1) {
  52163. $self._should_return_("foo < fooBar: 'return 2+3' > | x | ^ x := 6",(6));
  52164. $ctx1.sendIdx["should:return:"]=1;
  52165. $self._should_return_("foo | x | < fooBar: 'return 2+3' > ^ x := 6",(6));
  52166. return self;
  52167. }, function($ctx1) {$ctx1.fill(self,"testUnknownPragma",{})});
  52168. },
  52169. args: [],
  52170. 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",
  52171. referencedClasses: [],
  52172. pragmas: [],
  52173. messageSends: ["should:return:"]
  52174. }),
  52175. $globals.CodeGeneratorTest);
  52176. $core.addMethod(
  52177. $core.method({
  52178. selector: "testifFalse",
  52179. protocol: "tests",
  52180. fn: function (){
  52181. var self=this,$self=this;
  52182. return $core.withContext(function($ctx1) {
  52183. $self._should_return_("foo true ifFalse: [ ^ 1 ]",$self.receiver);
  52184. $ctx1.sendIdx["should:return:"]=1;
  52185. $self._should_return_("foo false ifFalse: [ ^ 2 ]",(2));
  52186. $ctx1.sendIdx["should:return:"]=2;
  52187. $self._should_return_("foo ^ true ifFalse: [ 1 ]",nil);
  52188. $ctx1.sendIdx["should:return:"]=3;
  52189. $self._should_return_("foo ^ false ifFalse: [ 2 ]",(2));
  52190. return self;
  52191. }, function($ctx1) {$ctx1.fill(self,"testifFalse",{})});
  52192. },
  52193. args: [],
  52194. 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.",
  52195. referencedClasses: [],
  52196. pragmas: [],
  52197. messageSends: ["should:return:"]
  52198. }),
  52199. $globals.CodeGeneratorTest);
  52200. $core.addMethod(
  52201. $core.method({
  52202. selector: "testifFalseIfTrue",
  52203. protocol: "tests",
  52204. fn: function (){
  52205. var self=this,$self=this;
  52206. return $core.withContext(function($ctx1) {
  52207. $self._should_return_("foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]",(2));
  52208. $ctx1.sendIdx["should:return:"]=1;
  52209. $self._should_return_("foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]",(2));
  52210. $ctx1.sendIdx["should:return:"]=2;
  52211. $self._should_return_("foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]",(2));
  52212. $ctx1.sendIdx["should:return:"]=3;
  52213. $self._should_return_("foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]",(2));
  52214. return self;
  52215. }, function($ctx1) {$ctx1.fill(self,"testifFalseIfTrue",{})});
  52216. },
  52217. args: [],
  52218. 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.",
  52219. referencedClasses: [],
  52220. pragmas: [],
  52221. messageSends: ["should:return:"]
  52222. }),
  52223. $globals.CodeGeneratorTest);
  52224. $core.addMethod(
  52225. $core.method({
  52226. selector: "testifNil",
  52227. protocol: "tests",
  52228. fn: function (){
  52229. var self=this,$self=this;
  52230. return $core.withContext(function($ctx1) {
  52231. $self._should_return_("foo ^ 1 ifNil: [ 2 ]",(1));
  52232. $ctx1.sendIdx["should:return:"]=1;
  52233. $self._should_return_("foo ^ nil ifNil: [ 2 ]",(2));
  52234. $ctx1.sendIdx["should:return:"]=2;
  52235. $self._should_return_("foo 1 ifNil: [ ^ 2 ]",$self.receiver);
  52236. $ctx1.sendIdx["should:return:"]=3;
  52237. $self._should_return_("foo nil ifNil: [ ^ 2 ]",(2));
  52238. return self;
  52239. }, function($ctx1) {$ctx1.fill(self,"testifNil",{})});
  52240. },
  52241. args: [],
  52242. 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.",
  52243. referencedClasses: [],
  52244. pragmas: [],
  52245. messageSends: ["should:return:"]
  52246. }),
  52247. $globals.CodeGeneratorTest);
  52248. $core.addMethod(
  52249. $core.method({
  52250. selector: "testifNilIfNotNil",
  52251. protocol: "tests",
  52252. fn: function (){
  52253. var self=this,$self=this;
  52254. return $core.withContext(function($ctx1) {
  52255. $self._should_return_("foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]",(3));
  52256. $ctx1.sendIdx["should:return:"]=1;
  52257. $self._should_return_("foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]",(2));
  52258. $ctx1.sendIdx["should:return:"]=2;
  52259. $self._should_return_("foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(3));
  52260. $ctx1.sendIdx["should:return:"]=3;
  52261. $self._should_return_("foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(2));
  52262. return self;
  52263. }, function($ctx1) {$ctx1.fill(self,"testifNilIfNotNil",{})});
  52264. },
  52265. args: [],
  52266. 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.",
  52267. referencedClasses: [],
  52268. pragmas: [],
  52269. messageSends: ["should:return:"]
  52270. }),
  52271. $globals.CodeGeneratorTest);
  52272. $core.addMethod(
  52273. $core.method({
  52274. selector: "testifNotNil",
  52275. protocol: "tests",
  52276. fn: function (){
  52277. var self=this,$self=this;
  52278. return $core.withContext(function($ctx1) {
  52279. $self._should_return_("foo ^ 1 ifNotNil: [ 2 ]",(2));
  52280. $ctx1.sendIdx["should:return:"]=1;
  52281. $self._should_return_("foo ^ nil ifNotNil: [ 2 ]",nil);
  52282. $ctx1.sendIdx["should:return:"]=2;
  52283. $self._should_return_("foo 1 ifNotNil: [ ^ 2 ]",(2));
  52284. $ctx1.sendIdx["should:return:"]=3;
  52285. $self._should_return_("foo nil ifNotNil: [ ^ 2 ]",$self.receiver);
  52286. return self;
  52287. }, function($ctx1) {$ctx1.fill(self,"testifNotNil",{})});
  52288. },
  52289. args: [],
  52290. 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.",
  52291. referencedClasses: [],
  52292. pragmas: [],
  52293. messageSends: ["should:return:"]
  52294. }),
  52295. $globals.CodeGeneratorTest);
  52296. $core.addMethod(
  52297. $core.method({
  52298. selector: "testifNotNilWithArgument",
  52299. protocol: "tests",
  52300. fn: function (){
  52301. var self=this,$self=this;
  52302. return $core.withContext(function($ctx1) {
  52303. $self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ]",(3));
  52304. $ctx1.sendIdx["should:return:"]=1;
  52305. $self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ]",nil);
  52306. $ctx1.sendIdx["should:return:"]=2;
  52307. $self._should_return_("foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(3));
  52308. $ctx1.sendIdx["should:return:"]=3;
  52309. $self._should_return_("foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(5));
  52310. $ctx1.sendIdx["should:return:"]=4;
  52311. $self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(3));
  52312. $ctx1.sendIdx["should:return:"]=5;
  52313. $self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(5));
  52314. return self;
  52315. }, function($ctx1) {$ctx1.fill(self,"testifNotNilWithArgument",{})});
  52316. },
  52317. args: [],
  52318. 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",
  52319. referencedClasses: [],
  52320. pragmas: [],
  52321. messageSends: ["should:return:"]
  52322. }),
  52323. $globals.CodeGeneratorTest);
  52324. $core.addMethod(
  52325. $core.method({
  52326. selector: "testifTrue",
  52327. protocol: "tests",
  52328. fn: function (){
  52329. var self=this,$self=this;
  52330. return $core.withContext(function($ctx1) {
  52331. $self._should_return_("foo false ifTrue: [ ^ 1 ]",$self.receiver);
  52332. $ctx1.sendIdx["should:return:"]=1;
  52333. $self._should_return_("foo true ifTrue: [ ^ 2 ]",(2));
  52334. $ctx1.sendIdx["should:return:"]=2;
  52335. $self._should_return_("foo ^ false ifTrue: [ 1 ]",nil);
  52336. $ctx1.sendIdx["should:return:"]=3;
  52337. $self._should_return_("foo ^ true ifTrue: [ 2 ]",(2));
  52338. return self;
  52339. }, function($ctx1) {$ctx1.fill(self,"testifTrue",{})});
  52340. },
  52341. args: [],
  52342. 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.",
  52343. referencedClasses: [],
  52344. pragmas: [],
  52345. messageSends: ["should:return:"]
  52346. }),
  52347. $globals.CodeGeneratorTest);
  52348. $core.addMethod(
  52349. $core.method({
  52350. selector: "testifTrueIfFalse",
  52351. protocol: "tests",
  52352. fn: function (){
  52353. var self=this,$self=this;
  52354. return $core.withContext(function($ctx1) {
  52355. $self._should_return_("foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]",(2));
  52356. $ctx1.sendIdx["should:return:"]=1;
  52357. $self._should_return_("foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]",(1));
  52358. $ctx1.sendIdx["should:return:"]=2;
  52359. $self._should_return_("foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]",(1));
  52360. $ctx1.sendIdx["should:return:"]=3;
  52361. $self._should_return_("foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]",(2));
  52362. return self;
  52363. }, function($ctx1) {$ctx1.fill(self,"testifTrueIfFalse",{})});
  52364. },
  52365. args: [],
  52366. 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.",
  52367. referencedClasses: [],
  52368. pragmas: [],
  52369. messageSends: ["should:return:"]
  52370. }),
  52371. $globals.CodeGeneratorTest);
  52372. $core.addClass("ASTInterpreterTest", $globals.CodeGeneratorTest, [], "Compiler-Tests");
  52373. $core.addMethod(
  52374. $core.method({
  52375. selector: "interpret:forClass:receiver:withArguments:",
  52376. protocol: "private",
  52377. fn: function (aString,aClass,anObject,aDictionary){
  52378. var self=this,$self=this;
  52379. var ctx;
  52380. return $core.withContext(function($ctx1) {
  52381. var $1;
  52382. ctx=$self._prepareContextFor_class_receiver_withArguments_(aString,aClass,anObject,aDictionary);
  52383. $1=$recv(ctx)._interpreter();
  52384. $recv($1)._proceed();
  52385. return $recv($1)._result();
  52386. }, function($ctx1) {$ctx1.fill(self,"interpret:forClass:receiver:withArguments:",{aString:aString,aClass:aClass,anObject:anObject,aDictionary:aDictionary,ctx:ctx})});
  52387. },
  52388. args: ["aString", "aClass", "anObject", "aDictionary"],
  52389. 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",
  52390. referencedClasses: [],
  52391. pragmas: [],
  52392. messageSends: ["prepareContextFor:class:receiver:withArguments:", "proceed", "interpreter", "result"]
  52393. }),
  52394. $globals.ASTInterpreterTest);
  52395. $core.addMethod(
  52396. $core.method({
  52397. selector: "prepareContextFor:class:receiver:withArguments:",
  52398. protocol: "private",
  52399. fn: function (aString,aClass,anObject,aDictionary){
  52400. var self=this,$self=this;
  52401. var ctx,ast;
  52402. return $core.withContext(function($ctx1) {
  52403. var $1,$2,$3,$receiver;
  52404. ast=$self._parse_forClass_(aString,aClass);
  52405. $1=$recv($globals.AIContext)._new();
  52406. $ctx1.sendIdx["new"]=1;
  52407. $recv($1)._receiver_(anObject);
  52408. $recv($1)._selector_($recv(ast)._selector());
  52409. $recv($1)._interpreter_($recv($globals.ASTInterpreter)._new());
  52410. ctx=$recv($1)._yourself();
  52411. $2=$recv(ast)._sequenceNode();
  52412. if(($receiver = $2) == null || $receiver.a$nil){
  52413. $2;
  52414. } else {
  52415. var sequence;
  52416. sequence=$receiver;
  52417. $recv($recv(sequence)._temps())._do_((function(each){
  52418. return $core.withContext(function($ctx2) {
  52419. return $recv(ctx)._defineLocal_(each);
  52420. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52421. }));
  52422. }
  52423. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  52424. return $core.withContext(function($ctx2) {
  52425. return $recv(ctx)._localAt_put_(key,value);
  52426. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  52427. }));
  52428. $3=$recv(ctx)._interpreter();
  52429. $recv($3)._context_(ctx);
  52430. $recv($3)._node_(ast);
  52431. $recv($3)._enterNode();
  52432. return ctx;
  52433. }, function($ctx1) {$ctx1.fill(self,"prepareContextFor:class:receiver:withArguments:",{aString:aString,aClass:aClass,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast})});
  52434. },
  52435. args: ["aString", "aClass", "anObject", "aDictionary"],
  52436. source: "prepareContextFor: aString class: aClass receiver: anObject withArguments: aDictionary\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\x09\x09\x0a\x09aDictionary keysAndValuesDo: [ :key :value |\x0a\x09\x09ctx 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",
  52437. referencedClasses: ["AIContext", "ASTInterpreter"],
  52438. pragmas: [],
  52439. messageSends: ["parse:forClass:", "receiver:", "new", "selector:", "selector", "interpreter:", "yourself", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpreter", "node:", "enterNode"]
  52440. }),
  52441. $globals.ASTInterpreterTest);
  52442. $core.addMethod(
  52443. $core.method({
  52444. selector: "should:class:receiver:return:",
  52445. protocol: "testing",
  52446. fn: function (aString,aClass,anObject,aResult){
  52447. var self=this,$self=this;
  52448. var method,result;
  52449. return $core.withContext(function($ctx1) {
  52450. $self.receiver=anObject;
  52451. method=$recv($self._compiler())._install_forClass_protocol_(aString,aClass,"tests");
  52452. result=$self._interpret_forClass_receiver_withArguments_(aString,aClass,$self.receiver,$globals.HashedCollection._newFromPairs_([]));
  52453. $recv(aClass)._removeCompiledMethod_(method);
  52454. $self._assert_equals_(aResult,result);
  52455. return self;
  52456. }, function($ctx1) {$ctx1.fill(self,"should:class:receiver:return:",{aString:aString,aClass:aClass,anObject:anObject,aResult:aResult,method:method,result:result})});
  52457. },
  52458. args: ["aString", "aClass", "anObject", "aResult"],
  52459. source: "should: aString class: aClass receiver: anObject return: aResult\x0a\x09| method result |\x0a\x0a\x09receiver := anObject.\x0a\x09method := self compiler install: aString forClass: aClass protocol: 'tests'.\x0a\x09result := self interpret: aString forClass: aClass receiver: receiver withArguments: #{}.\x0a\x09aClass removeCompiledMethod: method.\x0a\x09self assert: aResult equals: result",
  52460. referencedClasses: [],
  52461. pragmas: [],
  52462. messageSends: ["install:forClass:protocol:", "compiler", "interpret:forClass:receiver:withArguments:", "removeCompiledMethod:", "assert:equals:"]
  52463. }),
  52464. $globals.ASTInterpreterTest);
  52465. $core.addClass("ASTDebuggerTest", $globals.ASTInterpreterTest, [], "Compiler-Tests");
  52466. $core.addMethod(
  52467. $core.method({
  52468. selector: "interpret:forClass:receiver:withArguments:",
  52469. protocol: "private",
  52470. fn: function (aString,aClass,anObject,aDictionary){
  52471. var self=this,$self=this;
  52472. var ctx;
  52473. return $core.withContext(function($ctx1) {
  52474. var $1;
  52475. ctx=$self._prepareContextFor_class_receiver_withArguments_(aString,aClass,anObject,aDictionary);
  52476. $1=$recv($globals.ASTDebugger)._context_(ctx);
  52477. $recv($1)._proceed();
  52478. return $recv($1)._result();
  52479. }, function($ctx1) {$ctx1.fill(self,"interpret:forClass:receiver:withArguments:",{aString:aString,aClass:aClass,anObject:anObject,aDictionary:aDictionary,ctx:ctx})});
  52480. },
  52481. args: ["aString", "aClass", "anObject", "aDictionary"],
  52482. 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",
  52483. referencedClasses: ["ASTDebugger"],
  52484. pragmas: [],
  52485. messageSends: ["prepareContextFor:class:receiver:withArguments:", "proceed", "context:", "result"]
  52486. }),
  52487. $globals.ASTDebuggerTest);
  52488. $core.addClass("InliningCodeGeneratorTest", $globals.CodeGeneratorTest, [], "Compiler-Tests");
  52489. $core.addMethod(
  52490. $core.method({
  52491. selector: "codeGeneratorClass",
  52492. protocol: "accessing",
  52493. fn: function (){
  52494. var self=this,$self=this;
  52495. return $globals.InliningCodeGenerator;
  52496. },
  52497. args: [],
  52498. source: "codeGeneratorClass\x0a\x09^ InliningCodeGenerator",
  52499. referencedClasses: ["InliningCodeGenerator"],
  52500. pragmas: [],
  52501. messageSends: []
  52502. }),
  52503. $globals.InliningCodeGeneratorTest);
  52504. $core.addClass("ScopeVarTest", $globals.TestCase, [], "Compiler-Tests");
  52505. $core.addMethod(
  52506. $core.method({
  52507. selector: "testClassRefVar",
  52508. protocol: "tests",
  52509. fn: function (){
  52510. var self=this,$self=this;
  52511. var node;
  52512. return $core.withContext(function($ctx1) {
  52513. var $1,$2;
  52514. $1=$recv($globals.VariableNode)._new();
  52515. $ctx1.sendIdx["new"]=1;
  52516. $recv($1)._value_("Object");
  52517. node=$recv($1)._yourself();
  52518. $2=$recv($globals.SemanticAnalyzer)._new();
  52519. $ctx1.sendIdx["new"]=2;
  52520. $recv($2)._pushScope_($recv($globals.MethodLexicalScope)._new());
  52521. $recv($2)._visit_(node);
  52522. $self._assert_($recv($recv(node)._binding())._isClassRefVar());
  52523. return self;
  52524. }, function($ctx1) {$ctx1.fill(self,"testClassRefVar",{node:node})});
  52525. },
  52526. args: [],
  52527. source: "testClassRefVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'Object';\x0a\x09\x09yourself.\x0a\x09SemanticAnalyzer new \x0a\x09\x09pushScope: MethodLexicalScope new;\x0a\x09\x09visit: node.\x0a\x09self assert: node binding isClassRefVar",
  52528. referencedClasses: ["VariableNode", "SemanticAnalyzer", "MethodLexicalScope"],
  52529. pragmas: [],
  52530. messageSends: ["value:", "new", "yourself", "pushScope:", "visit:", "assert:", "isClassRefVar", "binding"]
  52531. }),
  52532. $globals.ScopeVarTest);
  52533. $core.addMethod(
  52534. $core.method({
  52535. selector: "testInstanceVar",
  52536. protocol: "tests",
  52537. fn: function (){
  52538. var self=this,$self=this;
  52539. var node,scope;
  52540. return $core.withContext(function($ctx1) {
  52541. var $1;
  52542. $1=$recv($globals.VariableNode)._new();
  52543. $ctx1.sendIdx["new"]=1;
  52544. $recv($1)._value_("bzzz");
  52545. node=$recv($1)._yourself();
  52546. scope=$recv($globals.MethodLexicalScope)._new();
  52547. $recv(scope)._addIVar_("bzzz");
  52548. $self._assert_($recv($recv(scope)._bindingFor_(node))._isInstanceVar());
  52549. return self;
  52550. }, function($ctx1) {$ctx1.fill(self,"testInstanceVar",{node:node,scope:scope})});
  52551. },
  52552. args: [],
  52553. source: "testInstanceVar\x0a\x09| node scope |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09scope := MethodLexicalScope new.\x0a\x09scope addIVar: 'bzzz'.\x0a\x09self assert: (scope bindingFor: node) isInstanceVar",
  52554. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  52555. pragmas: [],
  52556. messageSends: ["value:", "new", "yourself", "addIVar:", "assert:", "isInstanceVar", "bindingFor:"]
  52557. }),
  52558. $globals.ScopeVarTest);
  52559. $core.addMethod(
  52560. $core.method({
  52561. selector: "testPseudoVar",
  52562. protocol: "tests",
  52563. fn: function (){
  52564. var self=this,$self=this;
  52565. var node,pseudoVars;
  52566. return $core.withContext(function($ctx1) {
  52567. var $1;
  52568. pseudoVars=["self", "super", "true", "false", "nil"];
  52569. $recv(pseudoVars)._do_((function(each){
  52570. return $core.withContext(function($ctx2) {
  52571. $1=$recv($globals.VariableNode)._new();
  52572. $ctx2.sendIdx["new"]=1;
  52573. $recv($1)._value_(each);
  52574. node=$recv($1)._yourself();
  52575. return $self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isPseudoVar());
  52576. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52577. }));
  52578. return self;
  52579. }, function($ctx1) {$ctx1.fill(self,"testPseudoVar",{node:node,pseudoVars:pseudoVars})});
  52580. },
  52581. args: [],
  52582. source: "testPseudoVar\x0a\x09| node pseudoVars |\x0a\x09pseudoVars := #('self' 'super' 'true' 'false' 'nil').\x0a\x09pseudoVars do: [:each |\x0a\x09\x09node := VariableNode new\x0a\x09\x09value: each;\x0a\x09\x09yourself.\x0a\x09\x09self assert: (MethodLexicalScope new bindingFor: node) isPseudoVar]",
  52583. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  52584. pragmas: [],
  52585. messageSends: ["do:", "value:", "new", "yourself", "assert:", "isPseudoVar", "bindingFor:"]
  52586. }),
  52587. $globals.ScopeVarTest);
  52588. $core.addMethod(
  52589. $core.method({
  52590. selector: "testTempVar",
  52591. protocol: "tests",
  52592. fn: function (){
  52593. var self=this,$self=this;
  52594. var node,scope;
  52595. return $core.withContext(function($ctx1) {
  52596. var $1;
  52597. $1=$recv($globals.VariableNode)._new();
  52598. $ctx1.sendIdx["new"]=1;
  52599. $recv($1)._value_("bzzz");
  52600. node=$recv($1)._yourself();
  52601. scope=$recv($globals.MethodLexicalScope)._new();
  52602. $recv(scope)._addTemp_("bzzz");
  52603. $self._assert_($recv($recv(scope)._bindingFor_(node))._isTempVar());
  52604. return self;
  52605. }, function($ctx1) {$ctx1.fill(self,"testTempVar",{node:node,scope:scope})});
  52606. },
  52607. args: [],
  52608. source: "testTempVar\x0a\x09| node scope |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09scope := MethodLexicalScope new.\x0a\x09scope addTemp: 'bzzz'.\x0a\x09self assert: (scope bindingFor: node) isTempVar",
  52609. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  52610. pragmas: [],
  52611. messageSends: ["value:", "new", "yourself", "addTemp:", "assert:", "isTempVar", "bindingFor:"]
  52612. }),
  52613. $globals.ScopeVarTest);
  52614. $core.addMethod(
  52615. $core.method({
  52616. selector: "testUnknownVar",
  52617. protocol: "tests",
  52618. fn: function (){
  52619. var self=this,$self=this;
  52620. var node;
  52621. return $core.withContext(function($ctx1) {
  52622. var $1;
  52623. $1=$recv($globals.VariableNode)._new();
  52624. $ctx1.sendIdx["new"]=1;
  52625. $recv($1)._value_("bzzz");
  52626. node=$recv($1)._yourself();
  52627. $self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isNil());
  52628. return self;
  52629. }, function($ctx1) {$ctx1.fill(self,"testUnknownVar",{node:node})});
  52630. },
  52631. args: [],
  52632. source: "testUnknownVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09self assert: (MethodLexicalScope new bindingFor: node) isNil",
  52633. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  52634. pragmas: [],
  52635. messageSends: ["value:", "new", "yourself", "assert:", "isNil", "bindingFor:"]
  52636. }),
  52637. $globals.ScopeVarTest);
  52638. $core.addClass("SemanticAnalyzerTest", $globals.TestCase, ["analyzer"], "Compiler-Tests");
  52639. $core.addMethod(
  52640. $core.method({
  52641. selector: "setUp",
  52642. protocol: "running",
  52643. fn: function (){
  52644. var self=this,$self=this;
  52645. return $core.withContext(function($ctx1) {
  52646. $self.analyzer=$recv($globals.SemanticAnalyzer)._on_($globals.Object);
  52647. return self;
  52648. }, function($ctx1) {$ctx1.fill(self,"setUp",{})});
  52649. },
  52650. args: [],
  52651. source: "setUp\x0a\x09analyzer := SemanticAnalyzer on: Object",
  52652. referencedClasses: ["SemanticAnalyzer", "Object"],
  52653. pragmas: [],
  52654. messageSends: ["on:"]
  52655. }),
  52656. $globals.SemanticAnalyzerTest);
  52657. $core.addMethod(
  52658. $core.method({
  52659. selector: "testAssignment",
  52660. protocol: "tests",
  52661. fn: function (){
  52662. var self=this,$self=this;
  52663. var src,ast;
  52664. return $core.withContext(function($ctx1) {
  52665. src="foo self := 1";
  52666. ast=$recv($globals.Smalltalk)._parse_(src);
  52667. $self._should_raise_((function(){
  52668. return $core.withContext(function($ctx2) {
  52669. return $recv($self.analyzer)._visit_(ast);
  52670. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52671. }),$globals.InvalidAssignmentError);
  52672. return self;
  52673. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{src:src,ast:ast})});
  52674. },
  52675. args: [],
  52676. 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",
  52677. referencedClasses: ["Smalltalk", "InvalidAssignmentError"],
  52678. pragmas: [],
  52679. messageSends: ["parse:", "should:raise:", "visit:"]
  52680. }),
  52681. $globals.SemanticAnalyzerTest);
  52682. $core.addMethod(
  52683. $core.method({
  52684. selector: "testNonLocalReturn",
  52685. protocol: "tests",
  52686. fn: function (){
  52687. var self=this,$self=this;
  52688. var src,ast;
  52689. return $core.withContext(function($ctx1) {
  52690. src="foo | a | a + 1. ^ a";
  52691. ast=$recv($globals.Smalltalk)._parse_(src);
  52692. $recv($self.analyzer)._visit_(ast);
  52693. $self._deny_($recv($recv(ast)._scope())._hasNonLocalReturn());
  52694. return self;
  52695. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{src:src,ast:ast})});
  52696. },
  52697. args: [],
  52698. 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",
  52699. referencedClasses: ["Smalltalk"],
  52700. pragmas: [],
  52701. messageSends: ["parse:", "visit:", "deny:", "hasNonLocalReturn", "scope"]
  52702. }),
  52703. $globals.SemanticAnalyzerTest);
  52704. $core.addMethod(
  52705. $core.method({
  52706. selector: "testNonLocalReturn2",
  52707. protocol: "tests",
  52708. fn: function (){
  52709. var self=this,$self=this;
  52710. var src,ast;
  52711. return $core.withContext(function($ctx1) {
  52712. src="foo | a | a + 1. [ [ ^ a] ]";
  52713. ast=$recv($globals.Smalltalk)._parse_(src);
  52714. $recv($self.analyzer)._visit_(ast);
  52715. $self._assert_($recv($recv(ast)._scope())._hasNonLocalReturn());
  52716. return self;
  52717. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn2",{src:src,ast:ast})});
  52718. },
  52719. args: [],
  52720. 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",
  52721. referencedClasses: ["Smalltalk"],
  52722. pragmas: [],
  52723. messageSends: ["parse:", "visit:", "assert:", "hasNonLocalReturn", "scope"]
  52724. }),
  52725. $globals.SemanticAnalyzerTest);
  52726. $core.addMethod(
  52727. $core.method({
  52728. selector: "testScope",
  52729. protocol: "tests",
  52730. fn: function (){
  52731. var self=this,$self=this;
  52732. var src,ast;
  52733. return $core.withContext(function($ctx1) {
  52734. var $4,$3,$2,$1;
  52735. src="foo | a | a + 1. [ | b | b := a ]";
  52736. ast=$recv($globals.Smalltalk)._parse_(src);
  52737. $recv($self.analyzer)._visit_(ast);
  52738. $4=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  52739. $ctx1.sendIdx["dagChildren"]=1;
  52740. $3=$recv($4)._last();
  52741. $2=$recv($3)._scope();
  52742. $ctx1.sendIdx["scope"]=1;
  52743. $1=$recv($2).__eq_eq($recv(ast)._scope());
  52744. $self._deny_($1);
  52745. return self;
  52746. }, function($ctx1) {$ctx1.fill(self,"testScope",{src:src,ast:ast})});
  52747. },
  52748. args: [],
  52749. source: "testScope\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ | b | b := a ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self deny: ast dagChildren first dagChildren last scope == ast scope.",
  52750. referencedClasses: ["Smalltalk"],
  52751. pragmas: [],
  52752. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "last", "dagChildren", "first"]
  52753. }),
  52754. $globals.SemanticAnalyzerTest);
  52755. $core.addMethod(
  52756. $core.method({
  52757. selector: "testScope2",
  52758. protocol: "tests",
  52759. fn: function (){
  52760. var self=this,$self=this;
  52761. var src,ast;
  52762. return $core.withContext(function($ctx1) {
  52763. var $8,$7,$6,$5,$4,$3,$2,$1;
  52764. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  52765. ast=$recv($globals.Smalltalk)._parse_(src);
  52766. $recv($self.analyzer)._visit_(ast);
  52767. $8=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  52768. $ctx1.sendIdx["dagChildren"]=3;
  52769. $7=$recv($8)._last();
  52770. $6=$recv($7)._dagChildren();
  52771. $ctx1.sendIdx["dagChildren"]=2;
  52772. $5=$recv($6)._first();
  52773. $ctx1.sendIdx["first"]=2;
  52774. $4=$recv($5)._dagChildren();
  52775. $ctx1.sendIdx["dagChildren"]=1;
  52776. $3=$recv($4)._first();
  52777. $ctx1.sendIdx["first"]=1;
  52778. $2=$recv($3)._scope();
  52779. $ctx1.sendIdx["scope"]=1;
  52780. $1=$recv($2).__eq_eq($recv(ast)._scope());
  52781. $self._deny_($1);
  52782. return self;
  52783. }, function($ctx1) {$ctx1.fill(self,"testScope2",{src:src,ast:ast})});
  52784. },
  52785. args: [],
  52786. source: "testScope2\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ [ | b | b := a ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self deny: ast dagChildren first dagChildren last dagChildren first dagChildren first scope == ast scope.",
  52787. referencedClasses: ["Smalltalk"],
  52788. pragmas: [],
  52789. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "first", "dagChildren", "last"]
  52790. }),
  52791. $globals.SemanticAnalyzerTest);
  52792. $core.addMethod(
  52793. $core.method({
  52794. selector: "testScopeLevel",
  52795. protocol: "tests",
  52796. fn: function (){
  52797. var self=this,$self=this;
  52798. var src,ast;
  52799. return $core.withContext(function($ctx1) {
  52800. var $2,$1,$10,$9,$8,$7,$6,$5,$4,$3;
  52801. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  52802. ast=$recv($globals.Smalltalk)._parse_(src);
  52803. $recv($self.analyzer)._visit_(ast);
  52804. $2=$recv(ast)._scope();
  52805. $ctx1.sendIdx["scope"]=1;
  52806. $1=$recv($2)._scopeLevel();
  52807. $ctx1.sendIdx["scopeLevel"]=1;
  52808. $self._assert_equals_($1,(1));
  52809. $ctx1.sendIdx["assert:equals:"]=1;
  52810. $10=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  52811. $ctx1.sendIdx["dagChildren"]=3;
  52812. $9=$recv($10)._last();
  52813. $8=$recv($9)._dagChildren();
  52814. $ctx1.sendIdx["dagChildren"]=2;
  52815. $7=$recv($8)._first();
  52816. $ctx1.sendIdx["first"]=2;
  52817. $6=$recv($7)._dagChildren();
  52818. $ctx1.sendIdx["dagChildren"]=1;
  52819. $5=$recv($6)._first();
  52820. $ctx1.sendIdx["first"]=1;
  52821. $4=$recv($5)._scope();
  52822. $3=$recv($4)._scopeLevel();
  52823. $self._assert_equals_($3,(3));
  52824. return self;
  52825. }, function($ctx1) {$ctx1.fill(self,"testScopeLevel",{src:src,ast:ast})});
  52826. },
  52827. args: [],
  52828. source: "testScopeLevel\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ [ | b | b := a ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self assert: ast scope scopeLevel equals: 1.\x0a\x09self assert: ast dagChildren first dagChildren last dagChildren first dagChildren first scope scopeLevel equals: 3",
  52829. referencedClasses: ["Smalltalk"],
  52830. pragmas: [],
  52831. messageSends: ["parse:", "visit:", "assert:equals:", "scopeLevel", "scope", "first", "dagChildren", "last"]
  52832. }),
  52833. $globals.SemanticAnalyzerTest);
  52834. $core.addMethod(
  52835. $core.method({
  52836. selector: "testUnknownVariables",
  52837. protocol: "tests",
  52838. fn: function (){
  52839. var self=this,$self=this;
  52840. var src,ast;
  52841. return $core.withContext(function($ctx1) {
  52842. src="foo | a | b + a";
  52843. ast=$recv($globals.Smalltalk)._parse_(src);
  52844. $self._should_raise_((function(){
  52845. return $core.withContext(function($ctx2) {
  52846. return $recv($self.analyzer)._visit_(ast);
  52847. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52848. }),$globals.UnknownVariableError);
  52849. return self;
  52850. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariables",{src:src,ast:ast})});
  52851. },
  52852. args: [],
  52853. 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",
  52854. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  52855. pragmas: [],
  52856. messageSends: ["parse:", "should:raise:", "visit:"]
  52857. }),
  52858. $globals.SemanticAnalyzerTest);
  52859. $core.addMethod(
  52860. $core.method({
  52861. selector: "testUnknownVariablesWithScope",
  52862. protocol: "tests",
  52863. fn: function (){
  52864. var self=this,$self=this;
  52865. var src,ast;
  52866. return $core.withContext(function($ctx1) {
  52867. src="foo | a b | [ c + 1. [ a + 1. d + 1 ]]";
  52868. ast=$recv($globals.Smalltalk)._parse_(src);
  52869. $self._should_raise_((function(){
  52870. return $core.withContext(function($ctx2) {
  52871. return $recv($self.analyzer)._visit_(ast);
  52872. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52873. }),$globals.UnknownVariableError);
  52874. return self;
  52875. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariablesWithScope",{src:src,ast:ast})});
  52876. },
  52877. args: [],
  52878. 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",
  52879. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  52880. pragmas: [],
  52881. messageSends: ["parse:", "should:raise:", "visit:"]
  52882. }),
  52883. $globals.SemanticAnalyzerTest);
  52884. $core.addMethod(
  52885. $core.method({
  52886. selector: "testVariableShadowing",
  52887. protocol: "tests",
  52888. fn: function (){
  52889. var self=this,$self=this;
  52890. var src,ast;
  52891. return $core.withContext(function($ctx1) {
  52892. src="foo | a | a + 1";
  52893. ast=$recv($globals.Smalltalk)._parse_(src);
  52894. $recv($self.analyzer)._visit_(ast);
  52895. return self;
  52896. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing",{src:src,ast:ast})});
  52897. },
  52898. args: [],
  52899. source: "testVariableShadowing\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  52900. referencedClasses: ["Smalltalk"],
  52901. pragmas: [],
  52902. messageSends: ["parse:", "visit:"]
  52903. }),
  52904. $globals.SemanticAnalyzerTest);
  52905. $core.addMethod(
  52906. $core.method({
  52907. selector: "testVariableShadowing2",
  52908. protocol: "tests",
  52909. fn: function (){
  52910. var self=this,$self=this;
  52911. var src,ast;
  52912. return $core.withContext(function($ctx1) {
  52913. src="foo | a | a + 1. [ | a | a := 2 ]";
  52914. ast=$recv($globals.Smalltalk)._parse_(src);
  52915. $self._should_raise_((function(){
  52916. return $core.withContext(function($ctx2) {
  52917. return $recv($self.analyzer)._visit_(ast);
  52918. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52919. }),$globals.ShadowingVariableError);
  52920. return self;
  52921. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing2",{src:src,ast:ast})});
  52922. },
  52923. args: [],
  52924. 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",
  52925. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  52926. pragmas: [],
  52927. messageSends: ["parse:", "should:raise:", "visit:"]
  52928. }),
  52929. $globals.SemanticAnalyzerTest);
  52930. $core.addMethod(
  52931. $core.method({
  52932. selector: "testVariableShadowing3",
  52933. protocol: "tests",
  52934. fn: function (){
  52935. var self=this,$self=this;
  52936. var src,ast;
  52937. return $core.withContext(function($ctx1) {
  52938. src="foo | a | a + 1. [ | b | b := 2 ]";
  52939. ast=$recv($globals.Smalltalk)._parse_(src);
  52940. $recv($self.analyzer)._visit_(ast);
  52941. return self;
  52942. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing3",{src:src,ast:ast})});
  52943. },
  52944. args: [],
  52945. source: "testVariableShadowing3\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | b | b := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  52946. referencedClasses: ["Smalltalk"],
  52947. pragmas: [],
  52948. messageSends: ["parse:", "visit:"]
  52949. }),
  52950. $globals.SemanticAnalyzerTest);
  52951. $core.addMethod(
  52952. $core.method({
  52953. selector: "testVariableShadowing4",
  52954. protocol: "tests",
  52955. fn: function (){
  52956. var self=this,$self=this;
  52957. var src,ast;
  52958. return $core.withContext(function($ctx1) {
  52959. src="foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]";
  52960. ast=$recv($globals.Smalltalk)._parse_(src);
  52961. $recv($self.analyzer)._visit_(ast);
  52962. return self;
  52963. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing4",{src:src,ast:ast})});
  52964. },
  52965. args: [],
  52966. source: "testVariableShadowing4\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  52967. referencedClasses: ["Smalltalk"],
  52968. pragmas: [],
  52969. messageSends: ["parse:", "visit:"]
  52970. }),
  52971. $globals.SemanticAnalyzerTest);
  52972. $core.addMethod(
  52973. $core.method({
  52974. selector: "testVariableShadowing5",
  52975. protocol: "tests",
  52976. fn: function (){
  52977. var self=this,$self=this;
  52978. var src,ast;
  52979. return $core.withContext(function($ctx1) {
  52980. src="foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]";
  52981. ast=$recv($globals.Smalltalk)._parse_(src);
  52982. $self._should_raise_((function(){
  52983. return $core.withContext(function($ctx2) {
  52984. return $recv($self.analyzer)._visit_(ast);
  52985. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52986. }),$globals.ShadowingVariableError);
  52987. return self;
  52988. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing5",{src:src,ast:ast})});
  52989. },
  52990. args: [],
  52991. 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",
  52992. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  52993. pragmas: [],
  52994. messageSends: ["parse:", "should:raise:", "visit:"]
  52995. }),
  52996. $globals.SemanticAnalyzerTest);
  52997. $core.addMethod(
  52998. $core.method({
  52999. selector: "testVariablesLookup",
  53000. protocol: "tests",
  53001. fn: function (){
  53002. var self=this,$self=this;
  53003. var src,ast;
  53004. return $core.withContext(function($ctx1) {
  53005. var $7,$6,$5,$4,$3,$2,$1,$15,$14,$13,$12,$11,$10,$9,$16,$8,$27,$26,$25,$24,$23,$22,$21,$20,$19,$18,$17,$39,$38,$37,$36,$35,$34,$33,$32,$31,$30,$29,$42,$41,$40,$28;
  53006. src="foo | a | a + 1. [ | b | b := a ]";
  53007. ast=$recv($globals.Smalltalk)._parse_(src);
  53008. $recv($self.analyzer)._visit_(ast);
  53009. $7=$recv(ast)._dagChildren();
  53010. $ctx1.sendIdx["dagChildren"]=2;
  53011. $6=$recv($7)._first();
  53012. $ctx1.sendIdx["first"]=2;
  53013. $5=$recv($6)._dagChildren();
  53014. $ctx1.sendIdx["dagChildren"]=1;
  53015. $4=$recv($5)._first();
  53016. $ctx1.sendIdx["first"]=1;
  53017. $3=$recv($4)._receiver();
  53018. $ctx1.sendIdx["receiver"]=1;
  53019. $2=$recv($3)._binding();
  53020. $ctx1.sendIdx["binding"]=1;
  53021. $1=$recv($2)._isTempVar();
  53022. $ctx1.sendIdx["isTempVar"]=1;
  53023. $self._assert_($1);
  53024. $ctx1.sendIdx["assert:"]=1;
  53025. $15=$recv(ast)._dagChildren();
  53026. $ctx1.sendIdx["dagChildren"]=4;
  53027. $14=$recv($15)._first();
  53028. $ctx1.sendIdx["first"]=4;
  53029. $13=$recv($14)._dagChildren();
  53030. $ctx1.sendIdx["dagChildren"]=3;
  53031. $12=$recv($13)._first();
  53032. $ctx1.sendIdx["first"]=3;
  53033. $11=$recv($12)._receiver();
  53034. $10=$recv($11)._binding();
  53035. $ctx1.sendIdx["binding"]=2;
  53036. $9=$recv($10)._scope();
  53037. $ctx1.sendIdx["scope"]=1;
  53038. $16=$recv(ast)._scope();
  53039. $ctx1.sendIdx["scope"]=2;
  53040. $8=$recv($9).__eq_eq($16);
  53041. $ctx1.sendIdx["=="]=1;
  53042. $self._assert_($8);
  53043. $ctx1.sendIdx["assert:"]=2;
  53044. $27=$recv(ast)._dagChildren();
  53045. $ctx1.sendIdx["dagChildren"]=8;
  53046. $26=$recv($27)._first();
  53047. $ctx1.sendIdx["first"]=7;
  53048. $25=$recv($26)._dagChildren();
  53049. $ctx1.sendIdx["dagChildren"]=7;
  53050. $24=$recv($25)._last();
  53051. $ctx1.sendIdx["last"]=1;
  53052. $23=$recv($24)._dagChildren();
  53053. $ctx1.sendIdx["dagChildren"]=6;
  53054. $22=$recv($23)._first();
  53055. $ctx1.sendIdx["first"]=6;
  53056. $21=$recv($22)._dagChildren();
  53057. $ctx1.sendIdx["dagChildren"]=5;
  53058. $20=$recv($21)._first();
  53059. $ctx1.sendIdx["first"]=5;
  53060. $19=$recv($20)._left();
  53061. $ctx1.sendIdx["left"]=1;
  53062. $18=$recv($19)._binding();
  53063. $ctx1.sendIdx["binding"]=3;
  53064. $17=$recv($18)._isTempVar();
  53065. $self._assert_($17);
  53066. $ctx1.sendIdx["assert:"]=3;
  53067. $39=$recv(ast)._dagChildren();
  53068. $ctx1.sendIdx["dagChildren"]=12;
  53069. $38=$recv($39)._first();
  53070. $ctx1.sendIdx["first"]=10;
  53071. $37=$recv($38)._dagChildren();
  53072. $ctx1.sendIdx["dagChildren"]=11;
  53073. $36=$recv($37)._last();
  53074. $ctx1.sendIdx["last"]=2;
  53075. $35=$recv($36)._dagChildren();
  53076. $ctx1.sendIdx["dagChildren"]=10;
  53077. $34=$recv($35)._first();
  53078. $ctx1.sendIdx["first"]=9;
  53079. $33=$recv($34)._dagChildren();
  53080. $ctx1.sendIdx["dagChildren"]=9;
  53081. $32=$recv($33)._first();
  53082. $ctx1.sendIdx["first"]=8;
  53083. $31=$recv($32)._left();
  53084. $30=$recv($31)._binding();
  53085. $29=$recv($30)._scope();
  53086. $ctx1.sendIdx["scope"]=3;
  53087. $42=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  53088. $ctx1.sendIdx["dagChildren"]=13;
  53089. $41=$recv($42)._last();
  53090. $40=$recv($41)._scope();
  53091. $28=$recv($29).__eq_eq($40);
  53092. $self._assert_($28);
  53093. return self;
  53094. }, function($ctx1) {$ctx1.fill(self,"testVariablesLookup",{src:src,ast:ast})});
  53095. },
  53096. args: [],
  53097. source: "testVariablesLookup\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ | b | b := a ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09\x22Binding for `a` in the message send\x22\x0a\x09self assert: ast dagChildren first dagChildren first receiver binding isTempVar.\x0a\x09self assert: ast dagChildren first dagChildren first receiver binding scope == ast scope.\x0a\x0a\x09\x22Binding for `b`\x22\x0a\x09self assert: ast dagChildren first dagChildren last dagChildren first dagChildren first left binding isTempVar.\x0a\x09self assert: ast dagChildren first dagChildren last dagChildren first dagChildren first left binding scope == ast dagChildren first dagChildren last scope.",
  53098. referencedClasses: ["Smalltalk"],
  53099. pragmas: [],
  53100. messageSends: ["parse:", "visit:", "assert:", "isTempVar", "binding", "receiver", "first", "dagChildren", "==", "scope", "left", "last"]
  53101. }),
  53102. $globals.SemanticAnalyzerTest);
  53103. $core.addClass("AISemanticAnalyzerTest", $globals.SemanticAnalyzerTest, [], "Compiler-Tests");
  53104. $core.addMethod(
  53105. $core.method({
  53106. selector: "setUp",
  53107. protocol: "running",
  53108. fn: function (){
  53109. var self=this,$self=this;
  53110. return $core.withContext(function($ctx1) {
  53111. var $1,$3,$4,$2;
  53112. $1=$recv($globals.AISemanticAnalyzer)._on_($globals.Object);
  53113. $3=$recv($globals.AIContext)._new();
  53114. $recv($3)._defineLocal_("local");
  53115. $recv($3)._localAt_put_("local",(3));
  53116. $4=$recv($3)._yourself();
  53117. $ctx1.sendIdx["yourself"]=1;
  53118. $2=$4;
  53119. $recv($1)._context_($2);
  53120. $self.analyzer=$recv($1)._yourself();
  53121. return self;
  53122. }, function($ctx1) {$ctx1.fill(self,"setUp",{})});
  53123. },
  53124. args: [],
  53125. 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",
  53126. referencedClasses: ["AISemanticAnalyzer", "Object", "AIContext"],
  53127. pragmas: [],
  53128. messageSends: ["context:", "on:", "defineLocal:", "new", "localAt:put:", "yourself"]
  53129. }),
  53130. $globals.AISemanticAnalyzerTest);
  53131. $core.addMethod(
  53132. $core.method({
  53133. selector: "testContextVariables",
  53134. protocol: "tests",
  53135. fn: function (){
  53136. var self=this,$self=this;
  53137. var src,ast;
  53138. return $core.withContext(function($ctx1) {
  53139. src="foo | a | local + a";
  53140. ast=$recv($globals.Smalltalk)._parse_(src);
  53141. $self._shouldnt_raise_((function(){
  53142. return $core.withContext(function($ctx2) {
  53143. return $recv($self.analyzer)._visit_(ast);
  53144. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53145. }),$globals.UnknownVariableError);
  53146. return self;
  53147. }, function($ctx1) {$ctx1.fill(self,"testContextVariables",{src:src,ast:ast})});
  53148. },
  53149. args: [],
  53150. 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",
  53151. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  53152. pragmas: [],
  53153. messageSends: ["parse:", "shouldnt:raise:", "visit:"]
  53154. }),
  53155. $globals.AISemanticAnalyzerTest);
  53156. });
  53157. define('amber/core/Kernel-Tests',["amber/boot", "require", "amber/core/Kernel-Objects", "amber/core/SUnit"], function($boot,requirejs){"use strict";
  53158. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  53159. var $pkg = $core.addPackage("Kernel-Tests");
  53160. $pkg.innerEval = function (expr) { return eval(expr); };
  53161. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  53162. $core.addClass("AnnouncementSubscriptionTest", $globals.TestCase, [], "Kernel-Tests");
  53163. $core.addMethod(
  53164. $core.method({
  53165. selector: "testAddExtensionMethod",
  53166. protocol: "tests",
  53167. fn: function (){
  53168. var self=this,$self=this;
  53169. var method,dirty;
  53170. return $core.withContext(function($ctx1) {
  53171. var $2,$1,$4,$3,$5,$8,$7,$6,$9,$10;
  53172. $2=$self._class();
  53173. $ctx1.sendIdx["class"]=1;
  53174. $1=$recv($2)._package();
  53175. $ctx1.sendIdx["package"]=1;
  53176. dirty=$recv($1)._isDirty();
  53177. $ctx1.sendIdx["isDirty"]=1;
  53178. $4=$self._class();
  53179. $ctx1.sendIdx["class"]=2;
  53180. $3=$recv($4)._package();
  53181. $ctx1.sendIdx["package"]=2;
  53182. $recv($3)._beClean();
  53183. $5=$self._class();
  53184. $ctx1.sendIdx["class"]=3;
  53185. method=$recv($5)._compile_protocol_("doNothing","**not-a-package");
  53186. $8=$self._class();
  53187. $ctx1.sendIdx["class"]=4;
  53188. $7=$recv($8)._package();
  53189. $ctx1.sendIdx["package"]=3;
  53190. $6=$recv($7)._isDirty();
  53191. $self._deny_($6);
  53192. $9=$self._class();
  53193. $ctx1.sendIdx["class"]=5;
  53194. $recv($9)._removeCompiledMethod_(method);
  53195. $10=dirty;
  53196. if($core.assert($10)){
  53197. $recv($recv($self._class())._package())._beDirty();
  53198. }
  53199. return self;
  53200. }, function($ctx1) {$ctx1.fill(self,"testAddExtensionMethod",{method:method,dirty:dirty})});
  53201. },
  53202. args: [],
  53203. 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 ]",
  53204. referencedClasses: [],
  53205. pragmas: [],
  53206. messageSends: ["isDirty", "package", "class", "beClean", "compile:protocol:", "deny:", "removeCompiledMethod:", "ifTrue:", "beDirty"]
  53207. }),
  53208. $globals.AnnouncementSubscriptionTest);
  53209. $core.addMethod(
  53210. $core.method({
  53211. selector: "testHandlesAnnouncement",
  53212. protocol: "tests",
  53213. fn: function (){
  53214. var self=this,$self=this;
  53215. var subscription,announcementClass1,announcementClass2,classBuilder;
  53216. return $core.withContext(function($ctx1) {
  53217. var $1,$3,$4,$2,$6,$7,$5;
  53218. classBuilder=$recv($globals.ClassBuilder)._new();
  53219. $ctx1.sendIdx["new"]=1;
  53220. announcementClass1=$recv(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($globals.SystemAnnouncement,"TestAnnouncement1",[],"Kernel-Tests");
  53221. $1=$recv($globals.AnnouncementSubscription)._new();
  53222. $ctx1.sendIdx["new"]=2;
  53223. subscription=$recv($1)._announcementClass_($globals.SystemAnnouncement);
  53224. $3=subscription;
  53225. $4=$recv($globals.SystemAnnouncement)._new();
  53226. $ctx1.sendIdx["new"]=3;
  53227. $2=$recv($3)._handlesAnnouncement_($4);
  53228. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  53229. $self._assert_equals_($2,true);
  53230. $ctx1.sendIdx["assert:equals:"]=1;
  53231. $6=subscription;
  53232. $7=$recv(announcementClass1)._new();
  53233. $ctx1.sendIdx["new"]=4;
  53234. $5=$recv($6)._handlesAnnouncement_($7);
  53235. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  53236. $self._assert_equals_($5,true);
  53237. $ctx1.sendIdx["assert:equals:"]=2;
  53238. $self._assert_equals_($recv(subscription)._handlesAnnouncement_($recv($globals.Object)._new()),false);
  53239. $recv(classBuilder)._basicRemoveClass_(announcementClass1);
  53240. return self;
  53241. }, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder})});
  53242. },
  53243. args: [],
  53244. 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.",
  53245. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"],
  53246. pragmas: [],
  53247. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"]
  53248. }),
  53249. $globals.AnnouncementSubscriptionTest);
  53250. $core.addClass("AnnouncerTest", $globals.TestCase, [], "Kernel-Tests");
  53251. $core.addMethod(
  53252. $core.method({
  53253. selector: "testOnDo",
  53254. protocol: "tests",
  53255. fn: function (){
  53256. var self=this,$self=this;
  53257. var counter,announcer;
  53258. return $core.withContext(function($ctx1) {
  53259. var $1,$2;
  53260. counter=(0);
  53261. announcer=$recv($globals.Announcer)._new();
  53262. $ctx1.sendIdx["new"]=1;
  53263. $recv(announcer)._on_do_($globals.SystemAnnouncement,(function(){
  53264. return $core.withContext(function($ctx2) {
  53265. counter=$recv(counter).__plus((1));
  53266. return counter;
  53267. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53268. }));
  53269. $1=announcer;
  53270. $2=$recv($globals.SystemAnnouncement)._new();
  53271. $ctx1.sendIdx["new"]=2;
  53272. $recv($1)._announce_($2);
  53273. $ctx1.sendIdx["announce:"]=1;
  53274. $self._assert_equals_(counter,(1));
  53275. $ctx1.sendIdx["assert:equals:"]=1;
  53276. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  53277. $self._assert_equals_(counter,(2));
  53278. return self;
  53279. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer})});
  53280. },
  53281. args: [],
  53282. 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.",
  53283. referencedClasses: ["Announcer", "SystemAnnouncement"],
  53284. pragmas: [],
  53285. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"]
  53286. }),
  53287. $globals.AnnouncerTest);
  53288. $core.addMethod(
  53289. $core.method({
  53290. selector: "testOnDoFor",
  53291. protocol: "tests",
  53292. fn: function (){
  53293. var self=this,$self=this;
  53294. var counter,announcer;
  53295. return $core.withContext(function($ctx1) {
  53296. var $1,$2,$3,$4;
  53297. counter=(0);
  53298. announcer=$recv($globals.Announcer)._new();
  53299. $ctx1.sendIdx["new"]=1;
  53300. $recv(announcer)._on_do_for_($globals.SystemAnnouncement,(function(){
  53301. return $core.withContext(function($ctx2) {
  53302. counter=$recv(counter).__plus((1));
  53303. return counter;
  53304. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53305. }),self);
  53306. $1=announcer;
  53307. $2=$recv($globals.SystemAnnouncement)._new();
  53308. $ctx1.sendIdx["new"]=2;
  53309. $recv($1)._announce_($2);
  53310. $ctx1.sendIdx["announce:"]=1;
  53311. $self._assert_equals_(counter,(1));
  53312. $ctx1.sendIdx["assert:equals:"]=1;
  53313. $3=announcer;
  53314. $4=$recv($globals.SystemAnnouncement)._new();
  53315. $ctx1.sendIdx["new"]=3;
  53316. $recv($3)._announce_($4);
  53317. $ctx1.sendIdx["announce:"]=2;
  53318. $self._assert_equals_(counter,(2));
  53319. $ctx1.sendIdx["assert:equals:"]=2;
  53320. $recv(announcer)._unsubscribe_(self);
  53321. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  53322. $self._assert_equals_(counter,(2));
  53323. return self;
  53324. }, function($ctx1) {$ctx1.fill(self,"testOnDoFor",{counter:counter,announcer:announcer})});
  53325. },
  53326. args: [],
  53327. 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.",
  53328. referencedClasses: ["Announcer", "SystemAnnouncement"],
  53329. pragmas: [],
  53330. messageSends: ["new", "on:do:for:", "+", "announce:", "assert:equals:", "unsubscribe:"]
  53331. }),
  53332. $globals.AnnouncerTest);
  53333. $core.addMethod(
  53334. $core.method({
  53335. selector: "testOnDoOnce",
  53336. protocol: "tests",
  53337. fn: function (){
  53338. var self=this,$self=this;
  53339. var counter,announcer;
  53340. return $core.withContext(function($ctx1) {
  53341. var $1,$2;
  53342. counter=(0);
  53343. announcer=$recv($globals.Announcer)._new();
  53344. $ctx1.sendIdx["new"]=1;
  53345. $recv(announcer)._on_doOnce_($globals.SystemAnnouncement,(function(){
  53346. return $core.withContext(function($ctx2) {
  53347. counter=$recv(counter).__plus((1));
  53348. return counter;
  53349. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53350. }));
  53351. $1=announcer;
  53352. $2=$recv($globals.SystemAnnouncement)._new();
  53353. $ctx1.sendIdx["new"]=2;
  53354. $recv($1)._announce_($2);
  53355. $ctx1.sendIdx["announce:"]=1;
  53356. $self._assert_equals_(counter,(1));
  53357. $ctx1.sendIdx["assert:equals:"]=1;
  53358. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  53359. $self._assert_equals_(counter,(1));
  53360. return self;
  53361. }, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer})});
  53362. },
  53363. args: [],
  53364. 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.",
  53365. referencedClasses: ["Announcer", "SystemAnnouncement"],
  53366. pragmas: [],
  53367. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"]
  53368. }),
  53369. $globals.AnnouncerTest);
  53370. $core.addClass("BlockClosureTest", $globals.TestCase, [], "Kernel-Tests");
  53371. $core.addMethod(
  53372. $core.method({
  53373. selector: "localReturnOnDoCatch",
  53374. protocol: "fixture",
  53375. fn: function (){
  53376. var self=this,$self=this;
  53377. return $core.withContext(function($ctx1) {
  53378. var $early={};
  53379. try {
  53380. $recv((function(){
  53381. throw $early=[(2)];
  53382. }))._on_do_($globals.Error,(function(){
  53383. }));
  53384. return (3);
  53385. }
  53386. catch(e) {if(e===$early)return e[0]; throw e}
  53387. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoCatch",{})});
  53388. },
  53389. args: [],
  53390. source: "localReturnOnDoCatch\x0a [ ^ 2 ] on: Error do: [].\x0a ^ 3",
  53391. referencedClasses: ["Error"],
  53392. pragmas: [],
  53393. messageSends: ["on:do:"]
  53394. }),
  53395. $globals.BlockClosureTest);
  53396. $core.addMethod(
  53397. $core.method({
  53398. selector: "localReturnOnDoMiss",
  53399. protocol: "fixture",
  53400. fn: function (){
  53401. var self=this,$self=this;
  53402. return $core.withContext(function($ctx1) {
  53403. var $early={};
  53404. try {
  53405. $recv((function(){
  53406. throw $early=[(2)];
  53407. }))._on_do_($globals.Class,(function(){
  53408. }));
  53409. return (3);
  53410. }
  53411. catch(e) {if(e===$early)return e[0]; throw e}
  53412. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoMiss",{})});
  53413. },
  53414. args: [],
  53415. source: "localReturnOnDoMiss\x0a [ ^ 2 ] on: Class do: [].\x0a ^ 3",
  53416. referencedClasses: ["Class"],
  53417. pragmas: [],
  53418. messageSends: ["on:do:"]
  53419. }),
  53420. $globals.BlockClosureTest);
  53421. $core.addMethod(
  53422. $core.method({
  53423. selector: "testCanClearInterval",
  53424. protocol: "tests",
  53425. fn: function (){
  53426. var self=this,$self=this;
  53427. return $core.withContext(function($ctx1) {
  53428. $self._shouldnt_raise_((function(){
  53429. return $core.withContext(function($ctx2) {
  53430. return $recv($recv((function(){
  53431. return $core.withContext(function($ctx3) {
  53432. return $recv($recv($globals.Error)._new())._signal();
  53433. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  53434. }))._valueWithInterval_((0)))._clearInterval();
  53435. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53436. }),$globals.Error);
  53437. return self;
  53438. }, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{})});
  53439. },
  53440. args: [],
  53441. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  53442. referencedClasses: ["Error"],
  53443. pragmas: [],
  53444. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"]
  53445. }),
  53446. $globals.BlockClosureTest);
  53447. $core.addMethod(
  53448. $core.method({
  53449. selector: "testCanClearTimeout",
  53450. protocol: "tests",
  53451. fn: function (){
  53452. var self=this,$self=this;
  53453. return $core.withContext(function($ctx1) {
  53454. $self._shouldnt_raise_((function(){
  53455. return $core.withContext(function($ctx2) {
  53456. return $recv($recv((function(){
  53457. return $core.withContext(function($ctx3) {
  53458. return $recv($recv($globals.Error)._new())._signal();
  53459. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  53460. }))._valueWithTimeout_((0)))._clearTimeout();
  53461. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53462. }),$globals.Error);
  53463. return self;
  53464. }, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{})});
  53465. },
  53466. args: [],
  53467. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  53468. referencedClasses: ["Error"],
  53469. pragmas: [],
  53470. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"]
  53471. }),
  53472. $globals.BlockClosureTest);
  53473. $core.addMethod(
  53474. $core.method({
  53475. selector: "testCompiledSource",
  53476. protocol: "tests",
  53477. fn: function (){
  53478. var self=this,$self=this;
  53479. return $core.withContext(function($ctx1) {
  53480. $self._assert_($recv($recv((function(){
  53481. return $core.withContext(function($ctx2) {
  53482. return (1).__plus((1));
  53483. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53484. }))._compiledSource())._includesSubString_("function"));
  53485. return self;
  53486. }, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{})});
  53487. },
  53488. args: [],
  53489. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  53490. referencedClasses: [],
  53491. pragmas: [],
  53492. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"]
  53493. }),
  53494. $globals.BlockClosureTest);
  53495. $core.addMethod(
  53496. $core.method({
  53497. selector: "testCurrySelf",
  53498. protocol: "tests",
  53499. fn: function (){
  53500. var self=this,$self=this;
  53501. var curriedMethod,array;
  53502. return $core.withContext(function($ctx1) {
  53503. curriedMethod=$recv($recv((function(selfarg,x){
  53504. return $core.withContext(function($ctx2) {
  53505. return $recv(selfarg)._at_(x);
  53506. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)});
  53507. }))._currySelf())._asCompiledMethod_("foo:");
  53508. $recv(curriedMethod)._protocol_("**test helper");
  53509. array=[(3), (1), (4)];
  53510. $recv($globals.Array)._addCompiledMethod_(curriedMethod);
  53511. $recv((function(){
  53512. return $core.withContext(function($ctx2) {
  53513. return $self._assert_equals_($recv(array)._foo_((2)),(1));
  53514. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53515. }))._ensure_((function(){
  53516. return $core.withContext(function($ctx2) {
  53517. return $recv($globals.Array)._removeCompiledMethod_(curriedMethod);
  53518. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  53519. }));
  53520. return self;
  53521. }, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array})});
  53522. },
  53523. args: [],
  53524. 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 ]",
  53525. referencedClasses: ["Array"],
  53526. pragmas: [],
  53527. messageSends: ["asCompiledMethod:", "currySelf", "at:", "protocol:", "addCompiledMethod:", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"]
  53528. }),
  53529. $globals.BlockClosureTest);
  53530. $core.addMethod(
  53531. $core.method({
  53532. selector: "testEnsure",
  53533. protocol: "tests",
  53534. fn: function (){
  53535. var self=this,$self=this;
  53536. return $core.withContext(function($ctx1) {
  53537. $self._assert_equals_($recv((function(){
  53538. return (3);
  53539. }))._ensure_((function(){
  53540. return (4);
  53541. })),(3));
  53542. return self;
  53543. }, function($ctx1) {$ctx1.fill(self,"testEnsure",{})});
  53544. },
  53545. args: [],
  53546. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  53547. referencedClasses: [],
  53548. pragmas: [],
  53549. messageSends: ["assert:equals:", "ensure:"]
  53550. }),
  53551. $globals.BlockClosureTest);
  53552. $core.addMethod(
  53553. $core.method({
  53554. selector: "testEnsureRaises",
  53555. protocol: "tests",
  53556. fn: function (){
  53557. var self=this,$self=this;
  53558. return $core.withContext(function($ctx1) {
  53559. $self._should_raise_((function(){
  53560. return $core.withContext(function($ctx2) {
  53561. return $recv((function(){
  53562. return $core.withContext(function($ctx3) {
  53563. return $recv($recv($globals.Error)._new())._signal();
  53564. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  53565. }))._ensure_((function(){
  53566. return true;
  53567. }));
  53568. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53569. }),$globals.Error);
  53570. return self;
  53571. }, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{})});
  53572. },
  53573. args: [],
  53574. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  53575. referencedClasses: ["Error"],
  53576. pragmas: [],
  53577. messageSends: ["should:raise:", "ensure:", "signal", "new"]
  53578. }),
  53579. $globals.BlockClosureTest);
  53580. $core.addMethod(
  53581. $core.method({
  53582. selector: "testExceptionSemantics",
  53583. protocol: "tests",
  53584. fn: function (){
  53585. var self=this,$self=this;
  53586. return $core.withContext(function($ctx1) {
  53587. $self._timeout_((100));
  53588. $recv($self._async_((function(){
  53589. return $core.withContext(function($ctx2) {
  53590. return $recv((function(){
  53591. return $core.withContext(function($ctx3) {
  53592. $self._assert_(true);
  53593. $recv($globals.Error)._signal();
  53594. $self._deny_(true);
  53595. return $self._finished();
  53596. $ctx3.sendIdx["finished"]=1;
  53597. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  53598. }))._on_do_($globals.Error,(function(ex){
  53599. return $core.withContext(function($ctx3) {
  53600. return $self._finished();
  53601. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  53602. }));
  53603. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53604. })))._valueWithTimeout_((0));
  53605. return self;
  53606. }, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{})});
  53607. },
  53608. args: [],
  53609. 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",
  53610. referencedClasses: ["Error"],
  53611. pragmas: [],
  53612. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"]
  53613. }),
  53614. $globals.BlockClosureTest);
  53615. $core.addMethod(
  53616. $core.method({
  53617. selector: "testLocalReturnOnDoCatch",
  53618. protocol: "tests",
  53619. fn: function (){
  53620. var self=this,$self=this;
  53621. return $core.withContext(function($ctx1) {
  53622. $self._assert_equals_($self._localReturnOnDoCatch(),(2));
  53623. return self;
  53624. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoCatch",{})});
  53625. },
  53626. args: [],
  53627. source: "testLocalReturnOnDoCatch\x0a\x09self assert: self localReturnOnDoCatch equals: 2",
  53628. referencedClasses: [],
  53629. pragmas: [],
  53630. messageSends: ["assert:equals:", "localReturnOnDoCatch"]
  53631. }),
  53632. $globals.BlockClosureTest);
  53633. $core.addMethod(
  53634. $core.method({
  53635. selector: "testLocalReturnOnDoMiss",
  53636. protocol: "tests",
  53637. fn: function (){
  53638. var self=this,$self=this;
  53639. return $core.withContext(function($ctx1) {
  53640. $self._assert_equals_($self._localReturnOnDoMiss(),(2));
  53641. return self;
  53642. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoMiss",{})});
  53643. },
  53644. args: [],
  53645. source: "testLocalReturnOnDoMiss\x0a\x09self assert: self localReturnOnDoMiss equals: 2",
  53646. referencedClasses: [],
  53647. pragmas: [],
  53648. messageSends: ["assert:equals:", "localReturnOnDoMiss"]
  53649. }),
  53650. $globals.BlockClosureTest);
  53651. $core.addMethod(
  53652. $core.method({
  53653. selector: "testNewWithValues",
  53654. protocol: "tests",
  53655. fn: function (){
  53656. var self=this,$self=this;
  53657. return $core.withContext(function($ctx1) {
  53658. function TestConstructor(arg1, arg2, arg3) {}
  53659. TestConstructor.prototype.name = "theTestPrototype";
  53660. var wrappedConstructor = $recv(TestConstructor);
  53661. var result = wrappedConstructor._newWithValues_([1, 2, 3]);
  53662. $self._assert_(result instanceof TestConstructor);
  53663. $self._assert_equals_(result.name, "theTestPrototype");
  53664. /* newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made. */
  53665. $self._should_raise_(function () {wrappedConstructor._newWithValues_("single argument");}, $globals.Error);;
  53666. return self;
  53667. }, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{})});
  53668. },
  53669. args: [],
  53670. 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'>",
  53671. referencedClasses: [],
  53672. 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);"]]],
  53673. messageSends: []
  53674. }),
  53675. $globals.BlockClosureTest);
  53676. $core.addMethod(
  53677. $core.method({
  53678. selector: "testNumArgs",
  53679. protocol: "tests",
  53680. fn: function (){
  53681. var self=this,$self=this;
  53682. return $core.withContext(function($ctx1) {
  53683. var $1;
  53684. $1=$recv((function(){
  53685. }))._numArgs();
  53686. $ctx1.sendIdx["numArgs"]=1;
  53687. $self._assert_equals_($1,(0));
  53688. $ctx1.sendIdx["assert:equals:"]=1;
  53689. $self._assert_equals_($recv((function(a,b){
  53690. }))._numArgs(),(2));
  53691. return self;
  53692. }, function($ctx1) {$ctx1.fill(self,"testNumArgs",{})});
  53693. },
  53694. args: [],
  53695. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  53696. referencedClasses: [],
  53697. pragmas: [],
  53698. messageSends: ["assert:equals:", "numArgs"]
  53699. }),
  53700. $globals.BlockClosureTest);
  53701. $core.addMethod(
  53702. $core.method({
  53703. selector: "testOnDo",
  53704. protocol: "tests",
  53705. fn: function (){
  53706. var self=this,$self=this;
  53707. return $core.withContext(function($ctx1) {
  53708. $self._assert_($recv((function(){
  53709. return $core.withContext(function($ctx2) {
  53710. return $recv($recv($globals.Error)._new())._signal();
  53711. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53712. }))._on_do_($globals.Error,(function(ex){
  53713. return true;
  53714. })));
  53715. return self;
  53716. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{})});
  53717. },
  53718. args: [],
  53719. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  53720. referencedClasses: ["Error"],
  53721. pragmas: [],
  53722. messageSends: ["assert:", "on:do:", "signal", "new"]
  53723. }),
  53724. $globals.BlockClosureTest);
  53725. $core.addMethod(
  53726. $core.method({
  53727. selector: "testValue",
  53728. protocol: "tests",
  53729. fn: function (){
  53730. var self=this,$self=this;
  53731. return $core.withContext(function($ctx1) {
  53732. var $1;
  53733. $1=$recv((function(){
  53734. return $core.withContext(function($ctx2) {
  53735. return (1).__plus((1));
  53736. $ctx2.sendIdx["+"]=1;
  53737. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53738. }))._value();
  53739. $ctx1.sendIdx["value"]=1;
  53740. $self._assert_equals_($1,(2));
  53741. $ctx1.sendIdx["assert:equals:"]=1;
  53742. $self._assert_equals_($recv((function(x){
  53743. return $core.withContext(function($ctx2) {
  53744. return $recv(x).__plus((1));
  53745. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  53746. }))._value_((2)),(3));
  53747. $ctx1.sendIdx["assert:equals:"]=2;
  53748. $self._assert_equals_($recv((function(x,y){
  53749. return $core.withContext(function($ctx2) {
  53750. return $recv(x).__star(y);
  53751. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)});
  53752. }))._value_value_((2),(4)),(8));
  53753. $ctx1.sendIdx["assert:equals:"]=3;
  53754. $self._assert_equals_($recv((function(a,b,c){
  53755. return (1);
  53756. }))._value(),(1));
  53757. return self;
  53758. }, function($ctx1) {$ctx1.fill(self,"testValue",{})});
  53759. },
  53760. args: [],
  53761. 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",
  53762. referencedClasses: [],
  53763. pragmas: [],
  53764. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"]
  53765. }),
  53766. $globals.BlockClosureTest);
  53767. $core.addMethod(
  53768. $core.method({
  53769. selector: "testValueWithPossibleArguments",
  53770. protocol: "tests",
  53771. fn: function (){
  53772. var self=this,$self=this;
  53773. return $core.withContext(function($ctx1) {
  53774. var $1,$2;
  53775. $1=$recv((function(){
  53776. return (1);
  53777. }))._valueWithPossibleArguments_([(3), (4)]);
  53778. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  53779. $self._assert_equals_($1,(1));
  53780. $ctx1.sendIdx["assert:equals:"]=1;
  53781. $2=$recv((function(a){
  53782. return $core.withContext(function($ctx2) {
  53783. return $recv(a).__plus((4));
  53784. $ctx2.sendIdx["+"]=1;
  53785. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  53786. }))._valueWithPossibleArguments_([(3), (4)]);
  53787. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  53788. $self._assert_equals_($2,(7));
  53789. $ctx1.sendIdx["assert:equals:"]=2;
  53790. $self._assert_equals_($recv((function(a,b){
  53791. return $core.withContext(function($ctx2) {
  53792. return $recv(a).__plus(b);
  53793. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  53794. }))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  53795. return self;
  53796. }, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{})});
  53797. },
  53798. args: [],
  53799. 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.",
  53800. referencedClasses: [],
  53801. pragmas: [],
  53802. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"]
  53803. }),
  53804. $globals.BlockClosureTest);
  53805. $core.addMethod(
  53806. $core.method({
  53807. selector: "testWhileFalse",
  53808. protocol: "tests",
  53809. fn: function (){
  53810. var self=this,$self=this;
  53811. var i;
  53812. return $core.withContext(function($ctx1) {
  53813. i=(0);
  53814. $recv((function(){
  53815. return $core.withContext(function($ctx2) {
  53816. return $recv(i).__gt((5));
  53817. $ctx2.sendIdx[">"]=1;
  53818. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53819. }))._whileFalse_((function(){
  53820. return $core.withContext(function($ctx2) {
  53821. i=$recv(i).__plus((1));
  53822. $ctx2.sendIdx["+"]=1;
  53823. return i;
  53824. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53825. }));
  53826. $self._assert_equals_(i,(6));
  53827. $ctx1.sendIdx["assert:equals:"]=1;
  53828. i=(0);
  53829. $recv((function(){
  53830. return $core.withContext(function($ctx2) {
  53831. i=$recv(i).__plus((1));
  53832. return $recv(i).__gt((5));
  53833. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  53834. }))._whileFalse();
  53835. $self._assert_equals_(i,(6));
  53836. return self;
  53837. }, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i})});
  53838. },
  53839. args: [],
  53840. 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",
  53841. referencedClasses: [],
  53842. pragmas: [],
  53843. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"]
  53844. }),
  53845. $globals.BlockClosureTest);
  53846. $core.addMethod(
  53847. $core.method({
  53848. selector: "testWhileTrue",
  53849. protocol: "tests",
  53850. fn: function (){
  53851. var self=this,$self=this;
  53852. var i;
  53853. return $core.withContext(function($ctx1) {
  53854. i=(0);
  53855. $recv((function(){
  53856. return $core.withContext(function($ctx2) {
  53857. return $recv(i).__lt((5));
  53858. $ctx2.sendIdx["<"]=1;
  53859. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53860. }))._whileTrue_((function(){
  53861. return $core.withContext(function($ctx2) {
  53862. i=$recv(i).__plus((1));
  53863. $ctx2.sendIdx["+"]=1;
  53864. return i;
  53865. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53866. }));
  53867. $self._assert_equals_(i,(5));
  53868. $ctx1.sendIdx["assert:equals:"]=1;
  53869. i=(0);
  53870. $recv((function(){
  53871. return $core.withContext(function($ctx2) {
  53872. i=$recv(i).__plus((1));
  53873. return $recv(i).__lt((5));
  53874. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  53875. }))._whileTrue();
  53876. $self._assert_equals_(i,(5));
  53877. return self;
  53878. }, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i})});
  53879. },
  53880. args: [],
  53881. 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",
  53882. referencedClasses: [],
  53883. pragmas: [],
  53884. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"]
  53885. }),
  53886. $globals.BlockClosureTest);
  53887. $core.addClass("BooleanTest", $globals.TestCase, [], "Kernel-Tests");
  53888. $core.addMethod(
  53889. $core.method({
  53890. selector: "testEquality",
  53891. protocol: "tests",
  53892. fn: function (){
  53893. var self=this,$self=this;
  53894. return $core.withContext(function($ctx1) {
  53895. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  53896. $1=(0).__eq(false);
  53897. $ctx1.sendIdx["="]=1;
  53898. $self._deny_($1);
  53899. $ctx1.sendIdx["deny:"]=1;
  53900. $2=false.__eq((0));
  53901. $ctx1.sendIdx["="]=2;
  53902. $self._deny_($2);
  53903. $ctx1.sendIdx["deny:"]=2;
  53904. $3="".__eq(false);
  53905. $ctx1.sendIdx["="]=3;
  53906. $self._deny_($3);
  53907. $ctx1.sendIdx["deny:"]=3;
  53908. $4=false.__eq("");
  53909. $ctx1.sendIdx["="]=4;
  53910. $self._deny_($4);
  53911. $ctx1.sendIdx["deny:"]=4;
  53912. $5=true.__eq(true);
  53913. $ctx1.sendIdx["="]=5;
  53914. $self._assert_($5);
  53915. $ctx1.sendIdx["assert:"]=1;
  53916. $6=false.__eq(true);
  53917. $ctx1.sendIdx["="]=6;
  53918. $self._deny_($6);
  53919. $ctx1.sendIdx["deny:"]=5;
  53920. $7=true.__eq(false);
  53921. $ctx1.sendIdx["="]=7;
  53922. $self._deny_($7);
  53923. $8=false.__eq(false);
  53924. $ctx1.sendIdx["="]=8;
  53925. $self._assert_($8);
  53926. $ctx1.sendIdx["assert:"]=2;
  53927. $10=true._yourself();
  53928. $ctx1.sendIdx["yourself"]=1;
  53929. $9=$recv($10).__eq(true);
  53930. $ctx1.sendIdx["="]=9;
  53931. $self._assert_($9);
  53932. $ctx1.sendIdx["assert:"]=3;
  53933. $12=true._yourself();
  53934. $ctx1.sendIdx["yourself"]=2;
  53935. $11=$recv($12).__eq(true._yourself());
  53936. $self._assert_($11);
  53937. return self;
  53938. }, function($ctx1) {$ctx1.fill(self,"testEquality",{})});
  53939. },
  53940. args: [],
  53941. 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)",
  53942. referencedClasses: [],
  53943. pragmas: [],
  53944. messageSends: ["deny:", "=", "assert:", "yourself"]
  53945. }),
  53946. $globals.BooleanTest);
  53947. $core.addMethod(
  53948. $core.method({
  53949. selector: "testIdentity",
  53950. protocol: "tests",
  53951. fn: function (){
  53952. var self=this,$self=this;
  53953. return $core.withContext(function($ctx1) {
  53954. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  53955. $1=(0).__eq_eq(false);
  53956. $ctx1.sendIdx["=="]=1;
  53957. $self._deny_($1);
  53958. $ctx1.sendIdx["deny:"]=1;
  53959. $2=false.__eq_eq((0));
  53960. $ctx1.sendIdx["=="]=2;
  53961. $self._deny_($2);
  53962. $ctx1.sendIdx["deny:"]=2;
  53963. $3="".__eq_eq(false);
  53964. $ctx1.sendIdx["=="]=3;
  53965. $self._deny_($3);
  53966. $ctx1.sendIdx["deny:"]=3;
  53967. $4=false.__eq_eq("");
  53968. $ctx1.sendIdx["=="]=4;
  53969. $self._deny_($4);
  53970. $ctx1.sendIdx["deny:"]=4;
  53971. $5=true.__eq_eq(true);
  53972. $ctx1.sendIdx["=="]=5;
  53973. $self._assert_($5);
  53974. $ctx1.sendIdx["assert:"]=1;
  53975. $6=false.__eq_eq(true);
  53976. $ctx1.sendIdx["=="]=6;
  53977. $self._deny_($6);
  53978. $ctx1.sendIdx["deny:"]=5;
  53979. $7=true.__eq_eq(false);
  53980. $ctx1.sendIdx["=="]=7;
  53981. $self._deny_($7);
  53982. $8=false.__eq_eq(false);
  53983. $ctx1.sendIdx["=="]=8;
  53984. $self._assert_($8);
  53985. $ctx1.sendIdx["assert:"]=2;
  53986. $10=true._yourself();
  53987. $ctx1.sendIdx["yourself"]=1;
  53988. $9=$recv($10).__eq_eq(true);
  53989. $ctx1.sendIdx["=="]=9;
  53990. $self._assert_($9);
  53991. $ctx1.sendIdx["assert:"]=3;
  53992. $12=true._yourself();
  53993. $ctx1.sendIdx["yourself"]=2;
  53994. $11=$recv($12).__eq_eq(true._yourself());
  53995. $self._assert_($11);
  53996. return self;
  53997. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{})});
  53998. },
  53999. args: [],
  54000. 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",
  54001. referencedClasses: [],
  54002. pragmas: [],
  54003. messageSends: ["deny:", "==", "assert:", "yourself"]
  54004. }),
  54005. $globals.BooleanTest);
  54006. $core.addMethod(
  54007. $core.method({
  54008. selector: "testIfTrueIfFalse",
  54009. protocol: "tests",
  54010. fn: function (){
  54011. var self=this,$self=this;
  54012. return $core.withContext(function($ctx1) {
  54013. var $1,$2,$3,$4,$5,$6,$7,$8;
  54014. if($core.assert(true)){
  54015. $1="alternative block";
  54016. }
  54017. $self._assert_equals_($1,"alternative block");
  54018. $ctx1.sendIdx["assert:equals:"]=1;
  54019. if(!$core.assert(true)){
  54020. $2="alternative block";
  54021. }
  54022. $self._assert_equals_($2,nil);
  54023. $ctx1.sendIdx["assert:equals:"]=2;
  54024. if($core.assert(false)){
  54025. $3="alternative block";
  54026. }
  54027. $self._assert_equals_($3,nil);
  54028. $ctx1.sendIdx["assert:equals:"]=3;
  54029. if(!$core.assert(false)){
  54030. $4="alternative block";
  54031. }
  54032. $self._assert_equals_($4,"alternative block");
  54033. $ctx1.sendIdx["assert:equals:"]=4;
  54034. if($core.assert(false)){
  54035. $5="alternative block";
  54036. } else {
  54037. $5="alternative block2";
  54038. }
  54039. $self._assert_equals_($5,"alternative block2");
  54040. $ctx1.sendIdx["assert:equals:"]=5;
  54041. if($core.assert(false)){
  54042. $6="alternative block2";
  54043. } else {
  54044. $6="alternative block";
  54045. }
  54046. $self._assert_equals_($6,"alternative block");
  54047. $ctx1.sendIdx["assert:equals:"]=6;
  54048. if($core.assert(true)){
  54049. $7="alternative block";
  54050. } else {
  54051. $7="alternative block2";
  54052. }
  54053. $self._assert_equals_($7,"alternative block");
  54054. $ctx1.sendIdx["assert:equals:"]=7;
  54055. if($core.assert(true)){
  54056. $8="alternative block2";
  54057. } else {
  54058. $8="alternative block";
  54059. }
  54060. $self._assert_equals_($8,"alternative block2");
  54061. return self;
  54062. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{})});
  54063. },
  54064. args: [],
  54065. 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'.",
  54066. referencedClasses: [],
  54067. pragmas: [],
  54068. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  54069. }),
  54070. $globals.BooleanTest);
  54071. $core.addMethod(
  54072. $core.method({
  54073. selector: "testIfTrueIfFalseWithBoxing",
  54074. protocol: "tests",
  54075. fn: function (){
  54076. var self=this,$self=this;
  54077. return $core.withContext(function($ctx1) {
  54078. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  54079. $2=true._yourself();
  54080. $ctx1.sendIdx["yourself"]=1;
  54081. if($core.assert($2)){
  54082. $1="alternative block";
  54083. }
  54084. $self._assert_equals_($1,"alternative block");
  54085. $ctx1.sendIdx["assert:equals:"]=1;
  54086. $4=true._yourself();
  54087. $ctx1.sendIdx["yourself"]=2;
  54088. if(!$core.assert($4)){
  54089. $3="alternative block";
  54090. }
  54091. $self._assert_equals_($3,nil);
  54092. $ctx1.sendIdx["assert:equals:"]=2;
  54093. $6=false._yourself();
  54094. $ctx1.sendIdx["yourself"]=3;
  54095. if($core.assert($6)){
  54096. $5="alternative block";
  54097. }
  54098. $self._assert_equals_($5,nil);
  54099. $ctx1.sendIdx["assert:equals:"]=3;
  54100. $8=false._yourself();
  54101. $ctx1.sendIdx["yourself"]=4;
  54102. if(!$core.assert($8)){
  54103. $7="alternative block";
  54104. }
  54105. $self._assert_equals_($7,"alternative block");
  54106. $ctx1.sendIdx["assert:equals:"]=4;
  54107. $10=false._yourself();
  54108. $ctx1.sendIdx["yourself"]=5;
  54109. if($core.assert($10)){
  54110. $9="alternative block";
  54111. } else {
  54112. $9="alternative block2";
  54113. }
  54114. $self._assert_equals_($9,"alternative block2");
  54115. $ctx1.sendIdx["assert:equals:"]=5;
  54116. $12=false._yourself();
  54117. $ctx1.sendIdx["yourself"]=6;
  54118. if($core.assert($12)){
  54119. $11="alternative block2";
  54120. } else {
  54121. $11="alternative block";
  54122. }
  54123. $self._assert_equals_($11,"alternative block");
  54124. $ctx1.sendIdx["assert:equals:"]=6;
  54125. $14=true._yourself();
  54126. $ctx1.sendIdx["yourself"]=7;
  54127. if($core.assert($14)){
  54128. $13="alternative block";
  54129. } else {
  54130. $13="alternative block2";
  54131. }
  54132. $self._assert_equals_($13,"alternative block");
  54133. $ctx1.sendIdx["assert:equals:"]=7;
  54134. $16=true._yourself();
  54135. if($core.assert($16)){
  54136. $15="alternative block2";
  54137. } else {
  54138. $15="alternative block";
  54139. }
  54140. $self._assert_equals_($15,"alternative block2");
  54141. return self;
  54142. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{})});
  54143. },
  54144. args: [],
  54145. 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'.",
  54146. referencedClasses: [],
  54147. pragmas: [],
  54148. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  54149. }),
  54150. $globals.BooleanTest);
  54151. $core.addMethod(
  54152. $core.method({
  54153. selector: "testLogic",
  54154. protocol: "tests",
  54155. fn: function (){
  54156. var self=this,$self=this;
  54157. return $core.withContext(function($ctx1) {
  54158. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11,$14,$15,$13,$17,$16,$19,$18,$21,$20;
  54159. $1=true.__and(true);
  54160. $ctx1.sendIdx["&"]=1;
  54161. $self._assert_($1);
  54162. $ctx1.sendIdx["assert:"]=1;
  54163. $2=true.__and(false);
  54164. $ctx1.sendIdx["&"]=2;
  54165. $self._deny_($2);
  54166. $ctx1.sendIdx["deny:"]=1;
  54167. $3=false.__and(true);
  54168. $ctx1.sendIdx["&"]=3;
  54169. $self._deny_($3);
  54170. $ctx1.sendIdx["deny:"]=2;
  54171. $4=false.__and(false);
  54172. $ctx1.sendIdx["&"]=4;
  54173. $self._deny_($4);
  54174. $ctx1.sendIdx["deny:"]=3;
  54175. $5=true.__or(true);
  54176. $ctx1.sendIdx["|"]=1;
  54177. $self._assert_($5);
  54178. $ctx1.sendIdx["assert:"]=2;
  54179. $6=true.__or(false);
  54180. $ctx1.sendIdx["|"]=2;
  54181. $self._assert_($6);
  54182. $ctx1.sendIdx["assert:"]=3;
  54183. $7=false.__or(true);
  54184. $ctx1.sendIdx["|"]=3;
  54185. $self._assert_($7);
  54186. $ctx1.sendIdx["assert:"]=4;
  54187. $8=false.__or(false);
  54188. $ctx1.sendIdx["|"]=4;
  54189. $self._deny_($8);
  54190. $ctx1.sendIdx["deny:"]=4;
  54191. $10=(1).__gt((0));
  54192. $ctx1.sendIdx[">"]=1;
  54193. $9=true.__and($10);
  54194. $ctx1.sendIdx["&"]=5;
  54195. $self._assert_($9);
  54196. $ctx1.sendIdx["assert:"]=5;
  54197. $12=(1).__gt((0));
  54198. $ctx1.sendIdx[">"]=2;
  54199. $11=$recv($12).__and(false);
  54200. $ctx1.sendIdx["&"]=6;
  54201. $self._deny_($11);
  54202. $ctx1.sendIdx["deny:"]=5;
  54203. $14=(1).__gt((0));
  54204. $ctx1.sendIdx[">"]=3;
  54205. $15=(1).__gt((2));
  54206. $ctx1.sendIdx[">"]=4;
  54207. $13=$recv($14).__and($15);
  54208. $self._deny_($13);
  54209. $17=(1).__gt((0));
  54210. $ctx1.sendIdx[">"]=5;
  54211. $16=false.__or($17);
  54212. $ctx1.sendIdx["|"]=5;
  54213. $self._assert_($16);
  54214. $ctx1.sendIdx["assert:"]=6;
  54215. $19=(1).__gt((0));
  54216. $ctx1.sendIdx[">"]=6;
  54217. $18=$recv($19).__or(false);
  54218. $ctx1.sendIdx["|"]=6;
  54219. $self._assert_($18);
  54220. $ctx1.sendIdx["assert:"]=7;
  54221. $21=(1).__gt((0));
  54222. $ctx1.sendIdx[">"]=7;
  54223. $20=$recv($21).__or((1).__gt((2)));
  54224. $self._assert_($20);
  54225. return self;
  54226. }, function($ctx1) {$ctx1.fill(self,"testLogic",{})});
  54227. },
  54228. args: [],
  54229. 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))",
  54230. referencedClasses: [],
  54231. pragmas: [],
  54232. messageSends: ["assert:", "&", "deny:", "|", ">"]
  54233. }),
  54234. $globals.BooleanTest);
  54235. $core.addMethod(
  54236. $core.method({
  54237. selector: "testLogicKeywords",
  54238. protocol: "tests",
  54239. fn: function (){
  54240. var self=this,$self=this;
  54241. return $core.withContext(function($ctx1) {
  54242. var $1,$2,$3,$4,$5,$6,$7,$8,$9,$11,$10,$13,$12,$14,$16,$15,$18,$17;
  54243. $1=true._and_((function(){
  54244. return true;
  54245. }));
  54246. $ctx1.sendIdx["and:"]=1;
  54247. $self._assert_($1);
  54248. $ctx1.sendIdx["assert:"]=1;
  54249. $2=true._and_((function(){
  54250. return false;
  54251. }));
  54252. $ctx1.sendIdx["and:"]=2;
  54253. $self._deny_($2);
  54254. $ctx1.sendIdx["deny:"]=1;
  54255. $3=false._and_((function(){
  54256. return true;
  54257. }));
  54258. $ctx1.sendIdx["and:"]=3;
  54259. $self._deny_($3);
  54260. $ctx1.sendIdx["deny:"]=2;
  54261. $4=false._and_((function(){
  54262. return false;
  54263. }));
  54264. $ctx1.sendIdx["and:"]=4;
  54265. $self._deny_($4);
  54266. $ctx1.sendIdx["deny:"]=3;
  54267. $5=true._or_((function(){
  54268. return true;
  54269. }));
  54270. $ctx1.sendIdx["or:"]=1;
  54271. $self._assert_($5);
  54272. $ctx1.sendIdx["assert:"]=2;
  54273. $6=true._or_((function(){
  54274. return false;
  54275. }));
  54276. $ctx1.sendIdx["or:"]=2;
  54277. $self._assert_($6);
  54278. $ctx1.sendIdx["assert:"]=3;
  54279. $7=false._or_((function(){
  54280. return true;
  54281. }));
  54282. $ctx1.sendIdx["or:"]=3;
  54283. $self._assert_($7);
  54284. $ctx1.sendIdx["assert:"]=4;
  54285. $8=false._or_((function(){
  54286. return false;
  54287. }));
  54288. $ctx1.sendIdx["or:"]=4;
  54289. $self._deny_($8);
  54290. $ctx1.sendIdx["deny:"]=4;
  54291. $9=true._and_((function(){
  54292. return $core.withContext(function($ctx2) {
  54293. return (1).__gt((0));
  54294. $ctx2.sendIdx[">"]=1;
  54295. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  54296. }));
  54297. $ctx1.sendIdx["and:"]=5;
  54298. $self._assert_($9);
  54299. $ctx1.sendIdx["assert:"]=5;
  54300. $11=(1).__gt((0));
  54301. $ctx1.sendIdx[">"]=2;
  54302. $10=$recv($11)._and_((function(){
  54303. return false;
  54304. }));
  54305. $ctx1.sendIdx["and:"]=6;
  54306. $self._deny_($10);
  54307. $ctx1.sendIdx["deny:"]=5;
  54308. $13=(1).__gt((0));
  54309. $ctx1.sendIdx[">"]=3;
  54310. $12=$recv($13)._and_((function(){
  54311. return $core.withContext(function($ctx2) {
  54312. return (1).__gt((2));
  54313. $ctx2.sendIdx[">"]=4;
  54314. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  54315. }));
  54316. $self._deny_($12);
  54317. $14=false._or_((function(){
  54318. return $core.withContext(function($ctx2) {
  54319. return (1).__gt((0));
  54320. $ctx2.sendIdx[">"]=5;
  54321. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  54322. }));
  54323. $ctx1.sendIdx["or:"]=5;
  54324. $self._assert_($14);
  54325. $ctx1.sendIdx["assert:"]=6;
  54326. $16=(1).__gt((0));
  54327. $ctx1.sendIdx[">"]=6;
  54328. $15=$recv($16)._or_((function(){
  54329. return false;
  54330. }));
  54331. $ctx1.sendIdx["or:"]=6;
  54332. $self._assert_($15);
  54333. $ctx1.sendIdx["assert:"]=7;
  54334. $18=(1).__gt((0));
  54335. $ctx1.sendIdx[">"]=7;
  54336. $17=$recv($18)._or_((function(){
  54337. return $core.withContext(function($ctx2) {
  54338. return (1).__gt((2));
  54339. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  54340. }));
  54341. $self._assert_($17);
  54342. return self;
  54343. }, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{})});
  54344. },
  54345. args: [],
  54346. 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 ])",
  54347. referencedClasses: [],
  54348. pragmas: [],
  54349. messageSends: ["assert:", "and:", "deny:", "or:", ">"]
  54350. }),
  54351. $globals.BooleanTest);
  54352. $core.addMethod(
  54353. $core.method({
  54354. selector: "testNonBooleanError",
  54355. protocol: "tests",
  54356. fn: function (){
  54357. var self=this,$self=this;
  54358. return $core.withContext(function($ctx1) {
  54359. $self._should_raise_((function(){
  54360. return $core.withContext(function($ctx2) {
  54361. if($core.assert("")){
  54362. } else {
  54363. }
  54364. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54365. }),$globals.NonBooleanReceiver);
  54366. return self;
  54367. }, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{})});
  54368. },
  54369. args: [],
  54370. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  54371. referencedClasses: ["NonBooleanReceiver"],
  54372. pragmas: [],
  54373. messageSends: ["should:raise:", "ifTrue:ifFalse:"]
  54374. }),
  54375. $globals.BooleanTest);
  54376. $core.addClass("ClassBuilderTest", $globals.TestCase, ["builder", "theClass"], "Kernel-Tests");
  54377. $core.addMethod(
  54378. $core.method({
  54379. selector: "setUp",
  54380. protocol: "running",
  54381. fn: function (){
  54382. var self=this,$self=this;
  54383. return $core.withContext(function($ctx1) {
  54384. $self.builder=$recv($globals.ClassBuilder)._new();
  54385. return self;
  54386. }, function($ctx1) {$ctx1.fill(self,"setUp",{})});
  54387. },
  54388. args: [],
  54389. source: "setUp\x0a\x09builder := ClassBuilder new",
  54390. referencedClasses: ["ClassBuilder"],
  54391. pragmas: [],
  54392. messageSends: ["new"]
  54393. }),
  54394. $globals.ClassBuilderTest);
  54395. $core.addMethod(
  54396. $core.method({
  54397. selector: "tearDown",
  54398. protocol: "running",
  54399. fn: function (){
  54400. var self=this,$self=this;
  54401. return $core.withContext(function($ctx1) {
  54402. var $1,$receiver;
  54403. $1=$self.theClass;
  54404. if(($receiver = $1) == null || $receiver.a$nil){
  54405. $1;
  54406. } else {
  54407. $recv($globals.Smalltalk)._removeClass_($self.theClass);
  54408. $self._deny_($recv($recv($recv($self.theClass)._package())._classes())._includes_($self.theClass));
  54409. $self._assert_equals_($recv($recv($globals.Smalltalk)._globals())._at_($recv($self.theClass)._name()),nil);
  54410. $self.theClass=nil;
  54411. $self.theClass;
  54412. }
  54413. return self;
  54414. }, function($ctx1) {$ctx1.fill(self,"tearDown",{})});
  54415. },
  54416. args: [],
  54417. source: "tearDown\x0a\x09theClass ifNotNil: [\x0a\x09\x09Smalltalk removeClass: theClass.\x0a\x09\x09self deny: (theClass package classes includes: theClass).\x0a\x09\x09self assert: (Smalltalk globals at: theClass name) equals: nil.\x0a\x09\x09theClass := nil ]",
  54418. referencedClasses: ["Smalltalk"],
  54419. pragmas: [],
  54420. messageSends: ["ifNotNil:", "removeClass:", "deny:", "includes:", "classes", "package", "assert:equals:", "at:", "globals", "name"]
  54421. }),
  54422. $globals.ClassBuilderTest);
  54423. $core.addMethod(
  54424. $core.method({
  54425. selector: "testAddTrait",
  54426. protocol: "tests",
  54427. fn: function (){
  54428. var self=this,$self=this;
  54429. return $core.withContext(function($ctx1) {
  54430. var $3,$2,$1,$4;
  54431. $self.theClass=$recv($self.builder)._addTraitNamed_package_("ObjectMock2","Kernel-Tests");
  54432. $self._assert_equals_($recv($self.theClass)._name(),"ObjectMock2");
  54433. $ctx1.sendIdx["assert:equals:"]=1;
  54434. $3=$recv($self.theClass)._package();
  54435. $ctx1.sendIdx["package"]=1;
  54436. $2=$recv($3)._classes();
  54437. $1=$recv($2)._occurrencesOf_($self.theClass);
  54438. $self._assert_equals_($1,(1));
  54439. $ctx1.sendIdx["assert:equals:"]=2;
  54440. $4=$recv($self.theClass)._package();
  54441. $ctx1.sendIdx["package"]=2;
  54442. $self._assert_equals_($4,$recv($globals.ObjectMock)._package());
  54443. return self;
  54444. }, function($ctx1) {$ctx1.fill(self,"testAddTrait",{})});
  54445. },
  54446. args: [],
  54447. 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",
  54448. referencedClasses: ["ObjectMock"],
  54449. pragmas: [],
  54450. messageSends: ["addTraitNamed:package:", "assert:equals:", "name", "occurrencesOf:", "classes", "package"]
  54451. }),
  54452. $globals.ClassBuilderTest);
  54453. $core.addMethod(
  54454. $core.method({
  54455. selector: "testClassCopy",
  54456. protocol: "tests",
  54457. fn: function (){
  54458. var self=this,$self=this;
  54459. return $core.withContext(function($ctx1) {
  54460. var $2,$1,$4,$3,$6,$7,$5,$9,$8;
  54461. $self.theClass=$recv($self.builder)._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  54462. $2=$recv($self.theClass)._superclass();
  54463. $ctx1.sendIdx["superclass"]=1;
  54464. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  54465. $ctx1.sendIdx["=="]=1;
  54466. $self._assert_($1);
  54467. $ctx1.sendIdx["assert:"]=1;
  54468. $4=$recv($self.theClass)._instanceVariableNames();
  54469. $ctx1.sendIdx["instanceVariableNames"]=1;
  54470. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  54471. $ctx1.sendIdx["=="]=2;
  54472. $self._assert_($3);
  54473. $ctx1.sendIdx["assert:"]=2;
  54474. $self._assert_equals_($recv($self.theClass)._name(),"ObjectMock2");
  54475. $ctx1.sendIdx["assert:equals:"]=1;
  54476. $6=$recv($self.theClass)._package();
  54477. $ctx1.sendIdx["package"]=1;
  54478. $7=$recv($globals.ObjectMock)._package();
  54479. $ctx1.sendIdx["package"]=2;
  54480. $5=$recv($6).__eq_eq($7);
  54481. $self._assert_($5);
  54482. $ctx1.sendIdx["assert:"]=3;
  54483. $self._assert_($recv($recv($recv($self.theClass)._package())._classes())._includes_($self.theClass));
  54484. $9=$recv($self.theClass)._methodDictionary();
  54485. $ctx1.sendIdx["methodDictionary"]=1;
  54486. $8=$recv($9)._keys();
  54487. $ctx1.sendIdx["keys"]=1;
  54488. $self._assert_equals_($8,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  54489. return self;
  54490. }, function($ctx1) {$ctx1.fill(self,"testClassCopy",{})});
  54491. },
  54492. args: [],
  54493. source: "testClassCopy\x0a\x09theClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09self assert: theClass superclass == ObjectMock superclass.\x0a\x09self assert: theClass instanceVariableNames == ObjectMock instanceVariableNames.\x0a\x09self assert: theClass name equals: 'ObjectMock2'.\x0a\x09self assert: theClass package == ObjectMock package.\x0a\x09self assert: (theClass package classes includes: theClass).\x0a\x09self assert: theClass methodDictionary keys equals: ObjectMock methodDictionary keys",
  54494. referencedClasses: ["ObjectMock"],
  54495. pragmas: [],
  54496. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "includes:", "classes", "keys", "methodDictionary"]
  54497. }),
  54498. $globals.ClassBuilderTest);
  54499. $core.addMethod(
  54500. $core.method({
  54501. selector: "testClassMigration",
  54502. protocol: "tests",
  54503. fn: function (){
  54504. var self=this,$self=this;
  54505. var instance,oldClass;
  54506. return $core.withContext(function($ctx1) {
  54507. var $2,$1,$3,$4,$5,$6,$8,$7,$10,$9;
  54508. oldClass=$recv($self.builder)._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  54509. $2=$recv($globals.Smalltalk)._globals();
  54510. $ctx1.sendIdx["globals"]=1;
  54511. $1=$recv($2)._at_("ObjectMock2");
  54512. $ctx1.sendIdx["at:"]=1;
  54513. instance=$recv($1)._new();
  54514. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_("ObjectMock2","","Kernel-Tests");
  54515. $3=$recv(oldClass).__eq_eq($globals.ObjectMock2);
  54516. $ctx1.sendIdx["=="]=1;
  54517. $self._deny_($3);
  54518. $ctx1.sendIdx["deny:"]=1;
  54519. $4=$recv($recv($globals.ObjectMock2)._superclass()).__eq_eq($globals.ObjectMock);
  54520. $ctx1.sendIdx["=="]=2;
  54521. $self._assert_($4);
  54522. $ctx1.sendIdx["assert:"]=1;
  54523. $self._assert_($recv($recv($globals.ObjectMock2)._instanceVariableNames())._isEmpty());
  54524. $ctx1.sendIdx["assert:"]=2;
  54525. $5=$recv($globals.ObjectMock2)._selectors();
  54526. $ctx1.sendIdx["selectors"]=1;
  54527. $self._assert_equals_($5,$recv(oldClass)._selectors());
  54528. $ctx1.sendIdx["assert:equals:"]=1;
  54529. $6=$recv($globals.ObjectMock2)._comment();
  54530. $ctx1.sendIdx["comment"]=1;
  54531. $self._assert_equals_($6,$recv(oldClass)._comment());
  54532. $ctx1.sendIdx["assert:equals:"]=2;
  54533. $8=$recv($globals.ObjectMock2)._package();
  54534. $ctx1.sendIdx["package"]=1;
  54535. $7=$recv($8)._name();
  54536. $ctx1.sendIdx["name"]=1;
  54537. $self._assert_equals_($7,"Kernel-Tests");
  54538. $self._assert_($recv($recv($recv($globals.ObjectMock2)._package())._classes())._includes_($globals.ObjectMock2));
  54539. $ctx1.sendIdx["assert:"]=3;
  54540. $10=$recv(instance)._class();
  54541. $ctx1.sendIdx["class"]=1;
  54542. $9=$recv($10).__eq_eq($globals.ObjectMock2);
  54543. $self._deny_($9);
  54544. $self._assert_($recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv(instance)._class())._name()))._isNil());
  54545. $recv($globals.Smalltalk)._removeClass_($globals.ObjectMock2);
  54546. return self;
  54547. }, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass})});
  54548. },
  54549. args: [],
  54550. source: "testClassMigration\x0a\x09| instance oldClass |\x0a\x09\x0a\x09oldClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09instance := (Smalltalk globals at: 'ObjectMock2') new.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: #ObjectMock2\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: oldClass == ObjectMock2.\x0a\x09\x0a\x09self assert: ObjectMock2 superclass == ObjectMock.\x0a\x09self assert: ObjectMock2 instanceVariableNames isEmpty.\x0a\x09self assert: ObjectMock2 selectors equals: oldClass selectors.\x0a\x09self assert: ObjectMock2 comment equals: oldClass comment.\x0a\x09self assert: ObjectMock2 package name equals: 'Kernel-Tests'.\x0a\x09self assert: (ObjectMock2 package classes includes: ObjectMock2).\x0a\x09\x0a\x09self deny: instance class == ObjectMock2.\x0a\x09\x22Commeting this out. Tests implementation detail.\x22\x0a\x09\x22self assert: instance class name equals: 'OldObjectMock2'.\x22\x0a\x09\x0a\x09self assert: (Smalltalk globals at: instance class name) isNil.\x0a\x09\x0a\x09Smalltalk removeClass: ObjectMock2",
  54551. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"],
  54552. pragmas: [],
  54553. messageSends: ["copyClass:named:", "new", "at:", "globals", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "includes:", "classes", "class", "isNil", "removeClass:"]
  54554. }),
  54555. $globals.ClassBuilderTest);
  54556. $core.addMethod(
  54557. $core.method({
  54558. selector: "testClassMigrationWithClassInstanceVariables",
  54559. protocol: "tests",
  54560. fn: function (){
  54561. var self=this,$self=this;
  54562. return $core.withContext(function($ctx1) {
  54563. var $1;
  54564. $recv($self.builder)._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  54565. $1=$recv($globals.ObjectMock2)._class();
  54566. $ctx1.sendIdx["class"]=1;
  54567. $recv($1)._instanceVariableNames_("foo bar");
  54568. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($recv($recv($recv($globals.Smalltalk)._globals())._at_("ObjectMock2"))._name(),"","Kernel-Tests");
  54569. $self._assert_equals_($recv($recv($globals.ObjectMock2)._class())._instanceVariableNames(),["foo", "bar"]);
  54570. $recv($globals.Smalltalk)._removeClass_($globals.ObjectMock2);
  54571. return self;
  54572. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{})});
  54573. },
  54574. args: [],
  54575. source: "testClassMigrationWithClassInstanceVariables\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 class instanceVariableNames: 'foo bar'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals at: 'ObjectMock2') name\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: ObjectMock2 class instanceVariableNames equals: #('foo' 'bar').\x0a\x09\x0a\x09Smalltalk removeClass: ObjectMock2",
  54576. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"],
  54577. pragmas: [],
  54578. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "name", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"]
  54579. }),
  54580. $globals.ClassBuilderTest);
  54581. $core.addMethod(
  54582. $core.method({
  54583. selector: "testClassMigrationWithSubclasses",
  54584. protocol: "tests",
  54585. fn: function (){
  54586. var self=this,$self=this;
  54587. return $core.withContext(function($ctx1) {
  54588. var $2,$1,$4,$3;
  54589. $recv($self.builder)._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  54590. $recv($globals.ObjectMock2)._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  54591. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  54592. $recv($globals.ObjectMock3)._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  54593. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  54594. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_("ObjectMock2","","Kernel-Tests");
  54595. $2=$recv($globals.ObjectMock)._subclasses();
  54596. $ctx1.sendIdx["subclasses"]=1;
  54597. $1=$recv($2)._includes_($globals.ObjectMock2);
  54598. $ctx1.sendIdx["includes:"]=1;
  54599. $self._assert_($1);
  54600. $ctx1.sendIdx["assert:"]=1;
  54601. $4=$recv($globals.ObjectMock2)._subclasses();
  54602. $ctx1.sendIdx["subclasses"]=2;
  54603. $3=$recv($4)._includes_($globals.ObjectMock3);
  54604. $ctx1.sendIdx["includes:"]=2;
  54605. $self._assert_($3);
  54606. $ctx1.sendIdx["assert:"]=2;
  54607. $self._assert_($recv($recv($globals.ObjectMock3)._subclasses())._includes_($globals.ObjectMock4));
  54608. $recv($recv($globals.ObjectMock)._allSubclasses())._reverseDo_((function(each){
  54609. return $core.withContext(function($ctx2) {
  54610. return $recv($globals.Smalltalk)._removeClass_(each);
  54611. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  54612. }));
  54613. return self;
  54614. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{})});
  54615. },
  54616. args: [],
  54617. source: "testClassMigrationWithSubclasses\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 subclass: 'ObjectMock3' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09ObjectMock3 subclass: 'ObjectMock4' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: 'ObjectMock2'\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: (ObjectMock subclasses includes: ObjectMock2).\x0a\x09self assert: (ObjectMock2 subclasses includes: ObjectMock3).\x0a\x09self assert: (ObjectMock3 subclasses includes: ObjectMock4).\x0a\x09\x0a\x09ObjectMock allSubclasses reverseDo: [ :each | Smalltalk removeClass: each ]",
  54618. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "ObjectMock4", "Smalltalk"],
  54619. pragmas: [],
  54620. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "assert:", "includes:", "subclasses", "reverseDo:", "allSubclasses", "removeClass:"]
  54621. }),
  54622. $globals.ClassBuilderTest);
  54623. $core.addMethod(
  54624. $core.method({
  54625. selector: "testSubclass",
  54626. protocol: "tests",
  54627. fn: function (){
  54628. var self=this,$self=this;
  54629. return $core.withContext(function($ctx1) {
  54630. var $3,$2,$1,$4;
  54631. $self.theClass=$recv($self.builder)._addSubclassOf_named_instanceVariableNames_package_($globals.ObjectMock,"ObjectMock2",["foo", "bar"],"Kernel-Tests");
  54632. $self._assert_equals_($recv($self.theClass)._superclass(),$globals.ObjectMock);
  54633. $ctx1.sendIdx["assert:equals:"]=1;
  54634. $self._assert_equals_($recv($self.theClass)._instanceVariableNames(),["foo", "bar"]);
  54635. $ctx1.sendIdx["assert:equals:"]=2;
  54636. $self._assert_equals_($recv($self.theClass)._name(),"ObjectMock2");
  54637. $ctx1.sendIdx["assert:equals:"]=3;
  54638. $3=$recv($self.theClass)._package();
  54639. $ctx1.sendIdx["package"]=1;
  54640. $2=$recv($3)._classes();
  54641. $1=$recv($2)._occurrencesOf_($self.theClass);
  54642. $self._assert_equals_($1,(1));
  54643. $ctx1.sendIdx["assert:equals:"]=4;
  54644. $4=$recv($self.theClass)._package();
  54645. $ctx1.sendIdx["package"]=2;
  54646. $self._assert_equals_($4,$recv($globals.ObjectMock)._package());
  54647. $ctx1.sendIdx["assert:equals:"]=5;
  54648. $self._assert_equals_($recv($recv($recv($self.theClass)._methodDictionary())._keys())._size(),(0));
  54649. return self;
  54650. }, function($ctx1) {$ctx1.fill(self,"testSubclass",{})});
  54651. },
  54652. args: [],
  54653. 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",
  54654. referencedClasses: ["ObjectMock"],
  54655. pragmas: [],
  54656. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "assert:equals:", "superclass", "instanceVariableNames", "name", "occurrencesOf:", "classes", "package", "size", "keys", "methodDictionary"]
  54657. }),
  54658. $globals.ClassBuilderTest);
  54659. $core.addClass("ClassTest", $globals.TestCase, ["builder", "theClass"], "Kernel-Tests");
  54660. $core.addMethod(
  54661. $core.method({
  54662. selector: "jsConstructor",
  54663. protocol: "running",
  54664. fn: function (){
  54665. var self=this,$self=this;
  54666. return $core.withContext(function($ctx1) {
  54667. function Foo(){}
  54668. Foo.prototype.valueOf = function () {return 4;};
  54669. return Foo;
  54670. ;
  54671. return self;
  54672. }, function($ctx1) {$ctx1.fill(self,"jsConstructor",{})});
  54673. },
  54674. args: [],
  54675. source: "jsConstructor\x0a\x09<inlineJS: '\x0a\x09\x09function Foo(){}\x0a\x09\x09Foo.prototype.valueOf = function () {return 4;};\x0a\x09\x09return Foo;\x0a\x09'>",
  54676. referencedClasses: [],
  54677. pragmas: [["inlineJS:", ["\x0a\x09\x09function Foo(){}\x0a\x09\x09Foo.prototype.valueOf = function () {return 4;};\x0a\x09\x09return Foo;\x0a\x09"]]],
  54678. messageSends: []
  54679. }),
  54680. $globals.ClassTest);
  54681. $core.addMethod(
  54682. $core.method({
  54683. selector: "setUp",
  54684. protocol: "running",
  54685. fn: function (){
  54686. var self=this,$self=this;
  54687. return $core.withContext(function($ctx1) {
  54688. $self.builder=$recv($globals.ClassBuilder)._new();
  54689. return self;
  54690. }, function($ctx1) {$ctx1.fill(self,"setUp",{})});
  54691. },
  54692. args: [],
  54693. source: "setUp\x0a\x09builder := ClassBuilder new",
  54694. referencedClasses: ["ClassBuilder"],
  54695. pragmas: [],
  54696. messageSends: ["new"]
  54697. }),
  54698. $globals.ClassTest);
  54699. $core.addMethod(
  54700. $core.method({
  54701. selector: "tearDown",
  54702. protocol: "running",
  54703. fn: function (){
  54704. var self=this,$self=this;
  54705. return $core.withContext(function($ctx1) {
  54706. var $1,$receiver;
  54707. $1=$self.theClass;
  54708. if(($receiver = $1) == null || $receiver.a$nil){
  54709. $1;
  54710. } else {
  54711. $recv($recv($self.theClass)._allSubclasses())._reverseDo_((function(each){
  54712. return $core.withContext(function($ctx2) {
  54713. return $recv($globals.Smalltalk)._removeClass_(each);
  54714. $ctx2.sendIdx["removeClass:"]=1;
  54715. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  54716. }));
  54717. $recv($globals.Smalltalk)._removeClass_($self.theClass);
  54718. $self.theClass=nil;
  54719. $self.theClass;
  54720. }
  54721. return self;
  54722. }, function($ctx1) {$ctx1.fill(self,"tearDown",{})});
  54723. },
  54724. args: [],
  54725. source: "tearDown\x0a\x09theClass ifNotNil: [\x0a\x09\x09theClass allSubclasses reverseDo: [ :each | Smalltalk removeClass: each ].\x0a\x09\x09Smalltalk removeClass: theClass.\x0a\x09\x09theClass := nil ]",
  54726. referencedClasses: ["Smalltalk"],
  54727. pragmas: [],
  54728. messageSends: ["ifNotNil:", "reverseDo:", "allSubclasses", "removeClass:"]
  54729. }),
  54730. $globals.ClassTest);
  54731. $core.addMethod(
  54732. $core.method({
  54733. selector: "testAllSubclasses",
  54734. protocol: "tests",
  54735. fn: function (){
  54736. var self=this,$self=this;
  54737. var subclasses,index;
  54738. return $core.withContext(function($ctx1) {
  54739. subclasses=$recv($globals.Object)._subclasses();
  54740. $ctx1.sendIdx["subclasses"]=1;
  54741. index=(1);
  54742. $recv((function(){
  54743. return $core.withContext(function($ctx2) {
  54744. return $recv(index).__gt($recv(subclasses)._size());
  54745. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54746. }))._whileFalse_((function(){
  54747. return $core.withContext(function($ctx2) {
  54748. $recv(subclasses)._addAll_($recv($recv(subclasses)._at_(index))._subclasses());
  54749. index=$recv(index).__plus((1));
  54750. return index;
  54751. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  54752. }));
  54753. $self._assert_equals_($recv($globals.Object)._allSubclasses(),subclasses);
  54754. return self;
  54755. }, function($ctx1) {$ctx1.fill(self,"testAllSubclasses",{subclasses:subclasses,index:index})});
  54756. },
  54757. args: [],
  54758. 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",
  54759. referencedClasses: ["Object"],
  54760. pragmas: [],
  54761. messageSends: ["subclasses", "whileFalse:", ">", "size", "addAll:", "at:", "+", "assert:equals:", "allSubclasses"]
  54762. }),
  54763. $globals.ClassTest);
  54764. $core.addMethod(
  54765. $core.method({
  54766. selector: "testMetaclassSubclasses",
  54767. protocol: "tests",
  54768. fn: function (){
  54769. var self=this,$self=this;
  54770. var subclasses;
  54771. return $core.withContext(function($ctx1) {
  54772. var $4,$3,$2,$1;
  54773. $4=$recv($globals.Object)._class();
  54774. $ctx1.sendIdx["class"]=1;
  54775. $3=$recv($4)._instanceClass();
  54776. $2=$recv($3)._subclasses();
  54777. $ctx1.sendIdx["subclasses"]=1;
  54778. $1=$recv($2)._select_((function(each){
  54779. return $core.withContext(function($ctx2) {
  54780. return $recv($recv(each)._isMetaclass())._not();
  54781. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  54782. }));
  54783. subclasses=$recv($1)._collect_((function(each){
  54784. return $core.withContext(function($ctx2) {
  54785. return $recv(each)._theMetaClass();
  54786. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  54787. }));
  54788. $self._assert_equals_($recv($recv($globals.Object)._class())._subclasses(),subclasses);
  54789. return self;
  54790. }, function($ctx1) {$ctx1.fill(self,"testMetaclassSubclasses",{subclasses:subclasses})});
  54791. },
  54792. args: [],
  54793. 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",
  54794. referencedClasses: ["Object"],
  54795. pragmas: [],
  54796. messageSends: ["collect:", "select:", "subclasses", "instanceClass", "class", "not", "isMetaclass", "theMetaClass", "assert:equals:"]
  54797. }),
  54798. $globals.ClassTest);
  54799. $core.addMethod(
  54800. $core.method({
  54801. selector: "testSetJavaScriptConstructor",
  54802. protocol: "tests",
  54803. fn: function (){
  54804. var self=this,$self=this;
  54805. var instance;
  54806. return $core.withContext(function($ctx1) {
  54807. var $2,$1,$4,$3,$6,$5,$8,$7;
  54808. $self.theClass=$recv($self.builder)._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  54809. $recv($self.theClass)._javascriptConstructor_($self._jsConstructor());
  54810. $2=$recv($self.theClass)._superclass();
  54811. $ctx1.sendIdx["superclass"]=1;
  54812. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  54813. $ctx1.sendIdx["=="]=1;
  54814. $self._assert_($1);
  54815. $ctx1.sendIdx["assert:"]=1;
  54816. $4=$recv($self.theClass)._instanceVariableNames();
  54817. $ctx1.sendIdx["instanceVariableNames"]=1;
  54818. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  54819. $ctx1.sendIdx["=="]=2;
  54820. $self._assert_($3);
  54821. $ctx1.sendIdx["assert:"]=2;
  54822. $self._assert_equals_($recv($self.theClass)._name(),"ObjectMock2");
  54823. $ctx1.sendIdx["assert:equals:"]=1;
  54824. $6=$recv($self.theClass)._package();
  54825. $ctx1.sendIdx["package"]=1;
  54826. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  54827. $ctx1.sendIdx["=="]=3;
  54828. $self._assert_($5);
  54829. $ctx1.sendIdx["assert:"]=3;
  54830. $8=$recv($self.theClass)._methodDictionary();
  54831. $ctx1.sendIdx["methodDictionary"]=1;
  54832. $7=$recv($8)._keys();
  54833. $ctx1.sendIdx["keys"]=1;
  54834. $self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  54835. $ctx1.sendIdx["assert:equals:"]=2;
  54836. instance=$recv($self.theClass)._new();
  54837. $self._assert_($recv($recv(instance)._class()).__eq_eq($self.theClass));
  54838. $self._assert_equals_($recv(instance)._value(),(4));
  54839. $ctx1.sendIdx["assert:equals:"]=3;
  54840. $self._shouldnt_raise_((function(){
  54841. return $core.withContext(function($ctx2) {
  54842. return $recv(instance)._foo_((9));
  54843. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54844. }),$globals.Error);
  54845. $self._assert_equals_($recv(instance)._foo(),(9));
  54846. return self;
  54847. }, function($ctx1) {$ctx1.fill(self,"testSetJavaScriptConstructor",{instance:instance})});
  54848. },
  54849. args: [],
  54850. source: "testSetJavaScriptConstructor\x0a\x09| instance |\x0a\x09theClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09theClass javascriptConstructor: self jsConstructor.\x0a\x09\x22part took from copy class test\x22\x0a\x09self assert: theClass superclass == ObjectMock superclass.\x0a\x09self assert: theClass instanceVariableNames == ObjectMock instanceVariableNames.\x0a\x09self assert: theClass name equals: 'ObjectMock2'.\x0a\x09self assert: theClass package == ObjectMock package.\x0a\x09self assert: theClass methodDictionary keys equals: ObjectMock methodDictionary keys.\x0a\x09\x22testing specific to late-coupled detached root class\x22\x0a\x09instance := theClass new.\x0a\x09self assert: instance class == theClass.\x0a\x09self assert: instance value equals: 4.\x0a\x09self shouldnt: [ instance foo: 9 ] raise: Error.\x0a\x09self assert: instance foo equals: 9",
  54851. referencedClasses: ["ObjectMock", "Error"],
  54852. pragmas: [],
  54853. messageSends: ["copyClass:named:", "javascriptConstructor:", "jsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  54854. }),
  54855. $globals.ClassTest);
  54856. $core.addMethod(
  54857. $core.method({
  54858. selector: "testSlotsFromInstanceVariablesString",
  54859. protocol: "tests",
  54860. fn: function (){
  54861. var self=this,$self=this;
  54862. return $core.withContext(function($ctx1) {
  54863. $self._assert_equals_(" hello world "._instanceVariablesStringAsSlotList(),["hello", "world"]);
  54864. return self;
  54865. }, function($ctx1) {$ctx1.fill(self,"testSlotsFromInstanceVariablesString",{})});
  54866. },
  54867. args: [],
  54868. source: "testSlotsFromInstanceVariablesString\x0a\x09self assert: ' hello world ' instanceVariablesStringAsSlotList equals: #('hello' 'world')",
  54869. referencedClasses: [],
  54870. pragmas: [],
  54871. messageSends: ["assert:equals:", "instanceVariablesStringAsSlotList"]
  54872. }),
  54873. $globals.ClassTest);
  54874. $core.addMethod(
  54875. $core.method({
  54876. selector: "testTrickySetJavaScriptConstructor",
  54877. protocol: "tests",
  54878. fn: function (){
  54879. var self=this,$self=this;
  54880. var instance;
  54881. return $core.withContext(function($ctx1) {
  54882. var $2,$1,$4,$3,$6,$5,$8,$7;
  54883. $self.theClass=$recv($self.builder)._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  54884. $recv($self.theClass)._javascriptConstructor_($self._trickyJsConstructor());
  54885. $2=$recv($self.theClass)._superclass();
  54886. $ctx1.sendIdx["superclass"]=1;
  54887. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  54888. $ctx1.sendIdx["=="]=1;
  54889. $self._assert_($1);
  54890. $ctx1.sendIdx["assert:"]=1;
  54891. $4=$recv($self.theClass)._instanceVariableNames();
  54892. $ctx1.sendIdx["instanceVariableNames"]=1;
  54893. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  54894. $ctx1.sendIdx["=="]=2;
  54895. $self._assert_($3);
  54896. $ctx1.sendIdx["assert:"]=2;
  54897. $self._assert_equals_($recv($self.theClass)._name(),"ObjectMock2");
  54898. $ctx1.sendIdx["assert:equals:"]=1;
  54899. $6=$recv($self.theClass)._package();
  54900. $ctx1.sendIdx["package"]=1;
  54901. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  54902. $ctx1.sendIdx["=="]=3;
  54903. $self._assert_($5);
  54904. $ctx1.sendIdx["assert:"]=3;
  54905. $8=$recv($self.theClass)._methodDictionary();
  54906. $ctx1.sendIdx["methodDictionary"]=1;
  54907. $7=$recv($8)._keys();
  54908. $ctx1.sendIdx["keys"]=1;
  54909. $self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  54910. $ctx1.sendIdx["assert:equals:"]=2;
  54911. instance=$recv($self.theClass)._new();
  54912. $self._assert_($recv($recv(instance)._class()).__eq_eq($self.theClass));
  54913. $self._assert_equals_($recv(instance)._value(),(4));
  54914. $ctx1.sendIdx["assert:equals:"]=3;
  54915. $self._shouldnt_raise_((function(){
  54916. return $core.withContext(function($ctx2) {
  54917. return $recv(instance)._foo_((9));
  54918. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54919. }),$globals.Error);
  54920. $self._assert_equals_($recv(instance)._foo(),(9));
  54921. return self;
  54922. }, function($ctx1) {$ctx1.fill(self,"testTrickySetJavaScriptConstructor",{instance:instance})});
  54923. },
  54924. args: [],
  54925. source: "testTrickySetJavaScriptConstructor\x0a\x09| instance |\x0a\x09theClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09theClass javascriptConstructor: self trickyJsConstructor.\x0a\x09\x22part took from copy class test\x22\x0a\x09self assert: theClass superclass == ObjectMock superclass.\x0a\x09self assert: theClass instanceVariableNames == ObjectMock instanceVariableNames.\x0a\x09self assert: theClass name equals: 'ObjectMock2'.\x0a\x09self assert: theClass package == ObjectMock package.\x0a\x09self assert: theClass methodDictionary keys equals: ObjectMock methodDictionary keys.\x0a\x09\x22testing specific to late-coupled detached root class\x22\x0a\x09instance := theClass new.\x0a\x09self assert: instance class == theClass.\x0a\x09self assert: instance value equals: 4.\x0a\x09self shouldnt: [ instance foo: 9 ] raise: Error.\x0a\x09self assert: instance foo equals: 9",
  54926. referencedClasses: ["ObjectMock", "Error"],
  54927. pragmas: [],
  54928. messageSends: ["copyClass:named:", "javascriptConstructor:", "trickyJsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  54929. }),
  54930. $globals.ClassTest);
  54931. $core.addMethod(
  54932. $core.method({
  54933. selector: "trickyJsConstructor",
  54934. protocol: "running",
  54935. fn: function (){
  54936. var self=this,$self=this;
  54937. return $core.withContext(function($ctx1) {
  54938. function Foo(){}
  54939. Foo.prototype.valueOf = function () {return 4;};
  54940. Foo.prototype._foo = function () {return "bar";};
  54941. return Foo;
  54942. ;
  54943. return self;
  54944. }, function($ctx1) {$ctx1.fill(self,"trickyJsConstructor",{})});
  54945. },
  54946. args: [],
  54947. 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'>",
  54948. referencedClasses: [],
  54949. 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"]]],
  54950. messageSends: []
  54951. }),
  54952. $globals.ClassTest);
  54953. $core.addClass("CollectionTest", $globals.TestCase, ["sampleBlock"], "Kernel-Tests");
  54954. $core.addMethod(
  54955. $core.method({
  54956. selector: "assertSameContents:as:",
  54957. protocol: "convenience",
  54958. fn: function (aCollection,anotherCollection){
  54959. var self=this,$self=this;
  54960. return $core.withContext(function($ctx1) {
  54961. var $2,$1,$4,$3;
  54962. $2=$recv(aCollection)._size();
  54963. $ctx1.sendIdx["size"]=1;
  54964. $1=$recv($2).__eq($recv(anotherCollection)._size());
  54965. $ctx1.sendIdx["="]=1;
  54966. $self._assert_($1);
  54967. $ctx1.sendIdx["assert:"]=1;
  54968. $recv(aCollection)._do_((function(each){
  54969. return $core.withContext(function($ctx2) {
  54970. $4=$recv(aCollection)._occurrencesOf_(each);
  54971. $ctx2.sendIdx["occurrencesOf:"]=1;
  54972. $3=$recv($4).__eq($recv(anotherCollection)._occurrencesOf_(each));
  54973. return $self._assert_($3);
  54974. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  54975. }));
  54976. return self;
  54977. }, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection})});
  54978. },
  54979. args: ["aCollection", "anotherCollection"],
  54980. 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)) ]",
  54981. referencedClasses: [],
  54982. pragmas: [],
  54983. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"]
  54984. }),
  54985. $globals.CollectionTest);
  54986. $core.addMethod(
  54987. $core.method({
  54988. selector: "collection",
  54989. protocol: "fixture",
  54990. fn: function (){
  54991. var self=this,$self=this;
  54992. return $core.withContext(function($ctx1) {
  54993. $self._subclassResponsibility();
  54994. return self;
  54995. }, function($ctx1) {$ctx1.fill(self,"collection",{})});
  54996. },
  54997. args: [],
  54998. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  54999. referencedClasses: [],
  55000. pragmas: [],
  55001. messageSends: ["subclassResponsibility"]
  55002. }),
  55003. $globals.CollectionTest);
  55004. $core.addMethod(
  55005. $core.method({
  55006. selector: "collectionClass",
  55007. protocol: "fixture",
  55008. fn: function (){
  55009. var self=this,$self=this;
  55010. return $core.withContext(function($ctx1) {
  55011. return $recv($self._class())._collectionClass();
  55012. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{})});
  55013. },
  55014. args: [],
  55015. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  55016. referencedClasses: [],
  55017. pragmas: [],
  55018. messageSends: ["collectionClass", "class"]
  55019. }),
  55020. $globals.CollectionTest);
  55021. $core.addMethod(
  55022. $core.method({
  55023. selector: "collectionOfPrintStrings",
  55024. protocol: "fixture",
  55025. fn: function (){
  55026. var self=this,$self=this;
  55027. return $core.withContext(function($ctx1) {
  55028. $self._subclassResponsibility();
  55029. return self;
  55030. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{})});
  55031. },
  55032. args: [],
  55033. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  55034. referencedClasses: [],
  55035. pragmas: [],
  55036. messageSends: ["subclassResponsibility"]
  55037. }),
  55038. $globals.CollectionTest);
  55039. $core.addMethod(
  55040. $core.method({
  55041. selector: "collectionSize",
  55042. protocol: "fixture",
  55043. fn: function (){
  55044. var self=this,$self=this;
  55045. return $core.withContext(function($ctx1) {
  55046. $self._subclassResponsibility();
  55047. return self;
  55048. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{})});
  55049. },
  55050. args: [],
  55051. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  55052. referencedClasses: [],
  55053. pragmas: [],
  55054. messageSends: ["subclassResponsibility"]
  55055. }),
  55056. $globals.CollectionTest);
  55057. $core.addMethod(
  55058. $core.method({
  55059. selector: "collectionWithDuplicates",
  55060. protocol: "fixture",
  55061. fn: function (){
  55062. var self=this,$self=this;
  55063. return $core.withContext(function($ctx1) {
  55064. $self._subclassResponsibility();
  55065. return self;
  55066. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{})});
  55067. },
  55068. args: [],
  55069. 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",
  55070. referencedClasses: [],
  55071. pragmas: [],
  55072. messageSends: ["subclassResponsibility"]
  55073. }),
  55074. $globals.CollectionTest);
  55075. $core.addMethod(
  55076. $core.method({
  55077. selector: "collectionWithNewValue",
  55078. protocol: "fixture",
  55079. fn: function (){
  55080. var self=this,$self=this;
  55081. return $core.withContext(function($ctx1) {
  55082. $self._subclassResponsibility();
  55083. return self;
  55084. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{})});
  55085. },
  55086. args: [],
  55087. 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",
  55088. referencedClasses: [],
  55089. pragmas: [],
  55090. messageSends: ["subclassResponsibility"]
  55091. }),
  55092. $globals.CollectionTest);
  55093. $core.addMethod(
  55094. $core.method({
  55095. selector: "initialize",
  55096. protocol: "initialization",
  55097. fn: function (){
  55098. var self=this,$self=this;
  55099. return $core.withContext(function($ctx1) {
  55100. (
  55101. $ctx1.supercall = true,
  55102. ($globals.CollectionTest.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  55103. $ctx1.supercall = false;
  55104. $self.sampleBlock=(function(){
  55105. });
  55106. return self;
  55107. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  55108. },
  55109. args: [],
  55110. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09sampleBlock := []",
  55111. referencedClasses: [],
  55112. pragmas: [],
  55113. messageSends: ["initialize"]
  55114. }),
  55115. $globals.CollectionTest);
  55116. $core.addMethod(
  55117. $core.method({
  55118. selector: "sampleNewValue",
  55119. protocol: "fixture",
  55120. fn: function (){
  55121. var self=this,$self=this;
  55122. return "N";
  55123. },
  55124. args: [],
  55125. 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'",
  55126. referencedClasses: [],
  55127. pragmas: [],
  55128. messageSends: []
  55129. }),
  55130. $globals.CollectionTest);
  55131. $core.addMethod(
  55132. $core.method({
  55133. selector: "sampleNewValueAsCollection",
  55134. protocol: "fixture",
  55135. fn: function (){
  55136. var self=this,$self=this;
  55137. return $core.withContext(function($ctx1) {
  55138. return $recv($self._collectionClass())._with_($self._sampleNewValue());
  55139. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{})});
  55140. },
  55141. args: [],
  55142. 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",
  55143. referencedClasses: [],
  55144. pragmas: [],
  55145. messageSends: ["with:", "collectionClass", "sampleNewValue"]
  55146. }),
  55147. $globals.CollectionTest);
  55148. $core.addMethod(
  55149. $core.method({
  55150. selector: "testAddAll",
  55151. protocol: "tests",
  55152. fn: function (){
  55153. var self=this,$self=this;
  55154. return $core.withContext(function($ctx1) {
  55155. var $2,$4,$3,$5,$1,$6,$9,$8,$10,$11,$7,$12,$15,$14,$17,$16,$18,$13,$20,$21,$22,$19,$23,$25,$24;
  55156. $2=$self._collection();
  55157. $ctx1.sendIdx["collection"]=1;
  55158. $4=$self._collectionClass();
  55159. $ctx1.sendIdx["collectionClass"]=1;
  55160. $3=$recv($4)._new();
  55161. $ctx1.sendIdx["new"]=1;
  55162. $recv($2)._addAll_($3);
  55163. $ctx1.sendIdx["addAll:"]=1;
  55164. $5=$recv($2)._yourself();
  55165. $ctx1.sendIdx["yourself"]=1;
  55166. $1=$5;
  55167. $6=$self._collection();
  55168. $ctx1.sendIdx["collection"]=2;
  55169. $self._assert_equals_($1,$6);
  55170. $ctx1.sendIdx["assert:equals:"]=1;
  55171. $9=$self._collectionClass();
  55172. $ctx1.sendIdx["collectionClass"]=2;
  55173. $8=$recv($9)._new();
  55174. $ctx1.sendIdx["new"]=2;
  55175. $10=$self._collection();
  55176. $ctx1.sendIdx["collection"]=3;
  55177. $recv($8)._addAll_($10);
  55178. $ctx1.sendIdx["addAll:"]=2;
  55179. $11=$recv($8)._yourself();
  55180. $ctx1.sendIdx["yourself"]=2;
  55181. $7=$11;
  55182. $12=$self._collection();
  55183. $ctx1.sendIdx["collection"]=4;
  55184. $self._assert_equals_($7,$12);
  55185. $ctx1.sendIdx["assert:equals:"]=2;
  55186. $15=$self._collectionClass();
  55187. $ctx1.sendIdx["collectionClass"]=3;
  55188. $14=$recv($15)._new();
  55189. $ctx1.sendIdx["new"]=3;
  55190. $17=$self._collectionClass();
  55191. $ctx1.sendIdx["collectionClass"]=4;
  55192. $16=$recv($17)._new();
  55193. $ctx1.sendIdx["new"]=4;
  55194. $recv($14)._addAll_($16);
  55195. $ctx1.sendIdx["addAll:"]=3;
  55196. $18=$recv($14)._yourself();
  55197. $ctx1.sendIdx["yourself"]=3;
  55198. $13=$18;
  55199. $self._assert_equals_($13,$recv($self._collectionClass())._new());
  55200. $ctx1.sendIdx["assert:equals:"]=3;
  55201. $20=$self._collection();
  55202. $ctx1.sendIdx["collection"]=5;
  55203. $21=$self._sampleNewValueAsCollection();
  55204. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  55205. $recv($20)._addAll_($21);
  55206. $ctx1.sendIdx["addAll:"]=4;
  55207. $22=$recv($20)._yourself();
  55208. $ctx1.sendIdx["yourself"]=4;
  55209. $19=$22;
  55210. $23=$self._collectionWithNewValue();
  55211. $ctx1.sendIdx["collectionWithNewValue"]=1;
  55212. $self._assert_equals_($19,$23);
  55213. $25=$self._sampleNewValueAsCollection();
  55214. $recv($25)._addAll_($self._collection());
  55215. $24=$recv($25)._yourself();
  55216. $self._assertSameContents_as_($24,$self._collectionWithNewValue());
  55217. return self;
  55218. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{})});
  55219. },
  55220. args: [],
  55221. 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",
  55222. referencedClasses: [],
  55223. pragmas: [],
  55224. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  55225. }),
  55226. $globals.CollectionTest);
  55227. $core.addMethod(
  55228. $core.method({
  55229. selector: "testAllSatisfy",
  55230. protocol: "tests",
  55231. fn: function (){
  55232. var self=this,$self=this;
  55233. var collection,anyOne;
  55234. return $core.withContext(function($ctx1) {
  55235. var $1;
  55236. collection=$self._collection();
  55237. anyOne=$recv(collection)._anyOne();
  55238. $1=$recv(collection)._allSatisfy_((function(each){
  55239. return $core.withContext(function($ctx2) {
  55240. return $recv(collection)._includes_(each);
  55241. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  55242. }));
  55243. $ctx1.sendIdx["allSatisfy:"]=1;
  55244. $self._assert_($1);
  55245. $self._deny_($recv(collection)._allSatisfy_((function(each){
  55246. return $core.withContext(function($ctx2) {
  55247. return $recv(each).__tild_eq(anyOne);
  55248. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  55249. })));
  55250. return self;
  55251. }, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne})});
  55252. },
  55253. args: [],
  55254. 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 ])",
  55255. referencedClasses: [],
  55256. pragmas: [],
  55257. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="]
  55258. }),
  55259. $globals.CollectionTest);
  55260. $core.addMethod(
  55261. $core.method({
  55262. selector: "testAnyOne",
  55263. protocol: "tests",
  55264. fn: function (){
  55265. var self=this,$self=this;
  55266. return $core.withContext(function($ctx1) {
  55267. var $2,$1;
  55268. $self._should_raise_((function(){
  55269. return $core.withContext(function($ctx2) {
  55270. return $recv($recv($self._collectionClass())._new())._anyOne();
  55271. $ctx2.sendIdx["anyOne"]=1;
  55272. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55273. }),$globals.Error);
  55274. $2=$self._collection();
  55275. $ctx1.sendIdx["collection"]=1;
  55276. $1=$recv($2)._includes_($recv($self._collection())._anyOne());
  55277. $self._assert_($1);
  55278. return self;
  55279. }, function($ctx1) {$ctx1.fill(self,"testAnyOne",{})});
  55280. },
  55281. args: [],
  55282. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  55283. referencedClasses: ["Error"],
  55284. pragmas: [],
  55285. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"]
  55286. }),
  55287. $globals.CollectionTest);
  55288. $core.addMethod(
  55289. $core.method({
  55290. selector: "testAnySatisfy",
  55291. protocol: "tests",
  55292. fn: function (){
  55293. var self=this,$self=this;
  55294. var anyOne;
  55295. return $core.withContext(function($ctx1) {
  55296. var $1,$3,$2;
  55297. $1=$self._collection();
  55298. $ctx1.sendIdx["collection"]=1;
  55299. anyOne=$recv($1)._anyOne();
  55300. $3=$self._collection();
  55301. $ctx1.sendIdx["collection"]=2;
  55302. $2=$recv($3)._anySatisfy_((function(each){
  55303. return $core.withContext(function($ctx2) {
  55304. return $recv(each).__eq(anyOne);
  55305. $ctx2.sendIdx["="]=1;
  55306. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  55307. }));
  55308. $ctx1.sendIdx["anySatisfy:"]=1;
  55309. $self._assert_($2);
  55310. $self._deny_($recv($self._collection())._anySatisfy_((function(each){
  55311. return $core.withContext(function($ctx2) {
  55312. return $recv(each).__eq($recv($globals.Object)._new());
  55313. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  55314. })));
  55315. return self;
  55316. }, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne})});
  55317. },
  55318. args: [],
  55319. 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 ])",
  55320. referencedClasses: ["Object"],
  55321. pragmas: [],
  55322. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"]
  55323. }),
  55324. $globals.CollectionTest);
  55325. $core.addMethod(
  55326. $core.method({
  55327. selector: "testAsArray",
  55328. protocol: "tests",
  55329. fn: function (){
  55330. var self=this,$self=this;
  55331. return $core.withContext(function($ctx1) {
  55332. var $1;
  55333. $1=$self._collection();
  55334. $ctx1.sendIdx["collection"]=1;
  55335. $self._assertSameContents_as_($1,$recv($self._collection())._asArray());
  55336. return self;
  55337. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{})});
  55338. },
  55339. args: [],
  55340. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  55341. referencedClasses: [],
  55342. pragmas: [],
  55343. messageSends: ["assertSameContents:as:", "collection", "asArray"]
  55344. }),
  55345. $globals.CollectionTest);
  55346. $core.addMethod(
  55347. $core.method({
  55348. selector: "testAsOrderedCollection",
  55349. protocol: "tests",
  55350. fn: function (){
  55351. var self=this,$self=this;
  55352. return $core.withContext(function($ctx1) {
  55353. var $1;
  55354. $1=$self._collection();
  55355. $ctx1.sendIdx["collection"]=1;
  55356. $self._assertSameContents_as_($1,$recv($self._collection())._asOrderedCollection());
  55357. return self;
  55358. }, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{})});
  55359. },
  55360. args: [],
  55361. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  55362. referencedClasses: [],
  55363. pragmas: [],
  55364. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"]
  55365. }),
  55366. $globals.CollectionTest);
  55367. $core.addMethod(
  55368. $core.method({
  55369. selector: "testAsSet",
  55370. protocol: "tests",
  55371. fn: function (){
  55372. var self=this,$self=this;
  55373. var c,set;
  55374. return $core.withContext(function($ctx1) {
  55375. c=$self._collectionWithDuplicates();
  55376. set=$recv(c)._asSet();
  55377. $self._assert_equals_($recv(set)._size(),(6));
  55378. $recv(c)._do_((function(each){
  55379. return $core.withContext(function($ctx2) {
  55380. return $self._assert_($recv(set)._includes_(each));
  55381. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  55382. }));
  55383. return self;
  55384. }, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set})});
  55385. },
  55386. args: [],
  55387. 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) ]",
  55388. referencedClasses: [],
  55389. pragmas: [],
  55390. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"]
  55391. }),
  55392. $globals.CollectionTest);
  55393. $core.addMethod(
  55394. $core.method({
  55395. selector: "testCollect",
  55396. protocol: "tests",
  55397. fn: function (){
  55398. var self=this,$self=this;
  55399. return $core.withContext(function($ctx1) {
  55400. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  55401. $2=$self._collection();
  55402. $ctx1.sendIdx["collection"]=1;
  55403. $1=$recv($2)._collect_((function(each){
  55404. return each;
  55405. }));
  55406. $ctx1.sendIdx["collect:"]=1;
  55407. $3=$self._collection();
  55408. $ctx1.sendIdx["collection"]=2;
  55409. $self._assert_equals_($1,$3);
  55410. $ctx1.sendIdx["assert:equals:"]=1;
  55411. $5=$self._collectionWithNewValue();
  55412. $ctx1.sendIdx["collectionWithNewValue"]=1;
  55413. $4=$recv($5)._collect_((function(each){
  55414. return each;
  55415. }));
  55416. $ctx1.sendIdx["collect:"]=2;
  55417. $self._assert_equals_($4,$self._collectionWithNewValue());
  55418. $ctx1.sendIdx["assert:equals:"]=2;
  55419. $8=$self._collectionClass();
  55420. $ctx1.sendIdx["collectionClass"]=1;
  55421. $7=$recv($8)._new();
  55422. $ctx1.sendIdx["new"]=1;
  55423. $6=$recv($7)._collect_((function(each){
  55424. return $core.withContext(function($ctx2) {
  55425. return $recv(each)._printString();
  55426. $ctx2.sendIdx["printString"]=1;
  55427. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  55428. }));
  55429. $ctx1.sendIdx["collect:"]=3;
  55430. $self._assert_equals_($6,$recv($self._collectionClass())._new());
  55431. $ctx1.sendIdx["assert:equals:"]=3;
  55432. $11=$self._collection();
  55433. $ctx1.sendIdx["collection"]=3;
  55434. $10=$recv($11)._collect_((function(){
  55435. return $core.withContext(function($ctx2) {
  55436. return $self._sampleNewValue();
  55437. $ctx2.sendIdx["sampleNewValue"]=1;
  55438. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  55439. }));
  55440. $ctx1.sendIdx["collect:"]=4;
  55441. $9=$recv($10)._detect_((function(){
  55442. return true;
  55443. }));
  55444. $self._assert_equals_($9,$self._sampleNewValue());
  55445. $ctx1.sendIdx["assert:equals:"]=4;
  55446. $self._assert_equals_($recv($self._collection())._collect_((function(each){
  55447. return $core.withContext(function($ctx2) {
  55448. return $recv(each)._printString();
  55449. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  55450. })),$self._collectionOfPrintStrings());
  55451. return self;
  55452. }, function($ctx1) {$ctx1.fill(self,"testCollect",{})});
  55453. },
  55454. args: [],
  55455. 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",
  55456. referencedClasses: [],
  55457. pragmas: [],
  55458. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"]
  55459. }),
  55460. $globals.CollectionTest);
  55461. $core.addMethod(
  55462. $core.method({
  55463. selector: "testComma",
  55464. protocol: "tests",
  55465. fn: function (){
  55466. var self=this,$self=this;
  55467. return $core.withContext(function($ctx1) {
  55468. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  55469. $2=$self._collection();
  55470. $ctx1.sendIdx["collection"]=1;
  55471. $4=$self._collectionClass();
  55472. $ctx1.sendIdx["collectionClass"]=1;
  55473. $3=$recv($4)._new();
  55474. $ctx1.sendIdx["new"]=1;
  55475. $1=$recv($2).__comma($3);
  55476. $ctx1.sendIdx[","]=1;
  55477. $5=$self._collection();
  55478. $ctx1.sendIdx["collection"]=2;
  55479. $self._assert_equals_($1,$5);
  55480. $ctx1.sendIdx["assert:equals:"]=1;
  55481. $8=$self._collectionClass();
  55482. $ctx1.sendIdx["collectionClass"]=2;
  55483. $7=$recv($8)._new();
  55484. $ctx1.sendIdx["new"]=2;
  55485. $9=$self._collection();
  55486. $ctx1.sendIdx["collection"]=3;
  55487. $6=$recv($7).__comma($9);
  55488. $ctx1.sendIdx[","]=2;
  55489. $10=$self._collection();
  55490. $ctx1.sendIdx["collection"]=4;
  55491. $self._assert_equals_($6,$10);
  55492. $ctx1.sendIdx["assert:equals:"]=2;
  55493. $13=$self._collectionClass();
  55494. $ctx1.sendIdx["collectionClass"]=3;
  55495. $12=$recv($13)._new();
  55496. $ctx1.sendIdx["new"]=3;
  55497. $15=$self._collectionClass();
  55498. $ctx1.sendIdx["collectionClass"]=4;
  55499. $14=$recv($15)._new();
  55500. $ctx1.sendIdx["new"]=4;
  55501. $11=$recv($12).__comma($14);
  55502. $ctx1.sendIdx[","]=3;
  55503. $self._assert_equals_($11,$recv($self._collectionClass())._new());
  55504. $ctx1.sendIdx["assert:equals:"]=3;
  55505. $17=$self._collection();
  55506. $ctx1.sendIdx["collection"]=5;
  55507. $18=$self._sampleNewValueAsCollection();
  55508. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  55509. $16=$recv($17).__comma($18);
  55510. $ctx1.sendIdx[","]=4;
  55511. $19=$self._collectionWithNewValue();
  55512. $ctx1.sendIdx["collectionWithNewValue"]=1;
  55513. $self._assert_equals_($16,$19);
  55514. $self._assertSameContents_as_($recv($self._sampleNewValueAsCollection()).__comma($self._collection()),$self._collectionWithNewValue());
  55515. return self;
  55516. }, function($ctx1) {$ctx1.fill(self,"testComma",{})});
  55517. },
  55518. args: [],
  55519. 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",
  55520. referencedClasses: [],
  55521. pragmas: [],
  55522. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  55523. }),
  55524. $globals.CollectionTest);
  55525. $core.addMethod(
  55526. $core.method({
  55527. selector: "testCopy",
  55528. protocol: "tests",
  55529. fn: function (){
  55530. var self=this,$self=this;
  55531. return $core.withContext(function($ctx1) {
  55532. var $3,$2,$1,$5,$4,$7,$6,$8,$10,$9,$11,$15,$14,$13,$16,$12,$19,$18,$17;
  55533. $3=$self._collectionClass();
  55534. $ctx1.sendIdx["collectionClass"]=1;
  55535. $2=$recv($3)._new();
  55536. $ctx1.sendIdx["new"]=1;
  55537. $1=$recv($2)._copy();
  55538. $ctx1.sendIdx["copy"]=1;
  55539. $5=$self._collectionClass();
  55540. $ctx1.sendIdx["collectionClass"]=2;
  55541. $4=$recv($5)._new();
  55542. $ctx1.sendIdx["new"]=2;
  55543. $self._assert_equals_($1,$4);
  55544. $ctx1.sendIdx["assert:equals:"]=1;
  55545. $7=$self._collection();
  55546. $ctx1.sendIdx["collection"]=1;
  55547. $6=$recv($7)._copy();
  55548. $ctx1.sendIdx["copy"]=2;
  55549. $8=$self._collection();
  55550. $ctx1.sendIdx["collection"]=2;
  55551. $self._assert_equals_($6,$8);
  55552. $ctx1.sendIdx["assert:equals:"]=2;
  55553. $10=$self._collectionWithNewValue();
  55554. $ctx1.sendIdx["collectionWithNewValue"]=1;
  55555. $9=$recv($10)._copy();
  55556. $ctx1.sendIdx["copy"]=3;
  55557. $11=$self._collectionWithNewValue();
  55558. $ctx1.sendIdx["collectionWithNewValue"]=2;
  55559. $self._assert_equals_($9,$11);
  55560. $15=$self._collectionClass();
  55561. $ctx1.sendIdx["collectionClass"]=3;
  55562. $14=$recv($15)._new();
  55563. $ctx1.sendIdx["new"]=3;
  55564. $13=$recv($14)._copy();
  55565. $ctx1.sendIdx["copy"]=4;
  55566. $16=$self._collection();
  55567. $ctx1.sendIdx["collection"]=3;
  55568. $12=$recv($13).__eq($16);
  55569. $ctx1.sendIdx["="]=1;
  55570. $self._deny_($12);
  55571. $ctx1.sendIdx["deny:"]=1;
  55572. $19=$self._collection();
  55573. $ctx1.sendIdx["collection"]=4;
  55574. $18=$recv($19)._copy();
  55575. $ctx1.sendIdx["copy"]=5;
  55576. $17=$recv($18).__eq($recv($self._collectionClass())._new());
  55577. $ctx1.sendIdx["="]=2;
  55578. $self._deny_($17);
  55579. $ctx1.sendIdx["deny:"]=2;
  55580. $self._deny_($recv($recv($self._collection())._copy()).__eq($self._collectionWithNewValue()));
  55581. return self;
  55582. }, function($ctx1) {$ctx1.fill(self,"testCopy",{})});
  55583. },
  55584. args: [],
  55585. 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",
  55586. referencedClasses: [],
  55587. pragmas: [],
  55588. messageSends: ["assert:equals:", "copy", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  55589. }),
  55590. $globals.CollectionTest);
  55591. $core.addMethod(
  55592. $core.method({
  55593. selector: "testCopySeparates",
  55594. protocol: "tests",
  55595. fn: function (){
  55596. var self=this,$self=this;
  55597. var original,copy;
  55598. return $core.withContext(function($ctx1) {
  55599. original=$self._collection();
  55600. $ctx1.sendIdx["collection"]=1;
  55601. copy=$recv(original)._copy();
  55602. $recv(copy)._addAll_($self._sampleNewValueAsCollection());
  55603. $self._assert_($recv(original).__eq($self._collection()));
  55604. return self;
  55605. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{original:original,copy:copy})});
  55606. },
  55607. args: [],
  55608. 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",
  55609. referencedClasses: [],
  55610. pragmas: [],
  55611. messageSends: ["collection", "copy", "addAll:", "sampleNewValueAsCollection", "assert:", "="]
  55612. }),
  55613. $globals.CollectionTest);
  55614. $core.addMethod(
  55615. $core.method({
  55616. selector: "testDetect",
  55617. protocol: "tests",
  55618. fn: function (){
  55619. var self=this,$self=this;
  55620. return $core.withContext(function($ctx1) {
  55621. var $1,$2,$3,$4,$6,$5,$7;
  55622. $self._shouldnt_raise_((function(){
  55623. return $core.withContext(function($ctx2) {
  55624. $1=$self._collection();
  55625. $ctx2.sendIdx["collection"]=1;
  55626. return $recv($1)._detect_((function(){
  55627. return true;
  55628. }));
  55629. $ctx2.sendIdx["detect:"]=1;
  55630. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55631. }),$globals.Error);
  55632. $self._should_raise_((function(){
  55633. return $core.withContext(function($ctx2) {
  55634. $2=$self._collection();
  55635. $ctx2.sendIdx["collection"]=2;
  55636. return $recv($2)._detect_((function(){
  55637. return false;
  55638. }));
  55639. $ctx2.sendIdx["detect:"]=2;
  55640. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  55641. }),$globals.Error);
  55642. $ctx1.sendIdx["should:raise:"]=1;
  55643. $3=$recv($self._sampleNewValueAsCollection())._detect_((function(){
  55644. return true;
  55645. }));
  55646. $ctx1.sendIdx["detect:"]=3;
  55647. $4=$self._sampleNewValue();
  55648. $ctx1.sendIdx["sampleNewValue"]=1;
  55649. $self._assert_equals_($3,$4);
  55650. $ctx1.sendIdx["assert:equals:"]=1;
  55651. $5=$recv($self._collectionWithNewValue())._detect_((function(each){
  55652. return $core.withContext(function($ctx2) {
  55653. $6=$self._sampleNewValue();
  55654. $ctx2.sendIdx["sampleNewValue"]=2;
  55655. return $recv(each).__eq($6);
  55656. $ctx2.sendIdx["="]=1;
  55657. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  55658. }));
  55659. $ctx1.sendIdx["detect:"]=4;
  55660. $7=$self._sampleNewValue();
  55661. $ctx1.sendIdx["sampleNewValue"]=3;
  55662. $self._assert_equals_($5,$7);
  55663. $self._should_raise_((function(){
  55664. return $core.withContext(function($ctx2) {
  55665. return $recv($self._collection())._detect_((function(each){
  55666. return $core.withContext(function($ctx3) {
  55667. return $recv(each).__eq($self._sampleNewValue());
  55668. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)});
  55669. }));
  55670. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  55671. }),$globals.Error);
  55672. return self;
  55673. }, function($ctx1) {$ctx1.fill(self,"testDetect",{})});
  55674. },
  55675. args: [],
  55676. 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",
  55677. referencedClasses: ["Error"],
  55678. pragmas: [],
  55679. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  55680. }),
  55681. $globals.CollectionTest);
  55682. $core.addMethod(
  55683. $core.method({
  55684. selector: "testDetectIfNone",
  55685. protocol: "tests",
  55686. fn: function (){
  55687. var self=this,$self=this;
  55688. var sentinel;
  55689. return $core.withContext(function($ctx1) {
  55690. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  55691. sentinel=$recv($globals.Object)._new();
  55692. $3=$self._collection();
  55693. $ctx1.sendIdx["collection"]=1;
  55694. $2=$recv($3)._detect_ifNone_((function(){
  55695. return true;
  55696. }),(function(){
  55697. return sentinel;
  55698. }));
  55699. $ctx1.sendIdx["detect:ifNone:"]=1;
  55700. $1=$recv($2).__tild_eq(sentinel);
  55701. $self._assert_($1);
  55702. $5=$self._collection();
  55703. $ctx1.sendIdx["collection"]=2;
  55704. $4=$recv($5)._detect_ifNone_((function(){
  55705. return false;
  55706. }),(function(){
  55707. return sentinel;
  55708. }));
  55709. $ctx1.sendIdx["detect:ifNone:"]=2;
  55710. $self._assert_equals_($4,sentinel);
  55711. $ctx1.sendIdx["assert:equals:"]=1;
  55712. $6=$recv($self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  55713. return true;
  55714. }),(function(){
  55715. return sentinel;
  55716. }));
  55717. $ctx1.sendIdx["detect:ifNone:"]=3;
  55718. $7=$self._sampleNewValue();
  55719. $ctx1.sendIdx["sampleNewValue"]=1;
  55720. $self._assert_equals_($6,$7);
  55721. $ctx1.sendIdx["assert:equals:"]=2;
  55722. $8=$recv($self._collectionWithNewValue())._detect_ifNone_((function(each){
  55723. return $core.withContext(function($ctx2) {
  55724. $9=$self._sampleNewValue();
  55725. $ctx2.sendIdx["sampleNewValue"]=2;
  55726. return $recv(each).__eq($9);
  55727. $ctx2.sendIdx["="]=1;
  55728. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)});
  55729. }),(function(){
  55730. return sentinel;
  55731. }));
  55732. $ctx1.sendIdx["detect:ifNone:"]=4;
  55733. $10=$self._sampleNewValue();
  55734. $ctx1.sendIdx["sampleNewValue"]=3;
  55735. $self._assert_equals_($8,$10);
  55736. $ctx1.sendIdx["assert:equals:"]=3;
  55737. $self._assert_equals_($recv($self._collection())._detect_ifNone_((function(each){
  55738. return $core.withContext(function($ctx2) {
  55739. return $recv(each).__eq($self._sampleNewValue());
  55740. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)});
  55741. }),(function(){
  55742. return sentinel;
  55743. })),sentinel);
  55744. return self;
  55745. }, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel})});
  55746. },
  55747. args: [],
  55748. 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",
  55749. referencedClasses: ["Object"],
  55750. pragmas: [],
  55751. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  55752. }),
  55753. $globals.CollectionTest);
  55754. $core.addMethod(
  55755. $core.method({
  55756. selector: "testDo",
  55757. protocol: "tests",
  55758. fn: function (){
  55759. var self=this,$self=this;
  55760. var newCollection;
  55761. return $core.withContext(function($ctx1) {
  55762. var $1,$2;
  55763. newCollection=$recv($globals.OrderedCollection)._new();
  55764. $ctx1.sendIdx["new"]=1;
  55765. $1=$self._collection();
  55766. $ctx1.sendIdx["collection"]=1;
  55767. $recv($1)._do_((function(each){
  55768. return $core.withContext(function($ctx2) {
  55769. return $recv(newCollection)._add_(each);
  55770. $ctx2.sendIdx["add:"]=1;
  55771. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  55772. }));
  55773. $ctx1.sendIdx["do:"]=1;
  55774. $self._assertSameContents_as_($self._collection(),newCollection);
  55775. $ctx1.sendIdx["assertSameContents:as:"]=1;
  55776. newCollection=$recv($globals.OrderedCollection)._new();
  55777. $2=$self._collectionWithDuplicates();
  55778. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  55779. $recv($2)._do_((function(each){
  55780. return $core.withContext(function($ctx2) {
  55781. return $recv(newCollection)._add_(each);
  55782. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  55783. }));
  55784. $self._assertSameContents_as_($self._collectionWithDuplicates(),newCollection);
  55785. return self;
  55786. }, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection})});
  55787. },
  55788. args: [],
  55789. 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",
  55790. referencedClasses: ["OrderedCollection"],
  55791. pragmas: [],
  55792. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"]
  55793. }),
  55794. $globals.CollectionTest);
  55795. $core.addMethod(
  55796. $core.method({
  55797. selector: "testEquality",
  55798. protocol: "tests",
  55799. fn: function (){
  55800. var self=this,$self=this;
  55801. return $core.withContext(function($ctx1) {
  55802. var $2,$1,$4,$3,$5,$6,$7,$8,$11,$10,$12,$9,$14,$13;
  55803. $2=$self._collectionClass();
  55804. $ctx1.sendIdx["collectionClass"]=1;
  55805. $1=$recv($2)._new();
  55806. $ctx1.sendIdx["new"]=1;
  55807. $4=$self._collectionClass();
  55808. $ctx1.sendIdx["collectionClass"]=2;
  55809. $3=$recv($4)._new();
  55810. $ctx1.sendIdx["new"]=2;
  55811. $self._assert_equals_($1,$3);
  55812. $ctx1.sendIdx["assert:equals:"]=1;
  55813. $5=$self._collection();
  55814. $ctx1.sendIdx["collection"]=1;
  55815. $6=$self._collection();
  55816. $ctx1.sendIdx["collection"]=2;
  55817. $self._assert_equals_($5,$6);
  55818. $ctx1.sendIdx["assert:equals:"]=2;
  55819. $7=$self._collectionWithNewValue();
  55820. $ctx1.sendIdx["collectionWithNewValue"]=1;
  55821. $8=$self._collectionWithNewValue();
  55822. $ctx1.sendIdx["collectionWithNewValue"]=2;
  55823. $self._assert_equals_($7,$8);
  55824. $11=$self._collectionClass();
  55825. $ctx1.sendIdx["collectionClass"]=3;
  55826. $10=$recv($11)._new();
  55827. $ctx1.sendIdx["new"]=3;
  55828. $12=$self._collection();
  55829. $ctx1.sendIdx["collection"]=3;
  55830. $9=$recv($10).__eq($12);
  55831. $ctx1.sendIdx["="]=1;
  55832. $self._deny_($9);
  55833. $ctx1.sendIdx["deny:"]=1;
  55834. $14=$self._collection();
  55835. $ctx1.sendIdx["collection"]=4;
  55836. $13=$recv($14).__eq($recv($self._collectionClass())._new());
  55837. $ctx1.sendIdx["="]=2;
  55838. $self._deny_($13);
  55839. $ctx1.sendIdx["deny:"]=2;
  55840. $self._deny_($recv($self._collection()).__eq($self._collectionWithNewValue()));
  55841. return self;
  55842. }, function($ctx1) {$ctx1.fill(self,"testEquality",{})});
  55843. },
  55844. args: [],
  55845. 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",
  55846. referencedClasses: [],
  55847. pragmas: [],
  55848. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  55849. }),
  55850. $globals.CollectionTest);
  55851. $core.addMethod(
  55852. $core.method({
  55853. selector: "testIfEmptyFamily",
  55854. protocol: "tests",
  55855. fn: function (){
  55856. var self=this,$self=this;
  55857. return $core.withContext(function($ctx1) {
  55858. var $3,$2,$1,$5,$4,$6,$9,$8,$7,$11,$10,$13,$12,$15,$14,$16,$19,$18,$17,$21,$20,$23,$22,$24,$25,$27,$26,$29,$28;
  55859. $3=$self._collectionClass();
  55860. $ctx1.sendIdx["collectionClass"]=1;
  55861. $2=$recv($3)._new();
  55862. $ctx1.sendIdx["new"]=1;
  55863. $1=$recv($2)._ifEmpty_((function(){
  55864. return (42);
  55865. }));
  55866. $ctx1.sendIdx["ifEmpty:"]=1;
  55867. $self._assert_equals_($1,(42));
  55868. $ctx1.sendIdx["assert:equals:"]=1;
  55869. $5=$self._collection();
  55870. $ctx1.sendIdx["collection"]=1;
  55871. $4=$recv($5)._ifEmpty_((function(){
  55872. return (42);
  55873. }));
  55874. $6=$self._collection();
  55875. $ctx1.sendIdx["collection"]=2;
  55876. $self._assert_equals_($4,$6);
  55877. $ctx1.sendIdx["assert:equals:"]=2;
  55878. $9=$self._collectionClass();
  55879. $ctx1.sendIdx["collectionClass"]=2;
  55880. $8=$recv($9)._new();
  55881. $ctx1.sendIdx["new"]=2;
  55882. $7=$recv($8)._ifNotEmpty_((function(){
  55883. return (42);
  55884. }));
  55885. $ctx1.sendIdx["ifNotEmpty:"]=1;
  55886. $11=$self._collectionClass();
  55887. $ctx1.sendIdx["collectionClass"]=3;
  55888. $10=$recv($11)._new();
  55889. $ctx1.sendIdx["new"]=3;
  55890. $self._assert_equals_($7,$10);
  55891. $ctx1.sendIdx["assert:equals:"]=3;
  55892. $13=$self._collection();
  55893. $ctx1.sendIdx["collection"]=3;
  55894. $12=$recv($13)._ifNotEmpty_((function(){
  55895. return (42);
  55896. }));
  55897. $ctx1.sendIdx["ifNotEmpty:"]=2;
  55898. $self._assert_equals_($12,(42));
  55899. $ctx1.sendIdx["assert:equals:"]=4;
  55900. $15=$self._collection();
  55901. $ctx1.sendIdx["collection"]=4;
  55902. $14=$recv($15)._ifNotEmpty_((function(col){
  55903. return col;
  55904. }));
  55905. $16=$self._collection();
  55906. $ctx1.sendIdx["collection"]=5;
  55907. $self._assert_equals_($14,$16);
  55908. $ctx1.sendIdx["assert:equals:"]=5;
  55909. $19=$self._collectionClass();
  55910. $ctx1.sendIdx["collectionClass"]=4;
  55911. $18=$recv($19)._new();
  55912. $ctx1.sendIdx["new"]=4;
  55913. $17=$recv($18)._ifEmpty_ifNotEmpty_((function(){
  55914. return (42);
  55915. }),(function(){
  55916. return (999);
  55917. }));
  55918. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  55919. $self._assert_equals_($17,(42));
  55920. $ctx1.sendIdx["assert:equals:"]=6;
  55921. $21=$self._collection();
  55922. $ctx1.sendIdx["collection"]=6;
  55923. $20=$recv($21)._ifEmpty_ifNotEmpty_((function(){
  55924. return (42);
  55925. }),(function(){
  55926. return (999);
  55927. }));
  55928. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=2;
  55929. $self._assert_equals_($20,(999));
  55930. $ctx1.sendIdx["assert:equals:"]=7;
  55931. $23=$self._collection();
  55932. $ctx1.sendIdx["collection"]=7;
  55933. $22=$recv($23)._ifEmpty_ifNotEmpty_((function(){
  55934. return (42);
  55935. }),(function(col){
  55936. return col;
  55937. }));
  55938. $24=$self._collection();
  55939. $ctx1.sendIdx["collection"]=8;
  55940. $self._assert_equals_($22,$24);
  55941. $ctx1.sendIdx["assert:equals:"]=8;
  55942. $25=$recv($recv($self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  55943. return (42);
  55944. }),(function(){
  55945. return (999);
  55946. }));
  55947. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  55948. $self._assert_equals_($25,(999));
  55949. $ctx1.sendIdx["assert:equals:"]=9;
  55950. $27=$self._collection();
  55951. $ctx1.sendIdx["collection"]=9;
  55952. $26=$recv($27)._ifNotEmpty_ifEmpty_((function(){
  55953. return (42);
  55954. }),(function(){
  55955. return (999);
  55956. }));
  55957. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=2;
  55958. $self._assert_equals_($26,(42));
  55959. $ctx1.sendIdx["assert:equals:"]=10;
  55960. $29=$self._collection();
  55961. $ctx1.sendIdx["collection"]=10;
  55962. $28=$recv($29)._ifNotEmpty_ifEmpty_((function(col){
  55963. return col;
  55964. }),(function(){
  55965. return (999);
  55966. }));
  55967. $self._assert_equals_($28,$self._collection());
  55968. return self;
  55969. }, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{})});
  55970. },
  55971. args: [],
  55972. 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.",
  55973. referencedClasses: [],
  55974. pragmas: [],
  55975. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"]
  55976. }),
  55977. $globals.CollectionTest);
  55978. $core.addMethod(
  55979. $core.method({
  55980. selector: "testIsEmpty",
  55981. protocol: "tests",
  55982. fn: function (){
  55983. var self=this,$self=this;
  55984. return $core.withContext(function($ctx1) {
  55985. var $1;
  55986. $1=$recv($recv($self._collectionClass())._new())._isEmpty();
  55987. $ctx1.sendIdx["isEmpty"]=1;
  55988. $self._assert_($1);
  55989. $self._deny_($recv($self._collection())._isEmpty());
  55990. return self;
  55991. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{})});
  55992. },
  55993. args: [],
  55994. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  55995. referencedClasses: [],
  55996. pragmas: [],
  55997. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"]
  55998. }),
  55999. $globals.CollectionTest);
  56000. $core.addMethod(
  56001. $core.method({
  56002. selector: "testNoneSatisfy",
  56003. protocol: "tests",
  56004. fn: function (){
  56005. var self=this,$self=this;
  56006. var anyOne;
  56007. return $core.withContext(function($ctx1) {
  56008. var $1,$3,$2;
  56009. $1=$self._collection();
  56010. $ctx1.sendIdx["collection"]=1;
  56011. anyOne=$recv($1)._anyOne();
  56012. $3=$self._collection();
  56013. $ctx1.sendIdx["collection"]=2;
  56014. $2=$recv($3)._noneSatisfy_((function(each){
  56015. return $core.withContext(function($ctx2) {
  56016. return $recv(each).__eq(anyOne);
  56017. $ctx2.sendIdx["="]=1;
  56018. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  56019. }));
  56020. $ctx1.sendIdx["noneSatisfy:"]=1;
  56021. $self._deny_($2);
  56022. $self._assert_($recv($self._collection())._noneSatisfy_((function(each){
  56023. return $core.withContext(function($ctx2) {
  56024. return $recv(each).__eq($recv($globals.Object)._new());
  56025. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  56026. })));
  56027. return self;
  56028. }, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne})});
  56029. },
  56030. args: [],
  56031. 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 ])",
  56032. referencedClasses: ["Object"],
  56033. pragmas: [],
  56034. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"]
  56035. }),
  56036. $globals.CollectionTest);
  56037. $core.addMethod(
  56038. $core.method({
  56039. selector: "testRegression1224",
  56040. protocol: "tests",
  56041. fn: function (){
  56042. var self=this,$self=this;
  56043. return $core.withContext(function($ctx1) {
  56044. var $3,$2,$1;
  56045. $3=$recv($self._collectionClass())._new();
  56046. $recv($3)._remove_ifAbsent_($self._sampleNewValue(),(function(){
  56047. }));
  56048. $2=$recv($3)._yourself();
  56049. $1=$recv($2)._size();
  56050. $self._assert_equals_($1,(0));
  56051. return self;
  56052. }, function($ctx1) {$ctx1.fill(self,"testRegression1224",{})});
  56053. },
  56054. args: [],
  56055. source: "testRegression1224\x0a\x09self assert: (self collectionClass new\x0a\x09\x09remove: self sampleNewValue ifAbsent: [];\x0a\x09\x09yourself) size equals: 0",
  56056. referencedClasses: [],
  56057. pragmas: [],
  56058. messageSends: ["assert:equals:", "size", "remove:ifAbsent:", "new", "collectionClass", "sampleNewValue", "yourself"]
  56059. }),
  56060. $globals.CollectionTest);
  56061. $core.addMethod(
  56062. $core.method({
  56063. selector: "testRemoveAll",
  56064. protocol: "tests",
  56065. fn: function (){
  56066. var self=this,$self=this;
  56067. return $core.withContext(function($ctx1) {
  56068. var $2,$1;
  56069. $2=$self._collection();
  56070. $recv($2)._removeAll();
  56071. $1=$recv($2)._yourself();
  56072. $self._assert_equals_($1,$recv($self._collectionClass())._new());
  56073. return self;
  56074. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{})});
  56075. },
  56076. args: [],
  56077. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  56078. referencedClasses: [],
  56079. pragmas: [],
  56080. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"]
  56081. }),
  56082. $globals.CollectionTest);
  56083. $core.addMethod(
  56084. $core.method({
  56085. selector: "testSelect",
  56086. protocol: "tests",
  56087. fn: function (){
  56088. var self=this,$self=this;
  56089. return $core.withContext(function($ctx1) {
  56090. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  56091. $2=$self._collection();
  56092. $ctx1.sendIdx["collection"]=1;
  56093. $1=$recv($2)._select_((function(){
  56094. return false;
  56095. }));
  56096. $ctx1.sendIdx["select:"]=1;
  56097. $4=$self._collectionClass();
  56098. $ctx1.sendIdx["collectionClass"]=1;
  56099. $3=$recv($4)._new();
  56100. $ctx1.sendIdx["new"]=1;
  56101. $self._assert_equals_($1,$3);
  56102. $ctx1.sendIdx["assert:equals:"]=1;
  56103. $6=$self._collection();
  56104. $ctx1.sendIdx["collection"]=2;
  56105. $5=$recv($6)._select_((function(){
  56106. return true;
  56107. }));
  56108. $ctx1.sendIdx["select:"]=2;
  56109. $7=$self._collection();
  56110. $ctx1.sendIdx["collection"]=3;
  56111. $self._assert_equals_($5,$7);
  56112. $ctx1.sendIdx["assert:equals:"]=2;
  56113. $9=$self._collectionWithNewValue();
  56114. $ctx1.sendIdx["collectionWithNewValue"]=1;
  56115. $8=$recv($9)._select_((function(each){
  56116. return $core.withContext(function($ctx2) {
  56117. $10=$self._sampleNewValue();
  56118. $ctx2.sendIdx["sampleNewValue"]=1;
  56119. return $recv(each).__eq($10);
  56120. $ctx2.sendIdx["="]=1;
  56121. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  56122. }));
  56123. $ctx1.sendIdx["select:"]=3;
  56124. $self._assert_equals_($8,$self._sampleNewValueAsCollection());
  56125. $ctx1.sendIdx["assert:equals:"]=3;
  56126. $12=$self._collectionWithNewValue();
  56127. $ctx1.sendIdx["collectionWithNewValue"]=2;
  56128. $11=$recv($12)._select_((function(each){
  56129. return $core.withContext(function($ctx2) {
  56130. $13=$self._sampleNewValue();
  56131. $ctx2.sendIdx["sampleNewValue"]=2;
  56132. return $recv(each).__tild_eq($13);
  56133. $ctx2.sendIdx["~="]=1;
  56134. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  56135. }));
  56136. $ctx1.sendIdx["select:"]=4;
  56137. $14=$self._collection();
  56138. $ctx1.sendIdx["collection"]=4;
  56139. $self._assert_equals_($11,$14);
  56140. $ctx1.sendIdx["assert:equals:"]=4;
  56141. $16=$self._collection();
  56142. $ctx1.sendIdx["collection"]=5;
  56143. $15=$recv($16)._select_((function(each){
  56144. return $core.withContext(function($ctx2) {
  56145. $17=$self._sampleNewValue();
  56146. $ctx2.sendIdx["sampleNewValue"]=3;
  56147. return $recv(each).__eq($17);
  56148. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)});
  56149. }));
  56150. $ctx1.sendIdx["select:"]=5;
  56151. $self._assert_equals_($15,$recv($self._collectionClass())._new());
  56152. $ctx1.sendIdx["assert:equals:"]=5;
  56153. $self._assert_equals_($recv($self._collectionWithNewValue())._select_((function(each){
  56154. return $core.withContext(function($ctx2) {
  56155. return $recv(each).__tild_eq($self._sampleNewValue());
  56156. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  56157. })),$self._collection());
  56158. return self;
  56159. }, function($ctx1) {$ctx1.fill(self,"testSelect",{})});
  56160. },
  56161. args: [],
  56162. 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",
  56163. referencedClasses: [],
  56164. pragmas: [],
  56165. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="]
  56166. }),
  56167. $globals.CollectionTest);
  56168. $core.addMethod(
  56169. $core.method({
  56170. selector: "testSelectThenCollect",
  56171. protocol: "tests",
  56172. fn: function (){
  56173. var self=this,$self=this;
  56174. return $core.withContext(function($ctx1) {
  56175. var $2,$1,$4,$3,$6,$5,$7,$9,$8;
  56176. $2=$self._collection();
  56177. $ctx1.sendIdx["collection"]=1;
  56178. $1=$recv($2)._select_thenCollect_((function(){
  56179. return false;
  56180. }),"isString");
  56181. $ctx1.sendIdx["select:thenCollect:"]=1;
  56182. $4=$self._collectionClass();
  56183. $ctx1.sendIdx["collectionClass"]=1;
  56184. $3=$recv($4)._new();
  56185. $ctx1.sendIdx["new"]=1;
  56186. $self._assert_equals_($1,$3);
  56187. $ctx1.sendIdx["assert:equals:"]=1;
  56188. $6=$self._collection();
  56189. $ctx1.sendIdx["collection"]=2;
  56190. $5=$recv($6)._select_thenCollect_((function(){
  56191. return true;
  56192. }),(function(x){
  56193. return x;
  56194. }));
  56195. $ctx1.sendIdx["select:thenCollect:"]=2;
  56196. $7=$self._collection();
  56197. $ctx1.sendIdx["collection"]=3;
  56198. $self._assert_equals_($5,$7);
  56199. $ctx1.sendIdx["assert:equals:"]=2;
  56200. $8=$recv($self._collection())._select_thenCollect_((function(each){
  56201. return $core.withContext(function($ctx2) {
  56202. $9=$self._sampleNewValue();
  56203. $ctx2.sendIdx["sampleNewValue"]=1;
  56204. return $recv(each).__eq($9);
  56205. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  56206. }),(function(x){
  56207. return x;
  56208. }));
  56209. $ctx1.sendIdx["select:thenCollect:"]=3;
  56210. $self._assert_equals_($8,$recv($self._collectionClass())._new());
  56211. $ctx1.sendIdx["assert:equals:"]=3;
  56212. $self._assert_equals_($recv($self._collectionWithNewValue())._select_thenCollect_((function(each){
  56213. return $core.withContext(function($ctx2) {
  56214. return $recv(each).__tild_eq($self._sampleNewValue());
  56215. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  56216. }),"printString"),$self._collectionOfPrintStrings());
  56217. return self;
  56218. }, function($ctx1) {$ctx1.fill(self,"testSelectThenCollect",{})});
  56219. },
  56220. args: [],
  56221. 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",
  56222. referencedClasses: [],
  56223. pragmas: [],
  56224. messageSends: ["assert:equals:", "select:thenCollect:", "collection", "new", "collectionClass", "=", "sampleNewValue", "collectionWithNewValue", "~=", "collectionOfPrintStrings"]
  56225. }),
  56226. $globals.CollectionTest);
  56227. $core.addMethod(
  56228. $core.method({
  56229. selector: "testSingle",
  56230. protocol: "tests",
  56231. fn: function (){
  56232. var self=this,$self=this;
  56233. return $core.withContext(function($ctx1) {
  56234. $self._should_raise_((function(){
  56235. return $core.withContext(function($ctx2) {
  56236. return $recv($recv($self._collectionClass())._new())._single();
  56237. $ctx2.sendIdx["single"]=1;
  56238. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56239. }),$globals.Error);
  56240. $ctx1.sendIdx["should:raise:"]=1;
  56241. $self._should_raise_((function(){
  56242. return $core.withContext(function($ctx2) {
  56243. return $recv($self._collection())._single();
  56244. $ctx2.sendIdx["single"]=2;
  56245. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  56246. }),$globals.Error);
  56247. $self._assert_equals_($recv($self._sampleNewValueAsCollection())._single(),$self._sampleNewValue());
  56248. return self;
  56249. }, function($ctx1) {$ctx1.fill(self,"testSingle",{})});
  56250. },
  56251. args: [],
  56252. 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",
  56253. referencedClasses: ["Error"],
  56254. pragmas: [],
  56255. messageSends: ["should:raise:", "single", "new", "collectionClass", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue"]
  56256. }),
  56257. $globals.CollectionTest);
  56258. $core.addMethod(
  56259. $core.method({
  56260. selector: "testSize",
  56261. protocol: "tests",
  56262. fn: function (){
  56263. var self=this,$self=this;
  56264. return $core.withContext(function($ctx1) {
  56265. var $1,$2;
  56266. $1=$recv($recv($self._collectionClass())._new())._size();
  56267. $ctx1.sendIdx["size"]=1;
  56268. $self._assert_equals_($1,(0));
  56269. $ctx1.sendIdx["assert:equals:"]=1;
  56270. $2=$recv($self._sampleNewValueAsCollection())._size();
  56271. $ctx1.sendIdx["size"]=2;
  56272. $self._assert_equals_($2,(1));
  56273. $ctx1.sendIdx["assert:equals:"]=2;
  56274. $self._assert_equals_($recv($self._collection())._size(),$self._collectionSize());
  56275. return self;
  56276. }, function($ctx1) {$ctx1.fill(self,"testSize",{})});
  56277. },
  56278. args: [],
  56279. 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",
  56280. referencedClasses: [],
  56281. pragmas: [],
  56282. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"]
  56283. }),
  56284. $globals.CollectionTest);
  56285. $core.addMethod(
  56286. $core.method({
  56287. selector: "collectionClass",
  56288. protocol: "fixture",
  56289. fn: function (){
  56290. var self=this,$self=this;
  56291. return nil;
  56292. },
  56293. args: [],
  56294. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  56295. referencedClasses: [],
  56296. pragmas: [],
  56297. messageSends: []
  56298. }),
  56299. $globals.CollectionTest.a$cls);
  56300. $core.addMethod(
  56301. $core.method({
  56302. selector: "isAbstract",
  56303. protocol: "testing",
  56304. fn: function (){
  56305. var self=this,$self=this;
  56306. return $core.withContext(function($ctx1) {
  56307. return $recv($self._collectionClass())._isNil();
  56308. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{})});
  56309. },
  56310. args: [],
  56311. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  56312. referencedClasses: [],
  56313. pragmas: [],
  56314. messageSends: ["isNil", "collectionClass"]
  56315. }),
  56316. $globals.CollectionTest.a$cls);
  56317. $core.addClass("IndexableCollectionTest", $globals.CollectionTest, [], "Kernel-Tests");
  56318. $core.addMethod(
  56319. $core.method({
  56320. selector: "collectionWithNewValue",
  56321. protocol: "fixture",
  56322. fn: function (){
  56323. var self=this,$self=this;
  56324. return $core.withContext(function($ctx1) {
  56325. $self._subclassResponsibility();
  56326. return self;
  56327. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{})});
  56328. },
  56329. args: [],
  56330. source: "collectionWithNewValue\x0a\x09\x22Answers a collection which shows how\x0a\x09self collection would look after adding\x0a\x09self sampleNewValue at self sampleNewIndex\x22\x0a\x09\x0a\x09self subclassResponsibility",
  56331. referencedClasses: [],
  56332. pragmas: [],
  56333. messageSends: ["subclassResponsibility"]
  56334. }),
  56335. $globals.IndexableCollectionTest);
  56336. $core.addMethod(
  56337. $core.method({
  56338. selector: "nonIndexesDo:",
  56339. protocol: "fixture",
  56340. fn: function (aBlock){
  56341. var self=this,$self=this;
  56342. return $core.withContext(function($ctx1) {
  56343. $self._subclassResponsibility();
  56344. return self;
  56345. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock})});
  56346. },
  56347. args: ["aBlock"],
  56348. 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",
  56349. referencedClasses: [],
  56350. pragmas: [],
  56351. messageSends: ["subclassResponsibility"]
  56352. }),
  56353. $globals.IndexableCollectionTest);
  56354. $core.addMethod(
  56355. $core.method({
  56356. selector: "sampleNewIndex",
  56357. protocol: "fixture",
  56358. fn: function (){
  56359. var self=this,$self=this;
  56360. return $core.withContext(function($ctx1) {
  56361. $self._subclassResponsibility();
  56362. return self;
  56363. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{})});
  56364. },
  56365. args: [],
  56366. 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",
  56367. referencedClasses: [],
  56368. pragmas: [],
  56369. messageSends: ["subclassResponsibility"]
  56370. }),
  56371. $globals.IndexableCollectionTest);
  56372. $core.addMethod(
  56373. $core.method({
  56374. selector: "samplesDo:",
  56375. protocol: "fixture",
  56376. fn: function (aBlock){
  56377. var self=this,$self=this;
  56378. return $core.withContext(function($ctx1) {
  56379. $self._subclassResponsibility();
  56380. return self;
  56381. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock})});
  56382. },
  56383. args: ["aBlock"],
  56384. 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",
  56385. referencedClasses: [],
  56386. pragmas: [],
  56387. messageSends: ["subclassResponsibility"]
  56388. }),
  56389. $globals.IndexableCollectionTest);
  56390. $core.addMethod(
  56391. $core.method({
  56392. selector: "testAt",
  56393. protocol: "tests",
  56394. fn: function (){
  56395. var self=this,$self=this;
  56396. return $core.withContext(function($ctx1) {
  56397. var $1;
  56398. $self._nonIndexesDo_((function(each){
  56399. return $core.withContext(function($ctx2) {
  56400. return $self._should_raise_((function(){
  56401. return $core.withContext(function($ctx3) {
  56402. $1=$self._collection();
  56403. $ctx3.sendIdx["collection"]=1;
  56404. return $recv($1)._at_(each);
  56405. $ctx3.sendIdx["at:"]=1;
  56406. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  56407. }),$globals.Error);
  56408. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  56409. }));
  56410. $self._samplesDo_((function(index,value){
  56411. return $core.withContext(function($ctx2) {
  56412. return $self._assert_equals_($recv($self._collection())._at_(index),value);
  56413. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  56414. }));
  56415. return self;
  56416. }, function($ctx1) {$ctx1.fill(self,"testAt",{})});
  56417. },
  56418. args: [],
  56419. 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 ]",
  56420. referencedClasses: ["Error"],
  56421. pragmas: [],
  56422. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"]
  56423. }),
  56424. $globals.IndexableCollectionTest);
  56425. $core.addMethod(
  56426. $core.method({
  56427. selector: "testAtIfAbsent",
  56428. protocol: "tests",
  56429. fn: function (){
  56430. var self=this,$self=this;
  56431. return $core.withContext(function($ctx1) {
  56432. var $2,$1,$3;
  56433. $self._nonIndexesDo_((function(each){
  56434. return $core.withContext(function($ctx2) {
  56435. $2=$self._collection();
  56436. $ctx2.sendIdx["collection"]=1;
  56437. $1=$recv($2)._at_ifAbsent_(each,(function(){
  56438. return $core.withContext(function($ctx3) {
  56439. return $self._sampleNewValue();
  56440. $ctx3.sendIdx["sampleNewValue"]=1;
  56441. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  56442. }));
  56443. $ctx2.sendIdx["at:ifAbsent:"]=1;
  56444. $3=$self._sampleNewValue();
  56445. $ctx2.sendIdx["sampleNewValue"]=2;
  56446. return $self._assert_equals_($1,$3);
  56447. $ctx2.sendIdx["assert:equals:"]=1;
  56448. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  56449. }));
  56450. $self._samplesDo_((function(index,value){
  56451. return $core.withContext(function($ctx2) {
  56452. return $self._assert_equals_($recv($self._collection())._at_ifAbsent_(index,(function(){
  56453. return $core.withContext(function($ctx3) {
  56454. return $self._sampleNewValue();
  56455. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  56456. })),value);
  56457. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  56458. }));
  56459. return self;
  56460. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{})});
  56461. },
  56462. args: [],
  56463. 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 ].",
  56464. referencedClasses: [],
  56465. pragmas: [],
  56466. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"]
  56467. }),
  56468. $globals.IndexableCollectionTest);
  56469. $core.addMethod(
  56470. $core.method({
  56471. selector: "testAtIfAbsentPut",
  56472. protocol: "tests",
  56473. fn: function (){
  56474. var self=this,$self=this;
  56475. var newCollection;
  56476. return $core.withContext(function($ctx1) {
  56477. var $1;
  56478. newCollection=$self._collection();
  56479. $ctx1.sendIdx["collection"]=1;
  56480. $self._samplesDo_((function(index,value){
  56481. return $core.withContext(function($ctx2) {
  56482. $1=$recv(newCollection)._at_ifAbsentPut_(index,(function(){
  56483. return $core.withContext(function($ctx3) {
  56484. return $self._sampleNewValue();
  56485. $ctx3.sendIdx["sampleNewValue"]=1;
  56486. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  56487. }));
  56488. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  56489. return $self._assert_equals_($1,value);
  56490. $ctx2.sendIdx["assert:equals:"]=1;
  56491. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  56492. }));
  56493. $self._assert_equals_(newCollection,$self._collection());
  56494. $ctx1.sendIdx["assert:equals:"]=2;
  56495. $self._assert_equals_($recv(newCollection)._at_ifAbsentPut_($self._sampleNewIndex(),(function(){
  56496. return $core.withContext(function($ctx2) {
  56497. return $self._sampleNewValue();
  56498. $ctx2.sendIdx["sampleNewValue"]=2;
  56499. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  56500. })),$self._sampleNewValue());
  56501. $ctx1.sendIdx["assert:equals:"]=3;
  56502. $self._assert_equals_(newCollection,$self._collectionWithNewValue());
  56503. return self;
  56504. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection})});
  56505. },
  56506. args: [],
  56507. 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",
  56508. referencedClasses: [],
  56509. pragmas: [],
  56510. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"]
  56511. }),
  56512. $globals.IndexableCollectionTest);
  56513. $core.addMethod(
  56514. $core.method({
  56515. selector: "testAtIfPresent",
  56516. protocol: "tests",
  56517. fn: function (){
  56518. var self=this,$self=this;
  56519. var visited,sentinel;
  56520. return $core.withContext(function($ctx1) {
  56521. var $2,$1,$4,$3;
  56522. sentinel=$recv($globals.Object)._new();
  56523. $self._nonIndexesDo_((function(each){
  56524. return $core.withContext(function($ctx2) {
  56525. visited=nil;
  56526. $2=$self._collection();
  56527. $ctx2.sendIdx["collection"]=1;
  56528. $1=$recv($2)._at_ifPresent_(each,(function(value1){
  56529. visited=value1;
  56530. return sentinel;
  56531. }));
  56532. $ctx2.sendIdx["at:ifPresent:"]=1;
  56533. $self._assert_equals_($1,nil);
  56534. $ctx2.sendIdx["assert:equals:"]=1;
  56535. return $self._assert_($recv(visited)._isNil());
  56536. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  56537. }));
  56538. $self._samplesDo_((function(index,value){
  56539. return $core.withContext(function($ctx2) {
  56540. visited=nil;
  56541. $4=$self._collection();
  56542. $ctx2.sendIdx["collection"]=2;
  56543. $3=$recv($4)._at_ifPresent_(index,(function(value2){
  56544. visited=value2;
  56545. return sentinel;
  56546. }));
  56547. $self._assert_equals_($3,sentinel);
  56548. $ctx2.sendIdx["assert:equals:"]=2;
  56549. return $self._assert_equals_(visited,$recv($self._collection())._at_(index));
  56550. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  56551. }));
  56552. return self;
  56553. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel})});
  56554. },
  56555. args: [],
  56556. 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) ]",
  56557. referencedClasses: ["Object"],
  56558. pragmas: [],
  56559. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"]
  56560. }),
  56561. $globals.IndexableCollectionTest);
  56562. $core.addMethod(
  56563. $core.method({
  56564. selector: "testAtIfPresentIfAbsent",
  56565. protocol: "tests",
  56566. fn: function (){
  56567. var self=this,$self=this;
  56568. var visited,sentinel;
  56569. return $core.withContext(function($ctx1) {
  56570. var $2,$1,$3,$5,$4;
  56571. sentinel=$recv($globals.Object)._new();
  56572. $self._nonIndexesDo_((function(each){
  56573. return $core.withContext(function($ctx2) {
  56574. visited=nil;
  56575. $2=$self._collection();
  56576. $ctx2.sendIdx["collection"]=1;
  56577. $1=$recv($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  56578. visited=value1;
  56579. return sentinel;
  56580. }),(function(){
  56581. return $core.withContext(function($ctx3) {
  56582. return $self._sampleNewValue();
  56583. $ctx3.sendIdx["sampleNewValue"]=1;
  56584. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  56585. }));
  56586. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  56587. $3=$self._sampleNewValue();
  56588. $ctx2.sendIdx["sampleNewValue"]=2;
  56589. $self._assert_equals_($1,$3);
  56590. $ctx2.sendIdx["assert:equals:"]=1;
  56591. return $self._assert_($recv(visited)._isNil());
  56592. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  56593. }));
  56594. $self._samplesDo_((function(index,value){
  56595. return $core.withContext(function($ctx2) {
  56596. visited=nil;
  56597. $5=$self._collection();
  56598. $ctx2.sendIdx["collection"]=2;
  56599. $4=$recv($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  56600. visited=value2;
  56601. return sentinel;
  56602. }),(function(){
  56603. return $core.withContext(function($ctx3) {
  56604. return $self._sampleNewValue();
  56605. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)});
  56606. }));
  56607. $self._assert_equals_($4,sentinel);
  56608. $ctx2.sendIdx["assert:equals:"]=2;
  56609. return $self._assert_equals_(visited,$recv($self._collection())._at_(index));
  56610. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)});
  56611. }));
  56612. return self;
  56613. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel})});
  56614. },
  56615. args: [],
  56616. 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) ]",
  56617. referencedClasses: ["Object"],
  56618. pragmas: [],
  56619. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"]
  56620. }),
  56621. $globals.IndexableCollectionTest);
  56622. $core.addMethod(
  56623. $core.method({
  56624. selector: "testAtPut",
  56625. protocol: "tests",
  56626. fn: function (){
  56627. var self=this,$self=this;
  56628. var newCollection;
  56629. return $core.withContext(function($ctx1) {
  56630. newCollection=$self._collection();
  56631. $ctx1.sendIdx["collection"]=1;
  56632. $self._samplesDo_((function(index,value){
  56633. return $core.withContext(function($ctx2) {
  56634. return $recv(newCollection)._at_put_(index,value);
  56635. $ctx2.sendIdx["at:put:"]=1;
  56636. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  56637. }));
  56638. $self._assert_equals_(newCollection,$self._collection());
  56639. $ctx1.sendIdx["assert:equals:"]=1;
  56640. $recv(newCollection)._at_put_($self._sampleNewIndex(),$self._sampleNewValue());
  56641. $self._assert_equals_(newCollection,$self._collectionWithNewValue());
  56642. return self;
  56643. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection})});
  56644. },
  56645. args: [],
  56646. 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",
  56647. referencedClasses: [],
  56648. pragmas: [],
  56649. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"]
  56650. }),
  56651. $globals.IndexableCollectionTest);
  56652. $core.addMethod(
  56653. $core.method({
  56654. selector: "testIndexOf",
  56655. protocol: "tests",
  56656. fn: function (){
  56657. var self=this,$self=this;
  56658. return $core.withContext(function($ctx1) {
  56659. var $1;
  56660. $self._should_raise_((function(){
  56661. return $core.withContext(function($ctx2) {
  56662. $1=$self._collection();
  56663. $ctx2.sendIdx["collection"]=1;
  56664. return $recv($1)._indexOf_($self._sampleNewValue());
  56665. $ctx2.sendIdx["indexOf:"]=1;
  56666. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56667. }),$globals.Error);
  56668. $self._samplesDo_((function(index,value){
  56669. return $core.withContext(function($ctx2) {
  56670. return $self._assert_equals_($recv($self._collection())._indexOf_(value),index);
  56671. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)});
  56672. }));
  56673. return self;
  56674. }, function($ctx1) {$ctx1.fill(self,"testIndexOf",{})});
  56675. },
  56676. args: [],
  56677. 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 ]",
  56678. referencedClasses: ["Error"],
  56679. pragmas: [],
  56680. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"]
  56681. }),
  56682. $globals.IndexableCollectionTest);
  56683. $core.addMethod(
  56684. $core.method({
  56685. selector: "testIndexOfWithNull",
  56686. protocol: "tests",
  56687. fn: function (){
  56688. var self=this,$self=this;
  56689. var jsNull;
  56690. return $core.withContext(function($ctx1) {
  56691. var $2,$1;
  56692. jsNull=$recv($globals.JSON)._parse_("null");
  56693. $self._samplesDo_((function(index,value){
  56694. return $core.withContext(function($ctx2) {
  56695. $2=$self._collection();
  56696. $recv($2)._at_put_(index,jsNull);
  56697. $1=$recv($2)._indexOf_(jsNull);
  56698. return $self._assert_equals_($1,index);
  56699. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  56700. }));
  56701. return self;
  56702. }, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull})});
  56703. },
  56704. args: [],
  56705. 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 ]",
  56706. referencedClasses: ["JSON"],
  56707. pragmas: [],
  56708. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"]
  56709. }),
  56710. $globals.IndexableCollectionTest);
  56711. $core.addMethod(
  56712. $core.method({
  56713. selector: "testWithIndexDo",
  56714. protocol: "tests",
  56715. fn: function (){
  56716. var self=this,$self=this;
  56717. var collection;
  56718. return $core.withContext(function($ctx1) {
  56719. collection=$self._collection();
  56720. $ctx1.sendIdx["collection"]=1;
  56721. $recv($self._collection())._withIndexDo_((function(each,index){
  56722. return $core.withContext(function($ctx2) {
  56723. return $self._assert_equals_($recv(collection)._at_(index),each);
  56724. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  56725. }));
  56726. return self;
  56727. }, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection})});
  56728. },
  56729. args: [],
  56730. 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 ]",
  56731. referencedClasses: [],
  56732. pragmas: [],
  56733. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"]
  56734. }),
  56735. $globals.IndexableCollectionTest);
  56736. $core.addClass("AssociativeCollectionTest", $globals.IndexableCollectionTest, [], "Kernel-Tests");
  56737. $core.addMethod(
  56738. $core.method({
  56739. selector: "collectionKeys",
  56740. protocol: "fixture",
  56741. fn: function (){
  56742. var self=this,$self=this;
  56743. return $core.withContext(function($ctx1) {
  56744. $self._subclassResponsibility();
  56745. return self;
  56746. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{})});
  56747. },
  56748. args: [],
  56749. source: "collectionKeys\x0a\x09self subclassResponsibility",
  56750. referencedClasses: [],
  56751. pragmas: [],
  56752. messageSends: ["subclassResponsibility"]
  56753. }),
  56754. $globals.AssociativeCollectionTest);
  56755. $core.addMethod(
  56756. $core.method({
  56757. selector: "collectionValues",
  56758. protocol: "fixture",
  56759. fn: function (){
  56760. var self=this,$self=this;
  56761. return $core.withContext(function($ctx1) {
  56762. $self._subclassResponsibility();
  56763. return self;
  56764. }, function($ctx1) {$ctx1.fill(self,"collectionValues",{})});
  56765. },
  56766. args: [],
  56767. source: "collectionValues\x0a\x09self subclassResponsibility",
  56768. referencedClasses: [],
  56769. pragmas: [],
  56770. messageSends: ["subclassResponsibility"]
  56771. }),
  56772. $globals.AssociativeCollectionTest);
  56773. $core.addMethod(
  56774. $core.method({
  56775. selector: "nonIndexesDo:",
  56776. protocol: "fixture",
  56777. fn: function (aBlock){
  56778. var self=this,$self=this;
  56779. return $core.withContext(function($ctx1) {
  56780. $recv(aBlock)._value_((5));
  56781. $ctx1.sendIdx["value:"]=1;
  56782. $recv(aBlock)._value_((function(){
  56783. }));
  56784. $ctx1.sendIdx["value:"]=2;
  56785. $recv(aBlock)._value_($recv($globals.Object)._new());
  56786. $ctx1.sendIdx["value:"]=3;
  56787. $recv(aBlock)._value_("z");
  56788. return self;
  56789. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock})});
  56790. },
  56791. args: ["aBlock"],
  56792. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: [].\x0a\x09aBlock value: Object new.\x0a\x09aBlock value: 'z'",
  56793. referencedClasses: ["Object"],
  56794. pragmas: [],
  56795. messageSends: ["value:", "new"]
  56796. }),
  56797. $globals.AssociativeCollectionTest);
  56798. $core.addMethod(
  56799. $core.method({
  56800. selector: "sampleNewIndex",
  56801. protocol: "fixture",
  56802. fn: function (){
  56803. var self=this,$self=this;
  56804. return "new";
  56805. },
  56806. args: [],
  56807. source: "sampleNewIndex\x0a\x09^ 'new'",
  56808. referencedClasses: [],
  56809. pragmas: [],
  56810. messageSends: []
  56811. }),
  56812. $globals.AssociativeCollectionTest);
  56813. $core.addMethod(
  56814. $core.method({
  56815. selector: "samplesDo:",
  56816. protocol: "fixture",
  56817. fn: function (aBlock){
  56818. var self=this,$self=this;
  56819. return $core.withContext(function($ctx1) {
  56820. $recv(aBlock)._value_value_("a",(2));
  56821. return self;
  56822. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock})});
  56823. },
  56824. args: ["aBlock"],
  56825. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  56826. referencedClasses: [],
  56827. pragmas: [],
  56828. messageSends: ["value:value:"]
  56829. }),
  56830. $globals.AssociativeCollectionTest);
  56831. $core.addMethod(
  56832. $core.method({
  56833. selector: "testAddAll",
  56834. protocol: "tests",
  56835. fn: function (){
  56836. var self=this,$self=this;
  56837. return $core.withContext(function($ctx1) {
  56838. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  56839. (
  56840. $ctx1.supercall = true,
  56841. ($globals.AssociativeCollectionTest.superclass||$boot.nilAsClass).fn.prototype._testAddAll.apply($self, []));
  56842. $ctx1.supercall = false;
  56843. $2=$self._collection();
  56844. $ctx1.sendIdx["collection"]=1;
  56845. $3=$self._collection();
  56846. $ctx1.sendIdx["collection"]=2;
  56847. $recv($2)._addAll_($3);
  56848. $ctx1.sendIdx["addAll:"]=1;
  56849. $4=$recv($2)._yourself();
  56850. $ctx1.sendIdx["yourself"]=1;
  56851. $1=$4;
  56852. $5=$self._collection();
  56853. $ctx1.sendIdx["collection"]=3;
  56854. $self._assert_equals_($1,$5);
  56855. $ctx1.sendIdx["assert:equals:"]=1;
  56856. $7=$self._collection();
  56857. $ctx1.sendIdx["collection"]=4;
  56858. $8=$self._collectionWithNewValue();
  56859. $ctx1.sendIdx["collectionWithNewValue"]=1;
  56860. $recv($7)._addAll_($8);
  56861. $ctx1.sendIdx["addAll:"]=2;
  56862. $9=$recv($7)._yourself();
  56863. $ctx1.sendIdx["yourself"]=2;
  56864. $6=$9;
  56865. $10=$self._collectionWithNewValue();
  56866. $ctx1.sendIdx["collectionWithNewValue"]=2;
  56867. $self._assert_equals_($6,$10);
  56868. $ctx1.sendIdx["assert:equals:"]=2;
  56869. $12=$self._collectionWithNewValue();
  56870. $ctx1.sendIdx["collectionWithNewValue"]=3;
  56871. $recv($12)._addAll_($self._collection());
  56872. $11=$recv($12)._yourself();
  56873. $self._assert_equals_($11,$self._collectionWithNewValue());
  56874. return self;
  56875. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{})});
  56876. },
  56877. args: [],
  56878. 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",
  56879. referencedClasses: [],
  56880. pragmas: [],
  56881. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  56882. }),
  56883. $globals.AssociativeCollectionTest);
  56884. $core.addMethod(
  56885. $core.method({
  56886. selector: "testAsDictionary",
  56887. protocol: "tests",
  56888. fn: function (){
  56889. var self=this,$self=this;
  56890. return $core.withContext(function($ctx1) {
  56891. $self._assert_($recv($recv($recv($self._collectionClass())._new())._asDictionary())._isMemberOf_($globals.Dictionary));
  56892. return self;
  56893. }, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{})});
  56894. },
  56895. args: [],
  56896. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  56897. referencedClasses: ["Dictionary"],
  56898. pragmas: [],
  56899. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"]
  56900. }),
  56901. $globals.AssociativeCollectionTest);
  56902. $core.addMethod(
  56903. $core.method({
  56904. selector: "testAsHashedCollection",
  56905. protocol: "tests",
  56906. fn: function (){
  56907. var self=this,$self=this;
  56908. return $core.withContext(function($ctx1) {
  56909. $self._assert_($recv($recv($recv($self._collectionClass())._new())._asHashedCollection())._isMemberOf_($globals.HashedCollection));
  56910. return self;
  56911. }, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{})});
  56912. },
  56913. args: [],
  56914. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  56915. referencedClasses: ["HashedCollection"],
  56916. pragmas: [],
  56917. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"]
  56918. }),
  56919. $globals.AssociativeCollectionTest);
  56920. $core.addMethod(
  56921. $core.method({
  56922. selector: "testComma",
  56923. protocol: "tests",
  56924. fn: function (){
  56925. var self=this,$self=this;
  56926. return $core.withContext(function($ctx1) {
  56927. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  56928. (
  56929. $ctx1.supercall = true,
  56930. ($globals.AssociativeCollectionTest.superclass||$boot.nilAsClass).fn.prototype._testComma.apply($self, []));
  56931. $ctx1.supercall = false;
  56932. $2=$self._collection();
  56933. $ctx1.sendIdx["collection"]=1;
  56934. $3=$self._collection();
  56935. $ctx1.sendIdx["collection"]=2;
  56936. $1=$recv($2).__comma($3);
  56937. $ctx1.sendIdx[","]=1;
  56938. $4=$self._collection();
  56939. $ctx1.sendIdx["collection"]=3;
  56940. $self._assert_equals_($1,$4);
  56941. $ctx1.sendIdx["assert:equals:"]=1;
  56942. $6=$self._collection();
  56943. $ctx1.sendIdx["collection"]=4;
  56944. $7=$self._collectionWithNewValue();
  56945. $ctx1.sendIdx["collectionWithNewValue"]=1;
  56946. $5=$recv($6).__comma($7);
  56947. $ctx1.sendIdx[","]=2;
  56948. $8=$self._collectionWithNewValue();
  56949. $ctx1.sendIdx["collectionWithNewValue"]=2;
  56950. $self._assert_equals_($5,$8);
  56951. $ctx1.sendIdx["assert:equals:"]=2;
  56952. $10=$self._collectionWithNewValue();
  56953. $ctx1.sendIdx["collectionWithNewValue"]=3;
  56954. $9=$recv($10).__comma($self._collection());
  56955. $self._assert_equals_($9,$self._collectionWithNewValue());
  56956. return self;
  56957. }, function($ctx1) {$ctx1.fill(self,"testComma",{})});
  56958. },
  56959. args: [],
  56960. 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",
  56961. referencedClasses: [],
  56962. pragmas: [],
  56963. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  56964. }),
  56965. $globals.AssociativeCollectionTest);
  56966. $core.addMethod(
  56967. $core.method({
  56968. selector: "testFrom",
  56969. protocol: "tests",
  56970. fn: function (){
  56971. var self=this,$self=this;
  56972. var associations;
  56973. return $core.withContext(function($ctx1) {
  56974. var $1;
  56975. $1="a".__minus_gt((1));
  56976. $ctx1.sendIdx["->"]=1;
  56977. associations=[$1,"b".__minus_gt((2))];
  56978. $self._assertSameContents_as_($recv($recv($self._class())._collectionClass())._from_(associations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  56979. return self;
  56980. }, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations})});
  56981. },
  56982. args: [],
  56983. 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 }.",
  56984. referencedClasses: [],
  56985. pragmas: [],
  56986. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"]
  56987. }),
  56988. $globals.AssociativeCollectionTest);
  56989. $core.addMethod(
  56990. $core.method({
  56991. selector: "testKeys",
  56992. protocol: "tests",
  56993. fn: function (){
  56994. var self=this,$self=this;
  56995. return $core.withContext(function($ctx1) {
  56996. var $2,$1,$3,$4;
  56997. $2=$recv($recv($self._collectionClass())._new())._keys();
  56998. $ctx1.sendIdx["keys"]=1;
  56999. $1=$recv($2)._isEmpty();
  57000. $self._assert_($1);
  57001. $3=$recv($self._collection())._keys();
  57002. $ctx1.sendIdx["keys"]=2;
  57003. $4=$self._collectionKeys();
  57004. $ctx1.sendIdx["collectionKeys"]=1;
  57005. $self._assertSameContents_as_($3,$4);
  57006. $ctx1.sendIdx["assertSameContents:as:"]=1;
  57007. $self._assertSameContents_as_($recv($self._collectionWithNewValue())._keys(),$recv($self._collectionKeys()).__comma([$self._sampleNewIndex()]));
  57008. return self;
  57009. }, function($ctx1) {$ctx1.fill(self,"testKeys",{})});
  57010. },
  57011. args: [],
  57012. 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 }",
  57013. referencedClasses: [],
  57014. pragmas: [],
  57015. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"]
  57016. }),
  57017. $globals.AssociativeCollectionTest);
  57018. $core.addMethod(
  57019. $core.method({
  57020. selector: "testNewFromPairs",
  57021. protocol: "tests",
  57022. fn: function (){
  57023. var self=this,$self=this;
  57024. var flattenedAssociations;
  57025. return $core.withContext(function($ctx1) {
  57026. flattenedAssociations=["a",(1),"b",(2)];
  57027. $self._assertSameContents_as_($recv($recv($self._class())._collectionClass())._newFromPairs_(flattenedAssociations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  57028. return self;
  57029. }, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations})});
  57030. },
  57031. args: [],
  57032. 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 }.",
  57033. referencedClasses: [],
  57034. pragmas: [],
  57035. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class"]
  57036. }),
  57037. $globals.AssociativeCollectionTest);
  57038. $core.addMethod(
  57039. $core.method({
  57040. selector: "testPrintString",
  57041. protocol: "tests",
  57042. fn: function (){
  57043. var self=this,$self=this;
  57044. return $core.withContext(function($ctx1) {
  57045. var $3,$2,$1,$4;
  57046. $3=$self._collectionClass();
  57047. $ctx1.sendIdx["collectionClass"]=1;
  57048. $2=$recv($3)._new();
  57049. $recv($2)._at_put_("firstname","James");
  57050. $ctx1.sendIdx["at:put:"]=1;
  57051. $recv($2)._at_put_("lastname","Bond");
  57052. $1=$recv($2)._printString();
  57053. $4=$recv("a ".__comma($recv($self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  57054. $ctx1.sendIdx[","]=1;
  57055. $self._assert_equals_($1,$4);
  57056. return self;
  57057. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{})});
  57058. },
  57059. args: [],
  57060. 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'')'",
  57061. referencedClasses: [],
  57062. pragmas: [],
  57063. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"]
  57064. }),
  57065. $globals.AssociativeCollectionTest);
  57066. $core.addMethod(
  57067. $core.method({
  57068. selector: "testRemoveKey",
  57069. protocol: "tests",
  57070. fn: function (){
  57071. var self=this,$self=this;
  57072. return $core.withContext(function($ctx1) {
  57073. var $1,$2,$3,$5,$6,$4,$8,$7;
  57074. $self._nonIndexesDo_((function(each){
  57075. var collection;
  57076. return $core.withContext(function($ctx2) {
  57077. collection=$self._collection();
  57078. $ctx2.sendIdx["collection"]=1;
  57079. $self._should_raise_((function(){
  57080. return $core.withContext(function($ctx3) {
  57081. return $recv(collection)._removeKey_(each);
  57082. $ctx3.sendIdx["removeKey:"]=1;
  57083. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  57084. }),$globals.Error);
  57085. $1=collection;
  57086. $2=$self._collection();
  57087. $ctx2.sendIdx["collection"]=2;
  57088. return $self._assert_equals_($1,$2);
  57089. $ctx2.sendIdx["assert:equals:"]=1;
  57090. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  57091. }));
  57092. $self._samplesDo_((function(index,value){
  57093. var collection;
  57094. return $core.withContext(function($ctx2) {
  57095. collection=$self._collection();
  57096. $ctx2.sendIdx["collection"]=3;
  57097. $3=$recv(collection)._removeKey_(index);
  57098. $ctx2.sendIdx["removeKey:"]=2;
  57099. $self._assert_equals_($3,value);
  57100. $ctx2.sendIdx["assert:equals:"]=2;
  57101. $5=collection;
  57102. $6=$self._collection();
  57103. $ctx2.sendIdx["collection"]=4;
  57104. $4=$recv($5).__eq($6);
  57105. return $self._deny_($4);
  57106. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  57107. }));
  57108. $8=$self._collectionWithNewValue();
  57109. $recv($8)._removeKey_($self._sampleNewIndex());
  57110. $7=$recv($8)._yourself();
  57111. $self._assert_equals_($7,$self._collection());
  57112. return self;
  57113. }, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{})});
  57114. },
  57115. args: [],
  57116. 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",
  57117. referencedClasses: ["Error"],
  57118. pragmas: [],
  57119. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"]
  57120. }),
  57121. $globals.AssociativeCollectionTest);
  57122. $core.addMethod(
  57123. $core.method({
  57124. selector: "testRemoveKeyIfAbsent",
  57125. protocol: "tests",
  57126. fn: function (){
  57127. var self=this,$self=this;
  57128. return $core.withContext(function($ctx1) {
  57129. var $1,$2,$3,$4,$5,$7,$8,$6,$10,$9;
  57130. $self._nonIndexesDo_((function(each){
  57131. var collection;
  57132. return $core.withContext(function($ctx2) {
  57133. collection=$self._collection();
  57134. $ctx2.sendIdx["collection"]=1;
  57135. $1=$recv(collection)._removeKey_ifAbsent_(each,(function(){
  57136. return $core.withContext(function($ctx3) {
  57137. return $self._sampleNewValue();
  57138. $ctx3.sendIdx["sampleNewValue"]=1;
  57139. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  57140. }));
  57141. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  57142. $2=$self._sampleNewValue();
  57143. $ctx2.sendIdx["sampleNewValue"]=2;
  57144. $self._assert_equals_($1,$2);
  57145. $ctx2.sendIdx["assert:equals:"]=1;
  57146. $3=collection;
  57147. $4=$self._collection();
  57148. $ctx2.sendIdx["collection"]=2;
  57149. return $self._assert_equals_($3,$4);
  57150. $ctx2.sendIdx["assert:equals:"]=2;
  57151. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  57152. }));
  57153. $self._samplesDo_((function(index,value){
  57154. var collection;
  57155. return $core.withContext(function($ctx2) {
  57156. collection=$self._collection();
  57157. $ctx2.sendIdx["collection"]=3;
  57158. $5=$recv(collection)._removeKey_ifAbsent_(index,(function(){
  57159. return $core.withContext(function($ctx3) {
  57160. return $self._sampleNewValue();
  57161. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  57162. }));
  57163. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  57164. $self._assert_equals_($5,value);
  57165. $ctx2.sendIdx["assert:equals:"]=3;
  57166. $7=collection;
  57167. $8=$self._collection();
  57168. $ctx2.sendIdx["collection"]=4;
  57169. $6=$recv($7).__eq($8);
  57170. return $self._deny_($6);
  57171. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  57172. }));
  57173. $10=$self._collectionWithNewValue();
  57174. $recv($10)._removeKey_ifAbsent_($self._sampleNewIndex(),(function(){
  57175. return $core.withContext(function($ctx2) {
  57176. return $self._assert_(false);
  57177. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  57178. }));
  57179. $9=$recv($10)._yourself();
  57180. $self._assert_equals_($9,$self._collection());
  57181. return self;
  57182. }, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{})});
  57183. },
  57184. args: [],
  57185. 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",
  57186. referencedClasses: [],
  57187. pragmas: [],
  57188. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"]
  57189. }),
  57190. $globals.AssociativeCollectionTest);
  57191. $core.addMethod(
  57192. $core.method({
  57193. selector: "testValues",
  57194. protocol: "tests",
  57195. fn: function (){
  57196. var self=this,$self=this;
  57197. return $core.withContext(function($ctx1) {
  57198. var $2,$1,$3,$4;
  57199. $2=$recv($recv($self._collectionClass())._new())._values();
  57200. $ctx1.sendIdx["values"]=1;
  57201. $1=$recv($2)._isEmpty();
  57202. $self._assert_($1);
  57203. $3=$recv($self._collection())._values();
  57204. $ctx1.sendIdx["values"]=2;
  57205. $4=$self._collectionValues();
  57206. $ctx1.sendIdx["collectionValues"]=1;
  57207. $self._assertSameContents_as_($3,$4);
  57208. $ctx1.sendIdx["assertSameContents:as:"]=1;
  57209. $self._assertSameContents_as_($recv($self._collectionWithNewValue())._values(),$recv($self._collectionValues()).__comma([$self._sampleNewValue()]));
  57210. return self;
  57211. }, function($ctx1) {$ctx1.fill(self,"testValues",{})});
  57212. },
  57213. args: [],
  57214. 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 }",
  57215. referencedClasses: [],
  57216. pragmas: [],
  57217. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"]
  57218. }),
  57219. $globals.AssociativeCollectionTest);
  57220. $core.addClass("DictionaryTest", $globals.AssociativeCollectionTest, [], "Kernel-Tests");
  57221. $core.addMethod(
  57222. $core.method({
  57223. selector: "collection",
  57224. protocol: "fixture",
  57225. fn: function (){
  57226. var self=this,$self=this;
  57227. return $core.withContext(function($ctx1) {
  57228. var $1;
  57229. $1=$recv($globals.Dictionary)._new();
  57230. $recv($1)._at_put_((1),(1));
  57231. $ctx1.sendIdx["at:put:"]=1;
  57232. $recv($1)._at_put_("a",(2));
  57233. $ctx1.sendIdx["at:put:"]=2;
  57234. $recv($1)._at_put_(true,(3));
  57235. $ctx1.sendIdx["at:put:"]=3;
  57236. $recv($1)._at_put_((1).__at((3)),(-4));
  57237. $ctx1.sendIdx["at:put:"]=4;
  57238. $recv($1)._at_put_($self.sampleBlock,(9));
  57239. return $recv($1)._yourself();
  57240. }, function($ctx1) {$ctx1.fill(self,"collection",{})});
  57241. },
  57242. args: [],
  57243. 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",
  57244. referencedClasses: ["Dictionary"],
  57245. pragmas: [],
  57246. messageSends: ["at:put:", "new", "@", "yourself"]
  57247. }),
  57248. $globals.DictionaryTest);
  57249. $core.addMethod(
  57250. $core.method({
  57251. selector: "collectionKeys",
  57252. protocol: "fixture",
  57253. fn: function (){
  57254. var self=this,$self=this;
  57255. return $core.withContext(function($ctx1) {
  57256. return [(1),"a",true,(1).__at((3)),$self.sampleBlock];
  57257. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{})});
  57258. },
  57259. args: [],
  57260. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3. sampleBlock}",
  57261. referencedClasses: [],
  57262. pragmas: [],
  57263. messageSends: ["@"]
  57264. }),
  57265. $globals.DictionaryTest);
  57266. $core.addMethod(
  57267. $core.method({
  57268. selector: "collectionOfPrintStrings",
  57269. protocol: "fixture",
  57270. fn: function (){
  57271. var self=this,$self=this;
  57272. return $core.withContext(function($ctx1) {
  57273. var $1;
  57274. $1=$recv($globals.Dictionary)._new();
  57275. $recv($1)._at_put_((1),"1");
  57276. $ctx1.sendIdx["at:put:"]=1;
  57277. $recv($1)._at_put_("a","2");
  57278. $ctx1.sendIdx["at:put:"]=2;
  57279. $recv($1)._at_put_(true,"3");
  57280. $ctx1.sendIdx["at:put:"]=3;
  57281. $recv($1)._at_put_((1).__at((3)),"-4");
  57282. $ctx1.sendIdx["at:put:"]=4;
  57283. $recv($1)._at_put_($self.sampleBlock,"9");
  57284. return $recv($1)._yourself();
  57285. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{})});
  57286. },
  57287. args: [],
  57288. 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",
  57289. referencedClasses: ["Dictionary"],
  57290. pragmas: [],
  57291. messageSends: ["at:put:", "new", "@", "yourself"]
  57292. }),
  57293. $globals.DictionaryTest);
  57294. $core.addMethod(
  57295. $core.method({
  57296. selector: "collectionSize",
  57297. protocol: "fixture",
  57298. fn: function (){
  57299. var self=this,$self=this;
  57300. return (5);
  57301. },
  57302. args: [],
  57303. source: "collectionSize\x0a\x09^ 5",
  57304. referencedClasses: [],
  57305. pragmas: [],
  57306. messageSends: []
  57307. }),
  57308. $globals.DictionaryTest);
  57309. $core.addMethod(
  57310. $core.method({
  57311. selector: "collectionValues",
  57312. protocol: "fixture",
  57313. fn: function (){
  57314. var self=this,$self=this;
  57315. return [(1),(2),(3),(-4),(9)];
  57316. },
  57317. args: [],
  57318. source: "collectionValues\x0a\x09^ {1. 2. 3. -4. 9}",
  57319. referencedClasses: [],
  57320. pragmas: [],
  57321. messageSends: []
  57322. }),
  57323. $globals.DictionaryTest);
  57324. $core.addMethod(
  57325. $core.method({
  57326. selector: "collectionWithDuplicates",
  57327. protocol: "fixture",
  57328. fn: function (){
  57329. var self=this,$self=this;
  57330. return $core.withContext(function($ctx1) {
  57331. var $1;
  57332. $1=$recv($globals.Dictionary)._new();
  57333. $recv($1)._at_put_((1),(1));
  57334. $ctx1.sendIdx["at:put:"]=1;
  57335. $recv($1)._at_put_("a",(2));
  57336. $ctx1.sendIdx["at:put:"]=2;
  57337. $recv($1)._at_put_(true,(3));
  57338. $ctx1.sendIdx["at:put:"]=3;
  57339. $recv($1)._at_put_((4),(-4));
  57340. $ctx1.sendIdx["at:put:"]=4;
  57341. $recv($1)._at_put_($self.sampleBlock,(9));
  57342. $ctx1.sendIdx["at:put:"]=5;
  57343. $recv($1)._at_put_("b",(1));
  57344. $ctx1.sendIdx["at:put:"]=6;
  57345. $recv($1)._at_put_((3),(3));
  57346. $ctx1.sendIdx["at:put:"]=7;
  57347. $recv($1)._at_put_(false,(12));
  57348. return $recv($1)._yourself();
  57349. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{})});
  57350. },
  57351. args: [],
  57352. 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",
  57353. referencedClasses: ["Dictionary"],
  57354. pragmas: [],
  57355. messageSends: ["at:put:", "new", "yourself"]
  57356. }),
  57357. $globals.DictionaryTest);
  57358. $core.addMethod(
  57359. $core.method({
  57360. selector: "collectionWithNewValue",
  57361. protocol: "fixture",
  57362. fn: function (){
  57363. var self=this,$self=this;
  57364. return $core.withContext(function($ctx1) {
  57365. var $1;
  57366. $1=$recv($globals.Dictionary)._new();
  57367. $recv($1)._at_put_((1),(1));
  57368. $ctx1.sendIdx["at:put:"]=1;
  57369. $recv($1)._at_put_("a",(2));
  57370. $ctx1.sendIdx["at:put:"]=2;
  57371. $recv($1)._at_put_(true,(3));
  57372. $ctx1.sendIdx["at:put:"]=3;
  57373. $recv($1)._at_put_((1).__at((3)),(-4));
  57374. $ctx1.sendIdx["at:put:"]=4;
  57375. $recv($1)._at_put_($self.sampleBlock,(9));
  57376. $ctx1.sendIdx["at:put:"]=5;
  57377. $recv($1)._at_put_("new","N");
  57378. return $recv($1)._yourself();
  57379. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{})});
  57380. },
  57381. args: [],
  57382. 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",
  57383. referencedClasses: ["Dictionary"],
  57384. pragmas: [],
  57385. messageSends: ["at:put:", "new", "@", "yourself"]
  57386. }),
  57387. $globals.DictionaryTest);
  57388. $core.addMethod(
  57389. $core.method({
  57390. selector: "sampleNewValueAsCollection",
  57391. protocol: "fixture",
  57392. fn: function (){
  57393. var self=this,$self=this;
  57394. return $core.withContext(function($ctx1) {
  57395. var $1;
  57396. $1=$recv($globals.Dictionary)._new();
  57397. $recv($1)._at_put_("new","N");
  57398. return $recv($1)._yourself();
  57399. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{})});
  57400. },
  57401. args: [],
  57402. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  57403. referencedClasses: ["Dictionary"],
  57404. pragmas: [],
  57405. messageSends: ["at:put:", "new", "yourself"]
  57406. }),
  57407. $globals.DictionaryTest);
  57408. $core.addMethod(
  57409. $core.method({
  57410. selector: "samplesDo:",
  57411. protocol: "fixture",
  57412. fn: function (aBlock){
  57413. var self=this,$self=this;
  57414. return $core.withContext(function($ctx1) {
  57415. (
  57416. $ctx1.supercall = true,
  57417. ($globals.DictionaryTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($self, [aBlock]));
  57418. $ctx1.supercall = false;
  57419. $recv(aBlock)._value_value_(true,(3));
  57420. $ctx1.sendIdx["value:value:"]=1;
  57421. $recv(aBlock)._value_value_((1).__at((3)),(-4));
  57422. $ctx1.sendIdx["value:value:"]=2;
  57423. $recv(aBlock)._value_value_($self.sampleBlock,(9));
  57424. return self;
  57425. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock})});
  57426. },
  57427. args: ["aBlock"],
  57428. 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",
  57429. referencedClasses: [],
  57430. pragmas: [],
  57431. messageSends: ["samplesDo:", "value:value:", "@"]
  57432. }),
  57433. $globals.DictionaryTest);
  57434. $core.addMethod(
  57435. $core.method({
  57436. selector: "testAccessing",
  57437. protocol: "tests",
  57438. fn: function (){
  57439. var self=this,$self=this;
  57440. var d;
  57441. return $core.withContext(function($ctx1) {
  57442. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  57443. d=$recv($globals.Dictionary)._new();
  57444. $recv(d)._at_put_("hello","world");
  57445. $ctx1.sendIdx["at:put:"]=1;
  57446. $1=$recv(d)._at_("hello");
  57447. $ctx1.sendIdx["at:"]=1;
  57448. $self._assert_equals_($1,"world");
  57449. $ctx1.sendIdx["assert:equals:"]=1;
  57450. $2=$recv(d)._at_ifAbsent_("hello",(function(){
  57451. return nil;
  57452. }));
  57453. $ctx1.sendIdx["at:ifAbsent:"]=1;
  57454. $self._assert_equals_($2,"world");
  57455. $ctx1.sendIdx["assert:equals:"]=2;
  57456. $self._deny_($recv($recv(d)._at_ifAbsent_("foo",(function(){
  57457. return nil;
  57458. }))).__eq("world"));
  57459. $ctx1.sendIdx["deny:"]=1;
  57460. $3=$recv(d)._includesKey_("hello");
  57461. $ctx1.sendIdx["includesKey:"]=1;
  57462. $self._assert_($3);
  57463. $ctx1.sendIdx["assert:"]=1;
  57464. $4=$recv(d)._includesKey_("foo");
  57465. $ctx1.sendIdx["includesKey:"]=2;
  57466. $self._deny_($4);
  57467. $ctx1.sendIdx["deny:"]=2;
  57468. $recv(d)._at_put_((1),(2));
  57469. $ctx1.sendIdx["at:put:"]=2;
  57470. $5=$recv(d)._at_((1));
  57471. $ctx1.sendIdx["at:"]=2;
  57472. $self._assert_equals_($5,(2));
  57473. $ctx1.sendIdx["assert:equals:"]=3;
  57474. $6=d;
  57475. $7=(1).__at((3));
  57476. $ctx1.sendIdx["@"]=1;
  57477. $recv($6)._at_put_($7,(3));
  57478. $9=d;
  57479. $10=(1).__at((3));
  57480. $ctx1.sendIdx["@"]=2;
  57481. $8=$recv($9)._at_($10);
  57482. $self._assert_equals_($8,(3));
  57483. $12=d;
  57484. $13=(1).__at((3));
  57485. $ctx1.sendIdx["@"]=3;
  57486. $11=$recv($12)._includesKey_($13);
  57487. $ctx1.sendIdx["includesKey:"]=3;
  57488. $self._assert_($11);
  57489. $self._deny_($recv(d)._includesKey_((3).__at((1))));
  57490. return self;
  57491. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d})});
  57492. },
  57493. args: [],
  57494. 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)",
  57495. referencedClasses: ["Dictionary"],
  57496. pragmas: [],
  57497. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"]
  57498. }),
  57499. $globals.DictionaryTest);
  57500. $core.addMethod(
  57501. $core.method({
  57502. selector: "testDynamicDictionaries",
  57503. protocol: "tests",
  57504. fn: function (){
  57505. var self=this,$self=this;
  57506. return $core.withContext(function($ctx1) {
  57507. $self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asDictionary(),$recv($globals.Dictionary)._with_("hello".__minus_gt((1))));
  57508. return self;
  57509. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{})});
  57510. },
  57511. args: [],
  57512. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  57513. referencedClasses: ["Dictionary"],
  57514. pragmas: [],
  57515. messageSends: ["assert:equals:", "asDictionary", "with:", "->"]
  57516. }),
  57517. $globals.DictionaryTest);
  57518. $core.addMethod(
  57519. $core.method({
  57520. selector: "collectionClass",
  57521. protocol: "fixture",
  57522. fn: function (){
  57523. var self=this,$self=this;
  57524. return $globals.Dictionary;
  57525. },
  57526. args: [],
  57527. source: "collectionClass\x0a\x09^ Dictionary",
  57528. referencedClasses: ["Dictionary"],
  57529. pragmas: [],
  57530. messageSends: []
  57531. }),
  57532. $globals.DictionaryTest.a$cls);
  57533. $core.addClass("HashedCollectionTest", $globals.AssociativeCollectionTest, [], "Kernel-Tests");
  57534. $core.addMethod(
  57535. $core.method({
  57536. selector: "collection",
  57537. protocol: "fixture",
  57538. fn: function (){
  57539. var self=this,$self=this;
  57540. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4)]);
  57541. },
  57542. args: [],
  57543. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  57544. referencedClasses: [],
  57545. pragmas: [],
  57546. messageSends: []
  57547. }),
  57548. $globals.HashedCollectionTest);
  57549. $core.addMethod(
  57550. $core.method({
  57551. selector: "collectionKeys",
  57552. protocol: "fixture",
  57553. fn: function (){
  57554. var self=this,$self=this;
  57555. return ["b","a","c","d"];
  57556. },
  57557. args: [],
  57558. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  57559. referencedClasses: [],
  57560. pragmas: [],
  57561. messageSends: []
  57562. }),
  57563. $globals.HashedCollectionTest);
  57564. $core.addMethod(
  57565. $core.method({
  57566. selector: "collectionOfPrintStrings",
  57567. protocol: "fixture",
  57568. fn: function (){
  57569. var self=this,$self=this;
  57570. return $globals.HashedCollection._newFromPairs_(["b","1","a","2","c","3","d","-4"]);
  57571. },
  57572. args: [],
  57573. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  57574. referencedClasses: [],
  57575. pragmas: [],
  57576. messageSends: []
  57577. }),
  57578. $globals.HashedCollectionTest);
  57579. $core.addMethod(
  57580. $core.method({
  57581. selector: "collectionSize",
  57582. protocol: "fixture",
  57583. fn: function (){
  57584. var self=this,$self=this;
  57585. return (4);
  57586. },
  57587. args: [],
  57588. source: "collectionSize\x0a\x09^ 4",
  57589. referencedClasses: [],
  57590. pragmas: [],
  57591. messageSends: []
  57592. }),
  57593. $globals.HashedCollectionTest);
  57594. $core.addMethod(
  57595. $core.method({
  57596. selector: "collectionValues",
  57597. protocol: "fixture",
  57598. fn: function (){
  57599. var self=this,$self=this;
  57600. return [(1),(2),(3),(-4)];
  57601. },
  57602. args: [],
  57603. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  57604. referencedClasses: [],
  57605. pragmas: [],
  57606. messageSends: []
  57607. }),
  57608. $globals.HashedCollectionTest);
  57609. $core.addMethod(
  57610. $core.method({
  57611. selector: "collectionWithDuplicates",
  57612. protocol: "fixture",
  57613. fn: function (){
  57614. var self=this,$self=this;
  57615. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"e",(1),"f",(2),"g",(10),"h",(0)]);
  57616. },
  57617. args: [],
  57618. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10. 'h' -> 0 }",
  57619. referencedClasses: [],
  57620. pragmas: [],
  57621. messageSends: []
  57622. }),
  57623. $globals.HashedCollectionTest);
  57624. $core.addMethod(
  57625. $core.method({
  57626. selector: "collectionWithNewValue",
  57627. protocol: "fixture",
  57628. fn: function (){
  57629. var self=this,$self=this;
  57630. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"new","N"]);
  57631. },
  57632. args: [],
  57633. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  57634. referencedClasses: [],
  57635. pragmas: [],
  57636. messageSends: []
  57637. }),
  57638. $globals.HashedCollectionTest);
  57639. $core.addMethod(
  57640. $core.method({
  57641. selector: "sampleNewValueAsCollection",
  57642. protocol: "fixture",
  57643. fn: function (){
  57644. var self=this,$self=this;
  57645. return $globals.HashedCollection._newFromPairs_(["new","N"]);
  57646. },
  57647. args: [],
  57648. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  57649. referencedClasses: [],
  57650. pragmas: [],
  57651. messageSends: []
  57652. }),
  57653. $globals.HashedCollectionTest);
  57654. $core.addMethod(
  57655. $core.method({
  57656. selector: "testDynamicDictionaries",
  57657. protocol: "tests",
  57658. fn: function (){
  57659. var self=this,$self=this;
  57660. return $core.withContext(function($ctx1) {
  57661. $self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asHashedCollection(),$recv($globals.HashedCollection)._with_("hello".__minus_gt((1))));
  57662. return self;
  57663. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{})});
  57664. },
  57665. args: [],
  57666. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  57667. referencedClasses: ["HashedCollection"],
  57668. pragmas: [],
  57669. messageSends: ["assert:equals:", "asHashedCollection", "with:", "->"]
  57670. }),
  57671. $globals.HashedCollectionTest);
  57672. $core.addMethod(
  57673. $core.method({
  57674. selector: "collectionClass",
  57675. protocol: "fixture",
  57676. fn: function (){
  57677. var self=this,$self=this;
  57678. return $globals.HashedCollection;
  57679. },
  57680. args: [],
  57681. source: "collectionClass\x0a\x09^ HashedCollection",
  57682. referencedClasses: ["HashedCollection"],
  57683. pragmas: [],
  57684. messageSends: []
  57685. }),
  57686. $globals.HashedCollectionTest.a$cls);
  57687. $core.addClass("SequenceableCollectionTest", $globals.IndexableCollectionTest, [], "Kernel-Tests");
  57688. $core.addMethod(
  57689. $core.method({
  57690. selector: "collectionFirst",
  57691. protocol: "fixture",
  57692. fn: function (){
  57693. var self=this,$self=this;
  57694. return $core.withContext(function($ctx1) {
  57695. $self._subclassResponsibility();
  57696. return self;
  57697. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{})});
  57698. },
  57699. args: [],
  57700. source: "collectionFirst\x0a\x09self subclassResponsibility",
  57701. referencedClasses: [],
  57702. pragmas: [],
  57703. messageSends: ["subclassResponsibility"]
  57704. }),
  57705. $globals.SequenceableCollectionTest);
  57706. $core.addMethod(
  57707. $core.method({
  57708. selector: "collectionFirstTwo",
  57709. protocol: "fixture",
  57710. fn: function (){
  57711. var self=this,$self=this;
  57712. return $core.withContext(function($ctx1) {
  57713. $self._subclassResponsibility();
  57714. return self;
  57715. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{})});
  57716. },
  57717. args: [],
  57718. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  57719. referencedClasses: [],
  57720. pragmas: [],
  57721. messageSends: ["subclassResponsibility"]
  57722. }),
  57723. $globals.SequenceableCollectionTest);
  57724. $core.addMethod(
  57725. $core.method({
  57726. selector: "collectionLast",
  57727. protocol: "fixture",
  57728. fn: function (){
  57729. var self=this,$self=this;
  57730. return $core.withContext(function($ctx1) {
  57731. $self._subclassResponsibility();
  57732. return self;
  57733. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{})});
  57734. },
  57735. args: [],
  57736. source: "collectionLast\x0a\x09self subclassResponsibility",
  57737. referencedClasses: [],
  57738. pragmas: [],
  57739. messageSends: ["subclassResponsibility"]
  57740. }),
  57741. $globals.SequenceableCollectionTest);
  57742. $core.addMethod(
  57743. $core.method({
  57744. selector: "collectionLastTwo",
  57745. protocol: "fixture",
  57746. fn: function (){
  57747. var self=this,$self=this;
  57748. return $core.withContext(function($ctx1) {
  57749. $self._subclassResponsibility();
  57750. return self;
  57751. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{})});
  57752. },
  57753. args: [],
  57754. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  57755. referencedClasses: [],
  57756. pragmas: [],
  57757. messageSends: ["subclassResponsibility"]
  57758. }),
  57759. $globals.SequenceableCollectionTest);
  57760. $core.addMethod(
  57761. $core.method({
  57762. selector: "nonIndexesDo:",
  57763. protocol: "fixture",
  57764. fn: function (aBlock){
  57765. var self=this,$self=this;
  57766. return $core.withContext(function($ctx1) {
  57767. $recv(aBlock)._value_((0));
  57768. $ctx1.sendIdx["value:"]=1;
  57769. $recv(aBlock)._value_($recv($self._collectionSize()).__plus((1)));
  57770. $ctx1.sendIdx["value:"]=2;
  57771. $recv(aBlock)._value_("z");
  57772. return self;
  57773. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock})});
  57774. },
  57775. args: ["aBlock"],
  57776. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  57777. referencedClasses: [],
  57778. pragmas: [],
  57779. messageSends: ["value:", "+", "collectionSize"]
  57780. }),
  57781. $globals.SequenceableCollectionTest);
  57782. $core.addMethod(
  57783. $core.method({
  57784. selector: "samplesDo:",
  57785. protocol: "fixture",
  57786. fn: function (aBlock){
  57787. var self=this,$self=this;
  57788. return $core.withContext(function($ctx1) {
  57789. $recv(aBlock)._value_value_((1),$self._collectionFirst());
  57790. $ctx1.sendIdx["value:value:"]=1;
  57791. $recv(aBlock)._value_value_($self._collectionSize(),$self._collectionLast());
  57792. return self;
  57793. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock})});
  57794. },
  57795. args: ["aBlock"],
  57796. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  57797. referencedClasses: [],
  57798. pragmas: [],
  57799. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"]
  57800. }),
  57801. $globals.SequenceableCollectionTest);
  57802. $core.addMethod(
  57803. $core.method({
  57804. selector: "testBeginsWith",
  57805. protocol: "tests",
  57806. fn: function (){
  57807. var self=this,$self=this;
  57808. return $core.withContext(function($ctx1) {
  57809. var $2,$1,$4,$5,$3,$7,$6;
  57810. $2=$self._collection();
  57811. $ctx1.sendIdx["collection"]=1;
  57812. $1=$recv($2)._beginsWith_($recv($self._collectionClass())._new());
  57813. $ctx1.sendIdx["beginsWith:"]=1;
  57814. $self._assert_($1);
  57815. $ctx1.sendIdx["assert:"]=1;
  57816. $4=$self._collection();
  57817. $ctx1.sendIdx["collection"]=2;
  57818. $5=$self._collection();
  57819. $ctx1.sendIdx["collection"]=3;
  57820. $3=$recv($4)._beginsWith_($5);
  57821. $ctx1.sendIdx["beginsWith:"]=2;
  57822. $self._assert_($3);
  57823. $ctx1.sendIdx["assert:"]=2;
  57824. $7=$self._collection();
  57825. $ctx1.sendIdx["collection"]=4;
  57826. $6=$recv($7)._beginsWith_($self._collectionFirstTwo());
  57827. $ctx1.sendIdx["beginsWith:"]=3;
  57828. $self._assert_($6);
  57829. $self._deny_($recv($self._collection())._beginsWith_($self._collectionLastTwo()));
  57830. return self;
  57831. }, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{})});
  57832. },
  57833. args: [],
  57834. 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)",
  57835. referencedClasses: [],
  57836. pragmas: [],
  57837. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"]
  57838. }),
  57839. $globals.SequenceableCollectionTest);
  57840. $core.addMethod(
  57841. $core.method({
  57842. selector: "testEndsWith",
  57843. protocol: "tests",
  57844. fn: function (){
  57845. var self=this,$self=this;
  57846. return $core.withContext(function($ctx1) {
  57847. var $2,$1,$4,$5,$3,$7,$6;
  57848. $2=$self._collection();
  57849. $ctx1.sendIdx["collection"]=1;
  57850. $1=$recv($2)._endsWith_($recv($self._collectionClass())._new());
  57851. $ctx1.sendIdx["endsWith:"]=1;
  57852. $self._assert_($1);
  57853. $ctx1.sendIdx["assert:"]=1;
  57854. $4=$self._collection();
  57855. $ctx1.sendIdx["collection"]=2;
  57856. $5=$self._collection();
  57857. $ctx1.sendIdx["collection"]=3;
  57858. $3=$recv($4)._endsWith_($5);
  57859. $ctx1.sendIdx["endsWith:"]=2;
  57860. $self._assert_($3);
  57861. $ctx1.sendIdx["assert:"]=2;
  57862. $7=$self._collection();
  57863. $ctx1.sendIdx["collection"]=4;
  57864. $6=$recv($7)._endsWith_($self._collectionLastTwo());
  57865. $ctx1.sendIdx["endsWith:"]=3;
  57866. $self._assert_($6);
  57867. $self._deny_($recv($self._collection())._endsWith_($self._collectionFirstTwo()));
  57868. return self;
  57869. }, function($ctx1) {$ctx1.fill(self,"testEndsWith",{})});
  57870. },
  57871. args: [],
  57872. 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)",
  57873. referencedClasses: [],
  57874. pragmas: [],
  57875. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"]
  57876. }),
  57877. $globals.SequenceableCollectionTest);
  57878. $core.addMethod(
  57879. $core.method({
  57880. selector: "testFirst",
  57881. protocol: "tests",
  57882. fn: function (){
  57883. var self=this,$self=this;
  57884. return $core.withContext(function($ctx1) {
  57885. $self._assert_equals_($recv($self._collection())._first(),$self._collectionFirst());
  57886. return self;
  57887. }, function($ctx1) {$ctx1.fill(self,"testFirst",{})});
  57888. },
  57889. args: [],
  57890. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  57891. referencedClasses: [],
  57892. pragmas: [],
  57893. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"]
  57894. }),
  57895. $globals.SequenceableCollectionTest);
  57896. $core.addMethod(
  57897. $core.method({
  57898. selector: "testFirstN",
  57899. protocol: "tests",
  57900. fn: function (){
  57901. var self=this,$self=this;
  57902. return $core.withContext(function($ctx1) {
  57903. var $2,$1,$4,$3,$6,$5,$7;
  57904. $2=$self._collection();
  57905. $ctx1.sendIdx["collection"]=1;
  57906. $1=$recv($2)._first_((2));
  57907. $ctx1.sendIdx["first:"]=1;
  57908. $self._assert_equals_($1,$self._collectionFirstTwo());
  57909. $ctx1.sendIdx["assert:equals:"]=1;
  57910. $4=$self._collection();
  57911. $ctx1.sendIdx["collection"]=2;
  57912. $3=$recv($4)._first_((0));
  57913. $ctx1.sendIdx["first:"]=2;
  57914. $self._assert_equals_($3,$recv($self._collectionClass())._new());
  57915. $ctx1.sendIdx["assert:equals:"]=2;
  57916. $6=$self._collection();
  57917. $ctx1.sendIdx["collection"]=3;
  57918. $5=$recv($6)._first_($self._collectionSize());
  57919. $ctx1.sendIdx["first:"]=3;
  57920. $7=$self._collection();
  57921. $ctx1.sendIdx["collection"]=4;
  57922. $self._assert_equals_($5,$7);
  57923. $self._should_raise_((function(){
  57924. return $core.withContext(function($ctx2) {
  57925. return $recv($self._collection())._first_((33));
  57926. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57927. }),$globals.Error);
  57928. return self;
  57929. }, function($ctx1) {$ctx1.fill(self,"testFirstN",{})});
  57930. },
  57931. args: [],
  57932. 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",
  57933. referencedClasses: ["Error"],
  57934. pragmas: [],
  57935. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  57936. }),
  57937. $globals.SequenceableCollectionTest);
  57938. $core.addMethod(
  57939. $core.method({
  57940. selector: "testFourth",
  57941. protocol: "tests",
  57942. fn: function (){
  57943. var self=this,$self=this;
  57944. return $core.withContext(function($ctx1) {
  57945. var $2,$1;
  57946. $2=$self._collection();
  57947. $ctx1.sendIdx["collection"]=1;
  57948. $1=$recv($2)._fourth();
  57949. $self._assert_equals_($1,$recv($self._collection())._at_((4)));
  57950. return self;
  57951. }, function($ctx1) {$ctx1.fill(self,"testFourth",{})});
  57952. },
  57953. args: [],
  57954. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  57955. referencedClasses: [],
  57956. pragmas: [],
  57957. messageSends: ["assert:equals:", "fourth", "collection", "at:"]
  57958. }),
  57959. $globals.SequenceableCollectionTest);
  57960. $core.addMethod(
  57961. $core.method({
  57962. selector: "testIndexOfStartingAt",
  57963. protocol: "tests",
  57964. fn: function (){
  57965. var self=this,$self=this;
  57966. var jsNull;
  57967. return $core.withContext(function($ctx1) {
  57968. var $2,$1,$4,$3;
  57969. jsNull=$recv($globals.JSON)._parse_("null");
  57970. $self._samplesDo_((function(index,value){
  57971. return $core.withContext(function($ctx2) {
  57972. $2=$self._collection();
  57973. $ctx2.sendIdx["collection"]=1;
  57974. $1=$recv($2)._indexOf_startingAt_(value,(1));
  57975. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  57976. $self._assert_equals_($1,index);
  57977. $ctx2.sendIdx["assert:equals:"]=1;
  57978. $4=$self._collection();
  57979. $ctx2.sendIdx["collection"]=2;
  57980. $3=$recv($4)._indexOf_startingAt_(value,index);
  57981. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  57982. $self._assert_equals_($3,index);
  57983. $ctx2.sendIdx["assert:equals:"]=2;
  57984. return $self._assert_equals_($recv($self._collection())._indexOf_startingAt_(value,$recv(index).__plus((1))),(0));
  57985. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  57986. }));
  57987. return self;
  57988. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull})});
  57989. },
  57990. args: [],
  57991. 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 ]",
  57992. referencedClasses: ["JSON"],
  57993. pragmas: [],
  57994. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"]
  57995. }),
  57996. $globals.SequenceableCollectionTest);
  57997. $core.addMethod(
  57998. $core.method({
  57999. selector: "testIndexOfStartingAtWithNull",
  58000. protocol: "tests",
  58001. fn: function (){
  58002. var self=this,$self=this;
  58003. var jsNull;
  58004. return $core.withContext(function($ctx1) {
  58005. var $1,$2;
  58006. jsNull=$recv($globals.JSON)._parse_("null");
  58007. $self._samplesDo_((function(index,value){
  58008. var collection;
  58009. return $core.withContext(function($ctx2) {
  58010. collection=$self._collection();
  58011. $recv(collection)._at_put_(index,jsNull);
  58012. $1=$recv(collection)._indexOf_startingAt_(jsNull,(1));
  58013. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  58014. $self._assert_equals_($1,index);
  58015. $ctx2.sendIdx["assert:equals:"]=1;
  58016. $2=$recv(collection)._indexOf_startingAt_(jsNull,index);
  58017. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  58018. $self._assert_equals_($2,index);
  58019. $ctx2.sendIdx["assert:equals:"]=2;
  58020. return $self._assert_equals_($recv(collection)._indexOf_startingAt_(jsNull,$recv(index).__plus((1))),(0));
  58021. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)});
  58022. }));
  58023. return self;
  58024. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull})});
  58025. },
  58026. args: [],
  58027. 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 ]",
  58028. referencedClasses: ["JSON"],
  58029. pragmas: [],
  58030. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"]
  58031. }),
  58032. $globals.SequenceableCollectionTest);
  58033. $core.addMethod(
  58034. $core.method({
  58035. selector: "testLast",
  58036. protocol: "tests",
  58037. fn: function (){
  58038. var self=this,$self=this;
  58039. return $core.withContext(function($ctx1) {
  58040. $self._assert_equals_($recv($self._collection())._last(),$self._collectionLast());
  58041. return self;
  58042. }, function($ctx1) {$ctx1.fill(self,"testLast",{})});
  58043. },
  58044. args: [],
  58045. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  58046. referencedClasses: [],
  58047. pragmas: [],
  58048. messageSends: ["assert:equals:", "last", "collection", "collectionLast"]
  58049. }),
  58050. $globals.SequenceableCollectionTest);
  58051. $core.addMethod(
  58052. $core.method({
  58053. selector: "testLastN",
  58054. protocol: "tests",
  58055. fn: function (){
  58056. var self=this,$self=this;
  58057. return $core.withContext(function($ctx1) {
  58058. var $2,$1,$4,$3,$6,$5,$7;
  58059. $2=$self._collection();
  58060. $ctx1.sendIdx["collection"]=1;
  58061. $1=$recv($2)._last_((2));
  58062. $ctx1.sendIdx["last:"]=1;
  58063. $self._assert_equals_($1,$self._collectionLastTwo());
  58064. $ctx1.sendIdx["assert:equals:"]=1;
  58065. $4=$self._collection();
  58066. $ctx1.sendIdx["collection"]=2;
  58067. $3=$recv($4)._last_((0));
  58068. $ctx1.sendIdx["last:"]=2;
  58069. $self._assert_equals_($3,$recv($self._collectionClass())._new());
  58070. $ctx1.sendIdx["assert:equals:"]=2;
  58071. $6=$self._collection();
  58072. $ctx1.sendIdx["collection"]=3;
  58073. $5=$recv($6)._last_($self._collectionSize());
  58074. $ctx1.sendIdx["last:"]=3;
  58075. $7=$self._collection();
  58076. $ctx1.sendIdx["collection"]=4;
  58077. $self._assert_equals_($5,$7);
  58078. $self._should_raise_((function(){
  58079. return $core.withContext(function($ctx2) {
  58080. return $recv($self._collection())._last_((33));
  58081. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58082. }),$globals.Error);
  58083. return self;
  58084. }, function($ctx1) {$ctx1.fill(self,"testLastN",{})});
  58085. },
  58086. args: [],
  58087. 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",
  58088. referencedClasses: ["Error"],
  58089. pragmas: [],
  58090. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  58091. }),
  58092. $globals.SequenceableCollectionTest);
  58093. $core.addMethod(
  58094. $core.method({
  58095. selector: "testSecond",
  58096. protocol: "tests",
  58097. fn: function (){
  58098. var self=this,$self=this;
  58099. return $core.withContext(function($ctx1) {
  58100. var $2,$1;
  58101. $2=$self._collection();
  58102. $ctx1.sendIdx["collection"]=1;
  58103. $1=$recv($2)._second();
  58104. $self._assert_equals_($1,$recv($self._collection())._at_((2)));
  58105. return self;
  58106. }, function($ctx1) {$ctx1.fill(self,"testSecond",{})});
  58107. },
  58108. args: [],
  58109. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  58110. referencedClasses: [],
  58111. pragmas: [],
  58112. messageSends: ["assert:equals:", "second", "collection", "at:"]
  58113. }),
  58114. $globals.SequenceableCollectionTest);
  58115. $core.addMethod(
  58116. $core.method({
  58117. selector: "testThird",
  58118. protocol: "tests",
  58119. fn: function (){
  58120. var self=this,$self=this;
  58121. return $core.withContext(function($ctx1) {
  58122. var $2,$1;
  58123. $2=$self._collection();
  58124. $ctx1.sendIdx["collection"]=1;
  58125. $1=$recv($2)._third();
  58126. $self._assert_equals_($1,$recv($self._collection())._at_((3)));
  58127. return self;
  58128. }, function($ctx1) {$ctx1.fill(self,"testThird",{})});
  58129. },
  58130. args: [],
  58131. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  58132. referencedClasses: [],
  58133. pragmas: [],
  58134. messageSends: ["assert:equals:", "third", "collection", "at:"]
  58135. }),
  58136. $globals.SequenceableCollectionTest);
  58137. $core.addClass("ArrayTest", $globals.SequenceableCollectionTest, [], "Kernel-Tests");
  58138. $core.addMethod(
  58139. $core.method({
  58140. selector: "collection",
  58141. protocol: "fixture",
  58142. fn: function (){
  58143. var self=this,$self=this;
  58144. return [(1), (2), (3), (-4)];
  58145. },
  58146. args: [],
  58147. source: "collection\x0a\x09^ #(1 2 3 -4)",
  58148. referencedClasses: [],
  58149. pragmas: [],
  58150. messageSends: []
  58151. }),
  58152. $globals.ArrayTest);
  58153. $core.addMethod(
  58154. $core.method({
  58155. selector: "collectionFirst",
  58156. protocol: "fixture",
  58157. fn: function (){
  58158. var self=this,$self=this;
  58159. return (1);
  58160. },
  58161. args: [],
  58162. source: "collectionFirst\x0a\x09^ 1",
  58163. referencedClasses: [],
  58164. pragmas: [],
  58165. messageSends: []
  58166. }),
  58167. $globals.ArrayTest);
  58168. $core.addMethod(
  58169. $core.method({
  58170. selector: "collectionFirstTwo",
  58171. protocol: "fixture",
  58172. fn: function (){
  58173. var self=this,$self=this;
  58174. return [(1), (2)];
  58175. },
  58176. args: [],
  58177. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  58178. referencedClasses: [],
  58179. pragmas: [],
  58180. messageSends: []
  58181. }),
  58182. $globals.ArrayTest);
  58183. $core.addMethod(
  58184. $core.method({
  58185. selector: "collectionLast",
  58186. protocol: "fixture",
  58187. fn: function (){
  58188. var self=this,$self=this;
  58189. return (-4);
  58190. },
  58191. args: [],
  58192. source: "collectionLast\x0a\x09^ -4",
  58193. referencedClasses: [],
  58194. pragmas: [],
  58195. messageSends: []
  58196. }),
  58197. $globals.ArrayTest);
  58198. $core.addMethod(
  58199. $core.method({
  58200. selector: "collectionLastTwo",
  58201. protocol: "fixture",
  58202. fn: function (){
  58203. var self=this,$self=this;
  58204. return [(3), (-4)];
  58205. },
  58206. args: [],
  58207. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  58208. referencedClasses: [],
  58209. pragmas: [],
  58210. messageSends: []
  58211. }),
  58212. $globals.ArrayTest);
  58213. $core.addMethod(
  58214. $core.method({
  58215. selector: "collectionOfPrintStrings",
  58216. protocol: "fixture",
  58217. fn: function (){
  58218. var self=this,$self=this;
  58219. return ["1", "2", "3", "-4"];
  58220. },
  58221. args: [],
  58222. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  58223. referencedClasses: [],
  58224. pragmas: [],
  58225. messageSends: []
  58226. }),
  58227. $globals.ArrayTest);
  58228. $core.addMethod(
  58229. $core.method({
  58230. selector: "collectionSize",
  58231. protocol: "fixture",
  58232. fn: function (){
  58233. var self=this,$self=this;
  58234. return (4);
  58235. },
  58236. args: [],
  58237. source: "collectionSize\x0a\x09^ 4",
  58238. referencedClasses: [],
  58239. pragmas: [],
  58240. messageSends: []
  58241. }),
  58242. $globals.ArrayTest);
  58243. $core.addMethod(
  58244. $core.method({
  58245. selector: "collectionWithDuplicates",
  58246. protocol: "fixture",
  58247. fn: function (){
  58248. var self=this,$self=this;
  58249. return ["a", "b", "c", (1), (2), (1), "a", []];
  58250. },
  58251. args: [],
  58252. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a' ())",
  58253. referencedClasses: [],
  58254. pragmas: [],
  58255. messageSends: []
  58256. }),
  58257. $globals.ArrayTest);
  58258. $core.addMethod(
  58259. $core.method({
  58260. selector: "collectionWithNewValue",
  58261. protocol: "fixture",
  58262. fn: function (){
  58263. var self=this,$self=this;
  58264. return [(1), (2), (3), (-4), "N"];
  58265. },
  58266. args: [],
  58267. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  58268. referencedClasses: [],
  58269. pragmas: [],
  58270. messageSends: []
  58271. }),
  58272. $globals.ArrayTest);
  58273. $core.addMethod(
  58274. $core.method({
  58275. selector: "sampleNewIndex",
  58276. protocol: "fixture",
  58277. fn: function (){
  58278. var self=this,$self=this;
  58279. return (5);
  58280. },
  58281. args: [],
  58282. source: "sampleNewIndex\x0a\x09^ 5",
  58283. referencedClasses: [],
  58284. pragmas: [],
  58285. messageSends: []
  58286. }),
  58287. $globals.ArrayTest);
  58288. $core.addMethod(
  58289. $core.method({
  58290. selector: "samplesDo:",
  58291. protocol: "fixture",
  58292. fn: function (aBlock){
  58293. var self=this,$self=this;
  58294. return $core.withContext(function($ctx1) {
  58295. (
  58296. $ctx1.supercall = true,
  58297. ($globals.ArrayTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($self, [aBlock]));
  58298. $ctx1.supercall = false;
  58299. $recv(aBlock)._value_value_((3),(3));
  58300. return self;
  58301. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock})});
  58302. },
  58303. args: ["aBlock"],
  58304. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  58305. referencedClasses: [],
  58306. pragmas: [],
  58307. messageSends: ["samplesDo:", "value:value:"]
  58308. }),
  58309. $globals.ArrayTest);
  58310. $core.addMethod(
  58311. $core.method({
  58312. selector: "testAdd",
  58313. protocol: "tests",
  58314. fn: function (){
  58315. var self=this,$self=this;
  58316. var array;
  58317. return $core.withContext(function($ctx1) {
  58318. array=$self._collection();
  58319. $recv(array)._add_((6));
  58320. $self._assert_equals_($recv(array)._last(),(6));
  58321. return self;
  58322. }, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array})});
  58323. },
  58324. args: [],
  58325. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  58326. referencedClasses: [],
  58327. pragmas: [],
  58328. messageSends: ["collection", "add:", "assert:equals:", "last"]
  58329. }),
  58330. $globals.ArrayTest);
  58331. $core.addMethod(
  58332. $core.method({
  58333. selector: "testAddFirst",
  58334. protocol: "tests",
  58335. fn: function (){
  58336. var self=this,$self=this;
  58337. return $core.withContext(function($ctx1) {
  58338. var $3,$2,$1;
  58339. $3=$self._collection();
  58340. $recv($3)._addFirst_((0));
  58341. $2=$recv($3)._yourself();
  58342. $1=$recv($2)._first();
  58343. $self._assert_equals_($1,(0));
  58344. return self;
  58345. }, function($ctx1) {$ctx1.fill(self,"testAddFirst",{})});
  58346. },
  58347. args: [],
  58348. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  58349. referencedClasses: [],
  58350. pragmas: [],
  58351. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"]
  58352. }),
  58353. $globals.ArrayTest);
  58354. $core.addMethod(
  58355. $core.method({
  58356. selector: "testPrintString",
  58357. protocol: "tests",
  58358. fn: function (){
  58359. var self=this,$self=this;
  58360. var array;
  58361. return $core.withContext(function($ctx1) {
  58362. var $1,$2,$3,$4,$5,$6,$7;
  58363. array=$recv($globals.Array)._new();
  58364. $1=$recv(array)._printString();
  58365. $ctx1.sendIdx["printString"]=1;
  58366. $self._assert_equals_($1,"an Array ()");
  58367. $ctx1.sendIdx["assert:equals:"]=1;
  58368. $2=array;
  58369. $recv($2)._add_((1));
  58370. $ctx1.sendIdx["add:"]=1;
  58371. $recv($2)._add_((3));
  58372. $ctx1.sendIdx["add:"]=2;
  58373. $3=$recv(array)._printString();
  58374. $ctx1.sendIdx["printString"]=2;
  58375. $self._assert_equals_($3,"an Array (1 3)");
  58376. $ctx1.sendIdx["assert:equals:"]=2;
  58377. $recv(array)._add_("foo");
  58378. $4=$recv(array)._printString();
  58379. $ctx1.sendIdx["printString"]=3;
  58380. $self._assert_equals_($4,"an Array (1 3 'foo')");
  58381. $ctx1.sendIdx["assert:equals:"]=3;
  58382. $5=array;
  58383. $recv($5)._remove_((1));
  58384. $ctx1.sendIdx["remove:"]=1;
  58385. $recv($5)._remove_((3));
  58386. $6=$recv(array)._printString();
  58387. $ctx1.sendIdx["printString"]=4;
  58388. $self._assert_equals_($6,"an Array ('foo')");
  58389. $ctx1.sendIdx["assert:equals:"]=4;
  58390. $recv(array)._addLast_((3));
  58391. $ctx1.sendIdx["addLast:"]=1;
  58392. $7=$recv(array)._printString();
  58393. $ctx1.sendIdx["printString"]=5;
  58394. $self._assert_equals_($7,"an Array ('foo' 3)");
  58395. $ctx1.sendIdx["assert:equals:"]=5;
  58396. $recv(array)._addLast_((3));
  58397. $self._assert_equals_($recv(array)._printString(),"an Array ('foo' 3 3)");
  58398. return self;
  58399. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array})});
  58400. },
  58401. args: [],
  58402. 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)'.",
  58403. referencedClasses: ["Array"],
  58404. pragmas: [],
  58405. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"]
  58406. }),
  58407. $globals.ArrayTest);
  58408. $core.addMethod(
  58409. $core.method({
  58410. selector: "testRemove",
  58411. protocol: "tests",
  58412. fn: function (){
  58413. var self=this,$self=this;
  58414. var array;
  58415. return $core.withContext(function($ctx1) {
  58416. array=[(1), (2), (3), (4), (5)];
  58417. $recv(array)._remove_((3));
  58418. $ctx1.sendIdx["remove:"]=1;
  58419. $self._assert_equals_(array,[(1), (2), (4), (5)]);
  58420. $self._should_raise_((function(){
  58421. return $core.withContext(function($ctx2) {
  58422. return $recv(array)._remove_((3));
  58423. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58424. }),$globals.Error);
  58425. return self;
  58426. }, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array})});
  58427. },
  58428. args: [],
  58429. 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",
  58430. referencedClasses: ["Error"],
  58431. pragmas: [],
  58432. messageSends: ["remove:", "assert:equals:", "should:raise:"]
  58433. }),
  58434. $globals.ArrayTest);
  58435. $core.addMethod(
  58436. $core.method({
  58437. selector: "testRemoveFromTo",
  58438. protocol: "tests",
  58439. fn: function (){
  58440. var self=this,$self=this;
  58441. return $core.withContext(function($ctx1) {
  58442. var $1,$2;
  58443. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  58444. $ctx1.sendIdx["removeFrom:to:"]=1;
  58445. $self._assert_equals_($1,[(4)]);
  58446. $ctx1.sendIdx["assert:equals:"]=1;
  58447. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  58448. $ctx1.sendIdx["removeFrom:to:"]=2;
  58449. $self._assert_equals_($2,[(1), (4)]);
  58450. $ctx1.sendIdx["assert:equals:"]=2;
  58451. $self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  58452. return self;
  58453. }, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{})});
  58454. },
  58455. args: [],
  58456. 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)",
  58457. referencedClasses: [],
  58458. pragmas: [],
  58459. messageSends: ["assert:equals:", "removeFrom:to:"]
  58460. }),
  58461. $globals.ArrayTest);
  58462. $core.addMethod(
  58463. $core.method({
  58464. selector: "testRemoveIndex",
  58465. protocol: "tests",
  58466. fn: function (){
  58467. var self=this,$self=this;
  58468. return $core.withContext(function($ctx1) {
  58469. var $1,$2;
  58470. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  58471. $ctx1.sendIdx["removeIndex:"]=1;
  58472. $self._assert_equals_($1,[(1), (3), (4)]);
  58473. $ctx1.sendIdx["assert:equals:"]=1;
  58474. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  58475. $ctx1.sendIdx["removeIndex:"]=2;
  58476. $self._assert_equals_($2,[(2), (3), (4)]);
  58477. $ctx1.sendIdx["assert:equals:"]=2;
  58478. $self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  58479. return self;
  58480. }, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{})});
  58481. },
  58482. args: [],
  58483. 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: #()",
  58484. referencedClasses: [],
  58485. pragmas: [],
  58486. messageSends: ["assert:equals:", "removeIndex:"]
  58487. }),
  58488. $globals.ArrayTest);
  58489. $core.addMethod(
  58490. $core.method({
  58491. selector: "testRemoveLast",
  58492. protocol: "tests",
  58493. fn: function (){
  58494. var self=this,$self=this;
  58495. var array;
  58496. return $core.withContext(function($ctx1) {
  58497. array=[(1), (2)];
  58498. $recv(array)._removeLast();
  58499. $self._assert_equals_($recv(array)._last(),(1));
  58500. return self;
  58501. }, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array})});
  58502. },
  58503. args: [],
  58504. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  58505. referencedClasses: [],
  58506. pragmas: [],
  58507. messageSends: ["removeLast", "assert:equals:", "last"]
  58508. }),
  58509. $globals.ArrayTest);
  58510. $core.addMethod(
  58511. $core.method({
  58512. selector: "testReversed",
  58513. protocol: "tests",
  58514. fn: function (){
  58515. var self=this,$self=this;
  58516. var array;
  58517. return $core.withContext(function($ctx1) {
  58518. array=[(5), (4), (3), (2), (1)];
  58519. $self._assert_equals_($recv(array)._reversed(),[(1), (2), (3), (4), (5)]);
  58520. return self;
  58521. }, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array})});
  58522. },
  58523. args: [],
  58524. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  58525. referencedClasses: [],
  58526. pragmas: [],
  58527. messageSends: ["assert:equals:", "reversed"]
  58528. }),
  58529. $globals.ArrayTest);
  58530. $core.addMethod(
  58531. $core.method({
  58532. selector: "testSort",
  58533. protocol: "tests",
  58534. fn: function (){
  58535. var self=this,$self=this;
  58536. var array;
  58537. return $core.withContext(function($ctx1) {
  58538. array=[(10), (1), (5)];
  58539. $recv(array)._sort();
  58540. $self._assert_equals_(array,[(1), (5), (10)]);
  58541. return self;
  58542. }, function($ctx1) {$ctx1.fill(self,"testSort",{array:array})});
  58543. },
  58544. args: [],
  58545. source: "testSort\x0a\x09| array |\x0a\x09array := #(10 1 5). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 5 10)",
  58546. referencedClasses: [],
  58547. pragmas: [],
  58548. messageSends: ["sort", "assert:equals:"]
  58549. }),
  58550. $globals.ArrayTest);
  58551. $core.addMethod(
  58552. $core.method({
  58553. selector: "collectionClass",
  58554. protocol: "fixture",
  58555. fn: function (){
  58556. var self=this,$self=this;
  58557. return $globals.Array;
  58558. },
  58559. args: [],
  58560. source: "collectionClass\x0a\x09^ Array",
  58561. referencedClasses: ["Array"],
  58562. pragmas: [],
  58563. messageSends: []
  58564. }),
  58565. $globals.ArrayTest.a$cls);
  58566. $core.addClass("StringTest", $globals.SequenceableCollectionTest, [], "Kernel-Tests");
  58567. $core.addMethod(
  58568. $core.method({
  58569. selector: "collection",
  58570. protocol: "fixture",
  58571. fn: function (){
  58572. var self=this,$self=this;
  58573. return "helLo";
  58574. },
  58575. args: [],
  58576. source: "collection\x0a\x09^ 'helLo'",
  58577. referencedClasses: [],
  58578. pragmas: [],
  58579. messageSends: []
  58580. }),
  58581. $globals.StringTest);
  58582. $core.addMethod(
  58583. $core.method({
  58584. selector: "collectionFirst",
  58585. protocol: "fixture",
  58586. fn: function (){
  58587. var self=this,$self=this;
  58588. return "h";
  58589. },
  58590. args: [],
  58591. source: "collectionFirst\x0a\x09^ 'h'",
  58592. referencedClasses: [],
  58593. pragmas: [],
  58594. messageSends: []
  58595. }),
  58596. $globals.StringTest);
  58597. $core.addMethod(
  58598. $core.method({
  58599. selector: "collectionFirstTwo",
  58600. protocol: "fixture",
  58601. fn: function (){
  58602. var self=this,$self=this;
  58603. return "he";
  58604. },
  58605. args: [],
  58606. source: "collectionFirstTwo\x0a\x09^ 'he'",
  58607. referencedClasses: [],
  58608. pragmas: [],
  58609. messageSends: []
  58610. }),
  58611. $globals.StringTest);
  58612. $core.addMethod(
  58613. $core.method({
  58614. selector: "collectionLast",
  58615. protocol: "fixture",
  58616. fn: function (){
  58617. var self=this,$self=this;
  58618. return "o";
  58619. },
  58620. args: [],
  58621. source: "collectionLast\x0a\x09^ 'o'",
  58622. referencedClasses: [],
  58623. pragmas: [],
  58624. messageSends: []
  58625. }),
  58626. $globals.StringTest);
  58627. $core.addMethod(
  58628. $core.method({
  58629. selector: "collectionLastTwo",
  58630. protocol: "fixture",
  58631. fn: function (){
  58632. var self=this,$self=this;
  58633. return "Lo";
  58634. },
  58635. args: [],
  58636. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  58637. referencedClasses: [],
  58638. pragmas: [],
  58639. messageSends: []
  58640. }),
  58641. $globals.StringTest);
  58642. $core.addMethod(
  58643. $core.method({
  58644. selector: "collectionOfPrintStrings",
  58645. protocol: "fixture",
  58646. fn: function (){
  58647. var self=this,$self=this;
  58648. return "'h''e''l''L''o'";
  58649. },
  58650. args: [],
  58651. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  58652. referencedClasses: [],
  58653. pragmas: [],
  58654. messageSends: []
  58655. }),
  58656. $globals.StringTest);
  58657. $core.addMethod(
  58658. $core.method({
  58659. selector: "collectionSize",
  58660. protocol: "fixture",
  58661. fn: function (){
  58662. var self=this,$self=this;
  58663. return (5);
  58664. },
  58665. args: [],
  58666. source: "collectionSize\x0a\x09^ 5",
  58667. referencedClasses: [],
  58668. pragmas: [],
  58669. messageSends: []
  58670. }),
  58671. $globals.StringTest);
  58672. $core.addMethod(
  58673. $core.method({
  58674. selector: "collectionWithDuplicates",
  58675. protocol: "fixture",
  58676. fn: function (){
  58677. var self=this,$self=this;
  58678. return "abbaerten";
  58679. },
  58680. args: [],
  58681. source: "collectionWithDuplicates\x0a\x09^ 'abbaerten'",
  58682. referencedClasses: [],
  58683. pragmas: [],
  58684. messageSends: []
  58685. }),
  58686. $globals.StringTest);
  58687. $core.addMethod(
  58688. $core.method({
  58689. selector: "collectionWithNewValue",
  58690. protocol: "fixture",
  58691. fn: function (){
  58692. var self=this,$self=this;
  58693. return "helLoN";
  58694. },
  58695. args: [],
  58696. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  58697. referencedClasses: [],
  58698. pragmas: [],
  58699. messageSends: []
  58700. }),
  58701. $globals.StringTest);
  58702. $core.addMethod(
  58703. $core.method({
  58704. selector: "sampleNewValueAsCollection",
  58705. protocol: "fixture",
  58706. fn: function (){
  58707. var self=this,$self=this;
  58708. return "N";
  58709. },
  58710. args: [],
  58711. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  58712. referencedClasses: [],
  58713. pragmas: [],
  58714. messageSends: []
  58715. }),
  58716. $globals.StringTest);
  58717. $core.addMethod(
  58718. $core.method({
  58719. selector: "samplesDo:",
  58720. protocol: "fixture",
  58721. fn: function (aBlock){
  58722. var self=this,$self=this;
  58723. return $core.withContext(function($ctx1) {
  58724. (
  58725. $ctx1.supercall = true,
  58726. ($globals.StringTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($self, [aBlock]));
  58727. $ctx1.supercall = false;
  58728. $recv(aBlock)._value_value_((3),"l");
  58729. return self;
  58730. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock})});
  58731. },
  58732. args: ["aBlock"],
  58733. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  58734. referencedClasses: [],
  58735. pragmas: [],
  58736. messageSends: ["samplesDo:", "value:value:"]
  58737. }),
  58738. $globals.StringTest);
  58739. $core.addMethod(
  58740. $core.method({
  58741. selector: "testAddAll",
  58742. protocol: "tests",
  58743. fn: function (){
  58744. var self=this,$self=this;
  58745. return $core.withContext(function($ctx1) {
  58746. var $1;
  58747. $self._should_raise_((function(){
  58748. return $core.withContext(function($ctx2) {
  58749. $1=$self._collection();
  58750. $ctx2.sendIdx["collection"]=1;
  58751. return $recv($1)._addAll_($self._collection());
  58752. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58753. }),$globals.Error);
  58754. return self;
  58755. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{})});
  58756. },
  58757. args: [],
  58758. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  58759. referencedClasses: ["Error"],
  58760. pragmas: [],
  58761. messageSends: ["should:raise:", "addAll:", "collection"]
  58762. }),
  58763. $globals.StringTest);
  58764. $core.addMethod(
  58765. $core.method({
  58766. selector: "testAddRemove",
  58767. protocol: "tests",
  58768. fn: function (){
  58769. var self=this,$self=this;
  58770. return $core.withContext(function($ctx1) {
  58771. $self._should_raise_((function(){
  58772. return $core.withContext(function($ctx2) {
  58773. return "hello"._add_("a");
  58774. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58775. }),$globals.Error);
  58776. $ctx1.sendIdx["should:raise:"]=1;
  58777. $self._should_raise_((function(){
  58778. return $core.withContext(function($ctx2) {
  58779. return "hello"._remove_("h");
  58780. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  58781. }),$globals.Error);
  58782. return self;
  58783. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{})});
  58784. },
  58785. args: [],
  58786. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  58787. referencedClasses: ["Error"],
  58788. pragmas: [],
  58789. messageSends: ["should:raise:", "add:", "remove:"]
  58790. }),
  58791. $globals.StringTest);
  58792. $core.addMethod(
  58793. $core.method({
  58794. selector: "testAsArray",
  58795. protocol: "tests",
  58796. fn: function (){
  58797. var self=this,$self=this;
  58798. return $core.withContext(function($ctx1) {
  58799. $self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  58800. return self;
  58801. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{})});
  58802. },
  58803. args: [],
  58804. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  58805. referencedClasses: [],
  58806. pragmas: [],
  58807. messageSends: ["assert:equals:", "asArray"]
  58808. }),
  58809. $globals.StringTest);
  58810. $core.addMethod(
  58811. $core.method({
  58812. selector: "testAsLowerCase",
  58813. protocol: "tests",
  58814. fn: function (){
  58815. var self=this,$self=this;
  58816. return $core.withContext(function($ctx1) {
  58817. $self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  58818. return self;
  58819. }, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{})});
  58820. },
  58821. args: [],
  58822. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  58823. referencedClasses: [],
  58824. pragmas: [],
  58825. messageSends: ["assert:equals:", "asLowercase"]
  58826. }),
  58827. $globals.StringTest);
  58828. $core.addMethod(
  58829. $core.method({
  58830. selector: "testAsNumber",
  58831. protocol: "tests",
  58832. fn: function (){
  58833. var self=this,$self=this;
  58834. return $core.withContext(function($ctx1) {
  58835. var $1,$2;
  58836. $1="3"._asNumber();
  58837. $ctx1.sendIdx["asNumber"]=1;
  58838. $self._assert_equals_($1,(3));
  58839. $ctx1.sendIdx["assert:equals:"]=1;
  58840. $2="-3"._asNumber();
  58841. $ctx1.sendIdx["asNumber"]=2;
  58842. $self._assert_equals_($2,(-3));
  58843. $ctx1.sendIdx["assert:equals:"]=2;
  58844. $self._assert_equals_("-1.5"._asNumber(),(-1.5));
  58845. return self;
  58846. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{})});
  58847. },
  58848. args: [],
  58849. 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.",
  58850. referencedClasses: [],
  58851. pragmas: [],
  58852. messageSends: ["assert:equals:", "asNumber"]
  58853. }),
  58854. $globals.StringTest);
  58855. $core.addMethod(
  58856. $core.method({
  58857. selector: "testAsUpperCase",
  58858. protocol: "tests",
  58859. fn: function (){
  58860. var self=this,$self=this;
  58861. return $core.withContext(function($ctx1) {
  58862. $self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  58863. return self;
  58864. }, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{})});
  58865. },
  58866. args: [],
  58867. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  58868. referencedClasses: [],
  58869. pragmas: [],
  58870. messageSends: ["assert:equals:", "asUppercase"]
  58871. }),
  58872. $globals.StringTest);
  58873. $core.addMethod(
  58874. $core.method({
  58875. selector: "testAsciiValue",
  58876. protocol: "tests",
  58877. fn: function (){
  58878. var self=this,$self=this;
  58879. var characterA,characterU;
  58880. return $core.withContext(function($ctx1) {
  58881. var $1;
  58882. characterA="A";
  58883. characterU="U";
  58884. $1=$recv(characterA)._asciiValue();
  58885. $ctx1.sendIdx["asciiValue"]=1;
  58886. $self._assert_equals_($1,(65));
  58887. $ctx1.sendIdx["assert:equals:"]=1;
  58888. $self._assert_equals_($recv(characterU)._asciiValue(),(85));
  58889. return self;
  58890. }, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU})});
  58891. },
  58892. args: [],
  58893. 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",
  58894. referencedClasses: [],
  58895. pragmas: [],
  58896. messageSends: ["assert:equals:", "asciiValue"]
  58897. }),
  58898. $globals.StringTest);
  58899. $core.addMethod(
  58900. $core.method({
  58901. selector: "testAtIfAbsentPut",
  58902. protocol: "tests",
  58903. fn: function (){
  58904. var self=this,$self=this;
  58905. return $core.withContext(function($ctx1) {
  58906. $self._should_raise_((function(){
  58907. return $core.withContext(function($ctx2) {
  58908. return "hello"._at_ifAbsentPut_((6),(function(){
  58909. return "a";
  58910. }));
  58911. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58912. }),$globals.Error);
  58913. return self;
  58914. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{})});
  58915. },
  58916. args: [],
  58917. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  58918. referencedClasses: ["Error"],
  58919. pragmas: [],
  58920. messageSends: ["should:raise:", "at:ifAbsentPut:"]
  58921. }),
  58922. $globals.StringTest);
  58923. $core.addMethod(
  58924. $core.method({
  58925. selector: "testAtPut",
  58926. protocol: "tests",
  58927. fn: function (){
  58928. var self=this,$self=this;
  58929. return $core.withContext(function($ctx1) {
  58930. $self._should_raise_((function(){
  58931. return $core.withContext(function($ctx2) {
  58932. return "hello"._at_put_((1),"a");
  58933. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58934. }),$globals.Error);
  58935. return self;
  58936. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{})});
  58937. },
  58938. args: [],
  58939. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  58940. referencedClasses: ["Error"],
  58941. pragmas: [],
  58942. messageSends: ["should:raise:", "at:put:"]
  58943. }),
  58944. $globals.StringTest);
  58945. $core.addMethod(
  58946. $core.method({
  58947. selector: "testCapitalized",
  58948. protocol: "tests",
  58949. fn: function (){
  58950. var self=this,$self=this;
  58951. return $core.withContext(function($ctx1) {
  58952. var $1,$2,$3;
  58953. $1="test"._capitalized();
  58954. $ctx1.sendIdx["capitalized"]=1;
  58955. $self._assert_equals_($1,"Test");
  58956. $ctx1.sendIdx["assert:equals:"]=1;
  58957. $2="Test"._capitalized();
  58958. $ctx1.sendIdx["capitalized"]=2;
  58959. $self._assert_equals_($2,"Test");
  58960. $ctx1.sendIdx["assert:equals:"]=2;
  58961. $self._assert_equals_(""._capitalized(),"");
  58962. $ctx1.sendIdx["assert:equals:"]=3;
  58963. $3="Test"._isCapitalized();
  58964. $ctx1.sendIdx["isCapitalized"]=1;
  58965. $self._assert_equals_($3,true);
  58966. $ctx1.sendIdx["assert:equals:"]=4;
  58967. $self._assert_equals_("test"._isCapitalized(),false);
  58968. return self;
  58969. }, function($ctx1) {$ctx1.fill(self,"testCapitalized",{})});
  58970. },
  58971. args: [],
  58972. 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.",
  58973. referencedClasses: [],
  58974. pragmas: [],
  58975. messageSends: ["assert:equals:", "capitalized", "isCapitalized"]
  58976. }),
  58977. $globals.StringTest);
  58978. $core.addMethod(
  58979. $core.method({
  58980. selector: "testCharCodeAt",
  58981. protocol: "tests",
  58982. fn: function (){
  58983. var self=this,$self=this;
  58984. return $core.withContext(function($ctx1) {
  58985. var $1,$2,$3,$4,$5;
  58986. $1="jackie"._charCodeAt_((1));
  58987. $ctx1.sendIdx["charCodeAt:"]=1;
  58988. $self._assert_equals_($1,(106));
  58989. $ctx1.sendIdx["assert:equals:"]=1;
  58990. $2="jackie"._charCodeAt_((2));
  58991. $ctx1.sendIdx["charCodeAt:"]=2;
  58992. $self._assert_equals_($2,(97));
  58993. $ctx1.sendIdx["assert:equals:"]=2;
  58994. $3="jackie"._charCodeAt_((3));
  58995. $ctx1.sendIdx["charCodeAt:"]=3;
  58996. $self._assert_equals_($3,(99));
  58997. $ctx1.sendIdx["assert:equals:"]=3;
  58998. $4="jackie"._charCodeAt_((4));
  58999. $ctx1.sendIdx["charCodeAt:"]=4;
  59000. $self._assert_equals_($4,(107));
  59001. $ctx1.sendIdx["assert:equals:"]=4;
  59002. $5="jackie"._charCodeAt_((5));
  59003. $ctx1.sendIdx["charCodeAt:"]=5;
  59004. $self._assert_equals_($5,(105));
  59005. $ctx1.sendIdx["assert:equals:"]=5;
  59006. $self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  59007. return self;
  59008. }, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{})});
  59009. },
  59010. args: [],
  59011. 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",
  59012. referencedClasses: [],
  59013. pragmas: [],
  59014. messageSends: ["assert:equals:", "charCodeAt:"]
  59015. }),
  59016. $globals.StringTest);
  59017. $core.addMethod(
  59018. $core.method({
  59019. selector: "testCopyFromTo",
  59020. protocol: "tests",
  59021. fn: function (){
  59022. var self=this,$self=this;
  59023. return $core.withContext(function($ctx1) {
  59024. var $1;
  59025. $1="jackie"._copyFrom_to_((1),(3));
  59026. $ctx1.sendIdx["copyFrom:to:"]=1;
  59027. $self._assert_equals_($1,"jac");
  59028. $ctx1.sendIdx["assert:equals:"]=1;
  59029. $self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  59030. return self;
  59031. }, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{})});
  59032. },
  59033. args: [],
  59034. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  59035. referencedClasses: [],
  59036. pragmas: [],
  59037. messageSends: ["assert:equals:", "copyFrom:to:"]
  59038. }),
  59039. $globals.StringTest);
  59040. $core.addMethod(
  59041. $core.method({
  59042. selector: "testCopySeparates",
  59043. protocol: "tests",
  59044. fn: function (){
  59045. var self=this,$self=this;
  59046. return $core.withContext(function($ctx1) {
  59047. var $3,$2,$1;
  59048. $3=$self._collection();
  59049. $ctx1.sendIdx["collection"]=1;
  59050. $2=$recv($3)._copy();
  59051. $1=$recv($2).__eq_eq($self._collection());
  59052. $self._assert_($1);
  59053. return self;
  59054. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{})});
  59055. },
  59056. args: [],
  59057. source: "testCopySeparates\x0a\x09\x22String instances are immutable\x22\x0a\x09self assert: self collection copy == self collection",
  59058. referencedClasses: [],
  59059. pragmas: [],
  59060. messageSends: ["assert:", "==", "copy", "collection"]
  59061. }),
  59062. $globals.StringTest);
  59063. $core.addMethod(
  59064. $core.method({
  59065. selector: "testCopyWithoutAll",
  59066. protocol: "tests",
  59067. fn: function (){
  59068. var self=this,$self=this;
  59069. return $core.withContext(function($ctx1) {
  59070. $self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  59071. return self;
  59072. }, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{})});
  59073. },
  59074. args: [],
  59075. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  59076. referencedClasses: [],
  59077. pragmas: [],
  59078. messageSends: ["assert:equals:", "copyWithoutAll:"]
  59079. }),
  59080. $globals.StringTest);
  59081. $core.addMethod(
  59082. $core.method({
  59083. selector: "testEquality",
  59084. protocol: "tests",
  59085. fn: function (){
  59086. var self=this,$self=this;
  59087. return $core.withContext(function($ctx1) {
  59088. var $1,$2,$3;
  59089. $self._assert_equals_("hello","hello");
  59090. $ctx1.sendIdx["assert:equals:"]=1;
  59091. $1="hello".__eq("world");
  59092. $ctx1.sendIdx["="]=1;
  59093. $self._deny_($1);
  59094. $ctx1.sendIdx["deny:"]=1;
  59095. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  59096. })));
  59097. $ctx1.sendIdx["="]=2;
  59098. $self._deny_($2);
  59099. $ctx1.sendIdx["deny:"]=2;
  59100. $3="hello"._yourself();
  59101. $ctx1.sendIdx["yourself"]=1;
  59102. $self._assert_equals_("hello",$3);
  59103. $ctx1.sendIdx["assert:equals:"]=2;
  59104. $self._assert_equals_("hello"._yourself(),"hello");
  59105. $self._deny_("".__eq((0)));
  59106. return self;
  59107. }, function($ctx1) {$ctx1.fill(self,"testEquality",{})});
  59108. },
  59109. args: [],
  59110. 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",
  59111. referencedClasses: [],
  59112. pragmas: [],
  59113. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"]
  59114. }),
  59115. $globals.StringTest);
  59116. $core.addMethod(
  59117. $core.method({
  59118. selector: "testIdentity",
  59119. protocol: "tests",
  59120. fn: function (){
  59121. var self=this,$self=this;
  59122. return $core.withContext(function($ctx1) {
  59123. var $1,$2,$4,$3,$5;
  59124. $1="hello".__eq_eq("hello");
  59125. $ctx1.sendIdx["=="]=1;
  59126. $self._assert_($1);
  59127. $ctx1.sendIdx["assert:"]=1;
  59128. $2="hello".__eq_eq("world");
  59129. $ctx1.sendIdx["=="]=2;
  59130. $self._deny_($2);
  59131. $ctx1.sendIdx["deny:"]=1;
  59132. $4="hello"._yourself();
  59133. $ctx1.sendIdx["yourself"]=1;
  59134. $3="hello".__eq_eq($4);
  59135. $ctx1.sendIdx["=="]=3;
  59136. $self._assert_($3);
  59137. $ctx1.sendIdx["assert:"]=2;
  59138. $5=$recv("hello"._yourself()).__eq_eq("hello");
  59139. $ctx1.sendIdx["=="]=4;
  59140. $self._assert_($5);
  59141. $self._deny_("".__eq_eq((0)));
  59142. return self;
  59143. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{})});
  59144. },
  59145. args: [],
  59146. 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",
  59147. referencedClasses: [],
  59148. pragmas: [],
  59149. messageSends: ["assert:", "==", "deny:", "yourself"]
  59150. }),
  59151. $globals.StringTest);
  59152. $core.addMethod(
  59153. $core.method({
  59154. selector: "testIncludesSubString",
  59155. protocol: "tests",
  59156. fn: function (){
  59157. var self=this,$self=this;
  59158. return $core.withContext(function($ctx1) {
  59159. var $1;
  59160. $1="amber"._includesSubString_("ber");
  59161. $ctx1.sendIdx["includesSubString:"]=1;
  59162. $self._assert_($1);
  59163. $self._deny_("amber"._includesSubString_("zork"));
  59164. return self;
  59165. }, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{})});
  59166. },
  59167. args: [],
  59168. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  59169. referencedClasses: [],
  59170. pragmas: [],
  59171. messageSends: ["assert:", "includesSubString:", "deny:"]
  59172. }),
  59173. $globals.StringTest);
  59174. $core.addMethod(
  59175. $core.method({
  59176. selector: "testIndexOfStartingAtWithNull",
  59177. protocol: "tests",
  59178. fn: function (){
  59179. var self=this,$self=this;
  59180. return self;
  59181. },
  59182. args: [],
  59183. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  59184. referencedClasses: [],
  59185. pragmas: [],
  59186. messageSends: []
  59187. }),
  59188. $globals.StringTest);
  59189. $core.addMethod(
  59190. $core.method({
  59191. selector: "testIndexOfWithNull",
  59192. protocol: "tests",
  59193. fn: function (){
  59194. var self=this,$self=this;
  59195. return self;
  59196. },
  59197. args: [],
  59198. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  59199. referencedClasses: [],
  59200. pragmas: [],
  59201. messageSends: []
  59202. }),
  59203. $globals.StringTest);
  59204. $core.addMethod(
  59205. $core.method({
  59206. selector: "testIsVowel",
  59207. protocol: "tests",
  59208. fn: function (){
  59209. var self=this,$self=this;
  59210. var vowel,consonant;
  59211. return $core.withContext(function($ctx1) {
  59212. var $1;
  59213. vowel="u";
  59214. consonant="z";
  59215. $1=$recv(vowel)._isVowel();
  59216. $ctx1.sendIdx["isVowel"]=1;
  59217. $self._assert_equals_($1,true);
  59218. $ctx1.sendIdx["assert:equals:"]=1;
  59219. $self._assert_equals_($recv(consonant)._isVowel(),false);
  59220. return self;
  59221. }, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant})});
  59222. },
  59223. args: [],
  59224. 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",
  59225. referencedClasses: [],
  59226. pragmas: [],
  59227. messageSends: ["assert:equals:", "isVowel"]
  59228. }),
  59229. $globals.StringTest);
  59230. $core.addMethod(
  59231. $core.method({
  59232. selector: "testJoin",
  59233. protocol: "tests",
  59234. fn: function (){
  59235. var self=this,$self=this;
  59236. return $core.withContext(function($ctx1) {
  59237. $self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  59238. return self;
  59239. }, function($ctx1) {$ctx1.fill(self,"testJoin",{})});
  59240. },
  59241. args: [],
  59242. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  59243. referencedClasses: [],
  59244. pragmas: [],
  59245. messageSends: ["assert:equals:", "join:"]
  59246. }),
  59247. $globals.StringTest);
  59248. $core.addMethod(
  59249. $core.method({
  59250. selector: "testRegression1224",
  59251. protocol: "tests",
  59252. fn: function (){
  59253. var self=this,$self=this;
  59254. return $core.withContext(function($ctx1) {
  59255. var $2,$1;
  59256. $self._should_raise_((function(){
  59257. return $core.withContext(function($ctx2) {
  59258. $2=$recv($self._collectionClass())._new();
  59259. $recv($2)._remove_ifAbsent_($self._sampleNewValue(),(function(){
  59260. }));
  59261. $1=$recv($2)._yourself();
  59262. return $recv($1)._size();
  59263. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59264. }),$globals.Error);
  59265. return self;
  59266. }, function($ctx1) {$ctx1.fill(self,"testRegression1224",{})});
  59267. },
  59268. args: [],
  59269. 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",
  59270. referencedClasses: ["Error"],
  59271. pragmas: [],
  59272. messageSends: ["should:raise:", "size", "remove:ifAbsent:", "new", "collectionClass", "sampleNewValue", "yourself"]
  59273. }),
  59274. $globals.StringTest);
  59275. $core.addMethod(
  59276. $core.method({
  59277. selector: "testRemoveAll",
  59278. protocol: "tests",
  59279. fn: function (){
  59280. var self=this,$self=this;
  59281. return $core.withContext(function($ctx1) {
  59282. $self._should_raise_((function(){
  59283. return $core.withContext(function($ctx2) {
  59284. return $recv($self._collection())._removeAll();
  59285. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59286. }),$globals.Error);
  59287. return self;
  59288. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{})});
  59289. },
  59290. args: [],
  59291. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  59292. referencedClasses: ["Error"],
  59293. pragmas: [],
  59294. messageSends: ["should:raise:", "removeAll", "collection"]
  59295. }),
  59296. $globals.StringTest);
  59297. $core.addMethod(
  59298. $core.method({
  59299. selector: "testReversed",
  59300. protocol: "tests",
  59301. fn: function (){
  59302. var self=this,$self=this;
  59303. return $core.withContext(function($ctx1) {
  59304. $self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  59305. return self;
  59306. }, function($ctx1) {$ctx1.fill(self,"testReversed",{})});
  59307. },
  59308. args: [],
  59309. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  59310. referencedClasses: [],
  59311. pragmas: [],
  59312. messageSends: ["assert:equals:", "reversed"]
  59313. }),
  59314. $globals.StringTest);
  59315. $core.addMethod(
  59316. $core.method({
  59317. selector: "testStreamContents",
  59318. protocol: "tests",
  59319. fn: function (){
  59320. var self=this,$self=this;
  59321. return $core.withContext(function($ctx1) {
  59322. $self._assert_equals_($recv($globals.String)._streamContents_((function(aStream){
  59323. return $core.withContext(function($ctx2) {
  59324. $recv(aStream)._nextPutAll_("hello");
  59325. $ctx2.sendIdx["nextPutAll:"]=1;
  59326. $recv(aStream)._space();
  59327. return $recv(aStream)._nextPutAll_("world");
  59328. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)});
  59329. })),"hello world");
  59330. return self;
  59331. }, function($ctx1) {$ctx1.fill(self,"testStreamContents",{})});
  59332. },
  59333. args: [],
  59334. 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'",
  59335. referencedClasses: ["String"],
  59336. pragmas: [],
  59337. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"]
  59338. }),
  59339. $globals.StringTest);
  59340. $core.addMethod(
  59341. $core.method({
  59342. selector: "testSubStrings",
  59343. protocol: "tests",
  59344. fn: function (){
  59345. var self=this,$self=this;
  59346. return $core.withContext(function($ctx1) {
  59347. $self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  59348. return self;
  59349. }, function($ctx1) {$ctx1.fill(self,"testSubStrings",{})});
  59350. },
  59351. args: [],
  59352. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  59353. referencedClasses: [],
  59354. pragmas: [],
  59355. messageSends: ["assert:equals:", "subStrings:"]
  59356. }),
  59357. $globals.StringTest);
  59358. $core.addMethod(
  59359. $core.method({
  59360. selector: "testTrim",
  59361. protocol: "tests",
  59362. fn: function (){
  59363. var self=this,$self=this;
  59364. return $core.withContext(function($ctx1) {
  59365. $self._assert_equals_(" jackie"._trimLeft(),"jackie");
  59366. $ctx1.sendIdx["assert:equals:"]=1;
  59367. $self._assert_equals_("jackie "._trimRight(),"jackie");
  59368. return self;
  59369. }, function($ctx1) {$ctx1.fill(self,"testTrim",{})});
  59370. },
  59371. args: [],
  59372. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  59373. referencedClasses: [],
  59374. pragmas: [],
  59375. messageSends: ["assert:equals:", "trimLeft", "trimRight"]
  59376. }),
  59377. $globals.StringTest);
  59378. $core.addMethod(
  59379. $core.method({
  59380. selector: "testValue",
  59381. protocol: "tests",
  59382. fn: function (){
  59383. var self=this,$self=this;
  59384. return $core.withContext(function($ctx1) {
  59385. $self._assert_equals_("asString"._value_((1)),"1");
  59386. $ctx1.sendIdx["assert:equals:"]=1;
  59387. $self._assert_equals_([(1), (2), (3)]._collect_("asString"),["1", "2", "3"]);
  59388. return self;
  59389. }, function($ctx1) {$ctx1.fill(self,"testValue",{})});
  59390. },
  59391. args: [],
  59392. 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')",
  59393. referencedClasses: [],
  59394. pragmas: [],
  59395. messageSends: ["assert:equals:", "value:", "collect:"]
  59396. }),
  59397. $globals.StringTest);
  59398. $core.addMethod(
  59399. $core.method({
  59400. selector: "collectionClass",
  59401. protocol: "fixture",
  59402. fn: function (){
  59403. var self=this,$self=this;
  59404. return $globals.String;
  59405. },
  59406. args: [],
  59407. source: "collectionClass\x0a\x09^ String",
  59408. referencedClasses: ["String"],
  59409. pragmas: [],
  59410. messageSends: []
  59411. }),
  59412. $globals.StringTest.a$cls);
  59413. $core.addClass("SetTest", $globals.CollectionTest, [], "Kernel-Tests");
  59414. $core.addMethod(
  59415. $core.method({
  59416. selector: "collection",
  59417. protocol: "fixture",
  59418. fn: function (){
  59419. var self=this,$self=this;
  59420. return $core.withContext(function($ctx1) {
  59421. var $1;
  59422. $1=$recv($globals.Set)._new();
  59423. $recv($1)._add_($globals.Smalltalk);
  59424. $ctx1.sendIdx["add:"]=1;
  59425. $recv($1)._add_(nil);
  59426. $ctx1.sendIdx["add:"]=2;
  59427. $recv($1)._add_((3).__at((3)));
  59428. $ctx1.sendIdx["add:"]=3;
  59429. $recv($1)._add_(false);
  59430. $ctx1.sendIdx["add:"]=4;
  59431. $recv($1)._add_($self.sampleBlock);
  59432. return $recv($1)._yourself();
  59433. }, function($ctx1) {$ctx1.fill(self,"collection",{})});
  59434. },
  59435. args: [],
  59436. 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",
  59437. referencedClasses: ["Set", "Smalltalk"],
  59438. pragmas: [],
  59439. messageSends: ["add:", "new", "@", "yourself"]
  59440. }),
  59441. $globals.SetTest);
  59442. $core.addMethod(
  59443. $core.method({
  59444. selector: "collectionOfPrintStrings",
  59445. protocol: "fixture",
  59446. fn: function (){
  59447. var self=this,$self=this;
  59448. return $core.withContext(function($ctx1) {
  59449. var $1;
  59450. $1=$recv($globals.Set)._new();
  59451. $recv($1)._add_("a SmalltalkImage");
  59452. $ctx1.sendIdx["add:"]=1;
  59453. $recv($1)._add_("nil");
  59454. $ctx1.sendIdx["add:"]=2;
  59455. $recv($1)._add_("3@3");
  59456. $ctx1.sendIdx["add:"]=3;
  59457. $recv($1)._add_("false");
  59458. $ctx1.sendIdx["add:"]=4;
  59459. $recv($1)._add_("a BlockClosure");
  59460. return $recv($1)._yourself();
  59461. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{})});
  59462. },
  59463. args: [],
  59464. 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",
  59465. referencedClasses: ["Set"],
  59466. pragmas: [],
  59467. messageSends: ["add:", "new", "yourself"]
  59468. }),
  59469. $globals.SetTest);
  59470. $core.addMethod(
  59471. $core.method({
  59472. selector: "collectionSize",
  59473. protocol: "fixture",
  59474. fn: function (){
  59475. var self=this,$self=this;
  59476. return (5);
  59477. },
  59478. args: [],
  59479. source: "collectionSize\x0a\x09^ 5",
  59480. referencedClasses: [],
  59481. pragmas: [],
  59482. messageSends: []
  59483. }),
  59484. $globals.SetTest);
  59485. $core.addMethod(
  59486. $core.method({
  59487. selector: "collectionWithDuplicates",
  59488. protocol: "fixture",
  59489. fn: function (){
  59490. var self=this,$self=this;
  59491. return $core.withContext(function($ctx1) {
  59492. var $1;
  59493. $1=$self._collection();
  59494. $recv($1)._add_((0));
  59495. return $recv($1)._yourself();
  59496. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{})});
  59497. },
  59498. args: [],
  59499. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  59500. referencedClasses: [],
  59501. pragmas: [],
  59502. messageSends: ["add:", "collection", "yourself"]
  59503. }),
  59504. $globals.SetTest);
  59505. $core.addMethod(
  59506. $core.method({
  59507. selector: "collectionWithNewValue",
  59508. protocol: "fixture",
  59509. fn: function (){
  59510. var self=this,$self=this;
  59511. return $core.withContext(function($ctx1) {
  59512. var $1;
  59513. $1=$recv($globals.Set)._new();
  59514. $recv($1)._add_($globals.Smalltalk);
  59515. $ctx1.sendIdx["add:"]=1;
  59516. $recv($1)._add_(nil);
  59517. $ctx1.sendIdx["add:"]=2;
  59518. $recv($1)._add_((3).__at((3)));
  59519. $ctx1.sendIdx["add:"]=3;
  59520. $recv($1)._add_("N");
  59521. $ctx1.sendIdx["add:"]=4;
  59522. $recv($1)._add_(false);
  59523. $ctx1.sendIdx["add:"]=5;
  59524. $recv($1)._add_($self.sampleBlock);
  59525. return $recv($1)._yourself();
  59526. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{})});
  59527. },
  59528. args: [],
  59529. 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",
  59530. referencedClasses: ["Set", "Smalltalk"],
  59531. pragmas: [],
  59532. messageSends: ["add:", "new", "@", "yourself"]
  59533. }),
  59534. $globals.SetTest);
  59535. $core.addMethod(
  59536. $core.method({
  59537. selector: "testAddAll",
  59538. protocol: "tests",
  59539. fn: function (){
  59540. var self=this,$self=this;
  59541. return $core.withContext(function($ctx1) {
  59542. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  59543. (
  59544. $ctx1.supercall = true,
  59545. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testAddAll.apply($self, []));
  59546. $ctx1.supercall = false;
  59547. $2=$self._collection();
  59548. $ctx1.sendIdx["collection"]=1;
  59549. $3=$self._collection();
  59550. $ctx1.sendIdx["collection"]=2;
  59551. $recv($2)._addAll_($3);
  59552. $ctx1.sendIdx["addAll:"]=1;
  59553. $4=$recv($2)._yourself();
  59554. $ctx1.sendIdx["yourself"]=1;
  59555. $1=$4;
  59556. $5=$self._collection();
  59557. $ctx1.sendIdx["collection"]=3;
  59558. $self._assert_equals_($1,$5);
  59559. $ctx1.sendIdx["assert:equals:"]=1;
  59560. $7=$self._collection();
  59561. $ctx1.sendIdx["collection"]=4;
  59562. $8=$self._collectionWithNewValue();
  59563. $ctx1.sendIdx["collectionWithNewValue"]=1;
  59564. $recv($7)._addAll_($8);
  59565. $ctx1.sendIdx["addAll:"]=2;
  59566. $9=$recv($7)._yourself();
  59567. $ctx1.sendIdx["yourself"]=2;
  59568. $6=$9;
  59569. $10=$self._collectionWithNewValue();
  59570. $ctx1.sendIdx["collectionWithNewValue"]=2;
  59571. $self._assert_equals_($6,$10);
  59572. $ctx1.sendIdx["assert:equals:"]=2;
  59573. $12=$self._collectionWithNewValue();
  59574. $ctx1.sendIdx["collectionWithNewValue"]=3;
  59575. $recv($12)._addAll_($self._collection());
  59576. $11=$recv($12)._yourself();
  59577. $self._assert_equals_($11,$self._collectionWithNewValue());
  59578. return self;
  59579. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{})});
  59580. },
  59581. args: [],
  59582. 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",
  59583. referencedClasses: [],
  59584. pragmas: [],
  59585. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  59586. }),
  59587. $globals.SetTest);
  59588. $core.addMethod(
  59589. $core.method({
  59590. selector: "testAddRemove",
  59591. protocol: "tests",
  59592. fn: function (){
  59593. var self=this,$self=this;
  59594. var set;
  59595. return $core.withContext(function($ctx1) {
  59596. var $1,$2;
  59597. set=$recv($globals.Set)._new();
  59598. $self._assert_($recv(set)._isEmpty());
  59599. $ctx1.sendIdx["assert:"]=1;
  59600. $recv(set)._add_((3));
  59601. $ctx1.sendIdx["add:"]=1;
  59602. $1=$recv(set)._includes_((3));
  59603. $ctx1.sendIdx["includes:"]=1;
  59604. $self._assert_($1);
  59605. $ctx1.sendIdx["assert:"]=2;
  59606. $recv(set)._add_((5));
  59607. $2=$recv(set)._includes_((5));
  59608. $ctx1.sendIdx["includes:"]=2;
  59609. $self._assert_($2);
  59610. $recv(set)._remove_((3));
  59611. $self._deny_($recv(set)._includes_((3)));
  59612. return self;
  59613. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set})});
  59614. },
  59615. args: [],
  59616. 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)",
  59617. referencedClasses: ["Set"],
  59618. pragmas: [],
  59619. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"]
  59620. }),
  59621. $globals.SetTest);
  59622. $core.addMethod(
  59623. $core.method({
  59624. selector: "testAt",
  59625. protocol: "tests",
  59626. fn: function (){
  59627. var self=this,$self=this;
  59628. return $core.withContext(function($ctx1) {
  59629. $self._should_raise_((function(){
  59630. return $core.withContext(function($ctx2) {
  59631. return $recv($recv($globals.Set)._new())._at_put_((1),(2));
  59632. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59633. }),$globals.Error);
  59634. return self;
  59635. }, function($ctx1) {$ctx1.fill(self,"testAt",{})});
  59636. },
  59637. args: [],
  59638. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  59639. referencedClasses: ["Set", "Error"],
  59640. pragmas: [],
  59641. messageSends: ["should:raise:", "at:put:", "new"]
  59642. }),
  59643. $globals.SetTest);
  59644. $core.addMethod(
  59645. $core.method({
  59646. selector: "testCollect",
  59647. protocol: "tests",
  59648. fn: function (){
  59649. var self=this,$self=this;
  59650. return $core.withContext(function($ctx1) {
  59651. var $2,$1;
  59652. (
  59653. $ctx1.supercall = true,
  59654. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testCollect.apply($self, []));
  59655. $ctx1.supercall = false;
  59656. $2=[(5), (6), (8)]._asSet();
  59657. $ctx1.sendIdx["asSet"]=1;
  59658. $1=$recv($2)._collect_((function(x){
  59659. return $core.withContext(function($ctx2) {
  59660. return $recv(x).__backslash_backslash((3));
  59661. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  59662. }));
  59663. $self._assert_equals_($1,[(0), (2)]._asSet());
  59664. return self;
  59665. }, function($ctx1) {$ctx1.fill(self,"testCollect",{})});
  59666. },
  59667. args: [],
  59668. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  59669. referencedClasses: [],
  59670. pragmas: [],
  59671. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"]
  59672. }),
  59673. $globals.SetTest);
  59674. $core.addMethod(
  59675. $core.method({
  59676. selector: "testComma",
  59677. protocol: "tests",
  59678. fn: function (){
  59679. var self=this,$self=this;
  59680. return $core.withContext(function($ctx1) {
  59681. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  59682. (
  59683. $ctx1.supercall = true,
  59684. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testComma.apply($self, []));
  59685. $ctx1.supercall = false;
  59686. $2=$self._collection();
  59687. $ctx1.sendIdx["collection"]=1;
  59688. $3=$self._collection();
  59689. $ctx1.sendIdx["collection"]=2;
  59690. $1=$recv($2).__comma($3);
  59691. $ctx1.sendIdx[","]=1;
  59692. $4=$self._collection();
  59693. $ctx1.sendIdx["collection"]=3;
  59694. $self._assert_equals_($1,$4);
  59695. $ctx1.sendIdx["assert:equals:"]=1;
  59696. $6=$self._collection();
  59697. $ctx1.sendIdx["collection"]=4;
  59698. $7=$self._collectionWithNewValue();
  59699. $ctx1.sendIdx["collectionWithNewValue"]=1;
  59700. $5=$recv($6).__comma($7);
  59701. $ctx1.sendIdx[","]=2;
  59702. $8=$self._collectionWithNewValue();
  59703. $ctx1.sendIdx["collectionWithNewValue"]=2;
  59704. $self._assert_equals_($5,$8);
  59705. $ctx1.sendIdx["assert:equals:"]=2;
  59706. $10=$self._collectionWithNewValue();
  59707. $ctx1.sendIdx["collectionWithNewValue"]=3;
  59708. $9=$recv($10).__comma($self._collection());
  59709. $self._assert_equals_($9,$self._collectionWithNewValue());
  59710. return self;
  59711. }, function($ctx1) {$ctx1.fill(self,"testComma",{})});
  59712. },
  59713. args: [],
  59714. 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",
  59715. referencedClasses: [],
  59716. pragmas: [],
  59717. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  59718. }),
  59719. $globals.SetTest);
  59720. $core.addMethod(
  59721. $core.method({
  59722. selector: "testComparing",
  59723. protocol: "tests",
  59724. fn: function (){
  59725. var self=this,$self=this;
  59726. return $core.withContext(function($ctx1) {
  59727. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  59728. $1=[(0), (2)]._asSet();
  59729. $ctx1.sendIdx["asSet"]=1;
  59730. $2=[(0), (2)]._asSet();
  59731. $ctx1.sendIdx["asSet"]=2;
  59732. $self._assert_equals_($1,$2);
  59733. $ctx1.sendIdx["assert:equals:"]=1;
  59734. $3=[(2), (0)]._asSet();
  59735. $ctx1.sendIdx["asSet"]=3;
  59736. $4=[(0), (2)]._asSet();
  59737. $ctx1.sendIdx["asSet"]=4;
  59738. $self._assert_equals_($3,$4);
  59739. $6=[(0), (2), (3)]._asSet();
  59740. $ctx1.sendIdx["asSet"]=5;
  59741. $7=[(0), (2)]._asSet();
  59742. $ctx1.sendIdx["asSet"]=6;
  59743. $5=$recv($6).__eq($7);
  59744. $ctx1.sendIdx["="]=1;
  59745. $self._deny_($5);
  59746. $ctx1.sendIdx["deny:"]=1;
  59747. $9=[(1), (2)]._asSet();
  59748. $ctx1.sendIdx["asSet"]=7;
  59749. $8=$recv($9).__eq([(0), (2)]._asSet());
  59750. $self._deny_($8);
  59751. return self;
  59752. }, function($ctx1) {$ctx1.fill(self,"testComparing",{})});
  59753. },
  59754. args: [],
  59755. 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",
  59756. referencedClasses: [],
  59757. pragmas: [],
  59758. messageSends: ["assert:equals:", "asSet", "deny:", "="]
  59759. }),
  59760. $globals.SetTest);
  59761. $core.addMethod(
  59762. $core.method({
  59763. selector: "testPrintString",
  59764. protocol: "tests",
  59765. fn: function (){
  59766. var self=this,$self=this;
  59767. var set;
  59768. return $core.withContext(function($ctx1) {
  59769. var $1,$2,$3,$4,$5,$6,$7;
  59770. set=$recv($globals.Set)._new();
  59771. $1=$recv(set)._printString();
  59772. $ctx1.sendIdx["printString"]=1;
  59773. $self._assert_equals_($1,"a Set ()");
  59774. $ctx1.sendIdx["assert:equals:"]=1;
  59775. $2=set;
  59776. $recv($2)._add_((1));
  59777. $ctx1.sendIdx["add:"]=1;
  59778. $recv($2)._add_((3));
  59779. $ctx1.sendIdx["add:"]=2;
  59780. $3=$recv(set)._printString();
  59781. $ctx1.sendIdx["printString"]=2;
  59782. $self._assert_equals_($3,"a Set (1 3)");
  59783. $ctx1.sendIdx["assert:equals:"]=2;
  59784. $recv(set)._add_("foo");
  59785. $ctx1.sendIdx["add:"]=3;
  59786. $4=$recv(set)._printString();
  59787. $ctx1.sendIdx["printString"]=3;
  59788. $self._assert_equals_($4,"a Set (1 3 'foo')");
  59789. $ctx1.sendIdx["assert:equals:"]=3;
  59790. $5=set;
  59791. $recv($5)._remove_((1));
  59792. $ctx1.sendIdx["remove:"]=1;
  59793. $recv($5)._remove_((3));
  59794. $6=$recv(set)._printString();
  59795. $ctx1.sendIdx["printString"]=4;
  59796. $self._assert_equals_($6,"a Set ('foo')");
  59797. $ctx1.sendIdx["assert:equals:"]=4;
  59798. $recv(set)._add_((3));
  59799. $ctx1.sendIdx["add:"]=4;
  59800. $7=$recv(set)._printString();
  59801. $ctx1.sendIdx["printString"]=5;
  59802. $self._assert_equals_($7,"a Set (3 'foo')");
  59803. $ctx1.sendIdx["assert:equals:"]=5;
  59804. $recv(set)._add_((3));
  59805. $self._assert_equals_($recv(set)._printString(),"a Set (3 'foo')");
  59806. return self;
  59807. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set})});
  59808. },
  59809. args: [],
  59810. 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'')'",
  59811. referencedClasses: ["Set"],
  59812. pragmas: [],
  59813. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"]
  59814. }),
  59815. $globals.SetTest);
  59816. $core.addMethod(
  59817. $core.method({
  59818. selector: "testRegression1225",
  59819. protocol: "tests",
  59820. fn: function (){
  59821. var self=this,$self=this;
  59822. return $core.withContext(function($ctx1) {
  59823. $self._assert_equals_($recv([(1), (2), (3)]._asSet())._add_((3)),(3));
  59824. return self;
  59825. }, function($ctx1) {$ctx1.fill(self,"testRegression1225",{})});
  59826. },
  59827. args: [],
  59828. source: "testRegression1225\x0a\x09self assert: (#(1 2 3) asSet add: 3) equals: 3",
  59829. referencedClasses: [],
  59830. pragmas: [],
  59831. messageSends: ["assert:equals:", "add:", "asSet"]
  59832. }),
  59833. $globals.SetTest);
  59834. $core.addMethod(
  59835. $core.method({
  59836. selector: "testRegression1226",
  59837. protocol: "tests",
  59838. fn: function (){
  59839. var self=this,$self=this;
  59840. return $core.withContext(function($ctx1) {
  59841. $self._assert_equals_($recv([(1), (2), (3)]._asSet())._remove_((3)),(3));
  59842. return self;
  59843. }, function($ctx1) {$ctx1.fill(self,"testRegression1226",{})});
  59844. },
  59845. args: [],
  59846. source: "testRegression1226\x0a\x09self assert: (#(1 2 3) asSet remove: 3) equals: 3",
  59847. referencedClasses: [],
  59848. pragmas: [],
  59849. messageSends: ["assert:equals:", "remove:", "asSet"]
  59850. }),
  59851. $globals.SetTest);
  59852. $core.addMethod(
  59853. $core.method({
  59854. selector: "testRegression1227",
  59855. protocol: "tests",
  59856. fn: function (){
  59857. var self=this,$self=this;
  59858. return $core.withContext(function($ctx1) {
  59859. $self._assert_equals_($recv([(1), (2), (3)]._asSet())._remove_ifAbsent_((4),(function(){
  59860. return (5);
  59861. })),(5));
  59862. return self;
  59863. }, function($ctx1) {$ctx1.fill(self,"testRegression1227",{})});
  59864. },
  59865. args: [],
  59866. source: "testRegression1227\x0a\x09self assert: (#(1 2 3) asSet remove: 4 ifAbsent: [5]) equals: 5",
  59867. referencedClasses: [],
  59868. pragmas: [],
  59869. messageSends: ["assert:equals:", "remove:ifAbsent:", "asSet"]
  59870. }),
  59871. $globals.SetTest);
  59872. $core.addMethod(
  59873. $core.method({
  59874. selector: "testRegression1228",
  59875. protocol: "tests",
  59876. fn: function (){
  59877. var self=this,$self=this;
  59878. return $core.withContext(function($ctx1) {
  59879. $self._should_raise_((function(){
  59880. return $core.withContext(function($ctx2) {
  59881. return $recv([(1), (2), (3)]._asSet())._remove_((4));
  59882. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59883. }),$globals.Error);
  59884. return self;
  59885. }, function($ctx1) {$ctx1.fill(self,"testRegression1228",{})});
  59886. },
  59887. args: [],
  59888. source: "testRegression1228\x0a\x09self should: [#(1 2 3) asSet remove: 4] raise: Error",
  59889. referencedClasses: ["Error"],
  59890. pragmas: [],
  59891. messageSends: ["should:raise:", "remove:", "asSet"]
  59892. }),
  59893. $globals.SetTest);
  59894. $core.addMethod(
  59895. $core.method({
  59896. selector: "testUnboxedObjects",
  59897. protocol: "tests",
  59898. fn: function (){
  59899. var self=this,$self=this;
  59900. return $core.withContext(function($ctx1) {
  59901. var $4,$3,$2,$1;
  59902. $4="foo"._yourself();
  59903. $ctx1.sendIdx["yourself"]=1;
  59904. $3=[$4,"foo"._yourself()];
  59905. $2=$recv($3)._asSet();
  59906. $1=$recv($2)._asArray();
  59907. $self._assert_equals_($1,["foo"]);
  59908. return self;
  59909. }, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{})});
  59910. },
  59911. args: [],
  59912. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  59913. referencedClasses: [],
  59914. pragmas: [],
  59915. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"]
  59916. }),
  59917. $globals.SetTest);
  59918. $core.addMethod(
  59919. $core.method({
  59920. selector: "testUnicity",
  59921. protocol: "tests",
  59922. fn: function (){
  59923. var self=this,$self=this;
  59924. var set;
  59925. return $core.withContext(function($ctx1) {
  59926. var $1;
  59927. set=$recv($globals.Set)._new();
  59928. $recv(set)._add_((21));
  59929. $ctx1.sendIdx["add:"]=1;
  59930. $recv(set)._add_("hello");
  59931. $ctx1.sendIdx["add:"]=2;
  59932. $recv(set)._add_((21));
  59933. $ctx1.sendIdx["add:"]=3;
  59934. $1=$recv(set)._size();
  59935. $ctx1.sendIdx["size"]=1;
  59936. $self._assert_equals_($1,(2));
  59937. $ctx1.sendIdx["assert:equals:"]=1;
  59938. $recv(set)._add_("hello");
  59939. $self._assert_equals_($recv(set)._size(),(2));
  59940. $ctx1.sendIdx["assert:equals:"]=2;
  59941. $self._assert_equals_($recv(set)._asArray(),[(21), "hello"]);
  59942. return self;
  59943. }, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set})});
  59944. },
  59945. args: [],
  59946. 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')",
  59947. referencedClasses: ["Set"],
  59948. pragmas: [],
  59949. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"]
  59950. }),
  59951. $globals.SetTest);
  59952. $core.addMethod(
  59953. $core.method({
  59954. selector: "collectionClass",
  59955. protocol: "fixture",
  59956. fn: function (){
  59957. var self=this,$self=this;
  59958. return $globals.Set;
  59959. },
  59960. args: [],
  59961. source: "collectionClass\x0a\x09^ Set",
  59962. referencedClasses: ["Set"],
  59963. pragmas: [],
  59964. messageSends: []
  59965. }),
  59966. $globals.SetTest.a$cls);
  59967. $core.addClass("ConsoleTranscriptTest", $globals.TestCase, [], "Kernel-Tests");
  59968. $core.addMethod(
  59969. $core.method({
  59970. selector: "testShow",
  59971. protocol: "tests",
  59972. fn: function (){
  59973. var self=this,$self=this;
  59974. var originalTranscript;
  59975. return $core.withContext(function($ctx1) {
  59976. originalTranscript=$recv($globals.Transcript)._current();
  59977. $recv($globals.Transcript)._register_($recv($globals.ConsoleTranscript)._new());
  59978. $ctx1.sendIdx["register:"]=1;
  59979. $self._shouldnt_raise_((function(){
  59980. return $core.withContext(function($ctx2) {
  59981. return $recv($globals.Transcript)._show_("Hello console!");
  59982. $ctx2.sendIdx["show:"]=1;
  59983. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59984. }),$globals.Error);
  59985. $ctx1.sendIdx["shouldnt:raise:"]=1;
  59986. $self._shouldnt_raise_((function(){
  59987. return $core.withContext(function($ctx2) {
  59988. return $recv($globals.Transcript)._show_(console);
  59989. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59990. }),$globals.Error);
  59991. $recv($globals.Transcript)._register_(originalTranscript);
  59992. return self;
  59993. }, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript})});
  59994. },
  59995. args: [],
  59996. 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.",
  59997. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"],
  59998. pragmas: [],
  59999. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"]
  60000. }),
  60001. $globals.ConsoleTranscriptTest);
  60002. $core.addClass("DateTest", $globals.TestCase, [], "Kernel-Tests");
  60003. $core.addMethod(
  60004. $core.method({
  60005. selector: "testEquality",
  60006. protocol: "tests",
  60007. fn: function (){
  60008. var self=this,$self=this;
  60009. var now;
  60010. return $core.withContext(function($ctx1) {
  60011. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  60012. now=$recv($globals.Date)._new();
  60013. $1=$recv(now).__eq(now);
  60014. $ctx1.sendIdx["="]=1;
  60015. $self._assert_($1);
  60016. $ctx1.sendIdx["assert:"]=1;
  60017. $3=now;
  60018. $4=$recv($globals.Date)._fromMilliseconds_((0));
  60019. $ctx1.sendIdx["fromMilliseconds:"]=1;
  60020. $2=$recv($3).__eq($4);
  60021. $ctx1.sendIdx["="]=2;
  60022. $self._deny_($2);
  60023. $6=$recv($globals.Date)._fromMilliseconds_((12345678));
  60024. $ctx1.sendIdx["fromMilliseconds:"]=2;
  60025. $7=$recv($globals.Date)._fromMilliseconds_((12345678));
  60026. $ctx1.sendIdx["fromMilliseconds:"]=3;
  60027. $5=$recv($6).__eq($7);
  60028. $ctx1.sendIdx["="]=3;
  60029. $self._assert_($5);
  60030. $ctx1.sendIdx["assert:"]=2;
  60031. $9=now;
  60032. $11=$recv(now)._asMilliseconds();
  60033. $ctx1.sendIdx["asMilliseconds"]=1;
  60034. $10=$recv($globals.Date)._fromMilliseconds_($11);
  60035. $ctx1.sendIdx["fromMilliseconds:"]=4;
  60036. $8=$recv($9).__eq($10);
  60037. $ctx1.sendIdx["="]=4;
  60038. $self._assert_($8);
  60039. $ctx1.sendIdx["assert:"]=3;
  60040. $self._assert_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq(now));
  60041. return self;
  60042. }, function($ctx1) {$ctx1.fill(self,"testEquality",{now:now})});
  60043. },
  60044. args: [],
  60045. 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",
  60046. referencedClasses: ["Date"],
  60047. pragmas: [],
  60048. messageSends: ["new", "assert:", "=", "deny:", "fromMilliseconds:", "asMilliseconds"]
  60049. }),
  60050. $globals.DateTest);
  60051. $core.addMethod(
  60052. $core.method({
  60053. selector: "testIdentity",
  60054. protocol: "tests",
  60055. fn: function (){
  60056. var self=this,$self=this;
  60057. var now;
  60058. return $core.withContext(function($ctx1) {
  60059. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  60060. now=$recv($globals.Date)._new();
  60061. $1=$recv(now).__eq_eq(now);
  60062. $ctx1.sendIdx["=="]=1;
  60063. $self._assert_($1);
  60064. $3=now;
  60065. $4=$recv($globals.Date)._fromMilliseconds_((0));
  60066. $ctx1.sendIdx["fromMilliseconds:"]=1;
  60067. $2=$recv($3).__eq_eq($4);
  60068. $ctx1.sendIdx["=="]=2;
  60069. $self._deny_($2);
  60070. $ctx1.sendIdx["deny:"]=1;
  60071. $6=$recv($globals.Date)._fromMilliseconds_((12345678));
  60072. $ctx1.sendIdx["fromMilliseconds:"]=2;
  60073. $7=$recv($globals.Date)._fromMilliseconds_((12345678));
  60074. $ctx1.sendIdx["fromMilliseconds:"]=3;
  60075. $5=$recv($6).__eq_eq($7);
  60076. $ctx1.sendIdx["=="]=3;
  60077. $self._deny_($5);
  60078. $ctx1.sendIdx["deny:"]=2;
  60079. $9=now;
  60080. $11=$recv(now)._asMilliseconds();
  60081. $ctx1.sendIdx["asMilliseconds"]=1;
  60082. $10=$recv($globals.Date)._fromMilliseconds_($11);
  60083. $ctx1.sendIdx["fromMilliseconds:"]=4;
  60084. $8=$recv($9).__eq_eq($10);
  60085. $ctx1.sendIdx["=="]=4;
  60086. $self._deny_($8);
  60087. $ctx1.sendIdx["deny:"]=3;
  60088. $self._deny_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq_eq(now));
  60089. return self;
  60090. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{now:now})});
  60091. },
  60092. args: [],
  60093. 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",
  60094. referencedClasses: ["Date"],
  60095. pragmas: [],
  60096. messageSends: ["new", "assert:", "==", "deny:", "fromMilliseconds:", "asMilliseconds"]
  60097. }),
  60098. $globals.DateTest);
  60099. $core.addMethod(
  60100. $core.method({
  60101. selector: "testPlusAndMinus",
  60102. protocol: "tests",
  60103. fn: function (){
  60104. var self=this,$self=this;
  60105. var a,b,now,zeroDuration;
  60106. return $core.withContext(function($ctx1) {
  60107. var $3,$4,$5,$2,$1,$7,$8,$6,$10,$11,$9,$13,$14,$12,$16,$18,$17,$15;
  60108. a=$recv($globals.Date)._fromString_("1974-07-12 14:30");
  60109. $ctx1.sendIdx["fromString:"]=1;
  60110. now=$recv($globals.Date)._now();
  60111. b=$recv($globals.Date)._fromString_("2616-03-06");
  60112. zeroDuration=(0);
  60113. $3=$recv(a).__minus(a);
  60114. $ctx1.sendIdx["-"]=1;
  60115. $4=$recv(now).__minus(now);
  60116. $ctx1.sendIdx["-"]=2;
  60117. $5=$recv(b).__minus(b);
  60118. $ctx1.sendIdx["-"]=3;
  60119. $2=[$3,$4,$5];
  60120. $1=$recv($2)._asSet();
  60121. $self._assert_equals_($1,$recv($globals.Set)._with_(zeroDuration));
  60122. $ctx1.sendIdx["assert:equals:"]=1;
  60123. $7=now;
  60124. $8=$recv(b).__minus(now);
  60125. $ctx1.sendIdx["-"]=4;
  60126. $6=$recv($7).__plus($8);
  60127. $ctx1.sendIdx["+"]=1;
  60128. $self._assert_equals_($6,b);
  60129. $ctx1.sendIdx["assert:equals:"]=2;
  60130. $10=a;
  60131. $11=$recv(b).__minus(a);
  60132. $ctx1.sendIdx["-"]=5;
  60133. $9=$recv($10).__plus($11);
  60134. $ctx1.sendIdx["+"]=2;
  60135. $self._assert_equals_($9,b);
  60136. $ctx1.sendIdx["assert:equals:"]=3;
  60137. $13=now;
  60138. $14=$recv(a).__minus(now);
  60139. $ctx1.sendIdx["-"]=6;
  60140. $12=$recv($13).__plus($14);
  60141. $ctx1.sendIdx["+"]=3;
  60142. $self._assert_equals_($12,a);
  60143. $ctx1.sendIdx["assert:equals:"]=4;
  60144. $16=a;
  60145. $18=$recv(now).__minus(a);
  60146. $ctx1.sendIdx["-"]=7;
  60147. $17=$recv($18).__plus($recv(b).__minus(now));
  60148. $15=$recv($16).__plus($17);
  60149. $ctx1.sendIdx["+"]=4;
  60150. $self._assert_equals_($15,b);
  60151. return self;
  60152. }, function($ctx1) {$ctx1.fill(self,"testPlusAndMinus",{a:a,b:b,now:now,zeroDuration:zeroDuration})});
  60153. },
  60154. args: [],
  60155. 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",
  60156. referencedClasses: ["Date", "Set"],
  60157. pragmas: [],
  60158. messageSends: ["fromString:", "now", "assert:equals:", "asSet", "-", "with:", "+"]
  60159. }),
  60160. $globals.DateTest);
  60161. $core.addClass("JSObjectProxyTest", $globals.TestCase, [], "Kernel-Tests");
  60162. $core.addMethod(
  60163. $core.method({
  60164. selector: "jsObject",
  60165. protocol: "accessing",
  60166. fn: function (){
  60167. var self=this,$self=this;
  60168. return $core.withContext(function($ctx1) {
  60169. return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: "", "e": null, "f": void 0};
  60170. return self;
  60171. }, function($ctx1) {$ctx1.fill(self,"jsObject",{})});
  60172. },
  60173. args: [],
  60174. 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}'>",
  60175. referencedClasses: [],
  60176. pragmas: [["inlineJS:", ["return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: \x22\x22, \x22e\x22: null, \x22f\x22: void 0}"]]],
  60177. messageSends: []
  60178. }),
  60179. $globals.JSObjectProxyTest);
  60180. $core.addMethod(
  60181. $core.method({
  60182. selector: "jsUndefined",
  60183. protocol: "accessing",
  60184. fn: function (){
  60185. var self=this,$self=this;
  60186. return $core.withContext(function($ctx1) {
  60187. return;
  60188. return self;
  60189. }, function($ctx1) {$ctx1.fill(self,"jsUndefined",{})});
  60190. },
  60191. args: [],
  60192. source: "jsUndefined\x0a\x09<inlineJS: 'return'>",
  60193. referencedClasses: [],
  60194. pragmas: [["inlineJS:", ["return"]]],
  60195. messageSends: []
  60196. }),
  60197. $globals.JSObjectProxyTest);
  60198. $core.addMethod(
  60199. $core.method({
  60200. selector: "testAtIfAbsent",
  60201. protocol: "tests",
  60202. fn: function (){
  60203. var self=this,$self=this;
  60204. var testObject;
  60205. return $core.withContext(function($ctx1) {
  60206. var $1,$2,$3;
  60207. testObject=$self._jsObject();
  60208. $1=$recv(testObject)._at_ifAbsent_("abc",(function(){
  60209. return "Property does not exist";
  60210. }));
  60211. $ctx1.sendIdx["at:ifAbsent:"]=1;
  60212. $self._assert_equals_($1,"Property does not exist");
  60213. $ctx1.sendIdx["assert:equals:"]=1;
  60214. $2=$recv(testObject)._at_ifAbsent_("e",(function(){
  60215. return "Property does not exist";
  60216. }));
  60217. $ctx1.sendIdx["at:ifAbsent:"]=2;
  60218. $self._assert_equals_($2,nil);
  60219. $ctx1.sendIdx["assert:equals:"]=2;
  60220. $3=$recv(testObject)._at_ifAbsent_("a",(function(){
  60221. return "Property does not exist";
  60222. }));
  60223. $ctx1.sendIdx["at:ifAbsent:"]=3;
  60224. $self._assert_equals_($3,(1));
  60225. $ctx1.sendIdx["assert:equals:"]=3;
  60226. $self._assert_equals_($recv(testObject)._at_ifAbsent_("f",(function(){
  60227. return "Property does not exist";
  60228. })),nil);
  60229. return self;
  60230. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject})});
  60231. },
  60232. args: [],
  60233. 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.",
  60234. referencedClasses: [],
  60235. pragmas: [],
  60236. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"]
  60237. }),
  60238. $globals.JSObjectProxyTest);
  60239. $core.addMethod(
  60240. $core.method({
  60241. selector: "testAtIfPresent",
  60242. protocol: "tests",
  60243. fn: function (){
  60244. var self=this,$self=this;
  60245. var testObject;
  60246. return $core.withContext(function($ctx1) {
  60247. var $2,$1,$4,$3,$6,$5;
  60248. testObject=$self._jsObject();
  60249. $1=$recv(testObject)._at_ifPresent_("abc",(function(x){
  60250. return $core.withContext(function($ctx2) {
  60251. $2=$recv(x)._asString();
  60252. $ctx2.sendIdx["asString"]=1;
  60253. return "hello ".__comma($2);
  60254. $ctx2.sendIdx[","]=1;
  60255. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  60256. }));
  60257. $ctx1.sendIdx["at:ifPresent:"]=1;
  60258. $self._assert_equals_($1,nil);
  60259. $ctx1.sendIdx["assert:equals:"]=1;
  60260. $3=$recv(testObject)._at_ifPresent_("e",(function(x){
  60261. return $core.withContext(function($ctx2) {
  60262. $4=$recv(x)._asString();
  60263. $ctx2.sendIdx["asString"]=2;
  60264. return "hello ".__comma($4);
  60265. $ctx2.sendIdx[","]=2;
  60266. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  60267. }));
  60268. $ctx1.sendIdx["at:ifPresent:"]=2;
  60269. $self._assert_equals_($3,"hello nil");
  60270. $ctx1.sendIdx["assert:equals:"]=2;
  60271. $5=$recv(testObject)._at_ifPresent_("a",(function(x){
  60272. return $core.withContext(function($ctx2) {
  60273. $6=$recv(x)._asString();
  60274. $ctx2.sendIdx["asString"]=3;
  60275. return "hello ".__comma($6);
  60276. $ctx2.sendIdx[","]=3;
  60277. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  60278. }));
  60279. $ctx1.sendIdx["at:ifPresent:"]=3;
  60280. $self._assert_equals_($5,"hello 1");
  60281. $ctx1.sendIdx["assert:equals:"]=3;
  60282. $self._assert_equals_($recv(testObject)._at_ifPresent_("f",(function(x){
  60283. return $core.withContext(function($ctx2) {
  60284. return "hello ".__comma($recv(x)._asString());
  60285. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)});
  60286. })),"hello nil");
  60287. return self;
  60288. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject})});
  60289. },
  60290. args: [],
  60291. 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'.",
  60292. referencedClasses: [],
  60293. pragmas: [],
  60294. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"]
  60295. }),
  60296. $globals.JSObjectProxyTest);
  60297. $core.addMethod(
  60298. $core.method({
  60299. selector: "testAtIfPresentIfAbsent",
  60300. protocol: "tests",
  60301. fn: function (){
  60302. var self=this,$self=this;
  60303. var testObject;
  60304. return $core.withContext(function($ctx1) {
  60305. var $2,$1,$4,$3,$6,$5;
  60306. testObject=$self._jsObject();
  60307. $1=$recv(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  60308. return $core.withContext(function($ctx2) {
  60309. $2=$recv(x)._asString();
  60310. $ctx2.sendIdx["asString"]=1;
  60311. return "hello ".__comma($2);
  60312. $ctx2.sendIdx[","]=1;
  60313. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  60314. }),(function(){
  60315. return "not present";
  60316. }));
  60317. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  60318. $self._assert_equals_($1,"not present");
  60319. $ctx1.sendIdx["assert:equals:"]=1;
  60320. $3=$recv(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  60321. return $core.withContext(function($ctx2) {
  60322. $4=$recv(x)._asString();
  60323. $ctx2.sendIdx["asString"]=2;
  60324. return "hello ".__comma($4);
  60325. $ctx2.sendIdx[","]=2;
  60326. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  60327. }),(function(){
  60328. return "not present";
  60329. }));
  60330. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  60331. $self._assert_equals_($3,"hello nil");
  60332. $ctx1.sendIdx["assert:equals:"]=2;
  60333. $5=$recv(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  60334. return $core.withContext(function($ctx2) {
  60335. $6=$recv(x)._asString();
  60336. $ctx2.sendIdx["asString"]=3;
  60337. return "hello ".__comma($6);
  60338. $ctx2.sendIdx[","]=3;
  60339. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)});
  60340. }),(function(){
  60341. return "not present";
  60342. }));
  60343. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  60344. $self._assert_equals_($5,"hello 1");
  60345. $ctx1.sendIdx["assert:equals:"]=3;
  60346. $self._assert_equals_($recv(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  60347. return $core.withContext(function($ctx2) {
  60348. return "hello ".__comma($recv(x)._asString());
  60349. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)});
  60350. }),(function(){
  60351. return "not present";
  60352. })),"hello nil");
  60353. return self;
  60354. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject})});
  60355. },
  60356. args: [],
  60357. 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'.",
  60358. referencedClasses: [],
  60359. pragmas: [],
  60360. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"]
  60361. }),
  60362. $globals.JSObjectProxyTest);
  60363. $core.addMethod(
  60364. $core.method({
  60365. selector: "testAtPut",
  60366. protocol: "tests",
  60367. fn: function (){
  60368. var self=this,$self=this;
  60369. var testObject;
  60370. return $core.withContext(function($ctx1) {
  60371. var $2,$1;
  60372. testObject=$self._jsObject();
  60373. $2=$recv(testObject)._at_("abc");
  60374. $ctx1.sendIdx["at:"]=1;
  60375. $1=$recv($2).__tild_eq("xyz");
  60376. $self._assert_($1);
  60377. $self._assert_equals_($recv(testObject)._at_put_("abc","xyz"),"xyz");
  60378. $ctx1.sendIdx["assert:equals:"]=1;
  60379. $self._assert_equals_($recv(testObject)._at_("abc"),"xyz");
  60380. return self;
  60381. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject})});
  60382. },
  60383. args: [],
  60384. 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'",
  60385. referencedClasses: [],
  60386. pragmas: [],
  60387. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"]
  60388. }),
  60389. $globals.JSObjectProxyTest);
  60390. $core.addMethod(
  60391. $core.method({
  60392. selector: "testComparison",
  60393. protocol: "tests",
  60394. fn: function (){
  60395. var self=this,$self=this;
  60396. return $core.withContext(function($ctx1) {
  60397. var $1,$2;
  60398. $self._assert_equals_($recv([console,(2)])._indexOf_(console),(1));
  60399. $1=$recv(console).__eq(console);
  60400. $ctx1.sendIdx["="]=1;
  60401. $self._assert_($1);
  60402. $2=$recv(console).__eq($recv($globals.Object)._new());
  60403. $ctx1.sendIdx["="]=2;
  60404. $self._deny_($2);
  60405. $ctx1.sendIdx["deny:"]=1;
  60406. $self._deny_($recv(console).__eq($self._jsObject()));
  60407. return self;
  60408. }, function($ctx1) {$ctx1.fill(self,"testComparison",{})});
  60409. },
  60410. args: [],
  60411. 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",
  60412. referencedClasses: ["Object"],
  60413. pragmas: [],
  60414. messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"]
  60415. }),
  60416. $globals.JSObjectProxyTest);
  60417. $core.addMethod(
  60418. $core.method({
  60419. selector: "testDNU",
  60420. protocol: "tests",
  60421. fn: function (){
  60422. var self=this,$self=this;
  60423. return $core.withContext(function($ctx1) {
  60424. $self._should_raise_((function(){
  60425. return $core.withContext(function($ctx2) {
  60426. return $recv($self._jsObject())._foo();
  60427. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60428. }),$globals.MessageNotUnderstood);
  60429. return self;
  60430. }, function($ctx1) {$ctx1.fill(self,"testDNU",{})});
  60431. },
  60432. args: [],
  60433. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  60434. referencedClasses: ["MessageNotUnderstood"],
  60435. pragmas: [],
  60436. messageSends: ["should:raise:", "foo", "jsObject"]
  60437. }),
  60438. $globals.JSObjectProxyTest);
  60439. $core.addMethod(
  60440. $core.method({
  60441. selector: "testDNUWithAllowJavaScriptCalls",
  60442. protocol: "tests",
  60443. fn: function (){
  60444. var self=this,$self=this;
  60445. var jsObject;
  60446. return $core.withContext(function($ctx1) {
  60447. jsObject=[];
  60448. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  60449. $self._should_raise_((function(){
  60450. return $core.withContext(function($ctx2) {
  60451. return $recv(jsObject)._foo();
  60452. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60453. }),$globals.MessageNotUnderstood);
  60454. return self;
  60455. }, function($ctx1) {$ctx1.fill(self,"testDNUWithAllowJavaScriptCalls",{jsObject:jsObject})});
  60456. },
  60457. args: [],
  60458. source: "testDNUWithAllowJavaScriptCalls\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09self should: [ jsObject foo ] raise: MessageNotUnderstood",
  60459. referencedClasses: ["MessageNotUnderstood"],
  60460. pragmas: [],
  60461. messageSends: ["basicAt:put:", "should:raise:", "foo"]
  60462. }),
  60463. $globals.JSObjectProxyTest);
  60464. $core.addMethod(
  60465. $core.method({
  60466. selector: "testMessageSend",
  60467. protocol: "tests",
  60468. fn: function (){
  60469. var self=this,$self=this;
  60470. return $core.withContext(function($ctx1) {
  60471. var $2,$1,$4,$3;
  60472. $2=$self._jsObject();
  60473. $ctx1.sendIdx["jsObject"]=1;
  60474. $1=$recv($2)._a();
  60475. $self._assert_equals_($1,(1));
  60476. $ctx1.sendIdx["assert:equals:"]=1;
  60477. $4=$self._jsObject();
  60478. $ctx1.sendIdx["jsObject"]=2;
  60479. $3=$recv($4)._b();
  60480. $self._assert_equals_($3,(2));
  60481. $ctx1.sendIdx["assert:equals:"]=2;
  60482. $self._assert_equals_($recv($self._jsObject())._c_((3)),(3));
  60483. return self;
  60484. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{})});
  60485. },
  60486. args: [],
  60487. 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",
  60488. referencedClasses: [],
  60489. pragmas: [],
  60490. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"]
  60491. }),
  60492. $globals.JSObjectProxyTest);
  60493. $core.addMethod(
  60494. $core.method({
  60495. selector: "testMethodWithArguments",
  60496. protocol: "tests",
  60497. fn: function (){
  60498. var self=this,$self=this;
  60499. return $core.withContext(function($ctx1) {
  60500. $self._assert_equals_($recv($self._jsObject())._c_((1)),(1));
  60501. return self;
  60502. }, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{})});
  60503. },
  60504. args: [],
  60505. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  60506. referencedClasses: [],
  60507. pragmas: [],
  60508. messageSends: ["assert:equals:", "c:", "jsObject"]
  60509. }),
  60510. $globals.JSObjectProxyTest);
  60511. $core.addMethod(
  60512. $core.method({
  60513. selector: "testNull",
  60514. protocol: "tests",
  60515. fn: function (){
  60516. var self=this,$self=this;
  60517. return $core.withContext(function($ctx1) {
  60518. var $2,$1;
  60519. $2=$recv($globals.JSObjectProxy)._null();
  60520. $ctx1.sendIdx["null"]=1;
  60521. $1=$recv($2)._isNil();
  60522. $self._assert_($1);
  60523. $self._assert_equals_($recv($globals.JSON)._stringify_($globals.HashedCollection._newFromPairs_(["foo",$recv($globals.JSObjectProxy)._null()])),"{\x22foo\x22:null}");
  60524. return self;
  60525. }, function($ctx1) {$ctx1.fill(self,"testNull",{})});
  60526. },
  60527. args: [],
  60528. source: "testNull\x0a\x09self assert: JSObjectProxy null isNil.\x0a\x09self\x0a\x09\x09assert: (JSON stringify: #{#foo -> JSObjectProxy null})\x0a\x09\x09equals: '{\x22foo\x22:null}'",
  60529. referencedClasses: ["JSObjectProxy", "JSON"],
  60530. pragmas: [],
  60531. messageSends: ["assert:", "isNil", "null", "assert:equals:", "stringify:"]
  60532. }),
  60533. $globals.JSObjectProxyTest);
  60534. $core.addMethod(
  60535. $core.method({
  60536. selector: "testPrinting",
  60537. protocol: "tests",
  60538. fn: function (){
  60539. var self=this,$self=this;
  60540. return $core.withContext(function($ctx1) {
  60541. $self._assert_equals_($recv($self._jsObject())._printString(),"[object Object]");
  60542. return self;
  60543. }, function($ctx1) {$ctx1.fill(self,"testPrinting",{})});
  60544. },
  60545. args: [],
  60546. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  60547. referencedClasses: [],
  60548. pragmas: [],
  60549. messageSends: ["assert:equals:", "printString", "jsObject"]
  60550. }),
  60551. $globals.JSObjectProxyTest);
  60552. $core.addMethod(
  60553. $core.method({
  60554. selector: "testPropertyThatReturnsEmptyString",
  60555. protocol: "tests",
  60556. fn: function (){
  60557. var self=this,$self=this;
  60558. var object;
  60559. return $core.withContext(function($ctx1) {
  60560. var $1;
  60561. object=$self._jsObject();
  60562. $1=$recv(object)._d();
  60563. $ctx1.sendIdx["d"]=1;
  60564. $self._assert_equals_($1,"");
  60565. $ctx1.sendIdx["assert:equals:"]=1;
  60566. $recv(object)._d_("hello");
  60567. $self._assert_equals_($recv(object)._d(),"hello");
  60568. return self;
  60569. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object})});
  60570. },
  60571. args: [],
  60572. 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'",
  60573. referencedClasses: [],
  60574. pragmas: [],
  60575. messageSends: ["jsObject", "assert:equals:", "d", "d:"]
  60576. }),
  60577. $globals.JSObjectProxyTest);
  60578. $core.addMethod(
  60579. $core.method({
  60580. selector: "testPropertyThatReturnsUndefined",
  60581. protocol: "tests",
  60582. fn: function (){
  60583. var self=this,$self=this;
  60584. var object;
  60585. return $core.withContext(function($ctx1) {
  60586. object=$self._jsObject();
  60587. $self._shouldnt_raise_((function(){
  60588. return $core.withContext(function($ctx2) {
  60589. return $recv(object)._e();
  60590. $ctx2.sendIdx["e"]=1;
  60591. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60592. }),$globals.MessageNotUnderstood);
  60593. $self._assert_($recv($recv(object)._e())._isNil());
  60594. return self;
  60595. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object})});
  60596. },
  60597. args: [],
  60598. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  60599. referencedClasses: ["MessageNotUnderstood"],
  60600. pragmas: [],
  60601. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"]
  60602. }),
  60603. $globals.JSObjectProxyTest);
  60604. $core.addMethod(
  60605. $core.method({
  60606. selector: "testSetPropertyWithFalsyValue",
  60607. protocol: "tests",
  60608. fn: function (){
  60609. var self=this,$self=this;
  60610. var jsObject;
  60611. return $core.withContext(function($ctx1) {
  60612. var $1,$2,$3,$4,$5;
  60613. jsObject=$self._jsObject();
  60614. $1=$recv(jsObject)._a();
  60615. $ctx1.sendIdx["a"]=1;
  60616. $self._assert_equals_($1,(1));
  60617. $ctx1.sendIdx["assert:equals:"]=1;
  60618. $recv(jsObject)._a_($recv($globals.JSObjectProxy)._null());
  60619. $ctx1.sendIdx["a:"]=1;
  60620. $2=$recv(jsObject)._a();
  60621. $ctx1.sendIdx["a"]=2;
  60622. $self._assert_equals_($2,nil);
  60623. $ctx1.sendIdx["assert:equals:"]=2;
  60624. $recv(jsObject)._a_((0));
  60625. $ctx1.sendIdx["a:"]=2;
  60626. $3=$recv(jsObject)._a();
  60627. $ctx1.sendIdx["a"]=3;
  60628. $self._assert_equals_($3,(0));
  60629. $ctx1.sendIdx["assert:equals:"]=3;
  60630. $recv(jsObject)._a_($self._jsUndefined());
  60631. $ctx1.sendIdx["a:"]=3;
  60632. $4=$recv(jsObject)._a();
  60633. $ctx1.sendIdx["a"]=4;
  60634. $self._assert_equals_($4,nil);
  60635. $ctx1.sendIdx["assert:equals:"]=4;
  60636. $recv(jsObject)._a_("");
  60637. $ctx1.sendIdx["a:"]=4;
  60638. $5=$recv(jsObject)._a();
  60639. $ctx1.sendIdx["a"]=5;
  60640. $self._assert_equals_($5,"");
  60641. $ctx1.sendIdx["assert:equals:"]=5;
  60642. $recv(jsObject)._a_(false);
  60643. $self._assert_equals_($recv(jsObject)._a(),false);
  60644. return self;
  60645. }, function($ctx1) {$ctx1.fill(self,"testSetPropertyWithFalsyValue",{jsObject:jsObject})});
  60646. },
  60647. args: [],
  60648. 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",
  60649. referencedClasses: ["JSObjectProxy"],
  60650. pragmas: [],
  60651. messageSends: ["jsObject", "assert:equals:", "a", "a:", "null", "jsUndefined"]
  60652. }),
  60653. $globals.JSObjectProxyTest);
  60654. $core.addMethod(
  60655. $core.method({
  60656. selector: "testUndefined",
  60657. protocol: "tests",
  60658. fn: function (){
  60659. var self=this,$self=this;
  60660. return $core.withContext(function($ctx1) {
  60661. var $2,$1;
  60662. $2=$recv($globals.JSObjectProxy)._undefined();
  60663. $ctx1.sendIdx["undefined"]=1;
  60664. $1=$recv($2)._isNil();
  60665. $self._assert_($1);
  60666. $self._assert_equals_($recv($globals.JSON)._stringify_($globals.HashedCollection._newFromPairs_(["foo",$recv($globals.JSObjectProxy)._undefined()])),"{}");
  60667. return self;
  60668. }, function($ctx1) {$ctx1.fill(self,"testUndefined",{})});
  60669. },
  60670. args: [],
  60671. source: "testUndefined\x0a\x09self assert: JSObjectProxy undefined isNil.\x0a\x09self\x0a\x09\x09assert: (JSON stringify: #{#foo -> JSObjectProxy undefined})\x0a\x09\x09equals: '{}'",
  60672. referencedClasses: ["JSObjectProxy", "JSON"],
  60673. pragmas: [],
  60674. messageSends: ["assert:", "isNil", "undefined", "assert:equals:", "stringify:"]
  60675. }),
  60676. $globals.JSObjectProxyTest);
  60677. $core.addMethod(
  60678. $core.method({
  60679. selector: "testValue",
  60680. protocol: "tests",
  60681. fn: function (){
  60682. var self=this,$self=this;
  60683. var testObject;
  60684. return $core.withContext(function($ctx1) {
  60685. testObject=$self._jsObject();
  60686. $recv(testObject)._at_put_("value","aValue");
  60687. $self._assert_equals_($recv(testObject)._value(),"aValue");
  60688. return self;
  60689. }, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject})});
  60690. },
  60691. args: [],
  60692. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  60693. referencedClasses: [],
  60694. pragmas: [],
  60695. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"]
  60696. }),
  60697. $globals.JSObjectProxyTest);
  60698. $core.addMethod(
  60699. $core.method({
  60700. selector: "testYourself",
  60701. protocol: "tests",
  60702. fn: function (){
  60703. var self=this,$self=this;
  60704. var object;
  60705. return $core.withContext(function($ctx1) {
  60706. var $1;
  60707. $1=$self._jsObject();
  60708. $recv($1)._d_("test");
  60709. object=$recv($1)._yourself();
  60710. $self._assert_equals_($recv(object)._d(),"test");
  60711. return self;
  60712. }, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object})});
  60713. },
  60714. args: [],
  60715. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  60716. referencedClasses: [],
  60717. pragmas: [],
  60718. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"]
  60719. }),
  60720. $globals.JSObjectProxyTest);
  60721. $core.addClass("JavaScriptExceptionTest", $globals.TestCase, [], "Kernel-Tests");
  60722. $core.addMethod(
  60723. $core.method({
  60724. selector: "testCatchingException",
  60725. protocol: "tests",
  60726. fn: function (){
  60727. var self=this,$self=this;
  60728. return $core.withContext(function($ctx1) {
  60729. $recv((function(){
  60730. return $core.withContext(function($ctx2) {
  60731. return $self._throwException();
  60732. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60733. }))._on_do_($globals.Error,(function(error){
  60734. return $core.withContext(function($ctx2) {
  60735. return $self._assert_($recv($recv(error)._exception()).__eq("test"));
  60736. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  60737. }));
  60738. return self;
  60739. }, function($ctx1) {$ctx1.fill(self,"testCatchingException",{})});
  60740. },
  60741. args: [],
  60742. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  60743. referencedClasses: ["Error"],
  60744. pragmas: [],
  60745. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"]
  60746. }),
  60747. $globals.JavaScriptExceptionTest);
  60748. $core.addMethod(
  60749. $core.method({
  60750. selector: "testRaisingException",
  60751. protocol: "tests",
  60752. fn: function (){
  60753. var self=this,$self=this;
  60754. return $core.withContext(function($ctx1) {
  60755. $self._should_raise_((function(){
  60756. return $core.withContext(function($ctx2) {
  60757. return $self._throwException();
  60758. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60759. }),$globals.JavaScriptException);
  60760. return self;
  60761. }, function($ctx1) {$ctx1.fill(self,"testRaisingException",{})});
  60762. },
  60763. args: [],
  60764. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  60765. referencedClasses: ["JavaScriptException"],
  60766. pragmas: [],
  60767. messageSends: ["should:raise:", "throwException"]
  60768. }),
  60769. $globals.JavaScriptExceptionTest);
  60770. $core.addMethod(
  60771. $core.method({
  60772. selector: "throwException",
  60773. protocol: "helpers",
  60774. fn: function (){
  60775. var self=this,$self=this;
  60776. return $core.withContext(function($ctx1) {
  60777. throw "test";
  60778. return self;
  60779. }, function($ctx1) {$ctx1.fill(self,"throwException",{})});
  60780. },
  60781. args: [],
  60782. source: "throwException\x0a\x09<inlineJS: 'throw \x22test\x22'>",
  60783. referencedClasses: [],
  60784. pragmas: [["inlineJS:", ["throw \x22test\x22"]]],
  60785. messageSends: []
  60786. }),
  60787. $globals.JavaScriptExceptionTest);
  60788. $core.addClass("MessageSendTest", $globals.TestCase, [], "Kernel-Tests");
  60789. $core.addMethod(
  60790. $core.method({
  60791. selector: "testValue",
  60792. protocol: "tests",
  60793. fn: function (){
  60794. var self=this,$self=this;
  60795. var messageSend;
  60796. return $core.withContext(function($ctx1) {
  60797. var $1;
  60798. $1=$recv($globals.MessageSend)._new();
  60799. $ctx1.sendIdx["new"]=1;
  60800. $recv($1)._receiver_($recv($globals.Object)._new());
  60801. $recv($1)._selector_("asString");
  60802. messageSend=$recv($1)._yourself();
  60803. $self._assert_equals_($recv(messageSend)._value(),"an Object");
  60804. return self;
  60805. }, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend})});
  60806. },
  60807. args: [],
  60808. 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'",
  60809. referencedClasses: ["MessageSend", "Object"],
  60810. pragmas: [],
  60811. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"]
  60812. }),
  60813. $globals.MessageSendTest);
  60814. $core.addMethod(
  60815. $core.method({
  60816. selector: "testValueWithArguments",
  60817. protocol: "tests",
  60818. fn: function (){
  60819. var self=this,$self=this;
  60820. var messageSend;
  60821. return $core.withContext(function($ctx1) {
  60822. var $1;
  60823. $1=$recv($globals.MessageSend)._new();
  60824. $recv($1)._receiver_((2));
  60825. $recv($1)._selector_("+");
  60826. messageSend=$recv($1)._yourself();
  60827. $self._assert_equals_($recv(messageSend)._value_((3)),(5));
  60828. $ctx1.sendIdx["assert:equals:"]=1;
  60829. $self._assert_equals_($recv(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  60830. return self;
  60831. }, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend})});
  60832. },
  60833. args: [],
  60834. 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",
  60835. referencedClasses: ["MessageSend"],
  60836. pragmas: [],
  60837. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"]
  60838. }),
  60839. $globals.MessageSendTest);
  60840. $core.addClass("MethodInheritanceTest", $globals.TestCase, ["receiverTop", "receiverMiddle", "receiverBottom", "method", "performBlock"], "Kernel-Tests");
  60841. $core.addMethod(
  60842. $core.method({
  60843. selector: "codeGeneratorClass",
  60844. protocol: "accessing",
  60845. fn: function (){
  60846. var self=this,$self=this;
  60847. return $globals.CodeGenerator;
  60848. },
  60849. args: [],
  60850. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  60851. referencedClasses: ["CodeGenerator"],
  60852. pragmas: [],
  60853. messageSends: []
  60854. }),
  60855. $globals.MethodInheritanceTest);
  60856. $core.addMethod(
  60857. $core.method({
  60858. selector: "compiler",
  60859. protocol: "factory",
  60860. fn: function (){
  60861. var self=this,$self=this;
  60862. return $core.withContext(function($ctx1) {
  60863. var $1;
  60864. $1=$recv($globals.Compiler)._new();
  60865. $recv($1)._codeGeneratorClass_($self._codeGeneratorClass());
  60866. return $recv($1)._yourself();
  60867. }, function($ctx1) {$ctx1.fill(self,"compiler",{})});
  60868. },
  60869. args: [],
  60870. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  60871. referencedClasses: ["Compiler"],
  60872. pragmas: [],
  60873. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  60874. }),
  60875. $globals.MethodInheritanceTest);
  60876. $core.addMethod(
  60877. $core.method({
  60878. selector: "deinstallBottom",
  60879. protocol: "testing",
  60880. fn: function (){
  60881. var self=this,$self=this;
  60882. return $core.withContext(function($ctx1) {
  60883. $recv($self._targetClassBottom())._removeCompiledMethod_($self.method);
  60884. return self;
  60885. }, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{})});
  60886. },
  60887. args: [],
  60888. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  60889. referencedClasses: [],
  60890. pragmas: [],
  60891. messageSends: ["removeCompiledMethod:", "targetClassBottom"]
  60892. }),
  60893. $globals.MethodInheritanceTest);
  60894. $core.addMethod(
  60895. $core.method({
  60896. selector: "deinstallMiddle",
  60897. protocol: "testing",
  60898. fn: function (){
  60899. var self=this,$self=this;
  60900. return $core.withContext(function($ctx1) {
  60901. $recv($self._targetClassMiddle())._removeCompiledMethod_($self.method);
  60902. return self;
  60903. }, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{})});
  60904. },
  60905. args: [],
  60906. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  60907. referencedClasses: [],
  60908. pragmas: [],
  60909. messageSends: ["removeCompiledMethod:", "targetClassMiddle"]
  60910. }),
  60911. $globals.MethodInheritanceTest);
  60912. $core.addMethod(
  60913. $core.method({
  60914. selector: "deinstallTop",
  60915. protocol: "testing",
  60916. fn: function (){
  60917. var self=this,$self=this;
  60918. return $core.withContext(function($ctx1) {
  60919. $recv($self._targetClassTop())._removeCompiledMethod_($self.method);
  60920. return self;
  60921. }, function($ctx1) {$ctx1.fill(self,"deinstallTop",{})});
  60922. },
  60923. args: [],
  60924. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  60925. referencedClasses: [],
  60926. pragmas: [],
  60927. messageSends: ["removeCompiledMethod:", "targetClassTop"]
  60928. }),
  60929. $globals.MethodInheritanceTest);
  60930. $core.addMethod(
  60931. $core.method({
  60932. selector: "installBottom:",
  60933. protocol: "testing",
  60934. fn: function (aString){
  60935. var self=this,$self=this;
  60936. return $core.withContext(function($ctx1) {
  60937. $self.method=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassBottom(),"tests");
  60938. return self;
  60939. }, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString})});
  60940. },
  60941. args: ["aString"],
  60942. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  60943. referencedClasses: [],
  60944. pragmas: [],
  60945. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"]
  60946. }),
  60947. $globals.MethodInheritanceTest);
  60948. $core.addMethod(
  60949. $core.method({
  60950. selector: "installMiddle:",
  60951. protocol: "testing",
  60952. fn: function (aString){
  60953. var self=this,$self=this;
  60954. return $core.withContext(function($ctx1) {
  60955. $self.method=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassMiddle(),"tests");
  60956. return self;
  60957. }, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString})});
  60958. },
  60959. args: ["aString"],
  60960. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  60961. referencedClasses: [],
  60962. pragmas: [],
  60963. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"]
  60964. }),
  60965. $globals.MethodInheritanceTest);
  60966. $core.addMethod(
  60967. $core.method({
  60968. selector: "installTop:",
  60969. protocol: "testing",
  60970. fn: function (aString){
  60971. var self=this,$self=this;
  60972. return $core.withContext(function($ctx1) {
  60973. $self.method=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassTop(),"tests");
  60974. return self;
  60975. }, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString})});
  60976. },
  60977. args: ["aString"],
  60978. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  60979. referencedClasses: [],
  60980. pragmas: [],
  60981. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"]
  60982. }),
  60983. $globals.MethodInheritanceTest);
  60984. $core.addMethod(
  60985. $core.method({
  60986. selector: "setUp",
  60987. protocol: "initialization",
  60988. fn: function (){
  60989. var self=this,$self=this;
  60990. return $core.withContext(function($ctx1) {
  60991. $self.receiverTop=$recv($self._targetClassTop())._new();
  60992. $ctx1.sendIdx["new"]=1;
  60993. $self.receiverMiddle=$recv($self._targetClassMiddle())._new();
  60994. $ctx1.sendIdx["new"]=2;
  60995. $self.receiverBottom=$recv($self._targetClassBottom())._new();
  60996. $self.method=nil;
  60997. $self.performBlock=(function(){
  60998. return $core.withContext(function($ctx2) {
  60999. return $self._error_("performBlock not initialized");
  61000. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61001. });
  61002. return self;
  61003. }, function($ctx1) {$ctx1.fill(self,"setUp",{})});
  61004. },
  61005. args: [],
  61006. 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' ]",
  61007. referencedClasses: [],
  61008. pragmas: [],
  61009. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"]
  61010. }),
  61011. $globals.MethodInheritanceTest);
  61012. $core.addMethod(
  61013. $core.method({
  61014. selector: "shouldMNU",
  61015. protocol: "testing",
  61016. fn: function (){
  61017. var self=this,$self=this;
  61018. return $core.withContext(function($ctx1) {
  61019. $self._shouldMNUTop();
  61020. $self._shouldMNUMiddle();
  61021. $self._shouldMNUBottom();
  61022. return self;
  61023. }, function($ctx1) {$ctx1.fill(self,"shouldMNU",{})});
  61024. },
  61025. args: [],
  61026. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  61027. referencedClasses: [],
  61028. pragmas: [],
  61029. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"]
  61030. }),
  61031. $globals.MethodInheritanceTest);
  61032. $core.addMethod(
  61033. $core.method({
  61034. selector: "shouldMNUBottom",
  61035. protocol: "testing",
  61036. fn: function (){
  61037. var self=this,$self=this;
  61038. return $core.withContext(function($ctx1) {
  61039. $self._should_raise_((function(){
  61040. return $core.withContext(function($ctx2) {
  61041. return $recv($self.performBlock)._value_($self.receiverBottom);
  61042. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61043. }),$globals.MessageNotUnderstood);
  61044. return self;
  61045. }, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{})});
  61046. },
  61047. args: [],
  61048. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  61049. referencedClasses: ["MessageNotUnderstood"],
  61050. pragmas: [],
  61051. messageSends: ["should:raise:", "value:"]
  61052. }),
  61053. $globals.MethodInheritanceTest);
  61054. $core.addMethod(
  61055. $core.method({
  61056. selector: "shouldMNUMiddle",
  61057. protocol: "testing",
  61058. fn: function (){
  61059. var self=this,$self=this;
  61060. return $core.withContext(function($ctx1) {
  61061. $self._should_raise_((function(){
  61062. return $core.withContext(function($ctx2) {
  61063. return $recv($self.performBlock)._value_($self.receiverMiddle);
  61064. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61065. }),$globals.MessageNotUnderstood);
  61066. return self;
  61067. }, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{})});
  61068. },
  61069. args: [],
  61070. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  61071. referencedClasses: ["MessageNotUnderstood"],
  61072. pragmas: [],
  61073. messageSends: ["should:raise:", "value:"]
  61074. }),
  61075. $globals.MethodInheritanceTest);
  61076. $core.addMethod(
  61077. $core.method({
  61078. selector: "shouldMNUTop",
  61079. protocol: "testing",
  61080. fn: function (){
  61081. var self=this,$self=this;
  61082. return $core.withContext(function($ctx1) {
  61083. $self._should_raise_((function(){
  61084. return $core.withContext(function($ctx2) {
  61085. return $recv($self.performBlock)._value_($self.receiverTop);
  61086. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61087. }),$globals.MessageNotUnderstood);
  61088. return self;
  61089. }, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{})});
  61090. },
  61091. args: [],
  61092. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  61093. referencedClasses: ["MessageNotUnderstood"],
  61094. pragmas: [],
  61095. messageSends: ["should:raise:", "value:"]
  61096. }),
  61097. $globals.MethodInheritanceTest);
  61098. $core.addMethod(
  61099. $core.method({
  61100. selector: "shouldReturn:",
  61101. protocol: "testing",
  61102. fn: function (anObject){
  61103. var self=this,$self=this;
  61104. var result;
  61105. return $core.withContext(function($ctx1) {
  61106. result=$recv($self.performBlock)._value_($self.receiverTop);
  61107. $ctx1.sendIdx["value:"]=1;
  61108. $self._assert_equals_(["top",anObject],["top",result]);
  61109. $ctx1.sendIdx["assert:equals:"]=1;
  61110. result=$recv($self.performBlock)._value_($self.receiverMiddle);
  61111. $ctx1.sendIdx["value:"]=2;
  61112. $self._assert_equals_(["middle",anObject],["middle",result]);
  61113. $ctx1.sendIdx["assert:equals:"]=2;
  61114. result=$recv($self.performBlock)._value_($self.receiverBottom);
  61115. $self._assert_equals_(["bottom",anObject],["bottom",result]);
  61116. return self;
  61117. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result})});
  61118. },
  61119. args: ["anObject"],
  61120. 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 }",
  61121. referencedClasses: [],
  61122. pragmas: [],
  61123. messageSends: ["value:", "assert:equals:"]
  61124. }),
  61125. $globals.MethodInheritanceTest);
  61126. $core.addMethod(
  61127. $core.method({
  61128. selector: "shouldReturn:and:and:",
  61129. protocol: "testing",
  61130. fn: function (anObject,anObject2,anObject3){
  61131. var self=this,$self=this;
  61132. var result;
  61133. return $core.withContext(function($ctx1) {
  61134. result=$recv($self.performBlock)._value_($self.receiverTop);
  61135. $ctx1.sendIdx["value:"]=1;
  61136. $self._assert_equals_(["top",anObject],["top",result]);
  61137. $ctx1.sendIdx["assert:equals:"]=1;
  61138. result=$recv($self.performBlock)._value_($self.receiverMiddle);
  61139. $ctx1.sendIdx["value:"]=2;
  61140. $self._assert_equals_(["middle",anObject2],["middle",result]);
  61141. $ctx1.sendIdx["assert:equals:"]=2;
  61142. result=$recv($self.performBlock)._value_($self.receiverBottom);
  61143. $self._assert_equals_(["bottom",anObject3],["bottom",result]);
  61144. return self;
  61145. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result})});
  61146. },
  61147. args: ["anObject", "anObject2", "anObject3"],
  61148. 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 }",
  61149. referencedClasses: [],
  61150. pragmas: [],
  61151. messageSends: ["value:", "assert:equals:"]
  61152. }),
  61153. $globals.MethodInheritanceTest);
  61154. $core.addMethod(
  61155. $core.method({
  61156. selector: "targetClassBottom",
  61157. protocol: "accessing",
  61158. fn: function (){
  61159. var self=this,$self=this;
  61160. return $globals.JavaScriptException;
  61161. },
  61162. args: [],
  61163. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  61164. referencedClasses: ["JavaScriptException"],
  61165. pragmas: [],
  61166. messageSends: []
  61167. }),
  61168. $globals.MethodInheritanceTest);
  61169. $core.addMethod(
  61170. $core.method({
  61171. selector: "targetClassMiddle",
  61172. protocol: "accessing",
  61173. fn: function (){
  61174. var self=this,$self=this;
  61175. return $globals.Error;
  61176. },
  61177. args: [],
  61178. source: "targetClassMiddle\x0a\x09^ Error",
  61179. referencedClasses: ["Error"],
  61180. pragmas: [],
  61181. messageSends: []
  61182. }),
  61183. $globals.MethodInheritanceTest);
  61184. $core.addMethod(
  61185. $core.method({
  61186. selector: "targetClassTop",
  61187. protocol: "accessing",
  61188. fn: function (){
  61189. var self=this,$self=this;
  61190. return $globals.Object;
  61191. },
  61192. args: [],
  61193. source: "targetClassTop\x0a\x09^ Object",
  61194. referencedClasses: ["Object"],
  61195. pragmas: [],
  61196. messageSends: []
  61197. }),
  61198. $globals.MethodInheritanceTest);
  61199. $core.addMethod(
  61200. $core.method({
  61201. selector: "tearDown",
  61202. protocol: "initialization",
  61203. fn: function (){
  61204. var self=this,$self=this;
  61205. return $core.withContext(function($ctx1) {
  61206. $recv((function(){
  61207. return $core.withContext(function($ctx2) {
  61208. return $self._deinstallTop();
  61209. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61210. }))._on_do_($globals.Error,(function(){
  61211. }));
  61212. $ctx1.sendIdx["on:do:"]=1;
  61213. $recv((function(){
  61214. return $core.withContext(function($ctx2) {
  61215. return $self._deinstallMiddle();
  61216. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  61217. }))._on_do_($globals.Error,(function(){
  61218. }));
  61219. $ctx1.sendIdx["on:do:"]=2;
  61220. $recv((function(){
  61221. return $core.withContext(function($ctx2) {
  61222. return $self._deinstallBottom();
  61223. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  61224. }))._on_do_($globals.Error,(function(){
  61225. }));
  61226. return self;
  61227. }, function($ctx1) {$ctx1.fill(self,"tearDown",{})});
  61228. },
  61229. args: [],
  61230. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  61231. referencedClasses: ["Error"],
  61232. pragmas: [],
  61233. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"]
  61234. }),
  61235. $globals.MethodInheritanceTest);
  61236. $core.addMethod(
  61237. $core.method({
  61238. selector: "testMNU11",
  61239. protocol: "tests",
  61240. fn: function (){
  61241. var self=this,$self=this;
  61242. return $core.withContext(function($ctx1) {
  61243. $self.performBlock=(function(x){
  61244. return $core.withContext(function($ctx2) {
  61245. return $recv(x)._foo();
  61246. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  61247. });
  61248. $self._shouldMNU();
  61249. $ctx1.sendIdx["shouldMNU"]=1;
  61250. $self._installTop_("foo ^ false");
  61251. $ctx1.sendIdx["installTop:"]=1;
  61252. $self._installTop_("foo ^ true");
  61253. $self._deinstallTop();
  61254. $self._shouldMNU();
  61255. return self;
  61256. }, function($ctx1) {$ctx1.fill(self,"testMNU11",{})});
  61257. },
  61258. args: [],
  61259. 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",
  61260. referencedClasses: [],
  61261. pragmas: [],
  61262. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"]
  61263. }),
  61264. $globals.MethodInheritanceTest);
  61265. $core.addMethod(
  61266. $core.method({
  61267. selector: "testMNU22",
  61268. protocol: "tests",
  61269. fn: function (){
  61270. var self=this,$self=this;
  61271. return $core.withContext(function($ctx1) {
  61272. $self.performBlock=(function(x){
  61273. return $core.withContext(function($ctx2) {
  61274. return $recv(x)._foo();
  61275. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  61276. });
  61277. $self._shouldMNU();
  61278. $ctx1.sendIdx["shouldMNU"]=1;
  61279. $self._installMiddle_("foo ^ false");
  61280. $ctx1.sendIdx["installMiddle:"]=1;
  61281. $self._installMiddle_("foo ^ true");
  61282. $self._deinstallMiddle();
  61283. $self._shouldMNU();
  61284. return self;
  61285. }, function($ctx1) {$ctx1.fill(self,"testMNU22",{})});
  61286. },
  61287. args: [],
  61288. 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",
  61289. referencedClasses: [],
  61290. pragmas: [],
  61291. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"]
  61292. }),
  61293. $globals.MethodInheritanceTest);
  61294. $core.addMethod(
  61295. $core.method({
  61296. selector: "testReturns1",
  61297. protocol: "tests",
  61298. fn: function (){
  61299. var self=this,$self=this;
  61300. return $core.withContext(function($ctx1) {
  61301. $self.performBlock=(function(x){
  61302. return $core.withContext(function($ctx2) {
  61303. return $recv(x)._foo();
  61304. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  61305. });
  61306. $self._installTop_("foo ^ false");
  61307. $ctx1.sendIdx["installTop:"]=1;
  61308. $self._shouldReturn_(false);
  61309. $ctx1.sendIdx["shouldReturn:"]=1;
  61310. $self._installTop_("foo ^ true");
  61311. $self._shouldReturn_(true);
  61312. return self;
  61313. }, function($ctx1) {$ctx1.fill(self,"testReturns1",{})});
  61314. },
  61315. args: [],
  61316. 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",
  61317. referencedClasses: [],
  61318. pragmas: [],
  61319. messageSends: ["foo", "installTop:", "shouldReturn:"]
  61320. }),
  61321. $globals.MethodInheritanceTest);
  61322. $core.addClass("NumberTest", $globals.TestCase, [], "Kernel-Tests");
  61323. $core.addMethod(
  61324. $core.method({
  61325. selector: "testAbs",
  61326. protocol: "tests",
  61327. fn: function (){
  61328. var self=this,$self=this;
  61329. return $core.withContext(function($ctx1) {
  61330. var $1;
  61331. $1=(4)._abs();
  61332. $ctx1.sendIdx["abs"]=1;
  61333. $self._assert_equals_($1,(4));
  61334. $ctx1.sendIdx["assert:equals:"]=1;
  61335. $self._assert_equals_((-4)._abs(),(4));
  61336. return self;
  61337. }, function($ctx1) {$ctx1.fill(self,"testAbs",{})});
  61338. },
  61339. args: [],
  61340. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  61341. referencedClasses: [],
  61342. pragmas: [],
  61343. messageSends: ["assert:equals:", "abs"]
  61344. }),
  61345. $globals.NumberTest);
  61346. $core.addMethod(
  61347. $core.method({
  61348. selector: "testArithmetic",
  61349. protocol: "tests",
  61350. fn: function (){
  61351. var self=this,$self=this;
  61352. return $core.withContext(function($ctx1) {
  61353. var $1,$2,$3,$5,$4;
  61354. $1=(1.5).__plus((1));
  61355. $ctx1.sendIdx["+"]=1;
  61356. $self._assert_equals_($1,(2.5));
  61357. $ctx1.sendIdx["assert:equals:"]=1;
  61358. $2=(2).__minus((1));
  61359. $ctx1.sendIdx["-"]=1;
  61360. $self._assert_equals_($2,(1));
  61361. $ctx1.sendIdx["assert:equals:"]=2;
  61362. $self._assert_equals_((-2).__minus((1)),(-3));
  61363. $ctx1.sendIdx["assert:equals:"]=3;
  61364. $self._assert_equals_((12).__slash((2)),(6));
  61365. $ctx1.sendIdx["assert:equals:"]=4;
  61366. $3=(3).__star((4));
  61367. $ctx1.sendIdx["*"]=1;
  61368. $self._assert_equals_($3,(12));
  61369. $ctx1.sendIdx["assert:equals:"]=5;
  61370. $self._assert_equals_((7).__slash_slash((2)),(3));
  61371. $ctx1.sendIdx["assert:equals:"]=6;
  61372. $self._assert_equals_((7).__backslash_backslash((2)),(1));
  61373. $ctx1.sendIdx["assert:equals:"]=7;
  61374. $5=(1).__plus((2));
  61375. $ctx1.sendIdx["+"]=2;
  61376. $4=$recv($5).__star((3));
  61377. $ctx1.sendIdx["*"]=2;
  61378. $self._assert_equals_($4,(9));
  61379. $ctx1.sendIdx["assert:equals:"]=8;
  61380. $self._assert_equals_((1).__plus((2).__star((3))),(7));
  61381. return self;
  61382. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{})});
  61383. },
  61384. args: [],
  61385. 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",
  61386. referencedClasses: [],
  61387. pragmas: [],
  61388. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"]
  61389. }),
  61390. $globals.NumberTest);
  61391. $core.addMethod(
  61392. $core.method({
  61393. selector: "testAsNumber",
  61394. protocol: "tests",
  61395. fn: function (){
  61396. var self=this,$self=this;
  61397. return $core.withContext(function($ctx1) {
  61398. $self._assert_equals_((3)._asNumber(),(3));
  61399. return self;
  61400. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{})});
  61401. },
  61402. args: [],
  61403. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  61404. referencedClasses: [],
  61405. pragmas: [],
  61406. messageSends: ["assert:equals:", "asNumber"]
  61407. }),
  61408. $globals.NumberTest);
  61409. $core.addMethod(
  61410. $core.method({
  61411. selector: "testBetweenAnd",
  61412. protocol: "tests",
  61413. fn: function (){
  61414. var self=this,$self=this;
  61415. return $core.withContext(function($ctx1) {
  61416. var $1,$3,$2,$5,$4;
  61417. $1=(4)._between_and_((3),(5));
  61418. $ctx1.sendIdx["between:and:"]=1;
  61419. $self._assert_($1);
  61420. $ctx1.sendIdx["assert:"]=1;
  61421. $3=(1)._between_and_((5),(6));
  61422. $ctx1.sendIdx["between:and:"]=2;
  61423. $2=$recv($3)._not();
  61424. $ctx1.sendIdx["not"]=1;
  61425. $self._assert_($2);
  61426. $ctx1.sendIdx["assert:"]=2;
  61427. $5=(90)._between_and_((67),(87));
  61428. $ctx1.sendIdx["between:and:"]=3;
  61429. $4=$recv($5)._not();
  61430. $self._assert_($4);
  61431. $ctx1.sendIdx["assert:"]=3;
  61432. $self._assert_((1)._between_and_((1),(1)));
  61433. return self;
  61434. }, function($ctx1) {$ctx1.fill(self,"testBetweenAnd",{})});
  61435. },
  61436. args: [],
  61437. 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).",
  61438. referencedClasses: [],
  61439. pragmas: [],
  61440. messageSends: ["assert:", "between:and:", "not"]
  61441. }),
  61442. $globals.NumberTest);
  61443. $core.addMethod(
  61444. $core.method({
  61445. selector: "testBitAnd",
  61446. protocol: "tests",
  61447. fn: function (){
  61448. var self=this,$self=this;
  61449. return $core.withContext(function($ctx1) {
  61450. var $1,$2;
  61451. $1=(15)._bitAnd_((2));
  61452. $ctx1.sendIdx["bitAnd:"]=1;
  61453. $self._assert_equals_($1,(2));
  61454. $ctx1.sendIdx["assert:equals:"]=1;
  61455. $2=(15)._bitAnd_((15));
  61456. $ctx1.sendIdx["bitAnd:"]=2;
  61457. $self._assert_equals_($2,(15));
  61458. $ctx1.sendIdx["assert:equals:"]=2;
  61459. $self._assert_equals_((-1)._bitAnd_((1021)),(1021));
  61460. return self;
  61461. }, function($ctx1) {$ctx1.fill(self,"testBitAnd",{})});
  61462. },
  61463. args: [],
  61464. 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",
  61465. referencedClasses: [],
  61466. pragmas: [],
  61467. messageSends: ["assert:equals:", "bitAnd:"]
  61468. }),
  61469. $globals.NumberTest);
  61470. $core.addMethod(
  61471. $core.method({
  61472. selector: "testBitNot",
  61473. protocol: "tests",
  61474. fn: function (){
  61475. var self=this,$self=this;
  61476. return $core.withContext(function($ctx1) {
  61477. var $1,$2;
  61478. $1=(2)._bitNot();
  61479. $ctx1.sendIdx["bitNot"]=1;
  61480. $self._assert_equals_($1,(-3));
  61481. $ctx1.sendIdx["assert:equals:"]=1;
  61482. $2=(-1)._bitNot();
  61483. $ctx1.sendIdx["bitNot"]=2;
  61484. $self._assert_equals_($2,(0));
  61485. $ctx1.sendIdx["assert:equals:"]=2;
  61486. $self._assert_equals_((-1022)._bitNot(),(1021));
  61487. return self;
  61488. }, function($ctx1) {$ctx1.fill(self,"testBitNot",{})});
  61489. },
  61490. args: [],
  61491. source: "testBitNot\x0a\x09self assert: 2 bitNot equals: -3.\x0a\x09self assert: -1 bitNot equals: 0.\x0a\x09self assert: -1022 bitNot equals: 1021",
  61492. referencedClasses: [],
  61493. pragmas: [],
  61494. messageSends: ["assert:equals:", "bitNot"]
  61495. }),
  61496. $globals.NumberTest);
  61497. $core.addMethod(
  61498. $core.method({
  61499. selector: "testBitOr",
  61500. protocol: "tests",
  61501. fn: function (){
  61502. var self=this,$self=this;
  61503. return $core.withContext(function($ctx1) {
  61504. var $1,$2;
  61505. $1=(2)._bitOr_((4));
  61506. $ctx1.sendIdx["bitOr:"]=1;
  61507. $self._assert_equals_($1,(6));
  61508. $ctx1.sendIdx["assert:equals:"]=1;
  61509. $2=(7)._bitOr_((2));
  61510. $ctx1.sendIdx["bitOr:"]=2;
  61511. $self._assert_equals_($2,(7));
  61512. $ctx1.sendIdx["assert:equals:"]=2;
  61513. $self._assert_equals_((-1)._bitOr_((1021)),(-1));
  61514. return self;
  61515. }, function($ctx1) {$ctx1.fill(self,"testBitOr",{})});
  61516. },
  61517. args: [],
  61518. 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",
  61519. referencedClasses: [],
  61520. pragmas: [],
  61521. messageSends: ["assert:equals:", "bitOr:"]
  61522. }),
  61523. $globals.NumberTest);
  61524. $core.addMethod(
  61525. $core.method({
  61526. selector: "testBitXor",
  61527. protocol: "tests",
  61528. fn: function (){
  61529. var self=this,$self=this;
  61530. return $core.withContext(function($ctx1) {
  61531. var $1,$2,$3;
  61532. $1=(2)._bitXor_((4));
  61533. $ctx1.sendIdx["bitXor:"]=1;
  61534. $self._assert_equals_($1,(6));
  61535. $ctx1.sendIdx["assert:equals:"]=1;
  61536. $2=(7)._bitXor_((2));
  61537. $ctx1.sendIdx["bitXor:"]=2;
  61538. $self._assert_equals_($2,(5));
  61539. $ctx1.sendIdx["assert:equals:"]=2;
  61540. $3=(-1)._bitXor_((1021));
  61541. $ctx1.sendIdx["bitXor:"]=3;
  61542. $self._assert_equals_($3,(-1022));
  61543. $ctx1.sendIdx["assert:equals:"]=3;
  61544. $self._assert_equals_((91)._bitXor_((91)),(0));
  61545. return self;
  61546. }, function($ctx1) {$ctx1.fill(self,"testBitXor",{})});
  61547. },
  61548. args: [],
  61549. 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",
  61550. referencedClasses: [],
  61551. pragmas: [],
  61552. messageSends: ["assert:equals:", "bitXor:"]
  61553. }),
  61554. $globals.NumberTest);
  61555. $core.addMethod(
  61556. $core.method({
  61557. selector: "testCeiling",
  61558. protocol: "tests",
  61559. fn: function (){
  61560. var self=this,$self=this;
  61561. return $core.withContext(function($ctx1) {
  61562. var $1,$2;
  61563. $1=(1.2)._ceiling();
  61564. $ctx1.sendIdx["ceiling"]=1;
  61565. $self._assert_equals_($1,(2));
  61566. $ctx1.sendIdx["assert:equals:"]=1;
  61567. $2=(-1.2)._ceiling();
  61568. $ctx1.sendIdx["ceiling"]=2;
  61569. $self._assert_equals_($2,(-1));
  61570. $ctx1.sendIdx["assert:equals:"]=2;
  61571. $self._assert_equals_((1)._ceiling(),(1));
  61572. return self;
  61573. }, function($ctx1) {$ctx1.fill(self,"testCeiling",{})});
  61574. },
  61575. args: [],
  61576. 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.",
  61577. referencedClasses: [],
  61578. pragmas: [],
  61579. messageSends: ["assert:equals:", "ceiling"]
  61580. }),
  61581. $globals.NumberTest);
  61582. $core.addMethod(
  61583. $core.method({
  61584. selector: "testComparison",
  61585. protocol: "tests",
  61586. fn: function (){
  61587. var self=this,$self=this;
  61588. return $core.withContext(function($ctx1) {
  61589. var $1,$2,$3,$4;
  61590. $1=(3).__gt((2));
  61591. $ctx1.sendIdx[">"]=1;
  61592. $self._assert_($1);
  61593. $ctx1.sendIdx["assert:"]=1;
  61594. $2=(2).__lt((3));
  61595. $ctx1.sendIdx["<"]=1;
  61596. $self._assert_($2);
  61597. $ctx1.sendIdx["assert:"]=2;
  61598. $self._deny_((3).__lt((2)));
  61599. $ctx1.sendIdx["deny:"]=1;
  61600. $self._deny_((2).__gt((3)));
  61601. $3=(3).__gt_eq((3));
  61602. $ctx1.sendIdx[">="]=1;
  61603. $self._assert_($3);
  61604. $ctx1.sendIdx["assert:"]=3;
  61605. $self._assert_((3.1).__gt_eq((3)));
  61606. $ctx1.sendIdx["assert:"]=4;
  61607. $4=(3).__lt_eq((3));
  61608. $ctx1.sendIdx["<="]=1;
  61609. $self._assert_($4);
  61610. $ctx1.sendIdx["assert:"]=5;
  61611. $self._assert_((3).__lt_eq((3.1)));
  61612. return self;
  61613. }, function($ctx1) {$ctx1.fill(self,"testComparison",{})});
  61614. },
  61615. args: [],
  61616. 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",
  61617. referencedClasses: [],
  61618. pragmas: [],
  61619. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="]
  61620. }),
  61621. $globals.NumberTest);
  61622. $core.addMethod(
  61623. $core.method({
  61624. selector: "testCopying",
  61625. protocol: "tests",
  61626. fn: function (){
  61627. var self=this,$self=this;
  61628. return $core.withContext(function($ctx1) {
  61629. var $1;
  61630. $1=$recv((1)._copy()).__eq_eq((1));
  61631. $ctx1.sendIdx["=="]=1;
  61632. $self._assert_($1);
  61633. $ctx1.sendIdx["assert:"]=1;
  61634. $self._assert_($recv((1)._deepCopy()).__eq_eq((1)));
  61635. return self;
  61636. }, function($ctx1) {$ctx1.fill(self,"testCopying",{})});
  61637. },
  61638. args: [],
  61639. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  61640. referencedClasses: [],
  61641. pragmas: [],
  61642. messageSends: ["assert:", "==", "copy", "deepCopy"]
  61643. }),
  61644. $globals.NumberTest);
  61645. $core.addMethod(
  61646. $core.method({
  61647. selector: "testDegreesToRadians",
  61648. protocol: "tests",
  61649. fn: function (){
  61650. var self=this,$self=this;
  61651. return $core.withContext(function($ctx1) {
  61652. $self._assert_($recv($recv($recv((180)._degreesToRadians()).__minus($recv($globals.Number)._pi()))._abs()).__lt_eq((0.01)));
  61653. return self;
  61654. }, function($ctx1) {$ctx1.fill(self,"testDegreesToRadians",{})});
  61655. },
  61656. args: [],
  61657. source: "testDegreesToRadians\x0a\x09self assert: (180 degreesToRadians - Number pi) abs <= 0.01.",
  61658. referencedClasses: ["Number"],
  61659. pragmas: [],
  61660. messageSends: ["assert:", "<=", "abs", "-", "degreesToRadians", "pi"]
  61661. }),
  61662. $globals.NumberTest);
  61663. $core.addMethod(
  61664. $core.method({
  61665. selector: "testEquality",
  61666. protocol: "tests",
  61667. fn: function (){
  61668. var self=this,$self=this;
  61669. return $core.withContext(function($ctx1) {
  61670. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  61671. $1=(1).__eq((1));
  61672. $ctx1.sendIdx["="]=1;
  61673. $self._assert_($1);
  61674. $ctx1.sendIdx["assert:"]=1;
  61675. $2=(0).__eq((0));
  61676. $ctx1.sendIdx["="]=2;
  61677. $self._assert_($2);
  61678. $ctx1.sendIdx["assert:"]=2;
  61679. $3=(1).__eq((0));
  61680. $ctx1.sendIdx["="]=3;
  61681. $self._deny_($3);
  61682. $ctx1.sendIdx["deny:"]=1;
  61683. $5=(1)._yourself();
  61684. $ctx1.sendIdx["yourself"]=1;
  61685. $4=$recv($5).__eq((1));
  61686. $ctx1.sendIdx["="]=4;
  61687. $self._assert_($4);
  61688. $ctx1.sendIdx["assert:"]=3;
  61689. $7=(1)._yourself();
  61690. $ctx1.sendIdx["yourself"]=2;
  61691. $6=(1).__eq($7);
  61692. $ctx1.sendIdx["="]=5;
  61693. $self._assert_($6);
  61694. $ctx1.sendIdx["assert:"]=4;
  61695. $9=(1)._yourself();
  61696. $ctx1.sendIdx["yourself"]=3;
  61697. $8=$recv($9).__eq((1)._yourself());
  61698. $ctx1.sendIdx["="]=6;
  61699. $self._assert_($8);
  61700. $10=(0).__eq(false);
  61701. $ctx1.sendIdx["="]=7;
  61702. $self._deny_($10);
  61703. $ctx1.sendIdx["deny:"]=2;
  61704. $11=false.__eq((0));
  61705. $ctx1.sendIdx["="]=8;
  61706. $self._deny_($11);
  61707. $ctx1.sendIdx["deny:"]=3;
  61708. $12="".__eq((0));
  61709. $ctx1.sendIdx["="]=9;
  61710. $self._deny_($12);
  61711. $ctx1.sendIdx["deny:"]=4;
  61712. $self._deny_((0).__eq(""));
  61713. return self;
  61714. }, function($ctx1) {$ctx1.fill(self,"testEquality",{})});
  61715. },
  61716. args: [],
  61717. 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 = ''",
  61718. referencedClasses: [],
  61719. pragmas: [],
  61720. messageSends: ["assert:", "=", "deny:", "yourself"]
  61721. }),
  61722. $globals.NumberTest);
  61723. $core.addMethod(
  61724. $core.method({
  61725. selector: "testFloor",
  61726. protocol: "tests",
  61727. fn: function (){
  61728. var self=this,$self=this;
  61729. return $core.withContext(function($ctx1) {
  61730. var $1,$2;
  61731. $1=(1.2)._floor();
  61732. $ctx1.sendIdx["floor"]=1;
  61733. $self._assert_equals_($1,(1));
  61734. $ctx1.sendIdx["assert:equals:"]=1;
  61735. $2=(-1.2)._floor();
  61736. $ctx1.sendIdx["floor"]=2;
  61737. $self._assert_equals_($2,(-2));
  61738. $ctx1.sendIdx["assert:equals:"]=2;
  61739. $self._assert_equals_((1)._floor(),(1));
  61740. return self;
  61741. }, function($ctx1) {$ctx1.fill(self,"testFloor",{})});
  61742. },
  61743. args: [],
  61744. 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.",
  61745. referencedClasses: [],
  61746. pragmas: [],
  61747. messageSends: ["assert:equals:", "floor"]
  61748. }),
  61749. $globals.NumberTest);
  61750. $core.addMethod(
  61751. $core.method({
  61752. selector: "testHexNumbers",
  61753. protocol: "tests",
  61754. fn: function (){
  61755. var self=this,$self=this;
  61756. return $core.withContext(function($ctx1) {
  61757. var $1,$2,$3,$4,$5;
  61758. $self._assert_equals_((9),(9));
  61759. $ctx1.sendIdx["assert:equals:"]=1;
  61760. $1=(10)._truncated();
  61761. $ctx1.sendIdx["truncated"]=1;
  61762. $self._assert_equals_($1,(10));
  61763. $ctx1.sendIdx["assert:equals:"]=2;
  61764. $2=(11)._truncated();
  61765. $ctx1.sendIdx["truncated"]=2;
  61766. $self._assert_equals_($2,(11));
  61767. $ctx1.sendIdx["assert:equals:"]=3;
  61768. $3=(12)._truncated();
  61769. $ctx1.sendIdx["truncated"]=3;
  61770. $self._assert_equals_($3,(12));
  61771. $ctx1.sendIdx["assert:equals:"]=4;
  61772. $4=(13)._truncated();
  61773. $ctx1.sendIdx["truncated"]=4;
  61774. $self._assert_equals_($4,(13));
  61775. $ctx1.sendIdx["assert:equals:"]=5;
  61776. $5=(14)._truncated();
  61777. $ctx1.sendIdx["truncated"]=5;
  61778. $self._assert_equals_($5,(14));
  61779. $ctx1.sendIdx["assert:equals:"]=6;
  61780. $self._assert_equals_((15)._truncated(),(15));
  61781. return self;
  61782. }, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{})});
  61783. },
  61784. args: [],
  61785. 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",
  61786. referencedClasses: [],
  61787. pragmas: [],
  61788. messageSends: ["assert:equals:", "truncated"]
  61789. }),
  61790. $globals.NumberTest);
  61791. $core.addMethod(
  61792. $core.method({
  61793. selector: "testIdentity",
  61794. protocol: "tests",
  61795. fn: function (){
  61796. var self=this,$self=this;
  61797. return $core.withContext(function($ctx1) {
  61798. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  61799. $1=(1).__eq_eq((1));
  61800. $ctx1.sendIdx["=="]=1;
  61801. $self._assert_($1);
  61802. $ctx1.sendIdx["assert:"]=1;
  61803. $2=(0).__eq_eq((0));
  61804. $ctx1.sendIdx["=="]=2;
  61805. $self._assert_($2);
  61806. $ctx1.sendIdx["assert:"]=2;
  61807. $3=(1).__eq_eq((0));
  61808. $ctx1.sendIdx["=="]=3;
  61809. $self._deny_($3);
  61810. $ctx1.sendIdx["deny:"]=1;
  61811. $5=(1)._yourself();
  61812. $ctx1.sendIdx["yourself"]=1;
  61813. $4=$recv($5).__eq_eq((1));
  61814. $ctx1.sendIdx["=="]=4;
  61815. $self._assert_($4);
  61816. $ctx1.sendIdx["assert:"]=3;
  61817. $7=(1)._yourself();
  61818. $ctx1.sendIdx["yourself"]=2;
  61819. $6=(1).__eq_eq($7);
  61820. $ctx1.sendIdx["=="]=5;
  61821. $self._assert_($6);
  61822. $ctx1.sendIdx["assert:"]=4;
  61823. $9=(1)._yourself();
  61824. $ctx1.sendIdx["yourself"]=3;
  61825. $8=$recv($9).__eq_eq((1)._yourself());
  61826. $ctx1.sendIdx["=="]=6;
  61827. $self._assert_($8);
  61828. $self._deny_((1).__eq_eq((2)));
  61829. return self;
  61830. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{})});
  61831. },
  61832. args: [],
  61833. 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",
  61834. referencedClasses: [],
  61835. pragmas: [],
  61836. messageSends: ["assert:", "==", "deny:", "yourself"]
  61837. }),
  61838. $globals.NumberTest);
  61839. $core.addMethod(
  61840. $core.method({
  61841. selector: "testInvalidHexNumbers",
  61842. protocol: "tests",
  61843. fn: function (){
  61844. var self=this,$self=this;
  61845. return $core.withContext(function($ctx1) {
  61846. $self._should_raise_((function(){
  61847. return $core.withContext(function($ctx2) {
  61848. return (16)._rG();
  61849. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61850. }),$globals.MessageNotUnderstood);
  61851. $ctx1.sendIdx["should:raise:"]=1;
  61852. $self._should_raise_((function(){
  61853. return $core.withContext(function($ctx2) {
  61854. return (16)._rg();
  61855. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61856. }),$globals.MessageNotUnderstood);
  61857. $ctx1.sendIdx["should:raise:"]=2;
  61858. $self._should_raise_((function(){
  61859. return $core.withContext(function($ctx2) {
  61860. return (16)._rH();
  61861. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  61862. }),$globals.MessageNotUnderstood);
  61863. $ctx1.sendIdx["should:raise:"]=3;
  61864. $self._should_raise_((function(){
  61865. return $core.withContext(function($ctx2) {
  61866. return (16)._rh();
  61867. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  61868. }),$globals.MessageNotUnderstood);
  61869. $ctx1.sendIdx["should:raise:"]=4;
  61870. $self._should_raise_((function(){
  61871. return $core.withContext(function($ctx2) {
  61872. return (16)._rI();
  61873. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  61874. }),$globals.MessageNotUnderstood);
  61875. $ctx1.sendIdx["should:raise:"]=5;
  61876. $self._should_raise_((function(){
  61877. return $core.withContext(function($ctx2) {
  61878. return (16)._ri();
  61879. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  61880. }),$globals.MessageNotUnderstood);
  61881. $ctx1.sendIdx["should:raise:"]=6;
  61882. $self._should_raise_((function(){
  61883. return $core.withContext(function($ctx2) {
  61884. return (16)._rJ();
  61885. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  61886. }),$globals.MessageNotUnderstood);
  61887. $ctx1.sendIdx["should:raise:"]=7;
  61888. $self._should_raise_((function(){
  61889. return $core.withContext(function($ctx2) {
  61890. return (16)._rj();
  61891. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)});
  61892. }),$globals.MessageNotUnderstood);
  61893. $ctx1.sendIdx["should:raise:"]=8;
  61894. $self._should_raise_((function(){
  61895. return $core.withContext(function($ctx2) {
  61896. return (16)._rK();
  61897. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  61898. }),$globals.MessageNotUnderstood);
  61899. $ctx1.sendIdx["should:raise:"]=9;
  61900. $self._should_raise_((function(){
  61901. return $core.withContext(function($ctx2) {
  61902. return (16)._rk();
  61903. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)});
  61904. }),$globals.MessageNotUnderstood);
  61905. $ctx1.sendIdx["should:raise:"]=10;
  61906. $self._should_raise_((function(){
  61907. return $core.withContext(function($ctx2) {
  61908. return (16)._rL();
  61909. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  61910. }),$globals.MessageNotUnderstood);
  61911. $ctx1.sendIdx["should:raise:"]=11;
  61912. $self._should_raise_((function(){
  61913. return $core.withContext(function($ctx2) {
  61914. return (16)._rl();
  61915. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  61916. }),$globals.MessageNotUnderstood);
  61917. $ctx1.sendIdx["should:raise:"]=12;
  61918. $self._should_raise_((function(){
  61919. return $core.withContext(function($ctx2) {
  61920. return (16)._rM();
  61921. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)});
  61922. }),$globals.MessageNotUnderstood);
  61923. $ctx1.sendIdx["should:raise:"]=13;
  61924. $self._should_raise_((function(){
  61925. return $core.withContext(function($ctx2) {
  61926. return (16)._rm();
  61927. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  61928. }),$globals.MessageNotUnderstood);
  61929. $ctx1.sendIdx["should:raise:"]=14;
  61930. $self._should_raise_((function(){
  61931. return $core.withContext(function($ctx2) {
  61932. return (16)._rN();
  61933. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)});
  61934. }),$globals.MessageNotUnderstood);
  61935. $ctx1.sendIdx["should:raise:"]=15;
  61936. $self._should_raise_((function(){
  61937. return $core.withContext(function($ctx2) {
  61938. return (16)._rn();
  61939. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)});
  61940. }),$globals.MessageNotUnderstood);
  61941. $ctx1.sendIdx["should:raise:"]=16;
  61942. $self._should_raise_((function(){
  61943. return $core.withContext(function($ctx2) {
  61944. return (16)._rO();
  61945. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)});
  61946. }),$globals.MessageNotUnderstood);
  61947. $ctx1.sendIdx["should:raise:"]=17;
  61948. $self._should_raise_((function(){
  61949. return $core.withContext(function($ctx2) {
  61950. return (16)._ro();
  61951. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)});
  61952. }),$globals.MessageNotUnderstood);
  61953. $ctx1.sendIdx["should:raise:"]=18;
  61954. $self._should_raise_((function(){
  61955. return $core.withContext(function($ctx2) {
  61956. return (16)._rP();
  61957. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)});
  61958. }),$globals.MessageNotUnderstood);
  61959. $ctx1.sendIdx["should:raise:"]=19;
  61960. $self._should_raise_((function(){
  61961. return $core.withContext(function($ctx2) {
  61962. return (16)._rp();
  61963. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)});
  61964. }),$globals.MessageNotUnderstood);
  61965. $ctx1.sendIdx["should:raise:"]=20;
  61966. $self._should_raise_((function(){
  61967. return $core.withContext(function($ctx2) {
  61968. return (16)._rQ();
  61969. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)});
  61970. }),$globals.MessageNotUnderstood);
  61971. $ctx1.sendIdx["should:raise:"]=21;
  61972. $self._should_raise_((function(){
  61973. return $core.withContext(function($ctx2) {
  61974. return (16)._rq();
  61975. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)});
  61976. }),$globals.MessageNotUnderstood);
  61977. $ctx1.sendIdx["should:raise:"]=22;
  61978. $self._should_raise_((function(){
  61979. return $core.withContext(function($ctx2) {
  61980. return (16)._rR();
  61981. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)});
  61982. }),$globals.MessageNotUnderstood);
  61983. $ctx1.sendIdx["should:raise:"]=23;
  61984. $self._should_raise_((function(){
  61985. return $core.withContext(function($ctx2) {
  61986. return (16)._rr();
  61987. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)});
  61988. }),$globals.MessageNotUnderstood);
  61989. $ctx1.sendIdx["should:raise:"]=24;
  61990. $self._should_raise_((function(){
  61991. return $core.withContext(function($ctx2) {
  61992. return (16)._rS();
  61993. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)});
  61994. }),$globals.MessageNotUnderstood);
  61995. $ctx1.sendIdx["should:raise:"]=25;
  61996. $self._should_raise_((function(){
  61997. return $core.withContext(function($ctx2) {
  61998. return (16)._rs();
  61999. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)});
  62000. }),$globals.MessageNotUnderstood);
  62001. $ctx1.sendIdx["should:raise:"]=26;
  62002. $self._should_raise_((function(){
  62003. return $core.withContext(function($ctx2) {
  62004. return (16)._rT();
  62005. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)});
  62006. }),$globals.MessageNotUnderstood);
  62007. $ctx1.sendIdx["should:raise:"]=27;
  62008. $self._should_raise_((function(){
  62009. return $core.withContext(function($ctx2) {
  62010. return (16)._rt();
  62011. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)});
  62012. }),$globals.MessageNotUnderstood);
  62013. $ctx1.sendIdx["should:raise:"]=28;
  62014. $self._should_raise_((function(){
  62015. return $core.withContext(function($ctx2) {
  62016. return (16)._rU();
  62017. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)});
  62018. }),$globals.MessageNotUnderstood);
  62019. $ctx1.sendIdx["should:raise:"]=29;
  62020. $self._should_raise_((function(){
  62021. return $core.withContext(function($ctx2) {
  62022. return (16)._ru();
  62023. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)});
  62024. }),$globals.MessageNotUnderstood);
  62025. $ctx1.sendIdx["should:raise:"]=30;
  62026. $self._should_raise_((function(){
  62027. return $core.withContext(function($ctx2) {
  62028. return (16)._rV();
  62029. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)});
  62030. }),$globals.MessageNotUnderstood);
  62031. $ctx1.sendIdx["should:raise:"]=31;
  62032. $self._should_raise_((function(){
  62033. return $core.withContext(function($ctx2) {
  62034. return (16)._rv();
  62035. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)});
  62036. }),$globals.MessageNotUnderstood);
  62037. $ctx1.sendIdx["should:raise:"]=32;
  62038. $self._should_raise_((function(){
  62039. return $core.withContext(function($ctx2) {
  62040. return (16)._rW();
  62041. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)});
  62042. }),$globals.MessageNotUnderstood);
  62043. $ctx1.sendIdx["should:raise:"]=33;
  62044. $self._should_raise_((function(){
  62045. return $core.withContext(function($ctx2) {
  62046. return (16)._rw();
  62047. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)});
  62048. }),$globals.MessageNotUnderstood);
  62049. $ctx1.sendIdx["should:raise:"]=34;
  62050. $self._should_raise_((function(){
  62051. return $core.withContext(function($ctx2) {
  62052. return (16)._rX();
  62053. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)});
  62054. }),$globals.MessageNotUnderstood);
  62055. $ctx1.sendIdx["should:raise:"]=35;
  62056. $self._should_raise_((function(){
  62057. return $core.withContext(function($ctx2) {
  62058. return (16)._rx();
  62059. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)});
  62060. }),$globals.MessageNotUnderstood);
  62061. $ctx1.sendIdx["should:raise:"]=36;
  62062. $self._should_raise_((function(){
  62063. return $core.withContext(function($ctx2) {
  62064. return (16)._rY();
  62065. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)});
  62066. }),$globals.MessageNotUnderstood);
  62067. $ctx1.sendIdx["should:raise:"]=37;
  62068. $self._should_raise_((function(){
  62069. return $core.withContext(function($ctx2) {
  62070. return (16)._ry();
  62071. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)});
  62072. }),$globals.MessageNotUnderstood);
  62073. $ctx1.sendIdx["should:raise:"]=38;
  62074. $self._should_raise_((function(){
  62075. return $core.withContext(function($ctx2) {
  62076. return (16)._rZ();
  62077. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)});
  62078. }),$globals.MessageNotUnderstood);
  62079. $ctx1.sendIdx["should:raise:"]=39;
  62080. $self._should_raise_((function(){
  62081. return $core.withContext(function($ctx2) {
  62082. return (16)._rz();
  62083. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)});
  62084. }),$globals.MessageNotUnderstood);
  62085. $ctx1.sendIdx["should:raise:"]=40;
  62086. $self._should_raise_((function(){
  62087. return $core.withContext(function($ctx2) {
  62088. return (11259375)._Z();
  62089. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)});
  62090. }),$globals.MessageNotUnderstood);
  62091. return self;
  62092. }, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{})});
  62093. },
  62094. args: [],
  62095. 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.",
  62096. referencedClasses: ["MessageNotUnderstood"],
  62097. pragmas: [],
  62098. 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"]
  62099. }),
  62100. $globals.NumberTest);
  62101. $core.addMethod(
  62102. $core.method({
  62103. selector: "testLog",
  62104. protocol: "tests",
  62105. fn: function (){
  62106. var self=this,$self=this;
  62107. return $core.withContext(function($ctx1) {
  62108. $self._assert_equals_((10000)._log(),(4));
  62109. $ctx1.sendIdx["assert:equals:"]=1;
  62110. $self._assert_equals_((512)._log_((2)),(9));
  62111. $ctx1.sendIdx["assert:equals:"]=2;
  62112. $self._assert_equals_($recv($recv($globals.Number)._e())._ln(),(1));
  62113. return self;
  62114. }, function($ctx1) {$ctx1.fill(self,"testLog",{})});
  62115. },
  62116. args: [],
  62117. 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.",
  62118. referencedClasses: ["Number"],
  62119. pragmas: [],
  62120. messageSends: ["assert:equals:", "log", "log:", "ln", "e"]
  62121. }),
  62122. $globals.NumberTest);
  62123. $core.addMethod(
  62124. $core.method({
  62125. selector: "testMinMax",
  62126. protocol: "tests",
  62127. fn: function (){
  62128. var self=this,$self=this;
  62129. return $core.withContext(function($ctx1) {
  62130. var $1,$2;
  62131. $self._assert_equals_((2)._max_((5)),(5));
  62132. $ctx1.sendIdx["assert:equals:"]=1;
  62133. $self._assert_equals_((2)._min_((5)),(2));
  62134. $ctx1.sendIdx["assert:equals:"]=2;
  62135. $1=(2)._min_max_((5),(3));
  62136. $ctx1.sendIdx["min:max:"]=1;
  62137. $self._assert_equals_($1,(3));
  62138. $ctx1.sendIdx["assert:equals:"]=3;
  62139. $2=(7)._min_max_((5),(3));
  62140. $ctx1.sendIdx["min:max:"]=2;
  62141. $self._assert_equals_($2,(5));
  62142. $ctx1.sendIdx["assert:equals:"]=4;
  62143. $self._assert_equals_((4)._min_max_((5),(3)),(4));
  62144. return self;
  62145. }, function($ctx1) {$ctx1.fill(self,"testMinMax",{})});
  62146. },
  62147. args: [],
  62148. 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.",
  62149. referencedClasses: [],
  62150. pragmas: [],
  62151. messageSends: ["assert:equals:", "max:", "min:", "min:max:"]
  62152. }),
  62153. $globals.NumberTest);
  62154. $core.addMethod(
  62155. $core.method({
  62156. selector: "testNegated",
  62157. protocol: "tests",
  62158. fn: function (){
  62159. var self=this,$self=this;
  62160. return $core.withContext(function($ctx1) {
  62161. var $1;
  62162. $1=(3)._negated();
  62163. $ctx1.sendIdx["negated"]=1;
  62164. $self._assert_equals_($1,(-3));
  62165. $ctx1.sendIdx["assert:equals:"]=1;
  62166. $self._assert_equals_((-3)._negated(),(3));
  62167. return self;
  62168. }, function($ctx1) {$ctx1.fill(self,"testNegated",{})});
  62169. },
  62170. args: [],
  62171. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  62172. referencedClasses: [],
  62173. pragmas: [],
  62174. messageSends: ["assert:equals:", "negated"]
  62175. }),
  62176. $globals.NumberTest);
  62177. $core.addMethod(
  62178. $core.method({
  62179. selector: "testPrintShowingDecimalPlaces",
  62180. protocol: "tests",
  62181. fn: function (){
  62182. var self=this,$self=this;
  62183. return $core.withContext(function($ctx1) {
  62184. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  62185. $1=(23)._printShowingDecimalPlaces_((2));
  62186. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  62187. $self._assert_equals_($1,"23.00");
  62188. $ctx1.sendIdx["assert:equals:"]=1;
  62189. $2=(23.5698)._printShowingDecimalPlaces_((2));
  62190. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  62191. $self._assert_equals_($2,"23.57");
  62192. $ctx1.sendIdx["assert:equals:"]=2;
  62193. $4=(234.567)._negated();
  62194. $ctx1.sendIdx["negated"]=1;
  62195. $3=$recv($4)._printShowingDecimalPlaces_((5));
  62196. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  62197. $self._assert_equals_($3,"-234.56700");
  62198. $ctx1.sendIdx["assert:equals:"]=3;
  62199. $5=(23.4567)._printShowingDecimalPlaces_((0));
  62200. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  62201. $self._assert_equals_($5,"23");
  62202. $ctx1.sendIdx["assert:equals:"]=4;
  62203. $6=(23.5567)._printShowingDecimalPlaces_((0));
  62204. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  62205. $self._assert_equals_($6,"24");
  62206. $ctx1.sendIdx["assert:equals:"]=5;
  62207. $8=(23.4567)._negated();
  62208. $ctx1.sendIdx["negated"]=2;
  62209. $7=$recv($8)._printShowingDecimalPlaces_((0));
  62210. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  62211. $self._assert_equals_($7,"-23");
  62212. $ctx1.sendIdx["assert:equals:"]=6;
  62213. $10=(23.5567)._negated();
  62214. $ctx1.sendIdx["negated"]=3;
  62215. $9=$recv($10)._printShowingDecimalPlaces_((0));
  62216. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  62217. $self._assert_equals_($9,"-24");
  62218. $ctx1.sendIdx["assert:equals:"]=7;
  62219. $11=(100000000)._printShowingDecimalPlaces_((1));
  62220. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  62221. $self._assert_equals_($11,"100000000.0");
  62222. $ctx1.sendIdx["assert:equals:"]=8;
  62223. $12=(0.98)._printShowingDecimalPlaces_((5));
  62224. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  62225. $self._assert_equals_($12,"0.98000");
  62226. $ctx1.sendIdx["assert:equals:"]=9;
  62227. $13=$recv((0.98)._negated())._printShowingDecimalPlaces_((2));
  62228. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  62229. $self._assert_equals_($13,"-0.98");
  62230. $ctx1.sendIdx["assert:equals:"]=10;
  62231. $14=(2.567)._printShowingDecimalPlaces_((2));
  62232. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  62233. $self._assert_equals_($14,"2.57");
  62234. $ctx1.sendIdx["assert:equals:"]=11;
  62235. $15=(-2.567)._printShowingDecimalPlaces_((2));
  62236. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  62237. $self._assert_equals_($15,"-2.57");
  62238. $ctx1.sendIdx["assert:equals:"]=12;
  62239. $self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  62240. return self;
  62241. }, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{})});
  62242. },
  62243. args: [],
  62244. 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'.",
  62245. referencedClasses: [],
  62246. pragmas: [],
  62247. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"]
  62248. }),
  62249. $globals.NumberTest);
  62250. $core.addMethod(
  62251. $core.method({
  62252. selector: "testPrintStringBase",
  62253. protocol: "tests",
  62254. fn: function (){
  62255. var self=this,$self=this;
  62256. return $core.withContext(function($ctx1) {
  62257. var $1,$2,$3;
  62258. $1=(15)._printStringBase_((2));
  62259. $ctx1.sendIdx["printStringBase:"]=1;
  62260. $self._assert_equals_($1,"1111");
  62261. $ctx1.sendIdx["assert:equals:"]=1;
  62262. $2=(15)._printStringBase_((16));
  62263. $ctx1.sendIdx["printStringBase:"]=2;
  62264. $self._assert_equals_($2,"f");
  62265. $ctx1.sendIdx["assert:equals:"]=2;
  62266. $3=(256)._printStringBase_((16));
  62267. $ctx1.sendIdx["printStringBase:"]=3;
  62268. $self._assert_equals_($3,"100");
  62269. $ctx1.sendIdx["assert:equals:"]=3;
  62270. $self._assert_equals_((256)._printStringBase_((2)),"100000000");
  62271. return self;
  62272. }, function($ctx1) {$ctx1.fill(self,"testPrintStringBase",{})});
  62273. },
  62274. args: [],
  62275. 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'",
  62276. referencedClasses: [],
  62277. pragmas: [],
  62278. messageSends: ["assert:equals:", "printStringBase:"]
  62279. }),
  62280. $globals.NumberTest);
  62281. $core.addMethod(
  62282. $core.method({
  62283. selector: "testRadiansToDegrees",
  62284. protocol: "tests",
  62285. fn: function (){
  62286. var self=this,$self=this;
  62287. return $core.withContext(function($ctx1) {
  62288. $self._assert_($recv($recv($recv($recv($recv($globals.Number)._pi())._radiansToDegrees()).__minus((180)))._abs()).__lt_eq((0.01)));
  62289. return self;
  62290. }, function($ctx1) {$ctx1.fill(self,"testRadiansToDegrees",{})});
  62291. },
  62292. args: [],
  62293. source: "testRadiansToDegrees\x0a\x09self assert: (Number pi radiansToDegrees - 180) abs <= 0.01.",
  62294. referencedClasses: ["Number"],
  62295. pragmas: [],
  62296. messageSends: ["assert:", "<=", "abs", "-", "radiansToDegrees", "pi"]
  62297. }),
  62298. $globals.NumberTest);
  62299. $core.addMethod(
  62300. $core.method({
  62301. selector: "testRaisedTo",
  62302. protocol: "tests",
  62303. fn: function (){
  62304. var self=this,$self=this;
  62305. return $core.withContext(function($ctx1) {
  62306. var $1,$2,$3;
  62307. $1=(2)._raisedTo_((4));
  62308. $ctx1.sendIdx["raisedTo:"]=1;
  62309. $self._assert_equals_($1,(16));
  62310. $ctx1.sendIdx["assert:equals:"]=1;
  62311. $2=(2)._raisedTo_((0));
  62312. $ctx1.sendIdx["raisedTo:"]=2;
  62313. $self._assert_equals_($2,(1));
  62314. $ctx1.sendIdx["assert:equals:"]=2;
  62315. $3=(2)._raisedTo_((-3));
  62316. $ctx1.sendIdx["raisedTo:"]=3;
  62317. $self._assert_equals_($3,(0.125));
  62318. $ctx1.sendIdx["assert:equals:"]=3;
  62319. $self._assert_equals_((4)._raisedTo_((0.5)),(2));
  62320. $ctx1.sendIdx["assert:equals:"]=4;
  62321. $self._assert_equals_((2).__star_star((4)),(16));
  62322. return self;
  62323. }, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{})});
  62324. },
  62325. args: [],
  62326. 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.",
  62327. referencedClasses: [],
  62328. pragmas: [],
  62329. messageSends: ["assert:equals:", "raisedTo:", "**"]
  62330. }),
  62331. $globals.NumberTest);
  62332. $core.addMethod(
  62333. $core.method({
  62334. selector: "testRounded",
  62335. protocol: "tests",
  62336. fn: function (){
  62337. var self=this,$self=this;
  62338. return $core.withContext(function($ctx1) {
  62339. var $1,$2;
  62340. $1=(3)._rounded();
  62341. $ctx1.sendIdx["rounded"]=1;
  62342. $self._assert_equals_($1,(3));
  62343. $ctx1.sendIdx["assert:equals:"]=1;
  62344. $2=(3.212)._rounded();
  62345. $ctx1.sendIdx["rounded"]=2;
  62346. $self._assert_equals_($2,(3));
  62347. $ctx1.sendIdx["assert:equals:"]=2;
  62348. $self._assert_equals_((3.51)._rounded(),(4));
  62349. return self;
  62350. }, function($ctx1) {$ctx1.fill(self,"testRounded",{})});
  62351. },
  62352. args: [],
  62353. 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",
  62354. referencedClasses: [],
  62355. pragmas: [],
  62356. messageSends: ["assert:equals:", "rounded"]
  62357. }),
  62358. $globals.NumberTest);
  62359. $core.addMethod(
  62360. $core.method({
  62361. selector: "testSign",
  62362. protocol: "tests",
  62363. fn: function (){
  62364. var self=this,$self=this;
  62365. return $core.withContext(function($ctx1) {
  62366. var $1,$2;
  62367. $1=(5)._sign();
  62368. $ctx1.sendIdx["sign"]=1;
  62369. $self._assert_equals_($1,(1));
  62370. $ctx1.sendIdx["assert:equals:"]=1;
  62371. $2=(0)._sign();
  62372. $ctx1.sendIdx["sign"]=2;
  62373. $self._assert_equals_($2,(0));
  62374. $ctx1.sendIdx["assert:equals:"]=2;
  62375. $self._assert_equals_((-1.4)._sign(),(-1));
  62376. return self;
  62377. }, function($ctx1) {$ctx1.fill(self,"testSign",{})});
  62378. },
  62379. args: [],
  62380. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  62381. referencedClasses: [],
  62382. pragmas: [],
  62383. messageSends: ["assert:equals:", "sign"]
  62384. }),
  62385. $globals.NumberTest);
  62386. $core.addMethod(
  62387. $core.method({
  62388. selector: "testSqrt",
  62389. protocol: "tests",
  62390. fn: function (){
  62391. var self=this,$self=this;
  62392. return $core.withContext(function($ctx1) {
  62393. var $1;
  62394. $1=(4)._sqrt();
  62395. $ctx1.sendIdx["sqrt"]=1;
  62396. $self._assert_equals_($1,(2));
  62397. $ctx1.sendIdx["assert:equals:"]=1;
  62398. $self._assert_equals_((16)._sqrt(),(4));
  62399. return self;
  62400. }, function($ctx1) {$ctx1.fill(self,"testSqrt",{})});
  62401. },
  62402. args: [],
  62403. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  62404. referencedClasses: [],
  62405. pragmas: [],
  62406. messageSends: ["assert:equals:", "sqrt"]
  62407. }),
  62408. $globals.NumberTest);
  62409. $core.addMethod(
  62410. $core.method({
  62411. selector: "testSquared",
  62412. protocol: "tests",
  62413. fn: function (){
  62414. var self=this,$self=this;
  62415. return $core.withContext(function($ctx1) {
  62416. $self._assert_equals_((4)._squared(),(16));
  62417. return self;
  62418. }, function($ctx1) {$ctx1.fill(self,"testSquared",{})});
  62419. },
  62420. args: [],
  62421. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  62422. referencedClasses: [],
  62423. pragmas: [],
  62424. messageSends: ["assert:equals:", "squared"]
  62425. }),
  62426. $globals.NumberTest);
  62427. $core.addMethod(
  62428. $core.method({
  62429. selector: "testTimesRepeat",
  62430. protocol: "tests",
  62431. fn: function (){
  62432. var self=this,$self=this;
  62433. var i;
  62434. return $core.withContext(function($ctx1) {
  62435. i=(0);
  62436. (0)._timesRepeat_((function(){
  62437. return $core.withContext(function($ctx2) {
  62438. i=$recv(i).__plus((1));
  62439. $ctx2.sendIdx["+"]=1;
  62440. return i;
  62441. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  62442. }));
  62443. $ctx1.sendIdx["timesRepeat:"]=1;
  62444. $self._assert_equals_(i,(0));
  62445. $ctx1.sendIdx["assert:equals:"]=1;
  62446. (5)._timesRepeat_((function(){
  62447. return $core.withContext(function($ctx2) {
  62448. i=$recv(i).__plus((1));
  62449. return i;
  62450. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  62451. }));
  62452. $self._assert_equals_(i,(5));
  62453. return self;
  62454. }, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i})});
  62455. },
  62456. args: [],
  62457. 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",
  62458. referencedClasses: [],
  62459. pragmas: [],
  62460. messageSends: ["timesRepeat:", "+", "assert:equals:"]
  62461. }),
  62462. $globals.NumberTest);
  62463. $core.addMethod(
  62464. $core.method({
  62465. selector: "testTo",
  62466. protocol: "tests",
  62467. fn: function (){
  62468. var self=this,$self=this;
  62469. return $core.withContext(function($ctx1) {
  62470. $self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  62471. return self;
  62472. }, function($ctx1) {$ctx1.fill(self,"testTo",{})});
  62473. },
  62474. args: [],
  62475. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  62476. referencedClasses: [],
  62477. pragmas: [],
  62478. messageSends: ["assert:equals:", "to:"]
  62479. }),
  62480. $globals.NumberTest);
  62481. $core.addMethod(
  62482. $core.method({
  62483. selector: "testToBy",
  62484. protocol: "tests",
  62485. fn: function (){
  62486. var self=this,$self=this;
  62487. return $core.withContext(function($ctx1) {
  62488. var $1;
  62489. $1=(0)._to_by_((6),(2));
  62490. $ctx1.sendIdx["to:by:"]=1;
  62491. $self._assert_equals_($1,[(0), (2), (4), (6)]);
  62492. $self._should_raise_((function(){
  62493. return $core.withContext(function($ctx2) {
  62494. return (1)._to_by_((4),(0));
  62495. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  62496. }),$globals.Error);
  62497. return self;
  62498. }, function($ctx1) {$ctx1.fill(self,"testToBy",{})});
  62499. },
  62500. args: [],
  62501. 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",
  62502. referencedClasses: ["Error"],
  62503. pragmas: [],
  62504. messageSends: ["assert:equals:", "to:by:", "should:raise:"]
  62505. }),
  62506. $globals.NumberTest);
  62507. $core.addMethod(
  62508. $core.method({
  62509. selector: "testTrigonometry",
  62510. protocol: "tests",
  62511. fn: function (){
  62512. var self=this,$self=this;
  62513. return $core.withContext(function($ctx1) {
  62514. var $1;
  62515. $self._assert_equals_((0)._cos(),(1));
  62516. $ctx1.sendIdx["assert:equals:"]=1;
  62517. $self._assert_equals_((0)._sin(),(0));
  62518. $ctx1.sendIdx["assert:equals:"]=2;
  62519. $self._assert_equals_((0)._tan(),(0));
  62520. $ctx1.sendIdx["assert:equals:"]=3;
  62521. $self._assert_equals_((1)._arcCos(),(0));
  62522. $ctx1.sendIdx["assert:equals:"]=4;
  62523. $self._assert_equals_((0)._arcSin(),(0));
  62524. $ctx1.sendIdx["assert:equals:"]=5;
  62525. $self._assert_equals_((0)._arcTan(),(0));
  62526. $ctx1.sendIdx["assert:equals:"]=6;
  62527. $1=(0)._arcTan_((1));
  62528. $ctx1.sendIdx["arcTan:"]=1;
  62529. $self._assert_equals_($1,(0));
  62530. $ctx1.sendIdx["assert:equals:"]=7;
  62531. $self._assert_equals_((1)._arcTan_((0)),$recv($recv($globals.Number)._pi()).__slash((2)));
  62532. return self;
  62533. }, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{})});
  62534. },
  62535. args: [],
  62536. 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)",
  62537. referencedClasses: ["Number"],
  62538. pragmas: [],
  62539. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan", "arcTan:", "/", "pi"]
  62540. }),
  62541. $globals.NumberTest);
  62542. $core.addMethod(
  62543. $core.method({
  62544. selector: "testTruncated",
  62545. protocol: "tests",
  62546. fn: function (){
  62547. var self=this,$self=this;
  62548. return $core.withContext(function($ctx1) {
  62549. var $1,$2;
  62550. $1=(3)._truncated();
  62551. $ctx1.sendIdx["truncated"]=1;
  62552. $self._assert_equals_($1,(3));
  62553. $ctx1.sendIdx["assert:equals:"]=1;
  62554. $2=(3.212)._truncated();
  62555. $ctx1.sendIdx["truncated"]=2;
  62556. $self._assert_equals_($2,(3));
  62557. $ctx1.sendIdx["assert:equals:"]=2;
  62558. $self._assert_equals_((3.51)._truncated(),(3));
  62559. return self;
  62560. }, function($ctx1) {$ctx1.fill(self,"testTruncated",{})});
  62561. },
  62562. args: [],
  62563. 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",
  62564. referencedClasses: [],
  62565. pragmas: [],
  62566. messageSends: ["assert:equals:", "truncated"]
  62567. }),
  62568. $globals.NumberTest);
  62569. $core.addClass("ObjectMock", $globals.Object, ["foo", "bar"], "Kernel-Tests");
  62570. $globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  62571. $core.addMethod(
  62572. $core.method({
  62573. selector: "foo",
  62574. protocol: "not yet classified",
  62575. fn: function (){
  62576. var self=this,$self=this;
  62577. return $self.foo;
  62578. },
  62579. args: [],
  62580. source: "foo\x0a\x09^ foo",
  62581. referencedClasses: [],
  62582. pragmas: [],
  62583. messageSends: []
  62584. }),
  62585. $globals.ObjectMock);
  62586. $core.addMethod(
  62587. $core.method({
  62588. selector: "foo:",
  62589. protocol: "not yet classified",
  62590. fn: function (anObject){
  62591. var self=this,$self=this;
  62592. $self.foo=anObject;
  62593. return self;
  62594. },
  62595. args: ["anObject"],
  62596. source: "foo: anObject\x0a\x09foo := anObject",
  62597. referencedClasses: [],
  62598. pragmas: [],
  62599. messageSends: []
  62600. }),
  62601. $globals.ObjectMock);
  62602. $core.addClass("ObjectTest", $globals.TestCase, [], "Kernel-Tests");
  62603. $core.addMethod(
  62604. $core.method({
  62605. selector: "notDefined",
  62606. protocol: "tests",
  62607. fn: function (){
  62608. var self=this,$self=this;
  62609. return $core.withContext(function($ctx1) {
  62610. return void 0;;
  62611. return self;
  62612. }, function($ctx1) {$ctx1.fill(self,"notDefined",{})});
  62613. },
  62614. args: [],
  62615. source: "notDefined\x0a\x09<inlineJS: 'return void 0;'>",
  62616. referencedClasses: [],
  62617. pragmas: [["inlineJS:", ["return void 0;"]]],
  62618. messageSends: []
  62619. }),
  62620. $globals.ObjectTest);
  62621. $core.addMethod(
  62622. $core.method({
  62623. selector: "testBasicAccess",
  62624. protocol: "tests",
  62625. fn: function (){
  62626. var self=this,$self=this;
  62627. var o;
  62628. return $core.withContext(function($ctx1) {
  62629. var $1;
  62630. o=$recv($globals.Object)._new();
  62631. $recv(o)._basicAt_put_("a",(1));
  62632. $1=$recv(o)._basicAt_("a");
  62633. $ctx1.sendIdx["basicAt:"]=1;
  62634. $self._assert_equals_($1,(1));
  62635. $ctx1.sendIdx["assert:equals:"]=1;
  62636. $self._assert_equals_($recv(o)._basicAt_("b"),nil);
  62637. return self;
  62638. }, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o})});
  62639. },
  62640. args: [],
  62641. 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",
  62642. referencedClasses: ["Object"],
  62643. pragmas: [],
  62644. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"]
  62645. }),
  62646. $globals.ObjectTest);
  62647. $core.addMethod(
  62648. $core.method({
  62649. selector: "testBasicPerform",
  62650. protocol: "tests",
  62651. fn: function (){
  62652. var self=this,$self=this;
  62653. var o;
  62654. return $core.withContext(function($ctx1) {
  62655. o=$recv($globals.Object)._new();
  62656. $recv(o)._basicAt_put_("func",(function(){
  62657. return "hello";
  62658. }));
  62659. $ctx1.sendIdx["basicAt:put:"]=1;
  62660. $recv(o)._basicAt_put_("func2",(function(a){
  62661. return $core.withContext(function($ctx2) {
  62662. return $recv(a).__plus((1));
  62663. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  62664. }));
  62665. $self._assert_equals_($recv(o)._basicPerform_("func"),"hello");
  62666. $ctx1.sendIdx["assert:equals:"]=1;
  62667. $self._assert_equals_($recv(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  62668. return self;
  62669. }, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o})});
  62670. },
  62671. args: [],
  62672. 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",
  62673. referencedClasses: ["Object"],
  62674. pragmas: [],
  62675. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"]
  62676. }),
  62677. $globals.ObjectTest);
  62678. $core.addMethod(
  62679. $core.method({
  62680. selector: "testDNU",
  62681. protocol: "tests",
  62682. fn: function (){
  62683. var self=this,$self=this;
  62684. return $core.withContext(function($ctx1) {
  62685. $self._should_raise_((function(){
  62686. return $core.withContext(function($ctx2) {
  62687. return $recv($recv($globals.Object)._new())._foo();
  62688. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  62689. }),$globals.MessageNotUnderstood);
  62690. return self;
  62691. }, function($ctx1) {$ctx1.fill(self,"testDNU",{})});
  62692. },
  62693. args: [],
  62694. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  62695. referencedClasses: ["Object", "MessageNotUnderstood"],
  62696. pragmas: [],
  62697. messageSends: ["should:raise:", "foo", "new"]
  62698. }),
  62699. $globals.ObjectTest);
  62700. $core.addMethod(
  62701. $core.method({
  62702. selector: "testEquality",
  62703. protocol: "tests",
  62704. fn: function (){
  62705. var self=this,$self=this;
  62706. var o;
  62707. return $core.withContext(function($ctx1) {
  62708. var $1,$2,$4,$3;
  62709. o=$recv($globals.Object)._new();
  62710. $ctx1.sendIdx["new"]=1;
  62711. $1=$recv(o).__eq($recv($globals.Object)._new());
  62712. $ctx1.sendIdx["="]=1;
  62713. $self._deny_($1);
  62714. $2=$recv(o).__eq(o);
  62715. $ctx1.sendIdx["="]=2;
  62716. $self._assert_($2);
  62717. $ctx1.sendIdx["assert:"]=1;
  62718. $4=$recv(o)._yourself();
  62719. $ctx1.sendIdx["yourself"]=1;
  62720. $3=$recv($4).__eq(o);
  62721. $ctx1.sendIdx["="]=3;
  62722. $self._assert_($3);
  62723. $ctx1.sendIdx["assert:"]=2;
  62724. $self._assert_($recv(o).__eq($recv(o)._yourself()));
  62725. return self;
  62726. }, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o})});
  62727. },
  62728. args: [],
  62729. 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)",
  62730. referencedClasses: ["Object"],
  62731. pragmas: [],
  62732. messageSends: ["new", "deny:", "=", "assert:", "yourself"]
  62733. }),
  62734. $globals.ObjectTest);
  62735. $core.addMethod(
  62736. $core.method({
  62737. selector: "testHalt",
  62738. protocol: "tests",
  62739. fn: function (){
  62740. var self=this,$self=this;
  62741. return $core.withContext(function($ctx1) {
  62742. $self._should_raise_((function(){
  62743. return $core.withContext(function($ctx2) {
  62744. return $recv($recv($globals.Object)._new())._halt();
  62745. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  62746. }),$globals.Error);
  62747. return self;
  62748. }, function($ctx1) {$ctx1.fill(self,"testHalt",{})});
  62749. },
  62750. args: [],
  62751. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  62752. referencedClasses: ["Object", "Error"],
  62753. pragmas: [],
  62754. messageSends: ["should:raise:", "halt", "new"]
  62755. }),
  62756. $globals.ObjectTest);
  62757. $core.addMethod(
  62758. $core.method({
  62759. selector: "testIdentity",
  62760. protocol: "tests",
  62761. fn: function (){
  62762. var self=this,$self=this;
  62763. var o;
  62764. return $core.withContext(function($ctx1) {
  62765. var $1,$2,$4,$3;
  62766. o=$recv($globals.Object)._new();
  62767. $ctx1.sendIdx["new"]=1;
  62768. $1=$recv(o).__eq_eq($recv($globals.Object)._new());
  62769. $ctx1.sendIdx["=="]=1;
  62770. $self._deny_($1);
  62771. $2=$recv(o).__eq_eq(o);
  62772. $ctx1.sendIdx["=="]=2;
  62773. $self._assert_($2);
  62774. $ctx1.sendIdx["assert:"]=1;
  62775. $4=$recv(o)._yourself();
  62776. $ctx1.sendIdx["yourself"]=1;
  62777. $3=$recv($4).__eq_eq(o);
  62778. $ctx1.sendIdx["=="]=3;
  62779. $self._assert_($3);
  62780. $ctx1.sendIdx["assert:"]=2;
  62781. $self._assert_($recv(o).__eq_eq($recv(o)._yourself()));
  62782. return self;
  62783. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o})});
  62784. },
  62785. args: [],
  62786. 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",
  62787. referencedClasses: ["Object"],
  62788. pragmas: [],
  62789. messageSends: ["new", "deny:", "==", "assert:", "yourself"]
  62790. }),
  62791. $globals.ObjectTest);
  62792. $core.addMethod(
  62793. $core.method({
  62794. selector: "testIfNil",
  62795. protocol: "tests",
  62796. fn: function (){
  62797. var self=this,$self=this;
  62798. return $core.withContext(function($ctx1) {
  62799. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10,$receiver;
  62800. $2=$recv($globals.Object)._new();
  62801. $ctx1.sendIdx["new"]=1;
  62802. $1=$recv($2)._isNil();
  62803. $self._deny_($1);
  62804. $ctx1.sendIdx["deny:"]=1;
  62805. $5=$recv($globals.Object)._new();
  62806. $ctx1.sendIdx["new"]=2;
  62807. if(($receiver = $5) == null || $receiver.a$nil){
  62808. $4=true;
  62809. } else {
  62810. $4=$5;
  62811. }
  62812. $3=$recv($4).__eq(true);
  62813. $self._deny_($3);
  62814. $7=$recv($globals.Object)._new();
  62815. $ctx1.sendIdx["new"]=3;
  62816. if(($receiver = $7) == null || $receiver.a$nil){
  62817. $6=$7;
  62818. } else {
  62819. $6=true;
  62820. }
  62821. $self._assert_equals_($6,true);
  62822. $ctx1.sendIdx["assert:equals:"]=1;
  62823. $9=$recv($globals.Object)._new();
  62824. $ctx1.sendIdx["new"]=4;
  62825. if(($receiver = $9) == null || $receiver.a$nil){
  62826. $8=false;
  62827. } else {
  62828. $8=true;
  62829. }
  62830. $self._assert_equals_($8,true);
  62831. $ctx1.sendIdx["assert:equals:"]=2;
  62832. $11=$recv($globals.Object)._new();
  62833. if(($receiver = $11) == null || $receiver.a$nil){
  62834. $10=false;
  62835. } else {
  62836. $10=true;
  62837. }
  62838. $self._assert_equals_($10,true);
  62839. return self;
  62840. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{})});
  62841. },
  62842. args: [],
  62843. 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",
  62844. referencedClasses: ["Object"],
  62845. pragmas: [],
  62846. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  62847. }),
  62848. $globals.ObjectTest);
  62849. $core.addMethod(
  62850. $core.method({
  62851. selector: "testInstVars",
  62852. protocol: "tests",
  62853. fn: function (){
  62854. var self=this,$self=this;
  62855. var o;
  62856. return $core.withContext(function($ctx1) {
  62857. var $1,$2;
  62858. o=$recv($globals.ObjectMock)._new();
  62859. $1=$recv(o)._instVarAt_("foo");
  62860. $ctx1.sendIdx["instVarAt:"]=1;
  62861. $self._assert_equals_($1,nil);
  62862. $ctx1.sendIdx["assert:equals:"]=1;
  62863. $recv(o)._instVarAt_put_("foo",(1));
  62864. $2=$recv(o)._instVarAt_("foo");
  62865. $ctx1.sendIdx["instVarAt:"]=2;
  62866. $self._assert_equals_($2,(1));
  62867. $ctx1.sendIdx["assert:equals:"]=2;
  62868. $self._assert_equals_($recv(o)._instVarAt_("foo"),(1));
  62869. return self;
  62870. }, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o})});
  62871. },
  62872. args: [],
  62873. source: "testInstVars\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: (o instVarAt: #foo) equals: nil.\x0a\x0a\x09o instVarAt: #foo put: 1.\x0a\x09self assert: (o instVarAt: #foo) equals: 1.\x0a\x09self assert: (o instVarAt: 'foo') equals: 1",
  62874. referencedClasses: ["ObjectMock"],
  62875. pragmas: [],
  62876. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"]
  62877. }),
  62878. $globals.ObjectTest);
  62879. $core.addMethod(
  62880. $core.method({
  62881. selector: "testNilUndefined",
  62882. protocol: "tests",
  62883. fn: function (){
  62884. var self=this,$self=this;
  62885. return $core.withContext(function($ctx1) {
  62886. $self._assert_equals_($self._notDefined(),nil);
  62887. return self;
  62888. }, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{})});
  62889. },
  62890. args: [],
  62891. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  62892. referencedClasses: [],
  62893. pragmas: [],
  62894. messageSends: ["assert:equals:", "notDefined"]
  62895. }),
  62896. $globals.ObjectTest);
  62897. $core.addMethod(
  62898. $core.method({
  62899. selector: "testYourself",
  62900. protocol: "tests",
  62901. fn: function (){
  62902. var self=this,$self=this;
  62903. var o;
  62904. return $core.withContext(function($ctx1) {
  62905. o=$recv($globals.ObjectMock)._new();
  62906. $self._assert_($recv($recv(o)._yourself()).__eq_eq(o));
  62907. return self;
  62908. }, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o})});
  62909. },
  62910. args: [],
  62911. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  62912. referencedClasses: ["ObjectMock"],
  62913. pragmas: [],
  62914. messageSends: ["new", "assert:", "==", "yourself"]
  62915. }),
  62916. $globals.ObjectTest);
  62917. $core.addClass("PointTest", $globals.TestCase, [], "Kernel-Tests");
  62918. $core.addMethod(
  62919. $core.method({
  62920. selector: "testAccessing",
  62921. protocol: "tests",
  62922. fn: function (){
  62923. var self=this,$self=this;
  62924. return $core.withContext(function($ctx1) {
  62925. var $2,$1,$3,$6,$5,$4;
  62926. $2=$recv($globals.Point)._x_y_((3),(4));
  62927. $ctx1.sendIdx["x:y:"]=1;
  62928. $1=$recv($2)._x();
  62929. $ctx1.sendIdx["x"]=1;
  62930. $self._assert_equals_($1,(3));
  62931. $ctx1.sendIdx["assert:equals:"]=1;
  62932. $3=$recv($recv($globals.Point)._x_y_((3),(4)))._y();
  62933. $ctx1.sendIdx["y"]=1;
  62934. $self._assert_equals_($3,(4));
  62935. $ctx1.sendIdx["assert:equals:"]=2;
  62936. $6=$recv($globals.Point)._new();
  62937. $ctx1.sendIdx["new"]=1;
  62938. $5=$recv($6)._x_((3));
  62939. $4=$recv($5)._x();
  62940. $self._assert_equals_($4,(3));
  62941. $ctx1.sendIdx["assert:equals:"]=3;
  62942. $self._assert_equals_($recv($recv($recv($globals.Point)._new())._y_((4)))._y(),(4));
  62943. return self;
  62944. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{})});
  62945. },
  62946. args: [],
  62947. 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",
  62948. referencedClasses: ["Point"],
  62949. pragmas: [],
  62950. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"]
  62951. }),
  62952. $globals.PointTest);
  62953. $core.addMethod(
  62954. $core.method({
  62955. selector: "testAngle",
  62956. protocol: "tests",
  62957. fn: function (){
  62958. var self=this,$self=this;
  62959. return $core.withContext(function($ctx1) {
  62960. $self._assert_equals_($recv((-1).__at((0)))._angle(),$recv($globals.Number)._pi());
  62961. return self;
  62962. }, function($ctx1) {$ctx1.fill(self,"testAngle",{})});
  62963. },
  62964. args: [],
  62965. source: "testAngle\x0a\x09self assert: (-1@0) angle equals: Number pi",
  62966. referencedClasses: ["Number"],
  62967. pragmas: [],
  62968. messageSends: ["assert:equals:", "angle", "@", "pi"]
  62969. }),
  62970. $globals.PointTest);
  62971. $core.addMethod(
  62972. $core.method({
  62973. selector: "testArithmetic",
  62974. protocol: "tests",
  62975. fn: function (){
  62976. var self=this,$self=this;
  62977. return $core.withContext(function($ctx1) {
  62978. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  62979. $2=(3).__at((4));
  62980. $ctx1.sendIdx["@"]=1;
  62981. $3=(3).__at((4));
  62982. $ctx1.sendIdx["@"]=2;
  62983. $1=$recv($2).__star($3);
  62984. $4=$recv($globals.Point)._x_y_((9),(16));
  62985. $ctx1.sendIdx["x:y:"]=1;
  62986. $self._assert_equals_($1,$4);
  62987. $ctx1.sendIdx["assert:equals:"]=1;
  62988. $6=(3).__at((4));
  62989. $ctx1.sendIdx["@"]=3;
  62990. $7=(3).__at((4));
  62991. $ctx1.sendIdx["@"]=4;
  62992. $5=$recv($6).__plus($7);
  62993. $8=$recv($globals.Point)._x_y_((6),(8));
  62994. $ctx1.sendIdx["x:y:"]=2;
  62995. $self._assert_equals_($5,$8);
  62996. $ctx1.sendIdx["assert:equals:"]=2;
  62997. $10=(3).__at((4));
  62998. $ctx1.sendIdx["@"]=5;
  62999. $11=(3).__at((4));
  63000. $ctx1.sendIdx["@"]=6;
  63001. $9=$recv($10).__minus($11);
  63002. $12=$recv($globals.Point)._x_y_((0),(0));
  63003. $ctx1.sendIdx["x:y:"]=3;
  63004. $self._assert_equals_($9,$12);
  63005. $ctx1.sendIdx["assert:equals:"]=3;
  63006. $14=(6).__at((8));
  63007. $ctx1.sendIdx["@"]=7;
  63008. $13=$recv($14).__slash((3).__at((4)));
  63009. $self._assert_equals_($13,$recv($globals.Point)._x_y_((2),(2)));
  63010. return self;
  63011. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{})});
  63012. },
  63013. args: [],
  63014. 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)",
  63015. referencedClasses: ["Point"],
  63016. pragmas: [],
  63017. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"]
  63018. }),
  63019. $globals.PointTest);
  63020. $core.addMethod(
  63021. $core.method({
  63022. selector: "testAt",
  63023. protocol: "tests",
  63024. fn: function (){
  63025. var self=this,$self=this;
  63026. return $core.withContext(function($ctx1) {
  63027. $self._assert_equals_((3).__at((4)),$recv($globals.Point)._x_y_((3),(4)));
  63028. return self;
  63029. }, function($ctx1) {$ctx1.fill(self,"testAt",{})});
  63030. },
  63031. args: [],
  63032. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  63033. referencedClasses: ["Point"],
  63034. pragmas: [],
  63035. messageSends: ["assert:equals:", "@", "x:y:"]
  63036. }),
  63037. $globals.PointTest);
  63038. $core.addMethod(
  63039. $core.method({
  63040. selector: "testComparison",
  63041. protocol: "tests",
  63042. fn: function (){
  63043. var self=this,$self=this;
  63044. return $core.withContext(function($ctx1) {
  63045. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$18,$16,$20,$21,$19,$23,$22;
  63046. $2=(3).__at((4));
  63047. $ctx1.sendIdx["@"]=1;
  63048. $3=(4).__at((5));
  63049. $ctx1.sendIdx["@"]=2;
  63050. $1=$recv($2).__lt($3);
  63051. $ctx1.sendIdx["<"]=1;
  63052. $self._assert_($1);
  63053. $ctx1.sendIdx["assert:"]=1;
  63054. $5=(3).__at((4));
  63055. $ctx1.sendIdx["@"]=3;
  63056. $6=(4).__at((4));
  63057. $ctx1.sendIdx["@"]=4;
  63058. $4=$recv($5).__lt($6);
  63059. $self._deny_($4);
  63060. $ctx1.sendIdx["deny:"]=1;
  63061. $8=(4).__at((5));
  63062. $ctx1.sendIdx["@"]=5;
  63063. $9=(4).__at((5));
  63064. $ctx1.sendIdx["@"]=6;
  63065. $7=$recv($8).__lt_eq($9);
  63066. $ctx1.sendIdx["<="]=1;
  63067. $self._assert_($7);
  63068. $ctx1.sendIdx["assert:"]=2;
  63069. $11=(4).__at((5));
  63070. $ctx1.sendIdx["@"]=7;
  63071. $12=(3).__at((5));
  63072. $ctx1.sendIdx["@"]=8;
  63073. $10=$recv($11).__lt_eq($12);
  63074. $self._deny_($10);
  63075. $ctx1.sendIdx["deny:"]=2;
  63076. $14=(5).__at((6));
  63077. $ctx1.sendIdx["@"]=9;
  63078. $15=(4).__at((5));
  63079. $ctx1.sendIdx["@"]=10;
  63080. $13=$recv($14).__gt($15);
  63081. $ctx1.sendIdx[">"]=1;
  63082. $self._assert_($13);
  63083. $ctx1.sendIdx["assert:"]=3;
  63084. $17=(5).__at((6));
  63085. $ctx1.sendIdx["@"]=11;
  63086. $18=(6).__at((6));
  63087. $ctx1.sendIdx["@"]=12;
  63088. $16=$recv($17).__gt($18);
  63089. $self._deny_($16);
  63090. $ctx1.sendIdx["deny:"]=3;
  63091. $20=(4).__at((5));
  63092. $ctx1.sendIdx["@"]=13;
  63093. $21=(4).__at((5));
  63094. $ctx1.sendIdx["@"]=14;
  63095. $19=$recv($20).__gt_eq($21);
  63096. $ctx1.sendIdx[">="]=1;
  63097. $self._assert_($19);
  63098. $23=(4).__at((5));
  63099. $ctx1.sendIdx["@"]=15;
  63100. $22=$recv($23).__gt_eq((5).__at((5)));
  63101. $self._deny_($22);
  63102. return self;
  63103. }, function($ctx1) {$ctx1.fill(self,"testComparison",{})});
  63104. },
  63105. args: [],
  63106. 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)",
  63107. referencedClasses: [],
  63108. pragmas: [],
  63109. messageSends: ["assert:", "<", "@", "deny:", "<=", ">", ">="]
  63110. }),
  63111. $globals.PointTest);
  63112. $core.addMethod(
  63113. $core.method({
  63114. selector: "testDotProduct",
  63115. protocol: "tests",
  63116. fn: function (){
  63117. var self=this,$self=this;
  63118. return $core.withContext(function($ctx1) {
  63119. var $2,$1;
  63120. $2=(2).__at((3));
  63121. $ctx1.sendIdx["@"]=1;
  63122. $1=$recv($2)._dotProduct_((3).__at((7)));
  63123. $self._assert_equals_($1,(27));
  63124. return self;
  63125. }, function($ctx1) {$ctx1.fill(self,"testDotProduct",{})});
  63126. },
  63127. args: [],
  63128. source: "testDotProduct\x0a\x09self assert: (2@3 dotProduct: 3@7) equals: 27",
  63129. referencedClasses: [],
  63130. pragmas: [],
  63131. messageSends: ["assert:equals:", "dotProduct:", "@"]
  63132. }),
  63133. $globals.PointTest);
  63134. $core.addMethod(
  63135. $core.method({
  63136. selector: "testEgality",
  63137. protocol: "tests",
  63138. fn: function (){
  63139. var self=this,$self=this;
  63140. return $core.withContext(function($ctx1) {
  63141. var $2,$3,$1,$5,$4;
  63142. $2=(3).__at((4));
  63143. $ctx1.sendIdx["@"]=1;
  63144. $3=(3).__at((4));
  63145. $ctx1.sendIdx["@"]=2;
  63146. $1=$recv($2).__eq($3);
  63147. $ctx1.sendIdx["="]=1;
  63148. $self._assert_($1);
  63149. $5=(3).__at((5));
  63150. $ctx1.sendIdx["@"]=3;
  63151. $4=$recv($5).__eq((3).__at((6)));
  63152. $self._deny_($4);
  63153. return self;
  63154. }, function($ctx1) {$ctx1.fill(self,"testEgality",{})});
  63155. },
  63156. args: [],
  63157. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  63158. referencedClasses: [],
  63159. pragmas: [],
  63160. messageSends: ["assert:", "=", "@", "deny:"]
  63161. }),
  63162. $globals.PointTest);
  63163. $core.addMethod(
  63164. $core.method({
  63165. selector: "testNew",
  63166. protocol: "tests",
  63167. fn: function (){
  63168. var self=this,$self=this;
  63169. return $core.withContext(function($ctx1) {
  63170. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  63171. $3=$recv($globals.Point)._new();
  63172. $ctx1.sendIdx["new"]=1;
  63173. $2=$recv($3)._x_((3));
  63174. $ctx1.sendIdx["x:"]=1;
  63175. $1=$recv($2)._y();
  63176. $ctx1.sendIdx["y"]=1;
  63177. $self._assert_equals_($1,nil);
  63178. $ctx1.sendIdx["assert:equals:"]=1;
  63179. $7=$recv($globals.Point)._new();
  63180. $ctx1.sendIdx["new"]=2;
  63181. $6=$recv($7)._x_((3));
  63182. $5=$recv($6)._x();
  63183. $ctx1.sendIdx["x"]=1;
  63184. $4=$recv($5).__eq((0));
  63185. $ctx1.sendIdx["="]=1;
  63186. $self._deny_($4);
  63187. $ctx1.sendIdx["deny:"]=1;
  63188. $10=$recv($globals.Point)._new();
  63189. $ctx1.sendIdx["new"]=3;
  63190. $9=$recv($10)._y_((4));
  63191. $ctx1.sendIdx["y:"]=1;
  63192. $8=$recv($9)._x();
  63193. $self._assert_equals_($8,nil);
  63194. $self._deny_($recv($recv($recv($recv($globals.Point)._new())._y_((4)))._y()).__eq((0)));
  63195. return self;
  63196. }, function($ctx1) {$ctx1.fill(self,"testNew",{})});
  63197. },
  63198. args: [],
  63199. 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",
  63200. referencedClasses: ["Point"],
  63201. pragmas: [],
  63202. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"]
  63203. }),
  63204. $globals.PointTest);
  63205. $core.addMethod(
  63206. $core.method({
  63207. selector: "testNormal",
  63208. protocol: "tests",
  63209. fn: function (){
  63210. var self=this,$self=this;
  63211. return $core.withContext(function($ctx1) {
  63212. var $2,$1;
  63213. $2=(1).__at((0));
  63214. $ctx1.sendIdx["@"]=1;
  63215. $1=$recv($2)._normal();
  63216. $self._assert_equals_($1,(0).__at((1)));
  63217. return self;
  63218. }, function($ctx1) {$ctx1.fill(self,"testNormal",{})});
  63219. },
  63220. args: [],
  63221. source: "testNormal\x0a\x09self assert: (1@0) normal equals: 0@1",
  63222. referencedClasses: [],
  63223. pragmas: [],
  63224. messageSends: ["assert:equals:", "normal", "@"]
  63225. }),
  63226. $globals.PointTest);
  63227. $core.addMethod(
  63228. $core.method({
  63229. selector: "testNormalized",
  63230. protocol: "tests",
  63231. fn: function (){
  63232. var self=this,$self=this;
  63233. return $core.withContext(function($ctx1) {
  63234. var $2,$1,$3,$5,$4;
  63235. $2=(0).__at((2));
  63236. $ctx1.sendIdx["@"]=1;
  63237. $1=$recv($2)._normalized();
  63238. $ctx1.sendIdx["normalized"]=1;
  63239. $3=(0).__at((1));
  63240. $ctx1.sendIdx["@"]=2;
  63241. $self._assert_equals_($1,$3);
  63242. $ctx1.sendIdx["assert:equals:"]=1;
  63243. $5=(0).__at((0));
  63244. $ctx1.sendIdx["@"]=3;
  63245. $4=$recv($5)._normalized();
  63246. $self._assert_equals_($4,(0).__at((0)));
  63247. return self;
  63248. }, function($ctx1) {$ctx1.fill(self,"testNormalized",{})});
  63249. },
  63250. args: [],
  63251. source: "testNormalized\x0a\x09self assert: (0@2) normalized equals: 0@1.\x0a\x09self assert: (0@0) normalized equals: 0@0.",
  63252. referencedClasses: [],
  63253. pragmas: [],
  63254. messageSends: ["assert:equals:", "normalized", "@"]
  63255. }),
  63256. $globals.PointTest);
  63257. $core.addMethod(
  63258. $core.method({
  63259. selector: "testPolarCoordinates",
  63260. protocol: "tests",
  63261. fn: function (){
  63262. var self=this,$self=this;
  63263. return $core.withContext(function($ctx1) {
  63264. var $2,$1;
  63265. $2=(1).__at((0));
  63266. $ctx1.sendIdx["@"]=1;
  63267. $1=$recv($2)._r();
  63268. $ctx1.sendIdx["r"]=1;
  63269. $self._assert_equals_($1,(1));
  63270. $ctx1.sendIdx["assert:equals:"]=1;
  63271. $self._assert_equals_($recv((0).__at((0)))._r(),(0));
  63272. return self;
  63273. }, function($ctx1) {$ctx1.fill(self,"testPolarCoordinates",{})});
  63274. },
  63275. args: [],
  63276. source: "testPolarCoordinates\x0a\x09self assert: (1@0) r equals: 1.\x0a\x09self assert: (0@0) r equals: 0.",
  63277. referencedClasses: [],
  63278. pragmas: [],
  63279. messageSends: ["assert:equals:", "r", "@"]
  63280. }),
  63281. $globals.PointTest);
  63282. $core.addMethod(
  63283. $core.method({
  63284. selector: "testRectangleCreation",
  63285. protocol: "tests",
  63286. fn: function (){
  63287. var self=this,$self=this;
  63288. return $core.withContext(function($ctx1) {
  63289. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$16;
  63290. $2=(1).__at((1));
  63291. $ctx1.sendIdx["@"]=1;
  63292. $3=(2).__at((2));
  63293. $ctx1.sendIdx["@"]=2;
  63294. $1=$recv($2)._corner_($3);
  63295. $5=(1).__at((1));
  63296. $ctx1.sendIdx["@"]=3;
  63297. $6=(2).__at((2));
  63298. $ctx1.sendIdx["@"]=4;
  63299. $4=$recv($globals.Rectangle)._origin_corner_($5,$6);
  63300. $self._assert_equals_($1,$4);
  63301. $ctx1.sendIdx["assert:equals:"]=1;
  63302. $8=(1).__at((1));
  63303. $ctx1.sendIdx["@"]=5;
  63304. $9=(2).__at((2));
  63305. $ctx1.sendIdx["@"]=6;
  63306. $7=$recv($8)._rectangle_($9);
  63307. $11=(1).__at((1));
  63308. $ctx1.sendIdx["@"]=7;
  63309. $12=(2).__at((2));
  63310. $ctx1.sendIdx["@"]=8;
  63311. $10=$recv($globals.Rectangle)._point_point_($11,$12);
  63312. $self._assert_equals_($7,$10);
  63313. $ctx1.sendIdx["assert:equals:"]=2;
  63314. $14=(1).__at((1));
  63315. $ctx1.sendIdx["@"]=9;
  63316. $15=(2).__at((2));
  63317. $ctx1.sendIdx["@"]=10;
  63318. $13=$recv($14)._extent_($15);
  63319. $17=(1).__at((1));
  63320. $ctx1.sendIdx["@"]=11;
  63321. $16=$recv($globals.Rectangle)._origin_extent_($17,(2).__at((2)));
  63322. $self._assert_equals_($13,$16);
  63323. return self;
  63324. }, function($ctx1) {$ctx1.fill(self,"testRectangleCreation",{})});
  63325. },
  63326. args: [],
  63327. 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)",
  63328. referencedClasses: ["Rectangle"],
  63329. pragmas: [],
  63330. messageSends: ["assert:equals:", "corner:", "@", "origin:corner:", "rectangle:", "point:point:", "extent:", "origin:extent:"]
  63331. }),
  63332. $globals.PointTest);
  63333. $core.addMethod(
  63334. $core.method({
  63335. selector: "testTranslateBy",
  63336. protocol: "tests",
  63337. fn: function (){
  63338. var self=this,$self=this;
  63339. return $core.withContext(function($ctx1) {
  63340. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  63341. $2=(3).__at((3));
  63342. $ctx1.sendIdx["@"]=1;
  63343. $3=(0).__at((1));
  63344. $ctx1.sendIdx["@"]=2;
  63345. $1=$recv($2)._translateBy_($3);
  63346. $ctx1.sendIdx["translateBy:"]=1;
  63347. $4=(3).__at((4));
  63348. $ctx1.sendIdx["@"]=3;
  63349. $self._assert_equals_($1,$4);
  63350. $ctx1.sendIdx["assert:equals:"]=1;
  63351. $6=(3).__at((3));
  63352. $ctx1.sendIdx["@"]=4;
  63353. $8=(1)._negated();
  63354. $ctx1.sendIdx["negated"]=1;
  63355. $7=(0).__at($8);
  63356. $ctx1.sendIdx["@"]=5;
  63357. $5=$recv($6)._translateBy_($7);
  63358. $ctx1.sendIdx["translateBy:"]=2;
  63359. $9=(3).__at((2));
  63360. $ctx1.sendIdx["@"]=6;
  63361. $self._assert_equals_($5,$9);
  63362. $ctx1.sendIdx["assert:equals:"]=2;
  63363. $11=(3).__at((3));
  63364. $ctx1.sendIdx["@"]=7;
  63365. $12=(2).__at((3));
  63366. $ctx1.sendIdx["@"]=8;
  63367. $10=$recv($11)._translateBy_($12);
  63368. $ctx1.sendIdx["translateBy:"]=3;
  63369. $13=(5).__at((6));
  63370. $ctx1.sendIdx["@"]=9;
  63371. $self._assert_equals_($10,$13);
  63372. $ctx1.sendIdx["assert:equals:"]=3;
  63373. $15=(3).__at((3));
  63374. $ctx1.sendIdx["@"]=10;
  63375. $16=$recv((3)._negated()).__at((0));
  63376. $ctx1.sendIdx["@"]=11;
  63377. $14=$recv($15)._translateBy_($16);
  63378. $self._assert_equals_($14,(0).__at((3)));
  63379. return self;
  63380. }, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{})});
  63381. },
  63382. args: [],
  63383. 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.",
  63384. referencedClasses: [],
  63385. pragmas: [],
  63386. messageSends: ["assert:equals:", "translateBy:", "@", "negated"]
  63387. }),
  63388. $globals.PointTest);
  63389. $core.addClass("QueueTest", $globals.TestCase, [], "Kernel-Tests");
  63390. $core.addMethod(
  63391. $core.method({
  63392. selector: "testNextIfAbsent",
  63393. protocol: "tests",
  63394. fn: function (){
  63395. var self=this,$self=this;
  63396. var queue;
  63397. return $core.withContext(function($ctx1) {
  63398. var $2,$1;
  63399. queue=$recv($globals.Queue)._new();
  63400. $recv(queue)._nextPut_("index1");
  63401. $2=$recv(queue)._nextIfAbsent_("empty");
  63402. $ctx1.sendIdx["nextIfAbsent:"]=1;
  63403. $1=$recv($2).__eq("index1");
  63404. $ctx1.sendIdx["="]=1;
  63405. $self._assert_($1);
  63406. $self._deny_($recv($recv(queue)._nextIfAbsent_("empty")).__eq("index1"));
  63407. return self;
  63408. }, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue})});
  63409. },
  63410. args: [],
  63411. 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'",
  63412. referencedClasses: ["Queue"],
  63413. pragmas: [],
  63414. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"]
  63415. }),
  63416. $globals.QueueTest);
  63417. $core.addMethod(
  63418. $core.method({
  63419. selector: "testQueueNext",
  63420. protocol: "tests",
  63421. fn: function (){
  63422. var self=this,$self=this;
  63423. var queue;
  63424. return $core.withContext(function($ctx1) {
  63425. var $1,$3,$2,$5,$4;
  63426. queue=$recv($globals.Queue)._new();
  63427. $1=queue;
  63428. $recv($1)._nextPut_("index1");
  63429. $ctx1.sendIdx["nextPut:"]=1;
  63430. $recv($1)._nextPut_("index2");
  63431. $3=$recv(queue)._next();
  63432. $ctx1.sendIdx["next"]=1;
  63433. $2=$recv($3).__eq("index1");
  63434. $ctx1.sendIdx["="]=1;
  63435. $self._assert_($2);
  63436. $5=$recv(queue)._next();
  63437. $ctx1.sendIdx["next"]=2;
  63438. $4=$recv($5).__eq("index");
  63439. $self._deny_($4);
  63440. $self._should_raise_((function(){
  63441. return $core.withContext(function($ctx2) {
  63442. return $recv(queue)._next();
  63443. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  63444. }),$globals.Error);
  63445. return self;
  63446. }, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue})});
  63447. },
  63448. args: [],
  63449. 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",
  63450. referencedClasses: ["Queue", "Error"],
  63451. pragmas: [],
  63452. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"]
  63453. }),
  63454. $globals.QueueTest);
  63455. $core.addClass("RandomTest", $globals.TestCase, [], "Kernel-Tests");
  63456. $core.addMethod(
  63457. $core.method({
  63458. selector: "testAtRandomNumber",
  63459. protocol: "tests",
  63460. fn: function (){
  63461. var self=this,$self=this;
  63462. var val;
  63463. return $core.withContext(function($ctx1) {
  63464. (100)._timesRepeat_((function(){
  63465. return $core.withContext(function($ctx2) {
  63466. val=(10)._atRandom();
  63467. $self._assert_($recv(val).__gt((0)));
  63468. $ctx2.sendIdx["assert:"]=1;
  63469. return $self._assert_($recv(val).__lt((11)));
  63470. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  63471. }));
  63472. return self;
  63473. }, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val})});
  63474. },
  63475. args: [],
  63476. 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]",
  63477. referencedClasses: [],
  63478. pragmas: [],
  63479. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"]
  63480. }),
  63481. $globals.RandomTest);
  63482. $core.addMethod(
  63483. $core.method({
  63484. selector: "testAtRandomSequenceableCollection",
  63485. protocol: "tests",
  63486. fn: function (){
  63487. var self=this,$self=this;
  63488. var val;
  63489. return $core.withContext(function($ctx1) {
  63490. var $3,$4,$2,$1;
  63491. (100)._timesRepeat_((function(){
  63492. return $core.withContext(function($ctx2) {
  63493. val="abc"._atRandom();
  63494. $3=$recv(val).__eq("a");
  63495. $ctx2.sendIdx["="]=1;
  63496. $4=$recv(val).__eq("b");
  63497. $ctx2.sendIdx["="]=2;
  63498. $2=$recv($3).__or($4);
  63499. $1=$recv($2).__or($recv(val).__eq("c"));
  63500. $ctx2.sendIdx["|"]=1;
  63501. return $self._assert_($1);
  63502. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  63503. }));
  63504. return self;
  63505. }, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val})});
  63506. },
  63507. args: [],
  63508. 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].",
  63509. referencedClasses: [],
  63510. pragmas: [],
  63511. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="]
  63512. }),
  63513. $globals.RandomTest);
  63514. $core.addMethod(
  63515. $core.method({
  63516. selector: "textNext",
  63517. protocol: "tests",
  63518. fn: function (){
  63519. var self=this,$self=this;
  63520. return $core.withContext(function($ctx1) {
  63521. var $1;
  63522. (10000)._timesRepeat_((function(){
  63523. var current,next;
  63524. return $core.withContext(function($ctx2) {
  63525. next=$recv($recv($globals.Random)._new())._next();
  63526. $self._assert_($recv(next).__gt_eq((0)));
  63527. $ctx2.sendIdx["assert:"]=1;
  63528. $self._assert_($recv(next).__lt((1)));
  63529. $1=$recv(current).__eq(next);
  63530. $ctx2.sendIdx["="]=1;
  63531. $self._deny_($1);
  63532. return $recv(next).__eq(current);
  63533. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)});
  63534. }));
  63535. return self;
  63536. }, function($ctx1) {$ctx1.fill(self,"textNext",{})});
  63537. },
  63538. args: [],
  63539. 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 ]",
  63540. referencedClasses: ["Random"],
  63541. pragmas: [],
  63542. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="]
  63543. }),
  63544. $globals.RandomTest);
  63545. $core.addClass("RectangleTest", $globals.TestCase, [], "Kernel-Tests");
  63546. $core.addMethod(
  63547. $core.method({
  63548. selector: "testContainsPoint",
  63549. protocol: "tests",
  63550. fn: function (){
  63551. var self=this,$self=this;
  63552. var rect;
  63553. return $core.withContext(function($ctx1) {
  63554. var $1,$2,$4,$5,$3;
  63555. $1=(0).__at((0));
  63556. $ctx1.sendIdx["@"]=1;
  63557. $2=(4).__at((4));
  63558. $ctx1.sendIdx["@"]=2;
  63559. rect=$recv($globals.Rectangle)._origin_corner_($1,$2);
  63560. $4=rect;
  63561. $5=(1).__at((2));
  63562. $ctx1.sendIdx["@"]=3;
  63563. $3=$recv($4)._containsPoint_($5);
  63564. $ctx1.sendIdx["containsPoint:"]=1;
  63565. $self._assert_($3);
  63566. $ctx1.sendIdx["assert:"]=1;
  63567. $self._assert_($recv($recv(rect)._containsPoint_((5).__at((4))))._not());
  63568. return self;
  63569. }, function($ctx1) {$ctx1.fill(self,"testContainsPoint",{rect:rect})});
  63570. },
  63571. args: [],
  63572. 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.",
  63573. referencedClasses: ["Rectangle"],
  63574. pragmas: [],
  63575. messageSends: ["origin:corner:", "@", "assert:", "containsPoint:", "not"]
  63576. }),
  63577. $globals.RectangleTest);
  63578. $core.addMethod(
  63579. $core.method({
  63580. selector: "testContainsRect",
  63581. protocol: "tests",
  63582. fn: function (){
  63583. var self=this,$self=this;
  63584. return $core.withContext(function($ctx1) {
  63585. var $3,$4,$2,$6,$7,$5,$1,$11,$12,$10,$14,$13,$9,$8;
  63586. $3=(0).__at((0));
  63587. $ctx1.sendIdx["@"]=1;
  63588. $4=(6).__at((6));
  63589. $ctx1.sendIdx["@"]=2;
  63590. $2=$recv($globals.Rectangle)._origin_corner_($3,$4);
  63591. $ctx1.sendIdx["origin:corner:"]=1;
  63592. $6=(1).__at((1));
  63593. $ctx1.sendIdx["@"]=3;
  63594. $7=(5).__at((5));
  63595. $ctx1.sendIdx["@"]=4;
  63596. $5=$recv($globals.Rectangle)._origin_corner_($6,$7);
  63597. $ctx1.sendIdx["origin:corner:"]=2;
  63598. $1=$recv($2)._containsRect_($5);
  63599. $ctx1.sendIdx["containsRect:"]=1;
  63600. $self._assert_($1);
  63601. $ctx1.sendIdx["assert:"]=1;
  63602. $11=(0).__at((0));
  63603. $ctx1.sendIdx["@"]=5;
  63604. $12=(6).__at((6));
  63605. $ctx1.sendIdx["@"]=6;
  63606. $10=$recv($globals.Rectangle)._origin_corner_($11,$12);
  63607. $ctx1.sendIdx["origin:corner:"]=3;
  63608. $14=(1).__at((-1));
  63609. $ctx1.sendIdx["@"]=7;
  63610. $13=$recv($globals.Rectangle)._origin_corner_($14,(5).__at((5)));
  63611. $9=$recv($10)._containsRect_($13);
  63612. $8=$recv($9)._not();
  63613. $self._assert_($8);
  63614. return self;
  63615. }, function($ctx1) {$ctx1.fill(self,"testContainsRect",{})});
  63616. },
  63617. args: [],
  63618. 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.",
  63619. referencedClasses: ["Rectangle"],
  63620. pragmas: [],
  63621. messageSends: ["assert:", "containsRect:", "origin:corner:", "@", "not"]
  63622. }),
  63623. $globals.RectangleTest);
  63624. $core.addMethod(
  63625. $core.method({
  63626. selector: "testOriginExtent",
  63627. protocol: "tests",
  63628. fn: function (){
  63629. var self=this,$self=this;
  63630. var rectangle;
  63631. return $core.withContext(function($ctx1) {
  63632. var $1,$2,$3,$4;
  63633. $1=(3).__at((4));
  63634. $ctx1.sendIdx["@"]=1;
  63635. $2=(7).__at((8));
  63636. $ctx1.sendIdx["@"]=2;
  63637. rectangle=$recv($globals.Rectangle)._origin_extent_($1,$2);
  63638. $3=$recv(rectangle)._origin();
  63639. $4=(3).__at((4));
  63640. $ctx1.sendIdx["@"]=3;
  63641. $self._assert_equals_($3,$4);
  63642. $ctx1.sendIdx["assert:equals:"]=1;
  63643. $self._assert_equals_($recv(rectangle)._corner(),(10).__at((12)));
  63644. return self;
  63645. }, function($ctx1) {$ctx1.fill(self,"testOriginExtent",{rectangle:rectangle})});
  63646. },
  63647. args: [],
  63648. 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.",
  63649. referencedClasses: ["Rectangle"],
  63650. pragmas: [],
  63651. messageSends: ["origin:extent:", "@", "assert:equals:", "origin", "corner"]
  63652. }),
  63653. $globals.RectangleTest);
  63654. $core.addClass("StreamTest", $globals.TestCase, [], "Kernel-Tests");
  63655. $core.addMethod(
  63656. $core.method({
  63657. selector: "collectionClass",
  63658. protocol: "accessing",
  63659. fn: function (){
  63660. var self=this,$self=this;
  63661. return $core.withContext(function($ctx1) {
  63662. return $recv($self._class())._collectionClass();
  63663. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{})});
  63664. },
  63665. args: [],
  63666. source: "collectionClass\x0a\x09^ self class collectionClass",
  63667. referencedClasses: [],
  63668. pragmas: [],
  63669. messageSends: ["collectionClass", "class"]
  63670. }),
  63671. $globals.StreamTest);
  63672. $core.addMethod(
  63673. $core.method({
  63674. selector: "newCollection",
  63675. protocol: "accessing",
  63676. fn: function (){
  63677. var self=this,$self=this;
  63678. return $core.withContext(function($ctx1) {
  63679. return $recv($self._collectionClass())._new();
  63680. }, function($ctx1) {$ctx1.fill(self,"newCollection",{})});
  63681. },
  63682. args: [],
  63683. source: "newCollection\x0a\x09^ self collectionClass new",
  63684. referencedClasses: [],
  63685. pragmas: [],
  63686. messageSends: ["new", "collectionClass"]
  63687. }),
  63688. $globals.StreamTest);
  63689. $core.addMethod(
  63690. $core.method({
  63691. selector: "newStream",
  63692. protocol: "accessing",
  63693. fn: function (){
  63694. var self=this,$self=this;
  63695. return $core.withContext(function($ctx1) {
  63696. return $recv($recv($self._collectionClass())._new())._stream();
  63697. }, function($ctx1) {$ctx1.fill(self,"newStream",{})});
  63698. },
  63699. args: [],
  63700. source: "newStream\x0a\x09^ self collectionClass new stream",
  63701. referencedClasses: [],
  63702. pragmas: [],
  63703. messageSends: ["stream", "new", "collectionClass"]
  63704. }),
  63705. $globals.StreamTest);
  63706. $core.addMethod(
  63707. $core.method({
  63708. selector: "testAtStartAtEnd",
  63709. protocol: "tests",
  63710. fn: function (){
  63711. var self=this,$self=this;
  63712. var stream;
  63713. return $core.withContext(function($ctx1) {
  63714. var $1,$2,$3,$4;
  63715. stream=$self._newStream();
  63716. $1=$recv(stream)._atStart();
  63717. $ctx1.sendIdx["atStart"]=1;
  63718. $self._assert_($1);
  63719. $ctx1.sendIdx["assert:"]=1;
  63720. $2=$recv(stream)._atEnd();
  63721. $ctx1.sendIdx["atEnd"]=1;
  63722. $self._assert_($2);
  63723. $ctx1.sendIdx["assert:"]=2;
  63724. $recv(stream)._nextPutAll_($self._newCollection());
  63725. $3=$recv(stream)._atEnd();
  63726. $ctx1.sendIdx["atEnd"]=2;
  63727. $self._assert_($3);
  63728. $4=$recv(stream)._atStart();
  63729. $ctx1.sendIdx["atStart"]=2;
  63730. $self._deny_($4);
  63731. $ctx1.sendIdx["deny:"]=1;
  63732. $recv(stream)._position_((1));
  63733. $self._deny_($recv(stream)._atEnd());
  63734. $ctx1.sendIdx["deny:"]=2;
  63735. $self._deny_($recv(stream)._atStart());
  63736. return self;
  63737. }, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream})});
  63738. },
  63739. args: [],
  63740. 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",
  63741. referencedClasses: [],
  63742. pragmas: [],
  63743. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"]
  63744. }),
  63745. $globals.StreamTest);
  63746. $core.addMethod(
  63747. $core.method({
  63748. selector: "testContents",
  63749. protocol: "tests",
  63750. fn: function (){
  63751. var self=this,$self=this;
  63752. var stream;
  63753. return $core.withContext(function($ctx1) {
  63754. var $1,$2;
  63755. stream=$self._newStream();
  63756. $1=stream;
  63757. $2=$self._newCollection();
  63758. $ctx1.sendIdx["newCollection"]=1;
  63759. $recv($1)._nextPutAll_($2);
  63760. $self._assert_equals_($recv(stream)._contents(),$self._newCollection());
  63761. return self;
  63762. }, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream})});
  63763. },
  63764. args: [],
  63765. 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",
  63766. referencedClasses: [],
  63767. pragmas: [],
  63768. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"]
  63769. }),
  63770. $globals.StreamTest);
  63771. $core.addMethod(
  63772. $core.method({
  63773. selector: "testIsEmpty",
  63774. protocol: "tests",
  63775. fn: function (){
  63776. var self=this,$self=this;
  63777. var stream;
  63778. return $core.withContext(function($ctx1) {
  63779. var $1;
  63780. stream=$self._newStream();
  63781. $1=$recv(stream)._isEmpty();
  63782. $ctx1.sendIdx["isEmpty"]=1;
  63783. $self._assert_($1);
  63784. $recv(stream)._nextPutAll_($self._newCollection());
  63785. $self._deny_($recv(stream)._isEmpty());
  63786. return self;
  63787. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream})});
  63788. },
  63789. args: [],
  63790. 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",
  63791. referencedClasses: [],
  63792. pragmas: [],
  63793. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"]
  63794. }),
  63795. $globals.StreamTest);
  63796. $core.addMethod(
  63797. $core.method({
  63798. selector: "testPosition",
  63799. protocol: "tests",
  63800. fn: function (){
  63801. var self=this,$self=this;
  63802. var collection,stream;
  63803. return $core.withContext(function($ctx1) {
  63804. var $1,$2,$3;
  63805. collection=$self._newCollection();
  63806. stream=$self._newStream();
  63807. $recv(stream)._nextPutAll_(collection);
  63808. $1=$recv(stream)._position();
  63809. $ctx1.sendIdx["position"]=1;
  63810. $self._assert_equals_($1,$recv(collection)._size());
  63811. $ctx1.sendIdx["assert:equals:"]=1;
  63812. $recv(stream)._position_((0));
  63813. $2=$recv(stream)._position();
  63814. $ctx1.sendIdx["position"]=2;
  63815. $self._assert_equals_($2,(0));
  63816. $ctx1.sendIdx["assert:equals:"]=2;
  63817. $recv(stream)._next();
  63818. $ctx1.sendIdx["next"]=1;
  63819. $3=$recv(stream)._position();
  63820. $ctx1.sendIdx["position"]=3;
  63821. $self._assert_equals_($3,(1));
  63822. $ctx1.sendIdx["assert:equals:"]=3;
  63823. $recv(stream)._next();
  63824. $self._assert_equals_($recv(stream)._position(),(2));
  63825. return self;
  63826. }, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream})});
  63827. },
  63828. args: [],
  63829. 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",
  63830. referencedClasses: [],
  63831. pragmas: [],
  63832. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"]
  63833. }),
  63834. $globals.StreamTest);
  63835. $core.addMethod(
  63836. $core.method({
  63837. selector: "testReading",
  63838. protocol: "tests",
  63839. fn: function (){
  63840. var self=this,$self=this;
  63841. var stream,collection;
  63842. return $core.withContext(function($ctx1) {
  63843. var $1,$2;
  63844. collection=$self._newCollection();
  63845. stream=$self._newStream();
  63846. $1=stream;
  63847. $recv($1)._nextPutAll_(collection);
  63848. $recv($1)._position_((0));
  63849. $recv(collection)._do_((function(each){
  63850. return $core.withContext(function($ctx2) {
  63851. $2=$recv(stream)._next();
  63852. $ctx2.sendIdx["next"]=1;
  63853. return $self._assert_equals_($2,each);
  63854. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63855. }));
  63856. $self._assert_($recv($recv(stream)._next())._isNil());
  63857. return self;
  63858. }, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection})});
  63859. },
  63860. args: [],
  63861. 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",
  63862. referencedClasses: [],
  63863. pragmas: [],
  63864. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"]
  63865. }),
  63866. $globals.StreamTest);
  63867. $core.addMethod(
  63868. $core.method({
  63869. selector: "testStreamContents",
  63870. protocol: "tests",
  63871. fn: function (){
  63872. var self=this,$self=this;
  63873. return self;
  63874. },
  63875. args: [],
  63876. source: "testStreamContents",
  63877. referencedClasses: [],
  63878. pragmas: [],
  63879. messageSends: []
  63880. }),
  63881. $globals.StreamTest);
  63882. $core.addMethod(
  63883. $core.method({
  63884. selector: "testWrite",
  63885. protocol: "tests",
  63886. fn: function (){
  63887. var self=this,$self=this;
  63888. var stream,collection;
  63889. return $core.withContext(function($ctx1) {
  63890. collection=$self._newCollection();
  63891. stream=$self._newStream();
  63892. $recv(collection)._do_((function(each){
  63893. return $core.withContext(function($ctx2) {
  63894. return $recv(stream).__lt_lt(each);
  63895. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63896. }));
  63897. $self._assert_equals_($recv(stream)._contents(),collection);
  63898. return self;
  63899. }, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection})});
  63900. },
  63901. args: [],
  63902. 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",
  63903. referencedClasses: [],
  63904. pragmas: [],
  63905. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"]
  63906. }),
  63907. $globals.StreamTest);
  63908. $core.addMethod(
  63909. $core.method({
  63910. selector: "testWriting",
  63911. protocol: "tests",
  63912. fn: function (){
  63913. var self=this,$self=this;
  63914. var stream,collection;
  63915. return $core.withContext(function($ctx1) {
  63916. var $1;
  63917. collection=$self._newCollection();
  63918. stream=$self._newStream();
  63919. $ctx1.sendIdx["newStream"]=1;
  63920. $recv(collection)._do_((function(each){
  63921. return $core.withContext(function($ctx2) {
  63922. return $recv(stream)._nextPut_(each);
  63923. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63924. }));
  63925. $1=$recv(stream)._contents();
  63926. $ctx1.sendIdx["contents"]=1;
  63927. $self._assert_equals_($1,collection);
  63928. $ctx1.sendIdx["assert:equals:"]=1;
  63929. stream=$self._newStream();
  63930. $recv(stream)._nextPutAll_(collection);
  63931. $self._assert_equals_($recv(stream)._contents(),collection);
  63932. return self;
  63933. }, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection})});
  63934. },
  63935. args: [],
  63936. 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",
  63937. referencedClasses: [],
  63938. pragmas: [],
  63939. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"]
  63940. }),
  63941. $globals.StreamTest);
  63942. $core.addMethod(
  63943. $core.method({
  63944. selector: "collectionClass",
  63945. protocol: "accessing",
  63946. fn: function (){
  63947. var self=this,$self=this;
  63948. return nil;
  63949. },
  63950. args: [],
  63951. source: "collectionClass\x0a\x09^ nil",
  63952. referencedClasses: [],
  63953. pragmas: [],
  63954. messageSends: []
  63955. }),
  63956. $globals.StreamTest.a$cls);
  63957. $core.addMethod(
  63958. $core.method({
  63959. selector: "isAbstract",
  63960. protocol: "testing",
  63961. fn: function (){
  63962. var self=this,$self=this;
  63963. return $core.withContext(function($ctx1) {
  63964. return $recv($self._collectionClass())._isNil();
  63965. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{})});
  63966. },
  63967. args: [],
  63968. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  63969. referencedClasses: [],
  63970. pragmas: [],
  63971. messageSends: ["isNil", "collectionClass"]
  63972. }),
  63973. $globals.StreamTest.a$cls);
  63974. $core.addClass("ArrayStreamTest", $globals.StreamTest, [], "Kernel-Tests");
  63975. $core.addMethod(
  63976. $core.method({
  63977. selector: "newCollection",
  63978. protocol: "accessing",
  63979. fn: function (){
  63980. var self=this,$self=this;
  63981. return $core.withContext(function($ctx1) {
  63982. return [true,(1),(3).__at((4)),"foo"];
  63983. }, function($ctx1) {$ctx1.fill(self,"newCollection",{})});
  63984. },
  63985. args: [],
  63986. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  63987. referencedClasses: [],
  63988. pragmas: [],
  63989. messageSends: ["@"]
  63990. }),
  63991. $globals.ArrayStreamTest);
  63992. $core.addMethod(
  63993. $core.method({
  63994. selector: "collectionClass",
  63995. protocol: "accessing",
  63996. fn: function (){
  63997. var self=this,$self=this;
  63998. return $globals.Array;
  63999. },
  64000. args: [],
  64001. source: "collectionClass\x0a\x09^ Array",
  64002. referencedClasses: ["Array"],
  64003. pragmas: [],
  64004. messageSends: []
  64005. }),
  64006. $globals.ArrayStreamTest.a$cls);
  64007. $core.addClass("StringStreamTest", $globals.StreamTest, [], "Kernel-Tests");
  64008. $core.addMethod(
  64009. $core.method({
  64010. selector: "newCollection",
  64011. protocol: "accessing",
  64012. fn: function (){
  64013. var self=this,$self=this;
  64014. return "hello world";
  64015. },
  64016. args: [],
  64017. source: "newCollection\x0a\x09^ 'hello world'",
  64018. referencedClasses: [],
  64019. pragmas: [],
  64020. messageSends: []
  64021. }),
  64022. $globals.StringStreamTest);
  64023. $core.addMethod(
  64024. $core.method({
  64025. selector: "collectionClass",
  64026. protocol: "accessing",
  64027. fn: function (){
  64028. var self=this,$self=this;
  64029. return $globals.String;
  64030. },
  64031. args: [],
  64032. source: "collectionClass\x0a\x09^ String",
  64033. referencedClasses: ["String"],
  64034. pragmas: [],
  64035. messageSends: []
  64036. }),
  64037. $globals.StringStreamTest.a$cls);
  64038. $core.addClass("UndefinedTest", $globals.TestCase, [], "Kernel-Tests");
  64039. $core.addMethod(
  64040. $core.method({
  64041. selector: "testCopying",
  64042. protocol: "tests",
  64043. fn: function (){
  64044. var self=this,$self=this;
  64045. return $core.withContext(function($ctx1) {
  64046. $self._assert_equals_(nil._copy(),nil);
  64047. return self;
  64048. }, function($ctx1) {$ctx1.fill(self,"testCopying",{})});
  64049. },
  64050. args: [],
  64051. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  64052. referencedClasses: [],
  64053. pragmas: [],
  64054. messageSends: ["assert:equals:", "copy"]
  64055. }),
  64056. $globals.UndefinedTest);
  64057. $core.addMethod(
  64058. $core.method({
  64059. selector: "testDeepCopy",
  64060. protocol: "tests",
  64061. fn: function (){
  64062. var self=this,$self=this;
  64063. return $core.withContext(function($ctx1) {
  64064. $self._assert_($recv(nil._deepCopy()).__eq(nil));
  64065. return self;
  64066. }, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{})});
  64067. },
  64068. args: [],
  64069. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  64070. referencedClasses: [],
  64071. pragmas: [],
  64072. messageSends: ["assert:", "=", "deepCopy"]
  64073. }),
  64074. $globals.UndefinedTest);
  64075. $core.addMethod(
  64076. $core.method({
  64077. selector: "testIfNil",
  64078. protocol: "tests",
  64079. fn: function (){
  64080. var self=this,$self=this;
  64081. return $core.withContext(function($ctx1) {
  64082. var $1,$3,$2,$4,$6,$5,$receiver;
  64083. if(($receiver = nil) == null || $receiver.a$nil){
  64084. $1=true;
  64085. } else {
  64086. $1=nil;
  64087. }
  64088. $self._assert_equals_($1,true);
  64089. $ctx1.sendIdx["assert:equals:"]=1;
  64090. if(($receiver = nil) == null || $receiver.a$nil){
  64091. $3=nil;
  64092. } else {
  64093. $3=true;
  64094. }
  64095. $2=$recv($3).__eq(true);
  64096. $ctx1.sendIdx["="]=1;
  64097. $self._deny_($2);
  64098. $ctx1.sendIdx["deny:"]=1;
  64099. if(($receiver = nil) == null || $receiver.a$nil){
  64100. $4=true;
  64101. } else {
  64102. $4=false;
  64103. }
  64104. $self._assert_equals_($4,true);
  64105. if(($receiver = nil) == null || $receiver.a$nil){
  64106. $6=false;
  64107. } else {
  64108. $6=true;
  64109. }
  64110. $5=$recv($6).__eq(true);
  64111. $self._deny_($5);
  64112. return self;
  64113. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{})});
  64114. },
  64115. args: [],
  64116. 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",
  64117. referencedClasses: [],
  64118. pragmas: [],
  64119. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  64120. }),
  64121. $globals.UndefinedTest);
  64122. $core.addMethod(
  64123. $core.method({
  64124. selector: "testIsNil",
  64125. protocol: "tests",
  64126. fn: function (){
  64127. var self=this,$self=this;
  64128. return $core.withContext(function($ctx1) {
  64129. $self._assert_(nil._isNil());
  64130. $self._deny_(nil._notNil());
  64131. return self;
  64132. }, function($ctx1) {$ctx1.fill(self,"testIsNil",{})});
  64133. },
  64134. args: [],
  64135. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  64136. referencedClasses: [],
  64137. pragmas: [],
  64138. messageSends: ["assert:", "isNil", "deny:", "notNil"]
  64139. }),
  64140. $globals.UndefinedTest);
  64141. });
  64142. define('amber/core/Platform-DOM-Tests',["amber/boot", "require", "amber/core/SUnit"], function($boot,requirejs){"use strict";
  64143. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  64144. var $pkg = $core.addPackage("Platform-DOM-Tests");
  64145. $pkg.innerEval = function (expr) { return eval(expr); };
  64146. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  64147. $core.addClass("PlatformDomTest", $globals.TestCase, ["fixtureDiv"], "Platform-DOM-Tests");
  64148. $core.addMethod(
  64149. $core.method({
  64150. selector: "testEntityConversion",
  64151. protocol: "testing",
  64152. fn: function (){
  64153. var self=this,$self=this;
  64154. return $core.withContext(function($ctx1) {
  64155. var $1;
  64156. $1=$recv($globals.PlatformDom)._isFeasible();
  64157. if($core.assert($1)){
  64158. $self._assert_equals_("&copy;"._htmlTextContent(),"©");
  64159. }
  64160. return self;
  64161. }, function($ctx1) {$ctx1.fill(self,"testEntityConversion",{})});
  64162. },
  64163. args: [],
  64164. source: "testEntityConversion\x0a\x09PlatformDom isFeasible ifTrue: [ self assert: '&copy;' htmlTextContent equals: '©' ]",
  64165. referencedClasses: ["PlatformDom"],
  64166. pragmas: [],
  64167. messageSends: ["ifTrue:", "isFeasible", "assert:equals:", "htmlTextContent"]
  64168. }),
  64169. $globals.PlatformDomTest);
  64170. $core.addMethod(
  64171. $core.method({
  64172. selector: "testTextContentDoesNotRunScript",
  64173. protocol: "testing",
  64174. fn: function (){
  64175. var self=this,$self=this;
  64176. return $core.withContext(function($ctx1) {
  64177. var $1;
  64178. $1=$recv($globals.PlatformDom)._isFeasible();
  64179. if($core.assert($1)){
  64180. $self._shouldnt_raise_((function(){
  64181. return $core.withContext(function($ctx2) {
  64182. return "<script>throw new Error(\x22Intentional\x22)</script>"._htmlTextContent();
  64183. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  64184. }),$globals.Error);
  64185. }
  64186. return self;
  64187. }, function($ctx1) {$ctx1.fill(self,"testTextContentDoesNotRunScript",{})});
  64188. },
  64189. args: [],
  64190. source: "testTextContentDoesNotRunScript\x0a\x09PlatformDom isFeasible ifTrue: [\x0a\x09\x09self shouldnt: [ '<script>throw new Error(\x22Intentional\x22)</script>' htmlTextContent ] raise: Error ]",
  64191. referencedClasses: ["PlatformDom", "Error"],
  64192. pragmas: [],
  64193. messageSends: ["ifTrue:", "isFeasible", "shouldnt:raise:", "htmlTextContent"]
  64194. }),
  64195. $globals.PlatformDomTest);
  64196. });
  64197. define('amber/core/SUnit-Tests',["amber/boot", "require", "amber/core/SUnit"], function($boot,requirejs){"use strict";
  64198. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  64199. var $pkg = $core.addPackage("SUnit-Tests");
  64200. $pkg.innerEval = function (expr) { return eval(expr); };
  64201. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  64202. $core.addClass("ExampleSetTest", $globals.TestCase, ["empty", "full"], "SUnit-Tests");
  64203. $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.";
  64204. $core.addMethod(
  64205. $core.method({
  64206. selector: "setUp",
  64207. protocol: "running",
  64208. fn: function (){
  64209. var self=this,$self=this;
  64210. return $core.withContext(function($ctx1) {
  64211. $self.empty=$recv($globals.Set)._new();
  64212. $self.full=$recv($globals.Set)._with_with_((5),"abc");
  64213. return self;
  64214. }, function($ctx1) {$ctx1.fill(self,"setUp",{})});
  64215. },
  64216. args: [],
  64217. source: "setUp\x0a\x09empty := Set new.\x0a\x09full := Set with: 5 with: #abc",
  64218. referencedClasses: ["Set"],
  64219. pragmas: [],
  64220. messageSends: ["new", "with:with:"]
  64221. }),
  64222. $globals.ExampleSetTest);
  64223. $core.addMethod(
  64224. $core.method({
  64225. selector: "testAdd",
  64226. protocol: "tests",
  64227. fn: function (){
  64228. var self=this,$self=this;
  64229. return $core.withContext(function($ctx1) {
  64230. $recv($self.empty)._add_((5));
  64231. $self._assert_($recv($self.empty)._includes_((5)));
  64232. return self;
  64233. }, function($ctx1) {$ctx1.fill(self,"testAdd",{})});
  64234. },
  64235. args: [],
  64236. source: "testAdd\x0a\x09empty add: 5.\x0a\x09self assert: (empty includes: 5)",
  64237. referencedClasses: [],
  64238. pragmas: [],
  64239. messageSends: ["add:", "assert:", "includes:"]
  64240. }),
  64241. $globals.ExampleSetTest);
  64242. $core.addMethod(
  64243. $core.method({
  64244. selector: "testGrow",
  64245. protocol: "tests",
  64246. fn: function (){
  64247. var self=this,$self=this;
  64248. return $core.withContext(function($ctx1) {
  64249. $recv($self.empty)._addAll_((1)._to_((100)));
  64250. $self._assert_equals_($recv($self.empty)._size(),(100));
  64251. return self;
  64252. }, function($ctx1) {$ctx1.fill(self,"testGrow",{})});
  64253. },
  64254. args: [],
  64255. source: "testGrow\x0a\x09empty addAll: (1 to: 100).\x0a\x09self assert: empty size equals: 100",
  64256. referencedClasses: [],
  64257. pragmas: [],
  64258. messageSends: ["addAll:", "to:", "assert:equals:", "size"]
  64259. }),
  64260. $globals.ExampleSetTest);
  64261. $core.addMethod(
  64262. $core.method({
  64263. selector: "testIllegal",
  64264. protocol: "tests",
  64265. fn: function (){
  64266. var self=this,$self=this;
  64267. return $core.withContext(function($ctx1) {
  64268. $self._should_raise_((function(){
  64269. return $core.withContext(function($ctx2) {
  64270. return $recv($self.empty)._at_((5));
  64271. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64272. }),$globals.Error);
  64273. $ctx1.sendIdx["should:raise:"]=1;
  64274. $self._should_raise_((function(){
  64275. return $core.withContext(function($ctx2) {
  64276. return $recv($self.empty)._at_put_((5),"abc");
  64277. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  64278. }),$globals.Error);
  64279. return self;
  64280. }, function($ctx1) {$ctx1.fill(self,"testIllegal",{})});
  64281. },
  64282. args: [],
  64283. 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",
  64284. referencedClasses: ["Error"],
  64285. pragmas: [],
  64286. messageSends: ["should:raise:", "at:", "at:put:"]
  64287. }),
  64288. $globals.ExampleSetTest);
  64289. $core.addMethod(
  64290. $core.method({
  64291. selector: "testIncludes",
  64292. protocol: "tests",
  64293. fn: function (){
  64294. var self=this,$self=this;
  64295. return $core.withContext(function($ctx1) {
  64296. var $1;
  64297. $1=$recv($self.full)._includes_((5));
  64298. $ctx1.sendIdx["includes:"]=1;
  64299. $self._assert_($1);
  64300. $ctx1.sendIdx["assert:"]=1;
  64301. $self._assert_($recv($self.full)._includes_("abc"));
  64302. return self;
  64303. }, function($ctx1) {$ctx1.fill(self,"testIncludes",{})});
  64304. },
  64305. args: [],
  64306. source: "testIncludes\x0a\x09self assert: (full includes: 5).\x0a\x09self assert: (full includes: #abc)",
  64307. referencedClasses: [],
  64308. pragmas: [],
  64309. messageSends: ["assert:", "includes:"]
  64310. }),
  64311. $globals.ExampleSetTest);
  64312. $core.addMethod(
  64313. $core.method({
  64314. selector: "testOccurrences",
  64315. protocol: "tests",
  64316. fn: function (){
  64317. var self=this,$self=this;
  64318. return $core.withContext(function($ctx1) {
  64319. var $1,$2;
  64320. $1=$recv($self.empty)._occurrencesOf_((0));
  64321. $ctx1.sendIdx["occurrencesOf:"]=1;
  64322. $self._assert_equals_($1,(0));
  64323. $ctx1.sendIdx["assert:equals:"]=1;
  64324. $2=$recv($self.full)._occurrencesOf_((5));
  64325. $ctx1.sendIdx["occurrencesOf:"]=2;
  64326. $self._assert_equals_($2,(1));
  64327. $ctx1.sendIdx["assert:equals:"]=2;
  64328. $recv($self.full)._add_((5));
  64329. $self._assert_equals_($recv($self.full)._occurrencesOf_((5)),(1));
  64330. return self;
  64331. }, function($ctx1) {$ctx1.fill(self,"testOccurrences",{})});
  64332. },
  64333. args: [],
  64334. 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",
  64335. referencedClasses: [],
  64336. pragmas: [],
  64337. messageSends: ["assert:equals:", "occurrencesOf:", "add:"]
  64338. }),
  64339. $globals.ExampleSetTest);
  64340. $core.addMethod(
  64341. $core.method({
  64342. selector: "testRemove",
  64343. protocol: "tests",
  64344. fn: function (){
  64345. var self=this,$self=this;
  64346. return $core.withContext(function($ctx1) {
  64347. var $1;
  64348. $recv($self.full)._remove_((5));
  64349. $1=$recv($self.full)._includes_("abc");
  64350. $ctx1.sendIdx["includes:"]=1;
  64351. $self._assert_($1);
  64352. $self._deny_($recv($self.full)._includes_((5)));
  64353. return self;
  64354. }, function($ctx1) {$ctx1.fill(self,"testRemove",{})});
  64355. },
  64356. args: [],
  64357. source: "testRemove\x0a\x09full remove: 5.\x0a\x09self assert: (full includes: #abc).\x0a\x09self deny: (full includes: 5)",
  64358. referencedClasses: [],
  64359. pragmas: [],
  64360. messageSends: ["remove:", "assert:", "includes:", "deny:"]
  64361. }),
  64362. $globals.ExampleSetTest);
  64363. $core.addClass("SUnitAsyncTest", $globals.TestCase, ["flag"], "SUnit-Tests");
  64364. $core.addMethod(
  64365. $core.method({
  64366. selector: "fakeError",
  64367. protocol: "helpers",
  64368. fn: function (){
  64369. var self=this,$self=this;
  64370. return $core.withContext(function($ctx1) {
  64371. $self.flag="bad";
  64372. $self._timeout_((30));
  64373. $self.flag=$recv($self._async_((function(){
  64374. return $core.withContext(function($ctx2) {
  64375. $self.flag="ok";
  64376. return $self._error_("Intentional");
  64377. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64378. })))._valueWithTimeout_((20));
  64379. return self;
  64380. }, function($ctx1) {$ctx1.fill(self,"fakeError",{})});
  64381. },
  64382. args: [],
  64383. source: "fakeError\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self error: 'Intentional' ]) valueWithTimeout: 20",
  64384. referencedClasses: [],
  64385. pragmas: [],
  64386. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  64387. }),
  64388. $globals.SUnitAsyncTest);
  64389. $core.addMethod(
  64390. $core.method({
  64391. selector: "fakeErrorFailingInTearDown",
  64392. protocol: "helpers",
  64393. fn: function (){
  64394. var self=this,$self=this;
  64395. return $core.withContext(function($ctx1) {
  64396. $self.flag="bad";
  64397. $self._timeout_((30));
  64398. $self.flag=$recv($self._async_((function(){
  64399. return $core.withContext(function($ctx2) {
  64400. return $self._error_("Intentional");
  64401. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64402. })))._valueWithTimeout_((20));
  64403. return self;
  64404. }, function($ctx1) {$ctx1.fill(self,"fakeErrorFailingInTearDown",{})});
  64405. },
  64406. args: [],
  64407. source: "fakeErrorFailingInTearDown\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ self error: 'Intentional' ]) valueWithTimeout: 20",
  64408. referencedClasses: [],
  64409. pragmas: [],
  64410. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  64411. }),
  64412. $globals.SUnitAsyncTest);
  64413. $core.addMethod(
  64414. $core.method({
  64415. selector: "fakeFailure",
  64416. protocol: "helpers",
  64417. fn: function (){
  64418. var self=this,$self=this;
  64419. return $core.withContext(function($ctx1) {
  64420. $self.flag="bad";
  64421. $self._timeout_((30));
  64422. $self.flag=$recv($self._async_((function(){
  64423. return $core.withContext(function($ctx2) {
  64424. $self.flag="ok";
  64425. return $self._assert_(false);
  64426. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64427. })))._valueWithTimeout_((20));
  64428. return self;
  64429. }, function($ctx1) {$ctx1.fill(self,"fakeFailure",{})});
  64430. },
  64431. args: [],
  64432. source: "fakeFailure\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self assert: false ]) valueWithTimeout: 20",
  64433. referencedClasses: [],
  64434. pragmas: [],
  64435. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:"]
  64436. }),
  64437. $globals.SUnitAsyncTest);
  64438. $core.addMethod(
  64439. $core.method({
  64440. selector: "fakeMultipleTimeoutFailing",
  64441. protocol: "helpers",
  64442. fn: function (){
  64443. var self=this,$self=this;
  64444. return $core.withContext(function($ctx1) {
  64445. var $1;
  64446. $self._timeout_((100));
  64447. $ctx1.sendIdx["timeout:"]=1;
  64448. $1=$self._async_((function(){
  64449. return $core.withContext(function($ctx2) {
  64450. $self._timeout_((20));
  64451. return $recv($self._async_((function(){
  64452. return $core.withContext(function($ctx3) {
  64453. return $self._finished();
  64454. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  64455. })))._valueWithTimeout_((30));
  64456. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64457. }));
  64458. $ctx1.sendIdx["async:"]=1;
  64459. $recv($1)._valueWithTimeout_((20));
  64460. $ctx1.sendIdx["valueWithTimeout:"]=1;
  64461. return self;
  64462. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutFailing",{})});
  64463. },
  64464. args: [],
  64465. 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",
  64466. referencedClasses: [],
  64467. pragmas: [],
  64468. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  64469. }),
  64470. $globals.SUnitAsyncTest);
  64471. $core.addMethod(
  64472. $core.method({
  64473. selector: "fakeMultipleTimeoutPassing",
  64474. protocol: "helpers",
  64475. fn: function (){
  64476. var self=this,$self=this;
  64477. return $core.withContext(function($ctx1) {
  64478. var $1;
  64479. $self._timeout_((20));
  64480. $ctx1.sendIdx["timeout:"]=1;
  64481. $1=$self._async_((function(){
  64482. return $core.withContext(function($ctx2) {
  64483. $self._timeout_((40));
  64484. return $recv($self._async_((function(){
  64485. return $core.withContext(function($ctx3) {
  64486. return $self._finished();
  64487. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  64488. })))._valueWithTimeout_((20));
  64489. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64490. }));
  64491. $ctx1.sendIdx["async:"]=1;
  64492. $recv($1)._valueWithTimeout_((10));
  64493. $ctx1.sendIdx["valueWithTimeout:"]=1;
  64494. return self;
  64495. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutPassing",{})});
  64496. },
  64497. args: [],
  64498. 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",
  64499. referencedClasses: [],
  64500. pragmas: [],
  64501. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  64502. }),
  64503. $globals.SUnitAsyncTest);
  64504. $core.addMethod(
  64505. $core.method({
  64506. selector: "fakeTimeout",
  64507. protocol: "helpers",
  64508. fn: function (){
  64509. var self=this,$self=this;
  64510. return $core.withContext(function($ctx1) {
  64511. $self._timeout_((10));
  64512. $recv($self._async_((function(){
  64513. return $core.withContext(function($ctx2) {
  64514. return $self._finished();
  64515. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64516. })))._valueWithTimeout_((20));
  64517. return self;
  64518. }, function($ctx1) {$ctx1.fill(self,"fakeTimeout",{})});
  64519. },
  64520. args: [],
  64521. source: "fakeTimeout\x0a\x09self timeout: 10.\x0a\x09(self async: [ self finished ]) valueWithTimeout: 20",
  64522. referencedClasses: [],
  64523. pragmas: [],
  64524. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  64525. }),
  64526. $globals.SUnitAsyncTest);
  64527. $core.addMethod(
  64528. $core.method({
  64529. selector: "selectorSetOf:",
  64530. protocol: "private",
  64531. fn: function (aCollection){
  64532. var self=this,$self=this;
  64533. return $core.withContext(function($ctx1) {
  64534. return $recv($recv(aCollection)._collect_((function(each){
  64535. return $core.withContext(function($ctx2) {
  64536. return $recv(each)._selector();
  64537. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  64538. })))._asSet();
  64539. }, function($ctx1) {$ctx1.fill(self,"selectorSetOf:",{aCollection:aCollection})});
  64540. },
  64541. args: ["aCollection"],
  64542. source: "selectorSetOf: aCollection\x0a\x09^ (aCollection collect: [ :each | each selector ]) asSet",
  64543. referencedClasses: [],
  64544. pragmas: [],
  64545. messageSends: ["asSet", "collect:", "selector"]
  64546. }),
  64547. $globals.SUnitAsyncTest);
  64548. $core.addMethod(
  64549. $core.method({
  64550. selector: "setUp",
  64551. protocol: "running",
  64552. fn: function (){
  64553. var self=this,$self=this;
  64554. $self.flag="ok";
  64555. return self;
  64556. },
  64557. args: [],
  64558. source: "setUp\x0a\x09flag := 'ok'",
  64559. referencedClasses: [],
  64560. pragmas: [],
  64561. messageSends: []
  64562. }),
  64563. $globals.SUnitAsyncTest);
  64564. $core.addMethod(
  64565. $core.method({
  64566. selector: "tearDown",
  64567. protocol: "running",
  64568. fn: function (){
  64569. var self=this,$self=this;
  64570. return $core.withContext(function($ctx1) {
  64571. $self._assert_equals_("ok",$self.flag);
  64572. return self;
  64573. }, function($ctx1) {$ctx1.fill(self,"tearDown",{})});
  64574. },
  64575. args: [],
  64576. source: "tearDown\x0a\x09self assert: 'ok' equals: flag",
  64577. referencedClasses: [],
  64578. pragmas: [],
  64579. messageSends: ["assert:equals:"]
  64580. }),
  64581. $globals.SUnitAsyncTest);
  64582. $core.addMethod(
  64583. $core.method({
  64584. selector: "testAsyncErrorsAndFailures",
  64585. protocol: "tests",
  64586. fn: function (){
  64587. var self=this,$self=this;
  64588. var suite,runner,result,assertBlock;
  64589. return $core.withContext(function($ctx1) {
  64590. var $1,$2,$3,$4;
  64591. suite=["fakeError", "fakeErrorFailingInTearDown", "fakeFailure", "testPass"]._collect_((function(each){
  64592. return $core.withContext(function($ctx2) {
  64593. return $recv($self._class())._selector_(each);
  64594. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  64595. }));
  64596. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  64597. $self._timeout_((200));
  64598. result=$recv(runner)._result();
  64599. $ctx1.sendIdx["result"]=1;
  64600. assertBlock=$self._async_((function(){
  64601. return $core.withContext(function($ctx2) {
  64602. $1=$self._selectorSetOf_($recv(result)._errors());
  64603. $ctx2.sendIdx["selectorSetOf:"]=1;
  64604. $2=["fakeError"]._asSet();
  64605. $ctx2.sendIdx["asSet"]=1;
  64606. $self._assert_equals_($1,$2);
  64607. $ctx2.sendIdx["assert:equals:"]=1;
  64608. $self._assert_equals_($self._selectorSetOf_($recv(result)._failures()),["fakeErrorFailingInTearDown", "fakeFailure"]._asSet());
  64609. return $self._finished();
  64610. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  64611. }));
  64612. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  64613. return $core.withContext(function($ctx2) {
  64614. $3=$recv($recv(ann)._result()).__eq_eq(result);
  64615. if($core.assert($3)){
  64616. $4=$recv($recv(result)._runs()).__eq($recv(result)._total());
  64617. return $recv($4)._ifTrue_(assertBlock);
  64618. }
  64619. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  64620. }));
  64621. $recv(runner)._run();
  64622. return self;
  64623. }, function($ctx1) {$ctx1.fill(self,"testAsyncErrorsAndFailures",{suite:suite,runner:runner,result:result,assertBlock:assertBlock})});
  64624. },
  64625. args: [],
  64626. 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",
  64627. referencedClasses: ["TestSuiteRunner", "ResultAnnouncement"],
  64628. pragmas: [],
  64629. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "asSet", "failures", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  64630. }),
  64631. $globals.SUnitAsyncTest);
  64632. $core.addMethod(
  64633. $core.method({
  64634. selector: "testAsyncNeedsTimeout",
  64635. protocol: "tests",
  64636. fn: function (){
  64637. var self=this,$self=this;
  64638. return $core.withContext(function($ctx1) {
  64639. $self._should_raise_((function(){
  64640. return $core.withContext(function($ctx2) {
  64641. return $self._async_((function(){
  64642. }));
  64643. $ctx2.sendIdx["async:"]=1;
  64644. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64645. }),$globals.Error);
  64646. $self._timeout_((0));
  64647. $self._shouldnt_raise_((function(){
  64648. return $core.withContext(function($ctx2) {
  64649. return $self._async_((function(){
  64650. }));
  64651. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  64652. }),$globals.Error);
  64653. $self._finished();
  64654. return self;
  64655. }, function($ctx1) {$ctx1.fill(self,"testAsyncNeedsTimeout",{})});
  64656. },
  64657. args: [],
  64658. source: "testAsyncNeedsTimeout\x0a\x09self should: [ self async: [ ] ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self async: [ ] ] raise: Error.\x0a\x09self finished",
  64659. referencedClasses: ["Error"],
  64660. pragmas: [],
  64661. messageSends: ["should:raise:", "async:", "timeout:", "shouldnt:raise:", "finished"]
  64662. }),
  64663. $globals.SUnitAsyncTest);
  64664. $core.addMethod(
  64665. $core.method({
  64666. selector: "testFinishedNeedsTimeout",
  64667. protocol: "tests",
  64668. fn: function (){
  64669. var self=this,$self=this;
  64670. return $core.withContext(function($ctx1) {
  64671. $self._should_raise_((function(){
  64672. return $core.withContext(function($ctx2) {
  64673. return $self._finished();
  64674. $ctx2.sendIdx["finished"]=1;
  64675. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64676. }),$globals.Error);
  64677. $self._timeout_((0));
  64678. $self._shouldnt_raise_((function(){
  64679. return $core.withContext(function($ctx2) {
  64680. return $self._finished();
  64681. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  64682. }),$globals.Error);
  64683. return self;
  64684. }, function($ctx1) {$ctx1.fill(self,"testFinishedNeedsTimeout",{})});
  64685. },
  64686. args: [],
  64687. source: "testFinishedNeedsTimeout\x0a\x09self should: [ self finished ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self finished ] raise: Error.",
  64688. referencedClasses: ["Error"],
  64689. pragmas: [],
  64690. messageSends: ["should:raise:", "finished", "timeout:", "shouldnt:raise:"]
  64691. }),
  64692. $globals.SUnitAsyncTest);
  64693. $core.addMethod(
  64694. $core.method({
  64695. selector: "testIsAsyncReturnsCorrectValues",
  64696. protocol: "tests",
  64697. fn: function (){
  64698. var self=this,$self=this;
  64699. return $core.withContext(function($ctx1) {
  64700. var $1,$2;
  64701. $1=$self._isAsync();
  64702. $ctx1.sendIdx["isAsync"]=1;
  64703. $self._deny_($1);
  64704. $ctx1.sendIdx["deny:"]=1;
  64705. $self._timeout_((0));
  64706. $2=$self._isAsync();
  64707. $ctx1.sendIdx["isAsync"]=2;
  64708. $self._assert_($2);
  64709. $self._finished();
  64710. $self._deny_($self._isAsync());
  64711. return self;
  64712. }, function($ctx1) {$ctx1.fill(self,"testIsAsyncReturnsCorrectValues",{})});
  64713. },
  64714. args: [],
  64715. source: "testIsAsyncReturnsCorrectValues\x0a\x09self deny: self isAsync.\x0a\x09self timeout: 0.\x0a\x09self assert: self isAsync.\x0a\x09self finished.\x0a\x09self deny: self isAsync",
  64716. referencedClasses: [],
  64717. pragmas: [],
  64718. messageSends: ["deny:", "isAsync", "timeout:", "assert:", "finished"]
  64719. }),
  64720. $globals.SUnitAsyncTest);
  64721. $core.addMethod(
  64722. $core.method({
  64723. selector: "testPass",
  64724. protocol: "tests",
  64725. fn: function (){
  64726. var self=this,$self=this;
  64727. return $core.withContext(function($ctx1) {
  64728. $self.flag="bad";
  64729. $self._timeout_((10));
  64730. $self.flag=$recv($self._async_((function(){
  64731. return $core.withContext(function($ctx2) {
  64732. $self._assert_(true);
  64733. $self._finished();
  64734. $self.flag="ok";
  64735. return $self.flag;
  64736. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64737. })))._valueWithTimeout_((5));
  64738. return self;
  64739. }, function($ctx1) {$ctx1.fill(self,"testPass",{})});
  64740. },
  64741. args: [],
  64742. source: "testPass\x0a\x09flag := 'bad'.\x0a\x09self timeout: 10.\x0a\x09flag := (self async: [ self assert: true. self finished. flag := 'ok' ]) valueWithTimeout: 5",
  64743. referencedClasses: [],
  64744. pragmas: [],
  64745. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:", "finished"]
  64746. }),
  64747. $globals.SUnitAsyncTest);
  64748. $core.addMethod(
  64749. $core.method({
  64750. selector: "testTimeouts",
  64751. protocol: "tests",
  64752. fn: function (){
  64753. var self=this,$self=this;
  64754. var suite,runner,result,assertBlock;
  64755. return $core.withContext(function($ctx1) {
  64756. var $1,$2,$3;
  64757. suite=["fakeTimeout", "fakeMultipleTimeoutFailing", "fakeMultipleTimeoutPassing", "testPass"]._collect_((function(each){
  64758. return $core.withContext(function($ctx2) {
  64759. return $recv($self._class())._selector_(each);
  64760. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  64761. }));
  64762. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  64763. $self._timeout_((200));
  64764. result=$recv(runner)._result();
  64765. $ctx1.sendIdx["result"]=1;
  64766. assertBlock=$self._async_((function(){
  64767. return $core.withContext(function($ctx2) {
  64768. $1=$self._selectorSetOf_($recv(result)._errors());
  64769. $ctx2.sendIdx["selectorSetOf:"]=1;
  64770. $self._assert_equals_($1,$recv($globals.Set)._new());
  64771. $ctx2.sendIdx["assert:equals:"]=1;
  64772. $self._assert_equals_($self._selectorSetOf_($recv(result)._failures()),["fakeMultipleTimeoutFailing", "fakeTimeout"]._asSet());
  64773. return $self._finished();
  64774. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  64775. }));
  64776. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  64777. return $core.withContext(function($ctx2) {
  64778. $2=$recv($recv(ann)._result()).__eq_eq(result);
  64779. if($core.assert($2)){
  64780. $3=$recv($recv(result)._runs()).__eq($recv(result)._total());
  64781. return $recv($3)._ifTrue_(assertBlock);
  64782. }
  64783. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  64784. }));
  64785. $recv(runner)._run();
  64786. return self;
  64787. }, function($ctx1) {$ctx1.fill(self,"testTimeouts",{suite:suite,runner:runner,result:result,assertBlock:assertBlock})});
  64788. },
  64789. args: [],
  64790. 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",
  64791. referencedClasses: ["TestSuiteRunner", "Set", "ResultAnnouncement"],
  64792. pragmas: [],
  64793. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "new", "failures", "asSet", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  64794. }),
  64795. $globals.SUnitAsyncTest);
  64796. $core.addMethod(
  64797. $core.method({
  64798. selector: "testTwoAsyncPassesWithFinishedOnlyOneIsRun",
  64799. protocol: "tests",
  64800. fn: function (){
  64801. var self=this,$self=this;
  64802. var x;
  64803. return $core.withContext(function($ctx1) {
  64804. var $1;
  64805. $self.flag="bad";
  64806. $self._timeout_((10));
  64807. x=(0);
  64808. $1=$self._async_((function(){
  64809. return $core.withContext(function($ctx2) {
  64810. $self._finished();
  64811. $ctx2.sendIdx["finished"]=1;
  64812. $self.flag="ok";
  64813. x=$recv(x).__plus((1));
  64814. $ctx2.sendIdx["+"]=1;
  64815. return $self._assert_equals_(x,(1));
  64816. $ctx2.sendIdx["assert:equals:"]=1;
  64817. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64818. }));
  64819. $ctx1.sendIdx["async:"]=1;
  64820. $self.flag=$recv($1)._valueWithTimeout_((0));
  64821. $ctx1.sendIdx["valueWithTimeout:"]=1;
  64822. $self.flag=$recv($self._async_((function(){
  64823. return $core.withContext(function($ctx2) {
  64824. $self._finished();
  64825. $self.flag="ok";
  64826. x=$recv(x).__plus((1));
  64827. return $self._assert_equals_(x,(1));
  64828. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  64829. })))._valueWithTimeout_((0));
  64830. return self;
  64831. }, function($ctx1) {$ctx1.fill(self,"testTwoAsyncPassesWithFinishedOnlyOneIsRun",{x:x})});
  64832. },
  64833. args: [],
  64834. 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.",
  64835. referencedClasses: [],
  64836. pragmas: [],
  64837. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished", "+", "assert:equals:"]
  64838. }),
  64839. $globals.SUnitAsyncTest);
  64840. });
  64841. define('amber/devel',[
  64842. './lang',
  64843. './brikz', // pre-fetch, dep of ./boot
  64844. './kernel-checks', // pre-fetch, dep of ./boot
  64845. './kernel-fundamentals', // pre-fetch, dep of ./boot
  64846. './kernel-language', // pre-fetch, dep of ./boot
  64847. './boot', // pre-fetch, class loader
  64848. './deploy', // pre-fetch, dep of ./lang
  64849. // --- packages of the development only Amber begin here ---
  64850. 'amber/core/Platform-DOM',
  64851. 'amber/core/SUnit',
  64852. 'amber/core/Compiler-Tests',
  64853. 'amber/core/Kernel-Tests',
  64854. 'amber/core/Platform-DOM-Tests',
  64855. 'amber/core/SUnit-Tests'
  64856. // --- packages of the development only Amber end here ---
  64857. ], function (amber) {
  64858. return amber;
  64859. });
  64860. define('amber/core/Platform-Node',["amber/boot", "require", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  64861. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  64862. var $pkg = $core.addPackage("Platform-Node");
  64863. $pkg.innerEval = function (expr) { return eval(expr); };
  64864. $pkg.imports = ["amber/core/Platform-Services"];
  64865. $pkg.isReady = new Promise(function (resolve, reject) { requirejs(["amber/core/Platform-Services"], function () {resolve();}, reject); });
  64866. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  64867. $core.addClass("NodePlatform", $globals.Object, [], "Platform-Node");
  64868. $globals.NodePlatform.comment="I am `Platform` service implementation for node-like environment.";
  64869. $core.addMethod(
  64870. $core.method({
  64871. selector: "globals",
  64872. protocol: "accessing",
  64873. fn: function (){
  64874. var self=this,$self=this;
  64875. return global;
  64876. },
  64877. args: [],
  64878. source: "globals\x0a\x09^ global",
  64879. referencedClasses: [],
  64880. pragmas: [],
  64881. messageSends: []
  64882. }),
  64883. $globals.NodePlatform);
  64884. $core.addMethod(
  64885. $core.method({
  64886. selector: "newXhr",
  64887. protocol: "accessing",
  64888. fn: function (){
  64889. var self=this,$self=this;
  64890. return $core.withContext(function($ctx1) {
  64891. var $receiver;
  64892. if(($receiver = $globals.XMLHttpRequest) == null || $receiver.a$nil){
  64893. $self._error_("XMLHttpRequest not available.");
  64894. } else {
  64895. return $recv($globals.XMLHttpRequest)._new();
  64896. }
  64897. return self;
  64898. }, function($ctx1) {$ctx1.fill(self,"newXhr",{})});
  64899. },
  64900. args: [],
  64901. source: "newXhr\x0a\x09XMLHttpRequest\x0a\x09\x09ifNotNil: [ ^ XMLHttpRequest new ]\x0a\x09\x09ifNil: [ self error: 'XMLHttpRequest not available.' ]",
  64902. referencedClasses: ["XMLHttpRequest"],
  64903. pragmas: [],
  64904. messageSends: ["ifNotNil:ifNil:", "new", "error:"]
  64905. }),
  64906. $globals.NodePlatform);
  64907. $core.addMethod(
  64908. $core.method({
  64909. selector: "initialize",
  64910. protocol: "testing",
  64911. fn: function (){
  64912. var self=this,$self=this;
  64913. return $core.withContext(function($ctx1) {
  64914. var $1;
  64915. $1=$self._isFeasible();
  64916. if($core.assert($1)){
  64917. $recv($globals.Platform)._registerIfNone_($self._new());
  64918. }
  64919. return self;
  64920. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  64921. },
  64922. args: [],
  64923. source: "initialize\x0a\x09self isFeasible ifTrue: [ Platform registerIfNone: self new ]",
  64924. referencedClasses: ["Platform"],
  64925. pragmas: [],
  64926. messageSends: ["ifTrue:", "isFeasible", "registerIfNone:", "new"]
  64927. }),
  64928. $globals.NodePlatform.a$cls);
  64929. $core.addMethod(
  64930. $core.method({
  64931. selector: "isFeasible",
  64932. protocol: "testing",
  64933. fn: function (){
  64934. var self=this,$self=this;
  64935. return $core.withContext(function($ctx1) {
  64936. return typeof process !== "undefined" && process && process.versions && process.versions.node != null;
  64937. return self;
  64938. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{})});
  64939. },
  64940. args: [],
  64941. source: "isFeasible\x0a<inlineJS: 'return typeof process !== \x22undefined\x22 && process && process.versions && process.versions.node != null'>",
  64942. referencedClasses: [],
  64943. pragmas: [["inlineJS:", ["return typeof process !== \x22undefined\x22 && process && process.versions && process.versions.node != null"]]],
  64944. messageSends: []
  64945. }),
  64946. $globals.NodePlatform.a$cls);
  64947. });
  64948. define('amber_cli/AmberCli',["amber/boot", "require", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  64949. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  64950. var $pkg = $core.addPackage("AmberCli");
  64951. $pkg.innerEval = function (expr) { return eval(expr); };
  64952. $pkg.transport = {"type":"amd","amdNamespace":"amber_cli"};
  64953. $core.addClass("AmberCli", $globals.Object, [], "AmberCli");
  64954. $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.";
  64955. $core.addMethod(
  64956. $core.method({
  64957. selector: "commandLineSwitches",
  64958. protocol: "commandline",
  64959. fn: function (){
  64960. var self=this,$self=this;
  64961. var switches;
  64962. return $core.withContext(function($ctx1) {
  64963. switches=$recv($recv($self._class())._methodsInProtocol_("commands"))._collect_((function(each){
  64964. return $core.withContext(function($ctx2) {
  64965. return $recv(each)._selector();
  64966. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  64967. }));
  64968. $ctx1.sendIdx["collect:"]=1;
  64969. switches=$recv(switches)._select_((function(each){
  64970. return $core.withContext(function($ctx2) {
  64971. return $recv(each)._match_("^[^:]*:$");
  64972. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  64973. }));
  64974. switches=$recv(switches)._collect_((function(each){
  64975. return $core.withContext(function($ctx2) {
  64976. return $recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase();
  64977. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  64978. }));
  64979. return switches;
  64980. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches})});
  64981. },
  64982. args: [],
  64983. 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",
  64984. referencedClasses: [],
  64985. pragmas: [],
  64986. messageSends: ["collect:", "methodsInProtocol:", "class", "selector", "select:", "match:", "asLowercase", "replace:with:", "allButLast"]
  64987. }),
  64988. $globals.AmberCli.a$cls);
  64989. $core.addMethod(
  64990. $core.method({
  64991. selector: "config:",
  64992. protocol: "commands",
  64993. fn: function (args){
  64994. var self=this,$self=this;
  64995. return $core.withContext(function($ctx1) {
  64996. $recv($recv($globals.Configurator)._new())._start();
  64997. return self;
  64998. }, function($ctx1) {$ctx1.fill(self,"config:",{args:args})});
  64999. },
  65000. args: ["args"],
  65001. source: "config: args\x0a\x09Configurator new start",
  65002. referencedClasses: ["Configurator"],
  65003. pragmas: [],
  65004. messageSends: ["start", "new"]
  65005. }),
  65006. $globals.AmberCli.a$cls);
  65007. $core.addMethod(
  65008. $core.method({
  65009. selector: "handleArguments:",
  65010. protocol: "commandline",
  65011. fn: function (args){
  65012. var self=this,$self=this;
  65013. var selector;
  65014. return $core.withContext(function($ctx1) {
  65015. var $1;
  65016. $1=$recv(args)._first();
  65017. $ctx1.sendIdx["first"]=1;
  65018. selector=$self._selectorForCommandLineSwitch_($1);
  65019. $recv(args)._remove_($recv(args)._first());
  65020. $self._perform_withArguments_(selector,$recv($globals.Array)._with_(args));
  65021. return self;
  65022. }, function($ctx1) {$ctx1.fill(self,"handleArguments:",{args:args,selector:selector})});
  65023. },
  65024. args: ["args"],
  65025. source: "handleArguments: args\x0a\x09| selector |\x0a\x0a\x09selector := self selectorForCommandLineSwitch: (args first).\x0a\x09args remove: args first.\x0a\x09self perform: selector withArguments: (Array with: args)",
  65026. referencedClasses: ["Array"],
  65027. pragmas: [],
  65028. messageSends: ["selectorForCommandLineSwitch:", "first", "remove:", "perform:withArguments:", "with:"]
  65029. }),
  65030. $globals.AmberCli.a$cls);
  65031. $core.addMethod(
  65032. $core.method({
  65033. selector: "help:",
  65034. protocol: "commands",
  65035. fn: function (args){
  65036. var self=this,$self=this;
  65037. return $core.withContext(function($ctx1) {
  65038. $recv($globals.Transcript)._show_("Available commands");
  65039. $recv($self._commandLineSwitches())._do_((function(each){
  65040. return $core.withContext(function($ctx2) {
  65041. return $recv(console)._log_(each);
  65042. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  65043. }));
  65044. return self;
  65045. }, function($ctx1) {$ctx1.fill(self,"help:",{args:args})});
  65046. },
  65047. args: ["args"],
  65048. source: "help: args\x0a\x09Transcript show: 'Available commands'.\x0a\x09self commandLineSwitches do: [ :each | console log: each ]",
  65049. referencedClasses: ["Transcript"],
  65050. pragmas: [],
  65051. messageSends: ["show:", "do:", "commandLineSwitches", "log:"]
  65052. }),
  65053. $globals.AmberCli.a$cls);
  65054. $core.addMethod(
  65055. $core.method({
  65056. selector: "init:",
  65057. protocol: "commands",
  65058. fn: function (args){
  65059. var self=this,$self=this;
  65060. return $core.withContext(function($ctx1) {
  65061. $recv($recv($globals.Initer)._new())._start();
  65062. return self;
  65063. }, function($ctx1) {$ctx1.fill(self,"init:",{args:args})});
  65064. },
  65065. args: ["args"],
  65066. source: "init: args\x0a\x09Initer new start",
  65067. referencedClasses: ["Initer"],
  65068. pragmas: [],
  65069. messageSends: ["start", "new"]
  65070. }),
  65071. $globals.AmberCli.a$cls);
  65072. $core.addMethod(
  65073. $core.method({
  65074. selector: "main",
  65075. protocol: "startup",
  65076. fn: function (){
  65077. var self=this,$self=this;
  65078. var args,packageJSON;
  65079. return $core.withContext(function($ctx1) {
  65080. var $7,$6,$5,$4,$3,$2,$1;
  65081. var $early={};
  65082. try {
  65083. packageJSON=$recv(require)._value_("../package.json");
  65084. $7=$recv(packageJSON)._version();
  65085. $ctx1.sendIdx["version"]=1;
  65086. $6="Welcome to Amber CLI version ".__comma($7);
  65087. $5=$recv($6).__comma(" (Amber ");
  65088. $ctx1.sendIdx[","]=5;
  65089. $4=$recv($5).__comma($recv($globals.Smalltalk)._version());
  65090. $ctx1.sendIdx[","]=4;
  65091. $3=$recv($4).__comma(", NodeJS ");
  65092. $ctx1.sendIdx[","]=3;
  65093. $2=$recv($3).__comma($recv($recv(process)._versions())._node());
  65094. $ctx1.sendIdx[","]=2;
  65095. $1=$recv($2).__comma(").");
  65096. $ctx1.sendIdx[","]=1;
  65097. $recv($globals.Transcript)._show_($1);
  65098. args=$recv(process)._argv();
  65099. $recv(args)._removeFrom_to_((1),(2));
  65100. $recv(args)._ifEmpty_ifNotEmpty_((function(){
  65101. return $core.withContext(function($ctx2) {
  65102. return $self._help_(nil);
  65103. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  65104. }),(function(){
  65105. return $core.withContext(function($ctx2) {
  65106. throw $early=[$self._handleArguments_(args)];
  65107. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  65108. }));
  65109. return self;
  65110. }
  65111. catch(e) {if(e===$early)return e[0]; throw e}
  65112. }, function($ctx1) {$ctx1.fill(self,"main",{args:args,packageJSON:packageJSON})});
  65113. },
  65114. args: [],
  65115. 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]",
  65116. referencedClasses: ["Transcript", "Smalltalk"],
  65117. pragmas: [],
  65118. messageSends: ["value:", "show:", ",", "version", "node", "versions", "argv", "removeFrom:to:", "ifEmpty:ifNotEmpty:", "help:", "handleArguments:"]
  65119. }),
  65120. $globals.AmberCli.a$cls);
  65121. $core.addMethod(
  65122. $core.method({
  65123. selector: "repl:",
  65124. protocol: "commands",
  65125. fn: function (args){
  65126. var self=this,$self=this;
  65127. return $core.withContext(function($ctx1) {
  65128. return $recv($recv($globals.Repl)._new())._createInterface();
  65129. }, function($ctx1) {$ctx1.fill(self,"repl:",{args:args})});
  65130. },
  65131. args: ["args"],
  65132. source: "repl: args\x0a\x09^ Repl new createInterface",
  65133. referencedClasses: ["Repl"],
  65134. pragmas: [],
  65135. messageSends: ["createInterface", "new"]
  65136. }),
  65137. $globals.AmberCli.a$cls);
  65138. $core.addMethod(
  65139. $core.method({
  65140. selector: "selectorForCommandLineSwitch:",
  65141. protocol: "commandline",
  65142. fn: function (aSwitch){
  65143. var self=this,$self=this;
  65144. var command,selector;
  65145. return $core.withContext(function($ctx1) {
  65146. var $1;
  65147. $1=$recv($self._commandLineSwitches())._includes_(aSwitch);
  65148. if($core.assert($1)){
  65149. selector=$recv($recv(aSwitch)._replace_with_("-[a-z]",(function(each){
  65150. return $core.withContext(function($ctx2) {
  65151. return $recv($recv(each)._second())._asUppercase();
  65152. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  65153. }))).__comma(":");
  65154. selector;
  65155. } else {
  65156. selector="help:";
  65157. selector;
  65158. }
  65159. return selector;
  65160. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch,command:command,selector:selector})});
  65161. },
  65162. args: ["aSwitch"],
  65163. 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",
  65164. referencedClasses: [],
  65165. pragmas: [],
  65166. messageSends: ["ifTrue:ifFalse:", "includes:", "commandLineSwitches", ",", "replace:with:", "asUppercase", "second"]
  65167. }),
  65168. $globals.AmberCli.a$cls);
  65169. $core.addMethod(
  65170. $core.method({
  65171. selector: "serve:",
  65172. protocol: "commands",
  65173. fn: function (args){
  65174. var self=this,$self=this;
  65175. return $core.withContext(function($ctx1) {
  65176. return $recv($recv($globals.FileServer)._createServerWithArguments_(args))._start();
  65177. }, function($ctx1) {$ctx1.fill(self,"serve:",{args:args})});
  65178. },
  65179. args: ["args"],
  65180. source: "serve: args\x0a\x09^ (FileServer createServerWithArguments: args) start",
  65181. referencedClasses: ["FileServer"],
  65182. pragmas: [],
  65183. messageSends: ["start", "createServerWithArguments:"]
  65184. }),
  65185. $globals.AmberCli.a$cls);
  65186. $core.addMethod(
  65187. $core.method({
  65188. selector: "version:",
  65189. protocol: "commands",
  65190. fn: function (arguments_){
  65191. var self=this,$self=this;
  65192. return self;
  65193. },
  65194. args: ["arguments"],
  65195. source: "version: arguments",
  65196. referencedClasses: [],
  65197. pragmas: [],
  65198. messageSends: []
  65199. }),
  65200. $globals.AmberCli.a$cls);
  65201. $core.addClass("BaseFileManipulator", $globals.Object, ["path", "fs"], "AmberCli");
  65202. $core.addMethod(
  65203. $core.method({
  65204. selector: "dirname",
  65205. protocol: "private",
  65206. fn: function (){
  65207. var self=this,$self=this;
  65208. return $core.withContext(function($ctx1) {
  65209. return __dirname;
  65210. return self;
  65211. }, function($ctx1) {$ctx1.fill(self,"dirname",{})});
  65212. },
  65213. args: [],
  65214. source: "dirname\x0a\x09<inlineJS: 'return __dirname'>",
  65215. referencedClasses: [],
  65216. pragmas: [["inlineJS:", ["return __dirname"]]],
  65217. messageSends: []
  65218. }),
  65219. $globals.BaseFileManipulator);
  65220. $core.addMethod(
  65221. $core.method({
  65222. selector: "initialize",
  65223. protocol: "initialization",
  65224. fn: function (){
  65225. var self=this,$self=this;
  65226. return $core.withContext(function($ctx1) {
  65227. (
  65228. $ctx1.supercall = true,
  65229. ($globals.BaseFileManipulator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  65230. $ctx1.supercall = false;
  65231. $self.path=$recv(require)._value_("path");
  65232. $ctx1.sendIdx["value:"]=1;
  65233. $self.fs=$recv(require)._value_("fs");
  65234. return self;
  65235. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  65236. },
  65237. args: [],
  65238. source: "initialize\x0a\x09super initialize.\x0a\x09path := require value: 'path'.\x0a\x09fs := require value: 'fs'",
  65239. referencedClasses: [],
  65240. pragmas: [],
  65241. messageSends: ["initialize", "value:"]
  65242. }),
  65243. $globals.BaseFileManipulator);
  65244. $core.addMethod(
  65245. $core.method({
  65246. selector: "rootDirname",
  65247. protocol: "private",
  65248. fn: function (){
  65249. var self=this,$self=this;
  65250. return $core.withContext(function($ctx1) {
  65251. return $recv($self.path)._join_with_($self._dirname(),"..");
  65252. }, function($ctx1) {$ctx1.fill(self,"rootDirname",{})});
  65253. },
  65254. args: [],
  65255. source: "rootDirname\x0a\x09^ path join: self dirname with: '..'",
  65256. referencedClasses: [],
  65257. pragmas: [],
  65258. messageSends: ["join:with:", "dirname"]
  65259. }),
  65260. $globals.BaseFileManipulator);
  65261. $core.addClass("Configurator", $globals.BaseFileManipulator, [], "AmberCli");
  65262. $core.addMethod(
  65263. $core.method({
  65264. selector: "initialize",
  65265. protocol: "initialization",
  65266. fn: function (){
  65267. var self=this,$self=this;
  65268. return $core.withContext(function($ctx1) {
  65269. (
  65270. $ctx1.supercall = true,
  65271. ($globals.Configurator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  65272. $ctx1.supercall = false;
  65273. return self;
  65274. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  65275. },
  65276. args: [],
  65277. source: "initialize\x0a\x09super initialize",
  65278. referencedClasses: [],
  65279. pragmas: [],
  65280. messageSends: ["initialize"]
  65281. }),
  65282. $globals.Configurator);
  65283. $core.addMethod(
  65284. $core.method({
  65285. selector: "start",
  65286. protocol: "action",
  65287. fn: function (){
  65288. var self=this,$self=this;
  65289. return $core.withContext(function($ctx1) {
  65290. var $receiver;
  65291. $self._writeConfigThenDo_((function(err){
  65292. return $core.withContext(function($ctx2) {
  65293. if(($receiver = err) == null || $receiver.a$nil){
  65294. return $recv(process)._exit();
  65295. } else {
  65296. return $recv(process)._exit_((111));
  65297. }
  65298. }, function($ctx2) {$ctx2.fillBlock({err:err},$ctx1,1)});
  65299. }));
  65300. return self;
  65301. }, function($ctx1) {$ctx1.fill(self,"start",{})});
  65302. },
  65303. args: [],
  65304. source: "start\x0a\x09self writeConfigThenDo: [ :err | err\x0a\x09\x09ifNotNil: [ process exit: 111 ]\x0a\x09\x09ifNil: [ process exit ]]",
  65305. referencedClasses: [],
  65306. pragmas: [],
  65307. messageSends: ["writeConfigThenDo:", "ifNotNil:ifNil:", "exit:", "exit"]
  65308. }),
  65309. $globals.Configurator);
  65310. $core.addMethod(
  65311. $core.method({
  65312. selector: "writeConfigThenDo:",
  65313. protocol: "action",
  65314. fn: function (aBlock){
  65315. var self=this,$self=this;
  65316. return $core.withContext(function($ctx1) {
  65317. $recv($recv($recv(require)._value_("@ambers/sdk"))._configBuilder())._writeConfig_toFile_thenDo_($recv(process)._cwd(),"config.js",aBlock);
  65318. return self;
  65319. }, function($ctx1) {$ctx1.fill(self,"writeConfigThenDo:",{aBlock:aBlock})});
  65320. },
  65321. args: ["aBlock"],
  65322. source: "writeConfigThenDo: aBlock\x0a\x09(require value: '@ambers/sdk') configBuilder\x0a\x09\x09writeConfig: process cwd\x0a\x09\x09toFile: 'config.js'\x0a\x09\x09thenDo: aBlock",
  65323. referencedClasses: [],
  65324. pragmas: [],
  65325. messageSends: ["writeConfig:toFile:thenDo:", "configBuilder", "value:", "cwd"]
  65326. }),
  65327. $globals.Configurator);
  65328. $core.addClass("FileServer", $globals.BaseFileManipulator, ["http", "url", "host", "port", "basePath", "util", "username", "password", "fallbackPage"], "AmberCli");
  65329. $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.";
  65330. $core.addMethod(
  65331. $core.method({
  65332. selector: "base64Decode:",
  65333. protocol: "private",
  65334. fn: function (aString){
  65335. var self=this,$self=this;
  65336. return $core.withContext(function($ctx1) {
  65337. return (new Buffer(aString, "base64").toString());
  65338. return self;
  65339. }, function($ctx1) {$ctx1.fill(self,"base64Decode:",{aString:aString})});
  65340. },
  65341. args: ["aString"],
  65342. source: "base64Decode: aString\x0a\x09<inlineJS: 'return (new Buffer(aString, \x22base64\x22).toString())'>",
  65343. referencedClasses: [],
  65344. pragmas: [["inlineJS:", ["return (new Buffer(aString, \x22base64\x22).toString())"]]],
  65345. messageSends: []
  65346. }),
  65347. $globals.FileServer);
  65348. $core.addMethod(
  65349. $core.method({
  65350. selector: "basePath",
  65351. protocol: "accessing",
  65352. fn: function (){
  65353. var self=this,$self=this;
  65354. return $core.withContext(function($ctx1) {
  65355. var $1,$receiver;
  65356. $1=$self.basePath;
  65357. if(($receiver = $1) == null || $receiver.a$nil){
  65358. return $recv($self._class())._defaultBasePath();
  65359. } else {
  65360. return $1;
  65361. }
  65362. }, function($ctx1) {$ctx1.fill(self,"basePath",{})});
  65363. },
  65364. args: [],
  65365. source: "basePath\x0a\x09^ basePath ifNil: [self class defaultBasePath]",
  65366. referencedClasses: [],
  65367. pragmas: [],
  65368. messageSends: ["ifNil:", "defaultBasePath", "class"]
  65369. }),
  65370. $globals.FileServer);
  65371. $core.addMethod(
  65372. $core.method({
  65373. selector: "basePath:",
  65374. protocol: "accessing",
  65375. fn: function (aString){
  65376. var self=this,$self=this;
  65377. return $core.withContext(function($ctx1) {
  65378. $self.basePath=aString;
  65379. $self._validateBasePath();
  65380. return self;
  65381. }, function($ctx1) {$ctx1.fill(self,"basePath:",{aString:aString})});
  65382. },
  65383. args: ["aString"],
  65384. source: "basePath: aString\x0a\x09basePath := aString.\x0a\x09self validateBasePath.",
  65385. referencedClasses: [],
  65386. pragmas: [],
  65387. messageSends: ["validateBasePath"]
  65388. }),
  65389. $globals.FileServer);
  65390. $core.addMethod(
  65391. $core.method({
  65392. selector: "checkDirectoryLayout",
  65393. protocol: "initialization",
  65394. fn: function (){
  65395. var self=this,$self=this;
  65396. return $core.withContext(function($ctx1) {
  65397. var $1;
  65398. $1=$recv($self.fs)._existsSync_($self._withBasePath_("index.html"));
  65399. if(!$core.assert($1)){
  65400. $recv(console)._warn_("Warning: project directory does not contain index.html.");
  65401. $ctx1.sendIdx["warn:"]=1;
  65402. $recv(console)._warn_(" You can specify the directory containing index.html with --base-path.");
  65403. $ctx1.sendIdx["warn:"]=2;
  65404. $recv(console)._warn_(" You can also specify a page to be served by default,");
  65405. $ctx1.sendIdx["warn:"]=3;
  65406. $recv(console)._warn_(" for all paths that do not map to a file, with --fallback-page.");
  65407. }
  65408. return self;
  65409. }, function($ctx1) {$ctx1.fill(self,"checkDirectoryLayout",{})});
  65410. },
  65411. args: [],
  65412. 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.'].",
  65413. referencedClasses: [],
  65414. pragmas: [],
  65415. messageSends: ["ifFalse:", "existsSync:", "withBasePath:", "warn:"]
  65416. }),
  65417. $globals.FileServer);
  65418. $core.addMethod(
  65419. $core.method({
  65420. selector: "fallbackPage",
  65421. protocol: "accessing",
  65422. fn: function (){
  65423. var self=this,$self=this;
  65424. return $self.fallbackPage;
  65425. },
  65426. args: [],
  65427. source: "fallbackPage\x0a\x09^ fallbackPage",
  65428. referencedClasses: [],
  65429. pragmas: [],
  65430. messageSends: []
  65431. }),
  65432. $globals.FileServer);
  65433. $core.addMethod(
  65434. $core.method({
  65435. selector: "fallbackPage:",
  65436. protocol: "accessing",
  65437. fn: function (aString){
  65438. var self=this,$self=this;
  65439. $self.fallbackPage=aString;
  65440. return self;
  65441. },
  65442. args: ["aString"],
  65443. source: "fallbackPage: aString\x0a\x09fallbackPage := aString",
  65444. referencedClasses: [],
  65445. pragmas: [],
  65446. messageSends: []
  65447. }),
  65448. $globals.FileServer);
  65449. $core.addMethod(
  65450. $core.method({
  65451. selector: "handleGETRequest:respondTo:",
  65452. protocol: "request handling",
  65453. fn: function (aRequest,aResponse){
  65454. var self=this,$self=this;
  65455. var uri,filename;
  65456. return $core.withContext(function($ctx1) {
  65457. var $1;
  65458. uri=$recv($self.url)._parse_($recv(aRequest)._url());
  65459. filename=$recv($self.path)._join_with_($self._basePath(),$recv(uri)._pathname());
  65460. $recv($self.fs)._exists_do_(filename,(function(aBoolean){
  65461. return $core.withContext(function($ctx2) {
  65462. if($core.assert(aBoolean)){
  65463. $1=$recv($recv($self.fs)._statSync_(filename))._isDirectory();
  65464. if($core.assert($1)){
  65465. return $self._respondDirectoryNamed_from_to_(filename,uri,aResponse);
  65466. } else {
  65467. return $self._respondFileNamed_to_(filename,aResponse);
  65468. }
  65469. } else {
  65470. return $self._respondNotFoundTo_(aResponse);
  65471. }
  65472. }, function($ctx2) {$ctx2.fillBlock({aBoolean:aBoolean},$ctx1,1)});
  65473. }));
  65474. return self;
  65475. }, function($ctx1) {$ctx1.fill(self,"handleGETRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,uri:uri,filename:filename})});
  65476. },
  65477. args: ["aRequest", "aResponse"],
  65478. 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]]]",
  65479. referencedClasses: [],
  65480. pragmas: [],
  65481. messageSends: ["parse:", "url", "join:with:", "basePath", "pathname", "exists:do:", "ifFalse:ifTrue:", "respondNotFoundTo:", "ifTrue:ifFalse:", "isDirectory", "statSync:", "respondDirectoryNamed:from:to:", "respondFileNamed:to:"]
  65482. }),
  65483. $globals.FileServer);
  65484. $core.addMethod(
  65485. $core.method({
  65486. selector: "handleOPTIONSRequest:respondTo:",
  65487. protocol: "request handling",
  65488. fn: function (aRequest,aResponse){
  65489. var self=this,$self=this;
  65490. return $core.withContext(function($ctx1) {
  65491. $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)]));
  65492. $recv(aResponse)._end();
  65493. return self;
  65494. }, function($ctx1) {$ctx1.fill(self,"handleOPTIONSRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse})});
  65495. },
  65496. args: ["aRequest", "aResponse"],
  65497. 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",
  65498. referencedClasses: [],
  65499. pragmas: [],
  65500. messageSends: ["writeHead:options:", "end"]
  65501. }),
  65502. $globals.FileServer);
  65503. $core.addMethod(
  65504. $core.method({
  65505. selector: "handlePUTRequest:respondTo:",
  65506. protocol: "request handling",
  65507. fn: function (aRequest,aResponse){
  65508. var self=this,$self=this;
  65509. var file,stream;
  65510. return $core.withContext(function($ctx1) {
  65511. var $1,$2,$3,$4;
  65512. $1=$self._isAuthenticated_(aRequest);
  65513. if(!$core.assert($1)){
  65514. $self._respondAuthenticationRequiredTo_(aResponse);
  65515. return nil;
  65516. }
  65517. file=".".__comma($recv(aRequest)._url());
  65518. $ctx1.sendIdx[","]=1;
  65519. stream=$recv($self.fs)._createWriteStream_(file);
  65520. $recv(stream)._on_do_("error",(function(error){
  65521. return $core.withContext(function($ctx2) {
  65522. $2=console;
  65523. $3="Error creating WriteStream for file ".__comma(file);
  65524. $ctx2.sendIdx[","]=2;
  65525. $recv($2)._warn_($3);
  65526. $ctx2.sendIdx["warn:"]=1;
  65527. $recv(console)._warn_(" Did you forget to create the necessary directory in your project (often /src)?");
  65528. $ctx2.sendIdx["warn:"]=2;
  65529. $recv(console)._warn_(" The exact error is: ".__comma(error));
  65530. return $self._respondNotCreatedTo_(aResponse);
  65531. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  65532. }));
  65533. $ctx1.sendIdx["on:do:"]=1;
  65534. $recv(stream)._on_do_("close",(function(){
  65535. return $core.withContext(function($ctx2) {
  65536. return $self._respondCreatedTo_(aResponse);
  65537. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  65538. }));
  65539. $ctx1.sendIdx["on:do:"]=2;
  65540. $recv(aRequest)._setEncoding_("utf8");
  65541. $recv(aRequest)._on_do_("data",(function(data){
  65542. return $core.withContext(function($ctx2) {
  65543. return $recv(stream)._write_(data);
  65544. }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1,4)});
  65545. }));
  65546. $ctx1.sendIdx["on:do:"]=3;
  65547. $recv(aRequest)._on_do_("end",(function(){
  65548. return $core.withContext(function($ctx2) {
  65549. $4=$recv(stream)._writable();
  65550. if($core.assert($4)){
  65551. return $recv(stream)._end();
  65552. }
  65553. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  65554. }));
  65555. return self;
  65556. }, function($ctx1) {$ctx1.fill(self,"handlePUTRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,file:file,stream:stream})});
  65557. },
  65558. args: ["aRequest", "aResponse"],
  65559. 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]]",
  65560. referencedClasses: [],
  65561. pragmas: [],
  65562. messageSends: ["ifFalse:", "isAuthenticated:", "respondAuthenticationRequiredTo:", ",", "url", "createWriteStream:", "on:do:", "warn:", "respondNotCreatedTo:", "respondCreatedTo:", "setEncoding:", "write:", "ifTrue:", "writable", "end"]
  65563. }),
  65564. $globals.FileServer);
  65565. $core.addMethod(
  65566. $core.method({
  65567. selector: "handleRequest:respondTo:",
  65568. protocol: "request handling",
  65569. fn: function (aRequest,aResponse){
  65570. var self=this,$self=this;
  65571. return $core.withContext(function($ctx1) {
  65572. var $2,$1,$4,$3,$5;
  65573. $2=$recv(aRequest)._method();
  65574. $ctx1.sendIdx["method"]=1;
  65575. $1=$recv($2).__eq("PUT");
  65576. $ctx1.sendIdx["="]=1;
  65577. if($core.assert($1)){
  65578. $self._handlePUTRequest_respondTo_(aRequest,aResponse);
  65579. }
  65580. $4=$recv(aRequest)._method();
  65581. $ctx1.sendIdx["method"]=2;
  65582. $3=$recv($4).__eq("GET");
  65583. $ctx1.sendIdx["="]=2;
  65584. if($core.assert($3)){
  65585. $self._handleGETRequest_respondTo_(aRequest,aResponse);
  65586. }
  65587. $5=$recv($recv(aRequest)._method()).__eq("OPTIONS");
  65588. if($core.assert($5)){
  65589. $self._handleOPTIONSRequest_respondTo_(aRequest,aResponse);
  65590. }
  65591. return self;
  65592. }, function($ctx1) {$ctx1.fill(self,"handleRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse})});
  65593. },
  65594. args: ["aRequest", "aResponse"],
  65595. 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]",
  65596. referencedClasses: [],
  65597. pragmas: [],
  65598. messageSends: ["ifTrue:", "=", "method", "handlePUTRequest:respondTo:", "handleGETRequest:respondTo:", "handleOPTIONSRequest:respondTo:"]
  65599. }),
  65600. $globals.FileServer);
  65601. $core.addMethod(
  65602. $core.method({
  65603. selector: "host",
  65604. protocol: "accessing",
  65605. fn: function (){
  65606. var self=this,$self=this;
  65607. return $self.host;
  65608. },
  65609. args: [],
  65610. source: "host\x0a\x09^ host",
  65611. referencedClasses: [],
  65612. pragmas: [],
  65613. messageSends: []
  65614. }),
  65615. $globals.FileServer);
  65616. $core.addMethod(
  65617. $core.method({
  65618. selector: "host:",
  65619. protocol: "accessing",
  65620. fn: function (hostname){
  65621. var self=this,$self=this;
  65622. $self.host=hostname;
  65623. return self;
  65624. },
  65625. args: ["hostname"],
  65626. source: "host: hostname\x0a\x09host := hostname",
  65627. referencedClasses: [],
  65628. pragmas: [],
  65629. messageSends: []
  65630. }),
  65631. $globals.FileServer);
  65632. $core.addMethod(
  65633. $core.method({
  65634. selector: "initialize",
  65635. protocol: "initialization",
  65636. fn: function (){
  65637. var self=this,$self=this;
  65638. return $core.withContext(function($ctx1) {
  65639. var $1;
  65640. (
  65641. $ctx1.supercall = true,
  65642. ($globals.FileServer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  65643. $ctx1.supercall = false;
  65644. $self.http=$self._require_("http");
  65645. $ctx1.sendIdx["require:"]=1;
  65646. $self.util=$self._require_("util");
  65647. $ctx1.sendIdx["require:"]=2;
  65648. $self.url=$self._require_("url");
  65649. $1=$self._class();
  65650. $ctx1.sendIdx["class"]=1;
  65651. $self.host=$recv($1)._defaultHost();
  65652. $self.port=$recv($self._class())._defaultPort();
  65653. $self.username=nil;
  65654. $self.password=nil;
  65655. $self.fallbackPage=nil;
  65656. return self;
  65657. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  65658. },
  65659. args: [],
  65660. 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.",
  65661. referencedClasses: [],
  65662. pragmas: [],
  65663. messageSends: ["initialize", "require:", "defaultHost", "class", "defaultPort"]
  65664. }),
  65665. $globals.FileServer);
  65666. $core.addMethod(
  65667. $core.method({
  65668. selector: "isAuthenticated:",
  65669. protocol: "private",
  65670. fn: function (aRequest){
  65671. var self=this,$self=this;
  65672. var header,token,auth,parts;
  65673. return $core.withContext(function($ctx1) {
  65674. var $2,$1,$3,$4,$5,$8,$9,$7,$6,$receiver;
  65675. var $early={};
  65676. try {
  65677. $2=$recv($self.username)._isNil();
  65678. $ctx1.sendIdx["isNil"]=1;
  65679. $1=$recv($2)._and_((function(){
  65680. return $core.withContext(function($ctx2) {
  65681. return $recv($self.password)._isNil();
  65682. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  65683. }));
  65684. $ctx1.sendIdx["and:"]=1;
  65685. if($core.assert($1)){
  65686. return true;
  65687. }
  65688. $3=$recv($recv(aRequest)._headers())._at_("authorization");
  65689. $ctx1.sendIdx["at:"]=1;
  65690. if(($receiver = $3) == null || $receiver.a$nil){
  65691. header="";
  65692. } else {
  65693. header=$3;
  65694. }
  65695. $recv(header)._ifEmpty_ifNotEmpty_((function(){
  65696. throw $early=[false];
  65697. }),(function(){
  65698. return $core.withContext(function($ctx2) {
  65699. $4=$recv(header)._tokenize_(" ");
  65700. $ctx2.sendIdx["tokenize:"]=1;
  65701. if(($receiver = $4) == null || $receiver.a$nil){
  65702. token="";
  65703. } else {
  65704. token=$4;
  65705. }
  65706. $5=$recv(token)._at_((2));
  65707. $ctx2.sendIdx["at:"]=2;
  65708. auth=$self._base64Decode_($5);
  65709. parts=$recv(auth)._tokenize_(":");
  65710. $8=$self.username;
  65711. $9=$recv(parts)._at_((1));
  65712. $ctx2.sendIdx["at:"]=3;
  65713. $7=$recv($8).__eq($9);
  65714. $ctx2.sendIdx["="]=1;
  65715. $6=$recv($7)._and_((function(){
  65716. return $core.withContext(function($ctx3) {
  65717. return $recv($self.password).__eq($recv(parts)._at_((2)));
  65718. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  65719. }));
  65720. if($core.assert($6)){
  65721. throw $early=[true];
  65722. } else {
  65723. throw $early=[false];
  65724. }
  65725. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  65726. }));
  65727. return self;
  65728. }
  65729. catch(e) {if(e===$early)return e[0]; throw e}
  65730. }, function($ctx1) {$ctx1.fill(self,"isAuthenticated:",{aRequest:aRequest,header:header,token:token,auth:auth,parts:parts})});
  65731. },
  65732. args: ["aRequest"],
  65733. 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].",
  65734. referencedClasses: [],
  65735. pragmas: [],
  65736. messageSends: ["ifTrue:", "and:", "isNil", "ifNil:", "at:", "headers", "ifEmpty:ifNotEmpty:", "tokenize:", "base64Decode:", "ifTrue:ifFalse:", "="]
  65737. }),
  65738. $globals.FileServer);
  65739. $core.addMethod(
  65740. $core.method({
  65741. selector: "password:",
  65742. protocol: "accessing",
  65743. fn: function (aPassword){
  65744. var self=this,$self=this;
  65745. $self.password=aPassword;
  65746. return self;
  65747. },
  65748. args: ["aPassword"],
  65749. source: "password: aPassword\x0a\x09password := aPassword.",
  65750. referencedClasses: [],
  65751. pragmas: [],
  65752. messageSends: []
  65753. }),
  65754. $globals.FileServer);
  65755. $core.addMethod(
  65756. $core.method({
  65757. selector: "port",
  65758. protocol: "accessing",
  65759. fn: function (){
  65760. var self=this,$self=this;
  65761. return $self.port;
  65762. },
  65763. args: [],
  65764. source: "port\x0a\x09^ port",
  65765. referencedClasses: [],
  65766. pragmas: [],
  65767. messageSends: []
  65768. }),
  65769. $globals.FileServer);
  65770. $core.addMethod(
  65771. $core.method({
  65772. selector: "port:",
  65773. protocol: "accessing",
  65774. fn: function (aNumber){
  65775. var self=this,$self=this;
  65776. $self.port=aNumber;
  65777. return self;
  65778. },
  65779. args: ["aNumber"],
  65780. source: "port: aNumber\x0a\x09port := aNumber",
  65781. referencedClasses: [],
  65782. pragmas: [],
  65783. messageSends: []
  65784. }),
  65785. $globals.FileServer);
  65786. $core.addMethod(
  65787. $core.method({
  65788. selector: "require:",
  65789. protocol: "private",
  65790. fn: function (aModuleString){
  65791. var self=this,$self=this;
  65792. return $core.withContext(function($ctx1) {
  65793. return $recv(require)._value_(aModuleString);
  65794. }, function($ctx1) {$ctx1.fill(self,"require:",{aModuleString:aModuleString})});
  65795. },
  65796. args: ["aModuleString"],
  65797. source: "require: aModuleString\x0a\x09\x22call to the require function\x22\x0a\x09^require value: aModuleString",
  65798. referencedClasses: [],
  65799. pragmas: [],
  65800. messageSends: ["value:"]
  65801. }),
  65802. $globals.FileServer);
  65803. $core.addMethod(
  65804. $core.method({
  65805. selector: "respondAuthenticationRequiredTo:",
  65806. protocol: "request handling",
  65807. fn: function (aResponse){
  65808. var self=this,$self=this;
  65809. return $core.withContext(function($ctx1) {
  65810. $recv(aResponse)._writeHead_options_((401),$globals.HashedCollection._newFromPairs_(["WWW-Authenticate","Basic realm=\x22Secured Developer Area\x22"]));
  65811. $recv(aResponse)._write_("<html><body>Authentication needed</body></html>");
  65812. $recv(aResponse)._end();
  65813. return self;
  65814. }, function($ctx1) {$ctx1.fill(self,"respondAuthenticationRequiredTo:",{aResponse:aResponse})});
  65815. },
  65816. args: ["aResponse"],
  65817. 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.",
  65818. referencedClasses: [],
  65819. pragmas: [],
  65820. messageSends: ["writeHead:options:", "write:", "end"]
  65821. }),
  65822. $globals.FileServer);
  65823. $core.addMethod(
  65824. $core.method({
  65825. selector: "respondCreatedTo:",
  65826. protocol: "request handling",
  65827. fn: function (aResponse){
  65828. var self=this,$self=this;
  65829. return $core.withContext(function($ctx1) {
  65830. $recv(aResponse)._writeHead_options_((201),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  65831. $recv(aResponse)._end();
  65832. return self;
  65833. }, function($ctx1) {$ctx1.fill(self,"respondCreatedTo:",{aResponse:aResponse})});
  65834. },
  65835. args: ["aResponse"],
  65836. source: "respondCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 201 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  65837. referencedClasses: [],
  65838. pragmas: [],
  65839. messageSends: ["writeHead:options:", "end"]
  65840. }),
  65841. $globals.FileServer);
  65842. $core.addMethod(
  65843. $core.method({
  65844. selector: "respondDirectoryNamed:from:to:",
  65845. protocol: "request handling",
  65846. fn: function (aDirname,aUrl,aResponse){
  65847. var self=this,$self=this;
  65848. return $core.withContext(function($ctx1) {
  65849. var $2,$1,$3,$5,$7,$6,$4,$receiver;
  65850. $2=$recv(aUrl)._pathname();
  65851. $ctx1.sendIdx["pathname"]=1;
  65852. $1=$recv($2)._endsWith_("/");
  65853. if($core.assert($1)){
  65854. $3=$recv(aDirname).__comma("index.html");
  65855. $ctx1.sendIdx[","]=1;
  65856. $self._respondFileNamed_to_($3,aResponse);
  65857. } else {
  65858. $5=$recv($recv(aUrl)._pathname()).__comma("/");
  65859. $7=$recv(aUrl)._search();
  65860. if(($receiver = $7) == null || $receiver.a$nil){
  65861. $6="";
  65862. } else {
  65863. $6=$7;
  65864. }
  65865. $4=$recv($5).__comma($6);
  65866. $ctx1.sendIdx[","]=2;
  65867. $self._respondRedirect_to_($4,aResponse);
  65868. }
  65869. return self;
  65870. }, function($ctx1) {$ctx1.fill(self,"respondDirectoryNamed:from:to:",{aDirname:aDirname,aUrl:aUrl,aResponse:aResponse})});
  65871. },
  65872. args: ["aDirname", "aUrl", "aResponse"],
  65873. 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]",
  65874. referencedClasses: [],
  65875. pragmas: [],
  65876. messageSends: ["ifTrue:ifFalse:", "endsWith:", "pathname", "respondFileNamed:to:", ",", "respondRedirect:to:", "ifNil:", "search"]
  65877. }),
  65878. $globals.FileServer);
  65879. $core.addMethod(
  65880. $core.method({
  65881. selector: "respondFileNamed:to:",
  65882. protocol: "request handling",
  65883. fn: function (aFilename,aResponse){
  65884. var self=this,$self=this;
  65885. var type,filename;
  65886. return $core.withContext(function($ctx1) {
  65887. var $1,$2,$3,$4;
  65888. filename=aFilename;
  65889. $recv($self.fs)._readFile_do_(filename,(function(ex,file){
  65890. return $core.withContext(function($ctx2) {
  65891. $1=$recv(ex)._notNil();
  65892. if($core.assert($1)){
  65893. $2=console;
  65894. $3=$recv(filename).__comma(" does not exist");
  65895. $ctx2.sendIdx[","]=1;
  65896. $recv($2)._log_($3);
  65897. return $self._respondNotFoundTo_(aResponse);
  65898. } else {
  65899. type=$recv($self._class())._mimeTypeFor_(filename);
  65900. $4=$recv(type).__eq("application/javascript");
  65901. if($core.assert($4)){
  65902. type=$recv(type).__comma(";charset=utf-8");
  65903. type;
  65904. }
  65905. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type",type]));
  65906. $recv(aResponse)._write_encoding_(file,"binary");
  65907. return $recv(aResponse)._end();
  65908. }
  65909. }, function($ctx2) {$ctx2.fillBlock({ex:ex,file:file},$ctx1,1)});
  65910. }));
  65911. return self;
  65912. }, function($ctx1) {$ctx1.fill(self,"respondFileNamed:to:",{aFilename:aFilename,aResponse:aResponse,type:type,filename:filename})});
  65913. },
  65914. args: ["aFilename", "aResponse"],
  65915. 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]]",
  65916. referencedClasses: [],
  65917. pragmas: [],
  65918. messageSends: ["readFile:do:", "ifTrue:ifFalse:", "notNil", "log:", ",", "respondNotFoundTo:", "mimeTypeFor:", "class", "ifTrue:", "=", "writeHead:options:", "write:encoding:", "end"]
  65919. }),
  65920. $globals.FileServer);
  65921. $core.addMethod(
  65922. $core.method({
  65923. selector: "respondInternalErrorTo:",
  65924. protocol: "request handling",
  65925. fn: function (aResponse){
  65926. var self=this,$self=this;
  65927. return $core.withContext(function($ctx1) {
  65928. $recv(aResponse)._writeHead_options_((500),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  65929. $recv(aResponse)._write_("500 Internal server error");
  65930. $recv(aResponse)._end();
  65931. return self;
  65932. }, function($ctx1) {$ctx1.fill(self,"respondInternalErrorTo:",{aResponse:aResponse})});
  65933. },
  65934. args: ["aResponse"],
  65935. source: "respondInternalErrorTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 500 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '500 Internal server error';\x0a\x09\x09end",
  65936. referencedClasses: [],
  65937. pragmas: [],
  65938. messageSends: ["writeHead:options:", "write:", "end"]
  65939. }),
  65940. $globals.FileServer);
  65941. $core.addMethod(
  65942. $core.method({
  65943. selector: "respondNotCreatedTo:",
  65944. protocol: "request handling",
  65945. fn: function (aResponse){
  65946. var self=this,$self=this;
  65947. return $core.withContext(function($ctx1) {
  65948. $recv(aResponse)._writeHead_options_((400),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  65949. $recv(aResponse)._write_("File could not be created. Did you forget to create the src directory on the server?");
  65950. $recv(aResponse)._end();
  65951. return self;
  65952. }, function($ctx1) {$ctx1.fill(self,"respondNotCreatedTo:",{aResponse:aResponse})});
  65953. },
  65954. args: ["aResponse"],
  65955. 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.",
  65956. referencedClasses: [],
  65957. pragmas: [],
  65958. messageSends: ["writeHead:options:", "write:", "end"]
  65959. }),
  65960. $globals.FileServer);
  65961. $core.addMethod(
  65962. $core.method({
  65963. selector: "respondNotFoundTo:",
  65964. protocol: "request handling",
  65965. fn: function (aResponse){
  65966. var self=this,$self=this;
  65967. return $core.withContext(function($ctx1) {
  65968. var $2,$1;
  65969. $2=$self._fallbackPage();
  65970. $ctx1.sendIdx["fallbackPage"]=1;
  65971. $1=$recv($2)._isNil();
  65972. if(!$core.assert($1)){
  65973. return $self._respondFileNamed_to_($self._fallbackPage(),aResponse);
  65974. }
  65975. $recv(aResponse)._writeHead_options_((404),$globals.HashedCollection._newFromPairs_(["Content-Type","text/html"]));
  65976. $recv(aResponse)._write_("<html><body><p>404 Not found</p>");
  65977. $ctx1.sendIdx["write:"]=1;
  65978. $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>");
  65979. $ctx1.sendIdx["write:"]=2;
  65980. $recv(aResponse)._write_("<li>create an index.html in the served directory.</li>");
  65981. $ctx1.sendIdx["write:"]=3;
  65982. $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>");
  65983. $ctx1.sendIdx["write:"]=4;
  65984. $recv(aResponse)._write_("<li>change the directory to be served with the \x22--base-path\x22 option.</li>");
  65985. $ctx1.sendIdx["write:"]=5;
  65986. $recv(aResponse)._write_("</ul></p></body></html>");
  65987. $recv(aResponse)._end();
  65988. return self;
  65989. }, function($ctx1) {$ctx1.fill(self,"respondNotFoundTo:",{aResponse:aResponse})});
  65990. },
  65991. args: ["aResponse"],
  65992. 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",
  65993. referencedClasses: [],
  65994. pragmas: [],
  65995. messageSends: ["ifFalse:", "isNil", "fallbackPage", "respondFileNamed:to:", "writeHead:options:", "write:", "end"]
  65996. }),
  65997. $globals.FileServer);
  65998. $core.addMethod(
  65999. $core.method({
  66000. selector: "respondOKTo:",
  66001. protocol: "request handling",
  66002. fn: function (aResponse){
  66003. var self=this,$self=this;
  66004. return $core.withContext(function($ctx1) {
  66005. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  66006. $recv(aResponse)._end();
  66007. return self;
  66008. }, function($ctx1) {$ctx1.fill(self,"respondOKTo:",{aResponse:aResponse})});
  66009. },
  66010. args: ["aResponse"],
  66011. source: "respondOKTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 200 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  66012. referencedClasses: [],
  66013. pragmas: [],
  66014. messageSends: ["writeHead:options:", "end"]
  66015. }),
  66016. $globals.FileServer);
  66017. $core.addMethod(
  66018. $core.method({
  66019. selector: "respondRedirect:to:",
  66020. protocol: "request handling",
  66021. fn: function (aString,aResponse){
  66022. var self=this,$self=this;
  66023. return $core.withContext(function($ctx1) {
  66024. $recv(aResponse)._writeHead_options_((303),$globals.HashedCollection._newFromPairs_(["Location",aString]));
  66025. $recv(aResponse)._end();
  66026. return self;
  66027. }, function($ctx1) {$ctx1.fill(self,"respondRedirect:to:",{aString:aString,aResponse:aResponse})});
  66028. },
  66029. args: ["aString", "aResponse"],
  66030. source: "respondRedirect: aString to: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 303 options: #{'Location' -> aString};\x0a\x09\x09end.",
  66031. referencedClasses: [],
  66032. pragmas: [],
  66033. messageSends: ["writeHead:options:", "end"]
  66034. }),
  66035. $globals.FileServer);
  66036. $core.addMethod(
  66037. $core.method({
  66038. selector: "start",
  66039. protocol: "starting",
  66040. fn: function (){
  66041. var self=this,$self=this;
  66042. return $core.withContext(function($ctx1) {
  66043. var $1,$2,$3,$4,$8,$7,$6,$10,$9,$5;
  66044. $self._checkDirectoryLayout();
  66045. $1=$recv($self.http)._createServer_((function(request,response){
  66046. return $core.withContext(function($ctx2) {
  66047. return $self._handleRequest_respondTo_(request,response);
  66048. }, function($ctx2) {$ctx2.fillBlock({request:request,response:response},$ctx1,1)});
  66049. }));
  66050. $recv($1)._on_do_("error",(function(error){
  66051. return $core.withContext(function($ctx2) {
  66052. $2=console;
  66053. $3="Error starting server: ".__comma(error);
  66054. $ctx2.sendIdx[","]=1;
  66055. return $recv($2)._log_($3);
  66056. $ctx2.sendIdx["log:"]=1;
  66057. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  66058. }));
  66059. $ctx1.sendIdx["on:do:"]=1;
  66060. $recv($1)._on_do_("listening",(function(){
  66061. return $core.withContext(function($ctx2) {
  66062. $4=console;
  66063. $8=$self._host();
  66064. $ctx2.sendIdx["host"]=1;
  66065. $7="Starting file server on http://".__comma($8);
  66066. $6=$recv($7).__comma(":");
  66067. $ctx2.sendIdx[","]=3;
  66068. $10=$self._port();
  66069. $ctx2.sendIdx["port"]=1;
  66070. $9=$recv($10)._asString();
  66071. $5=$recv($6).__comma($9);
  66072. $ctx2.sendIdx[","]=2;
  66073. return $recv($4)._log_($5);
  66074. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  66075. }));
  66076. $recv($1)._listen_host_($self._port(),$self._host());
  66077. return self;
  66078. }, function($ctx1) {$ctx1.fill(self,"start",{})});
  66079. },
  66080. args: [],
  66081. 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.",
  66082. referencedClasses: [],
  66083. pragmas: [],
  66084. messageSends: ["checkDirectoryLayout", "on:do:", "createServer:", "handleRequest:respondTo:", "log:", ",", "host", "asString", "port", "listen:host:"]
  66085. }),
  66086. $globals.FileServer);
  66087. $core.addMethod(
  66088. $core.method({
  66089. selector: "startOn:",
  66090. protocol: "starting",
  66091. fn: function (aPort){
  66092. var self=this,$self=this;
  66093. return $core.withContext(function($ctx1) {
  66094. $self._port_(aPort);
  66095. $self._start();
  66096. return self;
  66097. }, function($ctx1) {$ctx1.fill(self,"startOn:",{aPort:aPort})});
  66098. },
  66099. args: ["aPort"],
  66100. source: "startOn: aPort\x0a\x09self port: aPort.\x0a\x09self start",
  66101. referencedClasses: [],
  66102. pragmas: [],
  66103. messageSends: ["port:", "start"]
  66104. }),
  66105. $globals.FileServer);
  66106. $core.addMethod(
  66107. $core.method({
  66108. selector: "username:",
  66109. protocol: "accessing",
  66110. fn: function (aUsername){
  66111. var self=this,$self=this;
  66112. $self.username=aUsername;
  66113. return self;
  66114. },
  66115. args: ["aUsername"],
  66116. source: "username: aUsername\x0a\x09username := aUsername.",
  66117. referencedClasses: [],
  66118. pragmas: [],
  66119. messageSends: []
  66120. }),
  66121. $globals.FileServer);
  66122. $core.addMethod(
  66123. $core.method({
  66124. selector: "validateBasePath",
  66125. protocol: "private",
  66126. fn: function (){
  66127. var self=this,$self=this;
  66128. return $core.withContext(function($ctx1) {
  66129. var $1,$2,$3,$4,$7,$6,$5,$8,$9,$receiver;
  66130. $1=$self.fs;
  66131. $2=$self._basePath();
  66132. $ctx1.sendIdx["basePath"]=1;
  66133. $recv($1)._stat_then_($2,(function(err,stat){
  66134. return $core.withContext(function($ctx2) {
  66135. if(($receiver = err) == null || $receiver.a$nil){
  66136. $3=$recv(stat)._isDirectory();
  66137. if(!$core.assert($3)){
  66138. $4=console;
  66139. $7=$self._basePath();
  66140. $ctx2.sendIdx["basePath"]=2;
  66141. $6="Warning: --base-path parameter ".__comma($7);
  66142. $ctx2.sendIdx[","]=2;
  66143. $5=$recv($6).__comma(" is not a directory.");
  66144. $ctx2.sendIdx[","]=1;
  66145. return $recv($4)._warn_($5);
  66146. $ctx2.sendIdx["warn:"]=1;
  66147. }
  66148. } else {
  66149. $8=console;
  66150. $9=$recv("Warning: path at --base-path parameter ".__comma($self._basePath())).__comma(" does not exist.");
  66151. $ctx2.sendIdx[","]=3;
  66152. return $recv($8)._warn_($9);
  66153. }
  66154. }, function($ctx2) {$ctx2.fillBlock({err:err,stat:stat},$ctx1,1)});
  66155. }));
  66156. return self;
  66157. }, function($ctx1) {$ctx1.fill(self,"validateBasePath",{})});
  66158. },
  66159. args: [],
  66160. 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.' ]].",
  66161. referencedClasses: [],
  66162. pragmas: [],
  66163. messageSends: ["stat:then:", "basePath", "ifNil:ifNotNil:", "ifFalse:", "isDirectory", "warn:", ","]
  66164. }),
  66165. $globals.FileServer);
  66166. $core.addMethod(
  66167. $core.method({
  66168. selector: "withBasePath:",
  66169. protocol: "private",
  66170. fn: function (aBaseRelativePath){
  66171. var self=this,$self=this;
  66172. return $core.withContext(function($ctx1) {
  66173. return $recv($self.path)._join_with_($self._basePath(),aBaseRelativePath);
  66174. }, function($ctx1) {$ctx1.fill(self,"withBasePath:",{aBaseRelativePath:aBaseRelativePath})});
  66175. },
  66176. args: ["aBaseRelativePath"],
  66177. source: "withBasePath: aBaseRelativePath\x0a\x09\x22return a file path which is relative to the basePath.\x22\x0a\x09^ path join: self basePath with: aBaseRelativePath",
  66178. referencedClasses: [],
  66179. pragmas: [],
  66180. messageSends: ["join:with:", "basePath"]
  66181. }),
  66182. $globals.FileServer);
  66183. $core.addMethod(
  66184. $core.method({
  66185. selector: "writeData:toFileNamed:",
  66186. protocol: "private",
  66187. fn: function (data,aFilename){
  66188. var self=this,$self=this;
  66189. return $core.withContext(function($ctx1) {
  66190. $recv(console)._log_(aFilename);
  66191. return self;
  66192. }, function($ctx1) {$ctx1.fill(self,"writeData:toFileNamed:",{data:data,aFilename:aFilename})});
  66193. },
  66194. args: ["data", "aFilename"],
  66195. source: "writeData: data toFileNamed: aFilename\x0a\x09console log: aFilename",
  66196. referencedClasses: [],
  66197. pragmas: [],
  66198. messageSends: ["log:"]
  66199. }),
  66200. $globals.FileServer);
  66201. $core.setSlots($globals.FileServer.a$cls, ["mimeTypes"]);
  66202. $core.addMethod(
  66203. $core.method({
  66204. selector: "commandLineSwitches",
  66205. protocol: "accessing",
  66206. fn: function (){
  66207. var self=this,$self=this;
  66208. var switches;
  66209. return $core.withContext(function($ctx1) {
  66210. switches=$recv($self._methodsInProtocol_("accessing"))._collect_((function(each){
  66211. return $core.withContext(function($ctx2) {
  66212. return $recv(each)._selector();
  66213. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  66214. }));
  66215. $ctx1.sendIdx["collect:"]=1;
  66216. switches=$recv(switches)._select_((function(each){
  66217. return $core.withContext(function($ctx2) {
  66218. return $recv(each)._match_("^[^:]*:$");
  66219. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  66220. }));
  66221. switches=$recv(switches)._collect_((function(each){
  66222. return $core.withContext(function($ctx2) {
  66223. return $recv($recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase())._replace_with_("^([a-z])","--$1");
  66224. $ctx2.sendIdx["replace:with:"]=1;
  66225. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  66226. }));
  66227. return switches;
  66228. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches})});
  66229. },
  66230. args: [],
  66231. 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",
  66232. referencedClasses: [],
  66233. pragmas: [],
  66234. messageSends: ["collect:", "methodsInProtocol:", "selector", "select:", "match:", "replace:with:", "asLowercase", "allButLast"]
  66235. }),
  66236. $globals.FileServer.a$cls);
  66237. $core.addMethod(
  66238. $core.method({
  66239. selector: "createServerWithArguments:",
  66240. protocol: "initialization",
  66241. fn: function (options){
  66242. var self=this,$self=this;
  66243. var server,popFront,front,optionName,optionValue,switches;
  66244. return $core.withContext(function($ctx1) {
  66245. var $1,$2,$3,$4,$5,$6,$7,$8;
  66246. var $early={};
  66247. try {
  66248. switches=$self._commandLineSwitches();
  66249. server=$self._new();
  66250. $recv(options)._ifEmpty_((function(){
  66251. throw $early=[server];
  66252. }));
  66253. $1=$recv($recv(options)._size())._even();
  66254. if(!$core.assert($1)){
  66255. $recv(console)._log_("Using default parameters.");
  66256. $ctx1.sendIdx["log:"]=1;
  66257. $2=console;
  66258. $3="Wrong commandline options or not enough arguments for: ".__comma(options);
  66259. $ctx1.sendIdx[","]=1;
  66260. $recv($2)._log_($3);
  66261. $ctx1.sendIdx["log:"]=2;
  66262. $4=console;
  66263. $5="Use any of the following ones: ".__comma(switches);
  66264. $ctx1.sendIdx[","]=2;
  66265. $recv($4)._log_($5);
  66266. $ctx1.sendIdx["log:"]=3;
  66267. return server;
  66268. }
  66269. popFront=(function(args){
  66270. return $core.withContext(function($ctx2) {
  66271. front=$recv(args)._first();
  66272. $recv(args)._remove_(front);
  66273. return front;
  66274. }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1,3)});
  66275. });
  66276. $recv((function(){
  66277. return $core.withContext(function($ctx2) {
  66278. return $recv(options)._notEmpty();
  66279. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  66280. }))._whileTrue_((function(){
  66281. return $core.withContext(function($ctx2) {
  66282. optionName=$recv(popFront)._value_(options);
  66283. $ctx2.sendIdx["value:"]=1;
  66284. optionValue=$recv(popFront)._value_(options);
  66285. $6=$recv(switches)._includes_(optionName);
  66286. if($core.assert($6)){
  66287. optionName=$self._selectorForCommandLineSwitch_(optionName);
  66288. return $recv(server)._perform_withArguments_(optionName,$recv($globals.Array)._with_(optionValue));
  66289. } else {
  66290. $7=console;
  66291. $8=$recv(optionName).__comma(" is not a valid commandline option");
  66292. $ctx2.sendIdx[","]=3;
  66293. $recv($7)._log_($8);
  66294. $ctx2.sendIdx["log:"]=4;
  66295. return $recv(console)._log_("Use any of the following ones: ".__comma(switches));
  66296. }
  66297. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  66298. }));
  66299. return server;
  66300. }
  66301. catch(e) {if(e===$early)return e[0]; throw e}
  66302. }, function($ctx1) {$ctx1.fill(self,"createServerWithArguments:",{options:options,server:server,popFront:popFront,front:front,optionName:optionName,optionValue:optionValue,switches:switches})});
  66303. },
  66304. args: ["options"],
  66305. source: "createServerWithArguments: options\x0a\x09\x22If options are empty return a default FileServer instance.\x0a\x09 If options are given loop through them and set the passed in values\x0a\x09 on the FileServer instance.\x0a\x09 \x0a\x09 Commanline options map directly to methods in the 'accessing' protocol\x0a\x09 taking one parameter.\x0a\x09 Adding a method to this protocol makes it directly settable through\x0a\x09 command line options.\x0a\x09 \x22\x0a\x09| server popFront front optionName optionValue switches |\x0a\x0a\x09switches := self commandLineSwitches.\x0a\x0a\x09server := self new.\x0a\x0a\x09options ifEmpty: [^server].\x0a\x0a\x09(options size even) ifFalse: [\x0a\x09\x09console log: 'Using default parameters.'.\x0a\x09\x09console log: 'Wrong commandline options or not enough arguments for: ' , options.\x0a\x09\x09console log: 'Use any of the following ones: ', switches.\x0a\x09\x09^server].\x0a\x0a\x09popFront := [:args |\x0a\x09\x09front := args first.\x0a\x09\x09args remove: front.\x0a\x09\x09front].\x0a\x0a\x09[options notEmpty] whileTrue: [\x0a\x09\x09optionName := popFront value: options.\x0a\x09\x09optionValue := popFront value: options.\x0a\x0a\x09\x09(switches includes: optionName) ifTrue: [\x0a\x09\x09\x09optionName := self selectorForCommandLineSwitch: optionName.\x0a\x09\x09\x09server perform: optionName withArguments: (Array with: optionValue)]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09console log: optionName, ' is not a valid commandline option'.\x0a\x09\x09\x09\x09console log: 'Use any of the following ones: ', switches ]].\x0a\x09^ server.",
  66306. referencedClasses: ["Array"],
  66307. pragmas: [],
  66308. messageSends: ["commandLineSwitches", "new", "ifEmpty:", "ifFalse:", "even", "size", "log:", ",", "first", "remove:", "whileTrue:", "notEmpty", "value:", "ifTrue:ifFalse:", "includes:", "selectorForCommandLineSwitch:", "perform:withArguments:", "with:"]
  66309. }),
  66310. $globals.FileServer.a$cls);
  66311. $core.addMethod(
  66312. $core.method({
  66313. selector: "defaultBasePath",
  66314. protocol: "accessing",
  66315. fn: function (){
  66316. var self=this,$self=this;
  66317. return "./";
  66318. },
  66319. args: [],
  66320. source: "defaultBasePath\x0a\x09^ './'",
  66321. referencedClasses: [],
  66322. pragmas: [],
  66323. messageSends: []
  66324. }),
  66325. $globals.FileServer.a$cls);
  66326. $core.addMethod(
  66327. $core.method({
  66328. selector: "defaultHost",
  66329. protocol: "accessing",
  66330. fn: function (){
  66331. var self=this,$self=this;
  66332. return "127.0.0.1";
  66333. },
  66334. args: [],
  66335. source: "defaultHost\x0a\x09^ '127.0.0.1'",
  66336. referencedClasses: [],
  66337. pragmas: [],
  66338. messageSends: []
  66339. }),
  66340. $globals.FileServer.a$cls);
  66341. $core.addMethod(
  66342. $core.method({
  66343. selector: "defaultMimeTypes",
  66344. protocol: "accessing",
  66345. fn: function (){
  66346. var self=this,$self=this;
  66347. 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"]);
  66348. },
  66349. args: [],
  66350. 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}",
  66351. referencedClasses: [],
  66352. pragmas: [],
  66353. messageSends: []
  66354. }),
  66355. $globals.FileServer.a$cls);
  66356. $core.addMethod(
  66357. $core.method({
  66358. selector: "defaultPort",
  66359. protocol: "accessing",
  66360. fn: function (){
  66361. var self=this,$self=this;
  66362. return (4000);
  66363. },
  66364. args: [],
  66365. source: "defaultPort\x0a\x09^ 4000",
  66366. referencedClasses: [],
  66367. pragmas: [],
  66368. messageSends: []
  66369. }),
  66370. $globals.FileServer.a$cls);
  66371. $core.addMethod(
  66372. $core.method({
  66373. selector: "main",
  66374. protocol: "initialization",
  66375. fn: function (){
  66376. var self=this,$self=this;
  66377. var fileServer,args;
  66378. return $core.withContext(function($ctx1) {
  66379. var $1;
  66380. var $early={};
  66381. try {
  66382. args=$recv(process)._argv();
  66383. $recv(args)._removeFrom_to_((1),(3));
  66384. $recv(args)._detect_ifNone_((function(each){
  66385. return $core.withContext(function($ctx2) {
  66386. $1=$recv(each).__eq("--help");
  66387. if($core.assert($1)){
  66388. return $recv($globals.FileServer)._printHelp();
  66389. }
  66390. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  66391. }),(function(){
  66392. return $core.withContext(function($ctx2) {
  66393. fileServer=$recv($globals.FileServer)._createServerWithArguments_(args);
  66394. throw $early=[$recv(fileServer)._start()];
  66395. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  66396. }));
  66397. return self;
  66398. }
  66399. catch(e) {if(e===$early)return e[0]; throw e}
  66400. }, function($ctx1) {$ctx1.fill(self,"main",{fileServer:fileServer,args:args})});
  66401. },
  66402. args: [],
  66403. 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]",
  66404. referencedClasses: ["FileServer"],
  66405. pragmas: [],
  66406. messageSends: ["argv", "removeFrom:to:", "detect:ifNone:", "ifTrue:", "=", "printHelp", "createServerWithArguments:", "start"]
  66407. }),
  66408. $globals.FileServer.a$cls);
  66409. $core.addMethod(
  66410. $core.method({
  66411. selector: "mimeTypeFor:",
  66412. protocol: "accessing",
  66413. fn: function (aString){
  66414. var self=this,$self=this;
  66415. return $core.withContext(function($ctx1) {
  66416. return $recv($self._mimeTypes())._at_ifAbsent_($recv(aString)._replace_with_(".*[\x5c.]",""),(function(){
  66417. return "text/plain";
  66418. }));
  66419. }, function($ctx1) {$ctx1.fill(self,"mimeTypeFor:",{aString:aString})});
  66420. },
  66421. args: ["aString"],
  66422. source: "mimeTypeFor: aString\x0a\x09^ self mimeTypes at: (aString replace: '.*[\x5c.]' with: '') ifAbsent: ['text/plain']",
  66423. referencedClasses: [],
  66424. pragmas: [],
  66425. messageSends: ["at:ifAbsent:", "mimeTypes", "replace:with:"]
  66426. }),
  66427. $globals.FileServer.a$cls);
  66428. $core.addMethod(
  66429. $core.method({
  66430. selector: "mimeTypes",
  66431. protocol: "accessing",
  66432. fn: function (){
  66433. var self=this,$self=this;
  66434. return $core.withContext(function($ctx1) {
  66435. var $1,$receiver;
  66436. $1=$self.mimeTypes;
  66437. if(($receiver = $1) == null || $receiver.a$nil){
  66438. $self.mimeTypes=$self._defaultMimeTypes();
  66439. return $self.mimeTypes;
  66440. } else {
  66441. return $1;
  66442. }
  66443. }, function($ctx1) {$ctx1.fill(self,"mimeTypes",{})});
  66444. },
  66445. args: [],
  66446. source: "mimeTypes\x0a\x09^ mimeTypes ifNil: [mimeTypes := self defaultMimeTypes]",
  66447. referencedClasses: [],
  66448. pragmas: [],
  66449. messageSends: ["ifNil:", "defaultMimeTypes"]
  66450. }),
  66451. $globals.FileServer.a$cls);
  66452. $core.addMethod(
  66453. $core.method({
  66454. selector: "printHelp",
  66455. protocol: "accessing",
  66456. fn: function (){
  66457. var self=this,$self=this;
  66458. return $core.withContext(function($ctx1) {
  66459. $recv(console)._log_("Available commandline options are:");
  66460. $ctx1.sendIdx["log:"]=1;
  66461. $recv(console)._log_("--help");
  66462. $ctx1.sendIdx["log:"]=2;
  66463. $recv($self._commandLineSwitches())._do_((function(each){
  66464. return $core.withContext(function($ctx2) {
  66465. return $recv(console)._log_($recv(each).__comma(" <parameter>"));
  66466. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  66467. }));
  66468. return self;
  66469. }, function($ctx1) {$ctx1.fill(self,"printHelp",{})});
  66470. },
  66471. args: [],
  66472. source: "printHelp\x0a\x09console log: 'Available commandline options are:'.\x0a\x09console log: '--help'.\x0a\x09self commandLineSwitches do: [ :each |\x0a\x09\x09console log: each, ' <parameter>']",
  66473. referencedClasses: [],
  66474. pragmas: [],
  66475. messageSends: ["log:", "do:", "commandLineSwitches", ","]
  66476. }),
  66477. $globals.FileServer.a$cls);
  66478. $core.addMethod(
  66479. $core.method({
  66480. selector: "selectorForCommandLineSwitch:",
  66481. protocol: "accessing",
  66482. fn: function (aSwitch){
  66483. var self=this,$self=this;
  66484. return $core.withContext(function($ctx1) {
  66485. var $1;
  66486. $1=$recv($recv(aSwitch)._replace_with_("^--",""))._replace_with_("-[a-z]",(function(each){
  66487. return $core.withContext(function($ctx2) {
  66488. return $recv($recv(each)._second())._asUppercase();
  66489. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  66490. }));
  66491. $ctx1.sendIdx["replace:with:"]=1;
  66492. return $recv($1).__comma(":");
  66493. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch})});
  66494. },
  66495. args: ["aSwitch"],
  66496. 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 ]), ':'",
  66497. referencedClasses: [],
  66498. pragmas: [],
  66499. messageSends: [",", "replace:with:", "asUppercase", "second"]
  66500. }),
  66501. $globals.FileServer.a$cls);
  66502. $core.addClass("Initer", $globals.BaseFileManipulator, ["childProcess", "nmPath"], "AmberCli");
  66503. $core.addMethod(
  66504. $core.method({
  66505. selector: "finishMessage",
  66506. protocol: "action",
  66507. fn: function (){
  66508. var self=this,$self=this;
  66509. return $core.withContext(function($ctx1) {
  66510. $recv(console)._log_([" ", "The project should now be set up.", " ", " "]._join_($recv($globals.String)._lf()));
  66511. $recv((function(){
  66512. }))._valueWithTimeout_((600));
  66513. return self;
  66514. }, function($ctx1) {$ctx1.fill(self,"finishMessage",{})});
  66515. },
  66516. args: [],
  66517. 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",
  66518. referencedClasses: ["String"],
  66519. pragmas: [],
  66520. messageSends: ["log:", "join:", "lf", "valueWithTimeout:"]
  66521. }),
  66522. $globals.Initer);
  66523. $core.addMethod(
  66524. $core.method({
  66525. selector: "gruntInitThenDo:",
  66526. protocol: "action",
  66527. fn: function (aBlock){
  66528. var self=this,$self=this;
  66529. var child,sanitizedTemplatePath;
  66530. return $core.withContext(function($ctx1) {
  66531. var $1,$3,$2;
  66532. sanitizedTemplatePath=$recv($recv($recv($self.path)._join_with_($self.nmPath,"@ambers/grunt-init-amber-project"))._replace_with_("\x5c\x5c","\x5c\x5c"))._replace_with_(":","\x5c:");
  66533. $ctx1.sendIdx["replace:with:"]=1;
  66534. child=$recv($self.childProcess)._fork_args_($self._npmScriptForModule_named_("grunt-init","grunt-init"),[sanitizedTemplatePath]);
  66535. $1=child;
  66536. $recv($1)._on_do_("error",aBlock);
  66537. $ctx1.sendIdx["on:do:"]=1;
  66538. $recv($1)._on_do_("close",(function(code){
  66539. return $core.withContext(function($ctx2) {
  66540. $3=$recv(code).__eq((0));
  66541. if($core.assert($3)){
  66542. $2=nil;
  66543. } else {
  66544. $2=code;
  66545. }
  66546. return $recv(aBlock)._value_($2);
  66547. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  66548. }));
  66549. return self;
  66550. }, function($ctx1) {$ctx1.fill(self,"gruntInitThenDo:",{aBlock:aBlock,child:child,sanitizedTemplatePath:sanitizedTemplatePath})});
  66551. },
  66552. args: ["aBlock"],
  66553. 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 ]) ]",
  66554. referencedClasses: [],
  66555. pragmas: [],
  66556. messageSends: ["replace:with:", "join:with:", "fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  66557. }),
  66558. $globals.Initer);
  66559. $core.addMethod(
  66560. $core.method({
  66561. selector: "initProjectThenDo:",
  66562. protocol: "action",
  66563. fn: function (aBlock){
  66564. var self=this,$self=this;
  66565. var child;
  66566. return $core.withContext(function($ctx1) {
  66567. var $1;
  66568. child=$recv($self.childProcess)._exec_thenDo_("npm run init",aBlock);
  66569. $1=$recv(child)._stdout();
  66570. $ctx1.sendIdx["stdout"]=1;
  66571. $recv($1)._pipe_options_($recv(process)._stdout(),$globals.HashedCollection._newFromPairs_(["end",false]));
  66572. return self;
  66573. }, function($ctx1) {$ctx1.fill(self,"initProjectThenDo:",{aBlock:aBlock,child:child})});
  66574. },
  66575. args: ["aBlock"],
  66576. 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 }",
  66577. referencedClasses: [],
  66578. pragmas: [],
  66579. messageSends: ["exec:thenDo:", "pipe:options:", "stdout"]
  66580. }),
  66581. $globals.Initer);
  66582. $core.addMethod(
  66583. $core.method({
  66584. selector: "initialize",
  66585. protocol: "initialization",
  66586. fn: function (){
  66587. var self=this,$self=this;
  66588. return $core.withContext(function($ctx1) {
  66589. (
  66590. $ctx1.supercall = true,
  66591. ($globals.Initer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  66592. $ctx1.supercall = false;
  66593. $self.childProcess=$recv(require)._value_("child_process");
  66594. $self.nmPath=$recv($self.path)._join_with_($self._rootDirname(),"node_modules");
  66595. return self;
  66596. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  66597. },
  66598. args: [],
  66599. source: "initialize\x0a\x09super initialize.\x0a\x09childProcess := require value: 'child_process'.\x0a\x09nmPath := path join: self rootDirname with: 'node_modules'",
  66600. referencedClasses: [],
  66601. pragmas: [],
  66602. messageSends: ["initialize", "value:", "join:with:", "rootDirname"]
  66603. }),
  66604. $globals.Initer);
  66605. $core.addMethod(
  66606. $core.method({
  66607. selector: "npmScriptForModule:named:",
  66608. protocol: "npm",
  66609. fn: function (aString,anotherString){
  66610. var self=this,$self=this;
  66611. var modulePath,packageJson,binSection,scriptPath;
  66612. return $core.withContext(function($ctx1) {
  66613. var $1,$3,$4,$2,$5;
  66614. $1=$self.path;
  66615. $3=$recv(require)._provided();
  66616. $4=$recv(aString).__comma("/package.json");
  66617. $ctx1.sendIdx[","]=1;
  66618. $2=$recv($3)._resolve_($4);
  66619. modulePath=$recv($1)._dirname_($2);
  66620. packageJson=$recv($globals.Smalltalk)._readJSObject_($recv(require)._value_($recv(aString).__comma("/package.json")));
  66621. binSection=$recv(packageJson)._at_("bin");
  66622. $ctx1.sendIdx["at:"]=1;
  66623. $5=$recv(binSection)._isString();
  66624. if($core.assert($5)){
  66625. scriptPath=binSection;
  66626. } else {
  66627. scriptPath=$recv(binSection)._at_(anotherString);
  66628. }
  66629. return $recv($self.path)._join_with_(modulePath,scriptPath);
  66630. }, function($ctx1) {$ctx1.fill(self,"npmScriptForModule:named:",{aString:aString,anotherString:anotherString,modulePath:modulePath,packageJson:packageJson,binSection:binSection,scriptPath:scriptPath})});
  66631. },
  66632. args: ["aString", "anotherString"],
  66633. 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",
  66634. referencedClasses: ["Smalltalk"],
  66635. pragmas: [],
  66636. messageSends: ["dirname:", "resolve:", "provided", ",", "readJSObject:", "value:", "at:", "ifTrue:ifFalse:", "isString", "join:with:"]
  66637. }),
  66638. $globals.Initer);
  66639. $core.addMethod(
  66640. $core.method({
  66641. selector: "start",
  66642. protocol: "action",
  66643. fn: function (){
  66644. var self=this,$self=this;
  66645. return $core.withContext(function($ctx1) {
  66646. var $1,$2,$receiver;
  66647. $self._gruntInitThenDo_((function(error){
  66648. return $core.withContext(function($ctx2) {
  66649. if(($receiver = error) == null || $receiver.a$nil){
  66650. return $self._initProjectThenDo_((function(error2){
  66651. return $core.withContext(function($ctx3) {
  66652. if(($receiver = error2) == null || $receiver.a$nil){
  66653. $self._finishMessage();
  66654. return $recv(process)._exit();
  66655. } else {
  66656. $2=console;
  66657. $recv($2)._log_("npm run init exec error:");
  66658. $ctx3.sendIdx["log:"]=3;
  66659. $recv($2)._log_(error2);
  66660. return $recv(process)._exit_((105));
  66661. }
  66662. }, function($ctx3) {$ctx3.fillBlock({error2:error2},$ctx2,4)});
  66663. }));
  66664. } else {
  66665. $1=console;
  66666. $recv($1)._log_("grunt-init exec error:");
  66667. $ctx2.sendIdx["log:"]=1;
  66668. $recv($1)._log_(error);
  66669. $ctx2.sendIdx["log:"]=2;
  66670. return $recv(process)._exit_((101));
  66671. $ctx2.sendIdx["exit:"]=1;
  66672. }
  66673. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,1)});
  66674. }));
  66675. return self;
  66676. }, function($ctx1) {$ctx1.fill(self,"start",{})});
  66677. },
  66678. args: [],
  66679. 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 ]]]]",
  66680. referencedClasses: [],
  66681. pragmas: [],
  66682. messageSends: ["gruntInitThenDo:", "ifNotNil:ifNil:", "log:", "exit:", "initProjectThenDo:", "finishMessage", "exit"]
  66683. }),
  66684. $globals.Initer);
  66685. $core.addClass("Repl", $globals.Object, ["readline", "interface", "util", "session", "resultCount", "commands"], "AmberCli");
  66686. $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.";
  66687. $core.addMethod(
  66688. $core.method({
  66689. selector: "addVariableNamed:to:",
  66690. protocol: "private",
  66691. fn: function (aString,anObject){
  66692. var self=this,$self=this;
  66693. var newClass,newObject;
  66694. return $core.withContext(function($ctx1) {
  66695. newClass=$self._subclass_withVariable_($recv(anObject)._class(),aString);
  66696. $self._encapsulateVariable_withValue_in_(aString,anObject,newClass);
  66697. newObject=$recv(newClass)._new();
  66698. $self._setPreviousVariablesFor_from_(newObject,anObject);
  66699. return newObject;
  66700. }, function($ctx1) {$ctx1.fill(self,"addVariableNamed:to:",{aString:aString,anObject:anObject,newClass:newClass,newObject:newObject})});
  66701. },
  66702. args: ["aString", "anObject"],
  66703. 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",
  66704. referencedClasses: [],
  66705. pragmas: [],
  66706. messageSends: ["subclass:withVariable:", "class", "encapsulateVariable:withValue:in:", "new", "setPreviousVariablesFor:from:"]
  66707. }),
  66708. $globals.Repl);
  66709. $core.addMethod(
  66710. $core.method({
  66711. selector: "assignNewVariable:do:",
  66712. protocol: "private",
  66713. fn: function (buffer,aBlock){
  66714. var self=this,$self=this;
  66715. return $core.withContext(function($ctx1) {
  66716. var $2,$3,$1,$receiver;
  66717. return $self._parseAssignment_do_(buffer,(function(name,expr){
  66718. var varName,value;
  66719. return $core.withContext(function($ctx2) {
  66720. if(($receiver = name) == null || $receiver.a$nil){
  66721. varName=$self._nextResultName();
  66722. } else {
  66723. varName=name;
  66724. }
  66725. $self.session=$self._addVariableNamed_to_(varName,$self.session);
  66726. $recv((function(){
  66727. return $core.withContext(function($ctx3) {
  66728. $2=$recv(varName).__comma(" := ");
  66729. if(($receiver = expr) == null || $receiver.a$nil){
  66730. $3=buffer;
  66731. } else {
  66732. $3=expr;
  66733. }
  66734. $1=$recv($2).__comma($3);
  66735. $ctx3.sendIdx[","]=1;
  66736. value=$self._eval_on_($1,$self.session);
  66737. return value;
  66738. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  66739. }))._on_do_($globals.Error,(function(e){
  66740. return $core.withContext(function($ctx3) {
  66741. $recv($recv($globals.ConsoleErrorHandler)._new())._logError_(e);
  66742. value=nil;
  66743. return value;
  66744. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,5)});
  66745. }));
  66746. return $recv(aBlock)._value_value_(varName,value);
  66747. }, function($ctx2) {$ctx2.fillBlock({name:name,expr:expr,varName:varName,value:value},$ctx1,1)});
  66748. }));
  66749. }, function($ctx1) {$ctx1.fill(self,"assignNewVariable:do:",{buffer:buffer,aBlock:aBlock})});
  66750. },
  66751. args: ["buffer", "aBlock"],
  66752. 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]",
  66753. referencedClasses: ["Error", "ConsoleErrorHandler"],
  66754. pragmas: [],
  66755. messageSends: ["parseAssignment:do:", "ifNil:", "nextResultName", "addVariableNamed:to:", "on:do:", "eval:on:", ",", "logError:", "new", "value:value:"]
  66756. }),
  66757. $globals.Repl);
  66758. $core.addMethod(
  66759. $core.method({
  66760. selector: "clearScreen",
  66761. protocol: "actions",
  66762. fn: function (){
  66763. var self=this,$self=this;
  66764. var esc,cls;
  66765. return $core.withContext(function($ctx1) {
  66766. var $1;
  66767. esc=$recv($globals.String)._fromCharCode_((27));
  66768. $1=$recv($recv(esc).__comma("[2J")).__comma(esc);
  66769. $ctx1.sendIdx[","]=2;
  66770. cls=$recv($1).__comma("[0;0f");
  66771. $ctx1.sendIdx[","]=1;
  66772. $recv($recv(process)._stdout())._write_(cls);
  66773. $recv($self.interface)._prompt();
  66774. return self;
  66775. }, function($ctx1) {$ctx1.fill(self,"clearScreen",{esc:esc,cls:cls})});
  66776. },
  66777. args: [],
  66778. 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",
  66779. referencedClasses: ["String"],
  66780. pragmas: [],
  66781. messageSends: ["fromCharCode:", ",", "write:", "stdout", "prompt"]
  66782. }),
  66783. $globals.Repl);
  66784. $core.addMethod(
  66785. $core.method({
  66786. selector: "close",
  66787. protocol: "actions",
  66788. fn: function (){
  66789. var self=this,$self=this;
  66790. return $core.withContext(function($ctx1) {
  66791. $recv($recv(process)._stdin())._destroy();
  66792. return self;
  66793. }, function($ctx1) {$ctx1.fill(self,"close",{})});
  66794. },
  66795. args: [],
  66796. source: "close\x0a\x09process stdin destroy",
  66797. referencedClasses: [],
  66798. pragmas: [],
  66799. messageSends: ["destroy", "stdin"]
  66800. }),
  66801. $globals.Repl);
  66802. $core.addMethod(
  66803. $core.method({
  66804. selector: "commands",
  66805. protocol: "accessing",
  66806. fn: function (){
  66807. var self=this,$self=this;
  66808. return $self.commands;
  66809. },
  66810. args: [],
  66811. source: "commands\x0a\x09^ commands",
  66812. referencedClasses: [],
  66813. pragmas: [],
  66814. messageSends: []
  66815. }),
  66816. $globals.Repl);
  66817. $core.addMethod(
  66818. $core.method({
  66819. selector: "createInterface",
  66820. protocol: "actions",
  66821. fn: function (){
  66822. var self=this,$self=this;
  66823. return $core.withContext(function($ctx1) {
  66824. $self.interface=$recv($self.readline)._createInterface_stdout_($recv(process)._stdin(),$recv(process)._stdout());
  66825. $recv($self.interface)._on_do_("line",(function(buffer){
  66826. return $core.withContext(function($ctx2) {
  66827. return $self._processLine_(buffer);
  66828. }, function($ctx2) {$ctx2.fillBlock({buffer:buffer},$ctx1,1)});
  66829. }));
  66830. $ctx1.sendIdx["on:do:"]=1;
  66831. $recv($self.interface)._on_do_("close",(function(){
  66832. return $core.withContext(function($ctx2) {
  66833. return $self._close();
  66834. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  66835. }));
  66836. $self._printWelcome();
  66837. $self._setupHotkeys();
  66838. $self._setPrompt();
  66839. $recv($self.interface)._prompt();
  66840. return self;
  66841. }, function($ctx1) {$ctx1.fill(self,"createInterface",{})});
  66842. },
  66843. args: [],
  66844. 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",
  66845. referencedClasses: [],
  66846. pragmas: [],
  66847. messageSends: ["createInterface:stdout:", "stdin", "stdout", "on:do:", "processLine:", "close", "printWelcome", "setupHotkeys", "setPrompt", "prompt"]
  66848. }),
  66849. $globals.Repl);
  66850. $core.addMethod(
  66851. $core.method({
  66852. selector: "encapsulateVariable:withValue:in:",
  66853. protocol: "private",
  66854. fn: function (aString,anObject,aClass){
  66855. var self=this,$self=this;
  66856. var compiler;
  66857. return $core.withContext(function($ctx1) {
  66858. var $1,$4,$3,$2,$5,$6;
  66859. compiler=$recv($globals.Compiler)._new();
  66860. $1=compiler;
  66861. $4=$recv(aString).__comma(": anObject ^ ");
  66862. $ctx1.sendIdx[","]=3;
  66863. $3=$recv($4).__comma(aString);
  66864. $ctx1.sendIdx[","]=2;
  66865. $2=$recv($3).__comma(" := anObject");
  66866. $ctx1.sendIdx[","]=1;
  66867. $recv($1)._install_forClass_protocol_($2,aClass,"session");
  66868. $ctx1.sendIdx["install:forClass:protocol:"]=1;
  66869. $5=compiler;
  66870. $6=$recv($recv(aString).__comma(" ^ ")).__comma(aString);
  66871. $ctx1.sendIdx[","]=4;
  66872. $recv($5)._install_forClass_protocol_($6,aClass,"session");
  66873. return self;
  66874. }, function($ctx1) {$ctx1.fill(self,"encapsulateVariable:withValue:in:",{aString:aString,anObject:anObject,aClass:aClass,compiler:compiler})});
  66875. },
  66876. args: ["aString", "anObject", "aClass"],
  66877. 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'.",
  66878. referencedClasses: ["Compiler"],
  66879. pragmas: [],
  66880. messageSends: ["new", "install:forClass:protocol:", ","]
  66881. }),
  66882. $globals.Repl);
  66883. $core.addMethod(
  66884. $core.method({
  66885. selector: "eval:",
  66886. protocol: "actions",
  66887. fn: function (buffer){
  66888. var self=this,$self=this;
  66889. return $core.withContext(function($ctx1) {
  66890. return $self._eval_on_(buffer,$recv($globals.DoIt)._new());
  66891. }, function($ctx1) {$ctx1.fill(self,"eval:",{buffer:buffer})});
  66892. },
  66893. args: ["buffer"],
  66894. source: "eval: buffer\x0a\x09^ self eval: buffer on: DoIt new.",
  66895. referencedClasses: ["DoIt"],
  66896. pragmas: [],
  66897. messageSends: ["eval:on:", "new"]
  66898. }),
  66899. $globals.Repl);
  66900. $core.addMethod(
  66901. $core.method({
  66902. selector: "eval:on:",
  66903. protocol: "actions",
  66904. fn: function (buffer,anObject){
  66905. var self=this,$self=this;
  66906. var result;
  66907. return $core.withContext(function($ctx1) {
  66908. var $1;
  66909. $recv(buffer)._ifNotEmpty_((function(){
  66910. return $core.withContext(function($ctx2) {
  66911. return $recv((function(){
  66912. return $core.withContext(function($ctx3) {
  66913. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_on_(buffer,anObject);
  66914. return result;
  66915. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  66916. }))._tryCatch_((function(e){
  66917. return $core.withContext(function($ctx3) {
  66918. $1=$recv(e)._isSmalltalkError();
  66919. if($core.assert($1)){
  66920. return $recv(e)._pass();
  66921. } else {
  66922. return $recv($recv(process)._stdout())._write_($recv(e)._jsStack());
  66923. }
  66924. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,3)});
  66925. }));
  66926. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  66927. }));
  66928. return result;
  66929. }, function($ctx1) {$ctx1.fill(self,"eval:on:",{buffer:buffer,anObject:anObject,result:result})});
  66930. },
  66931. args: ["buffer", "anObject"],
  66932. source: "eval: buffer on: anObject\x0a\x09| result |\x0a\x09buffer ifNotEmpty: [\x0a\x09\x09[result := Compiler new evaluateExpression: buffer on: anObject]\x0a\x09\x09\x09tryCatch: [:e |\x0a\x09\x09\x09\x09e isSmalltalkError\x0a\x09\x09\x09\x09\x09ifTrue: [ e pass ]\x0a\x09\x09\x09\x09\x09ifFalse: [ process stdout write: e jsStack ]]].\x0a\x09^ result",
  66933. referencedClasses: ["Compiler"],
  66934. pragmas: [],
  66935. messageSends: ["ifNotEmpty:", "tryCatch:", "evaluateExpression:on:", "new", "ifTrue:ifFalse:", "isSmalltalkError", "pass", "write:", "stdout", "jsStack"]
  66936. }),
  66937. $globals.Repl);
  66938. $core.addMethod(
  66939. $core.method({
  66940. selector: "executeCommand:",
  66941. protocol: "private",
  66942. fn: function (aString){
  66943. var self=this,$self=this;
  66944. return $core.withContext(function($ctx1) {
  66945. var $1;
  66946. var $early={};
  66947. try {
  66948. $recv($self._commands())._keysAndValuesDo_((function(names,cmd){
  66949. return $core.withContext(function($ctx2) {
  66950. $1=$recv(names)._includes_(aString);
  66951. if($core.assert($1)){
  66952. $recv(cmd)._value();
  66953. throw $early=[true];
  66954. }
  66955. }, function($ctx2) {$ctx2.fillBlock({names:names,cmd:cmd},$ctx1,1)});
  66956. }));
  66957. return false;
  66958. }
  66959. catch(e) {if(e===$early)return e[0]; throw e}
  66960. }, function($ctx1) {$ctx1.fill(self,"executeCommand:",{aString:aString})});
  66961. },
  66962. args: ["aString"],
  66963. 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",
  66964. referencedClasses: [],
  66965. pragmas: [],
  66966. messageSends: ["keysAndValuesDo:", "commands", "ifTrue:", "includes:", "value"]
  66967. }),
  66968. $globals.Repl);
  66969. $core.addMethod(
  66970. $core.method({
  66971. selector: "initialize",
  66972. protocol: "initialization",
  66973. fn: function (){
  66974. var self=this,$self=this;
  66975. return $core.withContext(function($ctx1) {
  66976. (
  66977. $ctx1.supercall = true,
  66978. ($globals.Repl.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  66979. $ctx1.supercall = false;
  66980. $self.session=$recv($globals.DoIt)._new();
  66981. $self.readline=$recv(require)._value_("readline");
  66982. $ctx1.sendIdx["value:"]=1;
  66983. $self.util=$recv(require)._value_("util");
  66984. $self._setupCommands();
  66985. return self;
  66986. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  66987. },
  66988. args: [],
  66989. source: "initialize\x0a\x09super initialize.\x0a\x09session := DoIt new.\x0a\x09readline := require value: 'readline'.\x0a\x09util := require value: 'util'.\x0a\x09self setupCommands",
  66990. referencedClasses: ["DoIt"],
  66991. pragmas: [],
  66992. messageSends: ["initialize", "new", "value:", "setupCommands"]
  66993. }),
  66994. $globals.Repl);
  66995. $core.addMethod(
  66996. $core.method({
  66997. selector: "instanceVariableNamesFor:",
  66998. protocol: "private",
  66999. fn: function (aClass){
  67000. var self=this,$self=this;
  67001. return $core.withContext(function($ctx1) {
  67002. var $1,$2,$receiver;
  67003. $1=$recv(aClass)._superclass();
  67004. $ctx1.sendIdx["superclass"]=1;
  67005. if(($receiver = $1) == null || $receiver.a$nil){
  67006. return $recv(aClass)._instanceVariableNames();
  67007. } else {
  67008. $2=$recv(aClass)._instanceVariableNames();
  67009. $ctx1.sendIdx["instanceVariableNames"]=1;
  67010. return $recv($2)._copyWithAll_($self._instanceVariableNamesFor_($recv(aClass)._superclass()));
  67011. }
  67012. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aClass:aClass})});
  67013. },
  67014. args: ["aClass"],
  67015. 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]",
  67016. referencedClasses: [],
  67017. pragmas: [],
  67018. messageSends: ["ifNotNil:ifNil:", "superclass", "copyWithAll:", "instanceVariableNames", "instanceVariableNamesFor:"]
  67019. }),
  67020. $globals.Repl);
  67021. $core.addMethod(
  67022. $core.method({
  67023. selector: "isIdentifier:",
  67024. protocol: "private",
  67025. fn: function (aString){
  67026. var self=this,$self=this;
  67027. return $core.withContext(function($ctx1) {
  67028. return $recv(aString)._match_("^[a-z_]\x5cw*$"._asRegexp());
  67029. }, function($ctx1) {$ctx1.fill(self,"isIdentifier:",{aString:aString})});
  67030. },
  67031. args: ["aString"],
  67032. source: "isIdentifier: aString\x0a\x09^ aString match: '^[a-z_]\x5cw*$' asRegexp",
  67033. referencedClasses: [],
  67034. pragmas: [],
  67035. messageSends: ["match:", "asRegexp"]
  67036. }),
  67037. $globals.Repl);
  67038. $core.addMethod(
  67039. $core.method({
  67040. selector: "isVariableDefined:",
  67041. protocol: "private",
  67042. fn: function (aString){
  67043. var self=this,$self=this;
  67044. return $core.withContext(function($ctx1) {
  67045. return $recv($self._instanceVariableNamesFor_($recv($self.session)._class()))._includes_(aString);
  67046. }, function($ctx1) {$ctx1.fill(self,"isVariableDefined:",{aString:aString})});
  67047. },
  67048. args: ["aString"],
  67049. source: "isVariableDefined: aString\x0a\x09^ (self instanceVariableNamesFor: session class) includes: aString",
  67050. referencedClasses: [],
  67051. pragmas: [],
  67052. messageSends: ["includes:", "instanceVariableNamesFor:", "class"]
  67053. }),
  67054. $globals.Repl);
  67055. $core.addMethod(
  67056. $core.method({
  67057. selector: "nextResultName",
  67058. protocol: "private",
  67059. fn: function (){
  67060. var self=this,$self=this;
  67061. return $core.withContext(function($ctx1) {
  67062. var $1,$receiver;
  67063. $1=$self.resultCount;
  67064. if(($receiver = $1) == null || $receiver.a$nil){
  67065. $self.resultCount=(1);
  67066. } else {
  67067. $self.resultCount=$recv($self.resultCount).__plus((1));
  67068. }
  67069. return "res".__comma($recv($self.resultCount)._asString());
  67070. }, function($ctx1) {$ctx1.fill(self,"nextResultName",{})});
  67071. },
  67072. args: [],
  67073. source: "nextResultName\x0a\x09resultCount := resultCount\x0a \x09ifNotNil: [resultCount + 1]\x0a \x09ifNil: [1].\x0a ^ 'res', resultCount asString",
  67074. referencedClasses: [],
  67075. pragmas: [],
  67076. messageSends: ["ifNotNil:ifNil:", "+", ",", "asString"]
  67077. }),
  67078. $globals.Repl);
  67079. $core.addMethod(
  67080. $core.method({
  67081. selector: "onKeyPress:",
  67082. protocol: "private",
  67083. fn: function (key){
  67084. var self=this,$self=this;
  67085. return $core.withContext(function($ctx1) {
  67086. var $1;
  67087. $1=$recv($recv(key)._ctrl())._and_((function(){
  67088. return $core.withContext(function($ctx2) {
  67089. return $recv($recv(key)._name()).__eq("l");
  67090. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  67091. }));
  67092. if($core.assert($1)){
  67093. $self._clearScreen();
  67094. }
  67095. return self;
  67096. }, function($ctx1) {$ctx1.fill(self,"onKeyPress:",{key:key})});
  67097. },
  67098. args: ["key"],
  67099. source: "onKeyPress: key\x0a\x09(key ctrl and: [key name = 'l'])\x0a\x09\x09ifTrue: [self clearScreen]",
  67100. referencedClasses: [],
  67101. pragmas: [],
  67102. messageSends: ["ifTrue:", "and:", "ctrl", "=", "name", "clearScreen"]
  67103. }),
  67104. $globals.Repl);
  67105. $core.addMethod(
  67106. $core.method({
  67107. selector: "parseAssignment:do:",
  67108. protocol: "private",
  67109. fn: function (aString,aBlock){
  67110. var self=this,$self=this;
  67111. var assignment;
  67112. return $core.withContext(function($ctx1) {
  67113. var $2,$1;
  67114. assignment=$recv($recv(aString)._tokenize_(":="))._collect_((function(s){
  67115. return $core.withContext(function($ctx2) {
  67116. return $recv(s)._trimBoth();
  67117. }, function($ctx2) {$ctx2.fillBlock({s:s},$ctx1,1)});
  67118. }));
  67119. $1=$recv($recv($recv(assignment)._size()).__eq((2)))._and_((function(){
  67120. return $core.withContext(function($ctx2) {
  67121. $2=$recv(assignment)._first();
  67122. $ctx2.sendIdx["first"]=1;
  67123. return $self._isIdentifier_($2);
  67124. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  67125. }));
  67126. if($core.assert($1)){
  67127. return $recv(aBlock)._value_value_($recv(assignment)._first(),$recv(assignment)._last());
  67128. $ctx1.sendIdx["value:value:"]=1;
  67129. } else {
  67130. return $recv(aBlock)._value_value_(nil,nil);
  67131. }
  67132. }, function($ctx1) {$ctx1.fill(self,"parseAssignment:do:",{aString:aString,aBlock:aBlock,assignment:assignment})});
  67133. },
  67134. args: ["aString", "aBlock"],
  67135. 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 ]",
  67136. referencedClasses: [],
  67137. pragmas: [],
  67138. messageSends: ["collect:", "tokenize:", "trimBoth", "ifTrue:ifFalse:", "and:", "=", "size", "isIdentifier:", "first", "value:value:", "last"]
  67139. }),
  67140. $globals.Repl);
  67141. $core.addMethod(
  67142. $core.method({
  67143. selector: "presentResultNamed:withValue:",
  67144. protocol: "private",
  67145. fn: function (varName,value){
  67146. var self=this,$self=this;
  67147. return $core.withContext(function($ctx1) {
  67148. var $3,$2,$1;
  67149. $3=$recv($recv(varName).__comma(": ")).__comma($recv($recv(value)._class())._name());
  67150. $ctx1.sendIdx[","]=3;
  67151. $2=$recv($3).__comma(" = ");
  67152. $ctx1.sendIdx[","]=2;
  67153. $1=$recv($2).__comma($recv(value)._asString());
  67154. $ctx1.sendIdx[","]=1;
  67155. $recv($globals.Transcript)._show_($1);
  67156. $recv($globals.Transcript)._cr();
  67157. $recv($self.interface)._prompt();
  67158. return self;
  67159. }, function($ctx1) {$ctx1.fill(self,"presentResultNamed:withValue:",{varName:varName,value:value})});
  67160. },
  67161. args: ["varName", "value"],
  67162. source: "presentResultNamed: varName withValue: value\x0a\x09Transcript show: varName, ': ', value class name, ' = ', value asString; cr.\x0a\x09interface prompt",
  67163. referencedClasses: ["Transcript"],
  67164. pragmas: [],
  67165. messageSends: ["show:", ",", "name", "class", "asString", "cr", "prompt"]
  67166. }),
  67167. $globals.Repl);
  67168. $core.addMethod(
  67169. $core.method({
  67170. selector: "printWelcome",
  67171. protocol: "actions",
  67172. fn: function (){
  67173. var self=this,$self=this;
  67174. return $core.withContext(function($ctx1) {
  67175. $recv($globals.Transcript)._show_("Type :q to exit.");
  67176. $recv($globals.Transcript)._cr();
  67177. return self;
  67178. }, function($ctx1) {$ctx1.fill(self,"printWelcome",{})});
  67179. },
  67180. args: [],
  67181. source: "printWelcome\x0a\x09Transcript show: 'Type :q to exit.'; cr.",
  67182. referencedClasses: ["Transcript"],
  67183. pragmas: [],
  67184. messageSends: ["show:", "cr"]
  67185. }),
  67186. $globals.Repl);
  67187. $core.addMethod(
  67188. $core.method({
  67189. selector: "processLine:",
  67190. protocol: "private",
  67191. fn: function (buffer){
  67192. var self=this,$self=this;
  67193. var show;
  67194. return $core.withContext(function($ctx1) {
  67195. var $1,$2;
  67196. show=(function(varName,value){
  67197. return $core.withContext(function($ctx2) {
  67198. return $self._presentResultNamed_withValue_(varName,value);
  67199. }, function($ctx2) {$ctx2.fillBlock({varName:varName,value:value},$ctx1,1)});
  67200. });
  67201. $1=$self._executeCommand_(buffer);
  67202. if(!$core.assert($1)){
  67203. $2=$self._isVariableDefined_(buffer);
  67204. if($core.assert($2)){
  67205. $recv(show)._value_value_(buffer,$recv($self.session)._perform_(buffer));
  67206. } else {
  67207. $self._assignNewVariable_do_(buffer,show);
  67208. }
  67209. }
  67210. return self;
  67211. }, function($ctx1) {$ctx1.fill(self,"processLine:",{buffer:buffer,show:show})});
  67212. },
  67213. args: ["buffer"],
  67214. 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]]",
  67215. referencedClasses: [],
  67216. pragmas: [],
  67217. messageSends: ["presentResultNamed:withValue:", "ifFalse:", "executeCommand:", "ifTrue:ifFalse:", "isVariableDefined:", "value:value:", "perform:", "assignNewVariable:do:"]
  67218. }),
  67219. $globals.Repl);
  67220. $core.addMethod(
  67221. $core.method({
  67222. selector: "prompt",
  67223. protocol: "accessing",
  67224. fn: function (){
  67225. var self=this,$self=this;
  67226. return "amber >> ";
  67227. },
  67228. args: [],
  67229. source: "prompt\x0a\x09^ 'amber >> '",
  67230. referencedClasses: [],
  67231. pragmas: [],
  67232. messageSends: []
  67233. }),
  67234. $globals.Repl);
  67235. $core.addMethod(
  67236. $core.method({
  67237. selector: "setPreviousVariablesFor:from:",
  67238. protocol: "private",
  67239. fn: function (newObject,oldObject){
  67240. var self=this,$self=this;
  67241. return $core.withContext(function($ctx1) {
  67242. $recv($self._instanceVariableNamesFor_($recv(oldObject)._class()))._do_((function(each){
  67243. return $core.withContext(function($ctx2) {
  67244. return $recv(newObject)._perform_withArguments_($recv(each).__comma(":"),[$recv(oldObject)._perform_(each)]);
  67245. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  67246. }));
  67247. return self;
  67248. }, function($ctx1) {$ctx1.fill(self,"setPreviousVariablesFor:from:",{newObject:newObject,oldObject:oldObject})});
  67249. },
  67250. args: ["newObject", "oldObject"],
  67251. source: "setPreviousVariablesFor: newObject from: oldObject\x0a\x09(self instanceVariableNamesFor: oldObject class) do: [:each |\x0a\x09\x09newObject perform: each, ':' withArguments: {oldObject perform: each}].",
  67252. referencedClasses: [],
  67253. pragmas: [],
  67254. messageSends: ["do:", "instanceVariableNamesFor:", "class", "perform:withArguments:", ",", "perform:"]
  67255. }),
  67256. $globals.Repl);
  67257. $core.addMethod(
  67258. $core.method({
  67259. selector: "setPrompt",
  67260. protocol: "actions",
  67261. fn: function (){
  67262. var self=this,$self=this;
  67263. return $core.withContext(function($ctx1) {
  67264. $recv($self.interface)._setPrompt_($self._prompt());
  67265. return self;
  67266. }, function($ctx1) {$ctx1.fill(self,"setPrompt",{})});
  67267. },
  67268. args: [],
  67269. source: "setPrompt\x0a\x09interface setPrompt: self prompt",
  67270. referencedClasses: [],
  67271. pragmas: [],
  67272. messageSends: ["setPrompt:", "prompt"]
  67273. }),
  67274. $globals.Repl);
  67275. $core.addMethod(
  67276. $core.method({
  67277. selector: "setupCommands",
  67278. protocol: "initialization",
  67279. fn: function (){
  67280. var self=this,$self=this;
  67281. return $core.withContext(function($ctx1) {
  67282. var $2,$1;
  67283. $2=$recv([":q"]).__minus_gt((function(){
  67284. return $core.withContext(function($ctx2) {
  67285. return $recv(process)._exit();
  67286. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  67287. }));
  67288. $ctx1.sendIdx["->"]=1;
  67289. $1=[$2,$recv([""]).__minus_gt((function(){
  67290. return $core.withContext(function($ctx2) {
  67291. return $recv($self.interface)._prompt();
  67292. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  67293. }))];
  67294. $self.commands=$recv($globals.Dictionary)._from_($1);
  67295. return self;
  67296. }, function($ctx1) {$ctx1.fill(self,"setupCommands",{})});
  67297. },
  67298. args: [],
  67299. source: "setupCommands\x0a\x09commands := Dictionary from: {\x0a\x09\x09{':q'} -> [process exit].\x0a\x09\x09{''} -> [interface prompt]}",
  67300. referencedClasses: ["Dictionary"],
  67301. pragmas: [],
  67302. messageSends: ["from:", "->", "exit", "prompt"]
  67303. }),
  67304. $globals.Repl);
  67305. $core.addMethod(
  67306. $core.method({
  67307. selector: "setupHotkeys",
  67308. protocol: "initialization",
  67309. fn: function (){
  67310. var self=this,$self=this;
  67311. return $core.withContext(function($ctx1) {
  67312. var $receiver;
  67313. $recv($recv(process)._stdin())._on_do_("keypress",(function(s,key){
  67314. return $core.withContext(function($ctx2) {
  67315. if(($receiver = key) == null || $receiver.a$nil){
  67316. return key;
  67317. } else {
  67318. return $self._onKeyPress_(key);
  67319. }
  67320. }, function($ctx2) {$ctx2.fillBlock({s:s,key:key},$ctx1,1)});
  67321. }));
  67322. return self;
  67323. }, function($ctx1) {$ctx1.fill(self,"setupHotkeys",{})});
  67324. },
  67325. args: [],
  67326. source: "setupHotkeys\x0a\x09process stdin on: 'keypress' do: [:s :key | key ifNotNil: [self onKeyPress: key]].",
  67327. referencedClasses: [],
  67328. pragmas: [],
  67329. messageSends: ["on:do:", "stdin", "ifNotNil:", "onKeyPress:"]
  67330. }),
  67331. $globals.Repl);
  67332. $core.addMethod(
  67333. $core.method({
  67334. selector: "subclass:withVariable:",
  67335. protocol: "private",
  67336. fn: function (aClass,varName){
  67337. var self=this,$self=this;
  67338. return $core.withContext(function($ctx1) {
  67339. return $recv($recv($globals.ClassBuilder)._new())._addSubclassOf_named_instanceVariableNames_package_(aClass,$recv($self._subclassNameFor_(aClass))._asSymbol(),[varName],"Compiler-Core");
  67340. }, function($ctx1) {$ctx1.fill(self,"subclass:withVariable:",{aClass:aClass,varName:varName})});
  67341. },
  67342. args: ["aClass", "varName"],
  67343. 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'",
  67344. referencedClasses: ["ClassBuilder"],
  67345. pragmas: [],
  67346. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "new", "asSymbol", "subclassNameFor:"]
  67347. }),
  67348. $globals.Repl);
  67349. $core.addMethod(
  67350. $core.method({
  67351. selector: "subclassNameFor:",
  67352. protocol: "private",
  67353. fn: function (aClass){
  67354. var self=this,$self=this;
  67355. return $core.withContext(function($ctx1) {
  67356. var $2,$1,$6,$5,$4,$3,$7,$receiver;
  67357. $2=$recv(aClass)._name();
  67358. $ctx1.sendIdx["name"]=1;
  67359. $1=$recv($2)._matchesOf_("\x5cd+$");
  67360. $ctx1.sendIdx["matchesOf:"]=1;
  67361. if(($receiver = $1) == null || $receiver.a$nil){
  67362. return $recv($recv(aClass)._name()).__comma("2");
  67363. } else {
  67364. var counter;
  67365. $6=$recv(aClass)._name();
  67366. $ctx1.sendIdx["name"]=2;
  67367. $5=$recv($6)._matchesOf_("\x5cd+$");
  67368. $4=$recv($5)._first();
  67369. $3=$recv($4)._asNumber();
  67370. counter=$recv($3).__plus((1));
  67371. $7=$recv(aClass)._name();
  67372. $ctx1.sendIdx["name"]=3;
  67373. return $recv($7)._replaceRegexp_with_("\x5cd+$"._asRegexp(),$recv(counter)._asString());
  67374. }
  67375. }, function($ctx1) {$ctx1.fill(self,"subclassNameFor:",{aClass:aClass})});
  67376. },
  67377. args: ["aClass"],
  67378. 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'].",
  67379. referencedClasses: [],
  67380. pragmas: [],
  67381. messageSends: ["ifNotNil:ifNil:", "matchesOf:", "name", "+", "asNumber", "first", "replaceRegexp:with:", "asRegexp", "asString", ","]
  67382. }),
  67383. $globals.Repl);
  67384. $core.addMethod(
  67385. $core.method({
  67386. selector: "main",
  67387. protocol: "initialization",
  67388. fn: function (){
  67389. var self=this,$self=this;
  67390. return $core.withContext(function($ctx1) {
  67391. $recv($self._new())._createInterface();
  67392. return self;
  67393. }, function($ctx1) {$ctx1.fill(self,"main",{})});
  67394. },
  67395. args: [],
  67396. source: "main\x0a\x09self new createInterface",
  67397. referencedClasses: [],
  67398. pragmas: [],
  67399. messageSends: ["createInterface", "new"]
  67400. }),
  67401. $globals.Repl.a$cls);
  67402. });
  67403. (function () {
  67404. define('__app__',["amber/devel", "amber/core/Platform-Node", "amber_cli/AmberCli"], function (amber) {
  67405. amber.initialize().then(function () {
  67406. amber.globals.AmberCli._main();
  67407. });
  67408. });
  67409. }());
  67410. (function () {
  67411. define('app',["require", "amber/es6-promise"], function (require, promiseLib) {
  67412. promiseLib.polyfill();
  67413. return new Promise(function (resolve, reject) {
  67414. require(["__app__"], resolve, reject);
  67415. });
  67416. });
  67417. }());
  67418. require(["app"]);
  67419. });
  67420. define.require('__wrap__');
  67421. }((function amdefine(module, requireFn) {
  67422. 'use strict';
  67423. var defineCache = {},
  67424. loaderCache = {},
  67425. alreadyCalled = false,
  67426. path = require('path'),
  67427. makeRequire, stringRequire;
  67428. /**
  67429. * Trims the . and .. from an array of path segments.
  67430. * It will keep a leading path segment if a .. will become
  67431. * the first path segment, to help with module name lookups,
  67432. * which act like paths, but can be remapped. But the end result,
  67433. * all paths that use this function should look normalized.
  67434. * NOTE: this method MODIFIES the input array.
  67435. * @param {Array} ary the array of path segments.
  67436. */
  67437. function trimDots(ary) {
  67438. var i, part;
  67439. for (i = 0; ary[i]; i+= 1) {
  67440. part = ary[i];
  67441. if (part === '.') {
  67442. ary.splice(i, 1);
  67443. i -= 1;
  67444. } else if (part === '..') {
  67445. if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
  67446. //End of the line. Keep at least one non-dot
  67447. //path segment at the front so it can be mapped
  67448. //correctly to disk. Otherwise, there is likely
  67449. //no path mapping for a path starting with '..'.
  67450. //This can still fail, but catches the most reasonable
  67451. //uses of ..
  67452. break;
  67453. } else if (i > 0) {
  67454. ary.splice(i - 1, 2);
  67455. i -= 2;
  67456. }
  67457. }
  67458. }
  67459. }
  67460. function normalize(name, baseName) {
  67461. var baseParts;
  67462. //Adjust any relative paths.
  67463. if (name && name.charAt(0) === '.') {
  67464. //If have a base name, try to normalize against it,
  67465. //otherwise, assume it is a top-level require that will
  67466. //be relative to baseUrl in the end.
  67467. if (baseName) {
  67468. baseParts = baseName.split('/');
  67469. baseParts = baseParts.slice(0, baseParts.length - 1);
  67470. baseParts = baseParts.concat(name.split('/'));
  67471. trimDots(baseParts);
  67472. name = baseParts.join('/');
  67473. }
  67474. }
  67475. return name;
  67476. }
  67477. /**
  67478. * Create the normalize() function passed to a loader plugin's
  67479. * normalize method.
  67480. */
  67481. function makeNormalize(relName) {
  67482. return function (name) {
  67483. return normalize(name, relName);
  67484. };
  67485. }
  67486. function makeLoad(id) {
  67487. function load(value) {
  67488. loaderCache[id] = value;
  67489. }
  67490. load.fromText = function (id, text) {
  67491. //This one is difficult because the text can/probably uses
  67492. //define, and any relative paths and requires should be relative
  67493. //to that id was it would be found on disk. But this would require
  67494. //bootstrapping a module/require fairly deeply from node core.
  67495. //Not sure how best to go about that yet.
  67496. throw new Error('amdefine does not implement load.fromText');
  67497. };
  67498. return load;
  67499. }
  67500. makeRequire = function (systemRequire, exports, module, relId) {
  67501. function amdRequire(deps, callback) {
  67502. if (typeof deps === 'string') {
  67503. //Synchronous, single module require('')
  67504. return stringRequire(systemRequire, exports, module, deps, relId);
  67505. } else {
  67506. //Array of dependencies with a callback.
  67507. //Convert the dependencies to modules.
  67508. deps = deps.map(function (depName) {
  67509. return stringRequire(systemRequire, exports, module, depName, relId);
  67510. });
  67511. //Wait for next tick to call back the require call.
  67512. if (callback) {
  67513. process.nextTick(function () {
  67514. callback.apply(null, deps);
  67515. });
  67516. }
  67517. }
  67518. }
  67519. amdRequire.toUrl = function (filePath) {
  67520. if (filePath.indexOf('.') === 0) {
  67521. return normalize(filePath, path.dirname(module.filename));
  67522. } else {
  67523. return filePath;
  67524. }
  67525. };
  67526. return amdRequire;
  67527. };
  67528. //Favor explicit value, passed in if the module wants to support Node 0.4.
  67529. requireFn = requireFn || function req() {
  67530. return module.require.apply(module, arguments);
  67531. };
  67532. function runFactory(id, deps, factory) {
  67533. var r, e, m, result;
  67534. if (id) {
  67535. e = loaderCache[id] = {};
  67536. m = {
  67537. id: id,
  67538. uri: __filename,
  67539. exports: e
  67540. };
  67541. r = makeRequire(requireFn, e, m, id);
  67542. } else {
  67543. //Only support one define call per file
  67544. if (alreadyCalled) {
  67545. throw new Error('amdefine with no module ID cannot be called more than once per file.');
  67546. }
  67547. alreadyCalled = true;
  67548. //Use the real variables from node
  67549. //Use module.exports for exports, since
  67550. //the exports in here is amdefine exports.
  67551. e = module.exports;
  67552. m = module;
  67553. r = makeRequire(requireFn, e, m, module.id);
  67554. }
  67555. //If there are dependencies, they are strings, so need
  67556. //to convert them to dependency values.
  67557. if (deps) {
  67558. deps = deps.map(function (depName) {
  67559. return r(depName);
  67560. });
  67561. }
  67562. //Call the factory with the right dependencies.
  67563. if (typeof factory === 'function') {
  67564. result = factory.apply(m.exports, deps);
  67565. } else {
  67566. result = factory;
  67567. }
  67568. if (result !== undefined) {
  67569. m.exports = result;
  67570. if (id) {
  67571. loaderCache[id] = m.exports;
  67572. }
  67573. }
  67574. }
  67575. stringRequire = function (systemRequire, exports, module, id, relId) {
  67576. //Split the ID by a ! so that
  67577. var index = id.indexOf('!'),
  67578. originalId = id,
  67579. prefix, plugin;
  67580. if (index === -1) {
  67581. id = normalize(id, relId);
  67582. //Straight module lookup. If it is one of the special dependencies,
  67583. //deal with it, otherwise, delegate to node.
  67584. if (id === 'require') {
  67585. return makeRequire(systemRequire, exports, module, relId);
  67586. } else if (id === 'exports') {
  67587. return exports;
  67588. } else if (id === 'module') {
  67589. return module;
  67590. } else if (loaderCache.hasOwnProperty(id)) {
  67591. return loaderCache[id];
  67592. } else if (defineCache[id]) {
  67593. runFactory.apply(null, defineCache[id]);
  67594. return loaderCache[id];
  67595. } else {
  67596. if(systemRequire) {
  67597. return systemRequire(originalId);
  67598. } else {
  67599. throw new Error('No module with ID: ' + id);
  67600. }
  67601. }
  67602. } else {
  67603. //There is a plugin in play.
  67604. prefix = id.substring(0, index);
  67605. id = id.substring(index + 1, id.length);
  67606. plugin = stringRequire(systemRequire, exports, module, prefix, relId);
  67607. if (plugin.normalize) {
  67608. id = plugin.normalize(id, makeNormalize(relId));
  67609. } else {
  67610. //Normalize the ID normally.
  67611. id = normalize(id, relId);
  67612. }
  67613. if (loaderCache[id]) {
  67614. return loaderCache[id];
  67615. } else {
  67616. plugin.load(id, makeRequire(systemRequire, exports, module, relId), makeLoad(id), {});
  67617. return loaderCache[id];
  67618. }
  67619. }
  67620. };
  67621. //Create a define function specific to the module asking for amdefine.
  67622. function define(id, deps, factory) {
  67623. if (Array.isArray(id)) {
  67624. factory = deps;
  67625. deps = id;
  67626. id = undefined;
  67627. } else if (typeof id !== 'string') {
  67628. factory = id;
  67629. id = deps = undefined;
  67630. }
  67631. if (deps && !Array.isArray(deps)) {
  67632. factory = deps;
  67633. deps = undefined;
  67634. }
  67635. if (!deps) {
  67636. deps = ['require', 'exports', 'module'];
  67637. }
  67638. //Set up properties for this module. If an ID, then use
  67639. //internal cache. If no ID, then use the external variables
  67640. //for this node module.
  67641. if (id) {
  67642. //Put the module in deep freeze until there is a
  67643. //require call for it.
  67644. defineCache[id] = [id, deps, factory];
  67645. } else {
  67646. runFactory(id, deps, factory);
  67647. }
  67648. }
  67649. //define.require, which has access to all the values in the
  67650. //cache. Useful for AMD modules that all have IDs in the file,
  67651. //but need to finally export a value to node based on one of those
  67652. //IDs.
  67653. define.require = function (id) {
  67654. if (loaderCache[id]) {
  67655. return loaderCache[id];
  67656. }
  67657. if (defineCache[id]) {
  67658. runFactory.apply(null, defineCache[id]);
  67659. return loaderCache[id];
  67660. }
  67661. };
  67662. define.amd = {};
  67663. return define;
  67664. }(module)), require));