amber-cli.js 2.2 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483534845348553486534875348853489534905349153492534935349453495534965349753498534995350053501535025350353504535055350653507535085350953510535115351253513535145351553516535175351853519535205352153522535235352453525535265352753528535295353053531535325353353534535355353653537535385353953540535415354253543535445354553546535475354853549535505355153552535535355453555535565355753558535595356053561535625356353564535655356653567535685356953570535715357253573535745357553576535775357853579535805358153582535835358453585535865358753588535895359053591535925359353594535955359653597535985359953600536015360253603536045360553606536075360853609536105361153612536135361453615536165361753618536195362053621536225362353624536255362653627536285362953630536315363253633536345363553636536375363853639536405364153642536435364453645536465364753648536495365053651536525365353654536555365653657536585365953660536615366253663536645366553666536675366853669536705367153672536735367453675536765367753678536795368053681536825368353684536855368653687536885368953690536915369253693536945369553696536975369853699537005370153702537035370453705537065370753708537095371053711537125371353714537155371653717537185371953720537215372253723537245372553726537275372853729537305373153732537335373453735537365373753738537395374053741537425374353744537455374653747537485374953750537515375253753537545375553756537575375853759537605376153762537635376453765537665376753768537695377053771537725377353774537755377653777537785377953780537815378253783537845378553786537875378853789537905379153792537935379453795537965379753798537995380053801538025380353804538055380653807538085380953810538115381253813538145381553816538175381853819538205382153822538235382453825538265382753828538295383053831538325383353834538355383653837538385383953840538415384253843538445384553846538475384853849538505385153852538535385453855538565385753858538595386053861538625386353864538655386653867538685386953870538715387253873538745387553876538775387853879538805388153882538835388453885538865388753888538895389053891538925389353894538955389653897538985389953900539015390253903539045390553906539075390853909539105391153912539135391453915539165391753918539195392053921539225392353924539255392653927539285392953930539315393253933539345393553936539375393853939539405394153942539435394453945539465394753948539495395053951539525395353954539555395653957539585395953960539615396253963539645396553966539675396853969539705397153972539735397453975539765397753978539795398053981539825398353984539855398653987539885398953990539915399253993539945399553996539975399853999540005400154002540035400454005540065400754008540095401054011540125401354014540155401654017540185401954020540215402254023540245402554026540275402854029540305403154032540335403454035540365403754038540395404054041540425404354044540455404654047540485404954050540515405254053540545405554056540575405854059540605406154062540635406454065540665406754068540695407054071540725407354074540755407654077540785407954080540815408254083540845408554086540875408854089540905409154092540935409454095540965409754098540995410054101541025410354104541055410654107541085410954110541115411254113541145411554116541175411854119541205412154122541235412454125541265412754128541295413054131541325413354134541355413654137541385413954140541415414254143541445414554146541475414854149541505415154152541535415454155541565415754158541595416054161541625416354164541655416654167541685416954170541715417254173541745417554176541775417854179541805418154182541835418454185541865418754188541895419054191541925419354194541955419654197541985419954200542015420254203542045420554206542075420854209542105421154212542135421454215542165421754218542195422054221542225422354224542255422654227542285422954230542315423254233542345423554236542375423854239542405424154242542435424454245542465424754248542495425054251542525425354254542555425654257542585425954260542615426254263542645426554266542675426854269542705427154272542735427454275542765427754278542795428054281542825428354284542855428654287542885428954290542915429254293542945429554296542975429854299543005430154302543035430454305543065430754308543095431054311543125431354314543155431654317543185431954320543215432254323543245432554326543275432854329543305433154332543335433454335543365433754338543395434054341543425434354344543455434654347543485434954350543515435254353543545435554356543575435854359543605436154362543635436454365543665436754368543695437054371543725437354374543755437654377543785437954380543815438254383543845438554386543875438854389543905439154392543935439454395543965439754398543995440054401544025440354404544055440654407544085440954410544115441254413544145441554416544175441854419544205442154422544235442454425544265442754428544295443054431544325443354434544355443654437544385443954440544415444254443544445444554446544475444854449544505445154452544535445454455544565445754458544595446054461544625446354464544655446654467544685446954470544715447254473544745447554476544775447854479544805448154482544835448454485544865448754488544895449054491544925449354494544955449654497544985449954500545015450254503545045450554506545075450854509545105451154512545135451454515545165451754518545195452054521545225452354524545255452654527545285452954530545315453254533545345453554536545375453854539545405454154542545435454454545545465454754548545495455054551545525455354554545555455654557545585455954560545615456254563545645456554566545675456854569545705457154572545735457454575545765457754578545795458054581545825458354584545855458654587545885458954590545915459254593545945459554596545975459854599546005460154602546035460454605546065460754608546095461054611546125461354614546155461654617546185461954620546215462254623546245462554626546275462854629546305463154632546335463454635546365463754638546395464054641546425464354644546455464654647546485464954650546515465254653546545465554656546575465854659546605466154662546635466454665546665466754668546695467054671546725467354674546755467654677546785467954680546815468254683546845468554686546875468854689546905469154692546935469454695546965469754698546995470054701547025470354704547055470654707547085470954710547115471254713547145471554716547175471854719547205472154722547235472454725547265472754728547295473054731547325473354734547355473654737547385473954740547415474254743547445474554746547475474854749547505475154752547535475454755547565475754758547595476054761547625476354764547655476654767547685476954770547715477254773547745477554776547775477854779547805478154782547835478454785547865478754788547895479054791547925479354794547955479654797547985479954800548015480254803548045480554806548075480854809548105481154812548135481454815548165481754818548195482054821548225482354824548255482654827548285482954830548315483254833548345483554836548375483854839548405484154842548435484454845548465484754848548495485054851548525485354854548555485654857548585485954860548615486254863548645486554866548675486854869548705487154872548735487454875548765487754878548795488054881548825488354884548855488654887548885488954890548915489254893548945489554896548975489854899549005490154902549035490454905549065490754908549095491054911549125491354914549155491654917549185491954920549215492254923549245492554926549275492854929549305493154932549335493454935549365493754938549395494054941549425494354944549455494654947549485494954950549515495254953549545495554956549575495854959549605496154962549635496454965549665496754968549695497054971549725497354974549755497654977549785497954980549815498254983549845498554986549875498854989549905499154992549935499454995549965499754998549995500055001550025500355004550055500655007550085500955010550115501255013550145501555016550175501855019550205502155022550235502455025550265502755028550295503055031550325503355034550355503655037550385503955040550415504255043550445504555046550475504855049550505505155052550535505455055550565505755058550595506055061550625506355064550655506655067550685506955070550715507255073550745507555076550775507855079550805508155082550835508455085550865508755088550895509055091550925509355094550955509655097550985509955100551015510255103551045510555106551075510855109551105511155112551135511455115551165511755118551195512055121551225512355124551255512655127551285512955130551315513255133551345513555136551375513855139551405514155142551435514455145551465514755148551495515055151551525515355154551555515655157551585515955160551615516255163551645516555166551675516855169551705517155172551735517455175551765517755178551795518055181551825518355184551855518655187551885518955190551915519255193551945519555196551975519855199552005520155202552035520455205552065520755208552095521055211552125521355214552155521655217552185521955220552215522255223552245522555226552275522855229552305523155232552335523455235552365523755238552395524055241552425524355244552455524655247552485524955250552515525255253552545525555256552575525855259552605526155262552635526455265552665526755268552695527055271552725527355274552755527655277552785527955280552815528255283552845528555286552875528855289552905529155292552935529455295552965529755298552995530055301553025530355304553055530655307553085530955310553115531255313553145531555316553175531855319553205532155322553235532455325553265532755328553295533055331553325533355334553355533655337553385533955340553415534255343553445534555346553475534855349553505535155352553535535455355553565535755358553595536055361553625536355364553655536655367553685536955370553715537255373553745537555376553775537855379553805538155382553835538455385553865538755388553895539055391553925539355394553955539655397553985539955400554015540255403554045540555406554075540855409554105541155412554135541455415554165541755418554195542055421554225542355424554255542655427554285542955430554315543255433554345543555436554375543855439554405544155442554435544455445554465544755448554495545055451554525545355454554555545655457554585545955460554615546255463554645546555466554675546855469554705547155472554735547455475554765547755478554795548055481554825548355484554855548655487554885548955490554915549255493554945549555496554975549855499555005550155502555035550455505555065550755508555095551055511555125551355514555155551655517555185551955520555215552255523555245552555526555275552855529555305553155532555335553455535555365553755538555395554055541555425554355544555455554655547555485554955550555515555255553555545555555556555575555855559555605556155562555635556455565555665556755568555695557055571555725557355574555755557655577555785557955580555815558255583555845558555586555875558855589555905559155592555935559455595555965559755598555995560055601556025560355604556055560655607556085560955610556115561255613556145561555616556175561855619556205562155622556235562455625556265562755628556295563055631556325563355634556355563655637556385563955640556415564255643556445564555646556475564855649556505565155652556535565455655556565565755658556595566055661556625566355664556655566655667556685566955670556715567255673556745567555676556775567855679556805568155682556835568455685556865568755688556895569055691556925569355694556955569655697556985569955700557015570255703557045570555706557075570855709557105571155712557135571455715557165571755718557195572055721557225572355724557255572655727557285572955730557315573255733557345573555736557375573855739557405574155742557435574455745557465574755748557495575055751557525575355754557555575655757557585575955760557615576255763557645576555766557675576855769557705577155772557735577455775557765577755778557795578055781557825578355784557855578655787557885578955790557915579255793557945579555796557975579855799558005580155802558035580455805558065580755808558095581055811558125581355814558155581655817558185581955820558215582255823558245582555826558275582855829558305583155832558335583455835558365583755838558395584055841558425584355844558455584655847558485584955850558515585255853558545585555856558575585855859558605586155862558635586455865558665586755868558695587055871558725587355874558755587655877558785587955880558815588255883558845588555886558875588855889558905589155892558935589455895558965589755898558995590055901559025590355904559055590655907559085590955910559115591255913559145591555916559175591855919559205592155922559235592455925559265592755928559295593055931559325593355934559355593655937559385593955940559415594255943559445594555946559475594855949559505595155952559535595455955559565595755958559595596055961559625596355964559655596655967559685596955970559715597255973559745597555976559775597855979559805598155982559835598455985559865598755988559895599055991559925599355994559955599655997559985599956000560015600256003560045600556006560075600856009560105601156012560135601456015560165601756018560195602056021560225602356024560255602656027560285602956030560315603256033560345603556036560375603856039560405604156042560435604456045560465604756048560495605056051560525605356054560555605656057560585605956060560615606256063560645606556066560675606856069560705607156072560735607456075560765607756078560795608056081560825608356084560855608656087560885608956090560915609256093560945609556096560975609856099561005610156102561035610456105561065610756108561095611056111561125611356114561155611656117561185611956120561215612256123561245612556126561275612856129561305613156132561335613456135561365613756138561395614056141561425614356144561455614656147561485614956150561515615256153561545615556156561575615856159561605616156162561635616456165561665616756168561695617056171561725617356174561755617656177561785617956180561815618256183561845618556186561875618856189561905619156192561935619456195561965619756198561995620056201562025620356204562055620656207562085620956210562115621256213562145621556216562175621856219562205622156222562235622456225562265622756228562295623056231562325623356234562355623656237562385623956240562415624256243562445624556246562475624856249562505625156252562535625456255562565625756258562595626056261562625626356264562655626656267562685626956270562715627256273562745627556276562775627856279562805628156282562835628456285562865628756288562895629056291562925629356294562955629656297562985629956300563015630256303563045630556306563075630856309563105631156312563135631456315563165631756318563195632056321563225632356324563255632656327563285632956330563315633256333563345633556336563375633856339563405634156342563435634456345563465634756348563495635056351563525635356354563555635656357563585635956360563615636256363563645636556366563675636856369563705637156372563735637456375563765637756378563795638056381563825638356384563855638656387563885638956390563915639256393563945639556396563975639856399564005640156402564035640456405564065640756408564095641056411564125641356414564155641656417564185641956420564215642256423564245642556426564275642856429564305643156432564335643456435564365643756438564395644056441564425644356444564455644656447564485644956450564515645256453564545645556456564575645856459564605646156462564635646456465564665646756468564695647056471564725647356474564755647656477564785647956480564815648256483564845648556486564875648856489564905649156492564935649456495564965649756498564995650056501565025650356504565055650656507565085650956510565115651256513565145651556516565175651856519565205652156522565235652456525565265652756528565295653056531565325653356534565355653656537565385653956540565415654256543565445654556546565475654856549565505655156552565535655456555565565655756558565595656056561565625656356564565655656656567565685656956570565715657256573565745657556576565775657856579565805658156582565835658456585565865658756588565895659056591565925659356594565955659656597565985659956600566015660256603566045660556606566075660856609566105661156612566135661456615566165661756618566195662056621566225662356624566255662656627566285662956630566315663256633566345663556636566375663856639566405664156642566435664456645566465664756648566495665056651566525665356654566555665656657566585665956660566615666256663566645666556666566675666856669566705667156672566735667456675566765667756678566795668056681566825668356684566855668656687566885668956690566915669256693566945669556696566975669856699567005670156702567035670456705567065670756708567095671056711567125671356714567155671656717567185671956720567215672256723567245672556726567275672856729567305673156732567335673456735567365673756738567395674056741567425674356744567455674656747567485674956750567515675256753567545675556756567575675856759567605676156762567635676456765567665676756768567695677056771567725677356774567755677656777567785677956780567815678256783567845678556786567875678856789567905679156792567935679456795567965679756798567995680056801568025680356804568055680656807568085680956810568115681256813568145681556816568175681856819568205682156822568235682456825568265682756828568295683056831568325683356834568355683656837568385683956840568415684256843568445684556846568475684856849568505685156852568535685456855568565685756858568595686056861568625686356864568655686656867568685686956870568715687256873568745687556876568775687856879568805688156882568835688456885568865688756888568895689056891568925689356894568955689656897568985689956900569015690256903569045690556906569075690856909569105691156912569135691456915569165691756918569195692056921569225692356924569255692656927569285692956930569315693256933569345693556936569375693856939569405694156942569435694456945569465694756948569495695056951569525695356954569555695656957569585695956960569615696256963569645696556966569675696856969569705697156972569735697456975569765697756978569795698056981569825698356984569855698656987569885698956990569915699256993569945699556996569975699856999570005700157002570035700457005570065700757008570095701057011570125701357014570155701657017570185701957020570215702257023570245702557026570275702857029570305703157032570335703457035570365703757038570395704057041570425704357044570455704657047570485704957050570515705257053570545705557056570575705857059570605706157062570635706457065570665706757068570695707057071570725707357074570755707657077570785707957080570815708257083570845708557086570875708857089570905709157092570935709457095570965709757098570995710057101571025710357104571055710657107571085710957110571115711257113571145711557116571175711857119571205712157122571235712457125571265712757128571295713057131571325713357134571355713657137571385713957140571415714257143571445714557146571475714857149571505715157152571535715457155571565715757158571595716057161571625716357164571655716657167571685716957170571715717257173571745717557176571775717857179571805718157182571835718457185571865718757188571895719057191571925719357194571955719657197571985719957200572015720257203572045720557206572075720857209572105721157212572135721457215572165721757218572195722057221572225722357224572255722657227572285722957230572315723257233572345723557236572375723857239572405724157242572435724457245572465724757248572495725057251572525725357254572555725657257572585725957260572615726257263572645726557266572675726857269572705727157272572735727457275572765727757278572795728057281572825728357284572855728657287572885728957290572915729257293572945729557296572975729857299573005730157302573035730457305573065730757308573095731057311573125731357314573155731657317573185731957320573215732257323573245732557326573275732857329573305733157332573335733457335573365733757338573395734057341573425734357344573455734657347573485734957350573515735257353573545735557356573575735857359573605736157362573635736457365573665736757368573695737057371573725737357374573755737657377573785737957380573815738257383573845738557386573875738857389573905739157392573935739457395573965739757398573995740057401574025740357404574055740657407574085740957410574115741257413574145741557416574175741857419574205742157422574235742457425574265742757428574295743057431574325743357434574355743657437574385743957440574415744257443574445744557446574475744857449574505745157452574535745457455574565745757458574595746057461574625746357464574655746657467574685746957470574715747257473574745747557476574775747857479574805748157482574835748457485574865748757488574895749057491574925749357494574955749657497574985749957500575015750257503575045750557506575075750857509575105751157512575135751457515575165751757518575195752057521575225752357524575255752657527575285752957530575315753257533575345753557536575375753857539575405754157542575435754457545575465754757548575495755057551575525755357554575555755657557575585755957560575615756257563575645756557566575675756857569575705757157572575735757457575575765757757578575795758057581575825758357584575855758657587575885758957590575915759257593575945759557596575975759857599576005760157602576035760457605576065760757608576095761057611576125761357614576155761657617576185761957620576215762257623576245762557626576275762857629576305763157632576335763457635576365763757638576395764057641576425764357644576455764657647576485764957650576515765257653576545765557656576575765857659576605766157662576635766457665576665766757668576695767057671576725767357674576755767657677576785767957680576815768257683576845768557686576875768857689576905769157692576935769457695576965769757698576995770057701577025770357704577055770657707577085770957710577115771257713577145771557716577175771857719577205772157722577235772457725577265772757728577295773057731577325773357734577355773657737577385773957740577415774257743577445774557746577475774857749577505775157752577535775457755577565775757758577595776057761577625776357764577655776657767577685776957770577715777257773577745777557776577775777857779577805778157782577835778457785577865778757788577895779057791577925779357794577955779657797577985779957800578015780257803578045780557806578075780857809578105781157812578135781457815578165781757818578195782057821578225782357824578255782657827578285782957830578315783257833578345783557836578375783857839578405784157842578435784457845578465784757848578495785057851578525785357854578555785657857578585785957860578615786257863578645786557866578675786857869578705787157872578735787457875578765787757878578795788057881578825788357884578855788657887578885788957890578915789257893578945789557896578975789857899579005790157902579035790457905579065790757908579095791057911579125791357914579155791657917579185791957920579215792257923579245792557926579275792857929579305793157932579335793457935579365793757938579395794057941579425794357944579455794657947579485794957950579515795257953579545795557956579575795857959579605796157962579635796457965579665796757968579695797057971579725797357974579755797657977579785797957980579815798257983579845798557986579875798857989579905799157992579935799457995579965799757998579995800058001580025800358004580055800658007580085800958010580115801258013580145801558016580175801858019580205802158022580235802458025580265802758028580295803058031580325803358034580355803658037580385803958040580415804258043580445804558046580475804858049580505805158052580535805458055580565805758058580595806058061580625806358064580655806658067580685806958070580715807258073580745807558076580775807858079580805808158082580835808458085580865808758088580895809058091580925809358094580955809658097580985809958100581015810258103581045810558106581075810858109581105811158112581135811458115581165811758118581195812058121581225812358124581255812658127581285812958130581315813258133581345813558136581375813858139581405814158142581435814458145581465814758148581495815058151581525815358154581555815658157581585815958160581615816258163581645816558166581675816858169581705817158172581735817458175581765817758178581795818058181581825818358184581855818658187581885818958190581915819258193581945819558196581975819858199582005820158202582035820458205582065820758208582095821058211582125821358214582155821658217582185821958220582215822258223582245822558226582275822858229582305823158232582335823458235582365823758238582395824058241582425824358244582455824658247582485824958250582515825258253582545825558256582575825858259582605826158262582635826458265582665826758268582695827058271582725827358274582755827658277582785827958280582815828258283582845828558286582875828858289582905829158292582935829458295582965829758298582995830058301583025830358304583055830658307583085830958310583115831258313583145831558316583175831858319583205832158322583235832458325583265832758328583295833058331583325833358334583355833658337583385833958340583415834258343583445834558346583475834858349583505835158352583535835458355583565835758358583595836058361583625836358364583655836658367583685836958370583715837258373583745837558376583775837858379583805838158382583835838458385583865838758388583895839058391583925839358394583955839658397583985839958400584015840258403584045840558406584075840858409584105841158412584135841458415584165841758418584195842058421584225842358424584255842658427584285842958430584315843258433584345843558436584375843858439584405844158442584435844458445584465844758448584495845058451584525845358454584555845658457584585845958460584615846258463584645846558466584675846858469584705847158472584735847458475584765847758478584795848058481584825848358484584855848658487584885848958490584915849258493584945849558496584975849858499585005850158502585035850458505585065850758508585095851058511585125851358514585155851658517585185851958520585215852258523585245852558526585275852858529585305853158532585335853458535585365853758538585395854058541585425854358544585455854658547585485854958550585515855258553585545855558556585575855858559585605856158562585635856458565585665856758568585695857058571585725857358574585755857658577585785857958580585815858258583585845858558586585875858858589585905859158592585935859458595585965859758598585995860058601586025860358604586055860658607586085860958610586115861258613586145861558616586175861858619586205862158622586235862458625586265862758628586295863058631586325863358634586355863658637586385863958640586415864258643586445864558646586475864858649586505865158652586535865458655586565865758658586595866058661586625866358664586655866658667586685866958670586715867258673586745867558676586775867858679586805868158682586835868458685586865868758688586895869058691586925869358694586955869658697586985869958700587015870258703587045870558706587075870858709587105871158712587135871458715587165871758718587195872058721587225872358724587255872658727587285872958730587315873258733587345873558736587375873858739587405874158742587435874458745587465874758748587495875058751587525875358754587555875658757587585875958760587615876258763587645876558766587675876858769587705877158772587735877458775587765877758778587795878058781587825878358784587855878658787587885878958790587915879258793587945879558796587975879858799588005880158802588035880458805588065880758808588095881058811588125881358814588155881658817588185881958820588215882258823588245882558826588275882858829588305883158832588335883458835588365883758838588395884058841588425884358844588455884658847588485884958850588515885258853588545885558856588575885858859588605886158862588635886458865588665886758868588695887058871588725887358874588755887658877588785887958880588815888258883588845888558886588875888858889588905889158892588935889458895588965889758898588995890058901589025890358904589055890658907589085890958910589115891258913589145891558916589175891858919589205892158922589235892458925589265892758928589295893058931589325893358934589355893658937589385893958940589415894258943589445894558946589475894858949589505895158952589535895458955589565895758958589595896058961589625896358964589655896658967589685896958970589715897258973589745897558976589775897858979589805898158982589835898458985589865898758988589895899058991589925899358994589955899658997589985899959000590015900259003590045900559006590075900859009590105901159012590135901459015590165901759018590195902059021590225902359024590255902659027590285902959030590315903259033590345903559036590375903859039590405904159042590435904459045590465904759048590495905059051590525905359054590555905659057590585905959060590615906259063590645906559066590675906859069590705907159072590735907459075590765907759078590795908059081590825908359084590855908659087590885908959090590915909259093590945909559096590975909859099591005910159102591035910459105591065910759108591095911059111591125911359114591155911659117591185911959120591215912259123591245912559126591275912859129591305913159132591335913459135591365913759138591395914059141591425914359144591455914659147591485914959150591515915259153591545915559156591575915859159591605916159162591635916459165591665916759168591695917059171591725917359174591755917659177591785917959180591815918259183591845918559186591875918859189591905919159192591935919459195591965919759198591995920059201592025920359204592055920659207592085920959210592115921259213592145921559216592175921859219592205922159222592235922459225592265922759228592295923059231592325923359234592355923659237592385923959240592415924259243592445924559246592475924859249592505925159252592535925459255592565925759258592595926059261592625926359264592655926659267592685926959270592715927259273592745927559276592775927859279592805928159282592835928459285592865928759288592895929059291592925929359294592955929659297592985929959300593015930259303593045930559306593075930859309593105931159312593135931459315593165931759318593195932059321593225932359324593255932659327593285932959330593315933259333593345933559336593375933859339593405934159342593435934459345593465934759348593495935059351593525935359354593555935659357593585935959360593615936259363593645936559366593675936859369593705937159372593735937459375593765937759378593795938059381593825938359384593855938659387593885938959390593915939259393593945939559396593975939859399594005940159402594035940459405594065940759408594095941059411594125941359414594155941659417594185941959420594215942259423594245942559426594275942859429594305943159432594335943459435594365943759438594395944059441594425944359444594455944659447594485944959450594515945259453594545945559456594575945859459594605946159462594635946459465594665946759468594695947059471594725947359474594755947659477594785947959480594815948259483594845948559486594875948859489594905949159492594935949459495594965949759498594995950059501595025950359504595055950659507595085950959510595115951259513595145951559516595175951859519595205952159522595235952459525595265952759528595295953059531595325953359534595355953659537595385953959540595415954259543595445954559546595475954859549595505955159552595535955459555595565955759558595595956059561595625956359564595655956659567595685956959570595715957259573595745957559576595775957859579595805958159582595835958459585595865958759588595895959059591595925959359594595955959659597595985959959600596015960259603596045960559606596075960859609596105961159612596135961459615596165961759618596195962059621596225962359624596255962659627596285962959630596315963259633596345963559636596375963859639596405964159642596435964459645596465964759648596495965059651596525965359654596555965659657596585965959660596615966259663596645966559666596675966859669596705967159672596735967459675596765967759678596795968059681596825968359684596855968659687596885968959690596915969259693596945969559696596975969859699597005970159702597035970459705597065970759708597095971059711597125971359714597155971659717597185971959720597215972259723597245972559726597275972859729597305973159732597335973459735597365973759738597395974059741597425974359744597455974659747597485974959750597515975259753597545975559756597575975859759597605976159762597635976459765597665976759768597695977059771597725977359774597755977659777597785977959780597815978259783597845978559786597875978859789597905979159792597935979459795597965979759798597995980059801598025980359804598055980659807598085980959810598115981259813598145981559816598175981859819598205982159822598235982459825598265982759828598295983059831598325983359834598355983659837598385983959840598415984259843598445984559846598475984859849598505985159852598535985459855598565985759858598595986059861598625986359864598655986659867598685986959870598715987259873598745987559876598775987859879598805988159882598835988459885598865988759888598895989059891598925989359894598955989659897598985989959900599015990259903599045990559906599075990859909599105991159912599135991459915599165991759918599195992059921599225992359924599255992659927599285992959930599315993259933599345993559936599375993859939599405994159942599435994459945599465994759948599495995059951599525995359954599555995659957599585995959960599615996259963599645996559966599675996859969599705997159972599735997459975599765997759978599795998059981599825998359984599855998659987599885998959990599915999259993599945999559996599975999859999600006000160002600036000460005600066000760008600096001060011600126001360014600156001660017600186001960020600216002260023600246002560026600276002860029600306003160032600336003460035600366003760038600396004060041600426004360044600456004660047600486004960050600516005260053600546005560056600576005860059600606006160062600636006460065600666006760068600696007060071600726007360074600756007660077600786007960080600816008260083600846008560086600876008860089600906009160092600936009460095600966009760098600996010060101601026010360104601056010660107601086010960110601116011260113601146011560116601176011860119601206012160122601236012460125601266012760128601296013060131601326013360134601356013660137601386013960140601416014260143601446014560146601476014860149601506015160152601536015460155601566015760158601596016060161601626016360164601656016660167601686016960170601716017260173601746017560176601776017860179601806018160182601836018460185601866018760188601896019060191601926019360194601956019660197601986019960200602016020260203602046020560206602076020860209602106021160212602136021460215602166021760218602196022060221602226022360224602256022660227602286022960230602316023260233602346023560236602376023860239602406024160242602436024460245602466024760248602496025060251602526025360254602556025660257602586025960260602616026260263602646026560266602676026860269602706027160272602736027460275602766027760278602796028060281602826028360284602856028660287602886028960290602916029260293602946029560296602976029860299603006030160302603036030460305603066030760308603096031060311603126031360314603156031660317603186031960320603216032260323603246032560326603276032860329603306033160332603336033460335603366033760338603396034060341603426034360344603456034660347603486034960350603516035260353603546035560356603576035860359603606036160362603636036460365603666036760368603696037060371603726037360374603756037660377603786037960380603816038260383603846038560386603876038860389603906039160392603936039460395603966039760398603996040060401604026040360404604056040660407604086040960410604116041260413604146041560416604176041860419604206042160422604236042460425604266042760428604296043060431604326043360434604356043660437604386043960440604416044260443604446044560446604476044860449604506045160452604536045460455604566045760458604596046060461604626046360464604656046660467604686046960470604716047260473604746047560476604776047860479604806048160482604836048460485604866048760488604896049060491604926049360494604956049660497604986049960500605016050260503605046050560506605076050860509605106051160512605136051460515605166051760518605196052060521605226052360524605256052660527605286052960530605316053260533605346053560536605376053860539605406054160542605436054460545605466054760548605496055060551605526055360554605556055660557605586055960560605616056260563605646056560566605676056860569605706057160572605736057460575605766057760578605796058060581605826058360584605856058660587605886058960590605916059260593605946059560596605976059860599606006060160602606036060460605606066060760608606096061060611606126061360614606156061660617606186061960620606216062260623606246062560626606276062860629606306063160632606336063460635606366063760638606396064060641606426064360644606456064660647606486064960650606516065260653606546065560656606576065860659606606066160662606636066460665606666066760668606696067060671606726067360674606756067660677606786067960680606816068260683606846068560686606876068860689606906069160692606936069460695606966069760698606996070060701607026070360704607056070660707607086070960710607116071260713607146071560716607176071860719607206072160722607236072460725607266072760728607296073060731607326073360734607356073660737607386073960740607416074260743607446074560746607476074860749607506075160752607536075460755607566075760758607596076060761607626076360764607656076660767607686076960770607716077260773607746077560776607776077860779607806078160782607836078460785607866078760788607896079060791607926079360794607956079660797607986079960800608016080260803608046080560806608076080860809608106081160812608136081460815608166081760818608196082060821608226082360824608256082660827608286082960830608316083260833608346083560836608376083860839608406084160842608436084460845608466084760848608496085060851608526085360854608556085660857608586085960860608616086260863608646086560866608676086860869608706087160872608736087460875608766087760878608796088060881608826088360884608856088660887608886088960890608916089260893608946089560896608976089860899609006090160902609036090460905609066090760908609096091060911609126091360914609156091660917609186091960920609216092260923609246092560926609276092860929609306093160932609336093460935609366093760938609396094060941609426094360944609456094660947609486094960950609516095260953609546095560956609576095860959609606096160962609636096460965609666096760968609696097060971609726097360974609756097660977609786097960980609816098260983609846098560986609876098860989609906099160992609936099460995609966099760998609996100061001610026100361004610056100661007610086100961010610116101261013610146101561016610176101861019610206102161022610236102461025610266102761028610296103061031610326103361034610356103661037610386103961040610416104261043610446104561046610476104861049610506105161052610536105461055610566105761058610596106061061610626106361064610656106661067610686106961070610716107261073610746107561076610776107861079610806108161082610836108461085610866108761088610896109061091610926109361094610956109661097610986109961100611016110261103611046110561106611076110861109611106111161112611136111461115611166111761118611196112061121611226112361124611256112661127611286112961130611316113261133611346113561136611376113861139611406114161142611436114461145611466114761148611496115061151611526115361154611556115661157611586115961160611616116261163611646116561166611676116861169611706117161172611736117461175611766117761178611796118061181611826118361184611856118661187611886118961190611916119261193611946119561196611976119861199612006120161202612036120461205612066120761208612096121061211612126121361214612156121661217612186121961220612216122261223612246122561226612276122861229612306123161232612336123461235612366123761238612396124061241612426124361244612456124661247612486124961250612516125261253612546125561256612576125861259612606126161262612636126461265612666126761268612696127061271612726127361274612756127661277612786127961280612816128261283612846128561286612876128861289612906129161292612936129461295612966129761298612996130061301613026130361304613056130661307613086130961310613116131261313613146131561316613176131861319613206132161322613236132461325613266132761328613296133061331613326133361334613356133661337613386133961340613416134261343613446134561346613476134861349613506135161352613536135461355613566135761358613596136061361613626136361364613656136661367613686136961370613716137261373613746137561376613776137861379613806138161382613836138461385613866138761388613896139061391613926139361394613956139661397613986139961400614016140261403614046140561406614076140861409614106141161412614136141461415614166141761418614196142061421614226142361424614256142661427614286142961430614316143261433614346143561436614376143861439614406144161442614436144461445614466144761448614496145061451614526145361454614556145661457614586145961460614616146261463614646146561466614676146861469614706147161472614736147461475614766147761478614796148061481614826148361484614856148661487614886148961490614916149261493614946149561496614976149861499615006150161502615036150461505615066150761508615096151061511615126151361514615156151661517615186151961520615216152261523615246152561526615276152861529615306153161532615336153461535615366153761538615396154061541615426154361544615456154661547615486154961550615516155261553615546155561556615576155861559615606156161562615636156461565615666156761568615696157061571615726157361574615756157661577615786157961580615816158261583615846158561586615876158861589615906159161592615936159461595615966159761598615996160061601616026160361604616056160661607616086160961610616116161261613616146161561616616176161861619616206162161622616236162461625616266162761628616296163061631616326163361634616356163661637616386163961640616416164261643616446164561646616476164861649616506165161652616536165461655616566165761658616596166061661616626166361664616656166661667616686166961670616716167261673616746167561676616776167861679616806168161682616836168461685616866168761688616896169061691616926169361694616956169661697616986169961700617016170261703617046170561706617076170861709617106171161712617136171461715617166171761718617196172061721617226172361724617256172661727617286172961730617316173261733617346173561736617376173861739617406174161742617436174461745617466174761748617496175061751617526175361754617556175661757617586175961760617616176261763617646176561766617676176861769617706177161772617736177461775617766177761778617796178061781617826178361784617856178661787617886178961790617916179261793617946179561796617976179861799618006180161802618036180461805618066180761808618096181061811618126181361814618156181661817618186181961820618216182261823618246182561826618276182861829618306183161832618336183461835618366183761838618396184061841618426184361844618456184661847618486184961850618516185261853618546185561856618576185861859618606186161862618636186461865618666186761868618696187061871618726187361874618756187661877618786187961880618816188261883618846188561886618876188861889618906189161892618936189461895618966189761898618996190061901619026190361904619056190661907619086190961910619116191261913619146191561916619176191861919619206192161922619236192461925619266192761928619296193061931619326193361934619356193661937619386193961940619416194261943619446194561946619476194861949619506195161952619536195461955619566195761958619596196061961619626196361964619656196661967619686196961970619716197261973619746197561976619776197861979619806198161982619836198461985619866198761988619896199061991619926199361994619956199661997619986199962000620016200262003620046200562006620076200862009620106201162012620136201462015620166201762018620196202062021620226202362024620256202662027620286202962030620316203262033620346203562036620376203862039620406204162042620436204462045620466204762048620496205062051620526205362054620556205662057620586205962060620616206262063620646206562066620676206862069620706207162072620736207462075620766207762078620796208062081620826208362084620856208662087620886208962090620916209262093620946209562096620976209862099621006210162102621036210462105621066210762108621096211062111621126211362114621156211662117621186211962120621216212262123621246212562126621276212862129621306213162132621336213462135621366213762138621396214062141621426214362144621456214662147621486214962150621516215262153621546215562156621576215862159621606216162162621636216462165621666216762168621696217062171621726217362174621756217662177621786217962180621816218262183621846218562186621876218862189621906219162192621936219462195621966219762198621996220062201622026220362204622056220662207622086220962210622116221262213622146221562216622176221862219622206222162222622236222462225622266222762228622296223062231622326223362234622356223662237622386223962240622416224262243622446224562246622476224862249622506225162252622536225462255622566225762258622596226062261622626226362264622656226662267622686226962270622716227262273622746227562276622776227862279622806228162282622836228462285622866228762288622896229062291622926229362294622956229662297622986229962300623016230262303623046230562306623076230862309623106231162312623136231462315623166231762318623196232062321623226232362324623256232662327623286232962330623316233262333623346233562336623376233862339623406234162342623436234462345623466234762348623496235062351623526235362354623556235662357623586235962360623616236262363623646236562366623676236862369623706237162372623736237462375623766237762378623796238062381623826238362384623856238662387623886238962390623916239262393623946239562396623976239862399624006240162402624036240462405624066240762408624096241062411624126241362414624156241662417624186241962420624216242262423624246242562426624276242862429624306243162432624336243462435624366243762438624396244062441624426244362444624456244662447624486244962450624516245262453624546245562456624576245862459624606246162462624636246462465624666246762468624696247062471624726247362474624756247662477624786247962480624816248262483624846248562486624876248862489624906249162492624936249462495624966249762498624996250062501625026250362504625056250662507625086250962510625116251262513625146251562516625176251862519625206252162522625236252462525625266252762528625296253062531625326253362534625356253662537625386253962540625416254262543625446254562546625476254862549625506255162552625536255462555625566255762558625596256062561625626256362564625656256662567625686256962570625716257262573625746257562576625776257862579625806258162582625836258462585625866258762588625896259062591625926259362594625956259662597625986259962600626016260262603626046260562606626076260862609626106261162612626136261462615626166261762618626196262062621626226262362624626256262662627626286262962630626316263262633626346263562636626376263862639626406264162642626436264462645626466264762648626496265062651626526265362654626556265662657626586265962660626616266262663626646266562666626676266862669626706267162672626736267462675626766267762678626796268062681626826268362684626856268662687626886268962690626916269262693626946269562696626976269862699627006270162702627036270462705627066270762708627096271062711627126271362714627156271662717627186271962720627216272262723627246272562726627276272862729627306273162732627336273462735627366273762738627396274062741627426274362744627456274662747627486274962750627516275262753627546275562756627576275862759627606276162762627636276462765627666276762768627696277062771627726277362774627756277662777627786277962780627816278262783627846278562786627876278862789627906279162792627936279462795627966279762798627996280062801628026280362804628056280662807628086280962810628116281262813628146281562816628176281862819628206282162822628236282462825628266282762828628296283062831628326283362834628356283662837628386283962840628416284262843628446284562846628476284862849628506285162852628536285462855628566285762858628596286062861628626286362864628656286662867628686286962870628716287262873628746287562876628776287862879628806288162882628836288462885628866288762888628896289062891628926289362894628956289662897628986289962900629016290262903629046290562906629076290862909629106291162912629136291462915629166291762918629196292062921629226292362924629256292662927629286292962930629316293262933629346293562936629376293862939629406294162942629436294462945629466294762948629496295062951629526295362954629556295662957629586295962960629616296262963629646296562966629676296862969629706297162972629736297462975629766297762978629796298062981629826298362984629856298662987629886298962990629916299262993629946299562996629976299862999630006300163002630036300463005630066300763008630096301063011630126301363014630156301663017630186301963020630216302263023630246302563026630276302863029630306303163032630336303463035630366303763038630396304063041630426304363044630456304663047630486304963050630516305263053630546305563056630576305863059630606306163062630636306463065630666306763068630696307063071630726307363074630756307663077630786307963080630816308263083630846308563086630876308863089630906309163092630936309463095630966309763098630996310063101631026310363104631056310663107631086310963110631116311263113631146311563116631176311863119631206312163122631236312463125631266312763128631296313063131631326313363134631356313663137631386313963140631416314263143631446314563146631476314863149631506315163152631536315463155631566315763158631596316063161631626316363164631656316663167631686316963170631716317263173631746317563176631776317863179631806318163182631836318463185631866318763188631896319063191631926319363194631956319663197631986319963200632016320263203632046320563206632076320863209632106321163212632136321463215632166321763218632196322063221632226322363224632256322663227632286322963230632316323263233632346323563236632376323863239632406324163242632436324463245632466324763248632496325063251632526325363254632556325663257632586325963260632616326263263632646326563266632676326863269632706327163272632736327463275632766327763278632796328063281632826328363284632856328663287632886328963290632916329263293632946329563296632976329863299633006330163302633036330463305633066330763308633096331063311633126331363314633156331663317633186331963320633216332263323633246332563326633276332863329633306333163332633336333463335633366333763338633396334063341633426334363344633456334663347633486334963350633516335263353633546335563356633576335863359633606336163362633636336463365633666336763368633696337063371633726337363374633756337663377633786337963380633816338263383633846338563386633876338863389633906339163392633936339463395633966339763398633996340063401634026340363404634056340663407634086340963410634116341263413634146341563416634176341863419634206342163422634236342463425634266342763428634296343063431634326343363434634356343663437634386343963440634416344263443634446344563446634476344863449634506345163452634536345463455634566345763458634596346063461634626346363464634656346663467634686346963470634716347263473634746347563476634776347863479634806348163482634836348463485634866348763488634896349063491634926349363494634956349663497634986349963500635016350263503635046350563506635076350863509635106351163512635136351463515635166351763518635196352063521635226352363524635256352663527635286352963530635316353263533635346353563536635376353863539635406354163542635436354463545635466354763548635496355063551635526355363554635556355663557635586355963560635616356263563635646356563566635676356863569635706357163572635736357463575635766357763578635796358063581635826358363584635856358663587635886358963590635916359263593635946359563596635976359863599636006360163602636036360463605636066360763608636096361063611636126361363614636156361663617636186361963620636216362263623636246362563626636276362863629636306363163632636336363463635636366363763638636396364063641636426364363644636456364663647636486364963650636516365263653636546365563656636576365863659636606366163662636636366463665636666366763668636696367063671636726367363674636756367663677636786367963680636816368263683636846368563686636876368863689636906369163692636936369463695636966369763698636996370063701637026370363704637056370663707637086370963710637116371263713637146371563716637176371863719637206372163722637236372463725637266372763728637296373063731637326373363734637356373663737637386373963740637416374263743637446374563746637476374863749637506375163752637536375463755637566375763758637596376063761637626376363764637656376663767637686376963770637716377263773637746377563776637776377863779637806378163782637836378463785637866378763788637896379063791637926379363794637956379663797637986379963800638016380263803638046380563806638076380863809638106381163812638136381463815638166381763818638196382063821638226382363824638256382663827638286382963830638316383263833638346383563836638376383863839638406384163842638436384463845638466384763848638496385063851638526385363854638556385663857638586385963860638616386263863638646386563866638676386863869638706387163872638736387463875638766387763878638796388063881638826388363884638856388663887638886388963890638916389263893638946389563896638976389863899639006390163902639036390463905639066390763908639096391063911639126391363914639156391663917639186391963920639216392263923639246392563926639276392863929639306393163932639336393463935639366393763938639396394063941639426394363944639456394663947639486394963950639516395263953639546395563956639576395863959639606396163962639636396463965639666396763968639696397063971639726397363974639756397663977639786397963980639816398263983639846398563986639876398863989639906399163992639936399463995639966399763998639996400064001640026400364004640056400664007640086400964010640116401264013640146401564016640176401864019640206402164022640236402464025640266402764028640296403064031640326403364034640356403664037640386403964040640416404264043640446404564046640476404864049640506405164052640536405464055640566405764058640596406064061640626406364064640656406664067640686406964070640716407264073640746407564076640776407864079640806408164082640836408464085640866408764088640896409064091640926409364094640956409664097640986409964100641016410264103641046410564106641076410864109641106411164112641136411464115641166411764118641196412064121641226412364124641256412664127641286412964130641316413264133641346413564136641376413864139641406414164142641436414464145641466414764148641496415064151641526415364154641556415664157641586415964160641616416264163641646416564166641676416864169641706417164172641736417464175641766417764178641796418064181641826418364184641856418664187641886418964190641916419264193641946419564196641976419864199642006420164202642036420464205642066420764208642096421064211642126421364214642156421664217642186421964220642216422264223642246422564226642276422864229642306423164232642336423464235642366423764238642396424064241642426424364244642456424664247642486424964250642516425264253642546425564256642576425864259642606426164262642636426464265642666426764268642696427064271642726427364274642756427664277642786427964280642816428264283642846428564286642876428864289642906429164292642936429464295642966429764298642996430064301643026430364304643056430664307643086430964310643116431264313643146431564316643176431864319643206432164322643236432464325643266432764328643296433064331643326433364334643356433664337643386433964340643416434264343643446434564346643476434864349643506435164352643536435464355643566435764358643596436064361643626436364364643656436664367643686436964370643716437264373643746437564376643776437864379643806438164382643836438464385643866438764388643896439064391643926439364394643956439664397643986439964400644016440264403644046440564406644076440864409644106441164412644136441464415644166441764418644196442064421644226442364424644256442664427644286442964430644316443264433644346443564436644376443864439644406444164442644436444464445644466444764448644496445064451644526445364454644556445664457644586445964460644616446264463644646446564466644676446864469644706447164472644736447464475644766447764478644796448064481644826448364484644856448664487644886448964490644916449264493644946449564496644976449864499645006450164502645036450464505645066450764508645096451064511645126451364514645156451664517645186451964520645216452264523645246452564526645276452864529645306453164532645336453464535645366453764538645396454064541645426454364544645456454664547645486454964550645516455264553645546455564556645576455864559645606456164562645636456464565645666456764568645696457064571645726457364574645756457664577645786457964580645816458264583645846458564586645876458864589645906459164592645936459464595645966459764598645996460064601646026460364604646056460664607646086460964610646116461264613646146461564616646176461864619646206462164622646236462464625646266462764628646296463064631646326463364634646356463664637646386463964640646416464264643646446464564646646476464864649646506465164652646536465464655646566465764658646596466064661646626466364664646656466664667646686466964670646716467264673646746467564676646776467864679646806468164682646836468464685646866468764688646896469064691646926469364694646956469664697646986469964700647016470264703647046470564706647076470864709647106471164712647136471464715647166471764718647196472064721647226472364724647256472664727647286472964730647316473264733647346473564736647376473864739647406474164742647436474464745647466474764748647496475064751647526475364754647556475664757647586475964760647616476264763647646476564766647676476864769647706477164772647736477464775647766477764778647796478064781647826478364784647856478664787647886478964790647916479264793647946479564796647976479864799648006480164802648036480464805648066480764808648096481064811648126481364814648156481664817648186481964820648216482264823648246482564826648276482864829648306483164832648336483464835648366483764838648396484064841648426484364844648456484664847648486484964850648516485264853648546485564856648576485864859648606486164862648636486464865648666486764868648696487064871648726487364874648756487664877648786487964880648816488264883648846488564886648876488864889648906489164892648936489464895648966489764898648996490064901649026490364904649056490664907649086490964910649116491264913649146491564916649176491864919649206492164922649236492464925649266492764928649296493064931649326493364934649356493664937649386493964940649416494264943649446494564946649476494864949649506495164952649536495464955649566495764958649596496064961649626496364964649656496664967649686496964970649716497264973649746497564976649776497864979649806498164982649836498464985649866498764988649896499064991649926499364994649956499664997649986499965000650016500265003650046500565006650076500865009650106501165012650136501465015650166501765018650196502065021650226502365024650256502665027650286502965030650316503265033650346503565036650376503865039650406504165042650436504465045650466504765048650496505065051650526505365054650556505665057650586505965060650616506265063650646506565066650676506865069650706507165072650736507465075650766507765078650796508065081650826508365084650856508665087650886508965090650916509265093650946509565096650976509865099651006510165102651036510465105651066510765108651096511065111651126511365114651156511665117651186511965120651216512265123651246512565126651276512865129651306513165132651336513465135651366513765138651396514065141651426514365144651456514665147651486514965150651516515265153651546515565156651576515865159651606516165162651636516465165651666516765168651696517065171651726517365174651756517665177651786517965180651816518265183651846518565186651876518865189651906519165192651936519465195651966519765198651996520065201652026520365204652056520665207652086520965210652116521265213652146521565216652176521865219652206522165222652236522465225652266522765228652296523065231652326523365234652356523665237652386523965240652416524265243652446524565246652476524865249652506525165252652536525465255652566525765258652596526065261652626526365264652656526665267652686526965270652716527265273652746527565276652776527865279652806528165282652836528465285652866528765288652896529065291652926529365294652956529665297652986529965300653016530265303653046530565306653076530865309653106531165312653136531465315653166531765318653196532065321653226532365324653256532665327653286532965330653316533265333653346533565336653376533865339653406534165342653436534465345653466534765348653496535065351653526535365354653556535665357653586535965360653616536265363653646536565366653676536865369653706537165372653736537465375653766537765378653796538065381653826538365384653856538665387653886538965390653916539265393653946539565396653976539865399654006540165402654036540465405654066540765408654096541065411654126541365414654156541665417654186541965420654216542265423654246542565426654276542865429654306543165432654336543465435654366543765438654396544065441654426544365444654456544665447654486544965450654516545265453654546545565456654576545865459654606546165462654636546465465654666546765468654696547065471654726547365474654756547665477654786547965480654816548265483654846548565486654876548865489654906549165492654936549465495654966549765498654996550065501655026550365504655056550665507655086550965510655116551265513655146551565516655176551865519655206552165522655236552465525655266552765528655296553065531655326553365534655356553665537655386553965540655416554265543655446554565546655476554865549655506555165552655536555465555655566555765558655596556065561655626556365564655656556665567655686556965570655716557265573655746557565576655776557865579655806558165582655836558465585655866558765588655896559065591655926559365594655956559665597655986559965600656016560265603656046560565606656076560865609656106561165612656136561465615656166561765618656196562065621656226562365624656256562665627656286562965630656316563265633656346563565636656376563865639656406564165642656436564465645656466564765648656496565065651656526565365654656556565665657656586565965660656616566265663656646566565666656676566865669656706567165672656736567465675656766567765678656796568065681656826568365684656856568665687656886568965690656916569265693656946569565696656976569865699657006570165702657036570465705657066570765708657096571065711657126571365714657156571665717657186571965720657216572265723657246572565726657276572865729657306573165732657336573465735657366573765738657396574065741657426574365744657456574665747657486574965750657516575265753657546575565756657576575865759657606576165762657636576465765657666576765768657696577065771657726577365774657756577665777657786577965780657816578265783657846578565786657876578865789657906579165792657936579465795657966579765798657996580065801658026580365804658056580665807658086580965810658116581265813658146581565816658176581865819658206582165822658236582465825658266582765828658296583065831658326583365834658356583665837658386583965840658416584265843658446584565846658476584865849658506585165852658536585465855658566585765858658596586065861658626586365864658656586665867658686586965870658716587265873658746587565876658776587865879658806588165882658836588465885658866588765888658896589065891658926589365894658956589665897658986589965900659016590265903659046590565906659076590865909659106591165912659136591465915659166591765918659196592065921659226592365924659256592665927659286592965930659316593265933659346593565936659376593865939659406594165942659436594465945659466594765948659496595065951659526595365954659556595665957659586595965960659616596265963659646596565966659676596865969659706597165972659736597465975659766597765978659796598065981659826598365984659856598665987659886598965990659916599265993659946599565996659976599865999660006600166002660036600466005660066600766008660096601066011660126601366014660156601666017660186601966020660216602266023660246602566026660276602866029660306603166032660336603466035660366603766038660396604066041660426604366044660456604666047660486604966050660516605266053660546605566056660576605866059660606606166062660636606466065660666606766068660696607066071660726607366074660756607666077660786607966080660816608266083660846608566086660876608866089660906609166092660936609466095660966609766098660996610066101661026610366104661056610666107661086610966110661116611266113661146611566116661176611866119661206612166122661236612466125661266612766128661296613066131661326613366134661356613666137661386613966140661416614266143661446614566146661476614866149661506615166152661536615466155661566615766158661596616066161661626616366164661656616666167661686616966170661716617266173661746617566176661776617866179661806618166182661836618466185661866618766188661896619066191661926619366194661956619666197661986619966200662016620266203662046620566206662076620866209662106621166212662136621466215662166621766218662196622066221662226622366224662256622666227662286622966230662316623266233662346623566236662376623866239662406624166242662436624466245662466624766248662496625066251662526625366254662556625666257662586625966260662616626266263662646626566266662676626866269662706627166272662736627466275662766627766278662796628066281662826628366284662856628666287662886628966290662916629266293662946629566296662976629866299663006630166302663036630466305663066630766308663096631066311663126631366314663156631666317663186631966320663216632266323663246632566326663276632866329663306633166332663336633466335663366633766338663396634066341663426634366344663456634666347663486634966350663516635266353663546635566356663576635866359663606636166362663636636466365663666636766368663696637066371663726637366374663756637666377663786637966380663816638266383663846638566386663876638866389663906639166392663936639466395663966639766398663996640066401664026640366404664056640666407664086640966410664116641266413664146641566416664176641866419664206642166422664236642466425664266642766428664296643066431664326643366434664356643666437664386643966440664416644266443664446644566446664476644866449664506645166452664536645466455664566645766458664596646066461664626646366464664656646666467664686646966470664716647266473664746647566476664776647866479664806648166482664836648466485664866648766488664896649066491664926649366494664956649666497664986649966500665016650266503665046650566506665076650866509665106651166512665136651466515665166651766518665196652066521665226652366524665256652666527665286652966530665316653266533665346653566536665376653866539665406654166542665436654466545665466654766548665496655066551665526655366554665556655666557665586655966560665616656266563665646656566566665676656866569665706657166572665736657466575665766657766578665796658066581665826658366584665856658666587665886658966590665916659266593665946659566596665976659866599666006660166602666036660466605666066660766608666096661066611666126661366614666156661666617666186661966620666216662266623666246662566626666276662866629666306663166632666336663466635666366663766638666396664066641666426664366644666456664666647666486664966650666516665266653666546665566656666576665866659666606666166662666636666466665666666666766668666696667066671666726667366674666756667666677666786667966680666816668266683666846668566686666876668866689666906669166692666936669466695666966669766698666996670066701667026670366704667056670666707667086670966710667116671266713667146671566716667176671866719667206672166722667236672466725667266672766728667296673066731667326673366734667356673666737667386673966740667416674266743667446674566746667476674866749667506675166752667536675466755667566675766758667596676066761667626676366764667656676666767667686676966770667716677266773667746677566776667776677866779667806678166782667836678466785667866678766788667896679066791667926679366794667956679666797667986679966800668016680266803668046680566806668076680866809668106681166812668136681466815668166681766818668196682066821668226682366824668256682666827668286682966830668316683266833668346683566836668376683866839668406684166842668436684466845668466684766848668496685066851668526685366854668556685666857668586685966860668616686266863668646686566866668676686866869668706687166872668736687466875668766687766878668796688066881668826688366884668856688666887668886688966890668916689266893668946689566896668976689866899669006690166902669036690466905669066690766908669096691066911669126691366914669156691666917669186691966920669216692266923669246692566926669276692866929669306693166932669336693466935669366693766938669396694066941669426694366944669456694666947669486694966950669516695266953669546695566956669576695866959669606696166962669636696466965669666696766968669696697066971669726697366974669756697666977669786697966980669816698266983669846698566986669876698866989669906699166992669936699466995669966699766998669996700067001670026700367004670056700667007670086700967010670116701267013670146701567016670176701867019670206702167022670236702467025670266702767028670296703067031670326703367034670356703667037670386703967040670416704267043670446704567046670476704867049670506705167052670536705467055670566705767058670596706067061670626706367064670656706667067670686706967070670716707267073670746707567076670776707867079670806708167082670836708467085670866708767088670896709067091670926709367094670956709667097670986709967100671016710267103671046710567106671076710867109671106711167112671136711467115671166711767118671196712067121671226712367124671256712667127671286712967130671316713267133671346713567136671376713867139671406714167142671436714467145671466714767148671496715067151671526715367154671556715667157671586715967160671616716267163671646716567166671676716867169671706717167172671736717467175671766717767178671796718067181671826718367184671856718667187671886718967190671916719267193671946719567196671976719867199672006720167202672036720467205672066720767208672096721067211672126721367214672156721667217672186721967220672216722267223672246722567226672276722867229672306723167232672336723467235672366723767238672396724067241672426724367244672456724667247672486724967250672516725267253672546725567256672576725867259672606726167262672636726467265672666726767268672696727067271672726727367274672756727667277672786727967280672816728267283672846728567286672876728867289672906729167292672936729467295672966729767298672996730067301673026730367304673056730667307673086730967310673116731267313673146731567316673176731867319673206732167322673236732467325673266732767328673296733067331673326733367334673356733667337673386733967340673416734267343673446734567346673476734867349673506735167352673536735467355673566735767358673596736067361673626736367364673656736667367673686736967370673716737267373673746737567376673776737867379673806738167382673836738467385673866738767388673896739067391673926739367394673956739667397673986739967400674016740267403674046740567406674076740867409674106741167412674136741467415674166741767418674196742067421674226742367424674256742667427674286742967430674316743267433674346743567436674376743867439674406744167442674436744467445674466744767448674496745067451674526745367454674556745667457674586745967460674616746267463674646746567466674676746867469674706747167472674736747467475674766747767478674796748067481674826748367484674856748667487674886748967490674916749267493674946749567496674976749867499675006750167502675036750467505675066750767508675096751067511675126751367514675156751667517675186751967520675216752267523675246752567526675276752867529675306753167532675336753467535675366753767538675396754067541675426754367544675456754667547675486754967550675516755267553675546755567556675576755867559675606756167562675636756467565675666756767568675696757067571675726757367574675756757667577675786757967580675816758267583675846758567586675876758867589675906759167592675936759467595675966759767598675996760067601676026760367604676056760667607676086760967610676116761267613676146761567616676176761867619676206762167622676236762467625676266762767628676296763067631676326763367634676356763667637676386763967640676416764267643676446764567646676476764867649676506765167652676536765467655676566765767658676596766067661676626766367664676656766667667676686766967670676716767267673676746767567676676776767867679676806768167682676836768467685676866768767688676896769067691676926769367694676956769667697676986769967700677016770267703677046770567706677076770867709677106771167712677136771467715677166771767718677196772067721677226772367724677256772667727677286772967730677316773267733677346773567736677376773867739677406774167742677436774467745677466774767748677496775067751677526775367754677556775667757677586775967760677616776267763677646776567766677676776867769677706777167772677736777467775677766777767778677796778067781677826778367784677856778667787677886778967790677916779267793677946779567796677976779867799678006780167802678036780467805678066780767808678096781067811678126781367814678156781667817678186781967820678216782267823678246782567826678276782867829678306783167832678336783467835678366783767838678396784067841678426784367844678456784667847678486784967850678516785267853678546785567856678576785867859678606786167862678636786467865678666786767868678696787067871678726787367874678756787667877678786787967880678816788267883678846788567886678876788867889678906789167892678936789467895678966789767898678996790067901679026790367904679056790667907679086790967910679116791267913679146791567916679176791867919679206792167922679236792467925679266792767928679296793067931679326793367934679356793667937679386793967940679416794267943679446794567946679476794867949679506795167952679536795467955679566795767958679596796067961679626796367964679656796667967679686796967970679716797267973679746797567976679776797867979679806798167982679836798467985679866798767988679896799067991679926799367994679956799667997679986799968000680016800268003680046800568006680076800868009680106801168012680136801468015680166801768018680196802068021680226802368024680256802668027680286802968030680316803268033680346803568036680376803868039680406804168042680436804468045680466804768048680496805068051680526805368054680556805668057680586805968060680616806268063680646806568066680676806868069680706807168072680736807468075680766807768078680796808068081680826808368084680856808668087680886808968090680916809268093680946809568096680976809868099681006810168102681036810468105681066810768108681096811068111681126811368114681156811668117681186811968120681216812268123681246812568126681276812868129681306813168132681336813468135681366813768138681396814068141681426814368144681456814668147681486814968150681516815268153681546815568156681576815868159681606816168162681636816468165681666816768168681696817068171681726817368174681756817668177681786817968180681816818268183681846818568186681876818868189681906819168192681936819468195681966819768198681996820068201682026820368204682056820668207682086820968210682116821268213682146821568216682176821868219682206822168222682236822468225682266822768228682296823068231682326823368234682356823668237682386823968240682416824268243682446824568246682476824868249682506825168252682536825468255682566825768258682596826068261682626826368264682656826668267682686826968270682716827268273682746827568276682776827868279682806828168282682836828468285682866828768288682896829068291682926829368294682956829668297682986829968300683016830268303683046830568306683076830868309683106831168312683136831468315683166831768318683196832068321683226832368324683256832668327683286832968330683316833268333683346833568336683376833868339683406834168342683436834468345683466834768348683496835068351683526835368354683556835668357683586835968360683616836268363683646836568366683676836868369683706837168372683736837468375683766837768378683796838068381683826838368384683856838668387683886838968390683916839268393683946839568396683976839868399684006840168402684036840468405684066840768408684096841068411684126841368414684156841668417684186841968420684216842268423684246842568426684276842868429684306843168432684336843468435684366843768438684396844068441684426844368444684456844668447684486844968450684516845268453684546845568456684576845868459684606846168462684636846468465684666846768468684696847068471684726847368474684756847668477684786847968480684816848268483684846848568486684876848868489684906849168492684936849468495684966849768498684996850068501685026850368504685056850668507685086850968510685116851268513685146851568516685176851868519685206852168522685236852468525685266852768528685296853068531685326853368534685356853668537685386853968540685416854268543685446854568546685476854868549685506855168552685536855468555685566855768558685596856068561685626856368564685656856668567685686856968570685716857268573685746857568576685776857868579685806858168582685836858468585685866858768588685896859068591685926859368594685956859668597685986859968600686016860268603686046860568606686076860868609686106861168612686136861468615686166861768618686196862068621686226862368624686256862668627686286862968630686316863268633686346863568636686376863868639686406864168642686436864468645686466864768648686496865068651686526865368654686556865668657686586865968660686616866268663686646866568666686676866868669686706867168672686736867468675686766867768678686796868068681686826868368684686856868668687686886868968690686916869268693686946869568696686976869868699687006870168702687036870468705687066870768708687096871068711687126871368714687156871668717687186871968720687216872268723687246872568726687276872868729687306873168732687336873468735687366873768738687396874068741687426874368744687456874668747687486874968750687516875268753687546875568756687576875868759687606876168762687636876468765687666876768768687696877068771687726877368774687756877668777687786877968780687816878268783687846878568786687876878868789687906879168792687936879468795687966879768798687996880068801688026880368804688056880668807688086880968810688116881268813688146881568816688176881868819688206882168822688236882468825688266882768828688296883068831688326883368834688356883668837688386883968840688416884268843688446884568846688476884868849688506885168852688536885468855688566885768858688596886068861688626886368864688656886668867688686886968870688716887268873688746887568876688776887868879688806888168882688836888468885688866888768888688896889068891688926889368894688956889668897688986889968900689016890268903689046890568906689076890868909689106891168912689136891468915689166891768918689196892068921689226892368924689256892668927689286892968930689316893268933689346893568936689376893868939689406894168942689436894468945689466894768948689496895068951689526895368954689556895668957689586895968960689616896268963689646896568966689676896868969689706897168972689736897468975689766897768978689796898068981689826898368984689856898668987689886898968990689916899268993689946899568996689976899868999690006900169002690036900469005690066900769008690096901069011690126901369014690156901669017690186901969020690216902269023690246902569026690276902869029690306903169032690336903469035690366903769038690396904069041690426904369044690456904669047690486904969050690516905269053690546905569056690576905869059690606906169062690636906469065690666906769068690696907069071690726907369074690756907669077690786907969080690816908269083690846908569086690876908869089690906909169092690936909469095690966909769098690996910069101691026910369104691056910669107691086910969110691116911269113691146911569116691176911869119691206912169122691236912469125691266912769128691296913069131691326913369134691356913669137691386913969140691416914269143691446914569146691476914869149691506915169152691536915469155691566915769158691596916069161691626916369164691656916669167691686916969170691716917269173691746917569176691776917869179691806918169182691836918469185691866918769188691896919069191691926919369194691956919669197691986919969200692016920269203692046920569206692076920869209692106921169212692136921469215692166921769218692196922069221692226922369224692256922669227692286922969230692316923269233692346923569236692376923869239692406924169242692436924469245692466924769248692496925069251692526925369254692556925669257692586925969260692616926269263692646926569266692676926869269692706927169272692736927469275692766927769278692796928069281692826928369284692856928669287692886928969290692916929269293692946929569296692976929869299693006930169302693036930469305693066930769308693096931069311693126931369314693156931669317693186931969320693216932269323693246932569326693276932869329693306933169332693336933469335693366933769338693396934069341693426934369344693456934669347693486934969350693516935269353693546935569356693576935869359693606936169362693636936469365693666936769368693696937069371693726937369374693756937669377693786937969380693816938269383693846938569386693876938869389693906939169392693936939469395693966939769398693996940069401694026940369404694056940669407694086940969410694116941269413694146941569416694176941869419694206942169422694236942469425694266942769428694296943069431694326943369434694356943669437694386943969440694416944269443694446944569446694476944869449694506945169452694536945469455694566945769458694596946069461694626946369464694656946669467694686946969470694716947269473694746947569476694776947869479694806948169482694836948469485694866948769488694896949069491694926949369494694956949669497694986949969500695016950269503695046950569506695076950869509695106951169512695136951469515695166951769518695196952069521695226952369524695256952669527695286952969530695316953269533695346953569536695376953869539695406954169542695436954469545695466954769548695496955069551695526955369554695556955669557695586955969560695616956269563695646956569566695676956869569695706957169572
  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. (function () {
  1007. define('app',["require", "amber/es6-promise"], function (require, promiseLib) {
  1008. promiseLib.polyfill();
  1009. return new Promise(function (resolve, reject) {
  1010. require(["__app__"], resolve, reject);
  1011. });
  1012. });
  1013. }());
  1014. //jshint eqnull:true
  1015. define('amber/kernel-runtime',[],function () {
  1016. "use strict";
  1017. function defineMethod (klass, name, method) {
  1018. Object.defineProperty(klass.prototype, name, {
  1019. value: method,
  1020. enumerable: false, configurable: true, writable: true
  1021. });
  1022. }
  1023. function installJSMethod (obj, jsSelector, fn) {
  1024. Object.defineProperty(obj, jsSelector, {
  1025. value: fn,
  1026. enumerable: false, configurable: true, writable: true
  1027. });
  1028. }
  1029. RuntimeSelectorsBrik.deps = ["selectors", "selectorConversion", "smalltalkGlobals", "classes"];
  1030. function RuntimeSelectorsBrik (brikz, st) {
  1031. var selectors = brikz.selectors.selectors;
  1032. var globals = brikz.smalltalkGlobals.globals;
  1033. var nilAsClass = brikz.classes.nilAsClass;
  1034. var st2js = brikz.selectorConversion.st2js;
  1035. var jsSelectors = this.jsSelectors = [];
  1036. /* Method not implemented handlers */
  1037. function installNewSelectors (newSelectors, targetClasses) {
  1038. newSelectors.forEach(function (selector) {
  1039. var jsSelector = st2js(selector);
  1040. jsSelectors.push(jsSelector);
  1041. var fn = createDnuHandler(selector);
  1042. installJSMethod(nilAsClass.fn.prototype, jsSelector, fn);
  1043. targetClasses.forEach(function (target) {
  1044. installJSMethod(target.fn.prototype, jsSelector, fn);
  1045. });
  1046. });
  1047. }
  1048. this.installNewSelectors = installNewSelectors;
  1049. /* Dnu handler method */
  1050. function createDnuHandler (stSelector) {
  1051. return function () {
  1052. return globals.Message._selector_arguments_notUnderstoodBy_(
  1053. stSelector, [].slice.call(arguments), this
  1054. );
  1055. };
  1056. }
  1057. installNewSelectors(selectors, []);
  1058. }
  1059. RuntimeClassesBrik.deps = ["event", "smalltalkGlobals", "runtimeSelectors", "behaviors", "classes", "runtimeMethods"];
  1060. function RuntimeClassesBrik (brikz, st) {
  1061. var globals = brikz.smalltalkGlobals.globals;
  1062. var jsSelectors = brikz.runtimeSelectors.jsSelectors;
  1063. var installNewSelectors = brikz.runtimeSelectors.installNewSelectors;
  1064. var installMethod = brikz.runtimeMethods.installMethod;
  1065. var traitsOrClasses = brikz.behaviors.traitsOrClasses;
  1066. var wireKlass = brikz.classes.wireKlass;
  1067. var emit = brikz.event.emit;
  1068. var detachedRootClasses = [];
  1069. function markClassDetachedRoot (klass) {
  1070. klass.detachedRoot = true;
  1071. detachedRootClasses = traitsOrClasses.filter(function (klass) {
  1072. return klass.detachedRoot;
  1073. });
  1074. }
  1075. emit.selectorsAdded = function (newSelectors) {
  1076. installNewSelectors(newSelectors, detachedRootClasses);
  1077. };
  1078. /* Initialize a class in its class hierarchy. Handle both classes and
  1079. metaclasses. */
  1080. function initClassAndMetaclass (klass) {
  1081. initClass(klass);
  1082. if (klass.a$cls && !klass.meta) {
  1083. initClass(klass.a$cls);
  1084. }
  1085. }
  1086. traitsOrClasses.forEach(function (traitOrClass) {
  1087. if (!traitOrClass.trait) initClassAndMetaclass(traitOrClass);
  1088. });
  1089. emit.classAdded = function (klass) {
  1090. initClassAndMetaclass(klass);
  1091. klass._enterOrganization();
  1092. };
  1093. emit.traitAdded = function (trait) {
  1094. trait._enterOrganization();
  1095. };
  1096. emit.classRemoved = function (klass) {
  1097. klass._leaveOrganization();
  1098. };
  1099. emit.traitRemoved = function (trait) {
  1100. trait._leaveOrganization();
  1101. };
  1102. function initClass (klass) {
  1103. wireKlass(klass);
  1104. if (klass.detachedRoot) {
  1105. copySuperclass(klass);
  1106. }
  1107. installMethods(klass);
  1108. }
  1109. function copySuperclass (klass) {
  1110. var myproto = klass.fn.prototype,
  1111. superproto = klass.superclass.fn.prototype;
  1112. jsSelectors.forEach(function (jsSelector) {
  1113. installJSMethod(myproto, jsSelector, superproto[jsSelector]);
  1114. });
  1115. }
  1116. function installMethods (klass) {
  1117. var methods = klass.methods;
  1118. Object.keys(methods).forEach(function (selector) {
  1119. installMethod(methods[selector], klass);
  1120. });
  1121. }
  1122. /* Create an alias for an existing class */
  1123. st.alias = function (traitOrClass, alias) {
  1124. globals[alias] = traitOrClass;
  1125. };
  1126. /* Manually set the constructor of an existing Smalltalk klass, making it a detached root class. */
  1127. st.setClassConstructor = this.setClassConstructor = function (klass, constructor) {
  1128. markClassDetachedRoot(klass);
  1129. klass.fn = constructor;
  1130. initClass(klass);
  1131. };
  1132. }
  1133. FrameBindingBrik.deps = ["smalltalkGlobals", "runtimeClasses"];
  1134. function FrameBindingBrik (brikz, st) {
  1135. var globals = brikz.smalltalkGlobals.globals;
  1136. var setClassConstructor = brikz.runtimeClasses.setClassConstructor;
  1137. setClassConstructor(globals.Number, Number);
  1138. setClassConstructor(globals.BlockClosure, Function);
  1139. setClassConstructor(globals.Boolean, Boolean);
  1140. setClassConstructor(globals.Date, Date);
  1141. setClassConstructor(globals.String, String);
  1142. setClassConstructor(globals.Array, Array);
  1143. setClassConstructor(globals.RegularExpression, RegExp);
  1144. setClassConstructor(globals.Error, Error);
  1145. setClassConstructor(globals.Promise, Promise);
  1146. this.__init__ = function () {
  1147. st.alias(globals.Array, "OrderedCollection");
  1148. st.alias(globals.Date, "Time");
  1149. }
  1150. }
  1151. RuntimeMethodsBrik.deps = ["event", "selectorConversion"];
  1152. function RuntimeMethodsBrik (brikz, st) {
  1153. var st2js = brikz.selectorConversion.st2js;
  1154. var emit = brikz.event.emit;
  1155. function installMethod (method, klass) {
  1156. var jsSelector = method.jsSelector;
  1157. if (!jsSelector) {
  1158. jsSelector = method.jsSelector = st2js(method.selector);
  1159. }
  1160. installJSMethod(klass.fn.prototype, jsSelector, method.fn);
  1161. }
  1162. this.installMethod = installMethod;
  1163. emit.behaviorMethodAdded = function (method, klass) {
  1164. installMethod(method, klass);
  1165. propagateMethodChange(klass, method, klass);
  1166. };
  1167. emit.behaviorMethodRemoved = function (method, klass) {
  1168. delete klass.fn.prototype[method.jsSelector];
  1169. propagateMethodChange(klass, method, null);
  1170. };
  1171. emit.methodReplaced = function (newMethod, oldMethod, traitOrBehavior) {
  1172. traitOrBehavior._methodOrganizationEnter_andLeave_(newMethod, oldMethod);
  1173. };
  1174. function propagateMethodChange (klass, method, exclude) {
  1175. var selector = method.selector;
  1176. var jsSelector = method.jsSelector;
  1177. st.traverseClassTree(klass, function (subclass, sentinel) {
  1178. if (subclass === exclude) return;
  1179. if (subclass.methods[selector]) return sentinel;
  1180. if (subclass.detachedRoot) {
  1181. installJSMethod(subclass.fn.prototype, jsSelector, subclass.superclass.fn.prototype[jsSelector]);
  1182. }
  1183. });
  1184. }
  1185. }
  1186. PrimitivesBrik.deps = ["smalltalkGlobals"];
  1187. function PrimitivesBrik (brikz, st) {
  1188. var globals = brikz.smalltalkGlobals.globals;
  1189. /* Converts a JavaScript object to valid Smalltalk Object */
  1190. st.readJSObject = function (js) {
  1191. if (js == null) return null;
  1192. else if (Array.isArray(js)) return js.map(st.readJSObject);
  1193. else if (js.constructor !== Object) return js;
  1194. var pairs = [];
  1195. for (var i in js) {
  1196. pairs.push(i, st.readJSObject(js[i]));
  1197. }
  1198. return globals.Dictionary._newFromPairs_(pairs);
  1199. };
  1200. /* Boolean assertion */
  1201. st.assert = function (shouldBeBoolean) {
  1202. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  1203. else if (shouldBeBoolean != null && typeof shouldBeBoolean === "object") {
  1204. shouldBeBoolean = shouldBeBoolean.valueOf();
  1205. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  1206. }
  1207. globals.NonBooleanReceiver._signalOn_(shouldBeBoolean);
  1208. };
  1209. }
  1210. RuntimeBrik.deps = ["selectorConversion", "smalltalkGlobals", "runtimeClasses"];
  1211. function RuntimeBrik (brikz, st) {
  1212. var globals = brikz.smalltalkGlobals.globals;
  1213. var setClassConstructor = brikz.runtimeClasses.setClassConstructor;
  1214. function SmalltalkMethodContext (home, setup) {
  1215. // TODO lazy fill of .sendIdx
  1216. this.sendIdx = {};
  1217. // TODO very likely .senderContext, not .homeContext here
  1218. this.homeContext = home;
  1219. this.setup = setup;
  1220. }
  1221. // Fallbacks
  1222. SmalltalkMethodContext.prototype.supercall = false;
  1223. SmalltalkMethodContext.prototype.locals = Object.freeze({});
  1224. SmalltalkMethodContext.prototype.receiver = null;
  1225. SmalltalkMethodContext.prototype.selector = null;
  1226. SmalltalkMethodContext.prototype.lookupClass = null;
  1227. SmalltalkMethodContext.prototype.outerContext = null;
  1228. SmalltalkMethodContext.prototype.index = 0;
  1229. defineMethod(SmalltalkMethodContext, "fill", function (receiver, selector, locals, lookupClass) {
  1230. this.receiver = receiver;
  1231. this.selector = selector;
  1232. if (locals != null) this.locals = locals;
  1233. this.lookupClass = lookupClass;
  1234. if (this.homeContext) {
  1235. this.homeContext.evaluatedSelector = selector;
  1236. }
  1237. });
  1238. defineMethod(SmalltalkMethodContext, "fillBlock", function (locals, ctx, index) {
  1239. if (locals != null) this.locals = locals;
  1240. this.outerContext = ctx;
  1241. if (index) this.index = index;
  1242. });
  1243. defineMethod(SmalltalkMethodContext, "method", function () {
  1244. var method;
  1245. var lookup = this.lookupClass || this.receiver.a$cls;
  1246. while (!method && lookup) {
  1247. method = lookup.methods[st.js2st(this.selector)];
  1248. lookup = lookup.superclass;
  1249. }
  1250. return method;
  1251. });
  1252. setClassConstructor(globals.MethodContext, SmalltalkMethodContext);
  1253. /* This is the current call context object.
  1254. In Smalltalk code, it is accessible just by using 'thisContext' variable.
  1255. In JS code, use api.getThisContext() (see below).
  1256. */
  1257. var thisContext = null;
  1258. /*
  1259. Runs worker function so that error handler is not set up
  1260. if there isn't one. This is accomplished by unconditional
  1261. wrapping inside a context of a simulated `nil seamlessDoIt` call,
  1262. which then stops error handler setup (see st.withContext above).
  1263. The effect is, $core.seamless(fn)'s exceptions are not
  1264. handed into ST error handler and caller should process them.
  1265. */
  1266. st.seamless = function (worker) {
  1267. var oldContext = thisContext;
  1268. thisContext = new SmalltalkMethodContext(thisContext, function (ctx) {
  1269. ctx.fill(null, "seamlessDoIt", {}, globals.UndefinedObject);
  1270. });
  1271. var result = worker(thisContext);
  1272. thisContext = oldContext;
  1273. return result;
  1274. };
  1275. function resultWithErrorHandling (worker) {
  1276. try {
  1277. return worker(thisContext);
  1278. } catch (error) {
  1279. globals.ErrorHandler._handleError_(error);
  1280. thisContext = null;
  1281. // Rethrow the error in any case.
  1282. throw error;
  1283. }
  1284. }
  1285. /*
  1286. Standard way to run within context.
  1287. Sets up error handler if entering first ST context in a stack.
  1288. */
  1289. st.withContext = function (worker, setup) {
  1290. var oldContext = thisContext;
  1291. thisContext = new SmalltalkMethodContext(thisContext, setup);
  1292. var result = oldContext == null ? resultWithErrorHandling(worker) : worker(thisContext);
  1293. thisContext = oldContext;
  1294. return result;
  1295. };
  1296. /* Handle thisContext pseudo variable */
  1297. st.getThisContext = function () {
  1298. if (!thisContext) return null;
  1299. for (var frame = thisContext; frame; frame = frame.homeContext) {
  1300. frame.setup(frame);
  1301. }
  1302. return thisContext;
  1303. };
  1304. }
  1305. MessageSendBrik.deps = ["smalltalkGlobals", "selectorConversion", "root"];
  1306. function MessageSendBrik (brikz, st) {
  1307. var globals = brikz.smalltalkGlobals.globals;
  1308. var nilAsReceiver = brikz.root.nilAsReceiver;
  1309. /* Send message programmatically. Used to implement #perform: & Co. */
  1310. st.send2 = function (self, selector, args, klass) {
  1311. if (self == null) {
  1312. self = nilAsReceiver;
  1313. }
  1314. var method = klass ? klass.fn.prototype[st.st2js(selector)] : self.a$cls && self[st.st2js(selector)];
  1315. return method != null ?
  1316. method.apply(self, args || []) :
  1317. globals.Message._selector_arguments_notUnderstoodBy_(
  1318. selector, [].slice.call(args), self.a$cls ? self : wrapJavaScript(self)
  1319. );
  1320. };
  1321. function wrapJavaScript (o) {
  1322. return globals.JSObjectProxy._on_(o);
  1323. }
  1324. st.wrapJavaScript = wrapJavaScript;
  1325. /* If the object property is a function, then call it, except if it starts with
  1326. an uppercase character (we probably want to answer the function itself in this
  1327. case and send it #new from Amber).
  1328. */
  1329. st.accessJavaScript = function (self, propertyName, args) {
  1330. var propertyValue = self[propertyName];
  1331. if (typeof propertyValue === "function" && !/^[A-Z]/.test(propertyName)) {
  1332. return propertyValue.apply(self, args);
  1333. } else if (args.length === 0) {
  1334. return propertyValue;
  1335. } else {
  1336. self[propertyName] = args[0];
  1337. return self;
  1338. }
  1339. };
  1340. }
  1341. function SelectorConversionBrik (brikz, st) {
  1342. var st2jsMemo = Object.create(null);
  1343. /* Convert a Smalltalk selector into a JS selector */
  1344. function st2js (string) {
  1345. return '_' + string
  1346. .replace(/:/g, '_')
  1347. .replace(/[\&]/g, '_and')
  1348. .replace(/[\|]/g, '_or')
  1349. .replace(/[+]/g, '_plus')
  1350. .replace(/-/g, '_minus')
  1351. .replace(/[*]/g, '_star')
  1352. .replace(/[\/]/g, '_slash')
  1353. .replace(/[\\]/g, '_backslash')
  1354. .replace(/[\~]/g, '_tild')
  1355. .replace(/%/g, '_percent')
  1356. .replace(/>/g, '_gt')
  1357. .replace(/</g, '_lt')
  1358. .replace(/=/g, '_eq')
  1359. .replace(/,/g, '_comma')
  1360. .replace(/[@]/g, '_at');
  1361. };
  1362. st.st2js = function (stSelector) {
  1363. return st2jsMemo[stSelector] || st2js(stSelector);
  1364. };
  1365. this.st2js = function (stSelector) {
  1366. return st2jsMemo[stSelector] || (st2jsMemo[stSelector] = st2js(stSelector));
  1367. };
  1368. /* Convert a string to a valid smalltalk selector.
  1369. if you modify the following functions, also change st2js
  1370. accordingly */
  1371. st.js2st = function (selector) {
  1372. if (selector.match(/^__/)) {
  1373. return binaryJsToSt(selector);
  1374. } else {
  1375. return keywordJsToSt(selector);
  1376. }
  1377. };
  1378. function keywordJsToSt (selector) {
  1379. return selector.replace(/^_/, '').replace(/_/g, ':');
  1380. }
  1381. function binaryJsToSt (selector) {
  1382. return selector
  1383. .replace(/^_/, '')
  1384. .replace(/_and/g, '&')
  1385. .replace(/_or/g, '|')
  1386. .replace(/_plus/g, '+')
  1387. .replace(/_minus/g, '-')
  1388. .replace(/_star/g, '*')
  1389. .replace(/_slash/g, '/')
  1390. .replace(/_backslash/g, '\\')
  1391. .replace(/_tild/g, '~')
  1392. .replace(/_percent/g, '%')
  1393. .replace(/_gt/g, '>')
  1394. .replace(/_lt/g, '<')
  1395. .replace(/_eq/g, '=')
  1396. .replace(/_comma/g, ',')
  1397. .replace(/_at/g, '@');
  1398. }
  1399. st.st2prop = function (stSelector) {
  1400. var colonPosition = stSelector.indexOf(':');
  1401. return colonPosition === -1 ? stSelector : stSelector.slice(0, colonPosition);
  1402. };
  1403. }
  1404. StartImageBrik.deps = ["smalltalkGlobals"];
  1405. function StartImageBrik (brikz, st) {
  1406. var globals = brikz.smalltalkGlobals.globals;
  1407. this.run = function () {
  1408. return globals.AmberBootstrapInitialization._run();
  1409. };
  1410. }
  1411. /* Making smalltalk that can run */
  1412. function configureWithRuntime (brikz) {
  1413. brikz.runtimeSelectors = RuntimeSelectorsBrik;
  1414. brikz.runtimeClasses = RuntimeClassesBrik;
  1415. brikz.frameBinding = FrameBindingBrik;
  1416. brikz.runtimeMethods = RuntimeMethodsBrik;
  1417. brikz.messageSend = MessageSendBrik;
  1418. brikz.runtime = RuntimeBrik;
  1419. brikz.primitives = PrimitivesBrik;
  1420. brikz.selectorConversion = SelectorConversionBrik;
  1421. brikz.startImage = StartImageBrik;
  1422. brikz.rebuild();
  1423. }
  1424. return configureWithRuntime;
  1425. });
  1426. // Depend on each module that is loaded lazily.
  1427. // Add to packager tasks as dependency,
  1428. // so the lazy-loaded modules are included.
  1429. define('amber/lazypack',['./kernel-runtime'], {});
  1430. //jshint eqnull:true
  1431. define('amber/kernel-checks',[],function () {
  1432. "use strict";
  1433. function assert (fn) {
  1434. try {
  1435. if (fn()) return;
  1436. } catch (ex) {
  1437. throw new Error("Error:\n" + ex + "in assertion:\n" + fn);
  1438. }
  1439. throw new Error("Assertion failed:\n" + fn);
  1440. }
  1441. assert(function () {
  1442. return !("hasOwnProperty" in Object.create(null));
  1443. });
  1444. assert(function () {
  1445. return Object.getPrototypeOf(Object.create(null)) === null;
  1446. });
  1447. assert(function () {
  1448. var p = {};
  1449. return Object.getPrototypeOf(Object.create(p)) === p;
  1450. });
  1451. // assert(function () {
  1452. // return new Function("return this")().Object === Object;
  1453. // });
  1454. // assert(function () {
  1455. // return Object.create(new Function("return this")()).Object === Object;
  1456. // });
  1457. assert(function () {
  1458. return typeof global !== "undefined";
  1459. });
  1460. assert(function () {
  1461. return global.Object === Object;
  1462. });
  1463. assert(function () {
  1464. return Object.create(global).Object === Object;
  1465. });
  1466. assert(function () {
  1467. return (function () {
  1468. return this;
  1469. }).apply(void 0) === void 0;
  1470. });
  1471. assert(function () {
  1472. return (function () {
  1473. return this;
  1474. }).apply(null) === null;
  1475. });
  1476. assert(function () {
  1477. return (function () {
  1478. return this;
  1479. }).apply(3) === 3;
  1480. });
  1481. assert(function () {
  1482. return (function () {
  1483. return this;
  1484. }).apply("foo") === "foo";
  1485. });
  1486. assert(function () {
  1487. return (function () {
  1488. return this;
  1489. }).apply(true) === true;
  1490. });
  1491. assert(function () {
  1492. var o = Object.freeze({});
  1493. try {
  1494. o.foo = "bar";
  1495. } catch (ex) {
  1496. }
  1497. return o.foo == null;
  1498. });
  1499. assert(function () {
  1500. return typeof Promise === "function";
  1501. });
  1502. assert(function () {
  1503. return typeof Promise.resolve === "function";
  1504. });
  1505. assert(function () {
  1506. return typeof Promise.reject === "function";
  1507. });
  1508. assert(function () {
  1509. return typeof new Promise(function () {
  1510. }).then === "function";
  1511. });
  1512. });
  1513. define('amber/brikz',[], function () {
  1514. return function Brikz(api, apiKey, initKey) {
  1515. "use strict";
  1516. //jshint eqnull:true
  1517. var brikz = this,
  1518. backup = {};
  1519. apiKey = apiKey || 'exports';
  1520. initKey = initKey || '__init__';
  1521. function mixin(src, target, what) {
  1522. for (var keys = Object.keys(what || src), l = keys.length, i = 0; i < l; ++i) {
  1523. if (src == null) {
  1524. target[keys[i]] = undefined;
  1525. } else {
  1526. var value = src[keys[i]];
  1527. if (typeof value !== "undefined") {
  1528. target[keys[i]] = value;
  1529. }
  1530. }
  1531. }
  1532. return target;
  1533. }
  1534. Object.defineProperties(this, {
  1535. rebuild: { value: null, enumerable: false, configurable: true, writable: true }
  1536. });
  1537. var exclude = mixin(this, {});
  1538. this.rebuild = function () {
  1539. Object.keys(backup).forEach(function (key) {
  1540. mixin(null, api, (backup[key] || 0)[apiKey] || {});
  1541. });
  1542. var oapi = mixin(api, {}),
  1543. order = [],
  1544. chk = {};
  1545. function ensure(key) {
  1546. if (key in exclude) {
  1547. return null;
  1548. }
  1549. var b = brikz[key],
  1550. bak = backup[key];
  1551. mixin(null, api, api);
  1552. while (typeof b === "function") {
  1553. (b.deps || []).forEach(ensure);
  1554. b = new b(brikz, api, bak);
  1555. }
  1556. brikz[key] = b;
  1557. if (b && !chk[key]) {
  1558. chk[key] = true;
  1559. order.push(b);
  1560. }
  1561. if (b && !b[apiKey]) {
  1562. b[apiKey] = mixin(api, {});
  1563. }
  1564. }
  1565. Object.keys(brikz).forEach(ensure);
  1566. mixin(oapi, mixin(null, api, api));
  1567. order.forEach(function (brik) {
  1568. mixin(brik[apiKey] || {}, api);
  1569. });
  1570. order.forEach(function (brik) {
  1571. if (brik[initKey]) {
  1572. brik[initKey]();
  1573. if (brik[initKey].once) {
  1574. delete brik[initKey];
  1575. }
  1576. }
  1577. });
  1578. backup = mixin(brikz, {});
  1579. };
  1580. };
  1581. });
  1582. /* ====================================================================
  1583. |
  1584. | Amber Smalltalk
  1585. | http://amber-lang.net
  1586. |
  1587. ======================================================================
  1588. ======================================================================
  1589. |
  1590. | Copyright (c) 2010-2014
  1591. | Nicolas Petton <petton.nicolas@gmail.com>
  1592. |
  1593. | Copyright (c) 2012-2017
  1594. | The Amber team https://lolg.it/org/amber/members
  1595. | Amber contributors (see /CONTRIBUTORS)
  1596. |
  1597. | Amber is released under the MIT license
  1598. |
  1599. | Permission is hereby granted, free of charge, to any person obtaining
  1600. | a copy of this software and associated documentation files (the
  1601. | 'Software'), to deal in the Software without restriction, including
  1602. | without limitation the rights to use, copy, modify, merge, publish,
  1603. | distribute, sublicense, and/or sell copies of the Software, and to
  1604. | permit persons to whom the Software is furnished to do so, subject to
  1605. | the following conditions:
  1606. |
  1607. | The above copyright notice and this permission notice shall be
  1608. | included in all copies or substantial portions of the Software.
  1609. |
  1610. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  1611. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  1612. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  1613. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  1614. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  1615. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  1616. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  1617. |
  1618. ==================================================================== */
  1619. //jshint eqnull:true
  1620. define('amber/kernel-fundamentals',[],function () {
  1621. "use strict";
  1622. function inherits (child, parent) {
  1623. child.prototype = Object.create(parent.prototype, {
  1624. constructor: {
  1625. value: child,
  1626. enumerable: false, configurable: true, writable: true
  1627. }
  1628. });
  1629. return child;
  1630. }
  1631. function SmalltalkGlobalsBrik (brikz, st) {
  1632. var globals = Object.create(global);
  1633. globals.SmalltalkSettings = {};
  1634. this.globals = globals;
  1635. }
  1636. function EventBrik (brikz, st) {
  1637. var emit = {};
  1638. this.emit = emit;
  1639. this.declareEvent = function (event) {
  1640. if (!emit[event]) emit[event] = function () {
  1641. };
  1642. }
  1643. }
  1644. function RootBrik (brikz, st) {
  1645. /* Smalltalk foundational objects */
  1646. var coreFns = this.coreFns = {};
  1647. /* SmalltalkRoot is the hidden root of the normal Amber hierarchy.
  1648. All objects including `ProtoObject` inherit from SmalltalkRoot.
  1649. Detached roots (eg. wrapped JS classes like Number or Date)
  1650. do not directly inherit from SmalltalkRoot, but employ a workaround.*/
  1651. function SmalltalkRoot () {
  1652. }
  1653. function SmalltalkProtoObject () {
  1654. }
  1655. function SmalltalkObject () {
  1656. }
  1657. coreFns.ProtoObject = inherits(SmalltalkProtoObject, SmalltalkRoot);
  1658. coreFns.Object = inherits(SmalltalkObject, SmalltalkProtoObject);
  1659. this.Root = SmalltalkRoot;
  1660. this.Object = SmalltalkObject;
  1661. }
  1662. function SelectorsBrik (brikz, st) {
  1663. var selectorSet = Object.create(null);
  1664. var selectors = this.selectors = [];
  1665. this.registerSelector = function (stSelector) {
  1666. if (selectorSet[stSelector]) return false;
  1667. selectors.push(stSelector);
  1668. return selectorSet[stSelector] = true;
  1669. };
  1670. st.allSelectors = function () {
  1671. return selectors;
  1672. };
  1673. }
  1674. function PackagesBrik (brikz, st) {
  1675. st.packages = st.packageDescriptors = {};
  1676. /* Add a package load descriptor to the system */
  1677. st.addPackage = function (name, properties) {
  1678. if (!name) return null;
  1679. return st.packageDescriptors[name] = {properties: properties};
  1680. };
  1681. }
  1682. BehaviorsBrik.deps = ["root", "smalltalkGlobals", "arraySet"];
  1683. function BehaviorsBrik (brikz, st) {
  1684. var globals = brikz.smalltalkGlobals.globals;
  1685. var addElement = brikz.arraySet.addElement;
  1686. var removeElement = brikz.arraySet.removeElement;
  1687. /* Smalltalk classes and traits */
  1688. var traitsOrClasses = [];
  1689. this.buildTraitOrClass = function (category, builder) {
  1690. var traitOrClass = globals.hasOwnProperty(builder.name) && globals[builder.name];
  1691. if (traitOrClass) {
  1692. builder.updateExisting(traitOrClass);
  1693. } else {
  1694. traitOrClass = builder.make();
  1695. traitOrClass.category = category;
  1696. addTraitOrClass(traitOrClass);
  1697. }
  1698. return traitOrClass;
  1699. };
  1700. function addTraitOrClass (traitOrClass) {
  1701. globals[traitOrClass.name] = traitOrClass;
  1702. addElement(traitsOrClasses, traitOrClass);
  1703. traitOrClass.added();
  1704. }
  1705. function removeTraitOrClass (traitOrClass) {
  1706. traitOrClass.removed();
  1707. removeElement(traitsOrClasses, traitOrClass);
  1708. delete globals[traitOrClass.name];
  1709. }
  1710. this.removeTraitOrClass = removeTraitOrClass;
  1711. st.traitsOrClasses = this.traitsOrClasses = traitsOrClasses;
  1712. }
  1713. MethodsBrik.deps = ["event", "selectors", "root"];
  1714. function MethodsBrik (brikz, st) {
  1715. var registerSelector = brikz.selectors.registerSelector;
  1716. var SmalltalkObject = brikz.root.Object;
  1717. var coreFns = brikz.root.coreFns;
  1718. var emit = brikz.event.emit;
  1719. var declareEvent = brikz.event.declareEvent;
  1720. function SmalltalkMethod () {
  1721. }
  1722. coreFns.CompiledMethod = inherits(SmalltalkMethod, SmalltalkObject);
  1723. /* Smalltalk method object. To add a method to a class,
  1724. use api.addMethod() */
  1725. st.method = function (spec) {
  1726. var that = new SmalltalkMethod();
  1727. var selector = spec.selector;
  1728. that.selector = selector;
  1729. that.args = spec.args || [];
  1730. that.protocol = spec.protocol;
  1731. that.source = spec.source;
  1732. that.messageSends = spec.messageSends || [];
  1733. // TODO remove .referencedClasses, have .referencedGlobals
  1734. that.referencedClasses = spec.referencedClasses || [];
  1735. that.fn = spec.fn;
  1736. return that;
  1737. };
  1738. /* Add/remove a method to/from a class */
  1739. st.addMethod = function (method, traitOrBehavior) {
  1740. if (method.owner != null) {
  1741. throw new Error("addMethod: Method " + method.selector + " already bound to " + method.owner);
  1742. }
  1743. method.owner = traitOrBehavior;
  1744. // TODO deprecation helper; remove
  1745. Object.defineProperty(method, "methodClass", {
  1746. get: function () {
  1747. console.warn("Use of .methodClass deprecated, use .owner");
  1748. return method.owner;
  1749. },
  1750. set: function (v) {
  1751. console.warn("Use of .methodClass= deprecated, use .owner=");
  1752. method.owner = v;
  1753. }
  1754. });
  1755. registerNewSelectors(method);
  1756. traitOrBehavior.localMethods[method.selector] = method;
  1757. updateMethod(method.selector, traitOrBehavior);
  1758. };
  1759. declareEvent("selectorsAdded");
  1760. function registerNewSelectors (method) {
  1761. var newSelectors = [];
  1762. function selectorInUse (stSelector) {
  1763. if (registerSelector(stSelector)) {
  1764. newSelectors.push(stSelector);
  1765. }
  1766. }
  1767. selectorInUse(method.selector);
  1768. method.messageSends.forEach(selectorInUse);
  1769. emit.selectorsAdded(newSelectors);
  1770. }
  1771. st.removeMethod = function (method, traitOrBehavior) {
  1772. if (traitOrBehavior.localMethods[method.selector] !== method) return;
  1773. delete traitOrBehavior.localMethods[method.selector];
  1774. updateMethod(method.selector, traitOrBehavior);
  1775. };
  1776. this.setupMethods = function (traitOrBehavior) {
  1777. traitOrBehavior.localMethods = Object.create(null);
  1778. traitOrBehavior.methods = Object.create(null);
  1779. };
  1780. declareEvent("methodReplaced");
  1781. function updateMethod (selector, traitOrBehavior) {
  1782. var oldMethod = traitOrBehavior.methods[selector],
  1783. newMethod = traitOrBehavior.localMethods[selector];
  1784. if (oldMethod == null && newMethod == null) {
  1785. console.warn("Removal of nonexistent method " + traitOrBehavior + " >> " + selector);
  1786. return;
  1787. }
  1788. if (newMethod === oldMethod) return;
  1789. if (newMethod != null) {
  1790. traitOrBehavior.methods[selector] = newMethod;
  1791. traitOrBehavior.methodAdded(newMethod);
  1792. } else {
  1793. delete traitOrBehavior.methods[selector];
  1794. traitOrBehavior.methodRemoved(oldMethod);
  1795. }
  1796. emit.methodReplaced(newMethod, oldMethod, traitOrBehavior);
  1797. }
  1798. this.updateMethod = updateMethod;
  1799. }
  1800. function ArraySetBrik (brikz, st) {
  1801. st.addElement = this.addElement = function (array, el) {
  1802. if (typeof el === 'undefined') {
  1803. return;
  1804. }
  1805. if (array.indexOf(el) === -1) {
  1806. array.push(el);
  1807. }
  1808. };
  1809. st.removeElement = this.removeElement = function (array, el) {
  1810. var i = array.indexOf(el);
  1811. if (i !== -1) {
  1812. array.splice(i, 1);
  1813. }
  1814. };
  1815. }
  1816. NilBrik.deps = ["root"];
  1817. function NilBrik (brikz, st) {
  1818. var SmalltalkObject = brikz.root.Object;
  1819. var coreFns = brikz.root.coreFns;
  1820. function SmalltalkNil () {
  1821. }
  1822. coreFns.UndefinedObject = inherits(SmalltalkNil, SmalltalkObject);
  1823. this.nilAsReceiver = new SmalltalkNil();
  1824. this.nilAsValue = this.nilAsReceiver; // TODO null
  1825. // Adds an `a$nil` (and legacy `isNil`) property to the `nil` object. When sending
  1826. // nil objects from one environment to another, doing
  1827. // `anObject == nil` (in JavaScript) does not always answer
  1828. // true as the referenced nil object might come from the other
  1829. // environment.
  1830. Object.defineProperty(this.nilAsReceiver, 'a$nil', {
  1831. value: true,
  1832. enumerable: false, configurable: false, writable: false
  1833. });
  1834. Object.defineProperty(this.nilAsReceiver, 'isNil', {
  1835. value: true,
  1836. enumerable: false, configurable: false, writable: false
  1837. });
  1838. }
  1839. /* Making smalltalk that has basic building blocks */
  1840. function configureWithFundamentals (brikz) {
  1841. brikz.smalltalkGlobals = SmalltalkGlobalsBrik;
  1842. brikz.root = RootBrik;
  1843. brikz.nil = NilBrik;
  1844. brikz.event = EventBrik;
  1845. brikz.arraySet = ArraySetBrik;
  1846. brikz.selectors = SelectorsBrik;
  1847. brikz.packages = PackagesBrik;
  1848. brikz.behaviors = BehaviorsBrik;
  1849. brikz.methods = MethodsBrik;
  1850. brikz.rebuild();
  1851. }
  1852. return configureWithFundamentals;
  1853. });
  1854. /* ====================================================================
  1855. |
  1856. | Amber Smalltalk
  1857. | http://amber-lang.net
  1858. |
  1859. ======================================================================
  1860. ======================================================================
  1861. |
  1862. | Copyright (c) 2010-2014
  1863. | Nicolas Petton <petton.nicolas@gmail.com>
  1864. |
  1865. | Copyright (c) 2012-2017
  1866. | The Amber team https://lolg.it/org/amber/members
  1867. | Amber contributors (see /CONTRIBUTORS)
  1868. |
  1869. | Amber is released under the MIT license
  1870. |
  1871. | Permission is hereby granted, free of charge, to any person obtaining
  1872. | a copy of this software and associated documentation files (the
  1873. | 'Software'), to deal in the Software without restriction, including
  1874. | without limitation the rights to use, copy, modify, merge, publish,
  1875. | distribute, sublicense, and/or sell copies of the Software, and to
  1876. | permit persons to whom the Software is furnished to do so, subject to
  1877. | the following conditions:
  1878. |
  1879. | The above copyright notice and this permission notice shall be
  1880. | included in all copies or substantial portions of the Software.
  1881. |
  1882. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  1883. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  1884. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  1885. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  1886. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  1887. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  1888. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  1889. |
  1890. ==================================================================== */
  1891. //jshint eqnull:true
  1892. define('amber/kernel-language',[],function () {
  1893. "use strict";
  1894. function inherits (child, parent) {
  1895. child.prototype = Object.create(parent.prototype, {
  1896. constructor: {
  1897. value: child,
  1898. enumerable: false, configurable: true, writable: true
  1899. }
  1900. });
  1901. return child;
  1902. }
  1903. function defineMethod (klass, name, method) {
  1904. Object.defineProperty(klass.prototype, name, {
  1905. value: method,
  1906. enumerable: false, configurable: true, writable: true
  1907. });
  1908. }
  1909. TraitsBrik.deps = ["event", "behaviors", "methods", "composition", "root"];
  1910. function TraitsBrik (brikz, st) {
  1911. var coreFns = brikz.root.coreFns;
  1912. var SmalltalkObject = brikz.root.Object;
  1913. var setupMethods = brikz.methods.setupMethods;
  1914. var traitMethodChanged = brikz.composition.traitMethodChanged;
  1915. var buildTraitOrClass = brikz.behaviors.buildTraitOrClass;
  1916. var emit = brikz.event.emit;
  1917. var declareEvent = brikz.event.declareEvent;
  1918. function SmalltalkTrait () {
  1919. }
  1920. coreFns.Trait = inherits(SmalltalkTrait, SmalltalkObject);
  1921. SmalltalkTrait.prototype.trait = true;
  1922. defineMethod(SmalltalkTrait, "toString", function () {
  1923. return 'Smalltalk Trait ' + this.name;
  1924. });
  1925. declareEvent("traitAdded");
  1926. defineMethod(SmalltalkTrait, "added", function () {
  1927. emit.traitAdded(this);
  1928. });
  1929. declareEvent("traitRemoved");
  1930. defineMethod(SmalltalkTrait, "removed", function () {
  1931. emit.traitRemoved(this);
  1932. });
  1933. declareEvent("traitMethodAdded");
  1934. defineMethod(SmalltalkTrait, "methodAdded", function (method) {
  1935. var self = this;
  1936. this.traitUsers.forEach(function (each) {
  1937. traitMethodChanged(method.selector, method, self, each);
  1938. });
  1939. emit.traitMethodAdded(method, this);
  1940. });
  1941. declareEvent("traitMethodRemoved");
  1942. defineMethod(SmalltalkTrait, "methodRemoved", function (method) {
  1943. var self = this;
  1944. this.traitUsers.forEach(function (each) {
  1945. traitMethodChanged(method.selector, null, self, each);
  1946. });
  1947. emit.traitMethodRemoved(method, this);
  1948. });
  1949. function traitBuilder (traitName) {
  1950. return {
  1951. name: traitName,
  1952. make: function () {
  1953. var that = new SmalltalkTrait();
  1954. // TODO deprecation helper; remove
  1955. Object.defineProperty(that, "className", {
  1956. get: function () {
  1957. console.warn("Use of .className deprecated, use .name");
  1958. return that.name;
  1959. },
  1960. set: function (v) {
  1961. console.warn("Use of .className= deprecated, use .name=");
  1962. that.name = v;
  1963. }
  1964. });
  1965. that.name = traitName;
  1966. that.traitUsers = [];
  1967. setupMethods(that);
  1968. return that;
  1969. },
  1970. updateExisting: function (trait) {
  1971. }
  1972. };
  1973. }
  1974. st.addTrait = function (className, category) {
  1975. return buildTraitOrClass(category, traitBuilder(className));
  1976. };
  1977. }
  1978. MethodCompositionBrik.deps = ["methods", "arraySet"];
  1979. function MethodCompositionBrik (brikz, st) {
  1980. var updateMethod = brikz.methods.updateMethod;
  1981. var addElement = brikz.arraySet.addElement;
  1982. var removeElement = brikz.arraySet.removeElement;
  1983. function aliased (selector, method) {
  1984. if (method.selector === selector) return method;
  1985. var result = st.method({
  1986. selector: selector,
  1987. args: method.args,
  1988. protocol: method.protocol,
  1989. source: '"Aliased as ' + selector + '"\n' + method.source,
  1990. messageSends: method.messageSends,
  1991. referencesClasses: method.referencedClasses,
  1992. fn: method.fn
  1993. });
  1994. result.owner = method.owner;
  1995. return result;
  1996. }
  1997. function deleteKeysFrom (keys, obj) {
  1998. keys.forEach(function (each) {
  1999. delete obj[each];
  2000. });
  2001. }
  2002. function fillTraitTransformation (traitTransformation, obj) {
  2003. // assert(Object.getOwnProperties(obj).length === 0)
  2004. var traitMethods = traitTransformation.trait.methods;
  2005. Object.keys(traitMethods).forEach(function (selector) {
  2006. obj[selector] = traitMethods[selector];
  2007. });
  2008. var traitAliases = traitTransformation.aliases;
  2009. if (traitAliases) {
  2010. Object.keys(traitAliases).forEach(function (aliasSelector) {
  2011. var aliasedMethod = traitMethods[traitAliases[aliasSelector]];
  2012. if (aliasedMethod) obj[aliasSelector] = aliased(aliasSelector, aliasedMethod);
  2013. // else delete obj[aliasSelector]; // semantically correct; optimized away
  2014. });
  2015. }
  2016. var traitExclusions = traitTransformation.exclusions;
  2017. if (traitExclusions) {
  2018. deleteKeysFrom(traitExclusions, obj);
  2019. }
  2020. return obj;
  2021. }
  2022. function buildCompositionChain (traitComposition) {
  2023. return traitComposition.reduce(function (soFar, each) {
  2024. return fillTraitTransformation(each, Object.create(soFar));
  2025. }, null);
  2026. }
  2027. st.setTraitComposition = function (traitComposition, traitOrBehavior) {
  2028. var oldLocalMethods = traitOrBehavior.localMethods,
  2029. newLocalMethods = Object.create(buildCompositionChain(traitComposition));
  2030. Object.keys(oldLocalMethods).forEach(function (selector) {
  2031. newLocalMethods[selector] = oldLocalMethods[selector];
  2032. });
  2033. var selector;
  2034. traitOrBehavior.localMethods = newLocalMethods;
  2035. for (selector in newLocalMethods) {
  2036. updateMethod(selector, traitOrBehavior);
  2037. }
  2038. for (selector in oldLocalMethods) {
  2039. updateMethod(selector, traitOrBehavior);
  2040. }
  2041. (traitOrBehavior.traitComposition || []).forEach(function (each) {
  2042. removeElement(each.trait.traitUsers, traitOrBehavior);
  2043. });
  2044. traitOrBehavior.traitComposition = traitComposition && traitComposition.length ? traitComposition : null;
  2045. (traitOrBehavior.traitComposition || []).forEach(function (each) {
  2046. addElement(each.trait.traitUsers, traitOrBehavior);
  2047. });
  2048. };
  2049. function aliasesOfSelector (selector, traitAliases) {
  2050. if (!traitAliases) return [selector];
  2051. var result = Object.keys(traitAliases).filter(function (aliasSelector) {
  2052. return traitAliases[aliasSelector] === selector
  2053. });
  2054. if (!traitAliases[selector]) result.push(selector);
  2055. return result;
  2056. }
  2057. function applyTraitMethodAddition (selector, method, traitTransformation, obj) {
  2058. var changes = aliasesOfSelector(selector, traitTransformation.aliases);
  2059. changes.forEach(function (aliasSelector) {
  2060. obj[aliasSelector] = aliased(aliasSelector, method);
  2061. });
  2062. var traitExclusions = traitTransformation.exclusions;
  2063. if (traitExclusions) {
  2064. deleteKeysFrom(traitExclusions, obj);
  2065. }
  2066. return changes;
  2067. }
  2068. function applyTraitMethodDeletion (selector, traitTransformation, obj) {
  2069. var changes = aliasesOfSelector(selector, traitTransformation.aliases);
  2070. deleteKeysFrom(changes, obj);
  2071. return changes;
  2072. }
  2073. function traitMethodChanged (selector, method, trait, traitOrBehavior) {
  2074. var traitComposition = traitOrBehavior.traitComposition,
  2075. chain = traitOrBehavior.localMethods,
  2076. changes = [];
  2077. for (var i = traitComposition.length - 1; i >= 0; --i) {
  2078. chain = Object.getPrototypeOf(chain);
  2079. var traitTransformation = traitComposition[i];
  2080. if (traitTransformation.trait !== trait) continue;
  2081. changes.push.apply(changes, method ?
  2082. applyTraitMethodAddition(selector, method, traitTransformation, chain) :
  2083. applyTraitMethodDeletion(selector, traitTransformation, chain));
  2084. }
  2085. // assert(chain === null);
  2086. changes.forEach(function (each) {
  2087. updateMethod(each, traitOrBehavior);
  2088. });
  2089. }
  2090. this.traitMethodChanged = traitMethodChanged;
  2091. }
  2092. ClassesBrik.deps = ["root", "event", "behaviors", "methods", "arraySet", "smalltalkGlobals"];
  2093. function ClassesBrik (brikz, st) {
  2094. var SmalltalkRoot = brikz.root.Root;
  2095. var coreFns = brikz.root.coreFns;
  2096. var globals = brikz.smalltalkGlobals.globals;
  2097. var SmalltalkObject = brikz.root.Object;
  2098. var buildTraitOrClass = brikz.behaviors.buildTraitOrClass;
  2099. var setupMethods = brikz.methods.setupMethods;
  2100. var removeTraitOrClass = brikz.behaviors.removeTraitOrClass;
  2101. var addElement = brikz.arraySet.addElement;
  2102. var removeElement = brikz.arraySet.removeElement;
  2103. var emit = brikz.event.emit;
  2104. var declareEvent = brikz.event.declareEvent;
  2105. function SmalltalkBehavior () {
  2106. }
  2107. function SmalltalkClass () {
  2108. }
  2109. function SmalltalkMetaclass () {
  2110. }
  2111. coreFns.Behavior = inherits(SmalltalkBehavior, SmalltalkObject);
  2112. coreFns.Class = inherits(SmalltalkClass, SmalltalkBehavior);
  2113. coreFns.Metaclass = inherits(SmalltalkMetaclass, SmalltalkBehavior);
  2114. // Fake root class of the system.
  2115. // Effective superclass of all classes created with `nil subclass: ...`.
  2116. var nilAsClass = this.nilAsClass = {
  2117. fn: SmalltalkRoot,
  2118. a$cls: {fn: SmalltalkClass},
  2119. klass: {fn: SmalltalkClass}
  2120. };
  2121. SmalltalkMetaclass.prototype.meta = true;
  2122. defineMethod(SmalltalkClass, "toString", function () {
  2123. return 'Smalltalk ' + this.name;
  2124. });
  2125. defineMethod(SmalltalkMetaclass, "toString", function () {
  2126. return 'Smalltalk Metaclass ' + this.instanceClass.name;
  2127. });
  2128. declareEvent("classAdded");
  2129. defineMethod(SmalltalkClass, "added", function () {
  2130. addSubclass(this);
  2131. emit.classAdded(this);
  2132. });
  2133. declareEvent("classRemoved");
  2134. defineMethod(SmalltalkClass, "removed", function () {
  2135. emit.classRemoved(this);
  2136. removeSubclass(this);
  2137. });
  2138. declareEvent("behaviorMethodAdded");
  2139. defineMethod(SmalltalkBehavior, "methodAdded", function (method) {
  2140. emit.behaviorMethodAdded(method, this);
  2141. });
  2142. declareEvent("behaviorMethodRemove");
  2143. defineMethod(SmalltalkBehavior, "methodRemoved", function (method) {
  2144. emit.behaviorMethodRemoved(method, this);
  2145. });
  2146. this.bootstrapHierarchy = function () {
  2147. var nilSubclasses = [globals.ProtoObject];
  2148. nilAsClass.a$cls = nilAsClass.klass = globals.Class;
  2149. nilSubclasses.forEach(function (each) {
  2150. each.a$cls.superclass = globals.Class;
  2151. addSubclass(each.a$cls);
  2152. });
  2153. };
  2154. /* Smalltalk class creation. A class is an instance of an automatically
  2155. created metaclass object. Newly created classes (not their metaclass)
  2156. should be added to the system, see smalltalk.addClass().
  2157. Superclass linking is *not* handled here, see api.initialize() */
  2158. function classBuilder (className, superclass, iVarNames, fn) {
  2159. var logicalSuperclass = superclass;
  2160. if (superclass == null || superclass.a$nil) {
  2161. superclass = nilAsClass;
  2162. logicalSuperclass = null;
  2163. }
  2164. function klass () {
  2165. var that = metaclass().instanceClass;
  2166. that.superclass = logicalSuperclass;
  2167. that.fn = fn || inherits(function () {
  2168. }, superclass.fn);
  2169. that.iVarNames = iVarNames || [];
  2170. // TODO deprecation helper; remove
  2171. Object.defineProperty(that, "className", {
  2172. get: function () {
  2173. console.warn("Use of .className deprecated, use .name");
  2174. return that.name;
  2175. },
  2176. set: function (v) {
  2177. console.warn("Use of .className= deprecated, use .name=");
  2178. that.name = v;
  2179. }
  2180. });
  2181. that.name = className;
  2182. that.subclasses = [];
  2183. setupMethods(that);
  2184. return that;
  2185. }
  2186. function metaclass () {
  2187. var that = new SmalltalkMetaclass();
  2188. that.superclass = superclass.a$cls;
  2189. that.fn = inherits(function () {
  2190. }, that.superclass.fn);
  2191. that.iVarNames = [];
  2192. that.instanceClass = new that.fn();
  2193. wireKlass(that);
  2194. setupMethods(that);
  2195. return that;
  2196. }
  2197. return {
  2198. name: className,
  2199. make: klass,
  2200. updateExisting: function (klass) {
  2201. if (klass.superclass == logicalSuperclass && (!fn || fn === klass.fn)) {
  2202. if (iVarNames) klass.iVarNames = iVarNames;
  2203. } else throw new Error("Incompatible change of class: " + klass.name);
  2204. }
  2205. };
  2206. }
  2207. function wireKlass (klass) {
  2208. Object.defineProperty(klass.fn.prototype, "a$cls", {
  2209. value: klass,
  2210. enumerable: false, configurable: true, writable: true
  2211. });
  2212. Object.defineProperty(klass.fn.prototype, "klass", {
  2213. value: klass,
  2214. enumerable: false, configurable: true, writable: true
  2215. });
  2216. }
  2217. this.wireKlass = wireKlass;
  2218. /* Add a class to the system, creating a new one if needed.
  2219. A Package is lazily created if one with given name does not exist. */
  2220. st.addClass = function (className, superclass, iVarNames, category) {
  2221. // While subclassing nil is allowed, it might be an error, so
  2222. // warn about it.
  2223. if (typeof superclass === 'undefined' || superclass && superclass.a$nil) {
  2224. console.warn('Compiling ' + className + ' as a subclass of `nil`. A dependency might be missing.');
  2225. }
  2226. return buildTraitOrClass(category, classBuilder(className, superclass, iVarNames, coreFns[className]));
  2227. };
  2228. st.removeClass = removeTraitOrClass;
  2229. function addSubclass (klass) {
  2230. if (klass.superclass) {
  2231. addElement(klass.superclass.subclasses, klass);
  2232. }
  2233. }
  2234. function removeSubclass (klass) {
  2235. if (klass.superclass) {
  2236. removeElement(klass.superclass.subclasses, klass);
  2237. }
  2238. }
  2239. function metaSubclasses (metaclass) {
  2240. return metaclass.instanceClass.subclasses
  2241. .filter(function (each) {
  2242. return !each.meta;
  2243. })
  2244. .map(function (each) {
  2245. return each.a$cls;
  2246. });
  2247. }
  2248. st.metaSubclasses = metaSubclasses;
  2249. st.traverseClassTree = function (klass, fn) {
  2250. var queue = [klass], sentinel = {};
  2251. for (var i = 0; i < queue.length; ++i) {
  2252. var item = queue[i];
  2253. if (fn(item, sentinel) === sentinel) continue;
  2254. var subclasses = item.meta ? metaSubclasses(item) : item.subclasses;
  2255. queue.push.apply(queue, subclasses);
  2256. }
  2257. };
  2258. }
  2259. /* Making smalltalk that can load */
  2260. function configureWithHierarchy (brikz) {
  2261. brikz.traits = TraitsBrik;
  2262. brikz.composition = MethodCompositionBrik;
  2263. brikz.classes = ClassesBrik;
  2264. brikz.rebuild();
  2265. }
  2266. return configureWithHierarchy;
  2267. });
  2268. /* ====================================================================
  2269. |
  2270. | Amber Smalltalk
  2271. | http://amber-lang.net
  2272. |
  2273. ======================================================================
  2274. ======================================================================
  2275. |
  2276. | Copyright (c) 2010-2014
  2277. | Nicolas Petton <petton.nicolas@gmail.com>
  2278. |
  2279. | Copyright (c) 2012-2017
  2280. | The Amber team https://lolg.it/org/amber/members
  2281. | Amber contributors (see /CONTRIBUTORS)
  2282. |
  2283. | Amber is released under the MIT license
  2284. |
  2285. | Permission is hereby granted, free of charge, to any person obtaining
  2286. | a copy of this software and associated documentation files (the
  2287. | 'Software'), to deal in the Software without restriction, including
  2288. | without limitation the rights to use, copy, modify, merge, publish,
  2289. | distribute, sublicense, and/or sell copies of the Software, and to
  2290. | permit persons to whom the Software is furnished to do so, subject to
  2291. | the following conditions:
  2292. |
  2293. | The above copyright notice and this permission notice shall be
  2294. | included in all copies or substantial portions of the Software.
  2295. |
  2296. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  2297. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  2298. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  2299. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  2300. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  2301. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  2302. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  2303. |
  2304. ==================================================================== */
  2305. //jshint eqnull:true
  2306. define('amber/boot',[
  2307. 'require', './kernel-checks', './brikz', './kernel-fundamentals', './kernel-language'
  2308. ], function (require, _, Brikz, configureWithFundamentals, configureWithHierarchy) {
  2309. "use strict";
  2310. var runtimeLoadedPromise = new Promise(function (resolve, reject) {
  2311. require(['./kernel-runtime'], resolve, reject);
  2312. });
  2313. function SmalltalkInitBrik (brikz, st) {
  2314. var initialized = false;
  2315. /* Smalltalk initialization. Called on page load */
  2316. st.initialize = function () {
  2317. return runtimeLoadedPromise.then(function (configureWithRuntime) {
  2318. if (initialized) return;
  2319. brikz.classes.bootstrapHierarchy();
  2320. configureWithRuntime(brikz);
  2321. // TODO deprecation helper; remove
  2322. Object.defineProperty(st, "packages", {
  2323. get: function () {
  2324. console.warn("Use of .packages deprecated, use .packageDescriptors");
  2325. return st.packageDescriptors;
  2326. },
  2327. set: function (v) {
  2328. console.trace();
  2329. throw new Error("No one should be setting st.packages directly on initialized Amber.");
  2330. }
  2331. });
  2332. return Promise.resolve(brikz.startImage.run())
  2333. .then(function () {
  2334. initialized = true;
  2335. });
  2336. });
  2337. };
  2338. }
  2339. /* Adds AMD and requirejs related methods to the api */
  2340. function AMDBrik (brikz, st) {
  2341. st.amdRequire = require;
  2342. st.defaultTransportType = st.defaultTransportType || "amd";
  2343. st.defaultAmdNamespace = st.defaultAmdNamespace || "amber_core";
  2344. }
  2345. /* Defines asReceiver to be present at load time */
  2346. /* (logically it belongs more to PrimitiveBrik) */
  2347. AsReceiverBrik.deps = ["nil"];
  2348. function AsReceiverBrik (brikz, st) {
  2349. var nilAsReceiver = brikz.nil.nilAsReceiver;
  2350. /**
  2351. * This function is used all over the compiled amber code.
  2352. * It takes any value (JavaScript or Smalltalk)
  2353. * and returns a proper Amber Smalltalk receiver.
  2354. *
  2355. * null or undefined -> nilAsReceiver,
  2356. * object having Smalltalk signature -> unchanged,
  2357. * otherwise wrapped foreign (JS) object
  2358. */
  2359. this.asReceiver = function (o) {
  2360. if (o == null) return nilAsReceiver;
  2361. else if (o.a$cls != null) return o;
  2362. else return st.wrapJavaScript(o);
  2363. };
  2364. }
  2365. var api = {};
  2366. var brikz = new Brikz(api);
  2367. configureWithFundamentals(brikz);
  2368. configureWithHierarchy(brikz);
  2369. brikz.asReceiver = AsReceiverBrik;
  2370. brikz.stInit = SmalltalkInitBrik;
  2371. brikz.amd = AMDBrik;
  2372. brikz.rebuild();
  2373. // TODO deprecated, remove
  2374. Object.defineProperty(brikz.smalltalkGlobals.globals, "CharacterArray", {
  2375. enumerable: true,
  2376. configurable: true,
  2377. get: function () {
  2378. return this.String;
  2379. }
  2380. });
  2381. return {
  2382. api: api,
  2383. nilAsReceiver: brikz.nil.nilAsReceiver,
  2384. nilAsValue: brikz.nil.nilAsValue,
  2385. nilAsClass: brikz.classes.nilAsClass,
  2386. globals: brikz.smalltalkGlobals.globals,
  2387. asReceiver: brikz.asReceiver.asReceiver
  2388. };
  2389. });
  2390. define('amber/helpers',["amber/boot", "require"], function (boot, require) {
  2391. var globals = boot.globals,
  2392. exports = {},
  2393. api = boot.api,
  2394. nil = boot.nilAsReceiver;
  2395. // API
  2396. exports.popupHelios = function () {
  2397. require(['helios/index'], function (helios) {
  2398. helios.popup();
  2399. }, function (err) {
  2400. window.alert("Error loading helios.\nIf not present, you can install it with 'bower install helios --save-dev'.\nThe error follows:\n" + err);
  2401. });
  2402. };
  2403. Object.defineProperty(exports, "api", {
  2404. value: api,
  2405. enumerable: true, configurable: true, writable: false
  2406. });
  2407. Object.defineProperty(exports, "globals", {
  2408. value: globals,
  2409. enumerable: true, configurable: true, writable: false
  2410. });
  2411. Object.defineProperty(exports, "nil", {
  2412. value: nil,
  2413. enumerable: true, configurable: true, writable: false
  2414. });
  2415. function mixinToSettings (source) {
  2416. var settings = globals.SmalltalkSettings;
  2417. Object.keys(source).forEach(function (key) {
  2418. settings[key] = source[key];
  2419. });
  2420. }
  2421. function settingsInLocalStorage () {
  2422. //jshint evil:true
  2423. var storage = 'localStorage' in global && global.localStorage;
  2424. if (storage) {
  2425. var fromStorage;
  2426. try {
  2427. fromStorage = JSON.parse(storage.getItem('amber.SmalltalkSettings'));
  2428. } catch (ex) {
  2429. // pass
  2430. }
  2431. mixinToSettings(fromStorage || {});
  2432. if (typeof window !== "undefined") {
  2433. window.addEventListener('beforeunload', function () {
  2434. storage.setItem('amber.SmalltalkSettings', JSON.stringify(globals.SmalltalkSettings));
  2435. });
  2436. }
  2437. }
  2438. }
  2439. exports.initialize = function (options) {
  2440. return new Promise(function (resolve) {
  2441. globals.SmalltalkSettings['transport.defaultAmdNamespace'] = api.defaultAmdNamespace;
  2442. settingsInLocalStorage();
  2443. mixinToSettings(options || {});
  2444. resolve(api.initialize());
  2445. });
  2446. };
  2447. exports.loadPackages = function (modules) {
  2448. return new Promise(function (resolve, reject) {
  2449. require(modules, resolve, reject);
  2450. }).then(function () {
  2451. return globals.Smalltalk._postLoad();
  2452. });
  2453. };
  2454. // Exports
  2455. return exports;
  2456. });
  2457. define('amber_core/Kernel-Helpers',["amber/boot"], function($boot){"use strict";
  2458. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  2459. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  2460. var $pkg = $core.addPackage("Kernel-Helpers");
  2461. $pkg.innerEval = function (expr) { return eval(expr); };
  2462. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  2463. $core.addTrait("TSubclassable", "Kernel-Helpers");
  2464. $core.addMethod(
  2465. $core.method({
  2466. selector: "subclass:",
  2467. protocol: "class creation",
  2468. fn: function (aString){
  2469. var self=this,$self=this;
  2470. return $core.withContext(function($ctx1) {
  2471. return $self._subclass_instanceVariableNames_package_(aString,"",nil);
  2472. }, function($ctx1) {$ctx1.fill(self,"subclass:",{aString:aString},$globals.TSubclassable)});
  2473. },
  2474. args: ["aString"],
  2475. source: "subclass: aString \x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: '' package: nil",
  2476. referencedClasses: [],
  2477. messageSends: ["subclass:instanceVariableNames:package:"]
  2478. }),
  2479. $globals.TSubclassable);
  2480. $core.addMethod(
  2481. $core.method({
  2482. selector: "subclass:instanceVariableNames:",
  2483. protocol: "class creation",
  2484. fn: function (aString,anotherString){
  2485. var self=this,$self=this;
  2486. return $core.withContext(function($ctx1) {
  2487. return $self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  2488. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},$globals.TSubclassable)});
  2489. },
  2490. args: ["aString", "anotherString"],
  2491. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  2492. referencedClasses: [],
  2493. messageSends: ["subclass:instanceVariableNames:package:"]
  2494. }),
  2495. $globals.TSubclassable);
  2496. $core.addMethod(
  2497. $core.method({
  2498. selector: "subclass:instanceVariableNames:category:",
  2499. protocol: "class creation",
  2500. fn: function (aString,aString2,aString3){
  2501. var self=this,$self=this;
  2502. return $core.withContext(function($ctx1) {
  2503. return $self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  2504. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},$globals.TSubclassable)});
  2505. },
  2506. args: ["aString", "aString2", "aString3"],
  2507. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  2508. referencedClasses: [],
  2509. messageSends: ["subclass:instanceVariableNames:package:"]
  2510. }),
  2511. $globals.TSubclassable);
  2512. $core.addMethod(
  2513. $core.method({
  2514. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  2515. protocol: "class creation",
  2516. fn: function (aString,aString2,classVars,pools,aString3){
  2517. var self=this,$self=this;
  2518. return $core.withContext(function($ctx1) {
  2519. return $self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  2520. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.TSubclassable)});
  2521. },
  2522. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  2523. source: "subclass: aString instanceVariableNames: aString2 classVariableNames: classVars poolDictionaries: pools category: aString3\x0a\x09\x22Kept for file-in compatibility. ignores class variables and pools.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  2524. referencedClasses: [],
  2525. messageSends: ["subclass:instanceVariableNames:package:"]
  2526. }),
  2527. $globals.TSubclassable);
  2528. $core.addMethod(
  2529. $core.method({
  2530. selector: "subclass:instanceVariableNames:package:",
  2531. protocol: "class creation",
  2532. fn: function (aString,aString2,aString3){
  2533. var self=this,$self=this;
  2534. return $core.withContext(function($ctx1) {
  2535. return $recv($recv($globals.ClassBuilder)._new())._superclass_subclass_instanceVariableNames_package_(self,$recv(aString)._asString(),aString2,aString3);
  2536. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},$globals.TSubclassable)});
  2537. },
  2538. args: ["aString", "aString2", "aString3"],
  2539. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  2540. referencedClasses: ["ClassBuilder"],
  2541. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"]
  2542. }),
  2543. $globals.TSubclassable);
  2544. $core.addMethod(
  2545. $core.method({
  2546. selector: "subclass:uses:",
  2547. protocol: "class creation",
  2548. fn: function (aString,aTraitCompositionDescription){
  2549. var self=this,$self=this;
  2550. return $core.withContext(function($ctx1) {
  2551. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,"",nil);
  2552. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription},$globals.TSubclassable)});
  2553. },
  2554. args: ["aString", "aTraitCompositionDescription"],
  2555. source: "subclass: aString uses: aTraitCompositionDescription \x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString uses: aTraitCompositionDescription instanceVariableNames: '' package: nil",
  2556. referencedClasses: [],
  2557. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2558. }),
  2559. $globals.TSubclassable);
  2560. $core.addMethod(
  2561. $core.method({
  2562. selector: "subclass:uses:instanceVariableNames:",
  2563. protocol: "class creation",
  2564. fn: function (aString,aTraitCompositionDescription,anotherString){
  2565. var self=this,$self=this;
  2566. return $core.withContext(function($ctx1) {
  2567. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,anotherString,nil);
  2568. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,anotherString:anotherString},$globals.TSubclassable)});
  2569. },
  2570. args: ["aString", "aTraitCompositionDescription", "anotherString"],
  2571. source: "subclass: aString uses: aTraitCompositionDescription instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString uses: aTraitCompositionDescription instanceVariableNames: anotherString package: nil",
  2572. referencedClasses: [],
  2573. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2574. }),
  2575. $globals.TSubclassable);
  2576. $core.addMethod(
  2577. $core.method({
  2578. selector: "subclass:uses:instanceVariableNames:category:",
  2579. protocol: "class creation",
  2580. fn: function (aString,aTraitCompositionDescription,aString2,aString3){
  2581. var self=this,$self=this;
  2582. return $core.withContext(function($ctx1) {
  2583. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,aString2,aString3);
  2584. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:category:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,aString3:aString3},$globals.TSubclassable)});
  2585. },
  2586. args: ["aString", "aTraitCompositionDescription", "aString2", "aString3"],
  2587. source: "subclass: aString uses: aTraitCompositionDescription instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString uses: aTraitCompositionDescription instanceVariableNames: aString2 package: aString3",
  2588. referencedClasses: [],
  2589. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2590. }),
  2591. $globals.TSubclassable);
  2592. $core.addMethod(
  2593. $core.method({
  2594. selector: "subclass:uses:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  2595. protocol: "class creation",
  2596. fn: function (aString,aTraitCompositionDescription,aString2,classVars,pools,aString3){
  2597. var self=this,$self=this;
  2598. return $core.withContext(function($ctx1) {
  2599. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,aString2,aString3);
  2600. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.TSubclassable)});
  2601. },
  2602. args: ["aString", "aTraitCompositionDescription", "aString2", "classVars", "pools", "aString3"],
  2603. source: "subclass: aString uses: aTraitCompositionDescription instanceVariableNames: aString2 classVariableNames: classVars poolDictionaries: pools category: aString3\x0a\x09\x22Kept for file-in compatibility. ignores class variables and pools.\x22\x0a\x09^ self subclass: aString uses: aTraitCompositionDescription instanceVariableNames: aString2 package: aString3",
  2604. referencedClasses: [],
  2605. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2606. }),
  2607. $globals.TSubclassable);
  2608. $core.addMethod(
  2609. $core.method({
  2610. selector: "subclass:uses:instanceVariableNames:package:",
  2611. protocol: "class creation",
  2612. fn: function (aString,aTraitCompositionDescription,aString2,aString3){
  2613. var self=this,$self=this;
  2614. var cls;
  2615. return $core.withContext(function($ctx1) {
  2616. cls=$self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  2617. $recv(cls)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  2618. return cls;
  2619. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:package:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,aString3:aString3,cls:cls},$globals.TSubclassable)});
  2620. },
  2621. args: ["aString", "aTraitCompositionDescription", "aString2", "aString3"],
  2622. source: "subclass: aString uses: aTraitCompositionDescription instanceVariableNames: aString2 package: aString3\x0a\x09| cls |\x0a\x09cls := self subclass: aString instanceVariableNames: aString2 package: aString3.\x0a\x09cls setTraitComposition: aTraitCompositionDescription asTraitComposition.\x0a\x09^ cls",
  2623. referencedClasses: [],
  2624. messageSends: ["subclass:instanceVariableNames:package:", "setTraitComposition:", "asTraitComposition"]
  2625. }),
  2626. $globals.TSubclassable);
  2627. });
  2628. define('amber_core/Kernel-Objects',["amber/boot", "amber_core/Kernel-Helpers"], function($boot){"use strict";
  2629. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  2630. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  2631. var $pkg = $core.addPackage("Kernel-Objects");
  2632. $pkg.innerEval = function (expr) { return eval(expr); };
  2633. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  2634. $core.addClass("ProtoObject", null, [], "Kernel-Objects");
  2635. $globals.ProtoObject.comment="I implement the basic behavior required for any object in Amber.\x0a\x0aIn most cases, subclassing `ProtoObject` is wrong and `Object` should be used instead. However subclassing `ProtoObject` can be useful in some special cases like proxy implementations.";
  2636. $core.addMethod(
  2637. $core.method({
  2638. selector: "=",
  2639. protocol: "comparing",
  2640. fn: function (anObject){
  2641. var self=this,$self=this;
  2642. return $core.withContext(function($ctx1) {
  2643. return $self.__eq_eq(anObject);
  2644. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.ProtoObject)});
  2645. },
  2646. args: ["anObject"],
  2647. source: "= anObject\x0a\x09^ self == anObject",
  2648. referencedClasses: [],
  2649. messageSends: ["=="]
  2650. }),
  2651. $globals.ProtoObject);
  2652. $core.addMethod(
  2653. $core.method({
  2654. selector: "==",
  2655. protocol: "comparing",
  2656. fn: function (anObject){
  2657. var self=this,$self=this;
  2658. return $core.withContext(function($ctx1) {
  2659. return self === anObject;
  2660. return self;
  2661. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},$globals.ProtoObject)});
  2662. },
  2663. args: ["anObject"],
  2664. source: "== anObject\x0a<inlineJS: 'return self === anObject'>",
  2665. referencedClasses: [],
  2666. messageSends: []
  2667. }),
  2668. $globals.ProtoObject);
  2669. $core.addMethod(
  2670. $core.method({
  2671. selector: "asString",
  2672. protocol: "converting",
  2673. fn: function (){
  2674. var self=this,$self=this;
  2675. return $core.withContext(function($ctx1) {
  2676. return $self._printString();
  2677. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.ProtoObject)});
  2678. },
  2679. args: [],
  2680. source: "asString\x0a\x09^ self printString",
  2681. referencedClasses: [],
  2682. messageSends: ["printString"]
  2683. }),
  2684. $globals.ProtoObject);
  2685. $core.addMethod(
  2686. $core.method({
  2687. selector: "class",
  2688. protocol: "accessing",
  2689. fn: function (){
  2690. var self=this,$self=this;
  2691. return $core.withContext(function($ctx1) {
  2692. return $self.a$cls;
  2693. return self;
  2694. }, function($ctx1) {$ctx1.fill(self,"class",{},$globals.ProtoObject)});
  2695. },
  2696. args: [],
  2697. source: "class\x0a\x09<inlineJS: 'return $self.a$cls'>",
  2698. referencedClasses: [],
  2699. messageSends: []
  2700. }),
  2701. $globals.ProtoObject);
  2702. $core.addMethod(
  2703. $core.method({
  2704. selector: "doesNotUnderstand:",
  2705. protocol: "error handling",
  2706. fn: function (aMessage){
  2707. var self=this,$self=this;
  2708. return $core.withContext(function($ctx1) {
  2709. var $1;
  2710. $1=$recv($globals.MessageNotUnderstood)._new();
  2711. $recv($1)._receiver_(self);
  2712. $recv($1)._message_(aMessage);
  2713. $recv($1)._signal();
  2714. return self;
  2715. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.ProtoObject)});
  2716. },
  2717. args: ["aMessage"],
  2718. source: "doesNotUnderstand: aMessage\x0a\x09MessageNotUnderstood new\x0a\x09\x09receiver: self;\x0a\x09\x09message: aMessage;\x0a\x09\x09signal",
  2719. referencedClasses: ["MessageNotUnderstood"],
  2720. messageSends: ["receiver:", "new", "message:", "signal"]
  2721. }),
  2722. $globals.ProtoObject);
  2723. $core.addMethod(
  2724. $core.method({
  2725. selector: "evaluate:on:",
  2726. protocol: "evaluating",
  2727. fn: function (aString,anEvaluator){
  2728. var self=this,$self=this;
  2729. return $core.withContext(function($ctx1) {
  2730. return $recv(anEvaluator)._evaluate_receiver_(aString,self);
  2731. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.ProtoObject)});
  2732. },
  2733. args: ["aString", "anEvaluator"],
  2734. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString receiver: self",
  2735. referencedClasses: [],
  2736. messageSends: ["evaluate:receiver:"]
  2737. }),
  2738. $globals.ProtoObject);
  2739. $core.addMethod(
  2740. $core.method({
  2741. selector: "identityHash",
  2742. protocol: "accessing",
  2743. fn: function (){
  2744. var self=this,$self=this;
  2745. return $core.withContext(function($ctx1) {
  2746. self._deprecatedAPI();
  2747. var hash=self.identityHash;
  2748. if (hash) return hash;
  2749. hash=$core.nextId();
  2750. Object.defineProperty(self, 'identityHash', {value:hash});
  2751. return hash;
  2752. ;
  2753. return self;
  2754. }, function($ctx1) {$ctx1.fill(self,"identityHash",{},$globals.ProtoObject)});
  2755. },
  2756. args: [],
  2757. source: "identityHash\x0a\x09<inlineJS: '\x0a\x09\x09self._deprecatedAPI();\x0a\x09\x09var hash=self.identityHash;\x0a\x09\x09if (hash) return hash;\x0a\x09\x09hash=$core.nextId();\x0a\x09\x09Object.defineProperty(self, ''identityHash'', {value:hash});\x0a\x09\x09return hash;\x0a\x09'>",
  2758. referencedClasses: [],
  2759. messageSends: []
  2760. }),
  2761. $globals.ProtoObject);
  2762. $core.addMethod(
  2763. $core.method({
  2764. selector: "ifNil:",
  2765. protocol: "testing",
  2766. fn: function (aBlock){
  2767. var self=this,$self=this;
  2768. return self;
  2769. },
  2770. args: ["aBlock"],
  2771. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  2772. referencedClasses: [],
  2773. messageSends: []
  2774. }),
  2775. $globals.ProtoObject);
  2776. $core.addMethod(
  2777. $core.method({
  2778. selector: "ifNil:ifNotNil:",
  2779. protocol: "testing",
  2780. fn: function (aBlock,anotherBlock){
  2781. var self=this,$self=this;
  2782. return $core.withContext(function($ctx1) {
  2783. return $recv(anotherBlock)._value_(self);
  2784. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  2785. },
  2786. args: ["aBlock", "anotherBlock"],
  2787. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value: self",
  2788. referencedClasses: [],
  2789. messageSends: ["value:"]
  2790. }),
  2791. $globals.ProtoObject);
  2792. $core.addMethod(
  2793. $core.method({
  2794. selector: "ifNotNil:",
  2795. protocol: "testing",
  2796. fn: function (aBlock){
  2797. var self=this,$self=this;
  2798. return $core.withContext(function($ctx1) {
  2799. return $recv(aBlock)._value_(self);
  2800. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock},$globals.ProtoObject)});
  2801. },
  2802. args: ["aBlock"],
  2803. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  2804. referencedClasses: [],
  2805. messageSends: ["value:"]
  2806. }),
  2807. $globals.ProtoObject);
  2808. $core.addMethod(
  2809. $core.method({
  2810. selector: "ifNotNil:ifNil:",
  2811. protocol: "testing",
  2812. fn: function (aBlock,anotherBlock){
  2813. var self=this,$self=this;
  2814. return $core.withContext(function($ctx1) {
  2815. return $recv(aBlock)._value_(self);
  2816. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  2817. },
  2818. args: ["aBlock", "anotherBlock"],
  2819. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  2820. referencedClasses: [],
  2821. messageSends: ["value:"]
  2822. }),
  2823. $globals.ProtoObject);
  2824. $core.addMethod(
  2825. $core.method({
  2826. selector: "initialize",
  2827. protocol: "initialization",
  2828. fn: function (){
  2829. var self=this,$self=this;
  2830. return self;
  2831. },
  2832. args: [],
  2833. source: "initialize",
  2834. referencedClasses: [],
  2835. messageSends: []
  2836. }),
  2837. $globals.ProtoObject);
  2838. $core.addMethod(
  2839. $core.method({
  2840. selector: "inspect",
  2841. protocol: "inspecting",
  2842. fn: function (){
  2843. var self=this,$self=this;
  2844. return $core.withContext(function($ctx1) {
  2845. $recv($globals.Inspector)._inspect_(self);
  2846. return self;
  2847. }, function($ctx1) {$ctx1.fill(self,"inspect",{},$globals.ProtoObject)});
  2848. },
  2849. args: [],
  2850. source: "inspect\x0a\x09Inspector inspect: self",
  2851. referencedClasses: ["Inspector"],
  2852. messageSends: ["inspect:"]
  2853. }),
  2854. $globals.ProtoObject);
  2855. $core.addMethod(
  2856. $core.method({
  2857. selector: "inspectOn:",
  2858. protocol: "inspecting",
  2859. fn: function (anInspector){
  2860. var self=this,$self=this;
  2861. return self;
  2862. },
  2863. args: ["anInspector"],
  2864. source: "inspectOn: anInspector",
  2865. referencedClasses: [],
  2866. messageSends: []
  2867. }),
  2868. $globals.ProtoObject);
  2869. $core.addMethod(
  2870. $core.method({
  2871. selector: "instVarAt:",
  2872. protocol: "accessing",
  2873. fn: function (aString){
  2874. var self=this,$self=this;
  2875. return $core.withContext(function($ctx1) {
  2876. return $self['@'+aString];
  2877. return self;
  2878. }, function($ctx1) {$ctx1.fill(self,"instVarAt:",{aString:aString},$globals.ProtoObject)});
  2879. },
  2880. args: ["aString"],
  2881. source: "instVarAt: aString\x0a\x09<inlineJS: 'return $self[''@''+aString]'>",
  2882. referencedClasses: [],
  2883. messageSends: []
  2884. }),
  2885. $globals.ProtoObject);
  2886. $core.addMethod(
  2887. $core.method({
  2888. selector: "instVarAt:put:",
  2889. protocol: "accessing",
  2890. fn: function (aString,anObject){
  2891. var self=this,$self=this;
  2892. return $core.withContext(function($ctx1) {
  2893. $self['@' + aString] = anObject;
  2894. return self;
  2895. }, function($ctx1) {$ctx1.fill(self,"instVarAt:put:",{aString:aString,anObject:anObject},$globals.ProtoObject)});
  2896. },
  2897. args: ["aString", "anObject"],
  2898. source: "instVarAt: aString put: anObject\x0a\x09<inlineJS: '$self[''@'' + aString] = anObject'>",
  2899. referencedClasses: [],
  2900. messageSends: []
  2901. }),
  2902. $globals.ProtoObject);
  2903. $core.addMethod(
  2904. $core.method({
  2905. selector: "isKindOf:",
  2906. protocol: "testing",
  2907. fn: function (aClass){
  2908. var self=this,$self=this;
  2909. return $core.withContext(function($ctx1) {
  2910. var $1;
  2911. $1=$self._isMemberOf_(aClass);
  2912. if($core.assert($1)){
  2913. return true;
  2914. } else {
  2915. return $recv($self._class())._inheritsFrom_(aClass);
  2916. }
  2917. }, function($ctx1) {$ctx1.fill(self,"isKindOf:",{aClass:aClass},$globals.ProtoObject)});
  2918. },
  2919. args: ["aClass"],
  2920. source: "isKindOf: aClass\x0a\x09^ (self isMemberOf: aClass)\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: [ self class inheritsFrom: aClass ]",
  2921. referencedClasses: [],
  2922. messageSends: ["ifTrue:ifFalse:", "isMemberOf:", "inheritsFrom:", "class"]
  2923. }),
  2924. $globals.ProtoObject);
  2925. $core.addMethod(
  2926. $core.method({
  2927. selector: "isNil",
  2928. protocol: "testing",
  2929. fn: function (){
  2930. var self=this,$self=this;
  2931. return false;
  2932. },
  2933. args: [],
  2934. source: "isNil\x0a\x09^ false",
  2935. referencedClasses: [],
  2936. messageSends: []
  2937. }),
  2938. $globals.ProtoObject);
  2939. $core.addMethod(
  2940. $core.method({
  2941. selector: "notNil",
  2942. protocol: "testing",
  2943. fn: function (){
  2944. var self=this,$self=this;
  2945. return $core.withContext(function($ctx1) {
  2946. return $recv($self._isNil())._not();
  2947. }, function($ctx1) {$ctx1.fill(self,"notNil",{},$globals.ProtoObject)});
  2948. },
  2949. args: [],
  2950. source: "notNil\x0a\x09^ self isNil not",
  2951. referencedClasses: [],
  2952. messageSends: ["not", "isNil"]
  2953. }),
  2954. $globals.ProtoObject);
  2955. $core.addMethod(
  2956. $core.method({
  2957. selector: "perform:",
  2958. protocol: "message handling",
  2959. fn: function (aString){
  2960. var self=this,$self=this;
  2961. return $core.withContext(function($ctx1) {
  2962. return $self._perform_withArguments_(aString,[]);
  2963. }, function($ctx1) {$ctx1.fill(self,"perform:",{aString:aString},$globals.ProtoObject)});
  2964. },
  2965. args: ["aString"],
  2966. source: "perform: aString\x0a\x09^ self perform: aString withArguments: #()",
  2967. referencedClasses: [],
  2968. messageSends: ["perform:withArguments:"]
  2969. }),
  2970. $globals.ProtoObject);
  2971. $core.addMethod(
  2972. $core.method({
  2973. selector: "perform:withArguments:",
  2974. protocol: "message handling",
  2975. fn: function (aString,aCollection){
  2976. var self=this,$self=this;
  2977. return $core.withContext(function($ctx1) {
  2978. return $core.send2(self, aString, aCollection);
  2979. return self;
  2980. }, function($ctx1) {$ctx1.fill(self,"perform:withArguments:",{aString:aString,aCollection:aCollection},$globals.ProtoObject)});
  2981. },
  2982. args: ["aString", "aCollection"],
  2983. source: "perform: aString withArguments: aCollection\x0a\x09<inlineJS: 'return $core.send2(self, aString, aCollection)'>",
  2984. referencedClasses: [],
  2985. messageSends: []
  2986. }),
  2987. $globals.ProtoObject);
  2988. $core.addMethod(
  2989. $core.method({
  2990. selector: "printOn:",
  2991. protocol: "printing",
  2992. fn: function (aStream){
  2993. var self=this,$self=this;
  2994. return $core.withContext(function($ctx1) {
  2995. var $5,$4,$3,$2,$1;
  2996. $5=$self._class();
  2997. $ctx1.sendIdx["class"]=1;
  2998. $4=$recv($5)._name();
  2999. $ctx1.sendIdx["name"]=1;
  3000. $3=$recv($4)._first();
  3001. $2=$recv($3)._isVowel();
  3002. if($core.assert($2)){
  3003. $1="an ";
  3004. } else {
  3005. $1="a ";
  3006. }
  3007. $recv(aStream)._nextPutAll_($1);
  3008. $ctx1.sendIdx["nextPutAll:"]=1;
  3009. $recv(aStream)._nextPutAll_($recv($self._class())._name());
  3010. return self;
  3011. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.ProtoObject)});
  3012. },
  3013. args: ["aStream"],
  3014. source: "printOn: aStream\x0a\x09aStream nextPutAll: (self class name first isVowel\x0a\x09\x09ifTrue: [ 'an ' ]\x0a\x09\x09ifFalse: [ 'a ' ]).\x0a\x09aStream nextPutAll: self class name",
  3015. referencedClasses: [],
  3016. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isVowel", "first", "name", "class"]
  3017. }),
  3018. $globals.ProtoObject);
  3019. $core.addMethod(
  3020. $core.method({
  3021. selector: "printString",
  3022. protocol: "printing",
  3023. fn: function (){
  3024. var self=this,$self=this;
  3025. return $core.withContext(function($ctx1) {
  3026. return $recv($globals.String)._streamContents_((function(str){
  3027. return $core.withContext(function($ctx2) {
  3028. return $self._printOn_(str);
  3029. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  3030. }));
  3031. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.ProtoObject)});
  3032. },
  3033. args: [],
  3034. source: "printString\x0a\x09^ String streamContents: [ :str | \x0a\x09\x09self printOn: str ]",
  3035. referencedClasses: ["String"],
  3036. messageSends: ["streamContents:", "printOn:"]
  3037. }),
  3038. $globals.ProtoObject);
  3039. $core.addMethod(
  3040. $core.method({
  3041. selector: "yourself",
  3042. protocol: "accessing",
  3043. fn: function (){
  3044. var self=this,$self=this;
  3045. return self;
  3046. },
  3047. args: [],
  3048. source: "yourself\x0a\x09^ self",
  3049. referencedClasses: [],
  3050. messageSends: []
  3051. }),
  3052. $globals.ProtoObject);
  3053. $core.addMethod(
  3054. $core.method({
  3055. selector: "~=",
  3056. protocol: "comparing",
  3057. fn: function (anObject){
  3058. var self=this,$self=this;
  3059. return $core.withContext(function($ctx1) {
  3060. var $1;
  3061. $1=$recv($self.__eq(anObject)).__eq(false);
  3062. $ctx1.sendIdx["="]=1;
  3063. return $1;
  3064. }, function($ctx1) {$ctx1.fill(self,"~=",{anObject:anObject},$globals.ProtoObject)});
  3065. },
  3066. args: ["anObject"],
  3067. source: "~= anObject\x0a\x09^ (self = anObject) = false",
  3068. referencedClasses: [],
  3069. messageSends: ["="]
  3070. }),
  3071. $globals.ProtoObject);
  3072. $core.addMethod(
  3073. $core.method({
  3074. selector: "~~",
  3075. protocol: "comparing",
  3076. fn: function (anObject){
  3077. var self=this,$self=this;
  3078. return $core.withContext(function($ctx1) {
  3079. return $recv($self.__eq_eq(anObject)).__eq(false);
  3080. }, function($ctx1) {$ctx1.fill(self,"~~",{anObject:anObject},$globals.ProtoObject)});
  3081. },
  3082. args: ["anObject"],
  3083. source: "~~ anObject\x0a\x09^ (self == anObject) = false",
  3084. referencedClasses: [],
  3085. messageSends: ["=", "=="]
  3086. }),
  3087. $globals.ProtoObject);
  3088. $core.addMethod(
  3089. $core.method({
  3090. selector: "initialize",
  3091. protocol: "initialization",
  3092. fn: function (){
  3093. var self=this,$self=this;
  3094. return self;
  3095. },
  3096. args: [],
  3097. source: "initialize",
  3098. referencedClasses: [],
  3099. messageSends: []
  3100. }),
  3101. $globals.ProtoObject.a$cls);
  3102. $core.addClass("Object", $globals.ProtoObject, [], "Kernel-Objects");
  3103. $globals.Object.comment="**I am the root of the Smalltalk class system**. With the exception of unual subclasses of `ProtoObject`, all other classes in the system are subclasses of me.\x0a\x0aI provide default behavior common to all normal objects (some of it inherited from `ProtoObject`), such as:\x0a\x0a- accessing\x0a- copying\x0a- comparison\x0a- error handling\x0a- message sending\x0a- reflection\x0a\x0aAlso utility messages that all objects should respond to are defined here.\x0a\x0aI have no instance variable.\x0a\x0a##Access\x0a\x0aInstance variables can be accessed with `#instVarAt:` and `#instVarAt:put:`. `#instanceVariableNames` answers a collection of all instance variable names.\x0aAccessing JavaScript properties of an object is done through `#basicAt:`, `#basicAt:put:` and `basicDelete:`.\x0a\x0a##Copying\x0a\x0aCopying an object is handled by `#copy` and `#deepCopy`. The first one performs a shallow copy of the receiver, while the second one performs a deep copy.\x0aThe hook method `#postCopy` can be overriden in subclasses to copy fields as necessary to complete the full copy. It will be sent by the copy of the receiver.\x0a\x0a##Comparison\x0a\x0aI understand equality `#=` and identity `#==` comparison.\x0a\x0a##Error handling\x0a\x0a- `#halt` is the typical message to use for inserting breakpoints during debugging.\x0a- `#error:` throws a generic error exception\x0a- `#doesNotUnderstand:` handles the fact that there was an attempt to send the given message to the receiver but the receiver does not understand this message.\x0a\x09Overriding this message can be useful to implement proxies for example.";
  3104. $core.addMethod(
  3105. $core.method({
  3106. selector: "->",
  3107. protocol: "converting",
  3108. fn: function (anObject){
  3109. var self=this,$self=this;
  3110. return $core.withContext(function($ctx1) {
  3111. return $recv($globals.Association)._key_value_(self,anObject);
  3112. }, function($ctx1) {$ctx1.fill(self,"->",{anObject:anObject},$globals.Object)});
  3113. },
  3114. args: ["anObject"],
  3115. source: "-> anObject\x0a\x09^ Association key: self value: anObject",
  3116. referencedClasses: ["Association"],
  3117. messageSends: ["key:value:"]
  3118. }),
  3119. $globals.Object);
  3120. $core.addMethod(
  3121. $core.method({
  3122. selector: "asJSONString",
  3123. protocol: "converting",
  3124. fn: function (){
  3125. var self=this,$self=this;
  3126. return $core.withContext(function($ctx1) {
  3127. return $recv($globals.JSON)._stringify_($self._asJavaScriptObject());
  3128. }, function($ctx1) {$ctx1.fill(self,"asJSONString",{},$globals.Object)});
  3129. },
  3130. args: [],
  3131. source: "asJSONString\x0a\x09^ JSON stringify: self asJavaScriptObject",
  3132. referencedClasses: ["JSON"],
  3133. messageSends: ["stringify:", "asJavaScriptObject"]
  3134. }),
  3135. $globals.Object);
  3136. $core.addMethod(
  3137. $core.method({
  3138. selector: "asJavaScriptObject",
  3139. protocol: "converting",
  3140. fn: function (){
  3141. var self=this,$self=this;
  3142. var variables;
  3143. return $core.withContext(function($ctx1) {
  3144. variables=$recv($globals.HashedCollection)._new();
  3145. $recv($recv($self._class())._allInstanceVariableNames())._do_((function(each){
  3146. return $core.withContext(function($ctx2) {
  3147. return $recv(variables)._at_put_(each,$recv($self._instVarAt_(each))._asJavaScriptObject());
  3148. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  3149. }));
  3150. return variables;
  3151. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{variables:variables},$globals.Object)});
  3152. },
  3153. args: [],
  3154. source: "asJavaScriptObject\x0a\x09| variables |\x0a\x09variables := HashedCollection new.\x0a\x09self class allInstanceVariableNames do: [ :each |\x0a\x09\x09variables at: each put: (self instVarAt: each) asJavaScriptObject ].\x0a\x09^ variables",
  3155. referencedClasses: ["HashedCollection"],
  3156. messageSends: ["new", "do:", "allInstanceVariableNames", "class", "at:put:", "asJavaScriptObject", "instVarAt:"]
  3157. }),
  3158. $globals.Object);
  3159. $core.addMethod(
  3160. $core.method({
  3161. selector: "asJavaScriptSource",
  3162. protocol: "converting",
  3163. fn: function (){
  3164. var self=this,$self=this;
  3165. return $core.withContext(function($ctx1) {
  3166. return $self._asString();
  3167. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Object)});
  3168. },
  3169. args: [],
  3170. source: "asJavaScriptSource\x0a\x09^ self asString",
  3171. referencedClasses: [],
  3172. messageSends: ["asString"]
  3173. }),
  3174. $globals.Object);
  3175. $core.addMethod(
  3176. $core.method({
  3177. selector: "basicAt:",
  3178. protocol: "accessing",
  3179. fn: function (aString){
  3180. var self=this,$self=this;
  3181. return $core.withContext(function($ctx1) {
  3182. return self[aString];
  3183. return self;
  3184. }, function($ctx1) {$ctx1.fill(self,"basicAt:",{aString:aString},$globals.Object)});
  3185. },
  3186. args: ["aString"],
  3187. source: "basicAt: aString\x0a\x09<inlineJS: 'return self[aString]'>",
  3188. referencedClasses: [],
  3189. messageSends: []
  3190. }),
  3191. $globals.Object);
  3192. $core.addMethod(
  3193. $core.method({
  3194. selector: "basicAt:put:",
  3195. protocol: "accessing",
  3196. fn: function (aString,anObject){
  3197. var self=this,$self=this;
  3198. return $core.withContext(function($ctx1) {
  3199. return self[aString] = anObject;
  3200. return self;
  3201. }, function($ctx1) {$ctx1.fill(self,"basicAt:put:",{aString:aString,anObject:anObject},$globals.Object)});
  3202. },
  3203. args: ["aString", "anObject"],
  3204. source: "basicAt: aString put: anObject\x0a\x09<inlineJS: 'return self[aString] = anObject'>",
  3205. referencedClasses: [],
  3206. messageSends: []
  3207. }),
  3208. $globals.Object);
  3209. $core.addMethod(
  3210. $core.method({
  3211. selector: "basicDelete:",
  3212. protocol: "accessing",
  3213. fn: function (aString){
  3214. var self=this,$self=this;
  3215. return $core.withContext(function($ctx1) {
  3216. delete self[aString]; return aString;
  3217. return self;
  3218. }, function($ctx1) {$ctx1.fill(self,"basicDelete:",{aString:aString},$globals.Object)});
  3219. },
  3220. args: ["aString"],
  3221. source: "basicDelete: aString\x0a\x09<inlineJS: 'delete self[aString]; return aString'>",
  3222. referencedClasses: [],
  3223. messageSends: []
  3224. }),
  3225. $globals.Object);
  3226. $core.addMethod(
  3227. $core.method({
  3228. selector: "basicPerform:",
  3229. protocol: "message handling",
  3230. fn: function (aString){
  3231. var self=this,$self=this;
  3232. return $core.withContext(function($ctx1) {
  3233. return $self._basicPerform_withArguments_(aString,[]);
  3234. }, function($ctx1) {$ctx1.fill(self,"basicPerform:",{aString:aString},$globals.Object)});
  3235. },
  3236. args: ["aString"],
  3237. source: "basicPerform: aString\x0a\x09^ self basicPerform: aString withArguments: #()",
  3238. referencedClasses: [],
  3239. messageSends: ["basicPerform:withArguments:"]
  3240. }),
  3241. $globals.Object);
  3242. $core.addMethod(
  3243. $core.method({
  3244. selector: "basicPerform:withArguments:",
  3245. protocol: "message handling",
  3246. fn: function (aString,aCollection){
  3247. var self=this,$self=this;
  3248. return $core.withContext(function($ctx1) {
  3249. return self[aString].apply(self, aCollection);;
  3250. return self;
  3251. }, function($ctx1) {$ctx1.fill(self,"basicPerform:withArguments:",{aString:aString,aCollection:aCollection},$globals.Object)});
  3252. },
  3253. args: ["aString", "aCollection"],
  3254. source: "basicPerform: aString withArguments: aCollection\x0a\x09<inlineJS: 'return self[aString].apply(self, aCollection);'>",
  3255. referencedClasses: [],
  3256. messageSends: []
  3257. }),
  3258. $globals.Object);
  3259. $core.addMethod(
  3260. $core.method({
  3261. selector: "browse",
  3262. protocol: "browsing",
  3263. fn: function (){
  3264. var self=this,$self=this;
  3265. return $core.withContext(function($ctx1) {
  3266. $recv($globals.Finder)._findClass_($self._class());
  3267. return self;
  3268. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.Object)});
  3269. },
  3270. args: [],
  3271. source: "browse\x0a\x09Finder findClass: self class",
  3272. referencedClasses: ["Finder"],
  3273. messageSends: ["findClass:", "class"]
  3274. }),
  3275. $globals.Object);
  3276. $core.addMethod(
  3277. $core.method({
  3278. selector: "copy",
  3279. protocol: "copying",
  3280. fn: function (){
  3281. var self=this,$self=this;
  3282. return $core.withContext(function($ctx1) {
  3283. return $recv($self._shallowCopy())._postCopy();
  3284. }, function($ctx1) {$ctx1.fill(self,"copy",{},$globals.Object)});
  3285. },
  3286. args: [],
  3287. source: "copy\x0a\x09^ self shallowCopy postCopy",
  3288. referencedClasses: [],
  3289. messageSends: ["postCopy", "shallowCopy"]
  3290. }),
  3291. $globals.Object);
  3292. $core.addMethod(
  3293. $core.method({
  3294. selector: "deepCopy",
  3295. protocol: "copying",
  3296. fn: function (){
  3297. var self=this,$self=this;
  3298. return $core.withContext(function($ctx1) {
  3299. var copy = self.a$cls._new();
  3300. Object.keys(self).forEach(function (i) {
  3301. if(/^@.+/.test(i)) {
  3302. copy[i] = $recv(self[i])._deepCopy();
  3303. }
  3304. });
  3305. return copy;
  3306. ;
  3307. return self;
  3308. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Object)});
  3309. },
  3310. args: [],
  3311. source: "deepCopy\x0a\x09<inlineJS: '\x0a\x09\x09var copy = self.a$cls._new();\x0a\x09\x09Object.keys(self).forEach(function (i) {\x0a\x09\x09if(/^@.+/.test(i)) {\x0a\x09\x09\x09copy[i] = $recv(self[i])._deepCopy();\x0a\x09\x09}\x0a\x09\x09});\x0a\x09\x09return copy;\x0a\x09'>",
  3312. referencedClasses: [],
  3313. messageSends: []
  3314. }),
  3315. $globals.Object);
  3316. $core.addMethod(
  3317. $core.method({
  3318. selector: "deprecatedAPI",
  3319. protocol: "error handling",
  3320. fn: function (){
  3321. var self=this,$self=this;
  3322. return $core.withContext(function($ctx1) {
  3323. var $1,$6,$5,$4,$8,$7,$3,$2;
  3324. $1=console;
  3325. $6=$core.getThisContext()._home();
  3326. $ctx1.sendIdx["home"]=1;
  3327. $5=$recv($6)._asString();
  3328. $ctx1.sendIdx["asString"]=1;
  3329. $4=$recv($5).__comma(" is deprecated! (in ");
  3330. $8=$recv($core.getThisContext()._home())._home();
  3331. $ctx1.sendIdx["home"]=2;
  3332. $7=$recv($8)._asString();
  3333. $3=$recv($4).__comma($7);
  3334. $ctx1.sendIdx[","]=2;
  3335. $2=$recv($3).__comma(")");
  3336. $ctx1.sendIdx[","]=1;
  3337. $recv($1)._warn_($2);
  3338. return self;
  3339. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI",{},$globals.Object)});
  3340. },
  3341. args: [],
  3342. source: "deprecatedAPI\x0a\x09\x22Just a simple way to deprecate methods.\x0a\x09#deprecatedAPI is in the 'error handling' protocol even if it doesn't throw an error,\x0a\x09but it could in the future.\x22\x0a\x09console warn: thisContext home asString, ' is deprecated! (in ', thisContext home home asString, ')'.",
  3343. referencedClasses: [],
  3344. messageSends: ["warn:", ",", "asString", "home"]
  3345. }),
  3346. $globals.Object);
  3347. $core.addMethod(
  3348. $core.method({
  3349. selector: "deprecatedAPI:",
  3350. protocol: "error handling",
  3351. fn: function (aString){
  3352. var self=this,$self=this;
  3353. return $core.withContext(function($ctx1) {
  3354. var $1,$6,$5,$4,$8,$7,$3,$2;
  3355. $1=console;
  3356. $6=$core.getThisContext()._home();
  3357. $ctx1.sendIdx["home"]=1;
  3358. $5=$recv($6)._asString();
  3359. $ctx1.sendIdx["asString"]=1;
  3360. $4=$recv($5).__comma(" is deprecated! (in ");
  3361. $8=$recv($core.getThisContext()._home())._home();
  3362. $ctx1.sendIdx["home"]=2;
  3363. $7=$recv($8)._asString();
  3364. $3=$recv($4).__comma($7);
  3365. $ctx1.sendIdx[","]=2;
  3366. $2=$recv($3).__comma(")");
  3367. $ctx1.sendIdx[","]=1;
  3368. $recv($1)._warn_($2);
  3369. $ctx1.sendIdx["warn:"]=1;
  3370. $recv(console)._warn_(aString);
  3371. return self;
  3372. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI:",{aString:aString},$globals.Object)});
  3373. },
  3374. args: ["aString"],
  3375. source: "deprecatedAPI: aString\x0a\x09\x22Just a simple way to deprecate methods.\x0a\x09#deprecatedAPI is in the 'error handling' protocol even if it doesn't throw an error,\x0a\x09but it could in the future.\x22\x0a\x09console warn: thisContext home asString, ' is deprecated! (in ', thisContext home home asString, ')'.\x0a\x09console warn: aString",
  3376. referencedClasses: [],
  3377. messageSends: ["warn:", ",", "asString", "home"]
  3378. }),
  3379. $globals.Object);
  3380. $core.addMethod(
  3381. $core.method({
  3382. selector: "error:",
  3383. protocol: "error handling",
  3384. fn: function (aString){
  3385. var self=this,$self=this;
  3386. return $core.withContext(function($ctx1) {
  3387. $recv($globals.Error)._signal_(aString);
  3388. return self;
  3389. }, function($ctx1) {$ctx1.fill(self,"error:",{aString:aString},$globals.Object)});
  3390. },
  3391. args: ["aString"],
  3392. source: "error: aString\x0a\x09Error signal: aString",
  3393. referencedClasses: ["Error"],
  3394. messageSends: ["signal:"]
  3395. }),
  3396. $globals.Object);
  3397. $core.addMethod(
  3398. $core.method({
  3399. selector: "halt",
  3400. protocol: "error handling",
  3401. fn: function (){
  3402. var self=this,$self=this;
  3403. return $core.withContext(function($ctx1) {
  3404. $recv($globals.Halt)._signal();
  3405. return self;
  3406. }, function($ctx1) {$ctx1.fill(self,"halt",{},$globals.Object)});
  3407. },
  3408. args: [],
  3409. source: "halt\x0a\x09Halt signal",
  3410. referencedClasses: ["Halt"],
  3411. messageSends: ["signal"]
  3412. }),
  3413. $globals.Object);
  3414. $core.addMethod(
  3415. $core.method({
  3416. selector: "in:",
  3417. protocol: "evaluating",
  3418. fn: function (aValuable){
  3419. var self=this,$self=this;
  3420. return $core.withContext(function($ctx1) {
  3421. return $recv(aValuable)._value_(self);
  3422. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.Object)});
  3423. },
  3424. args: ["aValuable"],
  3425. source: "in: aValuable\x0a\x09^ aValuable value: self",
  3426. referencedClasses: [],
  3427. messageSends: ["value:"]
  3428. }),
  3429. $globals.Object);
  3430. $core.addMethod(
  3431. $core.method({
  3432. selector: "isBehavior",
  3433. protocol: "testing",
  3434. fn: function (){
  3435. var self=this,$self=this;
  3436. return false;
  3437. },
  3438. args: [],
  3439. source: "isBehavior\x0a\x09^ false",
  3440. referencedClasses: [],
  3441. messageSends: []
  3442. }),
  3443. $globals.Object);
  3444. $core.addMethod(
  3445. $core.method({
  3446. selector: "isBoolean",
  3447. protocol: "testing",
  3448. fn: function (){
  3449. var self=this,$self=this;
  3450. return false;
  3451. },
  3452. args: [],
  3453. source: "isBoolean\x0a\x09^ false",
  3454. referencedClasses: [],
  3455. messageSends: []
  3456. }),
  3457. $globals.Object);
  3458. $core.addMethod(
  3459. $core.method({
  3460. selector: "isClass",
  3461. protocol: "testing",
  3462. fn: function (){
  3463. var self=this,$self=this;
  3464. return false;
  3465. },
  3466. args: [],
  3467. source: "isClass\x0a\x09^ false",
  3468. referencedClasses: [],
  3469. messageSends: []
  3470. }),
  3471. $globals.Object);
  3472. $core.addMethod(
  3473. $core.method({
  3474. selector: "isCompiledMethod",
  3475. protocol: "testing",
  3476. fn: function (){
  3477. var self=this,$self=this;
  3478. return false;
  3479. },
  3480. args: [],
  3481. source: "isCompiledMethod\x0a\x09^ false",
  3482. referencedClasses: [],
  3483. messageSends: []
  3484. }),
  3485. $globals.Object);
  3486. $core.addMethod(
  3487. $core.method({
  3488. selector: "isImmutable",
  3489. protocol: "testing",
  3490. fn: function (){
  3491. var self=this,$self=this;
  3492. return false;
  3493. },
  3494. args: [],
  3495. source: "isImmutable\x0a\x09^ false",
  3496. referencedClasses: [],
  3497. messageSends: []
  3498. }),
  3499. $globals.Object);
  3500. $core.addMethod(
  3501. $core.method({
  3502. selector: "isMemberOf:",
  3503. protocol: "testing",
  3504. fn: function (aClass){
  3505. var self=this,$self=this;
  3506. return $core.withContext(function($ctx1) {
  3507. return $recv($self._class()).__eq(aClass);
  3508. }, function($ctx1) {$ctx1.fill(self,"isMemberOf:",{aClass:aClass},$globals.Object)});
  3509. },
  3510. args: ["aClass"],
  3511. source: "isMemberOf: aClass\x0a\x09^ self class = aClass",
  3512. referencedClasses: [],
  3513. messageSends: ["=", "class"]
  3514. }),
  3515. $globals.Object);
  3516. $core.addMethod(
  3517. $core.method({
  3518. selector: "isMetaclass",
  3519. protocol: "testing",
  3520. fn: function (){
  3521. var self=this,$self=this;
  3522. return false;
  3523. },
  3524. args: [],
  3525. source: "isMetaclass\x0a\x09^ false",
  3526. referencedClasses: [],
  3527. messageSends: []
  3528. }),
  3529. $globals.Object);
  3530. $core.addMethod(
  3531. $core.method({
  3532. selector: "isNumber",
  3533. protocol: "testing",
  3534. fn: function (){
  3535. var self=this,$self=this;
  3536. return false;
  3537. },
  3538. args: [],
  3539. source: "isNumber\x0a\x09^ false",
  3540. referencedClasses: [],
  3541. messageSends: []
  3542. }),
  3543. $globals.Object);
  3544. $core.addMethod(
  3545. $core.method({
  3546. selector: "isPackage",
  3547. protocol: "testing",
  3548. fn: function (){
  3549. var self=this,$self=this;
  3550. return false;
  3551. },
  3552. args: [],
  3553. source: "isPackage\x0a\x09^ false",
  3554. referencedClasses: [],
  3555. messageSends: []
  3556. }),
  3557. $globals.Object);
  3558. $core.addMethod(
  3559. $core.method({
  3560. selector: "isParseFailure",
  3561. protocol: "testing",
  3562. fn: function (){
  3563. var self=this,$self=this;
  3564. return false;
  3565. },
  3566. args: [],
  3567. source: "isParseFailure\x0a\x09^ false",
  3568. referencedClasses: [],
  3569. messageSends: []
  3570. }),
  3571. $globals.Object);
  3572. $core.addMethod(
  3573. $core.method({
  3574. selector: "isString",
  3575. protocol: "testing",
  3576. fn: function (){
  3577. var self=this,$self=this;
  3578. return false;
  3579. },
  3580. args: [],
  3581. source: "isString\x0a\x09^ false",
  3582. referencedClasses: [],
  3583. messageSends: []
  3584. }),
  3585. $globals.Object);
  3586. $core.addMethod(
  3587. $core.method({
  3588. selector: "isSymbol",
  3589. protocol: "testing",
  3590. fn: function (){
  3591. var self=this,$self=this;
  3592. return false;
  3593. },
  3594. args: [],
  3595. source: "isSymbol\x0a\x09^ false",
  3596. referencedClasses: [],
  3597. messageSends: []
  3598. }),
  3599. $globals.Object);
  3600. $core.addMethod(
  3601. $core.method({
  3602. selector: "postCopy",
  3603. protocol: "copying",
  3604. fn: function (){
  3605. var self=this,$self=this;
  3606. return self;
  3607. },
  3608. args: [],
  3609. source: "postCopy",
  3610. referencedClasses: [],
  3611. messageSends: []
  3612. }),
  3613. $globals.Object);
  3614. $core.addMethod(
  3615. $core.method({
  3616. selector: "putOn:",
  3617. protocol: "streaming",
  3618. fn: function (aStream){
  3619. var self=this,$self=this;
  3620. return $core.withContext(function($ctx1) {
  3621. $recv(aStream)._nextPut_(self);
  3622. return self;
  3623. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Object)});
  3624. },
  3625. args: ["aStream"],
  3626. source: "putOn: aStream\x0a\x09aStream nextPut: self",
  3627. referencedClasses: [],
  3628. messageSends: ["nextPut:"]
  3629. }),
  3630. $globals.Object);
  3631. $core.addMethod(
  3632. $core.method({
  3633. selector: "respondsTo:",
  3634. protocol: "testing",
  3635. fn: function (aSelector){
  3636. var self=this,$self=this;
  3637. return $core.withContext(function($ctx1) {
  3638. return $recv($self._class())._canUnderstand_(aSelector);
  3639. }, function($ctx1) {$ctx1.fill(self,"respondsTo:",{aSelector:aSelector},$globals.Object)});
  3640. },
  3641. args: ["aSelector"],
  3642. source: "respondsTo: aSelector\x0a\x09^ self class canUnderstand: aSelector",
  3643. referencedClasses: [],
  3644. messageSends: ["canUnderstand:", "class"]
  3645. }),
  3646. $globals.Object);
  3647. $core.addMethod(
  3648. $core.method({
  3649. selector: "shallowCopy",
  3650. protocol: "copying",
  3651. fn: function (){
  3652. var self=this,$self=this;
  3653. return $core.withContext(function($ctx1) {
  3654. var copy = self.a$cls._new();
  3655. Object.keys(self).forEach(function(i) {
  3656. if(/^@.+/.test(i)) {
  3657. copy[i] = self[i];
  3658. }
  3659. });
  3660. return copy;
  3661. ;
  3662. return self;
  3663. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Object)});
  3664. },
  3665. args: [],
  3666. source: "shallowCopy\x0a\x09<inlineJS: '\x0a\x09\x09var copy = self.a$cls._new();\x0a\x09\x09Object.keys(self).forEach(function(i) {\x0a\x09\x09if(/^@.+/.test(i)) {\x0a\x09\x09\x09copy[i] = self[i];\x0a\x09\x09}\x0a\x09\x09});\x0a\x09\x09return copy;\x0a\x09'>",
  3667. referencedClasses: [],
  3668. messageSends: []
  3669. }),
  3670. $globals.Object);
  3671. $core.addMethod(
  3672. $core.method({
  3673. selector: "shouldNotImplement",
  3674. protocol: "error handling",
  3675. fn: function (){
  3676. var self=this,$self=this;
  3677. return $core.withContext(function($ctx1) {
  3678. $self._error_("This method should not be implemented in ".__comma($recv($self._class())._name()));
  3679. return self;
  3680. }, function($ctx1) {$ctx1.fill(self,"shouldNotImplement",{},$globals.Object)});
  3681. },
  3682. args: [],
  3683. source: "shouldNotImplement\x0a\x09self error: 'This method should not be implemented in ', self class name",
  3684. referencedClasses: [],
  3685. messageSends: ["error:", ",", "name", "class"]
  3686. }),
  3687. $globals.Object);
  3688. $core.addMethod(
  3689. $core.method({
  3690. selector: "size",
  3691. protocol: "accessing",
  3692. fn: function (){
  3693. var self=this,$self=this;
  3694. return $core.withContext(function($ctx1) {
  3695. $self._error_("Object not indexable");
  3696. return self;
  3697. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Object)});
  3698. },
  3699. args: [],
  3700. source: "size\x0a\x09self error: 'Object not indexable'",
  3701. referencedClasses: [],
  3702. messageSends: ["error:"]
  3703. }),
  3704. $globals.Object);
  3705. $core.addMethod(
  3706. $core.method({
  3707. selector: "subclassResponsibility",
  3708. protocol: "error handling",
  3709. fn: function (){
  3710. var self=this,$self=this;
  3711. return $core.withContext(function($ctx1) {
  3712. $self._error_("This method is a responsibility of a subclass");
  3713. return self;
  3714. }, function($ctx1) {$ctx1.fill(self,"subclassResponsibility",{},$globals.Object)});
  3715. },
  3716. args: [],
  3717. source: "subclassResponsibility\x0a\x09self error: 'This method is a responsibility of a subclass'",
  3718. referencedClasses: [],
  3719. messageSends: ["error:"]
  3720. }),
  3721. $globals.Object);
  3722. $core.addMethod(
  3723. $core.method({
  3724. selector: "value",
  3725. protocol: "evaluating",
  3726. fn: function (){
  3727. var self=this,$self=this;
  3728. return $core.withContext(function($ctx1) {
  3729. return self.valueOf();
  3730. return self;
  3731. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Object)});
  3732. },
  3733. args: [],
  3734. source: "value\x0a\x09<inlineJS: 'return self.valueOf()'>",
  3735. referencedClasses: [],
  3736. messageSends: []
  3737. }),
  3738. $globals.Object);
  3739. $core.addMethod(
  3740. $core.method({
  3741. selector: "accessorProtocolWith:",
  3742. protocol: "helios",
  3743. fn: function (aGenerator){
  3744. var self=this,$self=this;
  3745. return $core.withContext(function($ctx1) {
  3746. $recv(aGenerator)._accessorProtocolForObject();
  3747. return self;
  3748. }, function($ctx1) {$ctx1.fill(self,"accessorProtocolWith:",{aGenerator:aGenerator},$globals.Object.a$cls)});
  3749. },
  3750. args: ["aGenerator"],
  3751. source: "accessorProtocolWith: aGenerator\x0a\x09aGenerator accessorProtocolForObject",
  3752. referencedClasses: [],
  3753. messageSends: ["accessorProtocolForObject"]
  3754. }),
  3755. $globals.Object.a$cls);
  3756. $core.addMethod(
  3757. $core.method({
  3758. selector: "accessorsSourceCodesWith:",
  3759. protocol: "helios",
  3760. fn: function (aGenerator){
  3761. var self=this,$self=this;
  3762. return $core.withContext(function($ctx1) {
  3763. $recv(aGenerator)._accessorsForObject();
  3764. return self;
  3765. }, function($ctx1) {$ctx1.fill(self,"accessorsSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.a$cls)});
  3766. },
  3767. args: ["aGenerator"],
  3768. source: "accessorsSourceCodesWith: aGenerator\x0a\x09aGenerator accessorsForObject",
  3769. referencedClasses: [],
  3770. messageSends: ["accessorsForObject"]
  3771. }),
  3772. $globals.Object.a$cls);
  3773. $core.addMethod(
  3774. $core.method({
  3775. selector: "initialize",
  3776. protocol: "initialization",
  3777. fn: function (){
  3778. var self=this,$self=this;
  3779. return self;
  3780. },
  3781. args: [],
  3782. source: "initialize\x0a\x09\x22no op\x22",
  3783. referencedClasses: [],
  3784. messageSends: []
  3785. }),
  3786. $globals.Object.a$cls);
  3787. $core.addMethod(
  3788. $core.method({
  3789. selector: "initializeProtocolWith:",
  3790. protocol: "helios",
  3791. fn: function (aGenerator){
  3792. var self=this,$self=this;
  3793. return $core.withContext(function($ctx1) {
  3794. $recv(aGenerator)._initializeProtocolForObject();
  3795. return self;
  3796. }, function($ctx1) {$ctx1.fill(self,"initializeProtocolWith:",{aGenerator:aGenerator},$globals.Object.a$cls)});
  3797. },
  3798. args: ["aGenerator"],
  3799. source: "initializeProtocolWith: aGenerator\x0a\x09aGenerator initializeProtocolForObject",
  3800. referencedClasses: [],
  3801. messageSends: ["initializeProtocolForObject"]
  3802. }),
  3803. $globals.Object.a$cls);
  3804. $core.addMethod(
  3805. $core.method({
  3806. selector: "initializeSourceCodesWith:",
  3807. protocol: "helios",
  3808. fn: function (aGenerator){
  3809. var self=this,$self=this;
  3810. return $core.withContext(function($ctx1) {
  3811. $recv(aGenerator)._initializeForObject();
  3812. return self;
  3813. }, function($ctx1) {$ctx1.fill(self,"initializeSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.a$cls)});
  3814. },
  3815. args: ["aGenerator"],
  3816. source: "initializeSourceCodesWith: aGenerator\x0a\x09aGenerator initializeForObject",
  3817. referencedClasses: [],
  3818. messageSends: ["initializeForObject"]
  3819. }),
  3820. $globals.Object.a$cls);
  3821. $core.addClass("Boolean", $globals.Object, [], "Kernel-Objects");
  3822. $globals.Boolean.comment="I define the protocol for logic testing operations and conditional control structures for the logical values (see the `controlling` protocol).\x0a\x0aI have two instances, `true` and `false`.\x0a\x0aI am directly mapped to JavaScript Boolean. The `true` and `false` objects are the JavaScript boolean objects.\x0a\x0a## Usage Example:\x0a\x0a aBoolean not ifTrue: [ ... ] ifFalse: [ ... ]";
  3823. $core.addMethod(
  3824. $core.method({
  3825. selector: "&",
  3826. protocol: "controlling",
  3827. fn: function (aBoolean){
  3828. var self=this,$self=this;
  3829. return $core.withContext(function($ctx1) {
  3830. if(self == true) {
  3831. return aBoolean;
  3832. } else {
  3833. return false;
  3834. }
  3835. ;
  3836. return self;
  3837. }, function($ctx1) {$ctx1.fill(self,"&",{aBoolean:aBoolean},$globals.Boolean)});
  3838. },
  3839. args: ["aBoolean"],
  3840. source: "& aBoolean\x0a\x09<inlineJS: '\x0a\x09\x09if(self == true) {\x0a\x09\x09return aBoolean;\x0a\x09\x09} else {\x0a\x09\x09return false;\x0a\x09\x09}\x0a\x09'>",
  3841. referencedClasses: [],
  3842. messageSends: []
  3843. }),
  3844. $globals.Boolean);
  3845. $core.addMethod(
  3846. $core.method({
  3847. selector: "==",
  3848. protocol: "comparing",
  3849. fn: function (aBoolean){
  3850. var self=this,$self=this;
  3851. return $core.withContext(function($ctx1) {
  3852. if (typeof aBoolean === "boolean") return (self == true) === aBoolean;
  3853. else if (aBoolean != null && typeof aBoolean === "object") return (self == true) === aBoolean.valueOf();
  3854. else return false;;
  3855. return self;
  3856. }, function($ctx1) {$ctx1.fill(self,"==",{aBoolean:aBoolean},$globals.Boolean)});
  3857. },
  3858. args: ["aBoolean"],
  3859. source: "== aBoolean\x0a<inlineJS: '\x0a\x09if (typeof aBoolean === \x22boolean\x22) return (self == true) === aBoolean;\x0a\x09else if (aBoolean != null && typeof aBoolean === \x22object\x22) return (self == true) === aBoolean.valueOf();\x0a\x09else return false;\x0a'>",
  3860. referencedClasses: [],
  3861. messageSends: []
  3862. }),
  3863. $globals.Boolean);
  3864. $core.addMethod(
  3865. $core.method({
  3866. selector: "and:",
  3867. protocol: "controlling",
  3868. fn: function (aBlock){
  3869. var self=this,$self=this;
  3870. return $core.withContext(function($ctx1) {
  3871. if($core.assert(self)){
  3872. return $recv(aBlock)._value();
  3873. } else {
  3874. return false;
  3875. }
  3876. }, function($ctx1) {$ctx1.fill(self,"and:",{aBlock:aBlock},$globals.Boolean)});
  3877. },
  3878. args: ["aBlock"],
  3879. source: "and: aBlock\x0a\x09^ self\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ false ]",
  3880. referencedClasses: [],
  3881. messageSends: ["ifTrue:ifFalse:", "value"]
  3882. }),
  3883. $globals.Boolean);
  3884. $core.addMethod(
  3885. $core.method({
  3886. selector: "asBit",
  3887. protocol: "converting",
  3888. fn: function (){
  3889. var self=this,$self=this;
  3890. return $core.withContext(function($ctx1) {
  3891. if($core.assert(self)){
  3892. return (1);
  3893. } else {
  3894. return (0);
  3895. }
  3896. }, function($ctx1) {$ctx1.fill(self,"asBit",{},$globals.Boolean)});
  3897. },
  3898. args: [],
  3899. source: "asBit\x0a\x09^ self ifTrue: [ 1 ] ifFalse: [ 0 ]",
  3900. referencedClasses: [],
  3901. messageSends: ["ifTrue:ifFalse:"]
  3902. }),
  3903. $globals.Boolean);
  3904. $core.addMethod(
  3905. $core.method({
  3906. selector: "asJavaScriptObject",
  3907. protocol: "converting",
  3908. fn: function (){
  3909. var self=this,$self=this;
  3910. return self;
  3911. },
  3912. args: [],
  3913. source: "asJavaScriptObject\x0a\x09^ self",
  3914. referencedClasses: [],
  3915. messageSends: []
  3916. }),
  3917. $globals.Boolean);
  3918. $core.addMethod(
  3919. $core.method({
  3920. selector: "asString",
  3921. protocol: "converting",
  3922. fn: function (){
  3923. var self=this,$self=this;
  3924. return $core.withContext(function($ctx1) {
  3925. return self.toString();
  3926. return self;
  3927. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Boolean)});
  3928. },
  3929. args: [],
  3930. source: "asString\x0a\x09<inlineJS: 'return self.toString()'>",
  3931. referencedClasses: [],
  3932. messageSends: []
  3933. }),
  3934. $globals.Boolean);
  3935. $core.addMethod(
  3936. $core.method({
  3937. selector: "deepCopy",
  3938. protocol: "copying",
  3939. fn: function (){
  3940. var self=this,$self=this;
  3941. return self;
  3942. },
  3943. args: [],
  3944. source: "deepCopy\x0a\x09^ self",
  3945. referencedClasses: [],
  3946. messageSends: []
  3947. }),
  3948. $globals.Boolean);
  3949. $core.addMethod(
  3950. $core.method({
  3951. selector: "ifFalse:",
  3952. protocol: "controlling",
  3953. fn: function (aBlock){
  3954. var self=this,$self=this;
  3955. return $core.withContext(function($ctx1) {
  3956. return $self._ifTrue_ifFalse_((function(){
  3957. }),aBlock);
  3958. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{aBlock:aBlock},$globals.Boolean)});
  3959. },
  3960. args: ["aBlock"],
  3961. source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: [] ifFalse: aBlock",
  3962. referencedClasses: [],
  3963. messageSends: ["ifTrue:ifFalse:"]
  3964. }),
  3965. $globals.Boolean);
  3966. $core.addMethod(
  3967. $core.method({
  3968. selector: "ifFalse:ifTrue:",
  3969. protocol: "controlling",
  3970. fn: function (aBlock,anotherBlock){
  3971. var self=this,$self=this;
  3972. return $core.withContext(function($ctx1) {
  3973. return $self._ifTrue_ifFalse_(anotherBlock,aBlock);
  3974. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  3975. },
  3976. args: ["aBlock", "anotherBlock"],
  3977. source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: anotherBlock ifFalse: aBlock",
  3978. referencedClasses: [],
  3979. messageSends: ["ifTrue:ifFalse:"]
  3980. }),
  3981. $globals.Boolean);
  3982. $core.addMethod(
  3983. $core.method({
  3984. selector: "ifTrue:",
  3985. protocol: "controlling",
  3986. fn: function (aBlock){
  3987. var self=this,$self=this;
  3988. return $core.withContext(function($ctx1) {
  3989. return $self._ifTrue_ifFalse_(aBlock,(function(){
  3990. }));
  3991. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{aBlock:aBlock},$globals.Boolean)});
  3992. },
  3993. args: ["aBlock"],
  3994. source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: aBlock ifFalse: []",
  3995. referencedClasses: [],
  3996. messageSends: ["ifTrue:ifFalse:"]
  3997. }),
  3998. $globals.Boolean);
  3999. $core.addMethod(
  4000. $core.method({
  4001. selector: "ifTrue:ifFalse:",
  4002. protocol: "controlling",
  4003. fn: function (aBlock,anotherBlock){
  4004. var self=this,$self=this;
  4005. return $core.withContext(function($ctx1) {
  4006. if(self == true) {
  4007. return aBlock._value();
  4008. } else {
  4009. return anotherBlock._value();
  4010. }
  4011. ;
  4012. return self;
  4013. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  4014. },
  4015. args: ["aBlock", "anotherBlock"],
  4016. source: "ifTrue: aBlock ifFalse: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<inlineJS: '\x0a\x09\x09if(self == true) {\x0a\x09\x09return aBlock._value();\x0a\x09\x09} else {\x0a\x09\x09return anotherBlock._value();\x0a\x09\x09}\x0a\x09'>",
  4017. referencedClasses: [],
  4018. messageSends: []
  4019. }),
  4020. $globals.Boolean);
  4021. $core.addMethod(
  4022. $core.method({
  4023. selector: "isBoolean",
  4024. protocol: "testing",
  4025. fn: function (){
  4026. var self=this,$self=this;
  4027. return true;
  4028. },
  4029. args: [],
  4030. source: "isBoolean\x0a\x09^ true",
  4031. referencedClasses: [],
  4032. messageSends: []
  4033. }),
  4034. $globals.Boolean);
  4035. $core.addMethod(
  4036. $core.method({
  4037. selector: "isImmutable",
  4038. protocol: "testing",
  4039. fn: function (){
  4040. var self=this,$self=this;
  4041. return true;
  4042. },
  4043. args: [],
  4044. source: "isImmutable\x0a\x09^ true",
  4045. referencedClasses: [],
  4046. messageSends: []
  4047. }),
  4048. $globals.Boolean);
  4049. $core.addMethod(
  4050. $core.method({
  4051. selector: "not",
  4052. protocol: "controlling",
  4053. fn: function (){
  4054. var self=this,$self=this;
  4055. return $core.withContext(function($ctx1) {
  4056. return $self.__eq(false);
  4057. }, function($ctx1) {$ctx1.fill(self,"not",{},$globals.Boolean)});
  4058. },
  4059. args: [],
  4060. source: "not\x0a\x09^ self = false",
  4061. referencedClasses: [],
  4062. messageSends: ["="]
  4063. }),
  4064. $globals.Boolean);
  4065. $core.addMethod(
  4066. $core.method({
  4067. selector: "or:",
  4068. protocol: "controlling",
  4069. fn: function (aBlock){
  4070. var self=this,$self=this;
  4071. return $core.withContext(function($ctx1) {
  4072. if($core.assert(self)){
  4073. return true;
  4074. } else {
  4075. return $recv(aBlock)._value();
  4076. }
  4077. }, function($ctx1) {$ctx1.fill(self,"or:",{aBlock:aBlock},$globals.Boolean)});
  4078. },
  4079. args: ["aBlock"],
  4080. source: "or: aBlock\x0a\x09^ self\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: \x22aBlock\x22 [ aBlock value ]",
  4081. referencedClasses: [],
  4082. messageSends: ["ifTrue:ifFalse:", "value"]
  4083. }),
  4084. $globals.Boolean);
  4085. $core.addMethod(
  4086. $core.method({
  4087. selector: "printOn:",
  4088. protocol: "printing",
  4089. fn: function (aStream){
  4090. var self=this,$self=this;
  4091. return $core.withContext(function($ctx1) {
  4092. $recv(aStream)._nextPutAll_($self._asString());
  4093. return self;
  4094. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Boolean)});
  4095. },
  4096. args: ["aStream"],
  4097. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  4098. referencedClasses: [],
  4099. messageSends: ["nextPutAll:", "asString"]
  4100. }),
  4101. $globals.Boolean);
  4102. $core.addMethod(
  4103. $core.method({
  4104. selector: "shallowCopy",
  4105. protocol: "copying",
  4106. fn: function (){
  4107. var self=this,$self=this;
  4108. return self;
  4109. },
  4110. args: [],
  4111. source: "shallowCopy\x0a\x09^ self",
  4112. referencedClasses: [],
  4113. messageSends: []
  4114. }),
  4115. $globals.Boolean);
  4116. $core.addMethod(
  4117. $core.method({
  4118. selector: "|",
  4119. protocol: "controlling",
  4120. fn: function (aBoolean){
  4121. var self=this,$self=this;
  4122. return $core.withContext(function($ctx1) {
  4123. if(self == true) {
  4124. return true;
  4125. } else {
  4126. return aBoolean;
  4127. }
  4128. ;
  4129. return self;
  4130. }, function($ctx1) {$ctx1.fill(self,"|",{aBoolean:aBoolean},$globals.Boolean)});
  4131. },
  4132. args: ["aBoolean"],
  4133. source: "| aBoolean\x0a\x09<inlineJS: '\x0a\x09\x09if(self == true) {\x0a\x09\x09return true;\x0a\x09\x09} else {\x0a\x09\x09return aBoolean;\x0a\x09\x09}\x0a\x09'>",
  4134. referencedClasses: [],
  4135. messageSends: []
  4136. }),
  4137. $globals.Boolean);
  4138. $core.addClass("Date", $globals.Object, [], "Kernel-Objects");
  4139. $globals.Date.comment="I am used to work with both dates and times. Therefore `Date today` and `Date now` are both valid in\x0aAmber and answer the same date object.\x0a\x0aDate directly maps to the `Date()` JavaScript constructor, and Amber date objects are JavaScript date objects.\x0a\x0a## API\x0a\x0aThe class-side `instance creation` protocol contains some convenience methods for creating date/time objects such as `#fromSeconds:`.\x0a\x0aArithmetic and comparison is supported (see the `comparing` and `arithmetic` protocols).\x0a\x0aThe `converting` protocol provides convenience methods for various convertions (to numbers, strings, etc.).";
  4140. $core.addMethod(
  4141. $core.method({
  4142. selector: "+",
  4143. protocol: "arithmetic",
  4144. fn: function (aDate){
  4145. var self=this,$self=this;
  4146. return $core.withContext(function($ctx1) {
  4147. return self + aDate;
  4148. return self;
  4149. }, function($ctx1) {$ctx1.fill(self,"+",{aDate:aDate},$globals.Date)});
  4150. },
  4151. args: ["aDate"],
  4152. source: "+ aDate\x0a\x09<inlineJS: 'return self + aDate'>",
  4153. referencedClasses: [],
  4154. messageSends: []
  4155. }),
  4156. $globals.Date);
  4157. $core.addMethod(
  4158. $core.method({
  4159. selector: "-",
  4160. protocol: "arithmetic",
  4161. fn: function (aDate){
  4162. var self=this,$self=this;
  4163. return $core.withContext(function($ctx1) {
  4164. return self - aDate;
  4165. return self;
  4166. }, function($ctx1) {$ctx1.fill(self,"-",{aDate:aDate},$globals.Date)});
  4167. },
  4168. args: ["aDate"],
  4169. source: "- aDate\x0a\x09<inlineJS: 'return self - aDate'>",
  4170. referencedClasses: [],
  4171. messageSends: []
  4172. }),
  4173. $globals.Date);
  4174. $core.addMethod(
  4175. $core.method({
  4176. selector: "<",
  4177. protocol: "comparing",
  4178. fn: function (aDate){
  4179. var self=this,$self=this;
  4180. return $core.withContext(function($ctx1) {
  4181. return self < aDate;
  4182. return self;
  4183. }, function($ctx1) {$ctx1.fill(self,"<",{aDate:aDate},$globals.Date)});
  4184. },
  4185. args: ["aDate"],
  4186. source: "< aDate\x0a\x09<inlineJS: 'return self < aDate'>",
  4187. referencedClasses: [],
  4188. messageSends: []
  4189. }),
  4190. $globals.Date);
  4191. $core.addMethod(
  4192. $core.method({
  4193. selector: "<=",
  4194. protocol: "comparing",
  4195. fn: function (aDate){
  4196. var self=this,$self=this;
  4197. return $core.withContext(function($ctx1) {
  4198. return self <= aDate;
  4199. return self;
  4200. }, function($ctx1) {$ctx1.fill(self,"<=",{aDate:aDate},$globals.Date)});
  4201. },
  4202. args: ["aDate"],
  4203. source: "<= aDate\x0a\x09<inlineJS: 'return self <= aDate'>",
  4204. referencedClasses: [],
  4205. messageSends: []
  4206. }),
  4207. $globals.Date);
  4208. $core.addMethod(
  4209. $core.method({
  4210. selector: "=",
  4211. protocol: "comparing",
  4212. fn: function (aDate){
  4213. var self=this,$self=this;
  4214. return $core.withContext(function($ctx1) {
  4215. var $2,$1,$3;
  4216. $2=$recv(aDate)._class();
  4217. $ctx1.sendIdx["class"]=1;
  4218. $1=$recv($2).__eq_eq($self._class());
  4219. $ctx1.sendIdx["=="]=1;
  4220. return $recv($1)._and_((function(){
  4221. return $core.withContext(function($ctx2) {
  4222. $3=$self._asMilliseconds();
  4223. $ctx2.sendIdx["asMilliseconds"]=1;
  4224. return $recv($3).__eq_eq($recv(aDate)._asMilliseconds());
  4225. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4226. }));
  4227. }, function($ctx1) {$ctx1.fill(self,"=",{aDate:aDate},$globals.Date)});
  4228. },
  4229. args: ["aDate"],
  4230. source: "= aDate\x0a\x09^ (aDate class == self class) and: [ self asMilliseconds == aDate asMilliseconds ]",
  4231. referencedClasses: [],
  4232. messageSends: ["and:", "==", "class", "asMilliseconds"]
  4233. }),
  4234. $globals.Date);
  4235. $core.addMethod(
  4236. $core.method({
  4237. selector: ">",
  4238. protocol: "comparing",
  4239. fn: function (aDate){
  4240. var self=this,$self=this;
  4241. return $core.withContext(function($ctx1) {
  4242. return self > aDate;
  4243. return self;
  4244. }, function($ctx1) {$ctx1.fill(self,">",{aDate:aDate},$globals.Date)});
  4245. },
  4246. args: ["aDate"],
  4247. source: "> aDate\x0a\x09<inlineJS: 'return self > aDate'>",
  4248. referencedClasses: [],
  4249. messageSends: []
  4250. }),
  4251. $globals.Date);
  4252. $core.addMethod(
  4253. $core.method({
  4254. selector: ">=",
  4255. protocol: "comparing",
  4256. fn: function (aDate){
  4257. var self=this,$self=this;
  4258. return $core.withContext(function($ctx1) {
  4259. return self >= aDate;
  4260. return self;
  4261. }, function($ctx1) {$ctx1.fill(self,">=",{aDate:aDate},$globals.Date)});
  4262. },
  4263. args: ["aDate"],
  4264. source: ">= aDate\x0a\x09<inlineJS: 'return self >= aDate'>",
  4265. referencedClasses: [],
  4266. messageSends: []
  4267. }),
  4268. $globals.Date);
  4269. $core.addMethod(
  4270. $core.method({
  4271. selector: "asDateString",
  4272. protocol: "converting",
  4273. fn: function (){
  4274. var self=this,$self=this;
  4275. return $core.withContext(function($ctx1) {
  4276. return self.toDateString();
  4277. return self;
  4278. }, function($ctx1) {$ctx1.fill(self,"asDateString",{},$globals.Date)});
  4279. },
  4280. args: [],
  4281. source: "asDateString\x0a\x09<inlineJS: 'return self.toDateString()'>",
  4282. referencedClasses: [],
  4283. messageSends: []
  4284. }),
  4285. $globals.Date);
  4286. $core.addMethod(
  4287. $core.method({
  4288. selector: "asLocaleString",
  4289. protocol: "converting",
  4290. fn: function (){
  4291. var self=this,$self=this;
  4292. return $core.withContext(function($ctx1) {
  4293. return self.toLocaleString();
  4294. return self;
  4295. }, function($ctx1) {$ctx1.fill(self,"asLocaleString",{},$globals.Date)});
  4296. },
  4297. args: [],
  4298. source: "asLocaleString\x0a\x09<inlineJS: 'return self.toLocaleString()'>",
  4299. referencedClasses: [],
  4300. messageSends: []
  4301. }),
  4302. $globals.Date);
  4303. $core.addMethod(
  4304. $core.method({
  4305. selector: "asMilliseconds",
  4306. protocol: "converting",
  4307. fn: function (){
  4308. var self=this,$self=this;
  4309. return $core.withContext(function($ctx1) {
  4310. return $self._time();
  4311. }, function($ctx1) {$ctx1.fill(self,"asMilliseconds",{},$globals.Date)});
  4312. },
  4313. args: [],
  4314. source: "asMilliseconds\x0a\x09^ self time",
  4315. referencedClasses: [],
  4316. messageSends: ["time"]
  4317. }),
  4318. $globals.Date);
  4319. $core.addMethod(
  4320. $core.method({
  4321. selector: "asNumber",
  4322. protocol: "converting",
  4323. fn: function (){
  4324. var self=this,$self=this;
  4325. return $core.withContext(function($ctx1) {
  4326. return $self._asMilliseconds();
  4327. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.Date)});
  4328. },
  4329. args: [],
  4330. source: "asNumber\x0a\x09^ self asMilliseconds",
  4331. referencedClasses: [],
  4332. messageSends: ["asMilliseconds"]
  4333. }),
  4334. $globals.Date);
  4335. $core.addMethod(
  4336. $core.method({
  4337. selector: "asString",
  4338. protocol: "converting",
  4339. fn: function (){
  4340. var self=this,$self=this;
  4341. return $core.withContext(function($ctx1) {
  4342. return self.toString();
  4343. return self;
  4344. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Date)});
  4345. },
  4346. args: [],
  4347. source: "asString\x0a\x09<inlineJS: 'return self.toString()'>",
  4348. referencedClasses: [],
  4349. messageSends: []
  4350. }),
  4351. $globals.Date);
  4352. $core.addMethod(
  4353. $core.method({
  4354. selector: "asTimeString",
  4355. protocol: "converting",
  4356. fn: function (){
  4357. var self=this,$self=this;
  4358. return $core.withContext(function($ctx1) {
  4359. return self.toTimeString();
  4360. return self;
  4361. }, function($ctx1) {$ctx1.fill(self,"asTimeString",{},$globals.Date)});
  4362. },
  4363. args: [],
  4364. source: "asTimeString\x0a\x09<inlineJS: 'return self.toTimeString()'>",
  4365. referencedClasses: [],
  4366. messageSends: []
  4367. }),
  4368. $globals.Date);
  4369. $core.addMethod(
  4370. $core.method({
  4371. selector: "day",
  4372. protocol: "accessing",
  4373. fn: function (){
  4374. var self=this,$self=this;
  4375. return $core.withContext(function($ctx1) {
  4376. return $self._dayOfWeek();
  4377. }, function($ctx1) {$ctx1.fill(self,"day",{},$globals.Date)});
  4378. },
  4379. args: [],
  4380. source: "day\x0a\x09^ self dayOfWeek",
  4381. referencedClasses: [],
  4382. messageSends: ["dayOfWeek"]
  4383. }),
  4384. $globals.Date);
  4385. $core.addMethod(
  4386. $core.method({
  4387. selector: "day:",
  4388. protocol: "accessing",
  4389. fn: function (aNumber){
  4390. var self=this,$self=this;
  4391. return $core.withContext(function($ctx1) {
  4392. $self._dayOfWeek_(aNumber);
  4393. return self;
  4394. }, function($ctx1) {$ctx1.fill(self,"day:",{aNumber:aNumber},$globals.Date)});
  4395. },
  4396. args: ["aNumber"],
  4397. source: "day: aNumber\x0a\x09self dayOfWeek: aNumber",
  4398. referencedClasses: [],
  4399. messageSends: ["dayOfWeek:"]
  4400. }),
  4401. $globals.Date);
  4402. $core.addMethod(
  4403. $core.method({
  4404. selector: "dayOfMonth",
  4405. protocol: "accessing",
  4406. fn: function (){
  4407. var self=this,$self=this;
  4408. return $core.withContext(function($ctx1) {
  4409. return self.getDate();
  4410. return self;
  4411. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth",{},$globals.Date)});
  4412. },
  4413. args: [],
  4414. source: "dayOfMonth\x0a\x09<inlineJS: 'return self.getDate()'>",
  4415. referencedClasses: [],
  4416. messageSends: []
  4417. }),
  4418. $globals.Date);
  4419. $core.addMethod(
  4420. $core.method({
  4421. selector: "dayOfMonth:",
  4422. protocol: "accessing",
  4423. fn: function (aNumber){
  4424. var self=this,$self=this;
  4425. return $core.withContext(function($ctx1) {
  4426. self.setDate(aNumber);
  4427. return self;
  4428. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth:",{aNumber:aNumber},$globals.Date)});
  4429. },
  4430. args: ["aNumber"],
  4431. source: "dayOfMonth: aNumber\x0a\x09<inlineJS: 'self.setDate(aNumber)'>",
  4432. referencedClasses: [],
  4433. messageSends: []
  4434. }),
  4435. $globals.Date);
  4436. $core.addMethod(
  4437. $core.method({
  4438. selector: "dayOfWeek",
  4439. protocol: "accessing",
  4440. fn: function (){
  4441. var self=this,$self=this;
  4442. return $core.withContext(function($ctx1) {
  4443. return self.getDay() + 1;
  4444. return self;
  4445. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek",{},$globals.Date)});
  4446. },
  4447. args: [],
  4448. source: "dayOfWeek\x0a\x09<inlineJS: 'return self.getDay() + 1'>",
  4449. referencedClasses: [],
  4450. messageSends: []
  4451. }),
  4452. $globals.Date);
  4453. $core.addMethod(
  4454. $core.method({
  4455. selector: "dayOfWeek:",
  4456. protocol: "accessing",
  4457. fn: function (aNumber){
  4458. var self=this,$self=this;
  4459. return $core.withContext(function($ctx1) {
  4460. return self.setDay(aNumber - 1);
  4461. return self;
  4462. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek:",{aNumber:aNumber},$globals.Date)});
  4463. },
  4464. args: ["aNumber"],
  4465. source: "dayOfWeek: aNumber\x0a\x09<inlineJS: 'return self.setDay(aNumber - 1)'>",
  4466. referencedClasses: [],
  4467. messageSends: []
  4468. }),
  4469. $globals.Date);
  4470. $core.addMethod(
  4471. $core.method({
  4472. selector: "hours",
  4473. protocol: "accessing",
  4474. fn: function (){
  4475. var self=this,$self=this;
  4476. return $core.withContext(function($ctx1) {
  4477. return self.getHours();
  4478. return self;
  4479. }, function($ctx1) {$ctx1.fill(self,"hours",{},$globals.Date)});
  4480. },
  4481. args: [],
  4482. source: "hours\x0a\x09<inlineJS: 'return self.getHours()'>",
  4483. referencedClasses: [],
  4484. messageSends: []
  4485. }),
  4486. $globals.Date);
  4487. $core.addMethod(
  4488. $core.method({
  4489. selector: "hours:",
  4490. protocol: "accessing",
  4491. fn: function (aNumber){
  4492. var self=this,$self=this;
  4493. return $core.withContext(function($ctx1) {
  4494. self.setHours(aNumber);
  4495. return self;
  4496. }, function($ctx1) {$ctx1.fill(self,"hours:",{aNumber:aNumber},$globals.Date)});
  4497. },
  4498. args: ["aNumber"],
  4499. source: "hours: aNumber\x0a\x09<inlineJS: 'self.setHours(aNumber)'>",
  4500. referencedClasses: [],
  4501. messageSends: []
  4502. }),
  4503. $globals.Date);
  4504. $core.addMethod(
  4505. $core.method({
  4506. selector: "milliseconds",
  4507. protocol: "accessing",
  4508. fn: function (){
  4509. var self=this,$self=this;
  4510. return $core.withContext(function($ctx1) {
  4511. return self.getMilliseconds();
  4512. return self;
  4513. }, function($ctx1) {$ctx1.fill(self,"milliseconds",{},$globals.Date)});
  4514. },
  4515. args: [],
  4516. source: "milliseconds\x0a\x09<inlineJS: 'return self.getMilliseconds()'>",
  4517. referencedClasses: [],
  4518. messageSends: []
  4519. }),
  4520. $globals.Date);
  4521. $core.addMethod(
  4522. $core.method({
  4523. selector: "milliseconds:",
  4524. protocol: "accessing",
  4525. fn: function (aNumber){
  4526. var self=this,$self=this;
  4527. return $core.withContext(function($ctx1) {
  4528. self.setMilliseconds(aNumber);
  4529. return self;
  4530. }, function($ctx1) {$ctx1.fill(self,"milliseconds:",{aNumber:aNumber},$globals.Date)});
  4531. },
  4532. args: ["aNumber"],
  4533. source: "milliseconds: aNumber\x0a\x09<inlineJS: 'self.setMilliseconds(aNumber)'>",
  4534. referencedClasses: [],
  4535. messageSends: []
  4536. }),
  4537. $globals.Date);
  4538. $core.addMethod(
  4539. $core.method({
  4540. selector: "minutes",
  4541. protocol: "accessing",
  4542. fn: function (){
  4543. var self=this,$self=this;
  4544. return $core.withContext(function($ctx1) {
  4545. return self.getMinutes();
  4546. return self;
  4547. }, function($ctx1) {$ctx1.fill(self,"minutes",{},$globals.Date)});
  4548. },
  4549. args: [],
  4550. source: "minutes\x0a\x09<inlineJS: 'return self.getMinutes()'>",
  4551. referencedClasses: [],
  4552. messageSends: []
  4553. }),
  4554. $globals.Date);
  4555. $core.addMethod(
  4556. $core.method({
  4557. selector: "minutes:",
  4558. protocol: "accessing",
  4559. fn: function (aNumber){
  4560. var self=this,$self=this;
  4561. return $core.withContext(function($ctx1) {
  4562. self.setMinutes(aNumber);
  4563. return self;
  4564. }, function($ctx1) {$ctx1.fill(self,"minutes:",{aNumber:aNumber},$globals.Date)});
  4565. },
  4566. args: ["aNumber"],
  4567. source: "minutes: aNumber\x0a\x09<inlineJS: 'self.setMinutes(aNumber)'>",
  4568. referencedClasses: [],
  4569. messageSends: []
  4570. }),
  4571. $globals.Date);
  4572. $core.addMethod(
  4573. $core.method({
  4574. selector: "month",
  4575. protocol: "accessing",
  4576. fn: function (){
  4577. var self=this,$self=this;
  4578. return $core.withContext(function($ctx1) {
  4579. return self.getMonth() + 1;
  4580. return self;
  4581. }, function($ctx1) {$ctx1.fill(self,"month",{},$globals.Date)});
  4582. },
  4583. args: [],
  4584. source: "month\x0a\x09<inlineJS: 'return self.getMonth() + 1'>",
  4585. referencedClasses: [],
  4586. messageSends: []
  4587. }),
  4588. $globals.Date);
  4589. $core.addMethod(
  4590. $core.method({
  4591. selector: "month:",
  4592. protocol: "accessing",
  4593. fn: function (aNumber){
  4594. var self=this,$self=this;
  4595. return $core.withContext(function($ctx1) {
  4596. self.setMonth(aNumber - 1);
  4597. return self;
  4598. }, function($ctx1) {$ctx1.fill(self,"month:",{aNumber:aNumber},$globals.Date)});
  4599. },
  4600. args: ["aNumber"],
  4601. source: "month: aNumber\x0a\x09<inlineJS: 'self.setMonth(aNumber - 1)'>",
  4602. referencedClasses: [],
  4603. messageSends: []
  4604. }),
  4605. $globals.Date);
  4606. $core.addMethod(
  4607. $core.method({
  4608. selector: "printOn:",
  4609. protocol: "printing",
  4610. fn: function (aStream){
  4611. var self=this,$self=this;
  4612. return $core.withContext(function($ctx1) {
  4613. $recv(aStream)._nextPutAll_($self._asString());
  4614. return self;
  4615. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Date)});
  4616. },
  4617. args: ["aStream"],
  4618. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  4619. referencedClasses: [],
  4620. messageSends: ["nextPutAll:", "asString"]
  4621. }),
  4622. $globals.Date);
  4623. $core.addMethod(
  4624. $core.method({
  4625. selector: "seconds",
  4626. protocol: "accessing",
  4627. fn: function (){
  4628. var self=this,$self=this;
  4629. return $core.withContext(function($ctx1) {
  4630. return self.getSeconds();
  4631. return self;
  4632. }, function($ctx1) {$ctx1.fill(self,"seconds",{},$globals.Date)});
  4633. },
  4634. args: [],
  4635. source: "seconds\x0a\x09<inlineJS: 'return self.getSeconds()'>",
  4636. referencedClasses: [],
  4637. messageSends: []
  4638. }),
  4639. $globals.Date);
  4640. $core.addMethod(
  4641. $core.method({
  4642. selector: "seconds:",
  4643. protocol: "accessing",
  4644. fn: function (aNumber){
  4645. var self=this,$self=this;
  4646. return $core.withContext(function($ctx1) {
  4647. self.setSeconds(aNumber);
  4648. return self;
  4649. }, function($ctx1) {$ctx1.fill(self,"seconds:",{aNumber:aNumber},$globals.Date)});
  4650. },
  4651. args: ["aNumber"],
  4652. source: "seconds: aNumber\x0a\x09<inlineJS: 'self.setSeconds(aNumber)'>",
  4653. referencedClasses: [],
  4654. messageSends: []
  4655. }),
  4656. $globals.Date);
  4657. $core.addMethod(
  4658. $core.method({
  4659. selector: "time",
  4660. protocol: "accessing",
  4661. fn: function (){
  4662. var self=this,$self=this;
  4663. return $core.withContext(function($ctx1) {
  4664. return self.getTime();
  4665. return self;
  4666. }, function($ctx1) {$ctx1.fill(self,"time",{},$globals.Date)});
  4667. },
  4668. args: [],
  4669. source: "time\x0a\x09<inlineJS: 'return self.getTime()'>",
  4670. referencedClasses: [],
  4671. messageSends: []
  4672. }),
  4673. $globals.Date);
  4674. $core.addMethod(
  4675. $core.method({
  4676. selector: "time:",
  4677. protocol: "accessing",
  4678. fn: function (aNumber){
  4679. var self=this,$self=this;
  4680. return $core.withContext(function($ctx1) {
  4681. self.setTime(aNumber);
  4682. return self;
  4683. }, function($ctx1) {$ctx1.fill(self,"time:",{aNumber:aNumber},$globals.Date)});
  4684. },
  4685. args: ["aNumber"],
  4686. source: "time: aNumber\x0a\x09<inlineJS: 'self.setTime(aNumber)'>",
  4687. referencedClasses: [],
  4688. messageSends: []
  4689. }),
  4690. $globals.Date);
  4691. $core.addMethod(
  4692. $core.method({
  4693. selector: "year",
  4694. protocol: "accessing",
  4695. fn: function (){
  4696. var self=this,$self=this;
  4697. return $core.withContext(function($ctx1) {
  4698. return self.getFullYear();
  4699. return self;
  4700. }, function($ctx1) {$ctx1.fill(self,"year",{},$globals.Date)});
  4701. },
  4702. args: [],
  4703. source: "year\x0a\x09<inlineJS: 'return self.getFullYear()'>",
  4704. referencedClasses: [],
  4705. messageSends: []
  4706. }),
  4707. $globals.Date);
  4708. $core.addMethod(
  4709. $core.method({
  4710. selector: "year:",
  4711. protocol: "accessing",
  4712. fn: function (aNumber){
  4713. var self=this,$self=this;
  4714. return $core.withContext(function($ctx1) {
  4715. self.setFullYear(aNumber);
  4716. return self;
  4717. }, function($ctx1) {$ctx1.fill(self,"year:",{aNumber:aNumber},$globals.Date)});
  4718. },
  4719. args: ["aNumber"],
  4720. source: "year: aNumber\x0a\x09<inlineJS: 'self.setFullYear(aNumber)'>",
  4721. referencedClasses: [],
  4722. messageSends: []
  4723. }),
  4724. $globals.Date);
  4725. $core.addMethod(
  4726. $core.method({
  4727. selector: "classTag",
  4728. protocol: "accessing",
  4729. fn: function (){
  4730. var self=this,$self=this;
  4731. return "magnitude";
  4732. },
  4733. args: [],
  4734. source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'magnitude'",
  4735. referencedClasses: [],
  4736. messageSends: []
  4737. }),
  4738. $globals.Date.a$cls);
  4739. $core.addMethod(
  4740. $core.method({
  4741. selector: "fromMilliseconds:",
  4742. protocol: "instance creation",
  4743. fn: function (aNumber){
  4744. var self=this,$self=this;
  4745. return $core.withContext(function($ctx1) {
  4746. return $self._new_(aNumber);
  4747. }, function($ctx1) {$ctx1.fill(self,"fromMilliseconds:",{aNumber:aNumber},$globals.Date.a$cls)});
  4748. },
  4749. args: ["aNumber"],
  4750. source: "fromMilliseconds: aNumber\x0a\x09^ self new: aNumber",
  4751. referencedClasses: [],
  4752. messageSends: ["new:"]
  4753. }),
  4754. $globals.Date.a$cls);
  4755. $core.addMethod(
  4756. $core.method({
  4757. selector: "fromSeconds:",
  4758. protocol: "instance creation",
  4759. fn: function (aNumber){
  4760. var self=this,$self=this;
  4761. return $core.withContext(function($ctx1) {
  4762. return $self._fromMilliseconds_($recv(aNumber).__star((1000)));
  4763. }, function($ctx1) {$ctx1.fill(self,"fromSeconds:",{aNumber:aNumber},$globals.Date.a$cls)});
  4764. },
  4765. args: ["aNumber"],
  4766. source: "fromSeconds: aNumber\x0a\x09^ self fromMilliseconds: aNumber * 1000",
  4767. referencedClasses: [],
  4768. messageSends: ["fromMilliseconds:", "*"]
  4769. }),
  4770. $globals.Date.a$cls);
  4771. $core.addMethod(
  4772. $core.method({
  4773. selector: "fromString:",
  4774. protocol: "instance creation",
  4775. fn: function (aString){
  4776. var self=this,$self=this;
  4777. return $core.withContext(function($ctx1) {
  4778. return $self._new_(aString);
  4779. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.Date.a$cls)});
  4780. },
  4781. args: ["aString"],
  4782. source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^ self new: aString",
  4783. referencedClasses: [],
  4784. messageSends: ["new:"]
  4785. }),
  4786. $globals.Date.a$cls);
  4787. $core.addMethod(
  4788. $core.method({
  4789. selector: "millisecondsToRun:",
  4790. protocol: "instance creation",
  4791. fn: function (aBlock){
  4792. var self=this,$self=this;
  4793. var t;
  4794. return $core.withContext(function($ctx1) {
  4795. t=$recv($globals.Date)._now();
  4796. $ctx1.sendIdx["now"]=1;
  4797. $recv(aBlock)._value();
  4798. return $recv($recv($globals.Date)._now()).__minus(t);
  4799. }, function($ctx1) {$ctx1.fill(self,"millisecondsToRun:",{aBlock:aBlock,t:t},$globals.Date.a$cls)});
  4800. },
  4801. args: ["aBlock"],
  4802. source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^ Date now - t",
  4803. referencedClasses: ["Date"],
  4804. messageSends: ["now", "value", "-"]
  4805. }),
  4806. $globals.Date.a$cls);
  4807. $core.addMethod(
  4808. $core.method({
  4809. selector: "new:",
  4810. protocol: "instance creation",
  4811. fn: function (anObject){
  4812. var self=this,$self=this;
  4813. return $core.withContext(function($ctx1) {
  4814. return new Date(anObject);
  4815. return self;
  4816. }, function($ctx1) {$ctx1.fill(self,"new:",{anObject:anObject},$globals.Date.a$cls)});
  4817. },
  4818. args: ["anObject"],
  4819. source: "new: anObject\x0a\x09<inlineJS: 'return new Date(anObject)'>",
  4820. referencedClasses: [],
  4821. messageSends: []
  4822. }),
  4823. $globals.Date.a$cls);
  4824. $core.addMethod(
  4825. $core.method({
  4826. selector: "now",
  4827. protocol: "instance creation",
  4828. fn: function (){
  4829. var self=this,$self=this;
  4830. return $core.withContext(function($ctx1) {
  4831. return $self._today();
  4832. }, function($ctx1) {$ctx1.fill(self,"now",{},$globals.Date.a$cls)});
  4833. },
  4834. args: [],
  4835. source: "now\x0a\x09^ self today",
  4836. referencedClasses: [],
  4837. messageSends: ["today"]
  4838. }),
  4839. $globals.Date.a$cls);
  4840. $core.addMethod(
  4841. $core.method({
  4842. selector: "today",
  4843. protocol: "instance creation",
  4844. fn: function (){
  4845. var self=this,$self=this;
  4846. return $core.withContext(function($ctx1) {
  4847. return $self._new();
  4848. }, function($ctx1) {$ctx1.fill(self,"today",{},$globals.Date.a$cls)});
  4849. },
  4850. args: [],
  4851. source: "today\x0a\x09^ self new",
  4852. referencedClasses: [],
  4853. messageSends: ["new"]
  4854. }),
  4855. $globals.Date.a$cls);
  4856. $core.addClass("Number", $globals.Object, [], "Kernel-Objects");
  4857. $globals.Number.comment="I am the Amber representation for all numbers.\x0aI am directly mapped to JavaScript Number.\x0a\x0a## API\x0a\x0aI provide all necessary methods for arithmetic operations, comparison, conversion and so on with numbers.\x0a\x0aMy instances can also be used to evaluate a block a fixed number of times:\x0a\x0a\x095 timesRepeat: [ Transcript show: 'This will be printed 5 times'; cr ].\x0a\x09\x0a\x091 to: 5 do: [ :aNumber| Transcript show: aNumber asString; cr ].\x0a\x09\x0a\x091 to: 10 by: 2 do: [ :aNumber| Transcript show: aNumber asString; cr ].";
  4858. $core.addMethod(
  4859. $core.method({
  4860. selector: "&",
  4861. protocol: "converting",
  4862. fn: function (aNumber){
  4863. var self=this,$self=this;
  4864. return $core.withContext(function($ctx1) {
  4865. return self & aNumber;
  4866. return self;
  4867. }, function($ctx1) {$ctx1.fill(self,"&",{aNumber:aNumber},$globals.Number)});
  4868. },
  4869. args: ["aNumber"],
  4870. source: "& aNumber\x0a\x09<inlineJS: 'return self & aNumber'>",
  4871. referencedClasses: [],
  4872. messageSends: []
  4873. }),
  4874. $globals.Number);
  4875. $core.addMethod(
  4876. $core.method({
  4877. selector: "*",
  4878. protocol: "arithmetic",
  4879. fn: function (aNumber){
  4880. var self=this,$self=this;
  4881. return $core.withContext(function($ctx1) {
  4882. return self * aNumber;
  4883. return self;
  4884. }, function($ctx1) {$ctx1.fill(self,"*",{aNumber:aNumber},$globals.Number)});
  4885. },
  4886. args: ["aNumber"],
  4887. source: "* aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self * aNumber'>",
  4888. referencedClasses: [],
  4889. messageSends: []
  4890. }),
  4891. $globals.Number);
  4892. $core.addMethod(
  4893. $core.method({
  4894. selector: "**",
  4895. protocol: "mathematical functions",
  4896. fn: function (exponent){
  4897. var self=this,$self=this;
  4898. return $core.withContext(function($ctx1) {
  4899. return $self._raisedTo_(exponent);
  4900. }, function($ctx1) {$ctx1.fill(self,"**",{exponent:exponent},$globals.Number)});
  4901. },
  4902. args: ["exponent"],
  4903. source: "** exponent\x0a\x09^ self raisedTo: exponent",
  4904. referencedClasses: [],
  4905. messageSends: ["raisedTo:"]
  4906. }),
  4907. $globals.Number);
  4908. $core.addMethod(
  4909. $core.method({
  4910. selector: "+",
  4911. protocol: "arithmetic",
  4912. fn: function (aNumber){
  4913. var self=this,$self=this;
  4914. return $core.withContext(function($ctx1) {
  4915. return self + aNumber;
  4916. return self;
  4917. }, function($ctx1) {$ctx1.fill(self,"+",{aNumber:aNumber},$globals.Number)});
  4918. },
  4919. args: ["aNumber"],
  4920. source: "+ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self + aNumber'>",
  4921. referencedClasses: [],
  4922. messageSends: []
  4923. }),
  4924. $globals.Number);
  4925. $core.addMethod(
  4926. $core.method({
  4927. selector: "-",
  4928. protocol: "arithmetic",
  4929. fn: function (aNumber){
  4930. var self=this,$self=this;
  4931. return $core.withContext(function($ctx1) {
  4932. return self - aNumber;
  4933. return self;
  4934. }, function($ctx1) {$ctx1.fill(self,"-",{aNumber:aNumber},$globals.Number)});
  4935. },
  4936. args: ["aNumber"],
  4937. source: "- aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self - aNumber'>",
  4938. referencedClasses: [],
  4939. messageSends: []
  4940. }),
  4941. $globals.Number);
  4942. $core.addMethod(
  4943. $core.method({
  4944. selector: "/",
  4945. protocol: "arithmetic",
  4946. fn: function (aNumber){
  4947. var self=this,$self=this;
  4948. return $core.withContext(function($ctx1) {
  4949. return self / aNumber;
  4950. return self;
  4951. }, function($ctx1) {$ctx1.fill(self,"/",{aNumber:aNumber},$globals.Number)});
  4952. },
  4953. args: ["aNumber"],
  4954. source: "/ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self / aNumber'>",
  4955. referencedClasses: [],
  4956. messageSends: []
  4957. }),
  4958. $globals.Number);
  4959. $core.addMethod(
  4960. $core.method({
  4961. selector: "//",
  4962. protocol: "arithmetic",
  4963. fn: function (aNumber){
  4964. var self=this,$self=this;
  4965. return $core.withContext(function($ctx1) {
  4966. return $recv($self.__slash(aNumber))._floor();
  4967. }, function($ctx1) {$ctx1.fill(self,"//",{aNumber:aNumber},$globals.Number)});
  4968. },
  4969. args: ["aNumber"],
  4970. source: "// aNumber\x0a\x09^ (self / aNumber) floor",
  4971. referencedClasses: [],
  4972. messageSends: ["floor", "/"]
  4973. }),
  4974. $globals.Number);
  4975. $core.addMethod(
  4976. $core.method({
  4977. selector: "<",
  4978. protocol: "comparing",
  4979. fn: function (aNumber){
  4980. var self=this,$self=this;
  4981. return $core.withContext(function($ctx1) {
  4982. return self < aNumber;
  4983. return self;
  4984. }, function($ctx1) {$ctx1.fill(self,"<",{aNumber:aNumber},$globals.Number)});
  4985. },
  4986. args: ["aNumber"],
  4987. source: "< aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self < aNumber'>",
  4988. referencedClasses: [],
  4989. messageSends: []
  4990. }),
  4991. $globals.Number);
  4992. $core.addMethod(
  4993. $core.method({
  4994. selector: "<=",
  4995. protocol: "comparing",
  4996. fn: function (aNumber){
  4997. var self=this,$self=this;
  4998. return $core.withContext(function($ctx1) {
  4999. return self <= aNumber;
  5000. return self;
  5001. }, function($ctx1) {$ctx1.fill(self,"<=",{aNumber:aNumber},$globals.Number)});
  5002. },
  5003. args: ["aNumber"],
  5004. source: "<= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self <= aNumber'>",
  5005. referencedClasses: [],
  5006. messageSends: []
  5007. }),
  5008. $globals.Number);
  5009. $core.addMethod(
  5010. $core.method({
  5011. selector: "==",
  5012. protocol: "comparing",
  5013. fn: function (aNumber){
  5014. var self=this,$self=this;
  5015. return $core.withContext(function($ctx1) {
  5016. if (typeof aNumber === "number") return Number(self) === aNumber;
  5017. else if (aNumber != null && typeof aNumber === "object") return Number(self) === aNumber.valueOf();
  5018. else return false;;
  5019. return self;
  5020. }, function($ctx1) {$ctx1.fill(self,"==",{aNumber:aNumber},$globals.Number)});
  5021. },
  5022. args: ["aNumber"],
  5023. source: "== aNumber\x0a<inlineJS: '\x0a\x09if (typeof aNumber === \x22number\x22) return Number(self) === aNumber;\x0a\x09else if (aNumber != null && typeof aNumber === \x22object\x22) return Number(self) === aNumber.valueOf();\x0a\x09else return false;\x0a'>",
  5024. referencedClasses: [],
  5025. messageSends: []
  5026. }),
  5027. $globals.Number);
  5028. $core.addMethod(
  5029. $core.method({
  5030. selector: ">",
  5031. protocol: "comparing",
  5032. fn: function (aNumber){
  5033. var self=this,$self=this;
  5034. return $core.withContext(function($ctx1) {
  5035. return self > aNumber;
  5036. return self;
  5037. }, function($ctx1) {$ctx1.fill(self,">",{aNumber:aNumber},$globals.Number)});
  5038. },
  5039. args: ["aNumber"],
  5040. source: "> aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self > aNumber'>",
  5041. referencedClasses: [],
  5042. messageSends: []
  5043. }),
  5044. $globals.Number);
  5045. $core.addMethod(
  5046. $core.method({
  5047. selector: ">=",
  5048. protocol: "comparing",
  5049. fn: function (aNumber){
  5050. var self=this,$self=this;
  5051. return $core.withContext(function($ctx1) {
  5052. return self >= aNumber;
  5053. return self;
  5054. }, function($ctx1) {$ctx1.fill(self,">=",{aNumber:aNumber},$globals.Number)});
  5055. },
  5056. args: ["aNumber"],
  5057. source: ">= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self >= aNumber'>",
  5058. referencedClasses: [],
  5059. messageSends: []
  5060. }),
  5061. $globals.Number);
  5062. $core.addMethod(
  5063. $core.method({
  5064. selector: "@",
  5065. protocol: "converting",
  5066. fn: function (aNumber){
  5067. var self=this,$self=this;
  5068. return $core.withContext(function($ctx1) {
  5069. return $recv($globals.Point)._x_y_(self,aNumber);
  5070. }, function($ctx1) {$ctx1.fill(self,"@",{aNumber:aNumber},$globals.Number)});
  5071. },
  5072. args: ["aNumber"],
  5073. source: "@ aNumber\x0a\x09^ Point x: self y: aNumber",
  5074. referencedClasses: ["Point"],
  5075. messageSends: ["x:y:"]
  5076. }),
  5077. $globals.Number);
  5078. $core.addMethod(
  5079. $core.method({
  5080. selector: "\x5c\x5c",
  5081. protocol: "arithmetic",
  5082. fn: function (aNumber){
  5083. var self=this,$self=this;
  5084. return $core.withContext(function($ctx1) {
  5085. return self % aNumber;
  5086. return self;
  5087. }, function($ctx1) {$ctx1.fill(self,"\x5c\x5c",{aNumber:aNumber},$globals.Number)});
  5088. },
  5089. args: ["aNumber"],
  5090. source: "\x5c\x5c aNumber\x0a\x09<inlineJS: 'return self % aNumber'>",
  5091. referencedClasses: [],
  5092. messageSends: []
  5093. }),
  5094. $globals.Number);
  5095. $core.addMethod(
  5096. $core.method({
  5097. selector: "abs",
  5098. protocol: "arithmetic",
  5099. fn: function (){
  5100. var self=this,$self=this;
  5101. return $core.withContext(function($ctx1) {
  5102. return Math.abs(self);;
  5103. return self;
  5104. }, function($ctx1) {$ctx1.fill(self,"abs",{},$globals.Number)});
  5105. },
  5106. args: [],
  5107. source: "abs\x0a\x09<inlineJS: 'return Math.abs(self);'>",
  5108. referencedClasses: [],
  5109. messageSends: []
  5110. }),
  5111. $globals.Number);
  5112. $core.addMethod(
  5113. $core.method({
  5114. selector: "arcCos",
  5115. protocol: "mathematical functions",
  5116. fn: function (){
  5117. var self=this,$self=this;
  5118. return $core.withContext(function($ctx1) {
  5119. return Math.acos(self);;
  5120. return self;
  5121. }, function($ctx1) {$ctx1.fill(self,"arcCos",{},$globals.Number)});
  5122. },
  5123. args: [],
  5124. source: "arcCos\x0a\x09<inlineJS: 'return Math.acos(self);'>",
  5125. referencedClasses: [],
  5126. messageSends: []
  5127. }),
  5128. $globals.Number);
  5129. $core.addMethod(
  5130. $core.method({
  5131. selector: "arcSin",
  5132. protocol: "mathematical functions",
  5133. fn: function (){
  5134. var self=this,$self=this;
  5135. return $core.withContext(function($ctx1) {
  5136. return Math.asin(self);;
  5137. return self;
  5138. }, function($ctx1) {$ctx1.fill(self,"arcSin",{},$globals.Number)});
  5139. },
  5140. args: [],
  5141. source: "arcSin\x0a\x09<inlineJS: 'return Math.asin(self);'>",
  5142. referencedClasses: [],
  5143. messageSends: []
  5144. }),
  5145. $globals.Number);
  5146. $core.addMethod(
  5147. $core.method({
  5148. selector: "arcTan",
  5149. protocol: "mathematical functions",
  5150. fn: function (){
  5151. var self=this,$self=this;
  5152. return $core.withContext(function($ctx1) {
  5153. return Math.atan(self);;
  5154. return self;
  5155. }, function($ctx1) {$ctx1.fill(self,"arcTan",{},$globals.Number)});
  5156. },
  5157. args: [],
  5158. source: "arcTan\x0a\x09<inlineJS: 'return Math.atan(self);'>",
  5159. referencedClasses: [],
  5160. messageSends: []
  5161. }),
  5162. $globals.Number);
  5163. $core.addMethod(
  5164. $core.method({
  5165. selector: "arcTan:",
  5166. protocol: "mathematical functions",
  5167. fn: function (aNumber){
  5168. var self=this,$self=this;
  5169. return $core.withContext(function($ctx1) {
  5170. return Math.atan2(self, aNumber);;
  5171. return self;
  5172. }, function($ctx1) {$ctx1.fill(self,"arcTan:",{aNumber:aNumber},$globals.Number)});
  5173. },
  5174. args: ["aNumber"],
  5175. source: "arcTan: aNumber\x0a\x09<inlineJS: 'return Math.atan2(self, aNumber);'>",
  5176. referencedClasses: [],
  5177. messageSends: []
  5178. }),
  5179. $globals.Number);
  5180. $core.addMethod(
  5181. $core.method({
  5182. selector: "asJavaScriptObject",
  5183. protocol: "converting",
  5184. fn: function (){
  5185. var self=this,$self=this;
  5186. return self;
  5187. },
  5188. args: [],
  5189. source: "asJavaScriptObject\x0a\x09^ self",
  5190. referencedClasses: [],
  5191. messageSends: []
  5192. }),
  5193. $globals.Number);
  5194. $core.addMethod(
  5195. $core.method({
  5196. selector: "asJavaScriptSource",
  5197. protocol: "converting",
  5198. fn: function (){
  5199. var self=this,$self=this;
  5200. return $core.withContext(function($ctx1) {
  5201. var $1;
  5202. $1=$recv("(".__comma($self._printString())).__comma(")");
  5203. $ctx1.sendIdx[","]=1;
  5204. return $1;
  5205. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Number)});
  5206. },
  5207. args: [],
  5208. source: "asJavaScriptSource\x0a\x09^ '(', self printString, ')'",
  5209. referencedClasses: [],
  5210. messageSends: [",", "printString"]
  5211. }),
  5212. $globals.Number);
  5213. $core.addMethod(
  5214. $core.method({
  5215. selector: "asNumber",
  5216. protocol: "converting",
  5217. fn: function (){
  5218. var self=this,$self=this;
  5219. return self;
  5220. },
  5221. args: [],
  5222. source: "asNumber\x0a\x09^ self",
  5223. referencedClasses: [],
  5224. messageSends: []
  5225. }),
  5226. $globals.Number);
  5227. $core.addMethod(
  5228. $core.method({
  5229. selector: "asPoint",
  5230. protocol: "converting",
  5231. fn: function (){
  5232. var self=this,$self=this;
  5233. return $core.withContext(function($ctx1) {
  5234. return $recv($globals.Point)._x_y_(self,self);
  5235. }, function($ctx1) {$ctx1.fill(self,"asPoint",{},$globals.Number)});
  5236. },
  5237. args: [],
  5238. source: "asPoint\x0a\x09^ Point x: self y: self",
  5239. referencedClasses: ["Point"],
  5240. messageSends: ["x:y:"]
  5241. }),
  5242. $globals.Number);
  5243. $core.addMethod(
  5244. $core.method({
  5245. selector: "asString",
  5246. protocol: "converting",
  5247. fn: function (){
  5248. var self=this,$self=this;
  5249. return $core.withContext(function($ctx1) {
  5250. return String(self);
  5251. return self;
  5252. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Number)});
  5253. },
  5254. args: [],
  5255. source: "asString\x0a\x09<inlineJS: 'return String(self)'>",
  5256. referencedClasses: [],
  5257. messageSends: []
  5258. }),
  5259. $globals.Number);
  5260. $core.addMethod(
  5261. $core.method({
  5262. selector: "atRandom",
  5263. protocol: "converting",
  5264. fn: function (){
  5265. var self=this,$self=this;
  5266. return $core.withContext(function($ctx1) {
  5267. return $recv($recv($recv($recv($recv($globals.Random)._new())._next()).__star(self))._truncated()).__plus((1));
  5268. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.Number)});
  5269. },
  5270. args: [],
  5271. source: "atRandom\x0a\x09^ (Random new next * self) truncated + 1",
  5272. referencedClasses: ["Random"],
  5273. messageSends: ["+", "truncated", "*", "next", "new"]
  5274. }),
  5275. $globals.Number);
  5276. $core.addMethod(
  5277. $core.method({
  5278. selector: "between:and:",
  5279. protocol: "testing",
  5280. fn: function (min,max){
  5281. var self=this,$self=this;
  5282. return $core.withContext(function($ctx1) {
  5283. return $recv($self.__gt_eq(min))._and_((function(){
  5284. return $core.withContext(function($ctx2) {
  5285. return $self.__lt_eq(max);
  5286. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5287. }));
  5288. }, function($ctx1) {$ctx1.fill(self,"between:and:",{min:min,max:max},$globals.Number)});
  5289. },
  5290. args: ["min", "max"],
  5291. source: "between: min and: max\x0a ^ self >= min and: [ self <= max ]",
  5292. referencedClasses: [],
  5293. messageSends: ["and:", ">=", "<="]
  5294. }),
  5295. $globals.Number);
  5296. $core.addMethod(
  5297. $core.method({
  5298. selector: "bitAnd:",
  5299. protocol: "converting",
  5300. fn: function (aNumber){
  5301. var self=this,$self=this;
  5302. return $core.withContext(function($ctx1) {
  5303. return self & aNumber;
  5304. return self;
  5305. }, function($ctx1) {$ctx1.fill(self,"bitAnd:",{aNumber:aNumber},$globals.Number)});
  5306. },
  5307. args: ["aNumber"],
  5308. source: "bitAnd: aNumber\x0a\x09<inlineJS: 'return self & aNumber'>",
  5309. referencedClasses: [],
  5310. messageSends: []
  5311. }),
  5312. $globals.Number);
  5313. $core.addMethod(
  5314. $core.method({
  5315. selector: "bitNot",
  5316. protocol: "converting",
  5317. fn: function (){
  5318. var self=this,$self=this;
  5319. return $core.withContext(function($ctx1) {
  5320. return ~self;
  5321. return self;
  5322. }, function($ctx1) {$ctx1.fill(self,"bitNot",{},$globals.Number)});
  5323. },
  5324. args: [],
  5325. source: "bitNot\x0a\x09<inlineJS: 'return ~self'>",
  5326. referencedClasses: [],
  5327. messageSends: []
  5328. }),
  5329. $globals.Number);
  5330. $core.addMethod(
  5331. $core.method({
  5332. selector: "bitOr:",
  5333. protocol: "converting",
  5334. fn: function (aNumber){
  5335. var self=this,$self=this;
  5336. return $core.withContext(function($ctx1) {
  5337. return self | aNumber;
  5338. return self;
  5339. }, function($ctx1) {$ctx1.fill(self,"bitOr:",{aNumber:aNumber},$globals.Number)});
  5340. },
  5341. args: ["aNumber"],
  5342. source: "bitOr: aNumber\x0a\x09<inlineJS: 'return self | aNumber'>",
  5343. referencedClasses: [],
  5344. messageSends: []
  5345. }),
  5346. $globals.Number);
  5347. $core.addMethod(
  5348. $core.method({
  5349. selector: "bitXor:",
  5350. protocol: "converting",
  5351. fn: function (aNumber){
  5352. var self=this,$self=this;
  5353. return $core.withContext(function($ctx1) {
  5354. return self ^ aNumber;
  5355. return self;
  5356. }, function($ctx1) {$ctx1.fill(self,"bitXor:",{aNumber:aNumber},$globals.Number)});
  5357. },
  5358. args: ["aNumber"],
  5359. source: "bitXor: aNumber\x0a\x09<inlineJS: 'return self ^ aNumber'>",
  5360. referencedClasses: [],
  5361. messageSends: []
  5362. }),
  5363. $globals.Number);
  5364. $core.addMethod(
  5365. $core.method({
  5366. selector: "ceiling",
  5367. protocol: "converting",
  5368. fn: function (){
  5369. var self=this,$self=this;
  5370. return $core.withContext(function($ctx1) {
  5371. return Math.ceil(self);;
  5372. return self;
  5373. }, function($ctx1) {$ctx1.fill(self,"ceiling",{},$globals.Number)});
  5374. },
  5375. args: [],
  5376. source: "ceiling\x0a\x09<inlineJS: 'return Math.ceil(self);'>",
  5377. referencedClasses: [],
  5378. messageSends: []
  5379. }),
  5380. $globals.Number);
  5381. $core.addMethod(
  5382. $core.method({
  5383. selector: "copy",
  5384. protocol: "copying",
  5385. fn: function (){
  5386. var self=this,$self=this;
  5387. return self;
  5388. },
  5389. args: [],
  5390. source: "copy\x0a\x09^ self",
  5391. referencedClasses: [],
  5392. messageSends: []
  5393. }),
  5394. $globals.Number);
  5395. $core.addMethod(
  5396. $core.method({
  5397. selector: "cos",
  5398. protocol: "mathematical functions",
  5399. fn: function (){
  5400. var self=this,$self=this;
  5401. return $core.withContext(function($ctx1) {
  5402. return Math.cos(self);;
  5403. return self;
  5404. }, function($ctx1) {$ctx1.fill(self,"cos",{},$globals.Number)});
  5405. },
  5406. args: [],
  5407. source: "cos\x0a\x09<inlineJS: 'return Math.cos(self);'>",
  5408. referencedClasses: [],
  5409. messageSends: []
  5410. }),
  5411. $globals.Number);
  5412. $core.addMethod(
  5413. $core.method({
  5414. selector: "deepCopy",
  5415. protocol: "copying",
  5416. fn: function (){
  5417. var self=this,$self=this;
  5418. return $core.withContext(function($ctx1) {
  5419. return $self._copy();
  5420. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Number)});
  5421. },
  5422. args: [],
  5423. source: "deepCopy\x0a\x09^ self copy",
  5424. referencedClasses: [],
  5425. messageSends: ["copy"]
  5426. }),
  5427. $globals.Number);
  5428. $core.addMethod(
  5429. $core.method({
  5430. selector: "degreesToRadians",
  5431. protocol: "converting",
  5432. fn: function (){
  5433. var self=this,$self=this;
  5434. return $core.withContext(function($ctx1) {
  5435. return $self.__star($recv($globals.Number)._radiansPerDegree());
  5436. }, function($ctx1) {$ctx1.fill(self,"degreesToRadians",{},$globals.Number)});
  5437. },
  5438. args: [],
  5439. source: "degreesToRadians\x0a\x09^ self * Number radiansPerDegree",
  5440. referencedClasses: ["Number"],
  5441. messageSends: ["*", "radiansPerDegree"]
  5442. }),
  5443. $globals.Number);
  5444. $core.addMethod(
  5445. $core.method({
  5446. selector: "even",
  5447. protocol: "testing",
  5448. fn: function (){
  5449. var self=this,$self=this;
  5450. return $core.withContext(function($ctx1) {
  5451. return (0).__eq($self.__backslash_backslash((2)));
  5452. }, function($ctx1) {$ctx1.fill(self,"even",{},$globals.Number)});
  5453. },
  5454. args: [],
  5455. source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)",
  5456. referencedClasses: [],
  5457. messageSends: ["=", "\x5c\x5c"]
  5458. }),
  5459. $globals.Number);
  5460. $core.addMethod(
  5461. $core.method({
  5462. selector: "floor",
  5463. protocol: "converting",
  5464. fn: function (){
  5465. var self=this,$self=this;
  5466. return $core.withContext(function($ctx1) {
  5467. return Math.floor(self);;
  5468. return self;
  5469. }, function($ctx1) {$ctx1.fill(self,"floor",{},$globals.Number)});
  5470. },
  5471. args: [],
  5472. source: "floor\x0a\x09<inlineJS: 'return Math.floor(self);'>",
  5473. referencedClasses: [],
  5474. messageSends: []
  5475. }),
  5476. $globals.Number);
  5477. $core.addMethod(
  5478. $core.method({
  5479. selector: "isImmutable",
  5480. protocol: "testing",
  5481. fn: function (){
  5482. var self=this,$self=this;
  5483. return true;
  5484. },
  5485. args: [],
  5486. source: "isImmutable\x0a\x09^ true",
  5487. referencedClasses: [],
  5488. messageSends: []
  5489. }),
  5490. $globals.Number);
  5491. $core.addMethod(
  5492. $core.method({
  5493. selector: "isNumber",
  5494. protocol: "testing",
  5495. fn: function (){
  5496. var self=this,$self=this;
  5497. return true;
  5498. },
  5499. args: [],
  5500. source: "isNumber\x0a\x09^ true",
  5501. referencedClasses: [],
  5502. messageSends: []
  5503. }),
  5504. $globals.Number);
  5505. $core.addMethod(
  5506. $core.method({
  5507. selector: "isZero",
  5508. protocol: "testing",
  5509. fn: function (){
  5510. var self=this,$self=this;
  5511. return $core.withContext(function($ctx1) {
  5512. return $self.__eq((0));
  5513. }, function($ctx1) {$ctx1.fill(self,"isZero",{},$globals.Number)});
  5514. },
  5515. args: [],
  5516. source: "isZero\x0a\x09^ self = 0",
  5517. referencedClasses: [],
  5518. messageSends: ["="]
  5519. }),
  5520. $globals.Number);
  5521. $core.addMethod(
  5522. $core.method({
  5523. selector: "ln",
  5524. protocol: "mathematical functions",
  5525. fn: function (){
  5526. var self=this,$self=this;
  5527. return $core.withContext(function($ctx1) {
  5528. return Math.log(self);;
  5529. return self;
  5530. }, function($ctx1) {$ctx1.fill(self,"ln",{},$globals.Number)});
  5531. },
  5532. args: [],
  5533. source: "ln\x0a\x09<inlineJS: 'return Math.log(self);'>",
  5534. referencedClasses: [],
  5535. messageSends: []
  5536. }),
  5537. $globals.Number);
  5538. $core.addMethod(
  5539. $core.method({
  5540. selector: "ln1p",
  5541. protocol: "mathematical functions",
  5542. fn: function (){
  5543. var self=this,$self=this;
  5544. return $core.withContext(function($ctx1) {
  5545. return Math.log1p(self);;
  5546. return self;
  5547. }, function($ctx1) {$ctx1.fill(self,"ln1p",{},$globals.Number)});
  5548. },
  5549. args: [],
  5550. source: "ln1p\x0a\x09<inlineJS: 'return Math.log1p(self);'>",
  5551. referencedClasses: [],
  5552. messageSends: []
  5553. }),
  5554. $globals.Number);
  5555. $core.addMethod(
  5556. $core.method({
  5557. selector: "log",
  5558. protocol: "mathematical functions",
  5559. fn: function (){
  5560. var self=this,$self=this;
  5561. return $core.withContext(function($ctx1) {
  5562. return Math.log(self) / Math.LN10;;
  5563. return self;
  5564. }, function($ctx1) {$ctx1.fill(self,"log",{},$globals.Number)});
  5565. },
  5566. args: [],
  5567. source: "log\x0a\x09<inlineJS: 'return Math.log(self) / Math.LN10;'>",
  5568. referencedClasses: [],
  5569. messageSends: []
  5570. }),
  5571. $globals.Number);
  5572. $core.addMethod(
  5573. $core.method({
  5574. selector: "log:",
  5575. protocol: "mathematical functions",
  5576. fn: function (aNumber){
  5577. var self=this,$self=this;
  5578. return $core.withContext(function($ctx1) {
  5579. return Math.log(self) / Math.log(aNumber);;
  5580. return self;
  5581. }, function($ctx1) {$ctx1.fill(self,"log:",{aNumber:aNumber},$globals.Number)});
  5582. },
  5583. args: ["aNumber"],
  5584. source: "log: aNumber\x0a\x09<inlineJS: 'return Math.log(self) / Math.log(aNumber);'>",
  5585. referencedClasses: [],
  5586. messageSends: []
  5587. }),
  5588. $globals.Number);
  5589. $core.addMethod(
  5590. $core.method({
  5591. selector: "max:",
  5592. protocol: "arithmetic",
  5593. fn: function (aNumber){
  5594. var self=this,$self=this;
  5595. return $core.withContext(function($ctx1) {
  5596. return Math.max(self, aNumber);;
  5597. return self;
  5598. }, function($ctx1) {$ctx1.fill(self,"max:",{aNumber:aNumber},$globals.Number)});
  5599. },
  5600. args: ["aNumber"],
  5601. source: "max: aNumber\x0a\x09<inlineJS: 'return Math.max(self, aNumber);'>",
  5602. referencedClasses: [],
  5603. messageSends: []
  5604. }),
  5605. $globals.Number);
  5606. $core.addMethod(
  5607. $core.method({
  5608. selector: "min:",
  5609. protocol: "arithmetic",
  5610. fn: function (aNumber){
  5611. var self=this,$self=this;
  5612. return $core.withContext(function($ctx1) {
  5613. return Math.min(self, aNumber);;
  5614. return self;
  5615. }, function($ctx1) {$ctx1.fill(self,"min:",{aNumber:aNumber},$globals.Number)});
  5616. },
  5617. args: ["aNumber"],
  5618. source: "min: aNumber\x0a\x09<inlineJS: 'return Math.min(self, aNumber);'>",
  5619. referencedClasses: [],
  5620. messageSends: []
  5621. }),
  5622. $globals.Number);
  5623. $core.addMethod(
  5624. $core.method({
  5625. selector: "min:max:",
  5626. protocol: "arithmetic",
  5627. fn: function (aMin,aMax){
  5628. var self=this,$self=this;
  5629. return $core.withContext(function($ctx1) {
  5630. return $recv($self._min_(aMin))._max_(aMax);
  5631. }, function($ctx1) {$ctx1.fill(self,"min:max:",{aMin:aMin,aMax:aMax},$globals.Number)});
  5632. },
  5633. args: ["aMin", "aMax"],
  5634. source: "min: aMin max: aMax\x0a\x09^ (self min: aMin) max: aMax",
  5635. referencedClasses: [],
  5636. messageSends: ["max:", "min:"]
  5637. }),
  5638. $globals.Number);
  5639. $core.addMethod(
  5640. $core.method({
  5641. selector: "negated",
  5642. protocol: "arithmetic",
  5643. fn: function (){
  5644. var self=this,$self=this;
  5645. return $core.withContext(function($ctx1) {
  5646. return (0).__minus(self);
  5647. }, function($ctx1) {$ctx1.fill(self,"negated",{},$globals.Number)});
  5648. },
  5649. args: [],
  5650. source: "negated\x0a\x09^ 0 - self",
  5651. referencedClasses: [],
  5652. messageSends: ["-"]
  5653. }),
  5654. $globals.Number);
  5655. $core.addMethod(
  5656. $core.method({
  5657. selector: "negative",
  5658. protocol: "testing",
  5659. fn: function (){
  5660. var self=this,$self=this;
  5661. return $core.withContext(function($ctx1) {
  5662. return $self.__lt((0));
  5663. }, function($ctx1) {$ctx1.fill(self,"negative",{},$globals.Number)});
  5664. },
  5665. args: [],
  5666. source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0",
  5667. referencedClasses: [],
  5668. messageSends: ["<"]
  5669. }),
  5670. $globals.Number);
  5671. $core.addMethod(
  5672. $core.method({
  5673. selector: "odd",
  5674. protocol: "testing",
  5675. fn: function (){
  5676. var self=this,$self=this;
  5677. return $core.withContext(function($ctx1) {
  5678. return $recv($self._even())._not();
  5679. }, function($ctx1) {$ctx1.fill(self,"odd",{},$globals.Number)});
  5680. },
  5681. args: [],
  5682. source: "odd\x0a\x09^ self even not",
  5683. referencedClasses: [],
  5684. messageSends: ["not", "even"]
  5685. }),
  5686. $globals.Number);
  5687. $core.addMethod(
  5688. $core.method({
  5689. selector: "positive",
  5690. protocol: "testing",
  5691. fn: function (){
  5692. var self=this,$self=this;
  5693. return $core.withContext(function($ctx1) {
  5694. return $self.__gt_eq((0));
  5695. }, function($ctx1) {$ctx1.fill(self,"positive",{},$globals.Number)});
  5696. },
  5697. args: [],
  5698. source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0",
  5699. referencedClasses: [],
  5700. messageSends: [">="]
  5701. }),
  5702. $globals.Number);
  5703. $core.addMethod(
  5704. $core.method({
  5705. selector: "printOn:",
  5706. protocol: "printing",
  5707. fn: function (aStream){
  5708. var self=this,$self=this;
  5709. return $core.withContext(function($ctx1) {
  5710. $recv(aStream)._nextPutAll_($self._asString());
  5711. return self;
  5712. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Number)});
  5713. },
  5714. args: ["aStream"],
  5715. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  5716. referencedClasses: [],
  5717. messageSends: ["nextPutAll:", "asString"]
  5718. }),
  5719. $globals.Number);
  5720. $core.addMethod(
  5721. $core.method({
  5722. selector: "printShowingDecimalPlaces:",
  5723. protocol: "printing",
  5724. fn: function (placesDesired){
  5725. var self=this,$self=this;
  5726. return $core.withContext(function($ctx1) {
  5727. return self.toFixed(placesDesired);
  5728. return self;
  5729. }, function($ctx1) {$ctx1.fill(self,"printShowingDecimalPlaces:",{placesDesired:placesDesired},$globals.Number)});
  5730. },
  5731. args: ["placesDesired"],
  5732. source: "printShowingDecimalPlaces: placesDesired\x0a\x09<inlineJS: 'return self.toFixed(placesDesired)'>",
  5733. referencedClasses: [],
  5734. messageSends: []
  5735. }),
  5736. $globals.Number);
  5737. $core.addMethod(
  5738. $core.method({
  5739. selector: "printStringBase:",
  5740. protocol: "converting",
  5741. fn: function (aBase){
  5742. var self=this,$self=this;
  5743. return $core.withContext(function($ctx1) {
  5744. return self.toString(aBase);
  5745. return self;
  5746. }, function($ctx1) {$ctx1.fill(self,"printStringBase:",{aBase:aBase},$globals.Number)});
  5747. },
  5748. args: ["aBase"],
  5749. source: "printStringBase: aBase\x0a\x09<inlineJS: 'return self.toString(aBase)'>",
  5750. referencedClasses: [],
  5751. messageSends: []
  5752. }),
  5753. $globals.Number);
  5754. $core.addMethod(
  5755. $core.method({
  5756. selector: "radiansToDegrees",
  5757. protocol: "converting",
  5758. fn: function (){
  5759. var self=this,$self=this;
  5760. return $core.withContext(function($ctx1) {
  5761. return $self.__slash($recv($globals.Number)._radiansPerDegree());
  5762. }, function($ctx1) {$ctx1.fill(self,"radiansToDegrees",{},$globals.Number)});
  5763. },
  5764. args: [],
  5765. source: "radiansToDegrees\x0a\x09^ self / Number radiansPerDegree",
  5766. referencedClasses: ["Number"],
  5767. messageSends: ["/", "radiansPerDegree"]
  5768. }),
  5769. $globals.Number);
  5770. $core.addMethod(
  5771. $core.method({
  5772. selector: "raisedTo:",
  5773. protocol: "mathematical functions",
  5774. fn: function (exponent){
  5775. var self=this,$self=this;
  5776. return $core.withContext(function($ctx1) {
  5777. return Math.pow(self, exponent);;
  5778. return self;
  5779. }, function($ctx1) {$ctx1.fill(self,"raisedTo:",{exponent:exponent},$globals.Number)});
  5780. },
  5781. args: ["exponent"],
  5782. source: "raisedTo: exponent\x0a\x09<inlineJS: 'return Math.pow(self, exponent);'>",
  5783. referencedClasses: [],
  5784. messageSends: []
  5785. }),
  5786. $globals.Number);
  5787. $core.addMethod(
  5788. $core.method({
  5789. selector: "rounded",
  5790. protocol: "converting",
  5791. fn: function (){
  5792. var self=this,$self=this;
  5793. return $core.withContext(function($ctx1) {
  5794. return Math.round(self);;
  5795. return self;
  5796. }, function($ctx1) {$ctx1.fill(self,"rounded",{},$globals.Number)});
  5797. },
  5798. args: [],
  5799. source: "rounded\x0a\x09<inlineJS: 'return Math.round(self);'>",
  5800. referencedClasses: [],
  5801. messageSends: []
  5802. }),
  5803. $globals.Number);
  5804. $core.addMethod(
  5805. $core.method({
  5806. selector: "sign",
  5807. protocol: "mathematical functions",
  5808. fn: function (){
  5809. var self=this,$self=this;
  5810. return $core.withContext(function($ctx1) {
  5811. var $1,$2;
  5812. $1=$self._isZero();
  5813. if($core.assert($1)){
  5814. return (0);
  5815. }
  5816. $2=$self._positive();
  5817. if($core.assert($2)){
  5818. return (1);
  5819. } else {
  5820. return (-1);
  5821. }
  5822. return self;
  5823. }, function($ctx1) {$ctx1.fill(self,"sign",{},$globals.Number)});
  5824. },
  5825. args: [],
  5826. source: "sign\x0a\x09self isZero \x0a\x09\x09ifTrue: [ ^ 0 ].\x0a\x09self positive\x0a\x09\x09ifTrue: [ ^ 1 ]\x0a\x09\x09ifFalse: [ ^ -1 ].",
  5827. referencedClasses: [],
  5828. messageSends: ["ifTrue:", "isZero", "ifTrue:ifFalse:", "positive"]
  5829. }),
  5830. $globals.Number);
  5831. $core.addMethod(
  5832. $core.method({
  5833. selector: "sin",
  5834. protocol: "mathematical functions",
  5835. fn: function (){
  5836. var self=this,$self=this;
  5837. return $core.withContext(function($ctx1) {
  5838. return Math.sin(self);;
  5839. return self;
  5840. }, function($ctx1) {$ctx1.fill(self,"sin",{},$globals.Number)});
  5841. },
  5842. args: [],
  5843. source: "sin\x0a\x09<inlineJS: 'return Math.sin(self);'>",
  5844. referencedClasses: [],
  5845. messageSends: []
  5846. }),
  5847. $globals.Number);
  5848. $core.addMethod(
  5849. $core.method({
  5850. selector: "sqrt",
  5851. protocol: "mathematical functions",
  5852. fn: function (){
  5853. var self=this,$self=this;
  5854. return $core.withContext(function($ctx1) {
  5855. return Math.sqrt(self);
  5856. return self;
  5857. }, function($ctx1) {$ctx1.fill(self,"sqrt",{},$globals.Number)});
  5858. },
  5859. args: [],
  5860. source: "sqrt\x0a\x09<inlineJS: 'return Math.sqrt(self)'>",
  5861. referencedClasses: [],
  5862. messageSends: []
  5863. }),
  5864. $globals.Number);
  5865. $core.addMethod(
  5866. $core.method({
  5867. selector: "squared",
  5868. protocol: "mathematical functions",
  5869. fn: function (){
  5870. var self=this,$self=this;
  5871. return $core.withContext(function($ctx1) {
  5872. return $self.__star(self);
  5873. }, function($ctx1) {$ctx1.fill(self,"squared",{},$globals.Number)});
  5874. },
  5875. args: [],
  5876. source: "squared\x0a\x09^ self * self",
  5877. referencedClasses: [],
  5878. messageSends: ["*"]
  5879. }),
  5880. $globals.Number);
  5881. $core.addMethod(
  5882. $core.method({
  5883. selector: "tan",
  5884. protocol: "mathematical functions",
  5885. fn: function (){
  5886. var self=this,$self=this;
  5887. return $core.withContext(function($ctx1) {
  5888. return Math.tan(self);;
  5889. return self;
  5890. }, function($ctx1) {$ctx1.fill(self,"tan",{},$globals.Number)});
  5891. },
  5892. args: [],
  5893. source: "tan\x0a\x09<inlineJS: 'return Math.tan(self);'>",
  5894. referencedClasses: [],
  5895. messageSends: []
  5896. }),
  5897. $globals.Number);
  5898. $core.addMethod(
  5899. $core.method({
  5900. selector: "timesRepeat:",
  5901. protocol: "enumerating",
  5902. fn: function (aBlock){
  5903. var self=this,$self=this;
  5904. var count;
  5905. return $core.withContext(function($ctx1) {
  5906. count=(1);
  5907. $recv((function(){
  5908. return $core.withContext(function($ctx2) {
  5909. return $recv(count).__gt(self);
  5910. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5911. }))._whileFalse_((function(){
  5912. return $core.withContext(function($ctx2) {
  5913. $recv(aBlock)._value();
  5914. count=$recv(count).__plus((1));
  5915. return count;
  5916. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5917. }));
  5918. return self;
  5919. }, function($ctx1) {$ctx1.fill(self,"timesRepeat:",{aBlock:aBlock,count:count},$globals.Number)});
  5920. },
  5921. args: ["aBlock"],
  5922. source: "timesRepeat: aBlock\x0a\x09| count |\x0a\x09count := 1.\x0a\x09[ count > self ] whileFalse: [\x0a\x09\x09aBlock value.\x0a\x09\x09count := count + 1 ]",
  5923. referencedClasses: [],
  5924. messageSends: ["whileFalse:", ">", "value", "+"]
  5925. }),
  5926. $globals.Number);
  5927. $core.addMethod(
  5928. $core.method({
  5929. selector: "to:",
  5930. protocol: "converting",
  5931. fn: function (aNumber){
  5932. var self=this,$self=this;
  5933. var array,first,last,count;
  5934. return $core.withContext(function($ctx1) {
  5935. first=$self._truncated();
  5936. $ctx1.sendIdx["truncated"]=1;
  5937. last=$recv($recv(aNumber)._truncated()).__plus((1));
  5938. $ctx1.sendIdx["+"]=1;
  5939. count=(1);
  5940. array=$recv($globals.Array)._new();
  5941. $recv($recv(last).__minus(first))._timesRepeat_((function(){
  5942. return $core.withContext(function($ctx2) {
  5943. $recv(array)._at_put_(count,first);
  5944. count=$recv(count).__plus((1));
  5945. $ctx2.sendIdx["+"]=2;
  5946. first=$recv(first).__plus((1));
  5947. return first;
  5948. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5949. }));
  5950. return array;
  5951. }, function($ctx1) {$ctx1.fill(self,"to:",{aNumber:aNumber,array:array,first:first,last:last,count:count},$globals.Number)});
  5952. },
  5953. args: ["aNumber"],
  5954. source: "to: aNumber\x0a\x09| array first last count |\x0a\x09first := self truncated.\x0a\x09last := aNumber truncated + 1.\x0a\x09count := 1.\x0a\x09array := Array new.\x0a\x09(last - first) timesRepeat: [\x0a\x09\x09array at: count put: first.\x0a\x09\x09count := count + 1.\x0a\x09\x09first := first + 1 ].\x0a\x09^ array",
  5955. referencedClasses: ["Array"],
  5956. messageSends: ["truncated", "+", "new", "timesRepeat:", "-", "at:put:"]
  5957. }),
  5958. $globals.Number);
  5959. $core.addMethod(
  5960. $core.method({
  5961. selector: "to:by:",
  5962. protocol: "converting",
  5963. fn: function (stop,step){
  5964. var self=this,$self=this;
  5965. var array,value,pos;
  5966. return $core.withContext(function($ctx1) {
  5967. var $1,$2;
  5968. value=self;
  5969. array=$recv($globals.Array)._new();
  5970. pos=(1);
  5971. $1=$recv(step).__eq((0));
  5972. if($core.assert($1)){
  5973. $self._error_("step must be non-zero");
  5974. }
  5975. $2=$recv(step).__lt((0));
  5976. if($core.assert($2)){
  5977. $recv((function(){
  5978. return $core.withContext(function($ctx2) {
  5979. return $recv(value).__gt_eq(stop);
  5980. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  5981. }))._whileTrue_((function(){
  5982. return $core.withContext(function($ctx2) {
  5983. $recv(array)._at_put_(pos,value);
  5984. $ctx2.sendIdx["at:put:"]=1;
  5985. pos=$recv(pos).__plus((1));
  5986. $ctx2.sendIdx["+"]=1;
  5987. value=$recv(value).__plus(step);
  5988. $ctx2.sendIdx["+"]=2;
  5989. return value;
  5990. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  5991. }));
  5992. $ctx1.sendIdx["whileTrue:"]=1;
  5993. } else {
  5994. $recv((function(){
  5995. return $core.withContext(function($ctx2) {
  5996. return $recv(value).__lt_eq(stop);
  5997. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  5998. }))._whileTrue_((function(){
  5999. return $core.withContext(function($ctx2) {
  6000. $recv(array)._at_put_(pos,value);
  6001. pos=$recv(pos).__plus((1));
  6002. $ctx2.sendIdx["+"]=3;
  6003. value=$recv(value).__plus(step);
  6004. return value;
  6005. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  6006. }));
  6007. }
  6008. return array;
  6009. }, function($ctx1) {$ctx1.fill(self,"to:by:",{stop:stop,step:step,array:array,value:value,pos:pos},$globals.Number)});
  6010. },
  6011. args: ["stop", "step"],
  6012. source: "to: stop by: step\x0a\x09| array value pos |\x0a\x09value := self.\x0a\x09array := Array new.\x0a\x09pos := 1.\x0a\x09step = 0 ifTrue: [ self error: 'step must be non-zero' ].\x0a\x09step < 0\x0a\x09\x09ifTrue: [ [ value >= stop ] whileTrue: [\x0a\x09\x09\x09\x09\x09array at: pos put: value.\x0a\x09\x09\x09\x09\x09pos := pos + 1.\x0a\x09\x09\x09\x09\x09value := value + step ]]\x0a\x09\x09ifFalse: [ [ value <= stop ] whileTrue: [\x0a\x09\x09\x09\x09\x09array at: pos put: value.\x0a\x09\x09\x09\x09pos := pos + 1.\x0a\x09\x09\x09\x09\x09value := value + step ]].\x0a\x09^ array",
  6013. referencedClasses: ["Array"],
  6014. messageSends: ["new", "ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "at:put:", "+", "<="]
  6015. }),
  6016. $globals.Number);
  6017. $core.addMethod(
  6018. $core.method({
  6019. selector: "to:by:do:",
  6020. protocol: "enumerating",
  6021. fn: function (stop,step,aBlock){
  6022. var self=this,$self=this;
  6023. var value;
  6024. return $core.withContext(function($ctx1) {
  6025. var $1,$2;
  6026. value=self;
  6027. $1=$recv(step).__eq((0));
  6028. if($core.assert($1)){
  6029. $self._error_("step must be non-zero");
  6030. }
  6031. $2=$recv(step).__lt((0));
  6032. if($core.assert($2)){
  6033. $recv((function(){
  6034. return $core.withContext(function($ctx2) {
  6035. return $recv(value).__gt_eq(stop);
  6036. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  6037. }))._whileTrue_((function(){
  6038. return $core.withContext(function($ctx2) {
  6039. $recv(aBlock)._value_(value);
  6040. $ctx2.sendIdx["value:"]=1;
  6041. value=$recv(value).__plus(step);
  6042. $ctx2.sendIdx["+"]=1;
  6043. return value;
  6044. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  6045. }));
  6046. $ctx1.sendIdx["whileTrue:"]=1;
  6047. } else {
  6048. $recv((function(){
  6049. return $core.withContext(function($ctx2) {
  6050. return $recv(value).__lt_eq(stop);
  6051. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  6052. }))._whileTrue_((function(){
  6053. return $core.withContext(function($ctx2) {
  6054. $recv(aBlock)._value_(value);
  6055. value=$recv(value).__plus(step);
  6056. return value;
  6057. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  6058. }));
  6059. }
  6060. return self;
  6061. }, function($ctx1) {$ctx1.fill(self,"to:by:do:",{stop:stop,step:step,aBlock:aBlock,value:value},$globals.Number)});
  6062. },
  6063. args: ["stop", "step", "aBlock"],
  6064. source: "to: stop by: step do: aBlock\x0a\x09| value |\x0a\x09value := self.\x0a\x09step = 0 ifTrue: [ self error: 'step must be non-zero' ].\x0a\x09step < 0\x0a\x09\x09ifTrue: [ [ value >= stop ] whileTrue: [\x0a\x09\x09\x09\x09\x09aBlock value: value.\x0a\x09\x09\x09\x09\x09value := value + step ]]\x0a\x09\x09ifFalse: [ [ value <= stop ] whileTrue: [\x0a\x09\x09\x09\x09\x09aBlock value: value.\x0a\x09\x09\x09\x09\x09value := value + step ]]",
  6065. referencedClasses: [],
  6066. messageSends: ["ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "value:", "+", "<="]
  6067. }),
  6068. $globals.Number);
  6069. $core.addMethod(
  6070. $core.method({
  6071. selector: "to:do:",
  6072. protocol: "enumerating",
  6073. fn: function (stop,aBlock){
  6074. var self=this,$self=this;
  6075. var nextValue;
  6076. return $core.withContext(function($ctx1) {
  6077. nextValue=self;
  6078. $recv((function(){
  6079. return $core.withContext(function($ctx2) {
  6080. return $recv(nextValue).__lt_eq(stop);
  6081. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6082. }))._whileTrue_((function(){
  6083. return $core.withContext(function($ctx2) {
  6084. $recv(aBlock)._value_(nextValue);
  6085. nextValue=$recv(nextValue).__plus((1));
  6086. return nextValue;
  6087. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6088. }));
  6089. return self;
  6090. }, function($ctx1) {$ctx1.fill(self,"to:do:",{stop:stop,aBlock:aBlock,nextValue:nextValue},$globals.Number)});
  6091. },
  6092. args: ["stop", "aBlock"],
  6093. source: "to: stop do: aBlock\x0a\x09\x22Evaluate aBlock for each number from self to aNumber.\x22\x0a\x09| nextValue |\x0a\x09nextValue := self.\x0a\x09[ nextValue <= stop ]\x0a\x09\x09whileTrue:\x0a\x09\x09\x09[ aBlock value: nextValue.\x0a\x09\x09\x09nextValue := nextValue + 1 ]",
  6094. referencedClasses: [],
  6095. messageSends: ["whileTrue:", "<=", "value:", "+"]
  6096. }),
  6097. $globals.Number);
  6098. $core.addMethod(
  6099. $core.method({
  6100. selector: "truncated",
  6101. protocol: "converting",
  6102. fn: function (){
  6103. var self=this,$self=this;
  6104. return $core.withContext(function($ctx1) {
  6105. if(self >= 0) {
  6106. return Math.floor(self);
  6107. } else {
  6108. return Math.floor(self * (-1)) * (-1);
  6109. };
  6110. ;
  6111. return self;
  6112. }, function($ctx1) {$ctx1.fill(self,"truncated",{},$globals.Number)});
  6113. },
  6114. args: [],
  6115. source: "truncated\x0a\x09<inlineJS: '\x0a\x09\x09if(self >= 0) {\x0a\x09\x09\x09return Math.floor(self);\x0a\x09\x09} else {\x0a\x09\x09\x09return Math.floor(self * (-1)) * (-1);\x0a\x09\x09};\x0a\x09'>",
  6116. referencedClasses: [],
  6117. messageSends: []
  6118. }),
  6119. $globals.Number);
  6120. $core.addMethod(
  6121. $core.method({
  6122. selector: "|",
  6123. protocol: "converting",
  6124. fn: function (aNumber){
  6125. var self=this,$self=this;
  6126. return $core.withContext(function($ctx1) {
  6127. return self | aNumber;
  6128. return self;
  6129. }, function($ctx1) {$ctx1.fill(self,"|",{aNumber:aNumber},$globals.Number)});
  6130. },
  6131. args: ["aNumber"],
  6132. source: "| aNumber\x0a\x09<inlineJS: 'return self | aNumber'>",
  6133. referencedClasses: [],
  6134. messageSends: []
  6135. }),
  6136. $globals.Number);
  6137. $core.addMethod(
  6138. $core.method({
  6139. selector: "classTag",
  6140. protocol: "accessing",
  6141. fn: function (){
  6142. var self=this,$self=this;
  6143. return "magnitude";
  6144. },
  6145. args: [],
  6146. source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'magnitude'",
  6147. referencedClasses: [],
  6148. messageSends: []
  6149. }),
  6150. $globals.Number.a$cls);
  6151. $core.addMethod(
  6152. $core.method({
  6153. selector: "e",
  6154. protocol: "instance creation",
  6155. fn: function (){
  6156. var self=this,$self=this;
  6157. return $core.withContext(function($ctx1) {
  6158. return Math.E;;
  6159. return self;
  6160. }, function($ctx1) {$ctx1.fill(self,"e",{},$globals.Number.a$cls)});
  6161. },
  6162. args: [],
  6163. source: "e\x0a\x09<inlineJS: 'return Math.E;'>",
  6164. referencedClasses: [],
  6165. messageSends: []
  6166. }),
  6167. $globals.Number.a$cls);
  6168. $core.addMethod(
  6169. $core.method({
  6170. selector: "pi",
  6171. protocol: "instance creation",
  6172. fn: function (){
  6173. var self=this,$self=this;
  6174. return $core.withContext(function($ctx1) {
  6175. return Math.PI;
  6176. return self;
  6177. }, function($ctx1) {$ctx1.fill(self,"pi",{},$globals.Number.a$cls)});
  6178. },
  6179. args: [],
  6180. source: "pi\x0a\x09<inlineJS: 'return Math.PI'>",
  6181. referencedClasses: [],
  6182. messageSends: []
  6183. }),
  6184. $globals.Number.a$cls);
  6185. $core.addMethod(
  6186. $core.method({
  6187. selector: "radiansPerDegree",
  6188. protocol: "instance creation",
  6189. fn: function (){
  6190. var self=this,$self=this;
  6191. return $core.withContext(function($ctx1) {
  6192. return $recv($self._pi()).__slash((180));
  6193. }, function($ctx1) {$ctx1.fill(self,"radiansPerDegree",{},$globals.Number.a$cls)});
  6194. },
  6195. args: [],
  6196. source: "radiansPerDegree\x0a\x09^ (self pi) / 180",
  6197. referencedClasses: [],
  6198. messageSends: ["/", "pi"]
  6199. }),
  6200. $globals.Number.a$cls);
  6201. $core.addClass("Point", $globals.Object, ["x", "y"], "Kernel-Objects");
  6202. $globals.Point.comment="I represent an x-y pair of numbers usually designating a geometric coordinate.\x0a\x0a## API\x0a\x0aInstances are traditionally created using the binary `#@` message to a number:\x0a\x0a\x09100@120\x0a\x0aPoints can then be arithmetically manipulated:\x0a\x0a\x09100@100 + (10@10)\x0a\x0a...or for example:\x0a\x0a\x09(100@100) * 2\x0a\x0a**NOTE:** Creating a point with a negative y-value will need a space after `@` in order to avoid a parsing error:\x0a\x0a\x09100@ -100 \x22but 100@-100 would not parse\x22";
  6203. $core.addMethod(
  6204. $core.method({
  6205. selector: "*",
  6206. protocol: "arithmetic",
  6207. fn: function (aPoint){
  6208. var self=this,$self=this;
  6209. return $core.withContext(function($ctx1) {
  6210. var $2,$4,$3,$1,$6,$5;
  6211. $2=$self._x();
  6212. $ctx1.sendIdx["x"]=1;
  6213. $4=$recv(aPoint)._asPoint();
  6214. $ctx1.sendIdx["asPoint"]=1;
  6215. $3=$recv($4)._x();
  6216. $1=$recv($2).__star($3);
  6217. $ctx1.sendIdx["*"]=1;
  6218. $6=$self._y();
  6219. $ctx1.sendIdx["y"]=1;
  6220. $5=$recv($6).__star($recv($recv(aPoint)._asPoint())._y());
  6221. return $recv($globals.Point)._x_y_($1,$5);
  6222. }, function($ctx1) {$ctx1.fill(self,"*",{aPoint:aPoint},$globals.Point)});
  6223. },
  6224. args: ["aPoint"],
  6225. source: "* aPoint\x0a\x09^ Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y",
  6226. referencedClasses: ["Point"],
  6227. messageSends: ["x:y:", "*", "x", "asPoint", "y"]
  6228. }),
  6229. $globals.Point);
  6230. $core.addMethod(
  6231. $core.method({
  6232. selector: "+",
  6233. protocol: "arithmetic",
  6234. fn: function (aPoint){
  6235. var self=this,$self=this;
  6236. return $core.withContext(function($ctx1) {
  6237. var $2,$4,$3,$1,$6,$5;
  6238. $2=$self._x();
  6239. $ctx1.sendIdx["x"]=1;
  6240. $4=$recv(aPoint)._asPoint();
  6241. $ctx1.sendIdx["asPoint"]=1;
  6242. $3=$recv($4)._x();
  6243. $1=$recv($2).__plus($3);
  6244. $ctx1.sendIdx["+"]=1;
  6245. $6=$self._y();
  6246. $ctx1.sendIdx["y"]=1;
  6247. $5=$recv($6).__plus($recv($recv(aPoint)._asPoint())._y());
  6248. return $recv($globals.Point)._x_y_($1,$5);
  6249. }, function($ctx1) {$ctx1.fill(self,"+",{aPoint:aPoint},$globals.Point)});
  6250. },
  6251. args: ["aPoint"],
  6252. source: "+ aPoint\x0a\x09^ Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y",
  6253. referencedClasses: ["Point"],
  6254. messageSends: ["x:y:", "+", "x", "asPoint", "y"]
  6255. }),
  6256. $globals.Point);
  6257. $core.addMethod(
  6258. $core.method({
  6259. selector: "-",
  6260. protocol: "arithmetic",
  6261. fn: function (aPoint){
  6262. var self=this,$self=this;
  6263. return $core.withContext(function($ctx1) {
  6264. var $2,$4,$3,$1,$6,$5;
  6265. $2=$self._x();
  6266. $ctx1.sendIdx["x"]=1;
  6267. $4=$recv(aPoint)._asPoint();
  6268. $ctx1.sendIdx["asPoint"]=1;
  6269. $3=$recv($4)._x();
  6270. $1=$recv($2).__minus($3);
  6271. $ctx1.sendIdx["-"]=1;
  6272. $6=$self._y();
  6273. $ctx1.sendIdx["y"]=1;
  6274. $5=$recv($6).__minus($recv($recv(aPoint)._asPoint())._y());
  6275. return $recv($globals.Point)._x_y_($1,$5);
  6276. }, function($ctx1) {$ctx1.fill(self,"-",{aPoint:aPoint},$globals.Point)});
  6277. },
  6278. args: ["aPoint"],
  6279. source: "- aPoint\x0a\x09^ Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y",
  6280. referencedClasses: ["Point"],
  6281. messageSends: ["x:y:", "-", "x", "asPoint", "y"]
  6282. }),
  6283. $globals.Point);
  6284. $core.addMethod(
  6285. $core.method({
  6286. selector: "/",
  6287. protocol: "arithmetic",
  6288. fn: function (aPoint){
  6289. var self=this,$self=this;
  6290. return $core.withContext(function($ctx1) {
  6291. var $2,$4,$3,$1,$6,$5;
  6292. $2=$self._x();
  6293. $ctx1.sendIdx["x"]=1;
  6294. $4=$recv(aPoint)._asPoint();
  6295. $ctx1.sendIdx["asPoint"]=1;
  6296. $3=$recv($4)._x();
  6297. $1=$recv($2).__slash($3);
  6298. $ctx1.sendIdx["/"]=1;
  6299. $6=$self._y();
  6300. $ctx1.sendIdx["y"]=1;
  6301. $5=$recv($6).__slash($recv($recv(aPoint)._asPoint())._y());
  6302. return $recv($globals.Point)._x_y_($1,$5);
  6303. }, function($ctx1) {$ctx1.fill(self,"/",{aPoint:aPoint},$globals.Point)});
  6304. },
  6305. args: ["aPoint"],
  6306. source: "/ aPoint\x0a\x09^ Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
  6307. referencedClasses: ["Point"],
  6308. messageSends: ["x:y:", "/", "x", "asPoint", "y"]
  6309. }),
  6310. $globals.Point);
  6311. $core.addMethod(
  6312. $core.method({
  6313. selector: "<",
  6314. protocol: "comparing",
  6315. fn: function (aPoint){
  6316. var self=this,$self=this;
  6317. return $core.withContext(function($ctx1) {
  6318. var $2,$1,$3;
  6319. $2=$self._x();
  6320. $ctx1.sendIdx["x"]=1;
  6321. $1=$recv($2).__lt($recv(aPoint)._x());
  6322. $ctx1.sendIdx["<"]=1;
  6323. return $recv($1)._and_((function(){
  6324. return $core.withContext(function($ctx2) {
  6325. $3=$self._y();
  6326. $ctx2.sendIdx["y"]=1;
  6327. return $recv($3).__lt($recv(aPoint)._y());
  6328. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6329. }));
  6330. }, function($ctx1) {$ctx1.fill(self,"<",{aPoint:aPoint},$globals.Point)});
  6331. },
  6332. args: ["aPoint"],
  6333. source: "< aPoint\x0a\x09^ self x < aPoint x and: [\x0a\x09\x09self y < aPoint y ]",
  6334. referencedClasses: [],
  6335. messageSends: ["and:", "<", "x", "y"]
  6336. }),
  6337. $globals.Point);
  6338. $core.addMethod(
  6339. $core.method({
  6340. selector: "<=",
  6341. protocol: "comparing",
  6342. fn: function (aPoint){
  6343. var self=this,$self=this;
  6344. return $core.withContext(function($ctx1) {
  6345. var $2,$1,$3;
  6346. $2=$self._x();
  6347. $ctx1.sendIdx["x"]=1;
  6348. $1=$recv($2).__lt_eq($recv(aPoint)._x());
  6349. $ctx1.sendIdx["<="]=1;
  6350. return $recv($1)._and_((function(){
  6351. return $core.withContext(function($ctx2) {
  6352. $3=$self._y();
  6353. $ctx2.sendIdx["y"]=1;
  6354. return $recv($3).__lt_eq($recv(aPoint)._y());
  6355. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6356. }));
  6357. }, function($ctx1) {$ctx1.fill(self,"<=",{aPoint:aPoint},$globals.Point)});
  6358. },
  6359. args: ["aPoint"],
  6360. source: "<= aPoint\x0a\x09^ self x <= aPoint x and: [\x0a\x09\x09self y <= aPoint y ]",
  6361. referencedClasses: [],
  6362. messageSends: ["and:", "<=", "x", "y"]
  6363. }),
  6364. $globals.Point);
  6365. $core.addMethod(
  6366. $core.method({
  6367. selector: "=",
  6368. protocol: "comparing",
  6369. fn: function (aPoint){
  6370. var self=this,$self=this;
  6371. return $core.withContext(function($ctx1) {
  6372. var $2,$1,$4,$3,$6,$5;
  6373. $2=$recv(aPoint)._class();
  6374. $ctx1.sendIdx["class"]=1;
  6375. $1=$recv($2).__eq($self._class());
  6376. $ctx1.sendIdx["="]=1;
  6377. return $recv($1)._and_((function(){
  6378. return $core.withContext(function($ctx2) {
  6379. $4=$recv(aPoint)._x();
  6380. $ctx2.sendIdx["x"]=1;
  6381. $3=$recv($4).__eq($self._x());
  6382. $ctx2.sendIdx["="]=2;
  6383. $6=$recv(aPoint)._y();
  6384. $ctx2.sendIdx["y"]=1;
  6385. $5=$recv($6).__eq($self._y());
  6386. return $recv($3).__and($5);
  6387. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6388. }));
  6389. }, function($ctx1) {$ctx1.fill(self,"=",{aPoint:aPoint},$globals.Point)});
  6390. },
  6391. args: ["aPoint"],
  6392. source: "= aPoint\x0a\x09^ aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y) ]",
  6393. referencedClasses: [],
  6394. messageSends: ["and:", "=", "class", "&", "x", "y"]
  6395. }),
  6396. $globals.Point);
  6397. $core.addMethod(
  6398. $core.method({
  6399. selector: ">",
  6400. protocol: "comparing",
  6401. fn: function (aPoint){
  6402. var self=this,$self=this;
  6403. return $core.withContext(function($ctx1) {
  6404. var $2,$1,$3;
  6405. $2=$self._x();
  6406. $ctx1.sendIdx["x"]=1;
  6407. $1=$recv($2).__gt($recv(aPoint)._x());
  6408. $ctx1.sendIdx[">"]=1;
  6409. return $recv($1)._and_((function(){
  6410. return $core.withContext(function($ctx2) {
  6411. $3=$self._y();
  6412. $ctx2.sendIdx["y"]=1;
  6413. return $recv($3).__gt($recv(aPoint)._y());
  6414. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6415. }));
  6416. }, function($ctx1) {$ctx1.fill(self,">",{aPoint:aPoint},$globals.Point)});
  6417. },
  6418. args: ["aPoint"],
  6419. source: "> aPoint\x0a\x09^ self x > aPoint x and: [\x0a\x09\x09self y > aPoint y ]",
  6420. referencedClasses: [],
  6421. messageSends: ["and:", ">", "x", "y"]
  6422. }),
  6423. $globals.Point);
  6424. $core.addMethod(
  6425. $core.method({
  6426. selector: ">=",
  6427. protocol: "comparing",
  6428. fn: function (aPoint){
  6429. var self=this,$self=this;
  6430. return $core.withContext(function($ctx1) {
  6431. var $2,$1,$3;
  6432. $2=$self._x();
  6433. $ctx1.sendIdx["x"]=1;
  6434. $1=$recv($2).__gt_eq($recv(aPoint)._x());
  6435. $ctx1.sendIdx[">="]=1;
  6436. return $recv($1)._and_((function(){
  6437. return $core.withContext(function($ctx2) {
  6438. $3=$self._y();
  6439. $ctx2.sendIdx["y"]=1;
  6440. return $recv($3).__gt_eq($recv(aPoint)._y());
  6441. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6442. }));
  6443. }, function($ctx1) {$ctx1.fill(self,">=",{aPoint:aPoint},$globals.Point)});
  6444. },
  6445. args: ["aPoint"],
  6446. source: ">= aPoint\x0a\x09^ self x >= aPoint x and: [\x0a\x09\x09self y >= aPoint y ]",
  6447. referencedClasses: [],
  6448. messageSends: ["and:", ">=", "x", "y"]
  6449. }),
  6450. $globals.Point);
  6451. $core.addMethod(
  6452. $core.method({
  6453. selector: "angle",
  6454. protocol: "geometry",
  6455. fn: function (){
  6456. var self=this,$self=this;
  6457. return $core.withContext(function($ctx1) {
  6458. return $recv($self._y())._arcTan_($self._x());
  6459. }, function($ctx1) {$ctx1.fill(self,"angle",{},$globals.Point)});
  6460. },
  6461. args: [],
  6462. source: "angle\x0a\x09^ self y arcTan: self x",
  6463. referencedClasses: [],
  6464. messageSends: ["arcTan:", "y", "x"]
  6465. }),
  6466. $globals.Point);
  6467. $core.addMethod(
  6468. $core.method({
  6469. selector: "asPoint",
  6470. protocol: "converting",
  6471. fn: function (){
  6472. var self=this,$self=this;
  6473. return self;
  6474. },
  6475. args: [],
  6476. source: "asPoint\x0a\x09^ self",
  6477. referencedClasses: [],
  6478. messageSends: []
  6479. }),
  6480. $globals.Point);
  6481. $core.addMethod(
  6482. $core.method({
  6483. selector: "corner:",
  6484. protocol: "rectangle creation",
  6485. fn: function (aPoint){
  6486. var self=this,$self=this;
  6487. return $core.withContext(function($ctx1) {
  6488. return $recv($globals.Rectangle)._origin_corner_(self,aPoint);
  6489. }, function($ctx1) {$ctx1.fill(self,"corner:",{aPoint:aPoint},$globals.Point)});
  6490. },
  6491. args: ["aPoint"],
  6492. source: "corner: aPoint\x0a\x09^ Rectangle origin: self corner: aPoint",
  6493. referencedClasses: ["Rectangle"],
  6494. messageSends: ["origin:corner:"]
  6495. }),
  6496. $globals.Point);
  6497. $core.addMethod(
  6498. $core.method({
  6499. selector: "dist:",
  6500. protocol: "transforming",
  6501. fn: function (aPoint){
  6502. var self=this,$self=this;
  6503. var dx,dy;
  6504. return $core.withContext(function($ctx1) {
  6505. var $2,$1;
  6506. dx=$recv($recv(aPoint)._x()).__minus($self["@x"]);
  6507. $ctx1.sendIdx["-"]=1;
  6508. dy=$recv($recv(aPoint)._y()).__minus($self["@y"]);
  6509. $2=$recv(dx).__star(dx);
  6510. $ctx1.sendIdx["*"]=1;
  6511. $1=$recv($2).__plus($recv(dy).__star(dy));
  6512. return $recv($1)._sqrt();
  6513. }, function($ctx1) {$ctx1.fill(self,"dist:",{aPoint:aPoint,dx:dx,dy:dy},$globals.Point)});
  6514. },
  6515. args: ["aPoint"],
  6516. source: "dist: aPoint \x0a\x09\x22Answer the distance between aPoint and the receiver.\x22\x0a\x09| dx dy |\x0a\x09dx := aPoint x - x.\x0a\x09dy := aPoint y - y.\x0a\x09^ (dx * dx + (dy * dy)) sqrt",
  6517. referencedClasses: [],
  6518. messageSends: ["-", "x", "y", "sqrt", "+", "*"]
  6519. }),
  6520. $globals.Point);
  6521. $core.addMethod(
  6522. $core.method({
  6523. selector: "dotProduct:",
  6524. protocol: "point functions",
  6525. fn: function (aPoint){
  6526. var self=this,$self=this;
  6527. return $core.withContext(function($ctx1) {
  6528. var $1;
  6529. $1=$recv($self["@x"]).__star($recv(aPoint)._x());
  6530. $ctx1.sendIdx["*"]=1;
  6531. return $recv($1).__plus($recv($self["@y"]).__star($recv(aPoint)._y()));
  6532. }, function($ctx1) {$ctx1.fill(self,"dotProduct:",{aPoint:aPoint},$globals.Point)});
  6533. },
  6534. args: ["aPoint"],
  6535. source: "dotProduct: aPoint\x0a\x09^ (x * aPoint x) + (y * aPoint y)",
  6536. referencedClasses: [],
  6537. messageSends: ["+", "*", "x", "y"]
  6538. }),
  6539. $globals.Point);
  6540. $core.addMethod(
  6541. $core.method({
  6542. selector: "extent:",
  6543. protocol: "rectangle creation",
  6544. fn: function (aPoint){
  6545. var self=this,$self=this;
  6546. return $core.withContext(function($ctx1) {
  6547. return $recv($globals.Rectangle)._origin_extent_(self,aPoint);
  6548. }, function($ctx1) {$ctx1.fill(self,"extent:",{aPoint:aPoint},$globals.Point)});
  6549. },
  6550. args: ["aPoint"],
  6551. source: "extent: aPoint\x0a\x09^ Rectangle origin: self extent: aPoint",
  6552. referencedClasses: ["Rectangle"],
  6553. messageSends: ["origin:extent:"]
  6554. }),
  6555. $globals.Point);
  6556. $core.addMethod(
  6557. $core.method({
  6558. selector: "normal",
  6559. protocol: "point functions",
  6560. fn: function (){
  6561. var self=this,$self=this;
  6562. var n,d;
  6563. return $core.withContext(function($ctx1) {
  6564. var $4,$3,$6,$5,$2,$1;
  6565. n=$recv($recv($self["@y"])._negated()).__at($self["@x"]);
  6566. $ctx1.sendIdx["@"]=1;
  6567. $4=$recv(n)._x();
  6568. $ctx1.sendIdx["x"]=1;
  6569. $3=$recv($4).__star($recv(n)._x());
  6570. $ctx1.sendIdx["*"]=1;
  6571. $6=$recv(n)._y();
  6572. $ctx1.sendIdx["y"]=1;
  6573. $5=$recv($6).__star($recv(n)._y());
  6574. d=$recv($3).__plus($5);
  6575. $2=d;
  6576. $1=$recv($2).__eq((0));
  6577. if($core.assert($1)){
  6578. return (-1).__at((0));
  6579. }
  6580. return $recv(n).__slash($recv(d)._sqrt());
  6581. }, function($ctx1) {$ctx1.fill(self,"normal",{n:n,d:d},$globals.Point)});
  6582. },
  6583. args: [],
  6584. source: "normal\x0a\x09\x22Answer a Point representing the unit vector rotated 90 deg clockwise. For the zero point return -1@0.\x22\x0a\x0a\x09| n d |\x0a\x09n := y negated @ x.\x0a\x09(d := (n x * n x + (n y * n y))) = 0\x0a\x09\x09 ifTrue: [ ^ -1 @0 ].\x0a\x09^ n / d sqrt",
  6585. referencedClasses: [],
  6586. messageSends: ["@", "negated", "ifTrue:", "=", "+", "*", "x", "y", "/", "sqrt"]
  6587. }),
  6588. $globals.Point);
  6589. $core.addMethod(
  6590. $core.method({
  6591. selector: "normalized",
  6592. protocol: "point functions",
  6593. fn: function (){
  6594. var self=this,$self=this;
  6595. var r;
  6596. return $core.withContext(function($ctx1) {
  6597. var $1,$2,$3;
  6598. r=$self._r();
  6599. $1=$recv(r).__eq((0));
  6600. if($core.assert($1)){
  6601. $2=$recv($globals.Point)._x_y_((0),(0));
  6602. $ctx1.sendIdx["x:y:"]=1;
  6603. return $2;
  6604. } else {
  6605. $3=$recv($self["@x"]).__slash(r);
  6606. $ctx1.sendIdx["/"]=1;
  6607. return $recv($globals.Point)._x_y_($3,$recv($self["@y"]).__slash(r));
  6608. }
  6609. return self;
  6610. }, function($ctx1) {$ctx1.fill(self,"normalized",{r:r},$globals.Point)});
  6611. },
  6612. args: [],
  6613. source: "normalized\x0a\x09| r |\x0a\x09r := self r.\x0a\x09\x0a\x09r = 0\x0a\x09\x09ifTrue: [ ^ Point x: 0 y: 0 ]\x0a\x09\x09ifFalse: [ ^ Point x: x / r y: y / r ]",
  6614. referencedClasses: ["Point"],
  6615. messageSends: ["r", "ifTrue:ifFalse:", "=", "x:y:", "/"]
  6616. }),
  6617. $globals.Point);
  6618. $core.addMethod(
  6619. $core.method({
  6620. selector: "printOn:",
  6621. protocol: "printing",
  6622. fn: function (aStream){
  6623. var self=this,$self=this;
  6624. return $core.withContext(function($ctx1) {
  6625. var $1;
  6626. $recv($self["@x"])._printOn_(aStream);
  6627. $ctx1.sendIdx["printOn:"]=1;
  6628. $recv(aStream)._nextPutAll_("@");
  6629. $1=$recv($recv($self["@y"])._notNil())._and_((function(){
  6630. return $core.withContext(function($ctx2) {
  6631. return $recv($self["@y"])._negative();
  6632. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6633. }));
  6634. if($core.assert($1)){
  6635. $recv(aStream)._space();
  6636. }
  6637. $recv($self["@y"])._printOn_(aStream);
  6638. return self;
  6639. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Point)});
  6640. },
  6641. args: ["aStream"],
  6642. source: "printOn: aStream\x0a\x09\x22Print receiver in classic x@y notation.\x22\x0a\x0a\x09x printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: '@'.\x0a\x09(y notNil and: [ y negative ]) ifTrue: [\x0a\x09\x09\x09\x22Avoid ambiguous @- construct\x22\x0a\x09\x09\x09aStream space ].\x0a\x09\x0a\x09y printOn: aStream",
  6643. referencedClasses: [],
  6644. messageSends: ["printOn:", "nextPutAll:", "ifTrue:", "and:", "notNil", "negative", "space"]
  6645. }),
  6646. $globals.Point);
  6647. $core.addMethod(
  6648. $core.method({
  6649. selector: "r",
  6650. protocol: "polar coordinates",
  6651. fn: function (){
  6652. var self=this,$self=this;
  6653. return $core.withContext(function($ctx1) {
  6654. var $2,$1;
  6655. $2=$recv($self["@x"]).__star($self["@x"]);
  6656. $ctx1.sendIdx["*"]=1;
  6657. $1=$recv($2).__plus($recv($self["@y"]).__star($self["@y"]));
  6658. return $recv($1)._sqrt();
  6659. }, function($ctx1) {$ctx1.fill(self,"r",{},$globals.Point)});
  6660. },
  6661. args: [],
  6662. source: "r\x0a\x09^ ((x * x) + (y * y)) sqrt",
  6663. referencedClasses: [],
  6664. messageSends: ["sqrt", "+", "*"]
  6665. }),
  6666. $globals.Point);
  6667. $core.addMethod(
  6668. $core.method({
  6669. selector: "rectangle:",
  6670. protocol: "rectangle creation",
  6671. fn: function (aPoint){
  6672. var self=this,$self=this;
  6673. return $core.withContext(function($ctx1) {
  6674. return $recv($globals.Rectangle)._point_point_(self,aPoint);
  6675. }, function($ctx1) {$ctx1.fill(self,"rectangle:",{aPoint:aPoint},$globals.Point)});
  6676. },
  6677. args: ["aPoint"],
  6678. source: "rectangle: aPoint\x0a\x09^ Rectangle point: self point: aPoint",
  6679. referencedClasses: ["Rectangle"],
  6680. messageSends: ["point:point:"]
  6681. }),
  6682. $globals.Point);
  6683. $core.addMethod(
  6684. $core.method({
  6685. selector: "translateBy:",
  6686. protocol: "transforming",
  6687. fn: function (delta){
  6688. var self=this,$self=this;
  6689. return $core.withContext(function($ctx1) {
  6690. var $1;
  6691. $1=$recv($recv(delta)._x()).__plus($self["@x"]);
  6692. $ctx1.sendIdx["+"]=1;
  6693. return $recv($1).__at($recv($recv(delta)._y()).__plus($self["@y"]));
  6694. }, function($ctx1) {$ctx1.fill(self,"translateBy:",{delta:delta},$globals.Point)});
  6695. },
  6696. args: ["delta"],
  6697. source: "translateBy: delta\x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^ (delta x + x) @ (delta y + y)",
  6698. referencedClasses: [],
  6699. messageSends: ["@", "+", "x", "y"]
  6700. }),
  6701. $globals.Point);
  6702. $core.addMethod(
  6703. $core.method({
  6704. selector: "x",
  6705. protocol: "accessing",
  6706. fn: function (){
  6707. var self=this,$self=this;
  6708. return $self["@x"];
  6709. },
  6710. args: [],
  6711. source: "x\x0a\x09^ x",
  6712. referencedClasses: [],
  6713. messageSends: []
  6714. }),
  6715. $globals.Point);
  6716. $core.addMethod(
  6717. $core.method({
  6718. selector: "x:",
  6719. protocol: "accessing",
  6720. fn: function (aNumber){
  6721. var self=this,$self=this;
  6722. $self["@x"]=aNumber;
  6723. return self;
  6724. },
  6725. args: ["aNumber"],
  6726. source: "x: aNumber\x0a\x09x := aNumber",
  6727. referencedClasses: [],
  6728. messageSends: []
  6729. }),
  6730. $globals.Point);
  6731. $core.addMethod(
  6732. $core.method({
  6733. selector: "y",
  6734. protocol: "accessing",
  6735. fn: function (){
  6736. var self=this,$self=this;
  6737. return $self["@y"];
  6738. },
  6739. args: [],
  6740. source: "y\x0a\x09^ y",
  6741. referencedClasses: [],
  6742. messageSends: []
  6743. }),
  6744. $globals.Point);
  6745. $core.addMethod(
  6746. $core.method({
  6747. selector: "y:",
  6748. protocol: "accessing",
  6749. fn: function (aNumber){
  6750. var self=this,$self=this;
  6751. $self["@y"]=aNumber;
  6752. return self;
  6753. },
  6754. args: ["aNumber"],
  6755. source: "y: aNumber\x0a\x09y := aNumber",
  6756. referencedClasses: [],
  6757. messageSends: []
  6758. }),
  6759. $globals.Point);
  6760. $core.addMethod(
  6761. $core.method({
  6762. selector: "classTag",
  6763. protocol: "accessing",
  6764. fn: function (){
  6765. var self=this,$self=this;
  6766. return "magnitude";
  6767. },
  6768. args: [],
  6769. source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'magnitude'",
  6770. referencedClasses: [],
  6771. messageSends: []
  6772. }),
  6773. $globals.Point.a$cls);
  6774. $core.addMethod(
  6775. $core.method({
  6776. selector: "x:y:",
  6777. protocol: "instance creation",
  6778. fn: function (aNumber,anotherNumber){
  6779. var self=this,$self=this;
  6780. return $core.withContext(function($ctx1) {
  6781. var $1;
  6782. $1=$self._new();
  6783. $recv($1)._x_(aNumber);
  6784. $recv($1)._y_(anotherNumber);
  6785. return $recv($1)._yourself();
  6786. }, function($ctx1) {$ctx1.fill(self,"x:y:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Point.a$cls)});
  6787. },
  6788. args: ["aNumber", "anotherNumber"],
  6789. source: "x: aNumber y: anotherNumber\x0a\x09^ self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself",
  6790. referencedClasses: [],
  6791. messageSends: ["x:", "new", "y:", "yourself"]
  6792. }),
  6793. $globals.Point.a$cls);
  6794. $core.addClass("Random", $globals.Object, [], "Kernel-Objects");
  6795. $globals.Random.comment="I an used to generate a random number and I am implemented as a trivial wrapper around javascript `Math.random()`.\x0a\x0a## API\x0a\x0aThe typical use case it to use the `#next` method like the following:\x0a\x0a\x09Random new next\x0a\x0aThis will return a float x where x < 1 and x > 0. If you want a random integer from 1 to 10 you can use `#atRandom`\x0a\x0a\x0910 atRandom\x0a\x0aA random number in a specific interval can be obtained with the following:\x0a\x0a\x09(3 to: 7) atRandom\x0a\x0aBe aware that `#to:` does not create an Interval as in other Smalltalk implementations but in fact an `Array` of numbers, so it's better to use:\x0a\x0a\x095 atRandom + 2\x0a\x0aSince `#atRandom` is implemented in `SequencableCollection` you can easy pick an element at random:\x0a\x0a\x09#('a' 'b' 'c') atRandom\x0a\x0aAs well as letter from a `String`:\x0a\x0a\x09'abc' atRandom\x0a\x0aSince Amber does not have Characters this will return a `String` of length 1 like for example `'b'`.";
  6796. $core.addMethod(
  6797. $core.method({
  6798. selector: "next",
  6799. protocol: "accessing",
  6800. fn: function (){
  6801. var self=this,$self=this;
  6802. return $core.withContext(function($ctx1) {
  6803. return Math.random();
  6804. return self;
  6805. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Random)});
  6806. },
  6807. args: [],
  6808. source: "next\x0a\x09<inlineJS: 'return Math.random()'>",
  6809. referencedClasses: [],
  6810. messageSends: []
  6811. }),
  6812. $globals.Random);
  6813. $core.addMethod(
  6814. $core.method({
  6815. selector: "next:",
  6816. protocol: "accessing",
  6817. fn: function (anInteger){
  6818. var self=this,$self=this;
  6819. return $core.withContext(function($ctx1) {
  6820. return $recv((1)._to_(anInteger))._collect_((function(each){
  6821. return $core.withContext(function($ctx2) {
  6822. return $self._next();
  6823. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6824. }));
  6825. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger},$globals.Random)});
  6826. },
  6827. args: ["anInteger"],
  6828. source: "next: anInteger\x0a\x09^ (1 to: anInteger) collect: [ :each | self next ]",
  6829. referencedClasses: [],
  6830. messageSends: ["collect:", "to:", "next"]
  6831. }),
  6832. $globals.Random);
  6833. $core.addClass("Rectangle", $globals.Object, ["origin", "corner"], "Kernel-Objects");
  6834. $globals.Rectangle.comment="I represent a Rectangle defined by my two corners.\x0a\x0aThe simplest way to create an instance is using Point methods:\x0a\x0a 1@1 corner: 2@2\x0a\x0aWIll create a rectangle with 1@1 as the top left and 2@2 at the bottom right.\x0a\x0a 1@1 extent: 1@1\x0a\x0aWill create the same rectangle, defining an origin and a size instead of an origin and a corner.";
  6835. $core.addMethod(
  6836. $core.method({
  6837. selector: "=",
  6838. protocol: "testing",
  6839. fn: function (aRectangle){
  6840. var self=this,$self=this;
  6841. return $core.withContext(function($ctx1) {
  6842. var $1;
  6843. $1=$recv($self["@origin"]).__eq($recv(aRectangle)._origin());
  6844. $ctx1.sendIdx["="]=1;
  6845. return $recv($1)._and_((function(){
  6846. return $core.withContext(function($ctx2) {
  6847. return $recv($self["@corner"]).__eq($recv(aRectangle)._corner());
  6848. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6849. }));
  6850. }, function($ctx1) {$ctx1.fill(self,"=",{aRectangle:aRectangle},$globals.Rectangle)});
  6851. },
  6852. args: ["aRectangle"],
  6853. source: "= aRectangle\x0a\x09^ origin = aRectangle origin and: [ corner = aRectangle corner ]",
  6854. referencedClasses: [],
  6855. messageSends: ["and:", "=", "origin", "corner"]
  6856. }),
  6857. $globals.Rectangle);
  6858. $core.addMethod(
  6859. $core.method({
  6860. selector: "containsPoint:",
  6861. protocol: "testing",
  6862. fn: function (aPoint){
  6863. var self=this,$self=this;
  6864. return $core.withContext(function($ctx1) {
  6865. return $recv($recv($self["@origin"]).__lt_eq(aPoint))._and_((function(){
  6866. return $core.withContext(function($ctx2) {
  6867. return $recv($self["@corner"]).__gt_eq(aPoint);
  6868. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6869. }));
  6870. }, function($ctx1) {$ctx1.fill(self,"containsPoint:",{aPoint:aPoint},$globals.Rectangle)});
  6871. },
  6872. args: ["aPoint"],
  6873. source: "containsPoint: aPoint\x0a\x09^ origin <= aPoint and: [ corner >= aPoint ]",
  6874. referencedClasses: [],
  6875. messageSends: ["and:", "<=", ">="]
  6876. }),
  6877. $globals.Rectangle);
  6878. $core.addMethod(
  6879. $core.method({
  6880. selector: "containsRect:",
  6881. protocol: "testing",
  6882. fn: function (aRect){
  6883. var self=this,$self=this;
  6884. return $core.withContext(function($ctx1) {
  6885. return $recv($recv($recv(aRect)._origin()).__gt_eq($self["@origin"]))._and_((function(){
  6886. return $core.withContext(function($ctx2) {
  6887. return $recv($recv(aRect)._corner()).__lt_eq($self["@corner"]);
  6888. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6889. }));
  6890. }, function($ctx1) {$ctx1.fill(self,"containsRect:",{aRect:aRect},$globals.Rectangle)});
  6891. },
  6892. args: ["aRect"],
  6893. source: "containsRect: aRect\x0a\x09^ aRect origin >= origin and: [ aRect corner <= corner ]",
  6894. referencedClasses: [],
  6895. messageSends: ["and:", ">=", "origin", "<=", "corner"]
  6896. }),
  6897. $globals.Rectangle);
  6898. $core.addMethod(
  6899. $core.method({
  6900. selector: "corner",
  6901. protocol: "accessing",
  6902. fn: function (){
  6903. var self=this,$self=this;
  6904. return $self["@corner"];
  6905. },
  6906. args: [],
  6907. source: "corner\x0a\x09^ corner",
  6908. referencedClasses: [],
  6909. messageSends: []
  6910. }),
  6911. $globals.Rectangle);
  6912. $core.addMethod(
  6913. $core.method({
  6914. selector: "origin",
  6915. protocol: "accessing",
  6916. fn: function (){
  6917. var self=this,$self=this;
  6918. return $self["@origin"];
  6919. },
  6920. args: [],
  6921. source: "origin\x0a\x09^ origin",
  6922. referencedClasses: [],
  6923. messageSends: []
  6924. }),
  6925. $globals.Rectangle);
  6926. $core.addMethod(
  6927. $core.method({
  6928. selector: "printOn:",
  6929. protocol: "testing",
  6930. fn: function (aStream){
  6931. var self=this,$self=this;
  6932. return $core.withContext(function($ctx1) {
  6933. $recv($self["@origin"])._printOn_(aStream);
  6934. $ctx1.sendIdx["printOn:"]=1;
  6935. $recv(aStream)._nextPutAll_(" corner: ");
  6936. $recv($self["@corner"])._printOn_(aStream);
  6937. return self;
  6938. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Rectangle)});
  6939. },
  6940. args: ["aStream"],
  6941. source: "printOn: aStream\x0a\x09origin printOn: aStream.\x0a\x09aStream nextPutAll: ' corner: '.\x0a\x09corner printOn: aStream.",
  6942. referencedClasses: [],
  6943. messageSends: ["printOn:", "nextPutAll:"]
  6944. }),
  6945. $globals.Rectangle);
  6946. $core.addMethod(
  6947. $core.method({
  6948. selector: "setPoint:point:",
  6949. protocol: "private",
  6950. fn: function (pt1,pt2){
  6951. var self=this,$self=this;
  6952. return $core.withContext(function($ctx1) {
  6953. var $2,$3,$1,$5,$6,$4,$8,$7,$10,$9;
  6954. $2=$recv(pt1)._x();
  6955. $ctx1.sendIdx["x"]=1;
  6956. $3=$recv(pt2)._x();
  6957. $ctx1.sendIdx["x"]=2;
  6958. $1=$recv($2)._min_($3);
  6959. $ctx1.sendIdx["min:"]=1;
  6960. $5=$recv(pt1)._y();
  6961. $ctx1.sendIdx["y"]=1;
  6962. $6=$recv(pt2)._y();
  6963. $ctx1.sendIdx["y"]=2;
  6964. $4=$recv($5)._min_($6);
  6965. $self["@origin"]=$recv($1).__at($4);
  6966. $ctx1.sendIdx["@"]=1;
  6967. $8=$recv(pt1)._x();
  6968. $ctx1.sendIdx["x"]=3;
  6969. $7=$recv($8)._max_($recv(pt2)._x());
  6970. $ctx1.sendIdx["max:"]=1;
  6971. $10=$recv(pt1)._y();
  6972. $ctx1.sendIdx["y"]=3;
  6973. $9=$recv($10)._max_($recv(pt2)._y());
  6974. $self["@corner"]=$recv($7).__at($9);
  6975. return self;
  6976. }, function($ctx1) {$ctx1.fill(self,"setPoint:point:",{pt1:pt1,pt2:pt2},$globals.Rectangle)});
  6977. },
  6978. args: ["pt1", "pt2"],
  6979. source: "setPoint: pt1 point: pt2\x0a\x0a\x09origin := (pt1 x min: pt2 x)@(pt1 y min: pt2 y).\x0a\x09corner := (pt1 x max: pt2 x)@(pt1 y max: pt2 y).",
  6980. referencedClasses: [],
  6981. messageSends: ["@", "min:", "x", "y", "max:"]
  6982. }),
  6983. $globals.Rectangle);
  6984. $core.addMethod(
  6985. $core.method({
  6986. selector: "origin:corner:",
  6987. protocol: "instance creation",
  6988. fn: function (anOrigin,aCorner){
  6989. var self=this,$self=this;
  6990. return $core.withContext(function($ctx1) {
  6991. return $recv($self._basicNew())._setPoint_point_(anOrigin,aCorner);
  6992. }, function($ctx1) {$ctx1.fill(self,"origin:corner:",{anOrigin:anOrigin,aCorner:aCorner},$globals.Rectangle.a$cls)});
  6993. },
  6994. args: ["anOrigin", "aCorner"],
  6995. source: "origin: anOrigin corner: aCorner\x0a\x09^ self basicNew setPoint: anOrigin point: aCorner.",
  6996. referencedClasses: [],
  6997. messageSends: ["setPoint:point:", "basicNew"]
  6998. }),
  6999. $globals.Rectangle.a$cls);
  7000. $core.addMethod(
  7001. $core.method({
  7002. selector: "origin:extent:",
  7003. protocol: "instance creation",
  7004. fn: function (anOrigin,anExtent){
  7005. var self=this,$self=this;
  7006. return $core.withContext(function($ctx1) {
  7007. return $recv($self._basicNew())._setPoint_point_(anOrigin,$recv(anOrigin).__plus(anExtent));
  7008. }, function($ctx1) {$ctx1.fill(self,"origin:extent:",{anOrigin:anOrigin,anExtent:anExtent},$globals.Rectangle.a$cls)});
  7009. },
  7010. args: ["anOrigin", "anExtent"],
  7011. source: "origin: anOrigin extent: anExtent\x0a\x09^ self basicNew setPoint: anOrigin point: anOrigin + anExtent.",
  7012. referencedClasses: [],
  7013. messageSends: ["setPoint:point:", "basicNew", "+"]
  7014. }),
  7015. $globals.Rectangle.a$cls);
  7016. $core.addMethod(
  7017. $core.method({
  7018. selector: "point:point:",
  7019. protocol: "instance creation",
  7020. fn: function (anOrigin,aCorner){
  7021. var self=this,$self=this;
  7022. return $core.withContext(function($ctx1) {
  7023. return $recv($self._basicNew())._setPoint_point_(anOrigin,aCorner);
  7024. }, function($ctx1) {$ctx1.fill(self,"point:point:",{anOrigin:anOrigin,aCorner:aCorner},$globals.Rectangle.a$cls)});
  7025. },
  7026. args: ["anOrigin", "aCorner"],
  7027. source: "point: anOrigin point: aCorner\x0a\x09^ self basicNew setPoint: anOrigin point: aCorner.",
  7028. referencedClasses: [],
  7029. messageSends: ["setPoint:point:", "basicNew"]
  7030. }),
  7031. $globals.Rectangle.a$cls);
  7032. $core.addClass("UndefinedObject", $globals.Object, [], "Kernel-Objects");
  7033. $globals.UndefinedObject.comment="I describe the behavior of my sole instance, `nil`. `nil` represents a prior value for variables that have not been initialized, or for results which are meaningless.\x0a\x0a`nil` is the Smalltalk equivalent of the `undefined` JavaScript object.\x0a\x0a__note:__ When sending messages to the `undefined` JavaScript object, it will be replaced by `nil`.";
  7034. $core.addMethod(
  7035. $core.method({
  7036. selector: "==",
  7037. protocol: "testing",
  7038. fn: function (anObject){
  7039. var self=this,$self=this;
  7040. return $core.withContext(function($ctx1) {
  7041. return $recv(anObject)._isNil();
  7042. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},$globals.UndefinedObject)});
  7043. },
  7044. args: ["anObject"],
  7045. source: "== anObject\x0a\x09^ anObject isNil",
  7046. referencedClasses: [],
  7047. messageSends: ["isNil"]
  7048. }),
  7049. $globals.UndefinedObject);
  7050. $core.addMethod(
  7051. $core.method({
  7052. selector: "asJavaScriptObject",
  7053. protocol: "converting",
  7054. fn: function (){
  7055. var self=this,$self=this;
  7056. return null;
  7057. },
  7058. args: [],
  7059. source: "asJavaScriptObject\x0a\x09^ null",
  7060. referencedClasses: [],
  7061. messageSends: []
  7062. }),
  7063. $globals.UndefinedObject);
  7064. $core.addMethod(
  7065. $core.method({
  7066. selector: "deepCopy",
  7067. protocol: "copying",
  7068. fn: function (){
  7069. var self=this,$self=this;
  7070. return self;
  7071. },
  7072. args: [],
  7073. source: "deepCopy\x0a\x09^ self",
  7074. referencedClasses: [],
  7075. messageSends: []
  7076. }),
  7077. $globals.UndefinedObject);
  7078. $core.addMethod(
  7079. $core.method({
  7080. selector: "identityHash",
  7081. protocol: "accessing",
  7082. fn: function (){
  7083. var self=this,$self=this;
  7084. return "NIL";
  7085. },
  7086. args: [],
  7087. source: "identityHash\x0a\x09^ 'NIL'",
  7088. referencedClasses: [],
  7089. messageSends: []
  7090. }),
  7091. $globals.UndefinedObject);
  7092. $core.addMethod(
  7093. $core.method({
  7094. selector: "ifNil:",
  7095. protocol: "testing",
  7096. fn: function (aBlock){
  7097. var self=this,$self=this;
  7098. return $core.withContext(function($ctx1) {
  7099. return $self._ifNil_ifNotNil_(aBlock,(function(){
  7100. }));
  7101. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock},$globals.UndefinedObject)});
  7102. },
  7103. args: ["aBlock"],
  7104. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifNil: aBlock ifNotNil: []",
  7105. referencedClasses: [],
  7106. messageSends: ["ifNil:ifNotNil:"]
  7107. }),
  7108. $globals.UndefinedObject);
  7109. $core.addMethod(
  7110. $core.method({
  7111. selector: "ifNil:ifNotNil:",
  7112. protocol: "testing",
  7113. fn: function (aBlock,anotherBlock){
  7114. var self=this,$self=this;
  7115. return $core.withContext(function($ctx1) {
  7116. return $recv(aBlock)._value();
  7117. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  7118. },
  7119. args: ["aBlock", "anotherBlock"],
  7120. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value",
  7121. referencedClasses: [],
  7122. messageSends: ["value"]
  7123. }),
  7124. $globals.UndefinedObject);
  7125. $core.addMethod(
  7126. $core.method({
  7127. selector: "ifNotNil:",
  7128. protocol: "testing",
  7129. fn: function (aBlock){
  7130. var self=this,$self=this;
  7131. return self;
  7132. },
  7133. args: ["aBlock"],
  7134. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  7135. referencedClasses: [],
  7136. messageSends: []
  7137. }),
  7138. $globals.UndefinedObject);
  7139. $core.addMethod(
  7140. $core.method({
  7141. selector: "ifNotNil:ifNil:",
  7142. protocol: "testing",
  7143. fn: function (aBlock,anotherBlock){
  7144. var self=this,$self=this;
  7145. return $core.withContext(function($ctx1) {
  7146. return $recv(anotherBlock)._value();
  7147. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  7148. },
  7149. args: ["aBlock", "anotherBlock"],
  7150. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value",
  7151. referencedClasses: [],
  7152. messageSends: ["value"]
  7153. }),
  7154. $globals.UndefinedObject);
  7155. $core.addMethod(
  7156. $core.method({
  7157. selector: "isImmutable",
  7158. protocol: "testing",
  7159. fn: function (){
  7160. var self=this,$self=this;
  7161. return true;
  7162. },
  7163. args: [],
  7164. source: "isImmutable\x0a\x09^ true",
  7165. referencedClasses: [],
  7166. messageSends: []
  7167. }),
  7168. $globals.UndefinedObject);
  7169. $core.addMethod(
  7170. $core.method({
  7171. selector: "isNil",
  7172. protocol: "testing",
  7173. fn: function (){
  7174. var self=this,$self=this;
  7175. return true;
  7176. },
  7177. args: [],
  7178. source: "isNil\x0a\x09^ true",
  7179. referencedClasses: [],
  7180. messageSends: []
  7181. }),
  7182. $globals.UndefinedObject);
  7183. $core.addMethod(
  7184. $core.method({
  7185. selector: "notNil",
  7186. protocol: "testing",
  7187. fn: function (){
  7188. var self=this,$self=this;
  7189. return false;
  7190. },
  7191. args: [],
  7192. source: "notNil\x0a\x09^ false",
  7193. referencedClasses: [],
  7194. messageSends: []
  7195. }),
  7196. $globals.UndefinedObject);
  7197. $core.addMethod(
  7198. $core.method({
  7199. selector: "printOn:",
  7200. protocol: "printing",
  7201. fn: function (aStream){
  7202. var self=this,$self=this;
  7203. return $core.withContext(function($ctx1) {
  7204. $recv(aStream)._nextPutAll_("nil");
  7205. return self;
  7206. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.UndefinedObject)});
  7207. },
  7208. args: ["aStream"],
  7209. source: "printOn: aStream\x0a\x09aStream nextPutAll: 'nil'",
  7210. referencedClasses: [],
  7211. messageSends: ["nextPutAll:"]
  7212. }),
  7213. $globals.UndefinedObject);
  7214. $core.addMethod(
  7215. $core.method({
  7216. selector: "shallowCopy",
  7217. protocol: "copying",
  7218. fn: function (){
  7219. var self=this,$self=this;
  7220. return self;
  7221. },
  7222. args: [],
  7223. source: "shallowCopy\x0a\x09^ self",
  7224. referencedClasses: [],
  7225. messageSends: []
  7226. }),
  7227. $globals.UndefinedObject);
  7228. $core.addMethod(
  7229. $core.method({
  7230. selector: "value",
  7231. protocol: "evaluating",
  7232. fn: function (){
  7233. var self=this,$self=this;
  7234. return $core.withContext(function($ctx1) {
  7235. return null;
  7236. return self;
  7237. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.UndefinedObject)});
  7238. },
  7239. args: [],
  7240. source: "value\x0a\x09<inlineJS: 'return null'>",
  7241. referencedClasses: [],
  7242. messageSends: []
  7243. }),
  7244. $globals.UndefinedObject);
  7245. $core.addMethod(
  7246. $core.method({
  7247. selector: "new",
  7248. protocol: "instance creation",
  7249. fn: function (){
  7250. var self=this,$self=this;
  7251. return $core.withContext(function($ctx1) {
  7252. $self._error_("You cannot create new instances of UndefinedObject. Use nil");
  7253. return self;
  7254. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.UndefinedObject.a$cls)});
  7255. },
  7256. args: [],
  7257. source: "new\x0a\x09\x09self error: 'You cannot create new instances of UndefinedObject. Use nil'",
  7258. referencedClasses: [],
  7259. messageSends: ["error:"]
  7260. }),
  7261. $globals.UndefinedObject.a$cls);
  7262. $core.setTraitComposition([{trait: $globals.TSubclassable}], $globals.UndefinedObject);
  7263. });
  7264. define('amber_core/Kernel-Collections',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  7265. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  7266. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  7267. var $pkg = $core.addPackage("Kernel-Collections");
  7268. $pkg.innerEval = function (expr) { return eval(expr); };
  7269. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  7270. $core.addClass("Association", $globals.Object, ["key", "value"], "Kernel-Collections");
  7271. $globals.Association.comment="I represent a pair of associated objects, a key and a value. My instances can serve as entries in a dictionary.\x0a\x0aInstances can be created with the class-side method `#key:value:`";
  7272. $core.addMethod(
  7273. $core.method({
  7274. selector: "=",
  7275. protocol: "comparing",
  7276. fn: function (anAssociation){
  7277. var self=this,$self=this;
  7278. return $core.withContext(function($ctx1) {
  7279. var $3,$2,$5,$4,$6,$1;
  7280. $3=$self._class();
  7281. $ctx1.sendIdx["class"]=1;
  7282. $2=$recv($3).__eq($recv(anAssociation)._class());
  7283. $ctx1.sendIdx["="]=1;
  7284. $1=$recv($2)._and_((function(){
  7285. return $core.withContext(function($ctx2) {
  7286. $5=$self._key();
  7287. $ctx2.sendIdx["key"]=1;
  7288. $4=$recv($5).__eq($recv(anAssociation)._key());
  7289. $ctx2.sendIdx["="]=2;
  7290. return $recv($4)._and_((function(){
  7291. return $core.withContext(function($ctx3) {
  7292. $6=$self._value();
  7293. $ctx3.sendIdx["value"]=1;
  7294. return $recv($6).__eq($recv(anAssociation)._value());
  7295. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  7296. }));
  7297. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7298. }));
  7299. $ctx1.sendIdx["and:"]=1;
  7300. return $1;
  7301. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},$globals.Association)});
  7302. },
  7303. args: ["anAssociation"],
  7304. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  7305. referencedClasses: [],
  7306. messageSends: ["and:", "=", "class", "key", "value"]
  7307. }),
  7308. $globals.Association);
  7309. $core.addMethod(
  7310. $core.method({
  7311. selector: "key",
  7312. protocol: "accessing",
  7313. fn: function (){
  7314. var self=this,$self=this;
  7315. return $self["@key"];
  7316. },
  7317. args: [],
  7318. source: "key\x0a\x09^ key",
  7319. referencedClasses: [],
  7320. messageSends: []
  7321. }),
  7322. $globals.Association);
  7323. $core.addMethod(
  7324. $core.method({
  7325. selector: "key:",
  7326. protocol: "accessing",
  7327. fn: function (aKey){
  7328. var self=this,$self=this;
  7329. $self["@key"]=aKey;
  7330. return self;
  7331. },
  7332. args: ["aKey"],
  7333. source: "key: aKey\x0a\x09key := aKey",
  7334. referencedClasses: [],
  7335. messageSends: []
  7336. }),
  7337. $globals.Association);
  7338. $core.addMethod(
  7339. $core.method({
  7340. selector: "printOn:",
  7341. protocol: "printing",
  7342. fn: function (aStream){
  7343. var self=this,$self=this;
  7344. return $core.withContext(function($ctx1) {
  7345. $recv($self._key())._printOn_(aStream);
  7346. $ctx1.sendIdx["printOn:"]=1;
  7347. $recv(aStream)._nextPutAll_(" -> ");
  7348. $recv($self._value())._printOn_(aStream);
  7349. return self;
  7350. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Association)});
  7351. },
  7352. args: ["aStream"],
  7353. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  7354. referencedClasses: [],
  7355. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  7356. }),
  7357. $globals.Association);
  7358. $core.addMethod(
  7359. $core.method({
  7360. selector: "value",
  7361. protocol: "accessing",
  7362. fn: function (){
  7363. var self=this,$self=this;
  7364. return $self["@value"];
  7365. },
  7366. args: [],
  7367. source: "value\x0a\x09^ value",
  7368. referencedClasses: [],
  7369. messageSends: []
  7370. }),
  7371. $globals.Association);
  7372. $core.addMethod(
  7373. $core.method({
  7374. selector: "value:",
  7375. protocol: "accessing",
  7376. fn: function (aValue){
  7377. var self=this,$self=this;
  7378. $self["@value"]=aValue;
  7379. return self;
  7380. },
  7381. args: ["aValue"],
  7382. source: "value: aValue\x0a\x09value := aValue",
  7383. referencedClasses: [],
  7384. messageSends: []
  7385. }),
  7386. $globals.Association);
  7387. $core.addMethod(
  7388. $core.method({
  7389. selector: "key:value:",
  7390. protocol: "instance creation",
  7391. fn: function (aKey,aValue){
  7392. var self=this,$self=this;
  7393. return $core.withContext(function($ctx1) {
  7394. var $1;
  7395. $1=$self._new();
  7396. $recv($1)._key_(aKey);
  7397. $recv($1)._value_(aValue);
  7398. return $recv($1)._yourself();
  7399. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},$globals.Association.a$cls)});
  7400. },
  7401. args: ["aKey", "aValue"],
  7402. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  7403. referencedClasses: [],
  7404. messageSends: ["key:", "new", "value:", "yourself"]
  7405. }),
  7406. $globals.Association.a$cls);
  7407. $core.addClass("BucketStore", $globals.Object, ["buckets", "hashBlock"], "Kernel-Collections");
  7408. $globals.BucketStore.comment="I am an helper class for hash-based stores.\x0a\x0aI hold buckets which are selected by a hash, specified using `#hashBlock:`.\x0aThe hash can be any object, and\x0ait is used as a JS property (that is, in ES5\x0aits toString() value counts).\x0a\x0a## API\x0aI maintain a list of buckets. Client code can use this API:\x0a - `#bucketOfElement:` (to ask a bucket for element, I can return JS null if n/a)\x0a - `#do:` (to enumerate all elements of all buckets)\x0a - `#removeAll` (to remove all buckets)\x0a\x0aClient code itself should add/remove elements\x0ain a bucket. The `nil` object should not be put into any bucket.\x0a\x0aTypes of buckets are the responsibility of subclasses via `#newBucket`.";
  7409. $core.addMethod(
  7410. $core.method({
  7411. selector: "bucketOfElement:",
  7412. protocol: "accessing",
  7413. fn: function (anObject){
  7414. var self=this,$self=this;
  7415. return $core.withContext(function($ctx1) {
  7416. var hash = $self['@hashBlock'](anObject);
  7417. if (!hash) return null;
  7418. var buckets = $self['@buckets'],
  7419. bucket = buckets[hash];
  7420. if (!bucket) { bucket = buckets[hash] = $self._newBucket(); }
  7421. return bucket;
  7422. ;
  7423. return self;
  7424. }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject},$globals.BucketStore)});
  7425. },
  7426. args: ["anObject"],
  7427. source: "bucketOfElement: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var hash = $self[''@hashBlock''](anObject);\x0a\x09\x09if (!hash) return null;\x0a\x09\x09var buckets = $self[''@buckets''],\x0a\x09\x09\x09bucket = buckets[hash];\x0a\x09\x09if (!bucket) { bucket = buckets[hash] = $self._newBucket(); }\x0a\x09\x09return bucket;\x0a\x09'>",
  7428. referencedClasses: [],
  7429. messageSends: []
  7430. }),
  7431. $globals.BucketStore);
  7432. $core.addMethod(
  7433. $core.method({
  7434. selector: "do:",
  7435. protocol: "enumerating",
  7436. fn: function (aBlock){
  7437. var self=this,$self=this;
  7438. return $core.withContext(function($ctx1) {
  7439. var buckets = $self['@buckets'];
  7440. var keys = Object.keys(buckets);
  7441. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  7442. ;
  7443. return self;
  7444. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.BucketStore)});
  7445. },
  7446. args: ["aBlock"],
  7447. source: "do: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var buckets = $self[''@buckets''];\x0a\x09\x09var keys = Object.keys(buckets);\x0a\x09\x09for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }\x0a\x09'>",
  7448. referencedClasses: [],
  7449. messageSends: []
  7450. }),
  7451. $globals.BucketStore);
  7452. $core.addMethod(
  7453. $core.method({
  7454. selector: "hashBlock:",
  7455. protocol: "accessing",
  7456. fn: function (aBlock){
  7457. var self=this,$self=this;
  7458. $self["@hashBlock"]=aBlock;
  7459. return self;
  7460. },
  7461. args: ["aBlock"],
  7462. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  7463. referencedClasses: [],
  7464. messageSends: []
  7465. }),
  7466. $globals.BucketStore);
  7467. $core.addMethod(
  7468. $core.method({
  7469. selector: "initialize",
  7470. protocol: "initialization",
  7471. fn: function (){
  7472. var self=this,$self=this;
  7473. return $core.withContext(function($ctx1) {
  7474. (
  7475. $ctx1.supercall = true,
  7476. ($globals.BucketStore.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  7477. $ctx1.supercall = false;
  7478. $self._removeAll();
  7479. return self;
  7480. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BucketStore)});
  7481. },
  7482. args: [],
  7483. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  7484. referencedClasses: [],
  7485. messageSends: ["initialize", "removeAll"]
  7486. }),
  7487. $globals.BucketStore);
  7488. $core.addMethod(
  7489. $core.method({
  7490. selector: "newBucket",
  7491. protocol: "private",
  7492. fn: function (){
  7493. var self=this,$self=this;
  7494. return $core.withContext(function($ctx1) {
  7495. $self._subclassResponsibility();
  7496. return self;
  7497. }, function($ctx1) {$ctx1.fill(self,"newBucket",{},$globals.BucketStore)});
  7498. },
  7499. args: [],
  7500. source: "newBucket\x0a\x09self subclassResponsibility",
  7501. referencedClasses: [],
  7502. messageSends: ["subclassResponsibility"]
  7503. }),
  7504. $globals.BucketStore);
  7505. $core.addMethod(
  7506. $core.method({
  7507. selector: "removeAll",
  7508. protocol: "adding/removing",
  7509. fn: function (){
  7510. var self=this,$self=this;
  7511. return $core.withContext(function($ctx1) {
  7512. $self['@buckets'] = Object.create(null);;
  7513. return self;
  7514. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.BucketStore)});
  7515. },
  7516. args: [],
  7517. source: "removeAll\x0a\x09<inlineJS: '$self[''@buckets''] = Object.create(null);'>",
  7518. referencedClasses: [],
  7519. messageSends: []
  7520. }),
  7521. $globals.BucketStore);
  7522. $core.addMethod(
  7523. $core.method({
  7524. selector: "hashBlock:",
  7525. protocol: "instance creation",
  7526. fn: function (aBlock){
  7527. var self=this,$self=this;
  7528. return $core.withContext(function($ctx1) {
  7529. var $1;
  7530. $1=$self._new();
  7531. $recv($1)._hashBlock_(aBlock);
  7532. return $recv($1)._yourself();
  7533. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock},$globals.BucketStore.a$cls)});
  7534. },
  7535. args: ["aBlock"],
  7536. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  7537. referencedClasses: [],
  7538. messageSends: ["hashBlock:", "new", "yourself"]
  7539. }),
  7540. $globals.BucketStore.a$cls);
  7541. $core.addClass("ArrayBucketStore", $globals.BucketStore, [], "Kernel-Collections");
  7542. $globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  7543. $core.addMethod(
  7544. $core.method({
  7545. selector: "newBucket",
  7546. protocol: "private",
  7547. fn: function (){
  7548. var self=this,$self=this;
  7549. return [];
  7550. },
  7551. args: [],
  7552. source: "newBucket\x0a\x09^ #()",
  7553. referencedClasses: [],
  7554. messageSends: []
  7555. }),
  7556. $globals.ArrayBucketStore);
  7557. $core.addClass("Collection", $globals.Object, [], "Kernel-Collections");
  7558. $globals.Collection.comment="I am the abstract superclass of all classes that represent a group of elements.\x0a\x0aI provide a set of useful methods to the Collection hierarchy such as enumerating and converting methods.";
  7559. $core.addMethod(
  7560. $core.method({
  7561. selector: ",",
  7562. protocol: "copying",
  7563. fn: function (aCollection){
  7564. var self=this,$self=this;
  7565. return $core.withContext(function($ctx1) {
  7566. var $1;
  7567. $1=$self._copy();
  7568. $recv($1)._addAll_(aCollection);
  7569. return $recv($1)._yourself();
  7570. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},$globals.Collection)});
  7571. },
  7572. args: ["aCollection"],
  7573. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  7574. referencedClasses: [],
  7575. messageSends: ["addAll:", "copy", "yourself"]
  7576. }),
  7577. $globals.Collection);
  7578. $core.addMethod(
  7579. $core.method({
  7580. selector: "add:",
  7581. protocol: "adding/removing",
  7582. fn: function (anObject){
  7583. var self=this,$self=this;
  7584. return $core.withContext(function($ctx1) {
  7585. $self._subclassResponsibility();
  7586. return self;
  7587. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Collection)});
  7588. },
  7589. args: ["anObject"],
  7590. source: "add: anObject\x0a\x09self subclassResponsibility",
  7591. referencedClasses: [],
  7592. messageSends: ["subclassResponsibility"]
  7593. }),
  7594. $globals.Collection);
  7595. $core.addMethod(
  7596. $core.method({
  7597. selector: "addAll:",
  7598. protocol: "adding/removing",
  7599. fn: function (aCollection){
  7600. var self=this,$self=this;
  7601. return $core.withContext(function($ctx1) {
  7602. $recv(aCollection)._do_((function(each){
  7603. return $core.withContext(function($ctx2) {
  7604. return $self._add_(each);
  7605. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7606. }));
  7607. return aCollection;
  7608. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Collection)});
  7609. },
  7610. args: ["aCollection"],
  7611. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  7612. referencedClasses: [],
  7613. messageSends: ["do:", "add:"]
  7614. }),
  7615. $globals.Collection);
  7616. $core.addMethod(
  7617. $core.method({
  7618. selector: "allSatisfy:",
  7619. protocol: "enumerating",
  7620. fn: function (aBlock){
  7621. var self=this,$self=this;
  7622. return $core.withContext(function($ctx1) {
  7623. var $1;
  7624. var $early={};
  7625. try {
  7626. $self._do_((function(each){
  7627. return $core.withContext(function($ctx2) {
  7628. $1=$recv(aBlock)._value_(each);
  7629. if(!$core.assert($1)){
  7630. throw $early=[false];
  7631. }
  7632. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7633. }));
  7634. return true;
  7635. }
  7636. catch(e) {if(e===$early)return e[0]; throw e}
  7637. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock},$globals.Collection)});
  7638. },
  7639. args: ["aBlock"],
  7640. source: "allSatisfy: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns false for any element return false.\x0a\x09Otherwise return true.\x22\x0a\x0a\x09self do: [ :each | (aBlock value: each) ifFalse: [ ^ false ] ].\x0a\x09^ true",
  7641. referencedClasses: [],
  7642. messageSends: ["do:", "ifFalse:", "value:"]
  7643. }),
  7644. $globals.Collection);
  7645. $core.addMethod(
  7646. $core.method({
  7647. selector: "anyOne",
  7648. protocol: "accessing",
  7649. fn: function (){
  7650. var self=this,$self=this;
  7651. return $core.withContext(function($ctx1) {
  7652. var $early={};
  7653. try {
  7654. $self._ifEmpty_((function(){
  7655. return $core.withContext(function($ctx2) {
  7656. return $self._error_("Collection is empty");
  7657. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7658. }));
  7659. $self._do_((function(each){
  7660. throw $early=[each];
  7661. }));
  7662. return self;
  7663. }
  7664. catch(e) {if(e===$early)return e[0]; throw e}
  7665. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.Collection)});
  7666. },
  7667. args: [],
  7668. source: "anyOne\x0a\x09\x22Answer a representative sample of the receiver. This method can\x0a\x09be helpful when needing to preinfer the nature of the contents of \x0a\x09semi-homogeneous collections.\x22\x0a\x0a\x09self ifEmpty: [ self error: 'Collection is empty' ].\x0a\x09self do: [ :each | ^ each ]",
  7669. referencedClasses: [],
  7670. messageSends: ["ifEmpty:", "error:", "do:"]
  7671. }),
  7672. $globals.Collection);
  7673. $core.addMethod(
  7674. $core.method({
  7675. selector: "anySatisfy:",
  7676. protocol: "enumerating",
  7677. fn: function (aBlock){
  7678. var self=this,$self=this;
  7679. return $core.withContext(function($ctx1) {
  7680. var $1;
  7681. var $early={};
  7682. try {
  7683. $self._do_((function(each){
  7684. return $core.withContext(function($ctx2) {
  7685. $1=$recv(aBlock)._value_(each);
  7686. if($core.assert($1)){
  7687. throw $early=[true];
  7688. }
  7689. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7690. }));
  7691. return false;
  7692. }
  7693. catch(e) {if(e===$early)return e[0]; throw e}
  7694. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock},$globals.Collection)});
  7695. },
  7696. args: ["aBlock"],
  7697. source: "anySatisfy: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns true for any element return true.\x0a\x09Otherwise return false.\x22\x0a\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^ true ] ].\x0a\x09^ false",
  7698. referencedClasses: [],
  7699. messageSends: ["do:", "ifTrue:", "value:"]
  7700. }),
  7701. $globals.Collection);
  7702. $core.addMethod(
  7703. $core.method({
  7704. selector: "asArray",
  7705. protocol: "converting",
  7706. fn: function (){
  7707. var self=this,$self=this;
  7708. return $core.withContext(function($ctx1) {
  7709. return $recv($globals.Array)._withAll_(self);
  7710. }, function($ctx1) {$ctx1.fill(self,"asArray",{},$globals.Collection)});
  7711. },
  7712. args: [],
  7713. source: "asArray\x0a\x09^ Array withAll: self",
  7714. referencedClasses: ["Array"],
  7715. messageSends: ["withAll:"]
  7716. }),
  7717. $globals.Collection);
  7718. $core.addMethod(
  7719. $core.method({
  7720. selector: "asJavaScriptObject",
  7721. protocol: "converting",
  7722. fn: function (){
  7723. var self=this,$self=this;
  7724. return $core.withContext(function($ctx1) {
  7725. return $recv($self._asArray())._collect_((function(each){
  7726. return $core.withContext(function($ctx2) {
  7727. return $recv(each)._asJavaScriptObject();
  7728. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7729. }));
  7730. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.Collection)});
  7731. },
  7732. args: [],
  7733. source: "asJavaScriptObject\x0a\x09^ self asArray collect: [ :each | each asJavaScriptObject ]",
  7734. referencedClasses: [],
  7735. messageSends: ["collect:", "asArray", "asJavaScriptObject"]
  7736. }),
  7737. $globals.Collection);
  7738. $core.addMethod(
  7739. $core.method({
  7740. selector: "asOrderedCollection",
  7741. protocol: "converting",
  7742. fn: function (){
  7743. var self=this,$self=this;
  7744. return $core.withContext(function($ctx1) {
  7745. return $self._asArray();
  7746. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},$globals.Collection)});
  7747. },
  7748. args: [],
  7749. source: "asOrderedCollection\x0a\x09^ self asArray",
  7750. referencedClasses: [],
  7751. messageSends: ["asArray"]
  7752. }),
  7753. $globals.Collection);
  7754. $core.addMethod(
  7755. $core.method({
  7756. selector: "asSet",
  7757. protocol: "converting",
  7758. fn: function (){
  7759. var self=this,$self=this;
  7760. return $core.withContext(function($ctx1) {
  7761. return $recv($globals.Set)._withAll_(self);
  7762. }, function($ctx1) {$ctx1.fill(self,"asSet",{},$globals.Collection)});
  7763. },
  7764. args: [],
  7765. source: "asSet\x0a\x09^ Set withAll: self",
  7766. referencedClasses: ["Set"],
  7767. messageSends: ["withAll:"]
  7768. }),
  7769. $globals.Collection);
  7770. $core.addMethod(
  7771. $core.method({
  7772. selector: "collect:",
  7773. protocol: "enumerating",
  7774. fn: function (aBlock){
  7775. var self=this,$self=this;
  7776. var stream;
  7777. return $core.withContext(function($ctx1) {
  7778. stream=$recv($recv($self._class())._new())._writeStream();
  7779. $self._do_((function(each){
  7780. return $core.withContext(function($ctx2) {
  7781. return $recv(stream)._nextPut_($recv(aBlock)._value_(each));
  7782. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7783. }));
  7784. return $recv(stream)._contents();
  7785. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  7786. },
  7787. args: ["aBlock"],
  7788. source: "collect: aBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [ :each |\x0a\x09\x09stream nextPut: (aBlock value: each) ].\x0a\x09^ stream contents",
  7789. referencedClasses: [],
  7790. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  7791. }),
  7792. $globals.Collection);
  7793. $core.addMethod(
  7794. $core.method({
  7795. selector: "copyWith:",
  7796. protocol: "copying",
  7797. fn: function (anObject){
  7798. var self=this,$self=this;
  7799. return $core.withContext(function($ctx1) {
  7800. var $1;
  7801. $1=$self._copy();
  7802. $recv($1)._add_(anObject);
  7803. return $recv($1)._yourself();
  7804. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},$globals.Collection)});
  7805. },
  7806. args: ["anObject"],
  7807. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  7808. referencedClasses: [],
  7809. messageSends: ["add:", "copy", "yourself"]
  7810. }),
  7811. $globals.Collection);
  7812. $core.addMethod(
  7813. $core.method({
  7814. selector: "copyWithAll:",
  7815. protocol: "copying",
  7816. fn: function (aCollection){
  7817. var self=this,$self=this;
  7818. return $core.withContext(function($ctx1) {
  7819. $self._deprecatedAPI_("Use #, instead.");
  7820. return $self.__comma(aCollection);
  7821. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},$globals.Collection)});
  7822. },
  7823. args: ["aCollection"],
  7824. source: "copyWithAll: aCollection\x0a\x09self deprecatedAPI: 'Use #, instead.'.\x0a\x09^ self, aCollection",
  7825. referencedClasses: [],
  7826. messageSends: ["deprecatedAPI:", ","]
  7827. }),
  7828. $globals.Collection);
  7829. $core.addMethod(
  7830. $core.method({
  7831. selector: "copyWithout:",
  7832. protocol: "copying",
  7833. fn: function (anObject){
  7834. var self=this,$self=this;
  7835. return $core.withContext(function($ctx1) {
  7836. return $self._reject_((function(each){
  7837. return $core.withContext(function($ctx2) {
  7838. return $recv(each).__eq(anObject);
  7839. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7840. }));
  7841. }, function($ctx1) {$ctx1.fill(self,"copyWithout:",{anObject:anObject},$globals.Collection)});
  7842. },
  7843. args: ["anObject"],
  7844. source: "copyWithout: anObject\x0a\x09\x22Answer a copy of the receiver that does not contain\x0a\x09any occurrences of anObject.\x22\x0a\x0a\x09^ self reject: [ :each | each = anObject ]",
  7845. referencedClasses: [],
  7846. messageSends: ["reject:", "="]
  7847. }),
  7848. $globals.Collection);
  7849. $core.addMethod(
  7850. $core.method({
  7851. selector: "copyWithoutAll:",
  7852. protocol: "copying",
  7853. fn: function (aCollection){
  7854. var self=this,$self=this;
  7855. return $core.withContext(function($ctx1) {
  7856. return $self._reject_((function(each){
  7857. return $core.withContext(function($ctx2) {
  7858. return $recv(aCollection)._includes_(each);
  7859. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7860. }));
  7861. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},$globals.Collection)});
  7862. },
  7863. args: ["aCollection"],
  7864. source: "copyWithoutAll: aCollection\x0a\x09\x22Answer a copy of the receiver that does not contain any elements\x0a\x09equal to those in aCollection.\x22\x0a\x0a\x09^ self reject: [ :each | aCollection includes: each ]",
  7865. referencedClasses: [],
  7866. messageSends: ["reject:", "includes:"]
  7867. }),
  7868. $globals.Collection);
  7869. $core.addMethod(
  7870. $core.method({
  7871. selector: "deepCopy",
  7872. protocol: "copying",
  7873. fn: function (){
  7874. var self=this,$self=this;
  7875. return $core.withContext(function($ctx1) {
  7876. return $self._collect_((function(each){
  7877. return $core.withContext(function($ctx2) {
  7878. return $recv(each)._deepCopy();
  7879. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7880. }));
  7881. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Collection)});
  7882. },
  7883. args: [],
  7884. source: "deepCopy\x0a\x09^ self collect: [ :each | each deepCopy ]",
  7885. referencedClasses: [],
  7886. messageSends: ["collect:", "deepCopy"]
  7887. }),
  7888. $globals.Collection);
  7889. $core.addMethod(
  7890. $core.method({
  7891. selector: "detect:",
  7892. protocol: "enumerating",
  7893. fn: function (aBlock){
  7894. var self=this,$self=this;
  7895. return $core.withContext(function($ctx1) {
  7896. return $self._detect_ifNone_(aBlock,(function(){
  7897. return $core.withContext(function($ctx2) {
  7898. return $self._errorNotFound();
  7899. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7900. }));
  7901. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},$globals.Collection)});
  7902. },
  7903. args: ["aBlock"],
  7904. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  7905. referencedClasses: [],
  7906. messageSends: ["detect:ifNone:", "errorNotFound"]
  7907. }),
  7908. $globals.Collection);
  7909. $core.addMethod(
  7910. $core.method({
  7911. selector: "detect:ifNone:",
  7912. protocol: "enumerating",
  7913. fn: function (aBlock,anotherBlock){
  7914. var self=this,$self=this;
  7915. return $core.withContext(function($ctx1) {
  7916. var $1;
  7917. var $early={};
  7918. try {
  7919. $self._do_((function(each){
  7920. return $core.withContext(function($ctx2) {
  7921. $1=$recv(aBlock)._value_(each);
  7922. if($core.assert($1)){
  7923. throw $early=[each];
  7924. }
  7925. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7926. }));
  7927. return $recv(anotherBlock)._value();
  7928. }
  7929. catch(e) {if(e===$early)return e[0]; throw e}
  7930. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  7931. },
  7932. args: ["aBlock", "anotherBlock"],
  7933. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  7934. referencedClasses: [],
  7935. messageSends: ["do:", "ifTrue:", "value:", "value"]
  7936. }),
  7937. $globals.Collection);
  7938. $core.addMethod(
  7939. $core.method({
  7940. selector: "do:",
  7941. protocol: "enumerating",
  7942. fn: function (aBlock){
  7943. var self=this,$self=this;
  7944. return $core.withContext(function($ctx1) {
  7945. $self._subclassResponsibility();
  7946. return self;
  7947. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Collection)});
  7948. },
  7949. args: ["aBlock"],
  7950. source: "do: aBlock\x0a\x09self subclassResponsibility",
  7951. referencedClasses: [],
  7952. messageSends: ["subclassResponsibility"]
  7953. }),
  7954. $globals.Collection);
  7955. $core.addMethod(
  7956. $core.method({
  7957. selector: "do:separatedBy:",
  7958. protocol: "enumerating",
  7959. fn: function (aBlock,anotherBlock){
  7960. var self=this,$self=this;
  7961. var actionBeforeElement;
  7962. return $core.withContext(function($ctx1) {
  7963. actionBeforeElement=(function(){
  7964. actionBeforeElement=anotherBlock;
  7965. return actionBeforeElement;
  7966. });
  7967. $self._do_((function(each){
  7968. return $core.withContext(function($ctx2) {
  7969. $recv(actionBeforeElement)._value();
  7970. return $recv(aBlock)._value_(each);
  7971. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  7972. }));
  7973. return self;
  7974. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},$globals.Collection)});
  7975. },
  7976. args: ["aBlock", "anotherBlock"],
  7977. source: "do: aBlock separatedBy: anotherBlock\x0a\x09| actionBeforeElement |\x0a\x09actionBeforeElement := [ actionBeforeElement := anotherBlock ].\x0a\x09self do: [ :each |\x0a\x09\x09actionBeforeElement value.\x0a\x09\x09aBlock value: each ]",
  7978. referencedClasses: [],
  7979. messageSends: ["do:", "value", "value:"]
  7980. }),
  7981. $globals.Collection);
  7982. $core.addMethod(
  7983. $core.method({
  7984. selector: "errorNotFound",
  7985. protocol: "error handling",
  7986. fn: function (){
  7987. var self=this,$self=this;
  7988. return $core.withContext(function($ctx1) {
  7989. $self._error_("Object is not in the collection");
  7990. return self;
  7991. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},$globals.Collection)});
  7992. },
  7993. args: [],
  7994. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  7995. referencedClasses: [],
  7996. messageSends: ["error:"]
  7997. }),
  7998. $globals.Collection);
  7999. $core.addMethod(
  8000. $core.method({
  8001. selector: "ifEmpty:",
  8002. protocol: "testing",
  8003. fn: function (aBlock){
  8004. var self=this,$self=this;
  8005. return $core.withContext(function($ctx1) {
  8006. var $1;
  8007. $1=$self._isEmpty();
  8008. if($core.assert($1)){
  8009. return $recv(aBlock)._value();
  8010. } else {
  8011. return self;
  8012. }
  8013. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},$globals.Collection)});
  8014. },
  8015. args: ["aBlock"],
  8016. source: "ifEmpty: aBlock\x0a\x09\x22Evaluate the given block with the receiver as argument, answering its value if the receiver is empty, otherwise answer the receiver. \x0a\x09Note that the fact that this method returns its argument in case the receiver is not empty allows one to write expressions like the following ones: \x0a\x09\x09self classifyMethodAs:\x0a\x09\x09\x09(myProtocol ifEmpty: ['As yet unclassified'])\x22\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ self ]",
  8017. referencedClasses: [],
  8018. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value"]
  8019. }),
  8020. $globals.Collection);
  8021. $core.addMethod(
  8022. $core.method({
  8023. selector: "ifEmpty:ifNotEmpty:",
  8024. protocol: "testing",
  8025. fn: function (aBlock,anotherBlock){
  8026. var self=this,$self=this;
  8027. return $core.withContext(function($ctx1) {
  8028. var $1;
  8029. $1=$self._isEmpty();
  8030. if($core.assert($1)){
  8031. return $recv(aBlock)._value();
  8032. } else {
  8033. return $recv(anotherBlock)._value_(self);
  8034. }
  8035. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  8036. },
  8037. args: ["aBlock", "anotherBlock"],
  8038. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  8039. referencedClasses: [],
  8040. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value", "value:"]
  8041. }),
  8042. $globals.Collection);
  8043. $core.addMethod(
  8044. $core.method({
  8045. selector: "ifNotEmpty:",
  8046. protocol: "testing",
  8047. fn: function (aBlock){
  8048. var self=this,$self=this;
  8049. return $core.withContext(function($ctx1) {
  8050. var $1;
  8051. $1=$self._notEmpty();
  8052. if($core.assert($1)){
  8053. return $recv(aBlock)._value_(self);
  8054. } else {
  8055. return self;
  8056. }
  8057. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},$globals.Collection)});
  8058. },
  8059. args: ["aBlock"],
  8060. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  8061. referencedClasses: [],
  8062. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  8063. }),
  8064. $globals.Collection);
  8065. $core.addMethod(
  8066. $core.method({
  8067. selector: "ifNotEmpty:ifEmpty:",
  8068. protocol: "testing",
  8069. fn: function (aBlock,anotherBlock){
  8070. var self=this,$self=this;
  8071. return $core.withContext(function($ctx1) {
  8072. var $1;
  8073. $1=$self._notEmpty();
  8074. if($core.assert($1)){
  8075. return $recv(aBlock)._value_(self);
  8076. } else {
  8077. return $recv(anotherBlock)._value();
  8078. }
  8079. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  8080. },
  8081. args: ["aBlock", "anotherBlock"],
  8082. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: \x22anotherBlock\x22 [ anotherBlock value ]",
  8083. referencedClasses: [],
  8084. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:", "value"]
  8085. }),
  8086. $globals.Collection);
  8087. $core.addMethod(
  8088. $core.method({
  8089. selector: "includes:",
  8090. protocol: "testing",
  8091. fn: function (anObject){
  8092. var self=this,$self=this;
  8093. return $core.withContext(function($ctx1) {
  8094. return $self._anySatisfy_((function(each){
  8095. return $core.withContext(function($ctx2) {
  8096. return $recv(each).__eq(anObject);
  8097. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8098. }));
  8099. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.Collection)});
  8100. },
  8101. args: ["anObject"],
  8102. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  8103. referencedClasses: [],
  8104. messageSends: ["anySatisfy:", "="]
  8105. }),
  8106. $globals.Collection);
  8107. $core.addMethod(
  8108. $core.method({
  8109. selector: "inject:into:",
  8110. protocol: "enumerating",
  8111. fn: function (anObject,aBlock){
  8112. var self=this,$self=this;
  8113. var result;
  8114. return $core.withContext(function($ctx1) {
  8115. result=anObject;
  8116. $self._do_((function(each){
  8117. return $core.withContext(function($ctx2) {
  8118. result=$recv(aBlock)._value_value_(result,each);
  8119. return result;
  8120. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8121. }));
  8122. return result;
  8123. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},$globals.Collection)});
  8124. },
  8125. args: ["anObject", "aBlock"],
  8126. source: "inject: anObject into: aBlock\x0a\x09| result |\x0a\x09result := anObject.\x0a\x09self do: [ :each |\x0a\x09\x09result := aBlock value: result value: each ].\x0a\x09^ result",
  8127. referencedClasses: [],
  8128. messageSends: ["do:", "value:value:"]
  8129. }),
  8130. $globals.Collection);
  8131. $core.addMethod(
  8132. $core.method({
  8133. selector: "intersection:",
  8134. protocol: "enumerating",
  8135. fn: function (aCollection){
  8136. var self=this,$self=this;
  8137. var set,outputSet;
  8138. return $core.withContext(function($ctx1) {
  8139. var $2,$1;
  8140. set=$self._asSet();
  8141. outputSet=$recv($globals.Set)._new();
  8142. $recv(aCollection)._do_((function(each){
  8143. return $core.withContext(function($ctx2) {
  8144. $2=$recv(set)._includes_(each);
  8145. $ctx2.sendIdx["includes:"]=1;
  8146. $1=$recv($2)._and_((function(){
  8147. return $core.withContext(function($ctx3) {
  8148. return $recv($recv(outputSet)._includes_(each))._not();
  8149. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  8150. }));
  8151. if($core.assert($1)){
  8152. return $recv(outputSet)._add_(each);
  8153. }
  8154. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8155. }));
  8156. return $recv($self._class())._withAll_($recv(outputSet)._asArray());
  8157. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},$globals.Collection)});
  8158. },
  8159. args: ["aCollection"],
  8160. source: "intersection: aCollection\x0a\x09\x22Answer the set theoretic intersection of two collections.\x22\x0a\x0a\x09| set outputSet |\x0a\x09\x0a\x09set := self asSet.\x0a\x09outputSet := Set new.\x0a\x09\x0a\x09aCollection do: [ :each |\x0a\x09\x09((set includes: each) and: [ (outputSet includes: each) not ])\x0a\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09outputSet add: each ]].\x0a\x09\x09\x0a\x09^ self class withAll: outputSet asArray",
  8161. referencedClasses: ["Set"],
  8162. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  8163. }),
  8164. $globals.Collection);
  8165. $core.addMethod(
  8166. $core.method({
  8167. selector: "isEmpty",
  8168. protocol: "testing",
  8169. fn: function (){
  8170. var self=this,$self=this;
  8171. return $core.withContext(function($ctx1) {
  8172. return $recv($self._size()).__eq((0));
  8173. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Collection)});
  8174. },
  8175. args: [],
  8176. source: "isEmpty\x0a\x09^ self size = 0",
  8177. referencedClasses: [],
  8178. messageSends: ["=", "size"]
  8179. }),
  8180. $globals.Collection);
  8181. $core.addMethod(
  8182. $core.method({
  8183. selector: "noneSatisfy:",
  8184. protocol: "enumerating",
  8185. fn: function (aBlock){
  8186. var self=this,$self=this;
  8187. return $core.withContext(function($ctx1) {
  8188. var $1;
  8189. var $early={};
  8190. try {
  8191. $self._do_((function(item){
  8192. return $core.withContext(function($ctx2) {
  8193. $1=$recv(aBlock)._value_(item);
  8194. if($core.assert($1)){
  8195. throw $early=[false];
  8196. }
  8197. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  8198. }));
  8199. return true;
  8200. }
  8201. catch(e) {if(e===$early)return e[0]; throw e}
  8202. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock},$globals.Collection)});
  8203. },
  8204. args: ["aBlock"],
  8205. source: "noneSatisfy: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns false for all elements return true.\x0a\x09Otherwise return false\x22\x0a\x0a\x09self do: [ :item | (aBlock value: item) ifTrue: [ ^ false ] ].\x0a\x09^ true",
  8206. referencedClasses: [],
  8207. messageSends: ["do:", "ifTrue:", "value:"]
  8208. }),
  8209. $globals.Collection);
  8210. $core.addMethod(
  8211. $core.method({
  8212. selector: "notEmpty",
  8213. protocol: "testing",
  8214. fn: function (){
  8215. var self=this,$self=this;
  8216. return $core.withContext(function($ctx1) {
  8217. return $recv($self._isEmpty())._not();
  8218. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},$globals.Collection)});
  8219. },
  8220. args: [],
  8221. source: "notEmpty\x0a\x09^ self isEmpty not",
  8222. referencedClasses: [],
  8223. messageSends: ["not", "isEmpty"]
  8224. }),
  8225. $globals.Collection);
  8226. $core.addMethod(
  8227. $core.method({
  8228. selector: "occurrencesOf:",
  8229. protocol: "accessing",
  8230. fn: function (anObject){
  8231. var self=this,$self=this;
  8232. var tally;
  8233. return $core.withContext(function($ctx1) {
  8234. var $1;
  8235. tally=(0);
  8236. $self._do_((function(each){
  8237. return $core.withContext(function($ctx2) {
  8238. $1=$recv(anObject).__eq(each);
  8239. if($core.assert($1)){
  8240. tally=$recv(tally).__plus((1));
  8241. return tally;
  8242. }
  8243. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8244. }));
  8245. return tally;
  8246. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},$globals.Collection)});
  8247. },
  8248. args: ["anObject"],
  8249. source: "occurrencesOf: anObject\x0a\x09\x22Answer how many of the receiver's elements are equal to anObject.\x22\x0a\x0a\x09| tally |\x0a\x09tally := 0.\x0a\x09self do: [ :each | anObject = each ifTrue: [ tally := tally + 1 ]].\x0a\x09^ tally",
  8250. referencedClasses: [],
  8251. messageSends: ["do:", "ifTrue:", "=", "+"]
  8252. }),
  8253. $globals.Collection);
  8254. $core.addMethod(
  8255. $core.method({
  8256. selector: "putOn:",
  8257. protocol: "streaming",
  8258. fn: function (aStream){
  8259. var self=this,$self=this;
  8260. return $core.withContext(function($ctx1) {
  8261. $self._do_((function(each){
  8262. return $core.withContext(function($ctx2) {
  8263. return $recv(each)._putOn_(aStream);
  8264. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8265. }));
  8266. return self;
  8267. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Collection)});
  8268. },
  8269. args: ["aStream"],
  8270. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  8271. referencedClasses: [],
  8272. messageSends: ["do:", "putOn:"]
  8273. }),
  8274. $globals.Collection);
  8275. $core.addMethod(
  8276. $core.method({
  8277. selector: "reject:",
  8278. protocol: "enumerating",
  8279. fn: function (aBlock){
  8280. var self=this,$self=this;
  8281. return $core.withContext(function($ctx1) {
  8282. return $self._select_((function(each){
  8283. return $core.withContext(function($ctx2) {
  8284. return $recv($recv(aBlock)._value_(each)).__eq(false);
  8285. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8286. }));
  8287. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},$globals.Collection)});
  8288. },
  8289. args: ["aBlock"],
  8290. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  8291. referencedClasses: [],
  8292. messageSends: ["select:", "=", "value:"]
  8293. }),
  8294. $globals.Collection);
  8295. $core.addMethod(
  8296. $core.method({
  8297. selector: "remove:",
  8298. protocol: "adding/removing",
  8299. fn: function (anObject){
  8300. var self=this,$self=this;
  8301. return $core.withContext(function($ctx1) {
  8302. return $self._remove_ifAbsent_(anObject,(function(){
  8303. return $core.withContext(function($ctx2) {
  8304. return $self._errorNotFound();
  8305. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8306. }));
  8307. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.Collection)});
  8308. },
  8309. args: ["anObject"],
  8310. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  8311. referencedClasses: [],
  8312. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  8313. }),
  8314. $globals.Collection);
  8315. $core.addMethod(
  8316. $core.method({
  8317. selector: "remove:ifAbsent:",
  8318. protocol: "adding/removing",
  8319. fn: function (anObject,aBlock){
  8320. var self=this,$self=this;
  8321. return $core.withContext(function($ctx1) {
  8322. $self._subclassResponsibility();
  8323. return self;
  8324. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.Collection)});
  8325. },
  8326. args: ["anObject", "aBlock"],
  8327. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  8328. referencedClasses: [],
  8329. messageSends: ["subclassResponsibility"]
  8330. }),
  8331. $globals.Collection);
  8332. $core.addMethod(
  8333. $core.method({
  8334. selector: "removeAll",
  8335. protocol: "adding/removing",
  8336. fn: function (){
  8337. var self=this,$self=this;
  8338. return $core.withContext(function($ctx1) {
  8339. $self._subclassResponsibility();
  8340. return self;
  8341. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Collection)});
  8342. },
  8343. args: [],
  8344. source: "removeAll\x0a\x09self subclassResponsibility",
  8345. referencedClasses: [],
  8346. messageSends: ["subclassResponsibility"]
  8347. }),
  8348. $globals.Collection);
  8349. $core.addMethod(
  8350. $core.method({
  8351. selector: "select:",
  8352. protocol: "enumerating",
  8353. fn: function (aBlock){
  8354. var self=this,$self=this;
  8355. var stream;
  8356. return $core.withContext(function($ctx1) {
  8357. var $1;
  8358. stream=$recv($recv($self._class())._new())._writeStream();
  8359. $self._do_((function(each){
  8360. return $core.withContext(function($ctx2) {
  8361. $1=$recv(aBlock)._value_(each);
  8362. if($core.assert($1)){
  8363. return $recv(stream)._nextPut_(each);
  8364. }
  8365. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8366. }));
  8367. return $recv(stream)._contents();
  8368. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  8369. },
  8370. args: ["aBlock"],
  8371. source: "select: aBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [ :each |\x0a\x09\x09(aBlock value: each) ifTrue: [\x0a\x09\x09stream nextPut: each ] ].\x0a\x09^ stream contents",
  8372. referencedClasses: [],
  8373. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  8374. }),
  8375. $globals.Collection);
  8376. $core.addMethod(
  8377. $core.method({
  8378. selector: "select:thenCollect:",
  8379. protocol: "enumerating",
  8380. fn: function (selectBlock,collectBlock){
  8381. var self=this,$self=this;
  8382. var stream;
  8383. return $core.withContext(function($ctx1) {
  8384. var $1;
  8385. stream=$recv($recv($self._class())._new())._writeStream();
  8386. $self._do_((function(each){
  8387. return $core.withContext(function($ctx2) {
  8388. $1=$recv(selectBlock)._value_(each);
  8389. $ctx2.sendIdx["value:"]=1;
  8390. if($core.assert($1)){
  8391. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  8392. }
  8393. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8394. }));
  8395. return $recv(stream)._contents();
  8396. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream},$globals.Collection)});
  8397. },
  8398. args: ["selectBlock", "collectBlock"],
  8399. source: "select: selectBlock thenCollect: collectBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [ :each |\x0a\x09\x09(selectBlock value: each) ifTrue: [\x0a\x09\x09stream nextPut: (collectBlock value: each) ] ].\x0a\x09^ stream contents",
  8400. referencedClasses: [],
  8401. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  8402. }),
  8403. $globals.Collection);
  8404. $core.addMethod(
  8405. $core.method({
  8406. selector: "shallowCopy",
  8407. protocol: "copying",
  8408. fn: function (){
  8409. var self=this,$self=this;
  8410. return $core.withContext(function($ctx1) {
  8411. return $self._collect_((function(each){
  8412. return each;
  8413. }));
  8414. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Collection)});
  8415. },
  8416. args: [],
  8417. source: "shallowCopy\x0a\x09^ self collect: [ :each | each ]",
  8418. referencedClasses: [],
  8419. messageSends: ["collect:"]
  8420. }),
  8421. $globals.Collection);
  8422. $core.addMethod(
  8423. $core.method({
  8424. selector: "single",
  8425. protocol: "accessing",
  8426. fn: function (){
  8427. var self=this,$self=this;
  8428. return $core.withContext(function($ctx1) {
  8429. var $1;
  8430. $self._ifEmpty_((function(){
  8431. return $core.withContext(function($ctx2) {
  8432. return $self._error_("Collection is empty");
  8433. $ctx2.sendIdx["error:"]=1;
  8434. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8435. }));
  8436. $1=$recv($self._size()).__gt((1));
  8437. if($core.assert($1)){
  8438. $self._error_("Collection holds more than one element");
  8439. }
  8440. return $self._anyOne();
  8441. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.Collection)});
  8442. },
  8443. args: [],
  8444. source: "single\x0a\x09\x22Answer a single element.\x0a\x09Raise an error if collection holds less or more than one element.\x22\x0a\x0a\x09self ifEmpty: [ self error: 'Collection is empty' ].\x0a\x09self size > 1 ifTrue: [ self error: 'Collection holds more than one element' ].\x0a\x09^ self anyOne",
  8445. referencedClasses: [],
  8446. messageSends: ["ifEmpty:", "error:", "ifTrue:", ">", "size", "anyOne"]
  8447. }),
  8448. $globals.Collection);
  8449. $core.addMethod(
  8450. $core.method({
  8451. selector: "size",
  8452. protocol: "accessing",
  8453. fn: function (){
  8454. var self=this,$self=this;
  8455. return $core.withContext(function($ctx1) {
  8456. $self._subclassResponsibility();
  8457. return self;
  8458. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Collection)});
  8459. },
  8460. args: [],
  8461. source: "size\x0a\x09self subclassResponsibility",
  8462. referencedClasses: [],
  8463. messageSends: ["subclassResponsibility"]
  8464. }),
  8465. $globals.Collection);
  8466. $core.addMethod(
  8467. $core.method({
  8468. selector: "classTag",
  8469. protocol: "accessing",
  8470. fn: function (){
  8471. var self=this,$self=this;
  8472. return "collection";
  8473. },
  8474. args: [],
  8475. source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'collection'",
  8476. referencedClasses: [],
  8477. messageSends: []
  8478. }),
  8479. $globals.Collection.a$cls);
  8480. $core.addMethod(
  8481. $core.method({
  8482. selector: "new:",
  8483. protocol: "instance creation",
  8484. fn: function (anInteger){
  8485. var self=this,$self=this;
  8486. return $core.withContext(function($ctx1) {
  8487. return $self._new();
  8488. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Collection.a$cls)});
  8489. },
  8490. args: ["anInteger"],
  8491. source: "new: anInteger\x0a\x09^ self new",
  8492. referencedClasses: [],
  8493. messageSends: ["new"]
  8494. }),
  8495. $globals.Collection.a$cls);
  8496. $core.addMethod(
  8497. $core.method({
  8498. selector: "with:",
  8499. protocol: "instance creation",
  8500. fn: function (anObject){
  8501. var self=this,$self=this;
  8502. return $core.withContext(function($ctx1) {
  8503. var $1;
  8504. $1=$self._new();
  8505. $recv($1)._add_(anObject);
  8506. return $recv($1)._yourself();
  8507. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Collection.a$cls)});
  8508. },
  8509. args: ["anObject"],
  8510. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  8511. referencedClasses: [],
  8512. messageSends: ["add:", "new", "yourself"]
  8513. }),
  8514. $globals.Collection.a$cls);
  8515. $core.addMethod(
  8516. $core.method({
  8517. selector: "with:with:",
  8518. protocol: "instance creation",
  8519. fn: function (anObject,anotherObject){
  8520. var self=this,$self=this;
  8521. return $core.withContext(function($ctx1) {
  8522. var $1;
  8523. $1=$self._new();
  8524. $recv($1)._add_(anObject);
  8525. $ctx1.sendIdx["add:"]=1;
  8526. $recv($1)._add_(anotherObject);
  8527. return $recv($1)._yourself();
  8528. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},$globals.Collection.a$cls)});
  8529. },
  8530. args: ["anObject", "anotherObject"],
  8531. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  8532. referencedClasses: [],
  8533. messageSends: ["add:", "new", "yourself"]
  8534. }),
  8535. $globals.Collection.a$cls);
  8536. $core.addMethod(
  8537. $core.method({
  8538. selector: "with:with:with:",
  8539. protocol: "instance creation",
  8540. fn: function (firstObject,secondObject,thirdObject){
  8541. var self=this,$self=this;
  8542. return $core.withContext(function($ctx1) {
  8543. var $1;
  8544. $1=$self._new();
  8545. $recv($1)._add_(firstObject);
  8546. $ctx1.sendIdx["add:"]=1;
  8547. $recv($1)._add_(secondObject);
  8548. $ctx1.sendIdx["add:"]=2;
  8549. $recv($1)._add_(thirdObject);
  8550. return $recv($1)._yourself();
  8551. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},$globals.Collection.a$cls)});
  8552. },
  8553. args: ["firstObject", "secondObject", "thirdObject"],
  8554. source: "with: firstObject with: secondObject with: thirdObject\x0a\x09\x09^ self new\x0a\x09\x09add: firstObject;\x0a\x09\x09add: secondObject;\x0a\x09\x09add: thirdObject;\x0a\x09\x09yourself",
  8555. referencedClasses: [],
  8556. messageSends: ["add:", "new", "yourself"]
  8557. }),
  8558. $globals.Collection.a$cls);
  8559. $core.addMethod(
  8560. $core.method({
  8561. selector: "withAll:",
  8562. protocol: "instance creation",
  8563. fn: function (aCollection){
  8564. var self=this,$self=this;
  8565. return $core.withContext(function($ctx1) {
  8566. var $1;
  8567. $1=$self._new();
  8568. $recv($1)._addAll_(aCollection);
  8569. return $recv($1)._yourself();
  8570. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},$globals.Collection.a$cls)});
  8571. },
  8572. args: ["aCollection"],
  8573. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  8574. referencedClasses: [],
  8575. messageSends: ["addAll:", "new", "yourself"]
  8576. }),
  8577. $globals.Collection.a$cls);
  8578. $core.addClass("AssociativeCollection", $globals.Collection, [], "Kernel-Collections");
  8579. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  8580. $core.addMethod(
  8581. $core.method({
  8582. selector: "=",
  8583. protocol: "comparing",
  8584. fn: function (anAssocitativeCollection){
  8585. var self=this,$self=this;
  8586. return $core.withContext(function($ctx1) {
  8587. var $2,$1,$4,$3,$5;
  8588. $2=$self._class();
  8589. $ctx1.sendIdx["class"]=1;
  8590. $1=$recv($2).__eq($recv(anAssocitativeCollection)._class());
  8591. $ctx1.sendIdx["="]=1;
  8592. if(!$core.assert($1)){
  8593. return false;
  8594. }
  8595. $4=$self._size();
  8596. $ctx1.sendIdx["size"]=1;
  8597. $3=$recv($4).__eq($recv(anAssocitativeCollection)._size());
  8598. $ctx1.sendIdx["="]=2;
  8599. if(!$core.assert($3)){
  8600. return false;
  8601. }
  8602. $5=$self._associations();
  8603. $ctx1.sendIdx["associations"]=1;
  8604. return $recv($5).__eq($recv(anAssocitativeCollection)._associations());
  8605. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection},$globals.AssociativeCollection)});
  8606. },
  8607. args: ["anAssocitativeCollection"],
  8608. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  8609. referencedClasses: [],
  8610. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  8611. }),
  8612. $globals.AssociativeCollection);
  8613. $core.addMethod(
  8614. $core.method({
  8615. selector: "add:",
  8616. protocol: "adding/removing",
  8617. fn: function (anAssociation){
  8618. var self=this,$self=this;
  8619. return $core.withContext(function($ctx1) {
  8620. $self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  8621. return self;
  8622. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},$globals.AssociativeCollection)});
  8623. },
  8624. args: ["anAssociation"],
  8625. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  8626. referencedClasses: [],
  8627. messageSends: ["at:put:", "key", "value"]
  8628. }),
  8629. $globals.AssociativeCollection);
  8630. $core.addMethod(
  8631. $core.method({
  8632. selector: "addAll:",
  8633. protocol: "adding/removing",
  8634. fn: function (anAssociativeCollection){
  8635. var self=this,$self=this;
  8636. return $core.withContext(function($ctx1) {
  8637. (
  8638. $ctx1.supercall = true,
  8639. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._addAll_.apply($self, [$recv(anAssociativeCollection)._associations()]));
  8640. $ctx1.supercall = false;
  8641. return anAssociativeCollection;
  8642. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection},$globals.AssociativeCollection)});
  8643. },
  8644. args: ["anAssociativeCollection"],
  8645. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  8646. referencedClasses: [],
  8647. messageSends: ["addAll:", "associations"]
  8648. }),
  8649. $globals.AssociativeCollection);
  8650. $core.addMethod(
  8651. $core.method({
  8652. selector: "asDictionary",
  8653. protocol: "converting",
  8654. fn: function (){
  8655. var self=this,$self=this;
  8656. return $core.withContext(function($ctx1) {
  8657. return $recv($globals.Dictionary)._from_($self._associations());
  8658. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},$globals.AssociativeCollection)});
  8659. },
  8660. args: [],
  8661. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  8662. referencedClasses: ["Dictionary"],
  8663. messageSends: ["from:", "associations"]
  8664. }),
  8665. $globals.AssociativeCollection);
  8666. $core.addMethod(
  8667. $core.method({
  8668. selector: "asHashedCollection",
  8669. protocol: "converting",
  8670. fn: function (){
  8671. var self=this,$self=this;
  8672. return $core.withContext(function($ctx1) {
  8673. return $recv($globals.HashedCollection)._from_($self._associations());
  8674. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},$globals.AssociativeCollection)});
  8675. },
  8676. args: [],
  8677. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  8678. referencedClasses: ["HashedCollection"],
  8679. messageSends: ["from:", "associations"]
  8680. }),
  8681. $globals.AssociativeCollection);
  8682. $core.addMethod(
  8683. $core.method({
  8684. selector: "asJavaScriptObject",
  8685. protocol: "converting",
  8686. fn: function (){
  8687. var self=this,$self=this;
  8688. var hash;
  8689. return $core.withContext(function($ctx1) {
  8690. hash=$recv($globals.HashedCollection)._new();
  8691. $self._keysAndValuesDo_((function(key,value){
  8692. return $core.withContext(function($ctx2) {
  8693. return $recv(hash)._at_put_(key,$recv(value)._asJavaScriptObject());
  8694. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8695. }));
  8696. return hash;
  8697. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{hash:hash},$globals.AssociativeCollection)});
  8698. },
  8699. args: [],
  8700. source: "asJavaScriptObject\x0a\x09| hash |\x0a\x09hash := HashedCollection new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09hash at: key put: value asJavaScriptObject ].\x0a\x09^ hash",
  8701. referencedClasses: ["HashedCollection"],
  8702. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJavaScriptObject"]
  8703. }),
  8704. $globals.AssociativeCollection);
  8705. $core.addMethod(
  8706. $core.method({
  8707. selector: "associations",
  8708. protocol: "accessing",
  8709. fn: function (){
  8710. var self=this,$self=this;
  8711. var associations;
  8712. return $core.withContext(function($ctx1) {
  8713. associations=[];
  8714. $self._associationsDo_((function(each){
  8715. return $core.withContext(function($ctx2) {
  8716. return $recv(associations)._add_(each);
  8717. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8718. }));
  8719. return associations;
  8720. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},$globals.AssociativeCollection)});
  8721. },
  8722. args: [],
  8723. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  8724. referencedClasses: [],
  8725. messageSends: ["associationsDo:", "add:"]
  8726. }),
  8727. $globals.AssociativeCollection);
  8728. $core.addMethod(
  8729. $core.method({
  8730. selector: "associationsDo:",
  8731. protocol: "enumerating",
  8732. fn: function (aBlock){
  8733. var self=this,$self=this;
  8734. return $core.withContext(function($ctx1) {
  8735. $self._keysAndValuesDo_((function(key,value){
  8736. return $core.withContext(function($ctx2) {
  8737. return $recv(aBlock)._value_($recv($globals.Association)._key_value_(key,value));
  8738. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8739. }));
  8740. return self;
  8741. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  8742. },
  8743. args: ["aBlock"],
  8744. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  8745. referencedClasses: ["Association"],
  8746. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  8747. }),
  8748. $globals.AssociativeCollection);
  8749. $core.addMethod(
  8750. $core.method({
  8751. selector: "at:ifPresent:ifAbsent:",
  8752. protocol: "accessing",
  8753. fn: function (aKey,aBlock,anotherBlock){
  8754. var self=this,$self=this;
  8755. return $core.withContext(function($ctx1) {
  8756. var $1;
  8757. $1=$self._includesKey_(aKey);
  8758. if($core.assert($1)){
  8759. return $recv(aBlock)._value_($self._at_(aKey));
  8760. } else {
  8761. return $recv(anotherBlock)._value();
  8762. }
  8763. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  8764. },
  8765. args: ["aKey", "aBlock", "anotherBlock"],
  8766. source: "at: aKey ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09\x22Lookup the given key in the receiver.\x0a\x09If it is present, answer the value of evaluating the oneArgBlock \x0a\x09with the value associated with the key, otherwise answer the value \x0a\x09of absentBlock.\x22\x0a\x09\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ aBlock value: (self at: aKey) ]\x0a\x09\x09ifFalse: [ anotherBlock value ]",
  8767. referencedClasses: [],
  8768. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  8769. }),
  8770. $globals.AssociativeCollection);
  8771. $core.addMethod(
  8772. $core.method({
  8773. selector: "collect:",
  8774. protocol: "enumerating",
  8775. fn: function (aBlock){
  8776. var self=this,$self=this;
  8777. var newDict;
  8778. return $core.withContext(function($ctx1) {
  8779. newDict=$recv($self._class())._new();
  8780. $self._keysAndValuesDo_((function(key,value){
  8781. return $core.withContext(function($ctx2) {
  8782. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  8783. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8784. }));
  8785. return newDict;
  8786. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  8787. },
  8788. args: ["aBlock"],
  8789. source: "collect: aBlock\x0a\x09| newDict |\x0a\x09newDict := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09newDict at: key put: (aBlock value: value) ].\x0a\x09^ newDict",
  8790. referencedClasses: [],
  8791. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  8792. }),
  8793. $globals.AssociativeCollection);
  8794. $core.addMethod(
  8795. $core.method({
  8796. selector: "deepCopy",
  8797. protocol: "copying",
  8798. fn: function (){
  8799. var self=this,$self=this;
  8800. var copy;
  8801. return $core.withContext(function($ctx1) {
  8802. copy=$recv($self._class())._new();
  8803. $self._keysAndValuesDo_((function(key,value){
  8804. return $core.withContext(function($ctx2) {
  8805. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  8806. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8807. }));
  8808. return copy;
  8809. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},$globals.AssociativeCollection)});
  8810. },
  8811. args: [],
  8812. source: "deepCopy\x0a\x09| copy |\x0a\x09copy := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09copy at: key put: value deepCopy ].\x0a\x09^ copy",
  8813. referencedClasses: [],
  8814. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  8815. }),
  8816. $globals.AssociativeCollection);
  8817. $core.addMethod(
  8818. $core.method({
  8819. selector: "detect:ifNone:",
  8820. protocol: "enumerating",
  8821. fn: function (aBlock,anotherBlock){
  8822. var self=this,$self=this;
  8823. return $core.withContext(function($ctx1) {
  8824. return $recv($self._values())._detect_ifNone_(aBlock,anotherBlock);
  8825. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  8826. },
  8827. args: ["aBlock", "anotherBlock"],
  8828. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  8829. referencedClasses: [],
  8830. messageSends: ["detect:ifNone:", "values"]
  8831. }),
  8832. $globals.AssociativeCollection);
  8833. $core.addMethod(
  8834. $core.method({
  8835. selector: "do:",
  8836. protocol: "enumerating",
  8837. fn: function (aBlock){
  8838. var self=this,$self=this;
  8839. return $core.withContext(function($ctx1) {
  8840. $self._valuesDo_(aBlock);
  8841. return self;
  8842. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.AssociativeCollection)});
  8843. },
  8844. args: ["aBlock"],
  8845. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  8846. referencedClasses: [],
  8847. messageSends: ["valuesDo:"]
  8848. }),
  8849. $globals.AssociativeCollection);
  8850. $core.addMethod(
  8851. $core.method({
  8852. selector: "includes:",
  8853. protocol: "enumerating",
  8854. fn: function (anObject){
  8855. var self=this,$self=this;
  8856. return $core.withContext(function($ctx1) {
  8857. return $recv($self._values())._includes_(anObject);
  8858. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.AssociativeCollection)});
  8859. },
  8860. args: ["anObject"],
  8861. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  8862. referencedClasses: [],
  8863. messageSends: ["includes:", "values"]
  8864. }),
  8865. $globals.AssociativeCollection);
  8866. $core.addMethod(
  8867. $core.method({
  8868. selector: "includesKey:",
  8869. protocol: "testing",
  8870. fn: function (aKey){
  8871. var self=this,$self=this;
  8872. return $core.withContext(function($ctx1) {
  8873. $self._subclassResponsibility();
  8874. return self;
  8875. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.AssociativeCollection)});
  8876. },
  8877. args: ["aKey"],
  8878. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  8879. referencedClasses: [],
  8880. messageSends: ["subclassResponsibility"]
  8881. }),
  8882. $globals.AssociativeCollection);
  8883. $core.addMethod(
  8884. $core.method({
  8885. selector: "indexOf:ifAbsent:",
  8886. protocol: "accessing",
  8887. fn: function (anObject,aBlock){
  8888. var self=this,$self=this;
  8889. return $core.withContext(function($ctx1) {
  8890. return $recv($self._keys())._detect_ifNone_((function(each){
  8891. return $core.withContext(function($ctx2) {
  8892. return $recv($self._at_(each)).__eq(anObject);
  8893. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8894. }),aBlock);
  8895. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  8896. },
  8897. args: ["anObject", "aBlock"],
  8898. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  8899. referencedClasses: [],
  8900. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  8901. }),
  8902. $globals.AssociativeCollection);
  8903. $core.addMethod(
  8904. $core.method({
  8905. selector: "keyAtValue:",
  8906. protocol: "accessing",
  8907. fn: function (anObject){
  8908. var self=this,$self=this;
  8909. return $core.withContext(function($ctx1) {
  8910. return $self._keyAtValue_ifAbsent_(anObject,(function(){
  8911. return $core.withContext(function($ctx2) {
  8912. return $self._errorNotFound();
  8913. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8914. }));
  8915. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject},$globals.AssociativeCollection)});
  8916. },
  8917. args: ["anObject"],
  8918. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  8919. referencedClasses: [],
  8920. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  8921. }),
  8922. $globals.AssociativeCollection);
  8923. $core.addMethod(
  8924. $core.method({
  8925. selector: "keyAtValue:ifAbsent:",
  8926. protocol: "accessing",
  8927. fn: function (anObject,aBlock){
  8928. var self=this,$self=this;
  8929. return $core.withContext(function($ctx1) {
  8930. return $self._indexOf_ifAbsent_(anObject,aBlock);
  8931. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  8932. },
  8933. args: ["anObject", "aBlock"],
  8934. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  8935. referencedClasses: [],
  8936. messageSends: ["indexOf:ifAbsent:"]
  8937. }),
  8938. $globals.AssociativeCollection);
  8939. $core.addMethod(
  8940. $core.method({
  8941. selector: "keys",
  8942. protocol: "accessing",
  8943. fn: function (){
  8944. var self=this,$self=this;
  8945. return $core.withContext(function($ctx1) {
  8946. $self._subclassResponsibility();
  8947. return self;
  8948. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.AssociativeCollection)});
  8949. },
  8950. args: [],
  8951. source: "keys\x0a\x09self subclassResponsibility",
  8952. referencedClasses: [],
  8953. messageSends: ["subclassResponsibility"]
  8954. }),
  8955. $globals.AssociativeCollection);
  8956. $core.addMethod(
  8957. $core.method({
  8958. selector: "keysAndValuesDo:",
  8959. protocol: "enumerating",
  8960. fn: function (aBlock){
  8961. var self=this,$self=this;
  8962. return $core.withContext(function($ctx1) {
  8963. $self._keysDo_((function(each){
  8964. return $core.withContext(function($ctx2) {
  8965. return $recv(aBlock)._value_value_(each,$self._at_(each));
  8966. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8967. }));
  8968. return self;
  8969. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  8970. },
  8971. args: ["aBlock"],
  8972. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  8973. referencedClasses: [],
  8974. messageSends: ["keysDo:", "value:value:", "at:"]
  8975. }),
  8976. $globals.AssociativeCollection);
  8977. $core.addMethod(
  8978. $core.method({
  8979. selector: "keysDo:",
  8980. protocol: "enumerating",
  8981. fn: function (aBlock){
  8982. var self=this,$self=this;
  8983. return $core.withContext(function($ctx1) {
  8984. $self._subclassResponsibility();
  8985. return self;
  8986. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  8987. },
  8988. args: ["aBlock"],
  8989. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  8990. referencedClasses: [],
  8991. messageSends: ["subclassResponsibility"]
  8992. }),
  8993. $globals.AssociativeCollection);
  8994. $core.addMethod(
  8995. $core.method({
  8996. selector: "printOn:",
  8997. protocol: "printing",
  8998. fn: function (aStream){
  8999. var self=this,$self=this;
  9000. return $core.withContext(function($ctx1) {
  9001. (
  9002. $ctx1.supercall = true,
  9003. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  9004. $ctx1.supercall = false;
  9005. $ctx1.sendIdx["printOn:"]=1;
  9006. $recv(aStream)._nextPutAll_(" (");
  9007. $ctx1.sendIdx["nextPutAll:"]=1;
  9008. $recv($self._associations())._do_separatedBy_((function(each){
  9009. return $core.withContext(function($ctx2) {
  9010. return $recv(each)._printOn_(aStream);
  9011. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9012. }),(function(){
  9013. return $core.withContext(function($ctx2) {
  9014. return $recv(aStream)._nextPutAll_(" , ");
  9015. $ctx2.sendIdx["nextPutAll:"]=2;
  9016. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  9017. }));
  9018. $recv(aStream)._nextPutAll_(")");
  9019. return self;
  9020. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AssociativeCollection)});
  9021. },
  9022. args: ["aStream"],
  9023. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: ' ('.\x0a\x09self associations\x0a\x09\x09do: [ :each | each printOn: aStream ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ' , ' ].\x0a\x09aStream nextPutAll: ')'",
  9024. referencedClasses: [],
  9025. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  9026. }),
  9027. $globals.AssociativeCollection);
  9028. $core.addMethod(
  9029. $core.method({
  9030. selector: "remove:ifAbsent:",
  9031. protocol: "adding/removing",
  9032. fn: function (aKey,aBlock){
  9033. var self=this,$self=this;
  9034. return $core.withContext(function($ctx1) {
  9035. return $self._removeKey_ifAbsent_(aKey,aBlock);
  9036. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  9037. },
  9038. args: ["aKey", "aBlock"],
  9039. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  9040. referencedClasses: [],
  9041. messageSends: ["removeKey:ifAbsent:"]
  9042. }),
  9043. $globals.AssociativeCollection);
  9044. $core.addMethod(
  9045. $core.method({
  9046. selector: "removeAll",
  9047. protocol: "adding/removing",
  9048. fn: function (){
  9049. var self=this,$self=this;
  9050. return $core.withContext(function($ctx1) {
  9051. return $recv($self._keys())._do_((function(each){
  9052. return $core.withContext(function($ctx2) {
  9053. return $self._removeKey_(each);
  9054. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9055. }));
  9056. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.AssociativeCollection)});
  9057. },
  9058. args: [],
  9059. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  9060. referencedClasses: [],
  9061. messageSends: ["do:", "keys", "removeKey:"]
  9062. }),
  9063. $globals.AssociativeCollection);
  9064. $core.addMethod(
  9065. $core.method({
  9066. selector: "removeKey:",
  9067. protocol: "adding/removing",
  9068. fn: function (aKey){
  9069. var self=this,$self=this;
  9070. return $core.withContext(function($ctx1) {
  9071. return $self._remove_(aKey);
  9072. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},$globals.AssociativeCollection)});
  9073. },
  9074. args: ["aKey"],
  9075. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  9076. referencedClasses: [],
  9077. messageSends: ["remove:"]
  9078. }),
  9079. $globals.AssociativeCollection);
  9080. $core.addMethod(
  9081. $core.method({
  9082. selector: "removeKey:ifAbsent:",
  9083. protocol: "adding/removing",
  9084. fn: function (aKey,aBlock){
  9085. var self=this,$self=this;
  9086. return $core.withContext(function($ctx1) {
  9087. $self._subclassResponsibility();
  9088. return self;
  9089. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  9090. },
  9091. args: ["aKey", "aBlock"],
  9092. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  9093. referencedClasses: [],
  9094. messageSends: ["subclassResponsibility"]
  9095. }),
  9096. $globals.AssociativeCollection);
  9097. $core.addMethod(
  9098. $core.method({
  9099. selector: "select:",
  9100. protocol: "enumerating",
  9101. fn: function (aBlock){
  9102. var self=this,$self=this;
  9103. var newDict;
  9104. return $core.withContext(function($ctx1) {
  9105. var $1;
  9106. newDict=$recv($self._class())._new();
  9107. $self._keysAndValuesDo_((function(key,value){
  9108. return $core.withContext(function($ctx2) {
  9109. $1=$recv(aBlock)._value_(value);
  9110. if($core.assert($1)){
  9111. return $recv(newDict)._at_put_(key,value);
  9112. }
  9113. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9114. }));
  9115. return newDict;
  9116. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  9117. },
  9118. args: ["aBlock"],
  9119. source: "select: aBlock\x0a\x09| newDict |\x0a\x09newDict := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09(aBlock value: value) ifTrue: [ newDict at: key put: value ]].\x0a\x09^ newDict",
  9120. referencedClasses: [],
  9121. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  9122. }),
  9123. $globals.AssociativeCollection);
  9124. $core.addMethod(
  9125. $core.method({
  9126. selector: "select:thenCollect:",
  9127. protocol: "enumerating",
  9128. fn: function (selectBlock,collectBlock){
  9129. var self=this,$self=this;
  9130. var newDict;
  9131. return $core.withContext(function($ctx1) {
  9132. var $1;
  9133. newDict=$recv($self._class())._new();
  9134. $self._keysAndValuesDo_((function(key,value){
  9135. return $core.withContext(function($ctx2) {
  9136. $1=$recv(selectBlock)._value_(value);
  9137. $ctx2.sendIdx["value:"]=1;
  9138. if($core.assert($1)){
  9139. return $recv(newDict)._at_put_(key,$recv(collectBlock)._value_(value));
  9140. }
  9141. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9142. }));
  9143. return newDict;
  9144. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,newDict:newDict},$globals.AssociativeCollection)});
  9145. },
  9146. args: ["selectBlock", "collectBlock"],
  9147. source: "select: selectBlock thenCollect: collectBlock\x0a\x09| newDict |\x0a\x09newDict := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09(selectBlock value: value) ifTrue: [ newDict at: key put: (collectBlock value: value) ]].\x0a\x09^ newDict",
  9148. referencedClasses: [],
  9149. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  9150. }),
  9151. $globals.AssociativeCollection);
  9152. $core.addMethod(
  9153. $core.method({
  9154. selector: "shallowCopy",
  9155. protocol: "copying",
  9156. fn: function (){
  9157. var self=this,$self=this;
  9158. var copy;
  9159. return $core.withContext(function($ctx1) {
  9160. copy=$recv($self._class())._new();
  9161. $self._keysAndValuesDo_((function(key,value){
  9162. return $core.withContext(function($ctx2) {
  9163. return $recv(copy)._at_put_(key,value);
  9164. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9165. }));
  9166. return copy;
  9167. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},$globals.AssociativeCollection)});
  9168. },
  9169. args: [],
  9170. source: "shallowCopy\x0a\x09| copy |\x0a\x09copy := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09copy at: key put: value ].\x0a\x09^ copy",
  9171. referencedClasses: [],
  9172. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  9173. }),
  9174. $globals.AssociativeCollection);
  9175. $core.addMethod(
  9176. $core.method({
  9177. selector: "size",
  9178. protocol: "accessing",
  9179. fn: function (){
  9180. var self=this,$self=this;
  9181. return $core.withContext(function($ctx1) {
  9182. return $recv($self._keys())._size();
  9183. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.AssociativeCollection)});
  9184. },
  9185. args: [],
  9186. source: "size\x0a\x09^ self keys size",
  9187. referencedClasses: [],
  9188. messageSends: ["size", "keys"]
  9189. }),
  9190. $globals.AssociativeCollection);
  9191. $core.addMethod(
  9192. $core.method({
  9193. selector: "values",
  9194. protocol: "accessing",
  9195. fn: function (){
  9196. var self=this,$self=this;
  9197. return $core.withContext(function($ctx1) {
  9198. $self._subclassResponsibility();
  9199. return self;
  9200. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.AssociativeCollection)});
  9201. },
  9202. args: [],
  9203. source: "values\x0a\x09self subclassResponsibility",
  9204. referencedClasses: [],
  9205. messageSends: ["subclassResponsibility"]
  9206. }),
  9207. $globals.AssociativeCollection);
  9208. $core.addMethod(
  9209. $core.method({
  9210. selector: "valuesDo:",
  9211. protocol: "enumerating",
  9212. fn: function (aBlock){
  9213. var self=this,$self=this;
  9214. return $core.withContext(function($ctx1) {
  9215. $self._subclassResponsibility();
  9216. return self;
  9217. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  9218. },
  9219. args: ["aBlock"],
  9220. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  9221. referencedClasses: [],
  9222. messageSends: ["subclassResponsibility"]
  9223. }),
  9224. $globals.AssociativeCollection);
  9225. $core.addMethod(
  9226. $core.method({
  9227. selector: "withIndexDo:",
  9228. protocol: "enumerating",
  9229. fn: function (aBlock){
  9230. var self=this,$self=this;
  9231. return $core.withContext(function($ctx1) {
  9232. $self._keysAndValuesDo_((function(key,value){
  9233. return $core.withContext(function($ctx2) {
  9234. return $recv(aBlock)._value_value_(value,key);
  9235. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9236. }));
  9237. return self;
  9238. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  9239. },
  9240. args: ["aBlock"],
  9241. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  9242. referencedClasses: [],
  9243. messageSends: ["keysAndValuesDo:", "value:value:"]
  9244. }),
  9245. $globals.AssociativeCollection);
  9246. $core.addMethod(
  9247. $core.method({
  9248. selector: "from:",
  9249. protocol: "instance creation",
  9250. fn: function (aCollection){
  9251. var self=this,$self=this;
  9252. var newCollection;
  9253. return $core.withContext(function($ctx1) {
  9254. newCollection=$self._new();
  9255. $recv(aCollection)._do_((function(each){
  9256. return $core.withContext(function($ctx2) {
  9257. return $recv(newCollection)._add_(each);
  9258. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9259. }));
  9260. return newCollection;
  9261. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.a$cls)});
  9262. },
  9263. args: ["aCollection"],
  9264. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  9265. referencedClasses: [],
  9266. messageSends: ["new", "do:", "add:"]
  9267. }),
  9268. $globals.AssociativeCollection.a$cls);
  9269. $core.addMethod(
  9270. $core.method({
  9271. selector: "fromPairs:",
  9272. protocol: "instance creation",
  9273. fn: function (aCollection){
  9274. var self=this,$self=this;
  9275. return $core.withContext(function($ctx1) {
  9276. return $self._from_(aCollection);
  9277. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},$globals.AssociativeCollection.a$cls)});
  9278. },
  9279. args: ["aCollection"],
  9280. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  9281. referencedClasses: [],
  9282. messageSends: ["from:"]
  9283. }),
  9284. $globals.AssociativeCollection.a$cls);
  9285. $core.addMethod(
  9286. $core.method({
  9287. selector: "newFromPairs:",
  9288. protocol: "instance creation",
  9289. fn: function (aCollection){
  9290. var self=this,$self=this;
  9291. var newCollection;
  9292. return $core.withContext(function($ctx1) {
  9293. var $2,$1,$3,$4;
  9294. $2=$recv(aCollection)._size();
  9295. $ctx1.sendIdx["size"]=1;
  9296. $1=$recv($2)._even();
  9297. if(!$core.assert($1)){
  9298. $self._error_("#newFromPairs only accepts arrays of an even length");
  9299. }
  9300. newCollection=$self._new();
  9301. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  9302. return $core.withContext(function($ctx2) {
  9303. $3=newCollection;
  9304. $4=$recv(aCollection)._at_(each);
  9305. $ctx2.sendIdx["at:"]=1;
  9306. return $recv($3)._at_put_($4,$recv(aCollection)._at_($recv(each).__plus((1))));
  9307. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  9308. }));
  9309. return newCollection;
  9310. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.a$cls)});
  9311. },
  9312. args: ["aCollection"],
  9313. source: "newFromPairs: aCollection\x0a\x09\x22Accept an array of elements where every two elements form an \x0a\x09association - the odd element being the key, and the even element the value.\x22\x0a\x09\x0a\x09| newCollection |\x0a\x09\x0a\x09aCollection size even ifFalse: [ \x0a\x09\x09self error: '#newFromPairs only accepts arrays of an even length' ].\x0a\x09\x09\x0a\x09newCollection := self new.\x0a\x09( 1 to: aCollection size by: 2 ) do: [ :each | \x0a\x09\x09newCollection at: (aCollection at: each) put: (aCollection at: each + 1) ].\x0a\x09\x09\x0a\x09^ newCollection",
  9314. referencedClasses: [],
  9315. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  9316. }),
  9317. $globals.AssociativeCollection.a$cls);
  9318. $core.addClass("Dictionary", $globals.AssociativeCollection, ["keys", "values"], "Kernel-Collections");
  9319. $globals.Dictionary.comment="I represent a set of elements that can be viewed from one of two perspectives: a set of associations,\x0aor a container of values that are externally named where the name can be any object that responds to `=`.\x0a\x0aThe external name is referred to as the key.";
  9320. $core.addMethod(
  9321. $core.method({
  9322. selector: "at:ifAbsent:",
  9323. protocol: "accessing",
  9324. fn: function (aKey,aBlock){
  9325. var self=this,$self=this;
  9326. return $core.withContext(function($ctx1) {
  9327. var index = $self._positionOfKey_(aKey);
  9328. return index >=0 ? $self['@values'][index] : aBlock._value();
  9329. ;
  9330. return self;
  9331. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  9332. },
  9333. args: ["aKey", "aBlock"],
  9334. source: "at: aKey ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var index = $self._positionOfKey_(aKey);\x0a\x09\x09return index >=0 ? $self[''@values''][index] : aBlock._value();\x0a\x09'>",
  9335. referencedClasses: [],
  9336. messageSends: []
  9337. }),
  9338. $globals.Dictionary);
  9339. $core.addMethod(
  9340. $core.method({
  9341. selector: "at:put:",
  9342. protocol: "accessing",
  9343. fn: function (aKey,aValue){
  9344. var self=this,$self=this;
  9345. return $core.withContext(function($ctx1) {
  9346. var index = $self._positionOfKey_(aKey);
  9347. if(index === -1) {
  9348. var keys = $self['@keys'];
  9349. index = keys.length;
  9350. keys.push(aKey);
  9351. }
  9352. return $self['@values'][index] = aValue;
  9353. ;
  9354. return self;
  9355. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.Dictionary)});
  9356. },
  9357. args: ["aKey", "aValue"],
  9358. source: "at: aKey put: aValue\x0a\x09<inlineJS: '\x0a\x09\x09var index = $self._positionOfKey_(aKey);\x0a\x09\x09if(index === -1) {\x0a\x09\x09\x09var keys = $self[''@keys''];\x0a\x09\x09\x09index = keys.length;\x0a\x09\x09\x09keys.push(aKey);\x0a\x09\x09}\x0a\x0a\x09\x09return $self[''@values''][index] = aValue;\x0a\x09'>",
  9359. referencedClasses: [],
  9360. messageSends: []
  9361. }),
  9362. $globals.Dictionary);
  9363. $core.addMethod(
  9364. $core.method({
  9365. selector: "includesKey:",
  9366. protocol: "testing",
  9367. fn: function (aKey){
  9368. var self=this,$self=this;
  9369. return $core.withContext(function($ctx1) {
  9370. return $self._positionOfKey_(aKey) >= 0;;
  9371. return self;
  9372. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.Dictionary)});
  9373. },
  9374. args: ["aKey"],
  9375. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $self._positionOfKey_(aKey) >= 0;'>",
  9376. referencedClasses: [],
  9377. messageSends: []
  9378. }),
  9379. $globals.Dictionary);
  9380. $core.addMethod(
  9381. $core.method({
  9382. selector: "indexOf:ifAbsent:",
  9383. protocol: "accessing",
  9384. fn: function (anObject,aBlock){
  9385. var self=this,$self=this;
  9386. var index;
  9387. return $core.withContext(function($ctx1) {
  9388. var $1;
  9389. index=$recv($self["@values"])._indexOf_ifAbsent_(anObject,(function(){
  9390. return (0);
  9391. }));
  9392. $1=$recv(index).__eq((0));
  9393. if($core.assert($1)){
  9394. return $recv(aBlock)._value();
  9395. } else {
  9396. return $recv($self["@keys"])._at_(index);
  9397. }
  9398. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Dictionary)});
  9399. },
  9400. args: ["anObject", "aBlock"],
  9401. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09| index |\x0a\x09index := values \x0a\x09\x09indexOf: anObject \x0a\x09\x09ifAbsent: [ 0 ].\x0a\x09^ index = 0 \x0a\x09\x09ifTrue: [ aBlock value ] \x0a\x09\x09ifFalse: [ keys at: index ]",
  9402. referencedClasses: [],
  9403. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  9404. }),
  9405. $globals.Dictionary);
  9406. $core.addMethod(
  9407. $core.method({
  9408. selector: "initialize",
  9409. protocol: "initialization",
  9410. fn: function (){
  9411. var self=this,$self=this;
  9412. return $core.withContext(function($ctx1) {
  9413. (
  9414. $ctx1.supercall = true,
  9415. ($globals.Dictionary.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  9416. $ctx1.supercall = false;
  9417. $self["@keys"]=[];
  9418. $self["@values"]=[];
  9419. return self;
  9420. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Dictionary)});
  9421. },
  9422. args: [],
  9423. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  9424. referencedClasses: [],
  9425. messageSends: ["initialize"]
  9426. }),
  9427. $globals.Dictionary);
  9428. $core.addMethod(
  9429. $core.method({
  9430. selector: "keys",
  9431. protocol: "accessing",
  9432. fn: function (){
  9433. var self=this,$self=this;
  9434. return $core.withContext(function($ctx1) {
  9435. return $recv($self["@keys"])._copy();
  9436. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.Dictionary)});
  9437. },
  9438. args: [],
  9439. source: "keys\x0a\x09^ keys copy",
  9440. referencedClasses: [],
  9441. messageSends: ["copy"]
  9442. }),
  9443. $globals.Dictionary);
  9444. $core.addMethod(
  9445. $core.method({
  9446. selector: "keysAndValuesDo:",
  9447. protocol: "enumerating",
  9448. fn: function (aBlock){
  9449. var self=this,$self=this;
  9450. return $core.withContext(function($ctx1) {
  9451. return $recv($self["@keys"])._with_do_($self["@values"],aBlock);
  9452. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  9453. },
  9454. args: ["aBlock"],
  9455. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  9456. referencedClasses: [],
  9457. messageSends: ["with:do:"]
  9458. }),
  9459. $globals.Dictionary);
  9460. $core.addMethod(
  9461. $core.method({
  9462. selector: "keysDo:",
  9463. protocol: "enumerating",
  9464. fn: function (aBlock){
  9465. var self=this,$self=this;
  9466. return $core.withContext(function($ctx1) {
  9467. return $recv($self["@keys"])._do_(aBlock);
  9468. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.Dictionary)});
  9469. },
  9470. args: ["aBlock"],
  9471. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  9472. referencedClasses: [],
  9473. messageSends: ["do:"]
  9474. }),
  9475. $globals.Dictionary);
  9476. $core.addMethod(
  9477. $core.method({
  9478. selector: "positionOfKey:",
  9479. protocol: "private",
  9480. fn: function (anObject){
  9481. var self=this,$self=this;
  9482. return $core.withContext(function($ctx1) {
  9483. var keys = $self['@keys'];
  9484. for(var i=0;i<keys.length;i++){
  9485. if(keys[i].__eq(anObject)) { return i;}
  9486. }
  9487. return -1;
  9488. ;
  9489. return self;
  9490. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},$globals.Dictionary)});
  9491. },
  9492. args: ["anObject"],
  9493. source: "positionOfKey: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var keys = $self[''@keys''];\x0a\x09\x09for(var i=0;i<keys.length;i++){\x0a\x09\x09\x09if(keys[i].__eq(anObject)) { return i;}\x0a\x09\x09}\x0a\x09\x09return -1;\x0a\x09'>",
  9494. referencedClasses: [],
  9495. messageSends: []
  9496. }),
  9497. $globals.Dictionary);
  9498. $core.addMethod(
  9499. $core.method({
  9500. selector: "removeAll",
  9501. protocol: "adding/removing",
  9502. fn: function (){
  9503. var self=this,$self=this;
  9504. return $core.withContext(function($ctx1) {
  9505. $recv($self["@keys"])._removeAll();
  9506. $ctx1.sendIdx["removeAll"]=1;
  9507. $recv($self["@values"])._removeAll();
  9508. return self;
  9509. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Dictionary)});
  9510. },
  9511. args: [],
  9512. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  9513. referencedClasses: [],
  9514. messageSends: ["removeAll"]
  9515. }),
  9516. $globals.Dictionary);
  9517. $core.addMethod(
  9518. $core.method({
  9519. selector: "removeKey:ifAbsent:",
  9520. protocol: "adding/removing",
  9521. fn: function (aKey,aBlock){
  9522. var self=this,$self=this;
  9523. return $core.withContext(function($ctx1) {
  9524. var index = $self._positionOfKey_(aKey);
  9525. if(index === -1) {
  9526. return aBlock._value()
  9527. } else {
  9528. var keys = $self['@keys'], values = $self['@values'];
  9529. var value = values[index], l = keys.length;
  9530. keys[index] = keys[l-1];
  9531. keys.pop();
  9532. values[index] = values[l-1];
  9533. values.pop();
  9534. return value;
  9535. }
  9536. ;
  9537. return self;
  9538. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  9539. },
  9540. args: ["aKey", "aBlock"],
  9541. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var index = $self._positionOfKey_(aKey);\x0a\x09\x09if(index === -1) {\x0a\x09\x09\x09return aBlock._value()\x0a\x09\x09} else {\x0a\x09\x09\x09var keys = $self[''@keys''], values = $self[''@values''];\x0a\x09\x09\x09var value = values[index], l = keys.length;\x0a\x09\x09\x09keys[index] = keys[l-1];\x0a\x09\x09\x09keys.pop();\x0a\x09\x09\x09values[index] = values[l-1];\x0a\x09\x09\x09values.pop();\x0a\x09\x09\x09return value;\x0a\x09\x09}\x0a\x09'>",
  9542. referencedClasses: [],
  9543. messageSends: []
  9544. }),
  9545. $globals.Dictionary);
  9546. $core.addMethod(
  9547. $core.method({
  9548. selector: "values",
  9549. protocol: "accessing",
  9550. fn: function (){
  9551. var self=this,$self=this;
  9552. return $self["@values"];
  9553. },
  9554. args: [],
  9555. source: "values\x0a\x09^ values",
  9556. referencedClasses: [],
  9557. messageSends: []
  9558. }),
  9559. $globals.Dictionary);
  9560. $core.addMethod(
  9561. $core.method({
  9562. selector: "valuesDo:",
  9563. protocol: "enumerating",
  9564. fn: function (aBlock){
  9565. var self=this,$self=this;
  9566. return $core.withContext(function($ctx1) {
  9567. return $recv($self["@values"])._do_(aBlock);
  9568. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  9569. },
  9570. args: ["aBlock"],
  9571. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  9572. referencedClasses: [],
  9573. messageSends: ["do:"]
  9574. }),
  9575. $globals.Dictionary);
  9576. $core.addClass("HashedCollection", $globals.AssociativeCollection, [], "Kernel-Collections");
  9577. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  9578. $core.addMethod(
  9579. $core.method({
  9580. selector: "at:ifAbsent:",
  9581. protocol: "accessing",
  9582. fn: function (aKey,aBlock){
  9583. var self=this,$self=this;
  9584. return $core.withContext(function($ctx1) {
  9585. var $1;
  9586. $1=$self._includesKey_(aKey);
  9587. if($core.assert($1)){
  9588. return $self._basicAt_(aKey);
  9589. } else {
  9590. return $recv(aBlock)._value();
  9591. }
  9592. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  9593. },
  9594. args: ["aKey", "aBlock"],
  9595. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  9596. referencedClasses: [],
  9597. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  9598. }),
  9599. $globals.HashedCollection);
  9600. $core.addMethod(
  9601. $core.method({
  9602. selector: "at:put:",
  9603. protocol: "accessing",
  9604. fn: function (aKey,aValue){
  9605. var self=this,$self=this;
  9606. return $core.withContext(function($ctx1) {
  9607. return $self._basicAt_put_(aKey,aValue);
  9608. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.HashedCollection)});
  9609. },
  9610. args: ["aKey", "aValue"],
  9611. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  9612. referencedClasses: [],
  9613. messageSends: ["basicAt:put:"]
  9614. }),
  9615. $globals.HashedCollection);
  9616. $core.addMethod(
  9617. $core.method({
  9618. selector: "includesKey:",
  9619. protocol: "testing",
  9620. fn: function (aKey){
  9621. var self=this,$self=this;
  9622. return $core.withContext(function($ctx1) {
  9623. return self.hasOwnProperty(aKey);
  9624. return self;
  9625. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.HashedCollection)});
  9626. },
  9627. args: ["aKey"],
  9628. source: "includesKey: aKey\x0a\x09<inlineJS: 'return self.hasOwnProperty(aKey)'>",
  9629. referencedClasses: [],
  9630. messageSends: []
  9631. }),
  9632. $globals.HashedCollection);
  9633. $core.addMethod(
  9634. $core.method({
  9635. selector: "keys",
  9636. protocol: "accessing",
  9637. fn: function (){
  9638. var self=this,$self=this;
  9639. return $core.withContext(function($ctx1) {
  9640. return Object.keys(self);
  9641. return self;
  9642. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.HashedCollection)});
  9643. },
  9644. args: [],
  9645. source: "keys\x0a\x09<inlineJS: 'return Object.keys(self)'>",
  9646. referencedClasses: [],
  9647. messageSends: []
  9648. }),
  9649. $globals.HashedCollection);
  9650. $core.addMethod(
  9651. $core.method({
  9652. selector: "keysDo:",
  9653. protocol: "enumerating",
  9654. fn: function (aBlock){
  9655. var self=this,$self=this;
  9656. return $core.withContext(function($ctx1) {
  9657. $recv($self._keys())._do_(aBlock);
  9658. return self;
  9659. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.HashedCollection)});
  9660. },
  9661. args: ["aBlock"],
  9662. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  9663. referencedClasses: [],
  9664. messageSends: ["do:", "keys"]
  9665. }),
  9666. $globals.HashedCollection);
  9667. $core.addMethod(
  9668. $core.method({
  9669. selector: "removeKey:ifAbsent:",
  9670. protocol: "adding/removing",
  9671. fn: function (aKey,aBlock){
  9672. var self=this,$self=this;
  9673. return $core.withContext(function($ctx1) {
  9674. return $self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  9675. return $core.withContext(function($ctx2) {
  9676. $self._basicDelete_(aKey);
  9677. return removed;
  9678. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  9679. }),(function(){
  9680. return $core.withContext(function($ctx2) {
  9681. return $recv(aBlock)._value();
  9682. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  9683. }));
  9684. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  9685. },
  9686. args: ["aKey", "aBlock"],
  9687. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09^ self\x0a\x09\x09at: aKey\x0a\x09\x09ifPresent: [ :removed | self basicDelete: aKey. removed ]\x0a\x09\x09ifAbsent: [ aBlock value ]",
  9688. referencedClasses: [],
  9689. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  9690. }),
  9691. $globals.HashedCollection);
  9692. $core.addMethod(
  9693. $core.method({
  9694. selector: "values",
  9695. protocol: "accessing",
  9696. fn: function (){
  9697. var self=this,$self=this;
  9698. return $core.withContext(function($ctx1) {
  9699. return $self._keys().map(function(key){
  9700. return $self._at_(key);
  9701. });
  9702. ;
  9703. return self;
  9704. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.HashedCollection)});
  9705. },
  9706. args: [],
  9707. source: "values\x0a\x09<inlineJS: '\x0a\x09\x09return $self._keys().map(function(key){\x0a\x09\x09\x09return $self._at_(key);\x0a\x09\x09});\x0a\x09'>",
  9708. referencedClasses: [],
  9709. messageSends: []
  9710. }),
  9711. $globals.HashedCollection);
  9712. $core.addMethod(
  9713. $core.method({
  9714. selector: "valuesDo:",
  9715. protocol: "enumerating",
  9716. fn: function (aBlock){
  9717. var self=this,$self=this;
  9718. return $core.withContext(function($ctx1) {
  9719. $recv($self._values())._do_(aBlock);
  9720. return self;
  9721. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.HashedCollection)});
  9722. },
  9723. args: ["aBlock"],
  9724. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  9725. referencedClasses: [],
  9726. messageSends: ["do:", "values"]
  9727. }),
  9728. $globals.HashedCollection);
  9729. $core.addClass("SequenceableCollection", $globals.Collection, [], "Kernel-Collections");
  9730. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  9731. $core.addMethod(
  9732. $core.method({
  9733. selector: "=",
  9734. protocol: "comparing",
  9735. fn: function (aCollection){
  9736. var self=this,$self=this;
  9737. return $core.withContext(function($ctx1) {
  9738. var $3,$2,$4,$1,$5;
  9739. var $early={};
  9740. try {
  9741. $3=$self._class();
  9742. $ctx1.sendIdx["class"]=1;
  9743. $2=$recv($3).__eq($recv(aCollection)._class());
  9744. $ctx1.sendIdx["="]=1;
  9745. $1=$recv($2)._and_((function(){
  9746. return $core.withContext(function($ctx2) {
  9747. $4=$self._size();
  9748. $ctx2.sendIdx["size"]=1;
  9749. return $recv($4).__eq($recv(aCollection)._size());
  9750. $ctx2.sendIdx["="]=2;
  9751. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9752. }));
  9753. if(!$core.assert($1)){
  9754. return false;
  9755. }
  9756. $self._withIndexDo_((function(each,i){
  9757. return $core.withContext(function($ctx2) {
  9758. $5=$recv($recv(aCollection)._at_(i)).__eq(each);
  9759. if(!$core.assert($5)){
  9760. throw $early=[false];
  9761. }
  9762. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  9763. }));
  9764. return true;
  9765. }
  9766. catch(e) {if(e===$early)return e[0]; throw e}
  9767. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.SequenceableCollection)});
  9768. },
  9769. args: ["aCollection"],
  9770. source: "= aCollection\x0a\x09(self class = aCollection class and: [\x0a\x09\x09self size = aCollection size ]) ifFalse: [ ^ false ].\x0a\x09self withIndexDo: [ :each :i |\x0a\x09\x09\x09\x09(aCollection at: i) = each ifFalse: [ ^ false ]].\x0a\x09^ true",
  9771. referencedClasses: [],
  9772. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  9773. }),
  9774. $globals.SequenceableCollection);
  9775. $core.addMethod(
  9776. $core.method({
  9777. selector: "addLast:",
  9778. protocol: "adding/removing",
  9779. fn: function (anObject){
  9780. var self=this,$self=this;
  9781. return $core.withContext(function($ctx1) {
  9782. $self._add_(anObject);
  9783. return self;
  9784. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},$globals.SequenceableCollection)});
  9785. },
  9786. args: ["anObject"],
  9787. source: "addLast: anObject\x0a\x09self add: anObject",
  9788. referencedClasses: [],
  9789. messageSends: ["add:"]
  9790. }),
  9791. $globals.SequenceableCollection);
  9792. $core.addMethod(
  9793. $core.method({
  9794. selector: "allButFirst",
  9795. protocol: "accessing",
  9796. fn: function (){
  9797. var self=this,$self=this;
  9798. return $core.withContext(function($ctx1) {
  9799. return $self._copyFrom_to_((2),$self._size());
  9800. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},$globals.SequenceableCollection)});
  9801. },
  9802. args: [],
  9803. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  9804. referencedClasses: [],
  9805. messageSends: ["copyFrom:to:", "size"]
  9806. }),
  9807. $globals.SequenceableCollection);
  9808. $core.addMethod(
  9809. $core.method({
  9810. selector: "allButLast",
  9811. protocol: "accessing",
  9812. fn: function (){
  9813. var self=this,$self=this;
  9814. return $core.withContext(function($ctx1) {
  9815. return $self._copyFrom_to_((1),$recv($self._size()).__minus((1)));
  9816. }, function($ctx1) {$ctx1.fill(self,"allButLast",{},$globals.SequenceableCollection)});
  9817. },
  9818. args: [],
  9819. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  9820. referencedClasses: [],
  9821. messageSends: ["copyFrom:to:", "-", "size"]
  9822. }),
  9823. $globals.SequenceableCollection);
  9824. $core.addMethod(
  9825. $core.method({
  9826. selector: "anyOne",
  9827. protocol: "accessing",
  9828. fn: function (){
  9829. var self=this,$self=this;
  9830. return $core.withContext(function($ctx1) {
  9831. return $self._at_((1));
  9832. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.SequenceableCollection)});
  9833. },
  9834. args: [],
  9835. source: "anyOne\x0a\x09^ self at: 1",
  9836. referencedClasses: [],
  9837. messageSends: ["at:"]
  9838. }),
  9839. $globals.SequenceableCollection);
  9840. $core.addMethod(
  9841. $core.method({
  9842. selector: "atRandom",
  9843. protocol: "accessing",
  9844. fn: function (){
  9845. var self=this,$self=this;
  9846. return $core.withContext(function($ctx1) {
  9847. return $self._at_($recv($self._size())._atRandom());
  9848. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.SequenceableCollection)});
  9849. },
  9850. args: [],
  9851. source: "atRandom\x0a\x09^ self at: self size atRandom",
  9852. referencedClasses: [],
  9853. messageSends: ["at:", "atRandom", "size"]
  9854. }),
  9855. $globals.SequenceableCollection);
  9856. $core.addMethod(
  9857. $core.method({
  9858. selector: "beginsWith:",
  9859. protocol: "testing",
  9860. fn: function (prefix){
  9861. var self=this,$self=this;
  9862. return $core.withContext(function($ctx1) {
  9863. var $2,$3,$1;
  9864. $2=$self._size();
  9865. $ctx1.sendIdx["size"]=1;
  9866. $3=$recv(prefix)._size();
  9867. $ctx1.sendIdx["size"]=2;
  9868. $1=$recv($2).__lt($3);
  9869. if($core.assert($1)){
  9870. return false;
  9871. }
  9872. return $recv($self._first_($recv(prefix)._size())).__eq(prefix);
  9873. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix},$globals.SequenceableCollection)});
  9874. },
  9875. args: ["prefix"],
  9876. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  9877. referencedClasses: [],
  9878. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  9879. }),
  9880. $globals.SequenceableCollection);
  9881. $core.addMethod(
  9882. $core.method({
  9883. selector: "copyFrom:to:",
  9884. protocol: "copying",
  9885. fn: function (anIndex,anotherIndex){
  9886. var self=this,$self=this;
  9887. return $core.withContext(function($ctx1) {
  9888. $self._subclassResponsibility();
  9889. return self;
  9890. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.SequenceableCollection)});
  9891. },
  9892. args: ["anIndex", "anotherIndex"],
  9893. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self subclassResponsibility",
  9894. referencedClasses: [],
  9895. messageSends: ["subclassResponsibility"]
  9896. }),
  9897. $globals.SequenceableCollection);
  9898. $core.addMethod(
  9899. $core.method({
  9900. selector: "endsWith:",
  9901. protocol: "testing",
  9902. fn: function (suffix){
  9903. var self=this,$self=this;
  9904. return $core.withContext(function($ctx1) {
  9905. var $2,$3,$1;
  9906. $2=$self._size();
  9907. $ctx1.sendIdx["size"]=1;
  9908. $3=$recv(suffix)._size();
  9909. $ctx1.sendIdx["size"]=2;
  9910. $1=$recv($2).__lt($3);
  9911. if($core.assert($1)){
  9912. return false;
  9913. }
  9914. return $recv($self._last_($recv(suffix)._size())).__eq(suffix);
  9915. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix},$globals.SequenceableCollection)});
  9916. },
  9917. args: ["suffix"],
  9918. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  9919. referencedClasses: [],
  9920. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  9921. }),
  9922. $globals.SequenceableCollection);
  9923. $core.addMethod(
  9924. $core.method({
  9925. selector: "first",
  9926. protocol: "accessing",
  9927. fn: function (){
  9928. var self=this,$self=this;
  9929. return $core.withContext(function($ctx1) {
  9930. return $self._at_((1));
  9931. }, function($ctx1) {$ctx1.fill(self,"first",{},$globals.SequenceableCollection)});
  9932. },
  9933. args: [],
  9934. source: "first\x0a\x09^ self at: 1",
  9935. referencedClasses: [],
  9936. messageSends: ["at:"]
  9937. }),
  9938. $globals.SequenceableCollection);
  9939. $core.addMethod(
  9940. $core.method({
  9941. selector: "first:",
  9942. protocol: "accessing",
  9943. fn: function (aNumber){
  9944. var self=this,$self=this;
  9945. return $core.withContext(function($ctx1) {
  9946. var $1;
  9947. $1=$recv($self._size()).__lt(aNumber);
  9948. if($core.assert($1)){
  9949. $self._error_("Invalid number of elements");
  9950. }
  9951. return $self._copyFrom_to_((1),aNumber);
  9952. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber},$globals.SequenceableCollection)});
  9953. },
  9954. args: ["aNumber"],
  9955. source: "first: aNumber\x0a\x09\x22Answer the first `aNumber` elements of the receiver.\x0a\x09Raise an error if there are not enough elements in the receiver.\x22\x0a\x0a\x09self size < aNumber ifTrue: [ self error: 'Invalid number of elements' ].\x0a\x0a\x09^ self copyFrom: 1 to: aNumber",
  9956. referencedClasses: [],
  9957. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  9958. }),
  9959. $globals.SequenceableCollection);
  9960. $core.addMethod(
  9961. $core.method({
  9962. selector: "fourth",
  9963. protocol: "accessing",
  9964. fn: function (){
  9965. var self=this,$self=this;
  9966. return $core.withContext(function($ctx1) {
  9967. return $self._at_((4));
  9968. }, function($ctx1) {$ctx1.fill(self,"fourth",{},$globals.SequenceableCollection)});
  9969. },
  9970. args: [],
  9971. source: "fourth\x0a\x09^ self at: 4",
  9972. referencedClasses: [],
  9973. messageSends: ["at:"]
  9974. }),
  9975. $globals.SequenceableCollection);
  9976. $core.addMethod(
  9977. $core.method({
  9978. selector: "includes:",
  9979. protocol: "testing",
  9980. fn: function (anObject){
  9981. var self=this,$self=this;
  9982. return $core.withContext(function($ctx1) {
  9983. return $recv($self._indexOf_ifAbsent_(anObject,(function(){
  9984. return nil;
  9985. })))._notNil();
  9986. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.SequenceableCollection)});
  9987. },
  9988. args: ["anObject"],
  9989. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  9990. referencedClasses: [],
  9991. messageSends: ["notNil", "indexOf:ifAbsent:"]
  9992. }),
  9993. $globals.SequenceableCollection);
  9994. $core.addMethod(
  9995. $core.method({
  9996. selector: "indexOf:startingAt:",
  9997. protocol: "accessing",
  9998. fn: function (anObject,start){
  9999. var self=this,$self=this;
  10000. return $core.withContext(function($ctx1) {
  10001. return $self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  10002. return (0);
  10003. }));
  10004. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},$globals.SequenceableCollection)});
  10005. },
  10006. args: ["anObject", "start"],
  10007. source: "indexOf: anObject startingAt: start\x0a\x09\x22Answer the index of the first occurence of anElement after start\x0a\x09within the receiver. If the receiver does not contain anElement,\x0a\x09answer 0.\x22\x0a\x09^ self indexOf: anObject startingAt: start ifAbsent: [ 0 ]",
  10008. referencedClasses: [],
  10009. messageSends: ["indexOf:startingAt:ifAbsent:"]
  10010. }),
  10011. $globals.SequenceableCollection);
  10012. $core.addMethod(
  10013. $core.method({
  10014. selector: "indexOf:startingAt:ifAbsent:",
  10015. protocol: "accessing",
  10016. fn: function (anObject,start,aBlock){
  10017. var self=this,$self=this;
  10018. return $core.withContext(function($ctx1) {
  10019. $self._subclassResponsibility();
  10020. return self;
  10021. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},$globals.SequenceableCollection)});
  10022. },
  10023. args: ["anObject", "start", "aBlock"],
  10024. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  10025. referencedClasses: [],
  10026. messageSends: ["subclassResponsibility"]
  10027. }),
  10028. $globals.SequenceableCollection);
  10029. $core.addMethod(
  10030. $core.method({
  10031. selector: "last",
  10032. protocol: "accessing",
  10033. fn: function (){
  10034. var self=this,$self=this;
  10035. return $core.withContext(function($ctx1) {
  10036. return $self._at_($self._size());
  10037. }, function($ctx1) {$ctx1.fill(self,"last",{},$globals.SequenceableCollection)});
  10038. },
  10039. args: [],
  10040. source: "last\x0a\x09^ self at: self size",
  10041. referencedClasses: [],
  10042. messageSends: ["at:", "size"]
  10043. }),
  10044. $globals.SequenceableCollection);
  10045. $core.addMethod(
  10046. $core.method({
  10047. selector: "last:",
  10048. protocol: "accessing",
  10049. fn: function (aNumber){
  10050. var self=this,$self=this;
  10051. return $core.withContext(function($ctx1) {
  10052. var $2,$1,$5,$4,$3;
  10053. $2=$self._size();
  10054. $ctx1.sendIdx["size"]=1;
  10055. $1=$recv($2).__lt(aNumber);
  10056. if($core.assert($1)){
  10057. $self._error_("Invalid number of elements");
  10058. }
  10059. $5=$self._size();
  10060. $ctx1.sendIdx["size"]=2;
  10061. $4=$recv($5).__minus(aNumber);
  10062. $3=$recv($4).__plus((1));
  10063. return $self._copyFrom_to_($3,$self._size());
  10064. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber},$globals.SequenceableCollection)});
  10065. },
  10066. args: ["aNumber"],
  10067. source: "last: aNumber\x0a\x09\x22Answer the last aNumber elements of the receiver.\x0a\x09Raise an error if there are not enough elements in the receiver.\x22\x0a\x0a\x09self size < aNumber ifTrue: [ self error: 'Invalid number of elements' ].\x0a\x0a\x09^ self copyFrom: self size - aNumber + 1 to: self size",
  10068. referencedClasses: [],
  10069. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  10070. }),
  10071. $globals.SequenceableCollection);
  10072. $core.addMethod(
  10073. $core.method({
  10074. selector: "newStream",
  10075. protocol: "streaming",
  10076. fn: function (){
  10077. var self=this,$self=this;
  10078. return $core.withContext(function($ctx1) {
  10079. return $recv($self._streamClass())._on_(self);
  10080. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.SequenceableCollection)});
  10081. },
  10082. args: [],
  10083. source: "newStream\x0a\x09^ self streamClass on: self",
  10084. referencedClasses: [],
  10085. messageSends: ["on:", "streamClass"]
  10086. }),
  10087. $globals.SequenceableCollection);
  10088. $core.addMethod(
  10089. $core.method({
  10090. selector: "readStream",
  10091. protocol: "streaming",
  10092. fn: function (){
  10093. var self=this,$self=this;
  10094. return $core.withContext(function($ctx1) {
  10095. return $self._stream();
  10096. }, function($ctx1) {$ctx1.fill(self,"readStream",{},$globals.SequenceableCollection)});
  10097. },
  10098. args: [],
  10099. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  10100. referencedClasses: [],
  10101. messageSends: ["stream"]
  10102. }),
  10103. $globals.SequenceableCollection);
  10104. $core.addMethod(
  10105. $core.method({
  10106. selector: "removeLast",
  10107. protocol: "adding/removing",
  10108. fn: function (){
  10109. var self=this,$self=this;
  10110. return $core.withContext(function($ctx1) {
  10111. return $self._remove_($self._last());
  10112. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.SequenceableCollection)});
  10113. },
  10114. args: [],
  10115. source: "removeLast\x0a\x09^ self remove: self last",
  10116. referencedClasses: [],
  10117. messageSends: ["remove:", "last"]
  10118. }),
  10119. $globals.SequenceableCollection);
  10120. $core.addMethod(
  10121. $core.method({
  10122. selector: "reverseDo:",
  10123. protocol: "enumerating",
  10124. fn: function (aBlock){
  10125. var self=this,$self=this;
  10126. return $core.withContext(function($ctx1) {
  10127. $recv($self._reversed())._do_(aBlock);
  10128. return self;
  10129. }, function($ctx1) {$ctx1.fill(self,"reverseDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  10130. },
  10131. args: ["aBlock"],
  10132. source: "reverseDo: aBlock\x0a\x09self reversed do: aBlock",
  10133. referencedClasses: [],
  10134. messageSends: ["do:", "reversed"]
  10135. }),
  10136. $globals.SequenceableCollection);
  10137. $core.addMethod(
  10138. $core.method({
  10139. selector: "reversed",
  10140. protocol: "converting",
  10141. fn: function (){
  10142. var self=this,$self=this;
  10143. return $core.withContext(function($ctx1) {
  10144. $self._subclassResponsibility();
  10145. return self;
  10146. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.SequenceableCollection)});
  10147. },
  10148. args: [],
  10149. source: "reversed\x0a\x09self subclassResponsibility",
  10150. referencedClasses: [],
  10151. messageSends: ["subclassResponsibility"]
  10152. }),
  10153. $globals.SequenceableCollection);
  10154. $core.addMethod(
  10155. $core.method({
  10156. selector: "second",
  10157. protocol: "accessing",
  10158. fn: function (){
  10159. var self=this,$self=this;
  10160. return $core.withContext(function($ctx1) {
  10161. return $self._at_((2));
  10162. }, function($ctx1) {$ctx1.fill(self,"second",{},$globals.SequenceableCollection)});
  10163. },
  10164. args: [],
  10165. source: "second\x0a\x09^ self at: 2",
  10166. referencedClasses: [],
  10167. messageSends: ["at:"]
  10168. }),
  10169. $globals.SequenceableCollection);
  10170. $core.addMethod(
  10171. $core.method({
  10172. selector: "stream",
  10173. protocol: "streaming",
  10174. fn: function (){
  10175. var self=this,$self=this;
  10176. return $core.withContext(function($ctx1) {
  10177. return $self._newStream();
  10178. }, function($ctx1) {$ctx1.fill(self,"stream",{},$globals.SequenceableCollection)});
  10179. },
  10180. args: [],
  10181. source: "stream\x0a\x09^ self newStream",
  10182. referencedClasses: [],
  10183. messageSends: ["newStream"]
  10184. }),
  10185. $globals.SequenceableCollection);
  10186. $core.addMethod(
  10187. $core.method({
  10188. selector: "streamClass",
  10189. protocol: "streaming",
  10190. fn: function (){
  10191. var self=this,$self=this;
  10192. return $core.withContext(function($ctx1) {
  10193. return $recv($self._class())._streamClass();
  10194. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},$globals.SequenceableCollection)});
  10195. },
  10196. args: [],
  10197. source: "streamClass\x0a\x09^ self class streamClass",
  10198. referencedClasses: [],
  10199. messageSends: ["streamClass", "class"]
  10200. }),
  10201. $globals.SequenceableCollection);
  10202. $core.addMethod(
  10203. $core.method({
  10204. selector: "third",
  10205. protocol: "accessing",
  10206. fn: function (){
  10207. var self=this,$self=this;
  10208. return $core.withContext(function($ctx1) {
  10209. return $self._at_((3));
  10210. }, function($ctx1) {$ctx1.fill(self,"third",{},$globals.SequenceableCollection)});
  10211. },
  10212. args: [],
  10213. source: "third\x0a\x09^ self at: 3",
  10214. referencedClasses: [],
  10215. messageSends: ["at:"]
  10216. }),
  10217. $globals.SequenceableCollection);
  10218. $core.addMethod(
  10219. $core.method({
  10220. selector: "writeStream",
  10221. protocol: "streaming",
  10222. fn: function (){
  10223. var self=this,$self=this;
  10224. return $core.withContext(function($ctx1) {
  10225. return $self._stream();
  10226. }, function($ctx1) {$ctx1.fill(self,"writeStream",{},$globals.SequenceableCollection)});
  10227. },
  10228. args: [],
  10229. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  10230. referencedClasses: [],
  10231. messageSends: ["stream"]
  10232. }),
  10233. $globals.SequenceableCollection);
  10234. $core.addMethod(
  10235. $core.method({
  10236. selector: "streamClass",
  10237. protocol: "accessing",
  10238. fn: function (){
  10239. var self=this,$self=this;
  10240. return $globals.Stream;
  10241. },
  10242. args: [],
  10243. source: "streamClass\x0a\x09\x09^ Stream",
  10244. referencedClasses: ["Stream"],
  10245. messageSends: []
  10246. }),
  10247. $globals.SequenceableCollection.a$cls);
  10248. $core.addMethod(
  10249. $core.method({
  10250. selector: "streamContents:",
  10251. protocol: "streaming",
  10252. fn: function (aBlock){
  10253. var self=this,$self=this;
  10254. var stream;
  10255. return $core.withContext(function($ctx1) {
  10256. stream=$recv($self._streamClass())._on_($self._new());
  10257. $recv(aBlock)._value_(stream);
  10258. return $recv(stream)._contents();
  10259. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},$globals.SequenceableCollection.a$cls)});
  10260. },
  10261. args: ["aBlock"],
  10262. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  10263. referencedClasses: [],
  10264. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  10265. }),
  10266. $globals.SequenceableCollection.a$cls);
  10267. $core.addClass("Array", $globals.SequenceableCollection, [], "Kernel-Collections");
  10268. $globals.Array.comment="I represent a collection of objects ordered by the collector. The size of arrays is dynamic.\x0a\x0aI am directly mapped to JavaScript Number.\x0a\x0a*Note* In Amber, `OrderedCollection` is an alias for `Array`.";
  10269. $core.addMethod(
  10270. $core.method({
  10271. selector: "add:",
  10272. protocol: "adding/removing",
  10273. fn: function (anObject){
  10274. var self=this,$self=this;
  10275. return $core.withContext(function($ctx1) {
  10276. self.push(anObject); return anObject;;
  10277. return self;
  10278. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Array)});
  10279. },
  10280. args: ["anObject"],
  10281. source: "add: anObject\x0a\x09<inlineJS: 'self.push(anObject); return anObject;'>",
  10282. referencedClasses: [],
  10283. messageSends: []
  10284. }),
  10285. $globals.Array);
  10286. $core.addMethod(
  10287. $core.method({
  10288. selector: "addAll:",
  10289. protocol: "adding/removing",
  10290. fn: function (aCollection){
  10291. var self=this,$self=this;
  10292. return $core.withContext(function($ctx1) {
  10293. if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);
  10294. else $globals.Array.superclass.fn.prototype._addAll_.call($self, aCollection);
  10295. return aCollection;;
  10296. return self;
  10297. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Array)});
  10298. },
  10299. args: ["aCollection"],
  10300. source: "addAll: aCollection\x0a<inlineJS: '\x0a\x09if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);\x0a\x09else $globals.Array.superclass.fn.prototype._addAll_.call($self, aCollection);\x0a\x09return aCollection;\x0a'>",
  10301. referencedClasses: [],
  10302. messageSends: []
  10303. }),
  10304. $globals.Array);
  10305. $core.addMethod(
  10306. $core.method({
  10307. selector: "addFirst:",
  10308. protocol: "adding/removing",
  10309. fn: function (anObject){
  10310. var self=this,$self=this;
  10311. return $core.withContext(function($ctx1) {
  10312. self.unshift(anObject); return anObject;;
  10313. return self;
  10314. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject},$globals.Array)});
  10315. },
  10316. args: ["anObject"],
  10317. source: "addFirst: anObject\x0a\x09<inlineJS: 'self.unshift(anObject); return anObject;'>",
  10318. referencedClasses: [],
  10319. messageSends: []
  10320. }),
  10321. $globals.Array);
  10322. $core.addMethod(
  10323. $core.method({
  10324. selector: "asJavaScriptSource",
  10325. protocol: "converting",
  10326. fn: function (){
  10327. var self=this,$self=this;
  10328. return $core.withContext(function($ctx1) {
  10329. var $1;
  10330. $1=$recv("[".__comma($recv($self._collect_((function(each){
  10331. return $core.withContext(function($ctx2) {
  10332. return $recv(each)._asJavaScriptSource();
  10333. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10334. })))._join_(", "))).__comma("]");
  10335. $ctx1.sendIdx[","]=1;
  10336. return $1;
  10337. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Array)});
  10338. },
  10339. args: [],
  10340. source: "asJavaScriptSource\x0a\x09^ '[', ((self collect: [:each | each asJavaScriptSource ]) join: ', '), ']'",
  10341. referencedClasses: [],
  10342. messageSends: [",", "join:", "collect:", "asJavaScriptSource"]
  10343. }),
  10344. $globals.Array);
  10345. $core.addMethod(
  10346. $core.method({
  10347. selector: "at:put:",
  10348. protocol: "accessing",
  10349. fn: function (anIndex,anObject){
  10350. var self=this,$self=this;
  10351. return $core.withContext(function($ctx1) {
  10352. return self[anIndex - 1] = anObject;
  10353. return self;
  10354. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.Array)});
  10355. },
  10356. args: ["anIndex", "anObject"],
  10357. source: "at: anIndex put: anObject\x0a\x09<inlineJS: 'return self[anIndex - 1] = anObject'>",
  10358. referencedClasses: [],
  10359. messageSends: []
  10360. }),
  10361. $globals.Array);
  10362. $core.addMethod(
  10363. $core.method({
  10364. selector: "collect:",
  10365. protocol: "enumerating",
  10366. fn: function (aBlock){
  10367. var self=this,$self=this;
  10368. return $core.withContext(function($ctx1) {
  10369. return self.map(function(each) {return aBlock._value_(each)});
  10370. return self;
  10371. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},$globals.Array)});
  10372. },
  10373. args: ["aBlock"],
  10374. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.map(function(each) {return aBlock._value_(each)})'>",
  10375. referencedClasses: [],
  10376. messageSends: []
  10377. }),
  10378. $globals.Array);
  10379. $core.addMethod(
  10380. $core.method({
  10381. selector: "copyFrom:to:",
  10382. protocol: "copying",
  10383. fn: function (anIndex,anotherIndex){
  10384. var self=this,$self=this;
  10385. return $core.withContext(function($ctx1) {
  10386. if (anIndex >= 1 && anotherIndex <= self.length) {
  10387. return self.slice(anIndex - 1, anotherIndex);
  10388. } else {
  10389. self._at_(anIndex);
  10390. self._at_(self.length + 1);
  10391. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  10392. };
  10393. return self;
  10394. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.Array)});
  10395. },
  10396. args: ["anIndex", "anotherIndex"],
  10397. source: "copyFrom: anIndex to: anotherIndex\x0a<inlineJS: '\x0a\x09if (anIndex >= 1 && anotherIndex <= self.length) {\x0a\x09\x09return self.slice(anIndex - 1, anotherIndex);\x0a\x09} else {\x0a\x09\x09self._at_(anIndex);\x0a\x09\x09self._at_(self.length + 1);\x0a\x09\x09throw new Error(\x22Incorrect indexes in #copyFrom:to: not caught by #at:\x22);\x0a\x09}\x0a'>",
  10398. referencedClasses: [],
  10399. messageSends: []
  10400. }),
  10401. $globals.Array);
  10402. $core.addMethod(
  10403. $core.method({
  10404. selector: "join:",
  10405. protocol: "enumerating",
  10406. fn: function (aString){
  10407. var self=this,$self=this;
  10408. return $core.withContext(function($ctx1) {
  10409. return self.join(aString);
  10410. return self;
  10411. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},$globals.Array)});
  10412. },
  10413. args: ["aString"],
  10414. source: "join: aString\x0a\x09<inlineJS: 'return self.join(aString)'>",
  10415. referencedClasses: [],
  10416. messageSends: []
  10417. }),
  10418. $globals.Array);
  10419. $core.addMethod(
  10420. $core.method({
  10421. selector: "printOn:",
  10422. protocol: "printing",
  10423. fn: function (aStream){
  10424. var self=this,$self=this;
  10425. return $core.withContext(function($ctx1) {
  10426. (
  10427. $ctx1.supercall = true,
  10428. ($globals.Array.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  10429. $ctx1.supercall = false;
  10430. $ctx1.sendIdx["printOn:"]=1;
  10431. $recv(aStream)._nextPutAll_(" (");
  10432. $ctx1.sendIdx["nextPutAll:"]=1;
  10433. $self._do_separatedBy_((function(each){
  10434. return $core.withContext(function($ctx2) {
  10435. return $recv(each)._printOn_(aStream);
  10436. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10437. }),(function(){
  10438. return $core.withContext(function($ctx2) {
  10439. return $recv(aStream)._nextPutAll_(" ");
  10440. $ctx2.sendIdx["nextPutAll:"]=2;
  10441. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  10442. }));
  10443. $recv(aStream)._nextPutAll_(")");
  10444. return self;
  10445. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Array)});
  10446. },
  10447. args: ["aStream"],
  10448. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: ' ('.\x0a\x09self \x0a\x09\x09do: [ :each | each printOn: aStream ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ' ' ].\x0a\x09aStream nextPutAll: ')'",
  10449. referencedClasses: [],
  10450. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  10451. }),
  10452. $globals.Array);
  10453. $core.addMethod(
  10454. $core.method({
  10455. selector: "remove:ifAbsent:",
  10456. protocol: "adding/removing",
  10457. fn: function (anObject,aBlock){
  10458. var self=this,$self=this;
  10459. var index;
  10460. return $core.withContext(function($ctx1) {
  10461. var $1;
  10462. index=$self._indexOf_ifAbsent_(anObject,(function(){
  10463. return (0);
  10464. }));
  10465. $1=$recv(index).__eq((0));
  10466. if($core.assert($1)){
  10467. return $recv(aBlock)._value();
  10468. } else {
  10469. $self._removeIndex_(index);
  10470. return anObject;
  10471. }
  10472. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Array)});
  10473. },
  10474. args: ["anObject", "aBlock"],
  10475. source: "remove: anObject ifAbsent: aBlock\x0a\x09| index |\x0a\x09index := self indexOf: anObject ifAbsent: [ 0 ].\x0a\x09^ index = 0\x0a\x09\x09ifFalse: [ self removeIndex: index. anObject ]\x0a\x09\x09ifTrue: [ aBlock value ]",
  10476. referencedClasses: [],
  10477. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  10478. }),
  10479. $globals.Array);
  10480. $core.addMethod(
  10481. $core.method({
  10482. selector: "removeAll",
  10483. protocol: "adding/removing",
  10484. fn: function (){
  10485. var self=this,$self=this;
  10486. return $core.withContext(function($ctx1) {
  10487. self.length = 0;
  10488. return self;
  10489. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Array)});
  10490. },
  10491. args: [],
  10492. source: "removeAll\x0a\x09<inlineJS: 'self.length = 0'>",
  10493. referencedClasses: [],
  10494. messageSends: []
  10495. }),
  10496. $globals.Array);
  10497. $core.addMethod(
  10498. $core.method({
  10499. selector: "removeFrom:to:",
  10500. protocol: "adding/removing",
  10501. fn: function (aNumber,anotherNumber){
  10502. var self=this,$self=this;
  10503. return $core.withContext(function($ctx1) {
  10504. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  10505. return self;
  10506. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Array)});
  10507. },
  10508. args: ["aNumber", "anotherNumber"],
  10509. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<inlineJS: 'self.splice(aNumber -1, anotherNumber - aNumber + 1)'>",
  10510. referencedClasses: [],
  10511. messageSends: []
  10512. }),
  10513. $globals.Array);
  10514. $core.addMethod(
  10515. $core.method({
  10516. selector: "removeIndex:",
  10517. protocol: "adding/removing",
  10518. fn: function (anInteger){
  10519. var self=this,$self=this;
  10520. return $core.withContext(function($ctx1) {
  10521. self.splice(anInteger - 1, 1);
  10522. return self;
  10523. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger},$globals.Array)});
  10524. },
  10525. args: ["anInteger"],
  10526. source: "removeIndex: anInteger\x0a\x09<inlineJS: 'self.splice(anInteger - 1, 1)'>",
  10527. referencedClasses: [],
  10528. messageSends: []
  10529. }),
  10530. $globals.Array);
  10531. $core.addMethod(
  10532. $core.method({
  10533. selector: "removeLast",
  10534. protocol: "adding/removing",
  10535. fn: function (){
  10536. var self=this,$self=this;
  10537. return $core.withContext(function($ctx1) {
  10538. return self.pop();;
  10539. return self;
  10540. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.Array)});
  10541. },
  10542. args: [],
  10543. source: "removeLast\x0a\x09<inlineJS: 'return self.pop();'>",
  10544. referencedClasses: [],
  10545. messageSends: []
  10546. }),
  10547. $globals.Array);
  10548. $core.addMethod(
  10549. $core.method({
  10550. selector: "reversed",
  10551. protocol: "converting",
  10552. fn: function (){
  10553. var self=this,$self=this;
  10554. return $core.withContext(function($ctx1) {
  10555. return self.slice().reverse();
  10556. return self;
  10557. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.Array)});
  10558. },
  10559. args: [],
  10560. source: "reversed\x0a\x09<inlineJS: 'return self.slice().reverse()'>",
  10561. referencedClasses: [],
  10562. messageSends: []
  10563. }),
  10564. $globals.Array);
  10565. $core.addMethod(
  10566. $core.method({
  10567. selector: "select:",
  10568. protocol: "enumerating",
  10569. fn: function (aBlock){
  10570. var self=this,$self=this;
  10571. return $core.withContext(function($ctx1) {
  10572. return self.filter(function(each) {return aBlock._value_(each)});
  10573. return self;
  10574. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},$globals.Array)});
  10575. },
  10576. args: ["aBlock"],
  10577. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.filter(function(each) {return aBlock._value_(each)})'>",
  10578. referencedClasses: [],
  10579. messageSends: []
  10580. }),
  10581. $globals.Array);
  10582. $core.addMethod(
  10583. $core.method({
  10584. selector: "shallowCopy",
  10585. protocol: "copying",
  10586. fn: function (){
  10587. var self=this,$self=this;
  10588. return $core.withContext(function($ctx1) {
  10589. return self.slice();
  10590. return self;
  10591. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Array)});
  10592. },
  10593. args: [],
  10594. source: "shallowCopy\x0a\x09<inlineJS: 'return self.slice()'>",
  10595. referencedClasses: [],
  10596. messageSends: []
  10597. }),
  10598. $globals.Array);
  10599. $core.addMethod(
  10600. $core.method({
  10601. selector: "sort",
  10602. protocol: "enumerating",
  10603. fn: function (){
  10604. var self=this,$self=this;
  10605. return $core.withContext(function($ctx1) {
  10606. return $self._sort_((function(a,b){
  10607. return $core.withContext(function($ctx2) {
  10608. return $recv(a).__lt(b);
  10609. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  10610. }));
  10611. }, function($ctx1) {$ctx1.fill(self,"sort",{},$globals.Array)});
  10612. },
  10613. args: [],
  10614. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  10615. referencedClasses: [],
  10616. messageSends: ["sort:", "<"]
  10617. }),
  10618. $globals.Array);
  10619. $core.addMethod(
  10620. $core.method({
  10621. selector: "sort:",
  10622. protocol: "enumerating",
  10623. fn: function (aBlock){
  10624. var self=this,$self=this;
  10625. return $core.withContext(function($ctx1) {
  10626. return self.sort(function(a, b) {
  10627. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  10628. })
  10629. ;
  10630. return self;
  10631. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},$globals.Array)});
  10632. },
  10633. args: ["aBlock"],
  10634. source: "sort: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09return self.sort(function(a, b) {\x0a\x09\x09\x09if(aBlock._value_value_(a,b)) {return -1} else {return 1}\x0a\x09\x09})\x0a\x09'>",
  10635. referencedClasses: [],
  10636. messageSends: []
  10637. }),
  10638. $globals.Array);
  10639. $core.addMethod(
  10640. $core.method({
  10641. selector: "sorted",
  10642. protocol: "enumerating",
  10643. fn: function (){
  10644. var self=this,$self=this;
  10645. return $core.withContext(function($ctx1) {
  10646. return $recv($self._copy())._sort();
  10647. }, function($ctx1) {$ctx1.fill(self,"sorted",{},$globals.Array)});
  10648. },
  10649. args: [],
  10650. source: "sorted\x0a\x09^ self copy sort",
  10651. referencedClasses: [],
  10652. messageSends: ["sort", "copy"]
  10653. }),
  10654. $globals.Array);
  10655. $core.addMethod(
  10656. $core.method({
  10657. selector: "sorted:",
  10658. protocol: "enumerating",
  10659. fn: function (aBlock){
  10660. var self=this,$self=this;
  10661. return $core.withContext(function($ctx1) {
  10662. return $recv($self._copy())._sort_(aBlock);
  10663. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},$globals.Array)});
  10664. },
  10665. args: ["aBlock"],
  10666. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  10667. referencedClasses: [],
  10668. messageSends: ["sort:", "copy"]
  10669. }),
  10670. $globals.Array);
  10671. $core.addMethod(
  10672. $core.method({
  10673. selector: "new:",
  10674. protocol: "instance creation",
  10675. fn: function (anInteger){
  10676. var self=this,$self=this;
  10677. return $core.withContext(function($ctx1) {
  10678. return new Array(anInteger);
  10679. return self;
  10680. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Array.a$cls)});
  10681. },
  10682. args: ["anInteger"],
  10683. source: "new: anInteger\x0a\x09<inlineJS: 'return new Array(anInteger)'>",
  10684. referencedClasses: [],
  10685. messageSends: []
  10686. }),
  10687. $globals.Array.a$cls);
  10688. $core.addMethod(
  10689. $core.method({
  10690. selector: "with:",
  10691. protocol: "instance creation",
  10692. fn: function (anObject){
  10693. var self=this,$self=this;
  10694. return $core.withContext(function($ctx1) {
  10695. var $1;
  10696. $1=$self._new_((1));
  10697. $recv($1)._at_put_((1),anObject);
  10698. return $recv($1)._yourself();
  10699. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Array.a$cls)});
  10700. },
  10701. args: ["anObject"],
  10702. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  10703. referencedClasses: [],
  10704. messageSends: ["at:put:", "new:", "yourself"]
  10705. }),
  10706. $globals.Array.a$cls);
  10707. $core.addMethod(
  10708. $core.method({
  10709. selector: "with:with:",
  10710. protocol: "instance creation",
  10711. fn: function (anObject,anObject2){
  10712. var self=this,$self=this;
  10713. return $core.withContext(function($ctx1) {
  10714. var $1;
  10715. $1=$self._new_((2));
  10716. $recv($1)._at_put_((1),anObject);
  10717. $ctx1.sendIdx["at:put:"]=1;
  10718. $recv($1)._at_put_((2),anObject2);
  10719. return $recv($1)._yourself();
  10720. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},$globals.Array.a$cls)});
  10721. },
  10722. args: ["anObject", "anObject2"],
  10723. source: "with: anObject with: anObject2\x0a\x09\x09^ (self new: 2)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09at: 2 put: anObject2;\x0a\x09\x09yourself",
  10724. referencedClasses: [],
  10725. messageSends: ["at:put:", "new:", "yourself"]
  10726. }),
  10727. $globals.Array.a$cls);
  10728. $core.addMethod(
  10729. $core.method({
  10730. selector: "with:with:with:",
  10731. protocol: "instance creation",
  10732. fn: function (anObject,anObject2,anObject3){
  10733. var self=this,$self=this;
  10734. return $core.withContext(function($ctx1) {
  10735. var $1;
  10736. $1=$self._new_((3));
  10737. $recv($1)._at_put_((1),anObject);
  10738. $ctx1.sendIdx["at:put:"]=1;
  10739. $recv($1)._at_put_((2),anObject2);
  10740. $ctx1.sendIdx["at:put:"]=2;
  10741. $recv($1)._at_put_((3),anObject3);
  10742. return $recv($1)._yourself();
  10743. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.Array.a$cls)});
  10744. },
  10745. args: ["anObject", "anObject2", "anObject3"],
  10746. source: "with: anObject with: anObject2 with: anObject3\x0a\x09\x09^ (self new: 3)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09at: 2 put: anObject2;\x0a\x09\x09at: 3 put: anObject3;\x0a\x09\x09yourself",
  10747. referencedClasses: [],
  10748. messageSends: ["at:put:", "new:", "yourself"]
  10749. }),
  10750. $globals.Array.a$cls);
  10751. $core.addMethod(
  10752. $core.method({
  10753. selector: "withAll:",
  10754. protocol: "instance creation",
  10755. fn: function (aCollection){
  10756. var self=this,$self=this;
  10757. var instance,index;
  10758. return $core.withContext(function($ctx1) {
  10759. index=(1);
  10760. instance=$self._new_($recv(aCollection)._size());
  10761. $recv(aCollection)._do_((function(each){
  10762. return $core.withContext(function($ctx2) {
  10763. $recv(instance)._at_put_(index,each);
  10764. index=$recv(index).__plus((1));
  10765. return index;
  10766. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10767. }));
  10768. return instance;
  10769. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},$globals.Array.a$cls)});
  10770. },
  10771. args: ["aCollection"],
  10772. source: "withAll: aCollection\x0a\x09| instance index |\x0a\x09index := 1.\x0a\x09instance := self new: aCollection size.\x0a\x09aCollection do: [ :each |\x0a\x09\x09instance at: index put: each.\x0a\x09\x09index := index + 1 ].\x0a\x09^ instance",
  10773. referencedClasses: [],
  10774. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  10775. }),
  10776. $globals.Array.a$cls);
  10777. $core.addClass("String", $globals.SequenceableCollection, [], "Kernel-Collections");
  10778. $globals.String.comment="I am an indexed collection of Characters. Unlike most Smalltalk dialects, Amber doesn't provide the Character class. Instead, elements of a String are single character strings.\x0a\x0aString inherits many useful methods from its hierarchy, such as\x0a\x09`Collection >> #,`";
  10779. $core.addMethod(
  10780. $core.method({
  10781. selector: ",",
  10782. protocol: "copying",
  10783. fn: function (aString){
  10784. var self=this,$self=this;
  10785. return $core.withContext(function($ctx1) {
  10786. return String(self) + aString;
  10787. return self;
  10788. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.String)});
  10789. },
  10790. args: ["aString"],
  10791. source: ", aString\x0a\x09<inlineJS: 'return String(self) + aString'>",
  10792. referencedClasses: [],
  10793. messageSends: []
  10794. }),
  10795. $globals.String);
  10796. $core.addMethod(
  10797. $core.method({
  10798. selector: "<",
  10799. protocol: "comparing",
  10800. fn: function (aString){
  10801. var self=this,$self=this;
  10802. return $core.withContext(function($ctx1) {
  10803. return String(self) < aString._asString();
  10804. return self;
  10805. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},$globals.String)});
  10806. },
  10807. args: ["aString"],
  10808. source: "< aString\x0a\x09<inlineJS: 'return String(self) < aString._asString()'>",
  10809. referencedClasses: [],
  10810. messageSends: []
  10811. }),
  10812. $globals.String);
  10813. $core.addMethod(
  10814. $core.method({
  10815. selector: "<=",
  10816. protocol: "comparing",
  10817. fn: function (aString){
  10818. var self=this,$self=this;
  10819. return $core.withContext(function($ctx1) {
  10820. return String(self) <= aString._asString();
  10821. return self;
  10822. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},$globals.String)});
  10823. },
  10824. args: ["aString"],
  10825. source: "<= aString\x0a\x09<inlineJS: 'return String(self) <= aString._asString()'>",
  10826. referencedClasses: [],
  10827. messageSends: []
  10828. }),
  10829. $globals.String);
  10830. $core.addMethod(
  10831. $core.method({
  10832. selector: "=",
  10833. protocol: "comparing",
  10834. fn: function (aString){
  10835. var self=this,$self=this;
  10836. return $core.withContext(function($ctx1) {
  10837. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  10838. return self;
  10839. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},$globals.String)});
  10840. },
  10841. args: ["aString"],
  10842. source: "= aString\x0a<inlineJS:\x0a\x09'return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())'>",
  10843. referencedClasses: [],
  10844. messageSends: []
  10845. }),
  10846. $globals.String);
  10847. $core.addMethod(
  10848. $core.method({
  10849. selector: "==",
  10850. protocol: "comparing",
  10851. fn: function (aString){
  10852. var self=this,$self=this;
  10853. return $core.withContext(function($ctx1) {
  10854. if (typeof aString === "string") return String(self) === aString;
  10855. else if (aString != null && typeof aString === "object") return String(self) === aString.valueOf();
  10856. else return false;;
  10857. return self;
  10858. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},$globals.String)});
  10859. },
  10860. args: ["aString"],
  10861. source: "== aString\x0a<inlineJS: '\x0a\x09if (typeof aString === \x22string\x22) return String(self) === aString;\x0a\x09else if (aString != null && typeof aString === \x22object\x22) return String(self) === aString.valueOf();\x0a\x09else return false;\x0a'>",
  10862. referencedClasses: [],
  10863. messageSends: []
  10864. }),
  10865. $globals.String);
  10866. $core.addMethod(
  10867. $core.method({
  10868. selector: ">",
  10869. protocol: "comparing",
  10870. fn: function (aString){
  10871. var self=this,$self=this;
  10872. return $core.withContext(function($ctx1) {
  10873. return String(self) > aString._asString();
  10874. return self;
  10875. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString},$globals.String)});
  10876. },
  10877. args: ["aString"],
  10878. source: "> aString\x0a\x09<inlineJS: 'return String(self) > aString._asString()'>",
  10879. referencedClasses: [],
  10880. messageSends: []
  10881. }),
  10882. $globals.String);
  10883. $core.addMethod(
  10884. $core.method({
  10885. selector: ">=",
  10886. protocol: "comparing",
  10887. fn: function (aString){
  10888. var self=this,$self=this;
  10889. return $core.withContext(function($ctx1) {
  10890. return String(self) >= aString._asString();
  10891. return self;
  10892. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},$globals.String)});
  10893. },
  10894. args: ["aString"],
  10895. source: ">= aString\x0a\x09<inlineJS: 'return String(self) >= aString._asString()'>",
  10896. referencedClasses: [],
  10897. messageSends: []
  10898. }),
  10899. $globals.String);
  10900. $core.addMethod(
  10901. $core.method({
  10902. selector: "add:",
  10903. protocol: "adding/removing",
  10904. fn: function (anObject){
  10905. var self=this,$self=this;
  10906. return $core.withContext(function($ctx1) {
  10907. $self._errorReadOnly();
  10908. return self;
  10909. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.String)});
  10910. },
  10911. args: ["anObject"],
  10912. source: "add: anObject\x0a\x09self errorReadOnly",
  10913. referencedClasses: [],
  10914. messageSends: ["errorReadOnly"]
  10915. }),
  10916. $globals.String);
  10917. $core.addMethod(
  10918. $core.method({
  10919. selector: "asJavaScriptMethodName",
  10920. protocol: "converting",
  10921. fn: function (){
  10922. var self=this,$self=this;
  10923. return $core.withContext(function($ctx1) {
  10924. return $core.st2js(self);
  10925. return self;
  10926. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{},$globals.String)});
  10927. },
  10928. args: [],
  10929. source: "asJavaScriptMethodName\x0a\x09<inlineJS: 'return $core.st2js(self)'>",
  10930. referencedClasses: [],
  10931. messageSends: []
  10932. }),
  10933. $globals.String);
  10934. $core.addMethod(
  10935. $core.method({
  10936. selector: "asJavaScriptObject",
  10937. protocol: "converting",
  10938. fn: function (){
  10939. var self=this,$self=this;
  10940. return self;
  10941. },
  10942. args: [],
  10943. source: "asJavaScriptObject\x0a\x09^ self",
  10944. referencedClasses: [],
  10945. messageSends: []
  10946. }),
  10947. $globals.String);
  10948. $core.addMethod(
  10949. $core.method({
  10950. selector: "asJavaScriptSource",
  10951. protocol: "converting",
  10952. fn: function (){
  10953. var self=this,$self=this;
  10954. return $core.withContext(function($ctx1) {
  10955. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  10956. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  10957. else
  10958. return "\"" + self + "\"";
  10959. ;
  10960. return self;
  10961. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.String)});
  10962. },
  10963. args: [],
  10964. source: "asJavaScriptSource\x0a\x09<inlineJS: '\x0a\x09\x09if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)\x0a\x09\x09\x09return \x22\x5c\x22\x22 + self.replace(/[\x5cx00-\x5cx1f\x22\x5c\x5c\x5cx7f-\x5cx9f]/g, function(ch){var c=ch.charCodeAt(0);return \x22\x5c\x5cx\x22+(\x220\x22+c.toString(16)).slice(-2)}) + \x22\x5c\x22\x22;\x0a\x09\x09else\x0a\x09\x09\x09return \x22\x5c\x22\x22 + self + \x22\x5c\x22\x22;\x0a\x09'>",
  10965. referencedClasses: [],
  10966. messageSends: []
  10967. }),
  10968. $globals.String);
  10969. $core.addMethod(
  10970. $core.method({
  10971. selector: "asLowercase",
  10972. protocol: "converting",
  10973. fn: function (){
  10974. var self=this,$self=this;
  10975. return $core.withContext(function($ctx1) {
  10976. return self.toLowerCase();
  10977. return self;
  10978. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.String)});
  10979. },
  10980. args: [],
  10981. source: "asLowercase\x0a\x09<inlineJS: 'return self.toLowerCase()'>",
  10982. referencedClasses: [],
  10983. messageSends: []
  10984. }),
  10985. $globals.String);
  10986. $core.addMethod(
  10987. $core.method({
  10988. selector: "asMutator",
  10989. protocol: "converting",
  10990. fn: function (){
  10991. var self=this,$self=this;
  10992. return $core.withContext(function($ctx1) {
  10993. var $1;
  10994. $1=$recv($self._last()).__eq(":");
  10995. if(!$core.assert($1)){
  10996. return $self.__comma(":");
  10997. }
  10998. return self;
  10999. }, function($ctx1) {$ctx1.fill(self,"asMutator",{},$globals.String)});
  11000. },
  11001. args: [],
  11002. source: "asMutator\x0a\x09\x22Answer a setter selector. For example,\x0a\x09#name asMutator returns #name:\x22\x0a\x0a\x09self last = ':' ifFalse: [ ^ self, ':' ].\x0a\x09^ self",
  11003. referencedClasses: [],
  11004. messageSends: ["ifFalse:", "=", "last", ","]
  11005. }),
  11006. $globals.String);
  11007. $core.addMethod(
  11008. $core.method({
  11009. selector: "asNumber",
  11010. protocol: "converting",
  11011. fn: function (){
  11012. var self=this,$self=this;
  11013. return $core.withContext(function($ctx1) {
  11014. return Number(self);
  11015. return self;
  11016. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.String)});
  11017. },
  11018. args: [],
  11019. source: "asNumber\x0a\x09<inlineJS: 'return Number(self)'>",
  11020. referencedClasses: [],
  11021. messageSends: []
  11022. }),
  11023. $globals.String);
  11024. $core.addMethod(
  11025. $core.method({
  11026. selector: "asRegexp",
  11027. protocol: "converting",
  11028. fn: function (){
  11029. var self=this,$self=this;
  11030. return $core.withContext(function($ctx1) {
  11031. return $recv($globals.RegularExpression)._fromString_(self);
  11032. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},$globals.String)});
  11033. },
  11034. args: [],
  11035. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  11036. referencedClasses: ["RegularExpression"],
  11037. messageSends: ["fromString:"]
  11038. }),
  11039. $globals.String);
  11040. $core.addMethod(
  11041. $core.method({
  11042. selector: "asString",
  11043. protocol: "converting",
  11044. fn: function (){
  11045. var self=this,$self=this;
  11046. return self;
  11047. },
  11048. args: [],
  11049. source: "asString\x0a\x09^ self",
  11050. referencedClasses: [],
  11051. messageSends: []
  11052. }),
  11053. $globals.String);
  11054. $core.addMethod(
  11055. $core.method({
  11056. selector: "asSymbol",
  11057. protocol: "converting",
  11058. fn: function (){
  11059. var self=this,$self=this;
  11060. return self;
  11061. },
  11062. args: [],
  11063. source: "asSymbol\x0a\x09^ self",
  11064. referencedClasses: [],
  11065. messageSends: []
  11066. }),
  11067. $globals.String);
  11068. $core.addMethod(
  11069. $core.method({
  11070. selector: "asSymbolPrintOn:",
  11071. protocol: "printing",
  11072. fn: function (aStream){
  11073. var self=this,$self=this;
  11074. return $core.withContext(function($ctx1) {
  11075. var $1;
  11076. $recv(aStream)._nextPutAll_("#");
  11077. $1=$recv($self._asString())._isSelector();
  11078. if($core.assert($1)){
  11079. $recv(aStream)._nextPut_(self);
  11080. } else {
  11081. $self._printOn_(aStream);
  11082. }
  11083. return self;
  11084. }, function($ctx1) {$ctx1.fill(self,"asSymbolPrintOn:",{aStream:aStream},$globals.String)});
  11085. },
  11086. args: ["aStream"],
  11087. source: "asSymbolPrintOn: aStream\x0a\x09aStream nextPutAll: '#'.\x0a\x09self asString isSelector\x0a\x09\x09ifTrue: [ aStream nextPut: self ]\x0a\x09\x09ifFalse: [ self printOn: aStream ]",
  11088. referencedClasses: [],
  11089. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isSelector", "asString", "nextPut:", "printOn:"]
  11090. }),
  11091. $globals.String);
  11092. $core.addMethod(
  11093. $core.method({
  11094. selector: "asUppercase",
  11095. protocol: "converting",
  11096. fn: function (){
  11097. var self=this,$self=this;
  11098. return $core.withContext(function($ctx1) {
  11099. return self.toUpperCase();
  11100. return self;
  11101. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.String)});
  11102. },
  11103. args: [],
  11104. source: "asUppercase\x0a\x09<inlineJS: 'return self.toUpperCase()'>",
  11105. referencedClasses: [],
  11106. messageSends: []
  11107. }),
  11108. $globals.String);
  11109. $core.addMethod(
  11110. $core.method({
  11111. selector: "asciiValue",
  11112. protocol: "accessing",
  11113. fn: function (){
  11114. var self=this,$self=this;
  11115. return $core.withContext(function($ctx1) {
  11116. return self.charCodeAt(0);;
  11117. return self;
  11118. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{},$globals.String)});
  11119. },
  11120. args: [],
  11121. source: "asciiValue\x0a\x09<inlineJS: 'return self.charCodeAt(0);'>",
  11122. referencedClasses: [],
  11123. messageSends: []
  11124. }),
  11125. $globals.String);
  11126. $core.addMethod(
  11127. $core.method({
  11128. selector: "at:ifAbsent:",
  11129. protocol: "accessing",
  11130. fn: function (anIndex,aBlock){
  11131. var self=this,$self=this;
  11132. return $core.withContext(function($ctx1) {
  11133. return String(self)[anIndex - 1] || aBlock._value();
  11134. return self;
  11135. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.String)});
  11136. },
  11137. args: ["anIndex", "aBlock"],
  11138. source: "at: anIndex ifAbsent: aBlock\x0a\x09<inlineJS: 'return String(self)[anIndex - 1] || aBlock._value()'>",
  11139. referencedClasses: [],
  11140. messageSends: []
  11141. }),
  11142. $globals.String);
  11143. $core.addMethod(
  11144. $core.method({
  11145. selector: "at:ifPresent:ifAbsent:",
  11146. protocol: "accessing",
  11147. fn: function (anIndex,aBlock,anotherBlock){
  11148. var self=this,$self=this;
  11149. return $core.withContext(function($ctx1) {
  11150. var result = String(self)[anIndex - 1];
  11151. return result ? aBlock._value_(result) : anotherBlock._value();
  11152. ;
  11153. return self;
  11154. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.String)});
  11155. },
  11156. args: ["anIndex", "aBlock", "anotherBlock"],
  11157. source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09<inlineJS: '\x0a\x09\x09var result = String(self)[anIndex - 1];\x0a\x09\x09return result ? aBlock._value_(result) : anotherBlock._value();\x0a\x09'>",
  11158. referencedClasses: [],
  11159. messageSends: []
  11160. }),
  11161. $globals.String);
  11162. $core.addMethod(
  11163. $core.method({
  11164. selector: "at:put:",
  11165. protocol: "accessing",
  11166. fn: function (anIndex,anObject){
  11167. var self=this,$self=this;
  11168. return $core.withContext(function($ctx1) {
  11169. $self._errorReadOnly();
  11170. return self;
  11171. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.String)});
  11172. },
  11173. args: ["anIndex", "anObject"],
  11174. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  11175. referencedClasses: [],
  11176. messageSends: ["errorReadOnly"]
  11177. }),
  11178. $globals.String);
  11179. $core.addMethod(
  11180. $core.method({
  11181. selector: "capitalized",
  11182. protocol: "converting",
  11183. fn: function (){
  11184. var self=this,$self=this;
  11185. return $core.withContext(function($ctx1) {
  11186. return $self._ifNotEmpty_((function(){
  11187. return $core.withContext(function($ctx2) {
  11188. return $recv($recv($self._first())._asUppercase()).__comma($self._allButFirst());
  11189. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11190. }));
  11191. }, function($ctx1) {$ctx1.fill(self,"capitalized",{},$globals.String)});
  11192. },
  11193. args: [],
  11194. source: "capitalized\x0a\x09^ self ifNotEmpty: [ self first asUppercase, self allButFirst ]",
  11195. referencedClasses: [],
  11196. messageSends: ["ifNotEmpty:", ",", "asUppercase", "first", "allButFirst"]
  11197. }),
  11198. $globals.String);
  11199. $core.addMethod(
  11200. $core.method({
  11201. selector: "charCodeAt:",
  11202. protocol: "accessing",
  11203. fn: function (anInteger){
  11204. var self=this,$self=this;
  11205. return $core.withContext(function($ctx1) {
  11206. return self.charCodeAt(anInteger - 1);
  11207. return self;
  11208. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},$globals.String)});
  11209. },
  11210. args: ["anInteger"],
  11211. source: "charCodeAt: anInteger\x0a\x09<inlineJS: 'return self.charCodeAt(anInteger - 1)'>",
  11212. referencedClasses: [],
  11213. messageSends: []
  11214. }),
  11215. $globals.String);
  11216. $core.addMethod(
  11217. $core.method({
  11218. selector: "copyFrom:to:",
  11219. protocol: "copying",
  11220. fn: function (anIndex,anotherIndex){
  11221. var self=this,$self=this;
  11222. return $core.withContext(function($ctx1) {
  11223. return self.substring(anIndex - 1, anotherIndex);
  11224. return self;
  11225. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.String)});
  11226. },
  11227. args: ["anIndex", "anotherIndex"],
  11228. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<inlineJS: 'return self.substring(anIndex - 1, anotherIndex)'>",
  11229. referencedClasses: [],
  11230. messageSends: []
  11231. }),
  11232. $globals.String);
  11233. $core.addMethod(
  11234. $core.method({
  11235. selector: "crlfSanitized",
  11236. protocol: "converting",
  11237. fn: function (){
  11238. var self=this,$self=this;
  11239. return $core.withContext(function($ctx1) {
  11240. return $recv($self._lines())._join_($recv($globals.String)._lf());
  11241. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},$globals.String)});
  11242. },
  11243. args: [],
  11244. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  11245. referencedClasses: ["String"],
  11246. messageSends: ["join:", "lines", "lf"]
  11247. }),
  11248. $globals.String);
  11249. $core.addMethod(
  11250. $core.method({
  11251. selector: "deepCopy",
  11252. protocol: "copying",
  11253. fn: function (){
  11254. var self=this,$self=this;
  11255. return $core.withContext(function($ctx1) {
  11256. return $self._shallowCopy();
  11257. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.String)});
  11258. },
  11259. args: [],
  11260. source: "deepCopy\x0a\x09^ self shallowCopy",
  11261. referencedClasses: [],
  11262. messageSends: ["shallowCopy"]
  11263. }),
  11264. $globals.String);
  11265. $core.addMethod(
  11266. $core.method({
  11267. selector: "errorReadOnly",
  11268. protocol: "error handling",
  11269. fn: function (){
  11270. var self=this,$self=this;
  11271. return $core.withContext(function($ctx1) {
  11272. $self._error_("Object is read-only");
  11273. return self;
  11274. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},$globals.String)});
  11275. },
  11276. args: [],
  11277. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  11278. referencedClasses: [],
  11279. messageSends: ["error:"]
  11280. }),
  11281. $globals.String);
  11282. $core.addMethod(
  11283. $core.method({
  11284. selector: "escaped",
  11285. protocol: "converting",
  11286. fn: function (){
  11287. var self=this,$self=this;
  11288. return $core.withContext(function($ctx1) {
  11289. return escape(self);
  11290. return self;
  11291. }, function($ctx1) {$ctx1.fill(self,"escaped",{},$globals.String)});
  11292. },
  11293. args: [],
  11294. source: "escaped\x0a\x09<inlineJS: 'return escape(self)'>",
  11295. referencedClasses: [],
  11296. messageSends: []
  11297. }),
  11298. $globals.String);
  11299. $core.addMethod(
  11300. $core.method({
  11301. selector: "includesSubString:",
  11302. protocol: "testing",
  11303. fn: function (subString){
  11304. var self=this,$self=this;
  11305. return $core.withContext(function($ctx1) {
  11306. return self.indexOf(subString) != -1;
  11307. return self;
  11308. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},$globals.String)});
  11309. },
  11310. args: ["subString"],
  11311. source: "includesSubString: subString\x0a\x09<inlineJS: 'return self.indexOf(subString) != -1'>",
  11312. referencedClasses: [],
  11313. messageSends: []
  11314. }),
  11315. $globals.String);
  11316. $core.addMethod(
  11317. $core.method({
  11318. selector: "isCapitalized",
  11319. protocol: "testing",
  11320. fn: function (){
  11321. var self=this,$self=this;
  11322. return $core.withContext(function($ctx1) {
  11323. var $2,$1;
  11324. $2=$self._first();
  11325. $ctx1.sendIdx["first"]=1;
  11326. $1=$recv($2)._asUppercase();
  11327. return $recv($1).__eq_eq($self._first());
  11328. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{},$globals.String)});
  11329. },
  11330. args: [],
  11331. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  11332. referencedClasses: [],
  11333. messageSends: ["==", "asUppercase", "first"]
  11334. }),
  11335. $globals.String);
  11336. $core.addMethod(
  11337. $core.method({
  11338. selector: "isImmutable",
  11339. protocol: "testing",
  11340. fn: function (){
  11341. var self=this,$self=this;
  11342. return true;
  11343. },
  11344. args: [],
  11345. source: "isImmutable\x0a\x09^ true",
  11346. referencedClasses: [],
  11347. messageSends: []
  11348. }),
  11349. $globals.String);
  11350. $core.addMethod(
  11351. $core.method({
  11352. selector: "isSelector",
  11353. protocol: "testing",
  11354. fn: function (){
  11355. var self=this,$self=this;
  11356. return $core.withContext(function($ctx1) {
  11357. return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\\+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\:)+)$/);
  11358. return self;
  11359. }, function($ctx1) {$ctx1.fill(self,"isSelector",{},$globals.String)});
  11360. },
  11361. args: [],
  11362. source: "isSelector\x0a<inlineJS:\x0a\x09'return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\x5c\x5c+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\x5c:)+)$/)'\x0a>",
  11363. referencedClasses: [],
  11364. messageSends: []
  11365. }),
  11366. $globals.String);
  11367. $core.addMethod(
  11368. $core.method({
  11369. selector: "isString",
  11370. protocol: "testing",
  11371. fn: function (){
  11372. var self=this,$self=this;
  11373. return true;
  11374. },
  11375. args: [],
  11376. source: "isString\x0a\x09^ true",
  11377. referencedClasses: [],
  11378. messageSends: []
  11379. }),
  11380. $globals.String);
  11381. $core.addMethod(
  11382. $core.method({
  11383. selector: "isVowel",
  11384. protocol: "testing",
  11385. fn: function (){
  11386. var self=this,$self=this;
  11387. return $core.withContext(function($ctx1) {
  11388. return $recv($recv($self._size()).__eq((1)))._and_((function(){
  11389. return $core.withContext(function($ctx2) {
  11390. return "aeiou"._includes_($self._asLowercase());
  11391. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11392. }));
  11393. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},$globals.String)});
  11394. },
  11395. args: [],
  11396. source: "isVowel\x0a\x09\x22Answer true if the receiver is a one character string containing a voyel\x22\x0a\x09\x0a\x09^ self size = 1 and: [ 'aeiou' includes: self asLowercase ]",
  11397. referencedClasses: [],
  11398. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  11399. }),
  11400. $globals.String);
  11401. $core.addMethod(
  11402. $core.method({
  11403. selector: "join:",
  11404. protocol: "split join",
  11405. fn: function (aCollection){
  11406. var self=this,$self=this;
  11407. return $core.withContext(function($ctx1) {
  11408. return $recv($globals.String)._streamContents_((function(stream){
  11409. return $core.withContext(function($ctx2) {
  11410. return $recv(aCollection)._do_separatedBy_((function(each){
  11411. return $core.withContext(function($ctx3) {
  11412. return $recv(stream)._nextPutAll_($recv(each)._asString());
  11413. $ctx3.sendIdx["nextPutAll:"]=1;
  11414. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  11415. }),(function(){
  11416. return $core.withContext(function($ctx3) {
  11417. return $recv(stream)._nextPutAll_(self);
  11418. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  11419. }));
  11420. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  11421. }));
  11422. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},$globals.String)});
  11423. },
  11424. args: ["aCollection"],
  11425. source: "join: aCollection\x0a\x09^ String\x0a\x09\x09streamContents: [ :stream | aCollection\x0a\x09\x09\x09\x09do: [ :each | stream nextPutAll: each asString ]\x0a\x09\x09\x09\x09separatedBy: [ stream nextPutAll: self ]]",
  11426. referencedClasses: ["String"],
  11427. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  11428. }),
  11429. $globals.String);
  11430. $core.addMethod(
  11431. $core.method({
  11432. selector: "lineIndicesDo:",
  11433. protocol: "split join",
  11434. fn: function (aBlock){
  11435. var self=this,$self=this;
  11436. var cr,lf,start,sz,nextLF,nextCR;
  11437. return $core.withContext(function($ctx1) {
  11438. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  11439. var $early={};
  11440. try {
  11441. start=(1);
  11442. sz=$self._size();
  11443. cr=$recv($globals.String)._cr();
  11444. nextCR=$self._indexOf_startingAt_(cr,(1));
  11445. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  11446. lf=$recv($globals.String)._lf();
  11447. nextLF=$self._indexOf_startingAt_(lf,(1));
  11448. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  11449. $recv((function(){
  11450. return $core.withContext(function($ctx2) {
  11451. return $recv(start).__lt_eq(sz);
  11452. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11453. }))._whileTrue_((function(){
  11454. return $core.withContext(function($ctx2) {
  11455. $2=$recv(nextLF).__eq((0));
  11456. $ctx2.sendIdx["="]=1;
  11457. $1=$recv($2)._and_((function(){
  11458. return $core.withContext(function($ctx3) {
  11459. return $recv(nextCR).__eq((0));
  11460. $ctx3.sendIdx["="]=2;
  11461. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  11462. }));
  11463. $ctx2.sendIdx["and:"]=1;
  11464. if($core.assert($1)){
  11465. $recv(aBlock)._value_value_value_(start,sz,sz);
  11466. $ctx2.sendIdx["value:value:value:"]=1;
  11467. throw $early=[self];
  11468. }
  11469. $4=$recv(nextCR).__eq((0));
  11470. $ctx2.sendIdx["="]=3;
  11471. $3=$recv($4)._or_((function(){
  11472. return $core.withContext(function($ctx3) {
  11473. $5=(0).__lt(nextLF);
  11474. $ctx3.sendIdx["<"]=1;
  11475. return $recv($5)._and_((function(){
  11476. return $core.withContext(function($ctx4) {
  11477. return $recv(nextLF).__lt(nextCR);
  11478. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  11479. }));
  11480. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  11481. }));
  11482. if($core.assert($3)){
  11483. $6=start;
  11484. $7=$recv(nextLF).__minus((1));
  11485. $ctx2.sendIdx["-"]=1;
  11486. $recv(aBlock)._value_value_value_($6,$7,nextLF);
  11487. $ctx2.sendIdx["value:value:value:"]=2;
  11488. start=(1).__plus(nextLF);
  11489. $ctx2.sendIdx["+"]=1;
  11490. nextLF=$self._indexOf_startingAt_(lf,start);
  11491. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  11492. return nextLF;
  11493. } else {
  11494. $9=(1).__plus(nextCR);
  11495. $ctx2.sendIdx["+"]=2;
  11496. $8=$recv($9).__eq(nextLF);
  11497. if($core.assert($8)){
  11498. $10=start;
  11499. $11=$recv(nextCR).__minus((1));
  11500. $ctx2.sendIdx["-"]=2;
  11501. $recv(aBlock)._value_value_value_($10,$11,nextLF);
  11502. $ctx2.sendIdx["value:value:value:"]=3;
  11503. start=(1).__plus(nextLF);
  11504. $ctx2.sendIdx["+"]=3;
  11505. nextCR=$self._indexOf_startingAt_(cr,start);
  11506. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  11507. nextLF=$self._indexOf_startingAt_(lf,start);
  11508. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  11509. return nextLF;
  11510. } else {
  11511. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  11512. start=(1).__plus(nextCR);
  11513. nextCR=$self._indexOf_startingAt_(cr,start);
  11514. return nextCR;
  11515. }
  11516. }
  11517. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  11518. }));
  11519. return self;
  11520. }
  11521. catch(e) {if(e===$early)return e[0]; throw e}
  11522. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},$globals.String)});
  11523. },
  11524. args: ["aBlock"],
  11525. source: "lineIndicesDo: aBlock\x0a\x09\x22execute aBlock with 3 arguments for each line:\x0a\x09- start index of line\x0a\x09- end index of line without line delimiter\x0a\x09- end index of line including line delimiter(s) CR, LF or CRLF\x22\x0a\x09\x0a\x09| cr lf start sz nextLF nextCR |\x0a\x09start := 1.\x0a\x09sz := self size.\x0a\x09cr := String cr.\x0a\x09nextCR := self indexOf: cr startingAt: 1.\x0a\x09lf := String lf.\x0a\x09nextLF := self indexOf: lf startingAt: 1.\x0a\x09[ start <= sz ] whileTrue: [ \x0a\x09\x09(nextLF = 0 and: [ nextCR = 0 ])\x0a\x09\x09\x09ifTrue: [ \x22No more CR, nor LF, the string is over\x22\x0a\x09\x09\x09\x09\x09aBlock value: start value: sz value: sz.\x0a\x09\x09\x09\x09\x09^ self ].\x0a\x09\x09(nextCR = 0 or: [ 0 < nextLF and: [ nextLF < nextCR ] ])\x0a\x09\x09\x09ifTrue: [ \x22Found a LF\x22\x0a\x09\x09\x09\x09\x09aBlock value: start value: nextLF - 1 value: nextLF.\x0a\x09\x09\x09\x09\x09start := 1 + nextLF.\x0a\x09\x09\x09\x09\x09nextLF := self indexOf: lf startingAt: start ]\x0a\x09\x09\x09ifFalse: [ 1 + nextCR = nextLF\x0a\x09\x09\x09\x09ifTrue: [ \x22Found a CR-LF pair\x22\x0a\x09\x09\x09\x09\x09aBlock value: start value: nextCR - 1 value: nextLF.\x0a\x09\x09\x09\x09\x09start := 1 + nextLF.\x0a\x09\x09\x09\x09\x09nextCR := self indexOf: cr startingAt: start.\x0a\x09\x09\x09\x09\x09nextLF := self indexOf: lf startingAt: start ]\x0a\x09\x09\x09\x09ifFalse: [ \x22Found a CR\x22\x0a\x09\x09\x09\x09\x09aBlock value: start value: nextCR - 1 value: nextCR.\x0a\x09\x09\x09\x09\x09start := 1 + nextCR.\x0a\x09\x09\x09\x09\x09nextCR := self indexOf: cr startingAt: start ] ]]",
  11526. referencedClasses: ["String"],
  11527. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  11528. }),
  11529. $globals.String);
  11530. $core.addMethod(
  11531. $core.method({
  11532. selector: "lineNumber:",
  11533. protocol: "split join",
  11534. fn: function (anIndex){
  11535. var self=this,$self=this;
  11536. var lineCount;
  11537. return $core.withContext(function($ctx1) {
  11538. var $2,$1;
  11539. var $early={};
  11540. try {
  11541. lineCount=(0);
  11542. $self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  11543. return $core.withContext(function($ctx2) {
  11544. lineCount=$recv(lineCount).__plus((1));
  11545. $2=lineCount;
  11546. $1=$recv($2).__eq(anIndex);
  11547. if($core.assert($1)){
  11548. throw $early=[$self._copyFrom_to_(start,endWithoutDelimiters)];
  11549. }
  11550. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  11551. }));
  11552. return nil;
  11553. }
  11554. catch(e) {if(e===$early)return e[0]; throw e}
  11555. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},$globals.String)});
  11556. },
  11557. args: ["anIndex"],
  11558. source: "lineNumber: anIndex\x0a\x09\x22Answer a string containing the characters in the given line number.\x22\x0a\x0a\x09| lineCount |\x0a\x09lineCount := 0.\x0a\x09self lineIndicesDo: [ :start :endWithoutDelimiters :end |\x0a\x09\x09(lineCount := lineCount + 1) = anIndex ifTrue: [ ^ self copyFrom: start to: endWithoutDelimiters ]].\x0a\x09^ nil",
  11559. referencedClasses: [],
  11560. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  11561. }),
  11562. $globals.String);
  11563. $core.addMethod(
  11564. $core.method({
  11565. selector: "lines",
  11566. protocol: "split join",
  11567. fn: function (){
  11568. var self=this,$self=this;
  11569. return $core.withContext(function($ctx1) {
  11570. var result = self.split(/\r\n|\r|\n/);
  11571. if (!result[result.length-1]) result.pop();
  11572. return result;;
  11573. return self;
  11574. }, function($ctx1) {$ctx1.fill(self,"lines",{},$globals.String)});
  11575. },
  11576. args: [],
  11577. source: "lines\x0a\x09\x22Answer an array of lines composing this receiver without the line ending delimiters.\x22\x0a<inlineJS: '\x0a\x09var result = self.split(/\x5cr\x5cn|\x5cr|\x5cn/);\x0a\x09if (!result[result.length-1]) result.pop();\x0a\x09return result;\x0a'>",
  11578. referencedClasses: [],
  11579. messageSends: []
  11580. }),
  11581. $globals.String);
  11582. $core.addMethod(
  11583. $core.method({
  11584. selector: "linesDo:",
  11585. protocol: "split join",
  11586. fn: function (aBlock){
  11587. var self=this,$self=this;
  11588. return $core.withContext(function($ctx1) {
  11589. $recv($self._lines())._do_(aBlock);
  11590. return self;
  11591. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},$globals.String)});
  11592. },
  11593. args: ["aBlock"],
  11594. source: "linesDo: aBlock\x0a\x09\x22Execute aBlock with each line in this string. The terminating line\x0a\x09delimiters CR, LF or CRLF pairs are not included in what is passed to aBlock\x22\x0a\x0a\x09self lines do: aBlock",
  11595. referencedClasses: [],
  11596. messageSends: ["do:", "lines"]
  11597. }),
  11598. $globals.String);
  11599. $core.addMethod(
  11600. $core.method({
  11601. selector: "match:",
  11602. protocol: "regular expressions",
  11603. fn: function (aRegexp){
  11604. var self=this,$self=this;
  11605. return $core.withContext(function($ctx1) {
  11606. return self.search(aRegexp) != -1;
  11607. return self;
  11608. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},$globals.String)});
  11609. },
  11610. args: ["aRegexp"],
  11611. source: "match: aRegexp\x0a\x09<inlineJS: 'return self.search(aRegexp) != -1'>",
  11612. referencedClasses: [],
  11613. messageSends: []
  11614. }),
  11615. $globals.String);
  11616. $core.addMethod(
  11617. $core.method({
  11618. selector: "matchesOf:",
  11619. protocol: "regular expressions",
  11620. fn: function (aRegularExpression){
  11621. var self=this,$self=this;
  11622. return $core.withContext(function($ctx1) {
  11623. return self.match(aRegularExpression);
  11624. return self;
  11625. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},$globals.String)});
  11626. },
  11627. args: ["aRegularExpression"],
  11628. source: "matchesOf: aRegularExpression\x0a\x09<inlineJS: 'return self.match(aRegularExpression)'>",
  11629. referencedClasses: [],
  11630. messageSends: []
  11631. }),
  11632. $globals.String);
  11633. $core.addMethod(
  11634. $core.method({
  11635. selector: "printNl",
  11636. protocol: "printing",
  11637. fn: function (){
  11638. var self=this,$self=this;
  11639. return $core.withContext(function($ctx1) {
  11640. console.log(self);
  11641. return self;
  11642. }, function($ctx1) {$ctx1.fill(self,"printNl",{},$globals.String)});
  11643. },
  11644. args: [],
  11645. source: "printNl\x0a\x09<inlineJS: 'console.log(self)'>",
  11646. referencedClasses: [],
  11647. messageSends: []
  11648. }),
  11649. $globals.String);
  11650. $core.addMethod(
  11651. $core.method({
  11652. selector: "printOn:",
  11653. protocol: "printing",
  11654. fn: function (aStream){
  11655. var self=this,$self=this;
  11656. return $core.withContext(function($ctx1) {
  11657. $recv(aStream)._nextPutAll_("'");
  11658. $ctx1.sendIdx["nextPutAll:"]=1;
  11659. $recv(aStream)._nextPutAll_($self._replace_with_("'","''"));
  11660. $ctx1.sendIdx["nextPutAll:"]=2;
  11661. $recv(aStream)._nextPutAll_("'");
  11662. return self;
  11663. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.String)});
  11664. },
  11665. args: ["aStream"],
  11666. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: (self replace: '''' with: '''''');\x0a\x09\x09nextPutAll: ''''",
  11667. referencedClasses: [],
  11668. messageSends: ["nextPutAll:", "replace:with:"]
  11669. }),
  11670. $globals.String);
  11671. $core.addMethod(
  11672. $core.method({
  11673. selector: "putOn:",
  11674. protocol: "streaming",
  11675. fn: function (aStream){
  11676. var self=this,$self=this;
  11677. return $core.withContext(function($ctx1) {
  11678. $recv(aStream)._nextPutString_(self);
  11679. return self;
  11680. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.String)});
  11681. },
  11682. args: ["aStream"],
  11683. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  11684. referencedClasses: [],
  11685. messageSends: ["nextPutString:"]
  11686. }),
  11687. $globals.String);
  11688. $core.addMethod(
  11689. $core.method({
  11690. selector: "remove:",
  11691. protocol: "adding/removing",
  11692. fn: function (anObject){
  11693. var self=this,$self=this;
  11694. return $core.withContext(function($ctx1) {
  11695. $self._errorReadOnly();
  11696. return self;
  11697. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.String)});
  11698. },
  11699. args: ["anObject"],
  11700. source: "remove: anObject\x0a\x09self errorReadOnly",
  11701. referencedClasses: [],
  11702. messageSends: ["errorReadOnly"]
  11703. }),
  11704. $globals.String);
  11705. $core.addMethod(
  11706. $core.method({
  11707. selector: "remove:ifAbsent:",
  11708. protocol: "adding/removing",
  11709. fn: function (anObject,aBlock){
  11710. var self=this,$self=this;
  11711. return $core.withContext(function($ctx1) {
  11712. $self._errorReadOnly();
  11713. return self;
  11714. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.String)});
  11715. },
  11716. args: ["anObject", "aBlock"],
  11717. source: "remove: anObject ifAbsent: aBlock\x0a\x09self errorReadOnly",
  11718. referencedClasses: [],
  11719. messageSends: ["errorReadOnly"]
  11720. }),
  11721. $globals.String);
  11722. $core.addMethod(
  11723. $core.method({
  11724. selector: "replace:with:",
  11725. protocol: "regular expressions",
  11726. fn: function (aString,anotherString){
  11727. var self=this,$self=this;
  11728. return $core.withContext(function($ctx1) {
  11729. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_(aString,"g"),anotherString);
  11730. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},$globals.String)});
  11731. },
  11732. args: ["aString", "anotherString"],
  11733. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  11734. referencedClasses: ["RegularExpression"],
  11735. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  11736. }),
  11737. $globals.String);
  11738. $core.addMethod(
  11739. $core.method({
  11740. selector: "replaceRegexp:with:",
  11741. protocol: "regular expressions",
  11742. fn: function (aRegexp,aString){
  11743. var self=this,$self=this;
  11744. return $core.withContext(function($ctx1) {
  11745. return self.replace(aRegexp, aString);
  11746. return self;
  11747. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},$globals.String)});
  11748. },
  11749. args: ["aRegexp", "aString"],
  11750. source: "replaceRegexp: aRegexp with: aString\x0a\x09<inlineJS: 'return self.replace(aRegexp, aString)'>",
  11751. referencedClasses: [],
  11752. messageSends: []
  11753. }),
  11754. $globals.String);
  11755. $core.addMethod(
  11756. $core.method({
  11757. selector: "reversed",
  11758. protocol: "converting",
  11759. fn: function (){
  11760. var self=this,$self=this;
  11761. return $core.withContext(function($ctx1) {
  11762. return self.split("").reverse().join("");
  11763. return self;
  11764. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.String)});
  11765. },
  11766. args: [],
  11767. source: "reversed\x0a\x09<inlineJS: 'return self.split(\x22\x22).reverse().join(\x22\x22)'>",
  11768. referencedClasses: [],
  11769. messageSends: []
  11770. }),
  11771. $globals.String);
  11772. $core.addMethod(
  11773. $core.method({
  11774. selector: "shallowCopy",
  11775. protocol: "copying",
  11776. fn: function (){
  11777. var self=this,$self=this;
  11778. return self;
  11779. },
  11780. args: [],
  11781. source: "shallowCopy\x0a\x09^ self",
  11782. referencedClasses: [],
  11783. messageSends: []
  11784. }),
  11785. $globals.String);
  11786. $core.addMethod(
  11787. $core.method({
  11788. selector: "subStrings:",
  11789. protocol: "split join",
  11790. fn: function (aString){
  11791. var self=this,$self=this;
  11792. return $core.withContext(function($ctx1) {
  11793. return $self._tokenize_(aString);
  11794. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},$globals.String)});
  11795. },
  11796. args: ["aString"],
  11797. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  11798. referencedClasses: [],
  11799. messageSends: ["tokenize:"]
  11800. }),
  11801. $globals.String);
  11802. $core.addMethod(
  11803. $core.method({
  11804. selector: "symbolPrintString",
  11805. protocol: "printing",
  11806. fn: function (){
  11807. var self=this,$self=this;
  11808. return $core.withContext(function($ctx1) {
  11809. return $recv($globals.String)._streamContents_((function(str){
  11810. return $core.withContext(function($ctx2) {
  11811. return $self._asSymbolPrintOn_(str);
  11812. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  11813. }));
  11814. }, function($ctx1) {$ctx1.fill(self,"symbolPrintString",{},$globals.String)});
  11815. },
  11816. args: [],
  11817. source: "symbolPrintString\x0a\x09^ String streamContents: [ :str | self asSymbolPrintOn: str ]",
  11818. referencedClasses: ["String"],
  11819. messageSends: ["streamContents:", "asSymbolPrintOn:"]
  11820. }),
  11821. $globals.String);
  11822. $core.addMethod(
  11823. $core.method({
  11824. selector: "tokenize:",
  11825. protocol: "split join",
  11826. fn: function (aString){
  11827. var self=this,$self=this;
  11828. return $core.withContext(function($ctx1) {
  11829. return self.split(aString);
  11830. return self;
  11831. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},$globals.String)});
  11832. },
  11833. args: ["aString"],
  11834. source: "tokenize: aString\x0a\x09<inlineJS: 'return self.split(aString)'>",
  11835. referencedClasses: [],
  11836. messageSends: []
  11837. }),
  11838. $globals.String);
  11839. $core.addMethod(
  11840. $core.method({
  11841. selector: "trimBoth",
  11842. protocol: "regular expressions",
  11843. fn: function (){
  11844. var self=this,$self=this;
  11845. return $core.withContext(function($ctx1) {
  11846. return $self._trimBoth_("\x5cs");
  11847. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},$globals.String)});
  11848. },
  11849. args: [],
  11850. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  11851. referencedClasses: [],
  11852. messageSends: ["trimBoth:"]
  11853. }),
  11854. $globals.String);
  11855. $core.addMethod(
  11856. $core.method({
  11857. selector: "trimBoth:",
  11858. protocol: "regular expressions",
  11859. fn: function (separators){
  11860. var self=this,$self=this;
  11861. return $core.withContext(function($ctx1) {
  11862. return $recv($self._trimLeft_(separators))._trimRight_(separators);
  11863. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},$globals.String)});
  11864. },
  11865. args: ["separators"],
  11866. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  11867. referencedClasses: [],
  11868. messageSends: ["trimRight:", "trimLeft:"]
  11869. }),
  11870. $globals.String);
  11871. $core.addMethod(
  11872. $core.method({
  11873. selector: "trimLeft",
  11874. protocol: "regular expressions",
  11875. fn: function (){
  11876. var self=this,$self=this;
  11877. return $core.withContext(function($ctx1) {
  11878. return $self._trimLeft_("\x5cs");
  11879. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},$globals.String)});
  11880. },
  11881. args: [],
  11882. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  11883. referencedClasses: [],
  11884. messageSends: ["trimLeft:"]
  11885. }),
  11886. $globals.String);
  11887. $core.addMethod(
  11888. $core.method({
  11889. selector: "trimLeft:",
  11890. protocol: "regular expressions",
  11891. fn: function (separators){
  11892. var self=this,$self=this;
  11893. return $core.withContext(function($ctx1) {
  11894. var $2,$1;
  11895. $2=$recv("^[".__comma(separators)).__comma("]+");
  11896. $ctx1.sendIdx[","]=1;
  11897. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  11898. return $self._replaceRegexp_with_($1,"");
  11899. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},$globals.String)});
  11900. },
  11901. args: ["separators"],
  11902. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  11903. referencedClasses: ["RegularExpression"],
  11904. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  11905. }),
  11906. $globals.String);
  11907. $core.addMethod(
  11908. $core.method({
  11909. selector: "trimRight",
  11910. protocol: "regular expressions",
  11911. fn: function (){
  11912. var self=this,$self=this;
  11913. return $core.withContext(function($ctx1) {
  11914. return $self._trimRight_("\x5cs");
  11915. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},$globals.String)});
  11916. },
  11917. args: [],
  11918. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  11919. referencedClasses: [],
  11920. messageSends: ["trimRight:"]
  11921. }),
  11922. $globals.String);
  11923. $core.addMethod(
  11924. $core.method({
  11925. selector: "trimRight:",
  11926. protocol: "regular expressions",
  11927. fn: function (separators){
  11928. var self=this,$self=this;
  11929. return $core.withContext(function($ctx1) {
  11930. var $2,$1;
  11931. $2=$recv("[".__comma(separators)).__comma("]+$");
  11932. $ctx1.sendIdx[","]=1;
  11933. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  11934. return $self._replaceRegexp_with_($1,"");
  11935. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},$globals.String)});
  11936. },
  11937. args: ["separators"],
  11938. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  11939. referencedClasses: ["RegularExpression"],
  11940. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  11941. }),
  11942. $globals.String);
  11943. $core.addMethod(
  11944. $core.method({
  11945. selector: "unescaped",
  11946. protocol: "converting",
  11947. fn: function (){
  11948. var self=this,$self=this;
  11949. return $core.withContext(function($ctx1) {
  11950. return unescape(self);
  11951. return self;
  11952. }, function($ctx1) {$ctx1.fill(self,"unescaped",{},$globals.String)});
  11953. },
  11954. args: [],
  11955. source: "unescaped\x0a\x09<inlineJS: 'return unescape(self)'>",
  11956. referencedClasses: [],
  11957. messageSends: []
  11958. }),
  11959. $globals.String);
  11960. $core.addMethod(
  11961. $core.method({
  11962. selector: "uriComponentDecoded",
  11963. protocol: "converting",
  11964. fn: function (){
  11965. var self=this,$self=this;
  11966. return $core.withContext(function($ctx1) {
  11967. return decodeURIComponent(self);
  11968. return self;
  11969. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{},$globals.String)});
  11970. },
  11971. args: [],
  11972. source: "uriComponentDecoded\x0a\x09<inlineJS: 'return decodeURIComponent(self)'>",
  11973. referencedClasses: [],
  11974. messageSends: []
  11975. }),
  11976. $globals.String);
  11977. $core.addMethod(
  11978. $core.method({
  11979. selector: "uriComponentEncoded",
  11980. protocol: "converting",
  11981. fn: function (){
  11982. var self=this,$self=this;
  11983. return $core.withContext(function($ctx1) {
  11984. return encodeURIComponent(self);
  11985. return self;
  11986. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{},$globals.String)});
  11987. },
  11988. args: [],
  11989. source: "uriComponentEncoded\x0a\x09<inlineJS: 'return encodeURIComponent(self)'>",
  11990. referencedClasses: [],
  11991. messageSends: []
  11992. }),
  11993. $globals.String);
  11994. $core.addMethod(
  11995. $core.method({
  11996. selector: "uriDecoded",
  11997. protocol: "converting",
  11998. fn: function (){
  11999. var self=this,$self=this;
  12000. return $core.withContext(function($ctx1) {
  12001. return decodeURI(self);
  12002. return self;
  12003. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{},$globals.String)});
  12004. },
  12005. args: [],
  12006. source: "uriDecoded\x0a\x09<inlineJS: 'return decodeURI(self)'>",
  12007. referencedClasses: [],
  12008. messageSends: []
  12009. }),
  12010. $globals.String);
  12011. $core.addMethod(
  12012. $core.method({
  12013. selector: "uriEncoded",
  12014. protocol: "converting",
  12015. fn: function (){
  12016. var self=this,$self=this;
  12017. return $core.withContext(function($ctx1) {
  12018. return encodeURI(self);
  12019. return self;
  12020. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{},$globals.String)});
  12021. },
  12022. args: [],
  12023. source: "uriEncoded\x0a\x09<inlineJS: 'return encodeURI(self)'>",
  12024. referencedClasses: [],
  12025. messageSends: []
  12026. }),
  12027. $globals.String);
  12028. $core.addMethod(
  12029. $core.method({
  12030. selector: "value:",
  12031. protocol: "evaluating",
  12032. fn: function (anObject){
  12033. var self=this,$self=this;
  12034. return $core.withContext(function($ctx1) {
  12035. return $recv(anObject)._perform_(self);
  12036. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.String)});
  12037. },
  12038. args: ["anObject"],
  12039. source: "value: anObject \x0a\x09^ anObject perform: self",
  12040. referencedClasses: [],
  12041. messageSends: ["perform:"]
  12042. }),
  12043. $globals.String);
  12044. $core.addMethod(
  12045. $core.method({
  12046. selector: "cr",
  12047. protocol: "accessing",
  12048. fn: function (){
  12049. var self=this,$self=this;
  12050. return $core.withContext(function($ctx1) {
  12051. return "\r";
  12052. return self;
  12053. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.String.a$cls)});
  12054. },
  12055. args: [],
  12056. source: "cr\x0a\x09<inlineJS: 'return \x22\x5cr\x22'>",
  12057. referencedClasses: [],
  12058. messageSends: []
  12059. }),
  12060. $globals.String.a$cls);
  12061. $core.addMethod(
  12062. $core.method({
  12063. selector: "crlf",
  12064. protocol: "accessing",
  12065. fn: function (){
  12066. var self=this,$self=this;
  12067. return $core.withContext(function($ctx1) {
  12068. return "\r\n";
  12069. return self;
  12070. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.String.a$cls)});
  12071. },
  12072. args: [],
  12073. source: "crlf\x0a\x09<inlineJS: 'return \x22\x5cr\x5cn\x22'>",
  12074. referencedClasses: [],
  12075. messageSends: []
  12076. }),
  12077. $globals.String.a$cls);
  12078. $core.addMethod(
  12079. $core.method({
  12080. selector: "esc",
  12081. protocol: "accessing",
  12082. fn: function (){
  12083. var self=this,$self=this;
  12084. return $core.withContext(function($ctx1) {
  12085. return $self._fromCharCode_((27));
  12086. }, function($ctx1) {$ctx1.fill(self,"esc",{},$globals.String.a$cls)});
  12087. },
  12088. args: [],
  12089. source: "esc\x0a\x09^ self fromCharCode: 27",
  12090. referencedClasses: [],
  12091. messageSends: ["fromCharCode:"]
  12092. }),
  12093. $globals.String.a$cls);
  12094. $core.addMethod(
  12095. $core.method({
  12096. selector: "fromCharCode:",
  12097. protocol: "instance creation",
  12098. fn: function (anInteger){
  12099. var self=this,$self=this;
  12100. return $core.withContext(function($ctx1) {
  12101. return String.fromCharCode(anInteger);
  12102. return self;
  12103. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},$globals.String.a$cls)});
  12104. },
  12105. args: ["anInteger"],
  12106. source: "fromCharCode: anInteger\x0a\x09<inlineJS: 'return String.fromCharCode(anInteger)'>",
  12107. referencedClasses: [],
  12108. messageSends: []
  12109. }),
  12110. $globals.String.a$cls);
  12111. $core.addMethod(
  12112. $core.method({
  12113. selector: "fromString:",
  12114. protocol: "instance creation",
  12115. fn: function (aString){
  12116. var self=this,$self=this;
  12117. return $core.withContext(function($ctx1) {
  12118. return String(aString);
  12119. return self;
  12120. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.String.a$cls)});
  12121. },
  12122. args: ["aString"],
  12123. source: "fromString: aString\x0a\x09\x09<inlineJS: 'return String(aString)'>",
  12124. referencedClasses: [],
  12125. messageSends: []
  12126. }),
  12127. $globals.String.a$cls);
  12128. $core.addMethod(
  12129. $core.method({
  12130. selector: "lf",
  12131. protocol: "accessing",
  12132. fn: function (){
  12133. var self=this,$self=this;
  12134. return $core.withContext(function($ctx1) {
  12135. return "\n";
  12136. return self;
  12137. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.String.a$cls)});
  12138. },
  12139. args: [],
  12140. source: "lf\x0a\x09<inlineJS: 'return \x22\x5cn\x22'>",
  12141. referencedClasses: [],
  12142. messageSends: []
  12143. }),
  12144. $globals.String.a$cls);
  12145. $core.addMethod(
  12146. $core.method({
  12147. selector: "random",
  12148. protocol: "random",
  12149. fn: function (){
  12150. var self=this,$self=this;
  12151. return $core.withContext(function($ctx1) {
  12152. return ((10+22*Math.random())/32).toString(32).slice(2);;
  12153. return self;
  12154. }, function($ctx1) {$ctx1.fill(self,"random",{},$globals.String.a$cls)});
  12155. },
  12156. args: [],
  12157. source: "random\x0a\x09\x22Returns random alphanumeric string beginning with letter\x22\x0a\x09<inlineJS: 'return ((10+22*Math.random())/32).toString(32).slice(2);'>",
  12158. referencedClasses: [],
  12159. messageSends: []
  12160. }),
  12161. $globals.String.a$cls);
  12162. $core.addMethod(
  12163. $core.method({
  12164. selector: "randomNotIn:",
  12165. protocol: "random",
  12166. fn: function (aString){
  12167. var self=this,$self=this;
  12168. var result;
  12169. return $core.withContext(function($ctx1) {
  12170. $recv((function(){
  12171. return $core.withContext(function($ctx2) {
  12172. result=$self._random();
  12173. return $recv(aString)._includesSubString_(result);
  12174. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12175. }))._whileTrue();
  12176. return result;
  12177. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},$globals.String.a$cls)});
  12178. },
  12179. args: ["aString"],
  12180. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  12181. referencedClasses: [],
  12182. messageSends: ["whileTrue", "random", "includesSubString:"]
  12183. }),
  12184. $globals.String.a$cls);
  12185. $core.addMethod(
  12186. $core.method({
  12187. selector: "space",
  12188. protocol: "accessing",
  12189. fn: function (){
  12190. var self=this,$self=this;
  12191. return $core.withContext(function($ctx1) {
  12192. return " ";
  12193. return self;
  12194. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.String.a$cls)});
  12195. },
  12196. args: [],
  12197. source: "space\x0a\x09<inlineJS: 'return \x22 \x22'>",
  12198. referencedClasses: [],
  12199. messageSends: []
  12200. }),
  12201. $globals.String.a$cls);
  12202. $core.addMethod(
  12203. $core.method({
  12204. selector: "streamClass",
  12205. protocol: "accessing",
  12206. fn: function (){
  12207. var self=this,$self=this;
  12208. return $globals.StringStream;
  12209. },
  12210. args: [],
  12211. source: "streamClass\x0a\x09\x09^ StringStream",
  12212. referencedClasses: ["StringStream"],
  12213. messageSends: []
  12214. }),
  12215. $globals.String.a$cls);
  12216. $core.addMethod(
  12217. $core.method({
  12218. selector: "tab",
  12219. protocol: "accessing",
  12220. fn: function (){
  12221. var self=this,$self=this;
  12222. return $core.withContext(function($ctx1) {
  12223. return "\t";
  12224. return self;
  12225. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.String.a$cls)});
  12226. },
  12227. args: [],
  12228. source: "tab\x0a\x09<inlineJS: 'return \x22\x5ct\x22'>",
  12229. referencedClasses: [],
  12230. messageSends: []
  12231. }),
  12232. $globals.String.a$cls);
  12233. $core.addMethod(
  12234. $core.method({
  12235. selector: "value:",
  12236. protocol: "instance creation",
  12237. fn: function (aUTFCharCode){
  12238. var self=this,$self=this;
  12239. return $core.withContext(function($ctx1) {
  12240. return String.fromCharCode(aUTFCharCode);;
  12241. return self;
  12242. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},$globals.String.a$cls)});
  12243. },
  12244. args: ["aUTFCharCode"],
  12245. source: "value: aUTFCharCode\x0a\x0a\x09<inlineJS: 'return String.fromCharCode(aUTFCharCode);'>",
  12246. referencedClasses: [],
  12247. messageSends: []
  12248. }),
  12249. $globals.String.a$cls);
  12250. $core.addClass("Set", $globals.Collection, ["defaultBucket", "slowBucketStores", "fastBuckets", "size"], "Kernel-Collections");
  12251. $globals.Set.comment="I represent an unordered set of objects without duplicates.\x0a\x0a## Implementation notes\x0a\x0aI put elements into different stores based on their type.\x0aThe goal is to store some elements into native JS object property names to be fast.\x0a\x0aIf an unboxed element has typeof 'string', 'boolean' or 'number', or an element is nil, null or undefined,\x0aI store it as a property name in an empty (== Object.create(null)) JS object, different for each type\x0a(for simplicity, nil/null/undefined is treated as one and included with the two booleans).\x0a\x0aIf element happen to be an object, I try to store them in `ArrayBucketStore`. I have two of them by default,\x0aone hashed using the Smalltalk class name, the other one using the JS constructor name. It is possible to have more or less\x0ainstances of `ArrayBucketStores`, see `#initializeSlowBucketStores`.\x0a\x0aAs a last resort, if none of the `ArrayBucketStore` instances can find a suitable bucket, the `defaultBucket` is used,\x0awhich is an `Array`.";
  12252. $core.addMethod(
  12253. $core.method({
  12254. selector: "=",
  12255. protocol: "comparing",
  12256. fn: function (aCollection){
  12257. var self=this,$self=this;
  12258. return $core.withContext(function($ctx1) {
  12259. var $2,$1,$4,$3,$5;
  12260. var $early={};
  12261. try {
  12262. $2=$self._class();
  12263. $ctx1.sendIdx["class"]=1;
  12264. $1=$recv($2).__eq($recv(aCollection)._class());
  12265. $ctx1.sendIdx["="]=1;
  12266. if(!$core.assert($1)){
  12267. return false;
  12268. }
  12269. $4=$self._size();
  12270. $ctx1.sendIdx["size"]=1;
  12271. $3=$recv($4).__eq($recv(aCollection)._size());
  12272. if(!$core.assert($3)){
  12273. return false;
  12274. }
  12275. $self._do_((function(each){
  12276. return $core.withContext(function($ctx2) {
  12277. $5=$recv(aCollection)._includes_(each);
  12278. if(!$core.assert($5)){
  12279. throw $early=[false];
  12280. }
  12281. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  12282. }));
  12283. return true;
  12284. }
  12285. catch(e) {if(e===$early)return e[0]; throw e}
  12286. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.Set)});
  12287. },
  12288. args: ["aCollection"],
  12289. source: "= aCollection\x0a\x09self class = aCollection class ifFalse: [ ^ false ].\x0a\x09self size = aCollection size ifFalse: [ ^ false ].\x0a\x09self do: [ :each | (aCollection includes: each) ifFalse: [ ^ false ] ].\x0a\x09^ true",
  12290. referencedClasses: [],
  12291. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  12292. }),
  12293. $globals.Set);
  12294. $core.addMethod(
  12295. $core.method({
  12296. selector: "add:",
  12297. protocol: "adding/removing",
  12298. fn: function (anObject){
  12299. var self=this,$self=this;
  12300. var bucket;
  12301. return $core.withContext(function($ctx1) {
  12302. var $1,$receiver;
  12303. bucket=$self._bucketsOfElement_(anObject);
  12304. $1=$recv(bucket)._second();
  12305. if(($receiver = $1) == null || $receiver.a$nil){
  12306. var object,slowBucket;
  12307. object=$recv(bucket)._first();
  12308. $ctx1.sendIdx["first"]=1;
  12309. slowBucket=$recv(bucket)._third();
  12310. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  12311. return $core.withContext(function($ctx2) {
  12312. $recv(slowBucket)._add_(object);
  12313. $self["@size"]=$recv($self["@size"]).__plus((1));
  12314. return $self["@size"];
  12315. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12316. }));
  12317. return object;
  12318. } else {
  12319. var primitiveBucket;
  12320. primitiveBucket=$receiver;
  12321. return $self._add_in_($recv(bucket)._first(),primitiveBucket);
  12322. }
  12323. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket},$globals.Set)});
  12324. },
  12325. args: ["anObject"],
  12326. source: "add: anObject\x0a\x09| bucket |\x0a\x09bucket := self bucketsOfElement: anObject.\x0a\x09^ bucket second\x0a\x09\x09ifNil: [\x0a\x09\x09\x09| object slowBucket |\x0a\x09\x09\x09object := bucket first.\x0a\x09\x09\x09slowBucket := bucket third.\x0a\x09\x09\x09slowBucket \x0a\x09\x09\x09\x09indexOf: object \x0a\x09\x09\x09\x09ifAbsent: [ \x0a\x09\x09\x09\x09\x09slowBucket add: object. \x0a\x09\x09\x09\x09\x09size := size + 1 ].\x0a\x09\x09\x09object ]\x0a\x09\x09ifNotNil: [ :primitiveBucket | \x0a\x09\x09\x09self \x0a\x09\x09\x09\x09add: bucket first \x0a\x09\x09\x09\x09in: primitiveBucket ]",
  12327. referencedClasses: [],
  12328. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  12329. }),
  12330. $globals.Set);
  12331. $core.addMethod(
  12332. $core.method({
  12333. selector: "add:in:",
  12334. protocol: "private",
  12335. fn: function (anObject,anotherObject){
  12336. var self=this,$self=this;
  12337. return $core.withContext(function($ctx1) {
  12338. if (anObject in anotherObject.store) { return anObject; }
  12339. $self['@size']++;
  12340. anotherObject.store[anObject] = true;
  12341. return anObject;
  12342. ;
  12343. return self;
  12344. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  12345. },
  12346. args: ["anObject", "anotherObject"],
  12347. source: "add: anObject in: anotherObject\x0a\x09<inlineJS: '\x0a\x09\x09if (anObject in anotherObject.store) { return anObject; }\x0a\x09\x09$self[''@size'']++;\x0a\x09\x09anotherObject.store[anObject] = true;\x0a\x09\x09return anObject;\x0a\x09'>",
  12348. referencedClasses: [],
  12349. messageSends: []
  12350. }),
  12351. $globals.Set);
  12352. $core.addMethod(
  12353. $core.method({
  12354. selector: "bucketsOfElement:",
  12355. protocol: "private",
  12356. fn: function (anObject){
  12357. var self=this,$self=this;
  12358. return $core.withContext(function($ctx1) {
  12359. // include nil to well-known objects under "boolean" fastBucket
  12360. if (anObject == null || anObject.a$nil) return [ null, $self['@fastBuckets'].boolean ];
  12361. var prim = anObject.valueOf();
  12362. if (typeof prim === "object" || typeof prim === "function" || !$self['@fastBuckets'][typeof prim]) {
  12363. var bucket = null;
  12364. $self['@slowBucketStores'].some(function (store) {
  12365. return bucket = store._bucketOfElement_(anObject);
  12366. });
  12367. return [ anObject, null, bucket || $self['@defaultBucket'] ];
  12368. }
  12369. return [ prim, $self['@fastBuckets'][typeof prim] ];
  12370. ;
  12371. return self;
  12372. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject},$globals.Set)});
  12373. },
  12374. args: ["anObject"],
  12375. source: "bucketsOfElement: anObject\x0a\x09\x22Find the appropriate bucket for `anObject`.\x0a\x09For optimization purposes, directly answer an array with: \x0a\x09- the object to be store\x0a\x09- the primitive bucket\x0a\x09- the slow bucket\x22\x0a\x09\x0a\x09<inlineJS: '\x0a\x09\x09// include nil to well-known objects under \x22boolean\x22 fastBucket\x0a\x09\x09if (anObject == null || anObject.a$nil) return [ null, $self[''@fastBuckets''].boolean ];\x0a\x09\x09\x0a\x09\x09var prim = anObject.valueOf();\x0a\x09\x09if (typeof prim === \x22object\x22 || typeof prim === \x22function\x22 || !$self[''@fastBuckets''][typeof prim]) {\x0a\x09\x09\x09var bucket = null;\x0a\x09\x09\x09$self[''@slowBucketStores''].some(function (store) {\x0a\x09\x09\x09\x09return bucket = store._bucketOfElement_(anObject);\x0a\x09\x09\x09});\x0a\x09\x09\x09return [ anObject, null, bucket || $self[''@defaultBucket''] ];\x0a\x09\x09}\x0a\x09\x09return [ prim, $self[''@fastBuckets''][typeof prim] ];\x0a\x09'>",
  12376. referencedClasses: [],
  12377. messageSends: []
  12378. }),
  12379. $globals.Set);
  12380. $core.addMethod(
  12381. $core.method({
  12382. selector: "classNameOf:",
  12383. protocol: "private",
  12384. fn: function (anObject){
  12385. var self=this,$self=this;
  12386. return $core.withContext(function($ctx1) {
  12387. return anObject.a$cls != null && anObject.a$cls.name;
  12388. return self;
  12389. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject},$globals.Set)});
  12390. },
  12391. args: ["anObject"],
  12392. source: "classNameOf: anObject\x0a\x09\x22Answer the class name of `anObject`, or `undefined` \x0a\x09if `anObject` is not an Smalltalk object\x22\x0a\x09\x0a\x09<inlineJS: 'return anObject.a$cls != null && anObject.a$cls.name'>",
  12393. referencedClasses: [],
  12394. messageSends: []
  12395. }),
  12396. $globals.Set);
  12397. $core.addMethod(
  12398. $core.method({
  12399. selector: "collect:",
  12400. protocol: "enumerating",
  12401. fn: function (aBlock){
  12402. var self=this,$self=this;
  12403. var collection;
  12404. return $core.withContext(function($ctx1) {
  12405. collection=$recv($self._class())._new();
  12406. $self._do_((function(each){
  12407. return $core.withContext(function($ctx2) {
  12408. return $recv(collection)._add_($recv(aBlock)._value_(each));
  12409. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12410. }));
  12411. return collection;
  12412. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection},$globals.Set)});
  12413. },
  12414. args: ["aBlock"],
  12415. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  12416. referencedClasses: [],
  12417. messageSends: ["new", "class", "do:", "add:", "value:"]
  12418. }),
  12419. $globals.Set);
  12420. $core.addMethod(
  12421. $core.method({
  12422. selector: "do:",
  12423. protocol: "enumerating",
  12424. fn: function (aBlock){
  12425. var self=this,$self=this;
  12426. return $core.withContext(function($ctx1) {
  12427. var el, keys, i;
  12428. el = $self['@fastBuckets'];
  12429. keys = Object.keys(el);
  12430. for (i = 0; i < keys.length; ++i) {
  12431. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  12432. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  12433. else { store._do_(aBlock); }
  12434. }
  12435. el = $self['@slowBucketStores'];
  12436. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  12437. $self['@defaultBucket']._do_(aBlock);
  12438. ;
  12439. return self;
  12440. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Set)});
  12441. },
  12442. args: ["aBlock"],
  12443. source: "do: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var el, keys, i;\x0a\x09\x09el = $self[''@fastBuckets''];\x0a\x09\x09keys = Object.keys(el);\x0a\x09\x09for (i = 0; i < keys.length; ++i) {\x0a\x09\x09\x09var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);\x0a\x09\x09\x09if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }\x0a\x09\x09\x09else { store._do_(aBlock); }\x0a\x09\x09}\x0a\x09\x09el = $self[''@slowBucketStores''];\x0a\x09\x09for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }\x0a\x09\x09$self[''@defaultBucket'']._do_(aBlock);\x0a\x09'>",
  12444. referencedClasses: [],
  12445. messageSends: []
  12446. }),
  12447. $globals.Set);
  12448. $core.addMethod(
  12449. $core.method({
  12450. selector: "includes:",
  12451. protocol: "testing",
  12452. fn: function (anObject){
  12453. var self=this,$self=this;
  12454. var bucket;
  12455. return $core.withContext(function($ctx1) {
  12456. var $1,$2,$3,$receiver;
  12457. bucket=$self._bucketsOfElement_(anObject);
  12458. $1=$recv(bucket)._second();
  12459. if(($receiver = $1) == null || $receiver.a$nil){
  12460. $2=$recv(bucket)._third();
  12461. $3=$recv(bucket)._first();
  12462. $ctx1.sendIdx["first"]=1;
  12463. return $recv($2)._includes_($3);
  12464. } else {
  12465. var primitiveBucket;
  12466. primitiveBucket=$receiver;
  12467. return $self._includes_in_($recv(bucket)._first(),primitiveBucket);
  12468. }
  12469. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket},$globals.Set)});
  12470. },
  12471. args: ["anObject"],
  12472. source: "includes: anObject\x0a\x09| bucket |\x0a\x09bucket := self bucketsOfElement: anObject.\x0a\x09^ bucket second\x0a\x09\x09ifNil: [ bucket third includes: bucket first ]\x0a\x09\x09ifNotNil: [ :primitiveBucket | self includes: bucket first in: primitiveBucket ]",
  12473. referencedClasses: [],
  12474. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  12475. }),
  12476. $globals.Set);
  12477. $core.addMethod(
  12478. $core.method({
  12479. selector: "includes:in:",
  12480. protocol: "private",
  12481. fn: function (anObject,anotherObject){
  12482. var self=this,$self=this;
  12483. return $core.withContext(function($ctx1) {
  12484. return anObject in anotherObject.store;
  12485. return self;
  12486. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  12487. },
  12488. args: ["anObject", "anotherObject"],
  12489. source: "includes: anObject in: anotherObject\x0a\x09<inlineJS: 'return anObject in anotherObject.store'>",
  12490. referencedClasses: [],
  12491. messageSends: []
  12492. }),
  12493. $globals.Set);
  12494. $core.addMethod(
  12495. $core.method({
  12496. selector: "initialize",
  12497. protocol: "initialization",
  12498. fn: function (){
  12499. var self=this,$self=this;
  12500. return $core.withContext(function($ctx1) {
  12501. (
  12502. $ctx1.supercall = true,
  12503. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  12504. $ctx1.supercall = false;
  12505. $self["@defaultBucket"]=[];
  12506. $self._initializeSlowBucketStores();
  12507. $self._removeAll();
  12508. return self;
  12509. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Set)});
  12510. },
  12511. args: [],
  12512. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  12513. referencedClasses: [],
  12514. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  12515. }),
  12516. $globals.Set);
  12517. $core.addMethod(
  12518. $core.method({
  12519. selector: "initializeSlowBucketStores",
  12520. protocol: "initialization",
  12521. fn: function (){
  12522. var self=this,$self=this;
  12523. return $core.withContext(function($ctx1) {
  12524. var $1;
  12525. $1=$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  12526. return $core.withContext(function($ctx2) {
  12527. return $self._classNameOf_(x);
  12528. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  12529. }));
  12530. $ctx1.sendIdx["hashBlock:"]=1;
  12531. $self["@slowBucketStores"]=[$1,$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  12532. return $core.withContext(function($ctx2) {
  12533. return $self._jsConstructorNameOf_(x);
  12534. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  12535. }))];
  12536. return self;
  12537. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{},$globals.Set)});
  12538. },
  12539. args: [],
  12540. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  12541. referencedClasses: ["ArrayBucketStore"],
  12542. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  12543. }),
  12544. $globals.Set);
  12545. $core.addMethod(
  12546. $core.method({
  12547. selector: "jsConstructorNameOf:",
  12548. protocol: "private",
  12549. fn: function (anObject){
  12550. var self=this,$self=this;
  12551. return $core.withContext(function($ctx1) {
  12552. return anObject.constructor && anObject.constructor.name;
  12553. return self;
  12554. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject},$globals.Set)});
  12555. },
  12556. args: ["anObject"],
  12557. source: "jsConstructorNameOf: anObject\x0a\x09<inlineJS: 'return anObject.constructor && anObject.constructor.name'>",
  12558. referencedClasses: [],
  12559. messageSends: []
  12560. }),
  12561. $globals.Set);
  12562. $core.addMethod(
  12563. $core.method({
  12564. selector: "printOn:",
  12565. protocol: "printing",
  12566. fn: function (aStream){
  12567. var self=this,$self=this;
  12568. return $core.withContext(function($ctx1) {
  12569. (
  12570. $ctx1.supercall = true,
  12571. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  12572. $ctx1.supercall = false;
  12573. $ctx1.sendIdx["printOn:"]=1;
  12574. $recv(aStream)._nextPutAll_(" (");
  12575. $ctx1.sendIdx["nextPutAll:"]=1;
  12576. $self._do_separatedBy_((function(each){
  12577. return $core.withContext(function($ctx2) {
  12578. return $recv(each)._printOn_(aStream);
  12579. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12580. }),(function(){
  12581. return $core.withContext(function($ctx2) {
  12582. return $recv(aStream)._nextPutAll_(" ");
  12583. $ctx2.sendIdx["nextPutAll:"]=2;
  12584. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12585. }));
  12586. $recv(aStream)._nextPutAll_(")");
  12587. return self;
  12588. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Set)});
  12589. },
  12590. args: ["aStream"],
  12591. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: ' ('.\x0a\x09self \x0a\x09\x09do: [ :each | each printOn: aStream ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ' ' ].\x0a\x09aStream nextPutAll: ')'",
  12592. referencedClasses: [],
  12593. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  12594. }),
  12595. $globals.Set);
  12596. $core.addMethod(
  12597. $core.method({
  12598. selector: "remove:ifAbsent:",
  12599. protocol: "adding/removing",
  12600. fn: function (anObject,aBlock){
  12601. var self=this,$self=this;
  12602. var bucket;
  12603. return $core.withContext(function($ctx1) {
  12604. var $1,$2,$3,$receiver;
  12605. var $early={};
  12606. try {
  12607. bucket=$self._bucketsOfElement_(anObject);
  12608. $1=$recv(bucket)._second();
  12609. if(($receiver = $1) == null || $receiver.a$nil){
  12610. $2=$recv(bucket)._third();
  12611. $3=$recv(bucket)._first();
  12612. $ctx1.sendIdx["first"]=1;
  12613. $recv($2)._remove_ifAbsent_($3,(function(){
  12614. return $core.withContext(function($ctx2) {
  12615. throw $early=[$recv(aBlock)._value()];
  12616. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12617. }));
  12618. $self["@size"]=$recv($self["@size"]).__minus((1));
  12619. return $self["@size"];
  12620. } else {
  12621. var primitiveBucket;
  12622. primitiveBucket=$receiver;
  12623. return $self._remove_in_ifAbsent_($recv(bucket)._first(),primitiveBucket,aBlock);
  12624. }
  12625. }
  12626. catch(e) {if(e===$early)return e[0]; throw e}
  12627. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket},$globals.Set)});
  12628. },
  12629. args: ["anObject", "aBlock"],
  12630. source: "remove: anObject ifAbsent: aBlock\x0a\x09| bucket |\x0a\x09bucket := self bucketsOfElement: anObject.\x0a\x09^ bucket second\x0a\x09\x09ifNil: [ bucket third remove: bucket first ifAbsent: [ ^aBlock value ]. size := size - 1 ]\x0a\x09\x09ifNotNil: [ :primitiveBucket | self remove: bucket first in: primitiveBucket ifAbsent: aBlock ]",
  12631. referencedClasses: [],
  12632. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:ifAbsent:"]
  12633. }),
  12634. $globals.Set);
  12635. $core.addMethod(
  12636. $core.method({
  12637. selector: "remove:in:ifAbsent:",
  12638. protocol: "private",
  12639. fn: function (anObject,anotherObject,aBlock){
  12640. var self=this,$self=this;
  12641. return $core.withContext(function($ctx1) {
  12642. if (anObject in anotherObject.store) {
  12643. delete anotherObject.store[anObject];
  12644. $self['@size']--;
  12645. return anObject;
  12646. } else {
  12647. return aBlock._value();
  12648. };
  12649. return self;
  12650. }, function($ctx1) {$ctx1.fill(self,"remove:in:ifAbsent:",{anObject:anObject,anotherObject:anotherObject,aBlock:aBlock},$globals.Set)});
  12651. },
  12652. args: ["anObject", "anotherObject", "aBlock"],
  12653. source: "remove: anObject in: anotherObject ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09if (anObject in anotherObject.store) {\x0a\x09\x09\x09delete anotherObject.store[anObject];\x0a\x09\x09\x09$self[''@size'']--;\x0a\x09\x09\x09return anObject;\x0a\x09\x09} else {\x0a\x09\x09\x09return aBlock._value();\x0a\x09\x09}'>",
  12654. referencedClasses: [],
  12655. messageSends: []
  12656. }),
  12657. $globals.Set);
  12658. $core.addMethod(
  12659. $core.method({
  12660. selector: "removeAll",
  12661. protocol: "adding/removing",
  12662. fn: function (){
  12663. var self=this,$self=this;
  12664. return $core.withContext(function($ctx1) {
  12665. $self['@fastBuckets'] = {
  12666. "boolean": { store: Object.create(null), fn: function (x) { return {"true": true, "false": false, "null": null}[x]; } },
  12667. "number": { store: Object.create(null), fn: Number },
  12668. "string": { store: Object.create(null) }
  12669. };
  12670. $self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });
  12671. $self['@defaultBucket']._removeAll();
  12672. $self['@size'] = 0;
  12673. ;
  12674. return self;
  12675. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Set)});
  12676. },
  12677. args: [],
  12678. source: "removeAll\x0a\x09<inlineJS: '\x0a\x09\x09$self[''@fastBuckets''] = {\x0a\x09\x09\x09\x22boolean\x22: { store: Object.create(null), fn: function (x) { return {\x22true\x22: true, \x22false\x22: false, \x22null\x22: null}[x]; } },\x0a\x09\x09\x09\x22number\x22: { store: Object.create(null), fn: Number },\x0a\x09\x09\x09\x22string\x22: { store: Object.create(null) }\x0a\x09\x09};\x0a\x09\x09$self[''@slowBucketStores''].forEach(function (x) { x._removeAll(); });\x0a\x09\x09$self[''@defaultBucket'']._removeAll();\x0a\x09\x09$self[''@size''] = 0;\x0a\x09'>",
  12679. referencedClasses: [],
  12680. messageSends: []
  12681. }),
  12682. $globals.Set);
  12683. $core.addMethod(
  12684. $core.method({
  12685. selector: "select:",
  12686. protocol: "enumerating",
  12687. fn: function (aBlock){
  12688. var self=this,$self=this;
  12689. var collection;
  12690. return $core.withContext(function($ctx1) {
  12691. var $1;
  12692. collection=$recv($self._class())._new();
  12693. $self._do_((function(each){
  12694. return $core.withContext(function($ctx2) {
  12695. $1=$recv(aBlock)._value_(each);
  12696. if($core.assert($1)){
  12697. return $recv(collection)._add_(each);
  12698. }
  12699. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12700. }));
  12701. return collection;
  12702. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},$globals.Set)});
  12703. },
  12704. args: ["aBlock"],
  12705. source: "select: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each |\x0a\x09\x09(aBlock value: each) ifTrue: [\x0a\x09\x09\x09collection add: each ] ].\x0a\x09^ collection",
  12706. referencedClasses: [],
  12707. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  12708. }),
  12709. $globals.Set);
  12710. $core.addMethod(
  12711. $core.method({
  12712. selector: "select:thenCollect:",
  12713. protocol: "enumerating",
  12714. fn: function (selectBlock,collectBlock){
  12715. var self=this,$self=this;
  12716. var collection;
  12717. return $core.withContext(function($ctx1) {
  12718. var $1;
  12719. collection=$recv($self._class())._new();
  12720. $self._do_((function(each){
  12721. return $core.withContext(function($ctx2) {
  12722. $1=$recv(selectBlock)._value_(each);
  12723. $ctx2.sendIdx["value:"]=1;
  12724. if($core.assert($1)){
  12725. return $recv(collection)._add_($recv(collectBlock)._value_(each));
  12726. }
  12727. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12728. }));
  12729. return collection;
  12730. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,collection:collection},$globals.Set)});
  12731. },
  12732. args: ["selectBlock", "collectBlock"],
  12733. source: "select: selectBlock thenCollect: collectBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each |\x0a\x09\x09(selectBlock value: each) ifTrue: [\x0a\x09\x09\x09collection add: (collectBlock value: each) ] ].\x0a\x09^ collection",
  12734. referencedClasses: [],
  12735. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  12736. }),
  12737. $globals.Set);
  12738. $core.addMethod(
  12739. $core.method({
  12740. selector: "size",
  12741. protocol: "accessing",
  12742. fn: function (){
  12743. var self=this,$self=this;
  12744. return $self["@size"];
  12745. },
  12746. args: [],
  12747. source: "size\x0a\x09^ size",
  12748. referencedClasses: [],
  12749. messageSends: []
  12750. }),
  12751. $globals.Set);
  12752. $core.addClass("ProtoStream", $globals.Object, [], "Kernel-Collections");
  12753. $globals.ProtoStream.comment="I am the abstract base for different accessor for a sequence of objects. This sequence is referred to as my \x22contents\x22.\x0aMy instances are read/write streams modifying the contents.";
  12754. $core.addMethod(
  12755. $core.method({
  12756. selector: "<<",
  12757. protocol: "writing",
  12758. fn: function (anObject){
  12759. var self=this,$self=this;
  12760. return $core.withContext(function($ctx1) {
  12761. $self._write_(anObject);
  12762. return self;
  12763. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},$globals.ProtoStream)});
  12764. },
  12765. args: ["anObject"],
  12766. source: "<< anObject\x0a\x09self write: anObject",
  12767. referencedClasses: [],
  12768. messageSends: ["write:"]
  12769. }),
  12770. $globals.ProtoStream);
  12771. $core.addMethod(
  12772. $core.method({
  12773. selector: "atEnd",
  12774. protocol: "testing",
  12775. fn: function (){
  12776. var self=this,$self=this;
  12777. return $core.withContext(function($ctx1) {
  12778. $self._subclassResponsibility();
  12779. return self;
  12780. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ProtoStream)});
  12781. },
  12782. args: [],
  12783. source: "atEnd\x0a\x09self subclassResponsibility",
  12784. referencedClasses: [],
  12785. messageSends: ["subclassResponsibility"]
  12786. }),
  12787. $globals.ProtoStream);
  12788. $core.addMethod(
  12789. $core.method({
  12790. selector: "atStart",
  12791. protocol: "testing",
  12792. fn: function (){
  12793. var self=this,$self=this;
  12794. return $core.withContext(function($ctx1) {
  12795. $self._subclassResponsibility();
  12796. return self;
  12797. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.ProtoStream)});
  12798. },
  12799. args: [],
  12800. source: "atStart\x0a\x09self subclassResponsibility",
  12801. referencedClasses: [],
  12802. messageSends: ["subclassResponsibility"]
  12803. }),
  12804. $globals.ProtoStream);
  12805. $core.addMethod(
  12806. $core.method({
  12807. selector: "contents",
  12808. protocol: "accessing",
  12809. fn: function (){
  12810. var self=this,$self=this;
  12811. return $core.withContext(function($ctx1) {
  12812. $self._subclassResponsibility();
  12813. return self;
  12814. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.ProtoStream)});
  12815. },
  12816. args: [],
  12817. source: "contents\x0a\x09self subclassResponsibility",
  12818. referencedClasses: [],
  12819. messageSends: ["subclassResponsibility"]
  12820. }),
  12821. $globals.ProtoStream);
  12822. $core.addMethod(
  12823. $core.method({
  12824. selector: "do:",
  12825. protocol: "enumerating",
  12826. fn: function (aBlock){
  12827. var self=this,$self=this;
  12828. return $core.withContext(function($ctx1) {
  12829. $recv((function(){
  12830. return $core.withContext(function($ctx2) {
  12831. return $self._atEnd();
  12832. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12833. }))._whileFalse_((function(){
  12834. return $core.withContext(function($ctx2) {
  12835. return $recv(aBlock)._value_($self._next());
  12836. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12837. }));
  12838. return self;
  12839. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.ProtoStream)});
  12840. },
  12841. args: ["aBlock"],
  12842. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  12843. referencedClasses: [],
  12844. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  12845. }),
  12846. $globals.ProtoStream);
  12847. $core.addMethod(
  12848. $core.method({
  12849. selector: "isEmpty",
  12850. protocol: "testing",
  12851. fn: function (){
  12852. var self=this,$self=this;
  12853. return $core.withContext(function($ctx1) {
  12854. return $recv($self._atStart())._and_((function(){
  12855. return $core.withContext(function($ctx2) {
  12856. return $self._atEnd();
  12857. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12858. }));
  12859. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.ProtoStream)});
  12860. },
  12861. args: [],
  12862. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  12863. referencedClasses: [],
  12864. messageSends: ["and:", "atStart", "atEnd"]
  12865. }),
  12866. $globals.ProtoStream);
  12867. $core.addMethod(
  12868. $core.method({
  12869. selector: "next",
  12870. protocol: "reading",
  12871. fn: function (){
  12872. var self=this,$self=this;
  12873. return $core.withContext(function($ctx1) {
  12874. var $1;
  12875. $1=$self._atEnd();
  12876. if($core.assert($1)){
  12877. return nil;
  12878. } else {
  12879. return $self._subclassResponsibility();
  12880. }
  12881. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ProtoStream)});
  12882. },
  12883. args: [],
  12884. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  12885. referencedClasses: [],
  12886. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  12887. }),
  12888. $globals.ProtoStream);
  12889. $core.addMethod(
  12890. $core.method({
  12891. selector: "nextPut:",
  12892. protocol: "writing",
  12893. fn: function (anObject){
  12894. var self=this,$self=this;
  12895. return $core.withContext(function($ctx1) {
  12896. $self._subclassResponsibility();
  12897. return self;
  12898. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.ProtoStream)});
  12899. },
  12900. args: ["anObject"],
  12901. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  12902. referencedClasses: [],
  12903. messageSends: ["subclassResponsibility"]
  12904. }),
  12905. $globals.ProtoStream);
  12906. $core.addMethod(
  12907. $core.method({
  12908. selector: "nextPutAll:",
  12909. protocol: "writing",
  12910. fn: function (aCollection){
  12911. var self=this,$self=this;
  12912. return $core.withContext(function($ctx1) {
  12913. $recv(aCollection)._do_((function(each){
  12914. return $core.withContext(function($ctx2) {
  12915. return $self._nextPut_(each);
  12916. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12917. }));
  12918. return self;
  12919. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},$globals.ProtoStream)});
  12920. },
  12921. args: ["aCollection"],
  12922. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  12923. referencedClasses: [],
  12924. messageSends: ["do:", "nextPut:"]
  12925. }),
  12926. $globals.ProtoStream);
  12927. $core.addMethod(
  12928. $core.method({
  12929. selector: "nextPutString:",
  12930. protocol: "writing",
  12931. fn: function (aString){
  12932. var self=this,$self=this;
  12933. return $core.withContext(function($ctx1) {
  12934. $self._nextPut_(aString);
  12935. return self;
  12936. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.ProtoStream)});
  12937. },
  12938. args: ["aString"],
  12939. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  12940. referencedClasses: [],
  12941. messageSends: ["nextPut:"]
  12942. }),
  12943. $globals.ProtoStream);
  12944. $core.addMethod(
  12945. $core.method({
  12946. selector: "peek",
  12947. protocol: "reading",
  12948. fn: function (){
  12949. var self=this,$self=this;
  12950. return $core.withContext(function($ctx1) {
  12951. var $1;
  12952. $1=$self._atEnd();
  12953. if($core.assert($1)){
  12954. return nil;
  12955. } else {
  12956. return $self._subclassResponsibility();
  12957. }
  12958. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ProtoStream)});
  12959. },
  12960. args: [],
  12961. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  12962. referencedClasses: [],
  12963. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  12964. }),
  12965. $globals.ProtoStream);
  12966. $core.addMethod(
  12967. $core.method({
  12968. selector: "reset",
  12969. protocol: "actions",
  12970. fn: function (){
  12971. var self=this,$self=this;
  12972. return $core.withContext(function($ctx1) {
  12973. $self._subclassResponsibility();
  12974. return self;
  12975. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.ProtoStream)});
  12976. },
  12977. args: [],
  12978. source: "reset\x0a\x09self subclassResponsibility",
  12979. referencedClasses: [],
  12980. messageSends: ["subclassResponsibility"]
  12981. }),
  12982. $globals.ProtoStream);
  12983. $core.addMethod(
  12984. $core.method({
  12985. selector: "resetContents",
  12986. protocol: "actions",
  12987. fn: function (){
  12988. var self=this,$self=this;
  12989. return $core.withContext(function($ctx1) {
  12990. $self._subclassResponsibility();
  12991. return self;
  12992. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.ProtoStream)});
  12993. },
  12994. args: [],
  12995. source: "resetContents\x0a\x09self subclassResponsibility",
  12996. referencedClasses: [],
  12997. messageSends: ["subclassResponsibility"]
  12998. }),
  12999. $globals.ProtoStream);
  13000. $core.addMethod(
  13001. $core.method({
  13002. selector: "setToEnd",
  13003. protocol: "positioning",
  13004. fn: function (){
  13005. var self=this,$self=this;
  13006. return $core.withContext(function($ctx1) {
  13007. $self._subclassResponsibility();
  13008. return self;
  13009. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.ProtoStream)});
  13010. },
  13011. args: [],
  13012. source: "setToEnd\x0a\x09self subclassResponsibility",
  13013. referencedClasses: [],
  13014. messageSends: ["subclassResponsibility"]
  13015. }),
  13016. $globals.ProtoStream);
  13017. $core.addMethod(
  13018. $core.method({
  13019. selector: "setToStart",
  13020. protocol: "positioning",
  13021. fn: function (){
  13022. var self=this,$self=this;
  13023. return $core.withContext(function($ctx1) {
  13024. $self._reset();
  13025. return self;
  13026. }, function($ctx1) {$ctx1.fill(self,"setToStart",{},$globals.ProtoStream)});
  13027. },
  13028. args: [],
  13029. source: "setToStart\x0a\x09self reset",
  13030. referencedClasses: [],
  13031. messageSends: ["reset"]
  13032. }),
  13033. $globals.ProtoStream);
  13034. $core.addMethod(
  13035. $core.method({
  13036. selector: "write:",
  13037. protocol: "writing",
  13038. fn: function (anObject){
  13039. var self=this,$self=this;
  13040. return $core.withContext(function($ctx1) {
  13041. $recv(anObject)._putOn_(self);
  13042. return self;
  13043. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},$globals.ProtoStream)});
  13044. },
  13045. args: ["anObject"],
  13046. source: "write: anObject\x0a\x09anObject putOn: self",
  13047. referencedClasses: [],
  13048. messageSends: ["putOn:"]
  13049. }),
  13050. $globals.ProtoStream);
  13051. $core.addMethod(
  13052. $core.method({
  13053. selector: "on:",
  13054. protocol: "instance creation",
  13055. fn: function (aCollection){
  13056. var self=this,$self=this;
  13057. return $core.withContext(function($ctx1) {
  13058. var $1;
  13059. $1=$self._new();
  13060. $recv($1)._setCollection_(aCollection);
  13061. $recv($1)._setStreamSize_($recv(aCollection)._size());
  13062. return $recv($1)._yourself();
  13063. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.ProtoStream.a$cls)});
  13064. },
  13065. args: ["aCollection"],
  13066. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  13067. referencedClasses: [],
  13068. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  13069. }),
  13070. $globals.ProtoStream.a$cls);
  13071. $core.addClass("Stream", $globals.ProtoStream, ["collection", "position", "streamSize"], "Kernel-Collections");
  13072. $globals.Stream.comment="I represent an accessor for a sequence of objects. This sequence is referred to as my \x22contents\x22.\x0aMy instances are read/write streams to the contents sequence collection.";
  13073. $core.addMethod(
  13074. $core.method({
  13075. selector: "atEnd",
  13076. protocol: "testing",
  13077. fn: function (){
  13078. var self=this,$self=this;
  13079. return $core.withContext(function($ctx1) {
  13080. return $recv($self._position()).__eq($self._size());
  13081. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.Stream)});
  13082. },
  13083. args: [],
  13084. source: "atEnd\x0a\x09^ self position = self size",
  13085. referencedClasses: [],
  13086. messageSends: ["=", "position", "size"]
  13087. }),
  13088. $globals.Stream);
  13089. $core.addMethod(
  13090. $core.method({
  13091. selector: "atStart",
  13092. protocol: "testing",
  13093. fn: function (){
  13094. var self=this,$self=this;
  13095. return $core.withContext(function($ctx1) {
  13096. return $recv($self._position()).__eq((0));
  13097. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.Stream)});
  13098. },
  13099. args: [],
  13100. source: "atStart\x0a\x09^ self position = 0",
  13101. referencedClasses: [],
  13102. messageSends: ["=", "position"]
  13103. }),
  13104. $globals.Stream);
  13105. $core.addMethod(
  13106. $core.method({
  13107. selector: "close",
  13108. protocol: "actions",
  13109. fn: function (){
  13110. var self=this,$self=this;
  13111. return self;
  13112. },
  13113. args: [],
  13114. source: "close",
  13115. referencedClasses: [],
  13116. messageSends: []
  13117. }),
  13118. $globals.Stream);
  13119. $core.addMethod(
  13120. $core.method({
  13121. selector: "collection",
  13122. protocol: "accessing",
  13123. fn: function (){
  13124. var self=this,$self=this;
  13125. return $self["@collection"];
  13126. },
  13127. args: [],
  13128. source: "collection\x0a\x09^ collection",
  13129. referencedClasses: [],
  13130. messageSends: []
  13131. }),
  13132. $globals.Stream);
  13133. $core.addMethod(
  13134. $core.method({
  13135. selector: "contents",
  13136. protocol: "accessing",
  13137. fn: function (){
  13138. var self=this,$self=this;
  13139. return $core.withContext(function($ctx1) {
  13140. return $recv($self._collection())._copyFrom_to_((1),$self._streamSize());
  13141. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.Stream)});
  13142. },
  13143. args: [],
  13144. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  13145. referencedClasses: [],
  13146. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  13147. }),
  13148. $globals.Stream);
  13149. $core.addMethod(
  13150. $core.method({
  13151. selector: "flush",
  13152. protocol: "actions",
  13153. fn: function (){
  13154. var self=this,$self=this;
  13155. return self;
  13156. },
  13157. args: [],
  13158. source: "flush",
  13159. referencedClasses: [],
  13160. messageSends: []
  13161. }),
  13162. $globals.Stream);
  13163. $core.addMethod(
  13164. $core.method({
  13165. selector: "isEmpty",
  13166. protocol: "testing",
  13167. fn: function (){
  13168. var self=this,$self=this;
  13169. return $core.withContext(function($ctx1) {
  13170. return $recv($self._size()).__eq((0));
  13171. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Stream)});
  13172. },
  13173. args: [],
  13174. source: "isEmpty\x0a\x09^ self size = 0",
  13175. referencedClasses: [],
  13176. messageSends: ["=", "size"]
  13177. }),
  13178. $globals.Stream);
  13179. $core.addMethod(
  13180. $core.method({
  13181. selector: "next",
  13182. protocol: "reading",
  13183. fn: function (){
  13184. var self=this,$self=this;
  13185. return $core.withContext(function($ctx1) {
  13186. var $1,$3,$2;
  13187. $1=$self._atEnd();
  13188. if($core.assert($1)){
  13189. return nil;
  13190. } else {
  13191. $3=$self._position();
  13192. $ctx1.sendIdx["position"]=1;
  13193. $2=$recv($3).__plus((1));
  13194. $self._position_($2);
  13195. return $recv($self["@collection"])._at_($self._position());
  13196. }
  13197. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Stream)});
  13198. },
  13199. args: [],
  13200. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09self position: self position + 1.\x0a\x09\x09\x09collection at: self position ]",
  13201. referencedClasses: [],
  13202. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  13203. }),
  13204. $globals.Stream);
  13205. $core.addMethod(
  13206. $core.method({
  13207. selector: "next:",
  13208. protocol: "reading",
  13209. fn: function (anInteger){
  13210. var self=this,$self=this;
  13211. var tempCollection;
  13212. return $core.withContext(function($ctx1) {
  13213. var $1;
  13214. tempCollection=$recv($recv($self._collection())._class())._new();
  13215. $recv(anInteger)._timesRepeat_((function(){
  13216. return $core.withContext(function($ctx2) {
  13217. $1=$self._atEnd();
  13218. if(!$core.assert($1)){
  13219. return $recv(tempCollection)._add_($self._next());
  13220. }
  13221. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13222. }));
  13223. return tempCollection;
  13224. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.Stream)});
  13225. },
  13226. args: ["anInteger"],
  13227. source: "next: anInteger\x0a\x09| tempCollection |\x0a\x09tempCollection := self collection class new.\x0a\x09anInteger timesRepeat: [\x0a\x09\x09self atEnd ifFalse: [\x0a\x09\x09tempCollection add: self next ]].\x0a\x09^ tempCollection",
  13228. referencedClasses: [],
  13229. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  13230. }),
  13231. $globals.Stream);
  13232. $core.addMethod(
  13233. $core.method({
  13234. selector: "nextPut:",
  13235. protocol: "writing",
  13236. fn: function (anObject){
  13237. var self=this,$self=this;
  13238. return $core.withContext(function($ctx1) {
  13239. var $2,$1,$3,$4;
  13240. $2=$self._position();
  13241. $ctx1.sendIdx["position"]=1;
  13242. $1=$recv($2).__plus((1));
  13243. $self._position_($1);
  13244. $3=$self._collection();
  13245. $4=$self._position();
  13246. $ctx1.sendIdx["position"]=2;
  13247. $recv($3)._at_put_($4,anObject);
  13248. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  13249. return self;
  13250. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Stream)});
  13251. },
  13252. args: ["anObject"],
  13253. source: "nextPut: anObject\x0a\x09self position: self position + 1.\x0a\x09self collection at: self position put: anObject.\x0a\x09self setStreamSize: (self streamSize max: self position)",
  13254. referencedClasses: [],
  13255. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  13256. }),
  13257. $globals.Stream);
  13258. $core.addMethod(
  13259. $core.method({
  13260. selector: "peek",
  13261. protocol: "reading",
  13262. fn: function (){
  13263. var self=this,$self=this;
  13264. return $core.withContext(function($ctx1) {
  13265. var $1;
  13266. $1=$self._atEnd();
  13267. if(!$core.assert($1)){
  13268. return $recv($self._collection())._at_($recv($self._position()).__plus((1)));
  13269. }
  13270. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.Stream)});
  13271. },
  13272. args: [],
  13273. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  13274. referencedClasses: [],
  13275. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  13276. }),
  13277. $globals.Stream);
  13278. $core.addMethod(
  13279. $core.method({
  13280. selector: "position",
  13281. protocol: "accessing",
  13282. fn: function (){
  13283. var self=this,$self=this;
  13284. return $core.withContext(function($ctx1) {
  13285. var $1,$receiver;
  13286. $1=$self["@position"];
  13287. if(($receiver = $1) == null || $receiver.a$nil){
  13288. $self["@position"]=(0);
  13289. return $self["@position"];
  13290. } else {
  13291. return $1;
  13292. }
  13293. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Stream)});
  13294. },
  13295. args: [],
  13296. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  13297. referencedClasses: [],
  13298. messageSends: ["ifNil:"]
  13299. }),
  13300. $globals.Stream);
  13301. $core.addMethod(
  13302. $core.method({
  13303. selector: "position:",
  13304. protocol: "accessing",
  13305. fn: function (anInteger){
  13306. var self=this,$self=this;
  13307. $self["@position"]=anInteger;
  13308. return self;
  13309. },
  13310. args: ["anInteger"],
  13311. source: "position: anInteger\x0a\x09position := anInteger",
  13312. referencedClasses: [],
  13313. messageSends: []
  13314. }),
  13315. $globals.Stream);
  13316. $core.addMethod(
  13317. $core.method({
  13318. selector: "reset",
  13319. protocol: "actions",
  13320. fn: function (){
  13321. var self=this,$self=this;
  13322. return $core.withContext(function($ctx1) {
  13323. $self._position_((0));
  13324. return self;
  13325. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.Stream)});
  13326. },
  13327. args: [],
  13328. source: "reset\x0a\x09self position: 0",
  13329. referencedClasses: [],
  13330. messageSends: ["position:"]
  13331. }),
  13332. $globals.Stream);
  13333. $core.addMethod(
  13334. $core.method({
  13335. selector: "resetContents",
  13336. protocol: "actions",
  13337. fn: function (){
  13338. var self=this,$self=this;
  13339. return $core.withContext(function($ctx1) {
  13340. $self._reset();
  13341. $self._setStreamSize_((0));
  13342. return self;
  13343. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.Stream)});
  13344. },
  13345. args: [],
  13346. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  13347. referencedClasses: [],
  13348. messageSends: ["reset", "setStreamSize:"]
  13349. }),
  13350. $globals.Stream);
  13351. $core.addMethod(
  13352. $core.method({
  13353. selector: "setCollection:",
  13354. protocol: "accessing",
  13355. fn: function (aCollection){
  13356. var self=this,$self=this;
  13357. $self["@collection"]=aCollection;
  13358. return self;
  13359. },
  13360. args: ["aCollection"],
  13361. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  13362. referencedClasses: [],
  13363. messageSends: []
  13364. }),
  13365. $globals.Stream);
  13366. $core.addMethod(
  13367. $core.method({
  13368. selector: "setStreamSize:",
  13369. protocol: "accessing",
  13370. fn: function (anInteger){
  13371. var self=this,$self=this;
  13372. $self["@streamSize"]=anInteger;
  13373. return self;
  13374. },
  13375. args: ["anInteger"],
  13376. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  13377. referencedClasses: [],
  13378. messageSends: []
  13379. }),
  13380. $globals.Stream);
  13381. $core.addMethod(
  13382. $core.method({
  13383. selector: "setToEnd",
  13384. protocol: "positioning",
  13385. fn: function (){
  13386. var self=this,$self=this;
  13387. return $core.withContext(function($ctx1) {
  13388. $self._position_($self._size());
  13389. return self;
  13390. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.Stream)});
  13391. },
  13392. args: [],
  13393. source: "setToEnd\x0a\x09self position: self size",
  13394. referencedClasses: [],
  13395. messageSends: ["position:", "size"]
  13396. }),
  13397. $globals.Stream);
  13398. $core.addMethod(
  13399. $core.method({
  13400. selector: "size",
  13401. protocol: "accessing",
  13402. fn: function (){
  13403. var self=this,$self=this;
  13404. return $core.withContext(function($ctx1) {
  13405. return $self._streamSize();
  13406. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Stream)});
  13407. },
  13408. args: [],
  13409. source: "size\x0a\x09^ self streamSize",
  13410. referencedClasses: [],
  13411. messageSends: ["streamSize"]
  13412. }),
  13413. $globals.Stream);
  13414. $core.addMethod(
  13415. $core.method({
  13416. selector: "skip:",
  13417. protocol: "positioning",
  13418. fn: function (anInteger){
  13419. var self=this,$self=this;
  13420. return $core.withContext(function($ctx1) {
  13421. $self._position_($recv($recv($self._position()).__plus(anInteger))._min_max_($self._size(),(0)));
  13422. return self;
  13423. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},$globals.Stream)});
  13424. },
  13425. args: ["anInteger"],
  13426. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  13427. referencedClasses: [],
  13428. messageSends: ["position:", "min:max:", "+", "position", "size"]
  13429. }),
  13430. $globals.Stream);
  13431. $core.addMethod(
  13432. $core.method({
  13433. selector: "streamSize",
  13434. protocol: "accessing",
  13435. fn: function (){
  13436. var self=this,$self=this;
  13437. return $self["@streamSize"];
  13438. },
  13439. args: [],
  13440. source: "streamSize\x0a\x09^ streamSize",
  13441. referencedClasses: [],
  13442. messageSends: []
  13443. }),
  13444. $globals.Stream);
  13445. $core.addMethod(
  13446. $core.method({
  13447. selector: "on:",
  13448. protocol: "instance creation",
  13449. fn: function (aCollection){
  13450. var self=this,$self=this;
  13451. return $core.withContext(function($ctx1) {
  13452. var $1;
  13453. $1=$self._new();
  13454. $recv($1)._setCollection_(aCollection);
  13455. $recv($1)._setStreamSize_($recv(aCollection)._size());
  13456. return $recv($1)._yourself();
  13457. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.Stream.a$cls)});
  13458. },
  13459. args: ["aCollection"],
  13460. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  13461. referencedClasses: [],
  13462. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  13463. }),
  13464. $globals.Stream.a$cls);
  13465. $core.addClass("StringStream", $globals.Stream, [], "Kernel-Collections");
  13466. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  13467. $core.addMethod(
  13468. $core.method({
  13469. selector: "cr",
  13470. protocol: "writing",
  13471. fn: function (){
  13472. var self=this,$self=this;
  13473. return $core.withContext(function($ctx1) {
  13474. return $self._nextPutAll_($recv($globals.String)._cr());
  13475. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.StringStream)});
  13476. },
  13477. args: [],
  13478. source: "cr\x0a\x09^ self nextPutAll: String cr",
  13479. referencedClasses: ["String"],
  13480. messageSends: ["nextPutAll:", "cr"]
  13481. }),
  13482. $globals.StringStream);
  13483. $core.addMethod(
  13484. $core.method({
  13485. selector: "crlf",
  13486. protocol: "writing",
  13487. fn: function (){
  13488. var self=this,$self=this;
  13489. return $core.withContext(function($ctx1) {
  13490. return $self._nextPutAll_($recv($globals.String)._crlf());
  13491. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.StringStream)});
  13492. },
  13493. args: [],
  13494. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  13495. referencedClasses: ["String"],
  13496. messageSends: ["nextPutAll:", "crlf"]
  13497. }),
  13498. $globals.StringStream);
  13499. $core.addMethod(
  13500. $core.method({
  13501. selector: "lf",
  13502. protocol: "writing",
  13503. fn: function (){
  13504. var self=this,$self=this;
  13505. return $core.withContext(function($ctx1) {
  13506. return $self._nextPutAll_($recv($globals.String)._lf());
  13507. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.StringStream)});
  13508. },
  13509. args: [],
  13510. source: "lf\x0a\x09^ self nextPutAll: String lf",
  13511. referencedClasses: ["String"],
  13512. messageSends: ["nextPutAll:", "lf"]
  13513. }),
  13514. $globals.StringStream);
  13515. $core.addMethod(
  13516. $core.method({
  13517. selector: "next:",
  13518. protocol: "reading",
  13519. fn: function (anInteger){
  13520. var self=this,$self=this;
  13521. var tempCollection;
  13522. return $core.withContext(function($ctx1) {
  13523. var $1;
  13524. tempCollection=$recv($recv($self._collection())._class())._new();
  13525. $recv(anInteger)._timesRepeat_((function(){
  13526. return $core.withContext(function($ctx2) {
  13527. $1=$self._atEnd();
  13528. if(!$core.assert($1)){
  13529. tempCollection=$recv(tempCollection).__comma($self._next());
  13530. return tempCollection;
  13531. }
  13532. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13533. }));
  13534. return tempCollection;
  13535. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.StringStream)});
  13536. },
  13537. args: ["anInteger"],
  13538. source: "next: anInteger\x0a\x09| tempCollection |\x0a\x09tempCollection := self collection class new.\x0a\x09anInteger timesRepeat: [\x0a\x09\x09self atEnd ifFalse: [\x0a\x09\x09tempCollection := tempCollection, self next ]].\x0a\x09^ tempCollection",
  13539. referencedClasses: [],
  13540. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  13541. }),
  13542. $globals.StringStream);
  13543. $core.addMethod(
  13544. $core.method({
  13545. selector: "nextPut:",
  13546. protocol: "writing",
  13547. fn: function (aString){
  13548. var self=this,$self=this;
  13549. return $core.withContext(function($ctx1) {
  13550. $self._nextPutAll_(aString);
  13551. return self;
  13552. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.StringStream)});
  13553. },
  13554. args: ["aString"],
  13555. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  13556. referencedClasses: [],
  13557. messageSends: ["nextPutAll:"]
  13558. }),
  13559. $globals.StringStream);
  13560. $core.addMethod(
  13561. $core.method({
  13562. selector: "nextPutAll:",
  13563. protocol: "writing",
  13564. fn: function (aString){
  13565. var self=this,$self=this;
  13566. var pre,post;
  13567. return $core.withContext(function($ctx1) {
  13568. var $1,$3,$2,$4,$5,$6,$9,$8,$10,$7,$11,$12,$14,$13;
  13569. $1=$self._atEnd();
  13570. if($core.assert($1)){
  13571. $3=$self._collection();
  13572. $ctx1.sendIdx["collection"]=1;
  13573. $2=$recv($3).__comma(aString);
  13574. $ctx1.sendIdx[","]=1;
  13575. $self._setCollection_($2);
  13576. $ctx1.sendIdx["setCollection:"]=1;
  13577. } else {
  13578. $4=$self._collection();
  13579. $ctx1.sendIdx["collection"]=2;
  13580. $5=$self._position();
  13581. $ctx1.sendIdx["position"]=1;
  13582. pre=$recv($4)._copyFrom_to_((1),$5);
  13583. $ctx1.sendIdx["copyFrom:to:"]=1;
  13584. $6=$self._collection();
  13585. $ctx1.sendIdx["collection"]=3;
  13586. $9=$self._position();
  13587. $ctx1.sendIdx["position"]=2;
  13588. $8=$recv($9).__plus((1));
  13589. $ctx1.sendIdx["+"]=2;
  13590. $10=$recv(aString)._size();
  13591. $ctx1.sendIdx["size"]=1;
  13592. $7=$recv($8).__plus($10);
  13593. $ctx1.sendIdx["+"]=1;
  13594. $11=$recv($self._collection())._size();
  13595. $ctx1.sendIdx["size"]=2;
  13596. post=$recv($6)._copyFrom_to_($7,$11);
  13597. $12=$recv($recv(pre).__comma(aString)).__comma(post);
  13598. $ctx1.sendIdx[","]=2;
  13599. $self._setCollection_($12);
  13600. }
  13601. $14=$self._position();
  13602. $ctx1.sendIdx["position"]=3;
  13603. $13=$recv($14).__plus($recv(aString)._size());
  13604. $self._position_($13);
  13605. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  13606. return self;
  13607. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},$globals.StringStream)});
  13608. },
  13609. args: ["aString"],
  13610. source: "nextPutAll: aString\x0a\x09| pre post |\x0a\x09self atEnd ifTrue: [ self setCollection: self collection, aString ] ifFalse: [\x0a\x09\x09pre := self collection copyFrom: 1 to: self position.\x0a\x09\x09post := self collection copyFrom: (self position + 1 + aString size) to: self collection size.\x0a\x09\x09self setCollection: pre, aString, post\x0a\x09].\x0a\x09self position: self position + aString size.\x0a\x09self setStreamSize: (self streamSize max: self position)",
  13611. referencedClasses: [],
  13612. messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"]
  13613. }),
  13614. $globals.StringStream);
  13615. $core.addMethod(
  13616. $core.method({
  13617. selector: "nextPutString:",
  13618. protocol: "writing",
  13619. fn: function (aString){
  13620. var self=this,$self=this;
  13621. return $core.withContext(function($ctx1) {
  13622. $self._nextPutAll_(aString);
  13623. return self;
  13624. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.StringStream)});
  13625. },
  13626. args: ["aString"],
  13627. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  13628. referencedClasses: [],
  13629. messageSends: ["nextPutAll:"]
  13630. }),
  13631. $globals.StringStream);
  13632. $core.addMethod(
  13633. $core.method({
  13634. selector: "print:",
  13635. protocol: "writing",
  13636. fn: function (anObject){
  13637. var self=this,$self=this;
  13638. return $core.withContext(function($ctx1) {
  13639. $recv(anObject)._printOn_(self);
  13640. return self;
  13641. }, function($ctx1) {$ctx1.fill(self,"print:",{anObject:anObject},$globals.StringStream)});
  13642. },
  13643. args: ["anObject"],
  13644. source: "print: anObject\x0a\x09anObject printOn: self",
  13645. referencedClasses: [],
  13646. messageSends: ["printOn:"]
  13647. }),
  13648. $globals.StringStream);
  13649. $core.addMethod(
  13650. $core.method({
  13651. selector: "printSymbol:",
  13652. protocol: "writing",
  13653. fn: function (anObject){
  13654. var self=this,$self=this;
  13655. return $core.withContext(function($ctx1) {
  13656. $recv(anObject)._asSymbolPrintOn_(self);
  13657. return self;
  13658. }, function($ctx1) {$ctx1.fill(self,"printSymbol:",{anObject:anObject},$globals.StringStream)});
  13659. },
  13660. args: ["anObject"],
  13661. source: "printSymbol: anObject\x0a\x09anObject asSymbolPrintOn: self",
  13662. referencedClasses: [],
  13663. messageSends: ["asSymbolPrintOn:"]
  13664. }),
  13665. $globals.StringStream);
  13666. $core.addMethod(
  13667. $core.method({
  13668. selector: "space",
  13669. protocol: "writing",
  13670. fn: function (){
  13671. var self=this,$self=this;
  13672. return $core.withContext(function($ctx1) {
  13673. $self._nextPut_(" ");
  13674. return self;
  13675. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.StringStream)});
  13676. },
  13677. args: [],
  13678. source: "space\x0a\x09self nextPut: ' '",
  13679. referencedClasses: [],
  13680. messageSends: ["nextPut:"]
  13681. }),
  13682. $globals.StringStream);
  13683. $core.addMethod(
  13684. $core.method({
  13685. selector: "tab",
  13686. protocol: "writing",
  13687. fn: function (){
  13688. var self=this,$self=this;
  13689. return $core.withContext(function($ctx1) {
  13690. return $self._nextPutAll_($recv($globals.String)._tab());
  13691. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.StringStream)});
  13692. },
  13693. args: [],
  13694. source: "tab\x0a\x09^ self nextPutAll: String tab",
  13695. referencedClasses: ["String"],
  13696. messageSends: ["nextPutAll:", "tab"]
  13697. }),
  13698. $globals.StringStream);
  13699. $core.addClass("Queue", $globals.Object, ["read", "readIndex", "write"], "Kernel-Collections");
  13700. $globals.Queue.comment="I am a one-sided queue.\x0a\x0a## Usage\x0a\x0aUse `#nextPut:` to add items to the queue.\x0aUse `#next` or `#nextIfAbsent:` to get (and remove) the next item in the queue.\x0a\x0a## Implementation notes\x0a\x0aA Queue uses two OrderedCollections inside,\x0a`read` is at the front, is not modified and only read using `readIndex`.\x0a`write` is at the back and is appended new items.\x0aWhen `read` is exhausted, `write` is promoted to `read` and new `write` is created.\x0a\x0aAs a consequence, no data moving is done by me, write appending may do data moving\x0awhen growing `write`, but this is left to engine to implement as good as it chooses to.";
  13701. $core.addMethod(
  13702. $core.method({
  13703. selector: "initialize",
  13704. protocol: "initialization",
  13705. fn: function (){
  13706. var self=this,$self=this;
  13707. return $core.withContext(function($ctx1) {
  13708. (
  13709. $ctx1.supercall = true,
  13710. ($globals.Queue.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  13711. $ctx1.supercall = false;
  13712. $self["@read"]=$recv($globals.OrderedCollection)._new();
  13713. $ctx1.sendIdx["new"]=1;
  13714. $self["@write"]=$recv($globals.OrderedCollection)._new();
  13715. $self["@readIndex"]=(1);
  13716. return self;
  13717. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Queue)});
  13718. },
  13719. args: [],
  13720. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  13721. referencedClasses: ["OrderedCollection"],
  13722. messageSends: ["initialize", "new"]
  13723. }),
  13724. $globals.Queue);
  13725. $core.addMethod(
  13726. $core.method({
  13727. selector: "next",
  13728. protocol: "accessing",
  13729. fn: function (){
  13730. var self=this,$self=this;
  13731. return $core.withContext(function($ctx1) {
  13732. return $self._nextIfAbsent_((function(){
  13733. return $core.withContext(function($ctx2) {
  13734. return $self._error_("Cannot read from empty Queue.");
  13735. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13736. }));
  13737. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Queue)});
  13738. },
  13739. args: [],
  13740. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  13741. referencedClasses: [],
  13742. messageSends: ["nextIfAbsent:", "error:"]
  13743. }),
  13744. $globals.Queue);
  13745. $core.addMethod(
  13746. $core.method({
  13747. selector: "nextIfAbsent:",
  13748. protocol: "accessing",
  13749. fn: function (aBlock){
  13750. var self=this,$self=this;
  13751. var result;
  13752. return $core.withContext(function($ctx1) {
  13753. var $1;
  13754. var $early={};
  13755. try {
  13756. result=$recv($self["@read"])._at_ifAbsent_($self["@readIndex"],(function(){
  13757. return $core.withContext(function($ctx2) {
  13758. $recv($self["@write"])._ifEmpty_((function(){
  13759. return $core.withContext(function($ctx3) {
  13760. $1=$recv($self["@readIndex"]).__gt((1));
  13761. if($core.assert($1)){
  13762. $self["@read"]=[];
  13763. $self["@readIndex"]=(1);
  13764. $self["@readIndex"];
  13765. }
  13766. throw $early=[$recv(aBlock)._value()];
  13767. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  13768. }));
  13769. $self["@read"]=$self["@write"];
  13770. $self["@readIndex"]=(1);
  13771. $self["@write"]=$recv($globals.OrderedCollection)._new();
  13772. return $recv($self["@read"])._first();
  13773. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13774. }));
  13775. $recv($self["@read"])._at_put_($self["@readIndex"],nil);
  13776. $self["@readIndex"]=$recv($self["@readIndex"]).__plus((1));
  13777. return result;
  13778. }
  13779. catch(e) {if(e===$early)return e[0]; throw e}
  13780. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},$globals.Queue)});
  13781. },
  13782. args: ["aBlock"],
  13783. source: "nextIfAbsent: aBlock\x0a\x09| result |\x0a\x09result := read at: readIndex ifAbsent: [\x0a\x09\x09write ifEmpty: [\x0a\x09\x09\x09readIndex > 1 ifTrue: [ read := #(). readIndex := 1 ].\x0a\x09\x09\x09^ aBlock value ].\x0a\x09\x09read := write.\x0a\x09\x09readIndex := 1.\x0a\x09\x09write := OrderedCollection new.\x0a\x09\x09read first ].\x0a\x09read at: readIndex put: nil.\x0a\x09readIndex := readIndex + 1.\x0a\x09^ result",
  13784. referencedClasses: ["OrderedCollection"],
  13785. messageSends: ["at:ifAbsent:", "ifEmpty:", "ifTrue:", ">", "value", "new", "first", "at:put:", "+"]
  13786. }),
  13787. $globals.Queue);
  13788. $core.addMethod(
  13789. $core.method({
  13790. selector: "nextPut:",
  13791. protocol: "accessing",
  13792. fn: function (anObject){
  13793. var self=this,$self=this;
  13794. return $core.withContext(function($ctx1) {
  13795. $recv($self["@write"])._add_(anObject);
  13796. return self;
  13797. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Queue)});
  13798. },
  13799. args: ["anObject"],
  13800. source: "nextPut: anObject\x0a\x09write add: anObject",
  13801. referencedClasses: [],
  13802. messageSends: ["add:"]
  13803. }),
  13804. $globals.Queue);
  13805. $core.addClass("RegularExpression", $globals.Object, [], "Kernel-Collections");
  13806. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  13807. $core.addMethod(
  13808. $core.method({
  13809. selector: "compile:",
  13810. protocol: "evaluating",
  13811. fn: function (aString){
  13812. var self=this,$self=this;
  13813. return $core.withContext(function($ctx1) {
  13814. return self.compile(aString);
  13815. return self;
  13816. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},$globals.RegularExpression)});
  13817. },
  13818. args: ["aString"],
  13819. source: "compile: aString\x0a\x09<inlineJS: 'return self.compile(aString)'>",
  13820. referencedClasses: [],
  13821. messageSends: []
  13822. }),
  13823. $globals.RegularExpression);
  13824. $core.addMethod(
  13825. $core.method({
  13826. selector: "exec:",
  13827. protocol: "evaluating",
  13828. fn: function (aString){
  13829. var self=this,$self=this;
  13830. return $core.withContext(function($ctx1) {
  13831. return self.exec(aString) || nil;
  13832. return self;
  13833. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},$globals.RegularExpression)});
  13834. },
  13835. args: ["aString"],
  13836. source: "exec: aString\x0a\x09<inlineJS: 'return self.exec(aString) || nil'>",
  13837. referencedClasses: [],
  13838. messageSends: []
  13839. }),
  13840. $globals.RegularExpression);
  13841. $core.addMethod(
  13842. $core.method({
  13843. selector: "test:",
  13844. protocol: "evaluating",
  13845. fn: function (aString){
  13846. var self=this,$self=this;
  13847. return $core.withContext(function($ctx1) {
  13848. return self.test(aString);
  13849. return self;
  13850. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},$globals.RegularExpression)});
  13851. },
  13852. args: ["aString"],
  13853. source: "test: aString\x0a\x09<inlineJS: 'return self.test(aString)'>",
  13854. referencedClasses: [],
  13855. messageSends: []
  13856. }),
  13857. $globals.RegularExpression);
  13858. $core.addMethod(
  13859. $core.method({
  13860. selector: "fromString:",
  13861. protocol: "instance creation",
  13862. fn: function (aString){
  13863. var self=this,$self=this;
  13864. return $core.withContext(function($ctx1) {
  13865. return $self._fromString_flag_(aString,"");
  13866. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.RegularExpression.a$cls)});
  13867. },
  13868. args: ["aString"],
  13869. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  13870. referencedClasses: [],
  13871. messageSends: ["fromString:flag:"]
  13872. }),
  13873. $globals.RegularExpression.a$cls);
  13874. $core.addMethod(
  13875. $core.method({
  13876. selector: "fromString:flag:",
  13877. protocol: "instance creation",
  13878. fn: function (aString,anotherString){
  13879. var self=this,$self=this;
  13880. return $core.withContext(function($ctx1) {
  13881. return new RegExp(aString, anotherString);
  13882. return self;
  13883. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},$globals.RegularExpression.a$cls)});
  13884. },
  13885. args: ["aString", "anotherString"],
  13886. source: "fromString: aString flag: anotherString\x0a\x09<inlineJS: 'return new RegExp(aString, anotherString)'>",
  13887. referencedClasses: [],
  13888. messageSends: []
  13889. }),
  13890. $globals.RegularExpression.a$cls);
  13891. $core.addTrait("TKeyValueCollection", "Kernel-Collections");
  13892. $core.addMethod(
  13893. $core.method({
  13894. selector: "at:",
  13895. protocol: "accessing",
  13896. fn: function (anIndex){
  13897. var self=this,$self=this;
  13898. return $core.withContext(function($ctx1) {
  13899. return $self._at_ifAbsent_(anIndex,(function(){
  13900. return $core.withContext(function($ctx2) {
  13901. return $self._errorNotFound();
  13902. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13903. }));
  13904. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},$globals.TKeyValueCollection)});
  13905. },
  13906. args: ["anIndex"],
  13907. source: "at: anIndex\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value stored at anIndex.\x0a\x09Otherwise, raise an error.\x22\x0a\x0a\x09^ self at: anIndex ifAbsent: [ self errorNotFound ]",
  13908. referencedClasses: [],
  13909. messageSends: ["at:ifAbsent:", "errorNotFound"]
  13910. }),
  13911. $globals.TKeyValueCollection);
  13912. $core.addMethod(
  13913. $core.method({
  13914. selector: "at:ifAbsent:",
  13915. protocol: "accessing",
  13916. fn: function (anIndex,aBlock){
  13917. var self=this,$self=this;
  13918. return $core.withContext(function($ctx1) {
  13919. $self._subclassResponsibility();
  13920. return self;
  13921. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.TKeyValueCollection)});
  13922. },
  13923. args: ["anIndex", "aBlock"],
  13924. source: "at: anIndex ifAbsent: aBlock\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value stored at anIndex.\x0a\x09Otherwise, answer the value of aBlock.\x22\x0a\x0a\x09self subclassResponsibility",
  13925. referencedClasses: [],
  13926. messageSends: ["subclassResponsibility"]
  13927. }),
  13928. $globals.TKeyValueCollection);
  13929. $core.addMethod(
  13930. $core.method({
  13931. selector: "at:ifAbsentPut:",
  13932. protocol: "accessing",
  13933. fn: function (aKey,aBlock){
  13934. var self=this,$self=this;
  13935. return $core.withContext(function($ctx1) {
  13936. return $self._at_ifAbsent_(aKey,(function(){
  13937. return $core.withContext(function($ctx2) {
  13938. return $self._at_put_(aKey,$recv(aBlock)._value());
  13939. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13940. }));
  13941. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},$globals.TKeyValueCollection)});
  13942. },
  13943. args: ["aKey", "aBlock"],
  13944. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  13945. referencedClasses: [],
  13946. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  13947. }),
  13948. $globals.TKeyValueCollection);
  13949. $core.addMethod(
  13950. $core.method({
  13951. selector: "at:ifPresent:",
  13952. protocol: "accessing",
  13953. fn: function (anIndex,aBlock){
  13954. var self=this,$self=this;
  13955. return $core.withContext(function($ctx1) {
  13956. return $self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  13957. return nil;
  13958. }));
  13959. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},$globals.TKeyValueCollection)});
  13960. },
  13961. args: ["anIndex", "aBlock"],
  13962. source: "at: anIndex ifPresent: aBlock\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value of evaluating aBlock with the value stored at anIndex.\x0a\x09Otherwise, answer nil.\x22\x0a\x0a\x09^ self at: anIndex ifPresent: aBlock ifAbsent: [ nil ]",
  13963. referencedClasses: [],
  13964. messageSends: ["at:ifPresent:ifAbsent:"]
  13965. }),
  13966. $globals.TKeyValueCollection);
  13967. $core.addMethod(
  13968. $core.method({
  13969. selector: "at:ifPresent:ifAbsent:",
  13970. protocol: "accessing",
  13971. fn: function (anIndex,aBlock,anotherBlock){
  13972. var self=this,$self=this;
  13973. return $core.withContext(function($ctx1) {
  13974. $self._subclassResponsibility();
  13975. return self;
  13976. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.TKeyValueCollection)});
  13977. },
  13978. args: ["anIndex", "aBlock", "anotherBlock"],
  13979. source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value of evaluating aBlock with the value stored at anIndex.\x0a\x09Otherwise, answer the value of anotherBlock.\x22\x0a\x0a\x09self subclassResponsibility",
  13980. referencedClasses: [],
  13981. messageSends: ["subclassResponsibility"]
  13982. }),
  13983. $globals.TKeyValueCollection);
  13984. $core.addMethod(
  13985. $core.method({
  13986. selector: "at:put:",
  13987. protocol: "accessing",
  13988. fn: function (anIndex,anObject){
  13989. var self=this,$self=this;
  13990. return $core.withContext(function($ctx1) {
  13991. $self._subclassResponsibility();
  13992. return self;
  13993. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.TKeyValueCollection)});
  13994. },
  13995. args: ["anIndex", "anObject"],
  13996. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  13997. referencedClasses: [],
  13998. messageSends: ["subclassResponsibility"]
  13999. }),
  14000. $globals.TKeyValueCollection);
  14001. $core.addMethod(
  14002. $core.method({
  14003. selector: "indexOf:",
  14004. protocol: "accessing",
  14005. fn: function (anObject){
  14006. var self=this,$self=this;
  14007. return $core.withContext(function($ctx1) {
  14008. return $self._indexOf_ifAbsent_(anObject,(function(){
  14009. return $core.withContext(function($ctx2) {
  14010. return $self._errorNotFound();
  14011. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14012. }));
  14013. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},$globals.TKeyValueCollection)});
  14014. },
  14015. args: ["anObject"],
  14016. source: "indexOf: anObject\x0a\x09\x22Lookup index at which anObject is stored in the receiver.\x0a\x09If not present, raise an error.\x22\x0a\x0a\x09^ self indexOf: anObject ifAbsent: [ self errorNotFound ]",
  14017. referencedClasses: [],
  14018. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  14019. }),
  14020. $globals.TKeyValueCollection);
  14021. $core.addMethod(
  14022. $core.method({
  14023. selector: "indexOf:ifAbsent:",
  14024. protocol: "accessing",
  14025. fn: function (anObject,aBlock){
  14026. var self=this,$self=this;
  14027. return $core.withContext(function($ctx1) {
  14028. $self._subclassResponsibility();
  14029. return self;
  14030. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.TKeyValueCollection)});
  14031. },
  14032. args: ["anObject", "aBlock"],
  14033. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09\x22Lookup index at which anObject is stored in the receiver.\x0a\x09If not present, return value of executing aBlock.\x22\x0a\x0a\x09self subclassResponsibility",
  14034. referencedClasses: [],
  14035. messageSends: ["subclassResponsibility"]
  14036. }),
  14037. $globals.TKeyValueCollection);
  14038. $core.addMethod(
  14039. $core.method({
  14040. selector: "with:do:",
  14041. protocol: "enumerating",
  14042. fn: function (anotherCollection,aBlock){
  14043. var self=this,$self=this;
  14044. return $core.withContext(function($ctx1) {
  14045. $self._withIndexDo_((function(each,index){
  14046. return $core.withContext(function($ctx2) {
  14047. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  14048. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  14049. }));
  14050. return self;
  14051. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.TKeyValueCollection)});
  14052. },
  14053. args: ["anotherCollection", "aBlock"],
  14054. source: "with: anotherCollection do: aBlock\x0a\x09\x22Calls aBlock with every value from self\x0a\x09and with indetically-indexed value from anotherCollection\x22\x0a\x0a\x09self withIndexDo: [ :each :index |\x0a\x09\x09aBlock value: each value: (anotherCollection at: index) ]",
  14055. referencedClasses: [],
  14056. messageSends: ["withIndexDo:", "value:value:", "at:"]
  14057. }),
  14058. $globals.TKeyValueCollection);
  14059. $core.addMethod(
  14060. $core.method({
  14061. selector: "withIndexDo:",
  14062. protocol: "enumerating",
  14063. fn: function (aBlock){
  14064. var self=this,$self=this;
  14065. return $core.withContext(function($ctx1) {
  14066. $self._subclassResponsibility();
  14067. return self;
  14068. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.TKeyValueCollection)});
  14069. },
  14070. args: ["aBlock"],
  14071. source: "withIndexDo: aBlock\x0a\x09\x22Calls aBlock with every value from self\x0a\x09and with its index as the second argument\x22\x0a\x0a\x09self subclassResponsibility",
  14072. referencedClasses: [],
  14073. messageSends: ["subclassResponsibility"]
  14074. }),
  14075. $globals.TKeyValueCollection);
  14076. $core.addTrait("TNativeZeroBasedCollection", "Kernel-Collections");
  14077. $core.addMethod(
  14078. $core.method({
  14079. selector: "at:ifAbsent:",
  14080. protocol: "accessing",
  14081. fn: function (anIndex,aBlock){
  14082. var self=this,$self=this;
  14083. return $core.withContext(function($ctx1) {
  14084. return anIndex >= 1 && anIndex <= self.length
  14085. ? self[anIndex - 1]
  14086. : aBlock._value()
  14087. ;
  14088. return self;
  14089. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  14090. },
  14091. args: ["anIndex", "aBlock"],
  14092. source: "at: anIndex ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09return anIndex >= 1 && anIndex <= self.length\x0a\x09\x09\x09? self[anIndex - 1]\x0a\x09\x09\x09: aBlock._value()\x0a\x09'>",
  14093. referencedClasses: [],
  14094. messageSends: []
  14095. }),
  14096. $globals.TNativeZeroBasedCollection);
  14097. $core.addMethod(
  14098. $core.method({
  14099. selector: "at:ifPresent:ifAbsent:",
  14100. protocol: "accessing",
  14101. fn: function (anIndex,aBlock,anotherBlock){
  14102. var self=this,$self=this;
  14103. return $core.withContext(function($ctx1) {
  14104. return anIndex >= 1 && anIndex <= self.length
  14105. ? aBlock._value_(self[anIndex - 1])
  14106. : anotherBlock._value()
  14107. ;
  14108. return self;
  14109. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.TNativeZeroBasedCollection)});
  14110. },
  14111. args: ["anIndex", "aBlock", "anotherBlock"],
  14112. source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09<inlineJS: '\x0a\x09\x09return anIndex >= 1 && anIndex <= self.length\x0a\x09\x09\x09? aBlock._value_(self[anIndex - 1])\x0a\x09\x09\x09: anotherBlock._value()\x0a\x09'>",
  14113. referencedClasses: [],
  14114. messageSends: []
  14115. }),
  14116. $globals.TNativeZeroBasedCollection);
  14117. $core.addMethod(
  14118. $core.method({
  14119. selector: "detect:ifNone:",
  14120. protocol: "enumerating",
  14121. fn: function (aBlock,anotherBlock){
  14122. var self=this,$self=this;
  14123. return $core.withContext(function($ctx1) {
  14124. for(var i = 0; i < self.length; i++)
  14125. if(aBlock._value_(self[i]))
  14126. return self[i];
  14127. return anotherBlock._value();
  14128. ;
  14129. return self;
  14130. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.TNativeZeroBasedCollection)});
  14131. },
  14132. args: ["aBlock", "anotherBlock"],
  14133. source: "detect: aBlock ifNone: anotherBlock\x0a\x09<inlineJS: '\x0a\x09\x09for(var i = 0; i < self.length; i++)\x0a\x09\x09\x09if(aBlock._value_(self[i]))\x0a\x09\x09\x09\x09return self[i];\x0a\x09\x09return anotherBlock._value();\x0a\x09'>",
  14134. referencedClasses: [],
  14135. messageSends: []
  14136. }),
  14137. $globals.TNativeZeroBasedCollection);
  14138. $core.addMethod(
  14139. $core.method({
  14140. selector: "do:",
  14141. protocol: "enumerating",
  14142. fn: function (aBlock){
  14143. var self=this,$self=this;
  14144. return $core.withContext(function($ctx1) {
  14145. for(var i=0; i < self.length; i++) {
  14146. aBlock._value_(self[i]);
  14147. }
  14148. ;
  14149. return self;
  14150. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  14151. },
  14152. args: ["aBlock"],
  14153. source: "do: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_(self[i]);\x0a\x09\x09}\x0a\x09'>",
  14154. referencedClasses: [],
  14155. messageSends: []
  14156. }),
  14157. $globals.TNativeZeroBasedCollection);
  14158. $core.addMethod(
  14159. $core.method({
  14160. selector: "indexOf:ifAbsent:",
  14161. protocol: "accessing",
  14162. fn: function (anObject,aBlock){
  14163. var self=this,$self=this;
  14164. return $core.withContext(function($ctx1) {
  14165. for(var i=0; i < self.length; i++) {
  14166. if($recv(self[i]).__eq(anObject)) {return i+1}
  14167. };
  14168. return aBlock._value();
  14169. ;
  14170. return self;
  14171. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  14172. },
  14173. args: ["anObject", "aBlock"],
  14174. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09if($recv(self[i]).__eq(anObject)) {return i+1}\x0a\x09\x09};\x0a\x09\x09return aBlock._value();\x0a\x09'>",
  14175. referencedClasses: [],
  14176. messageSends: []
  14177. }),
  14178. $globals.TNativeZeroBasedCollection);
  14179. $core.addMethod(
  14180. $core.method({
  14181. selector: "indexOf:startingAt:ifAbsent:",
  14182. protocol: "accessing",
  14183. fn: function (anObject,start,aBlock){
  14184. var self=this,$self=this;
  14185. return $core.withContext(function($ctx1) {
  14186. for(var i=start - 1; i < self.length; i++){
  14187. if($recv(self[i]).__eq(anObject)) {return i+1}
  14188. }
  14189. return aBlock._value();
  14190. ;
  14191. return self;
  14192. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  14193. },
  14194. args: ["anObject", "start", "aBlock"],
  14195. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09for(var i=start - 1; i < self.length; i++){\x0a\x09\x09\x09if($recv(self[i]).__eq(anObject)) {return i+1}\x0a\x09\x09}\x0a\x09\x09return aBlock._value();\x0a\x09'>",
  14196. referencedClasses: [],
  14197. messageSends: []
  14198. }),
  14199. $globals.TNativeZeroBasedCollection);
  14200. $core.addMethod(
  14201. $core.method({
  14202. selector: "single",
  14203. protocol: "accessing",
  14204. fn: function (){
  14205. var self=this,$self=this;
  14206. return $core.withContext(function($ctx1) {
  14207. if (self.length == 0) throw new Error("Collection is empty");
  14208. if (self.length > 1) throw new Error("Collection holds more than one element.");
  14209. return self[0];;
  14210. return self;
  14211. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.TNativeZeroBasedCollection)});
  14212. },
  14213. args: [],
  14214. source: "single\x0a<inlineJS: '\x0a\x09if (self.length == 0) throw new Error(\x22Collection is empty\x22);\x0a\x09if (self.length > 1) throw new Error(\x22Collection holds more than one element.\x22);\x0a\x09return self[0];\x0a'>",
  14215. referencedClasses: [],
  14216. messageSends: []
  14217. }),
  14218. $globals.TNativeZeroBasedCollection);
  14219. $core.addMethod(
  14220. $core.method({
  14221. selector: "size",
  14222. protocol: "accessing",
  14223. fn: function (){
  14224. var self=this,$self=this;
  14225. return $core.withContext(function($ctx1) {
  14226. return self.length;
  14227. return self;
  14228. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.TNativeZeroBasedCollection)});
  14229. },
  14230. args: [],
  14231. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  14232. referencedClasses: [],
  14233. messageSends: []
  14234. }),
  14235. $globals.TNativeZeroBasedCollection);
  14236. $core.addMethod(
  14237. $core.method({
  14238. selector: "with:do:",
  14239. protocol: "enumerating",
  14240. fn: function (anotherCollection,aBlock){
  14241. var self=this,$self=this;
  14242. return $core.withContext(function($ctx1) {
  14243. $recv(anotherCollection)._first_(0); // #guardSequenceableCollection
  14244. for(var i=0; i<self.length; i++) {
  14245. aBlock._value_value_(self[i], anotherCollection[i]);
  14246. }
  14247. ;
  14248. return self;
  14249. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  14250. },
  14251. args: ["anotherCollection", "aBlock"],
  14252. source: "with: anotherCollection do: aBlock\x0a\x09<inlineJS: '\x0a\x09 $recv(anotherCollection)._first_(0); // #guardSequenceableCollection\x0a\x09\x09for(var i=0; i<self.length; i++) {\x0a\x09\x09\x09aBlock._value_value_(self[i], anotherCollection[i]);\x0a\x09\x09}\x0a\x09'>",
  14253. referencedClasses: [],
  14254. messageSends: []
  14255. }),
  14256. $globals.TNativeZeroBasedCollection);
  14257. $core.addMethod(
  14258. $core.method({
  14259. selector: "withIndexDo:",
  14260. protocol: "enumerating",
  14261. fn: function (aBlock){
  14262. var self=this,$self=this;
  14263. return $core.withContext(function($ctx1) {
  14264. for(var i=0; i < self.length; i++) {
  14265. aBlock._value_value_(self[i], i+1);
  14266. }
  14267. ;
  14268. return self;
  14269. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  14270. },
  14271. args: ["aBlock"],
  14272. source: "withIndexDo: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_value_(self[i], i+1);\x0a\x09\x09}\x0a\x09'>",
  14273. referencedClasses: [],
  14274. messageSends: []
  14275. }),
  14276. $globals.TNativeZeroBasedCollection);
  14277. $core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.AssociativeCollection);
  14278. $core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.SequenceableCollection);
  14279. $core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.Array);
  14280. $core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.String);
  14281. });
  14282. define('amber_core/Kernel-Classes',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Helpers", "amber_core/Kernel-Objects"], function($boot){"use strict";
  14283. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  14284. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  14285. var $pkg = $core.addPackage("Kernel-Classes");
  14286. $pkg.innerEval = function (expr) { return eval(expr); };
  14287. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  14288. $core.addClass("Behavior", $globals.Object, ["organization"], "Kernel-Classes");
  14289. $globals.Behavior.comment="I am the superclass of all class objects.\x0a\x0aIn addition to BehaviorBody, I define superclass/subclass relationships and instantiation.\x0a\x0aI define the protocol for creating instances of a class with `#basicNew` and `#new` (see `boot.js` for class constructors details).\x0a\x0aMy instances know about the subclass/superclass relationships between classes and contain the description that instances are created from.\x0a\x0aI also provide iterating over the class hierarchy.";
  14290. $core.addMethod(
  14291. $core.method({
  14292. selector: "allInstanceVariableNames",
  14293. protocol: "accessing",
  14294. fn: function (){
  14295. var self=this,$self=this;
  14296. var result;
  14297. return $core.withContext(function($ctx1) {
  14298. var $1,$receiver;
  14299. result=$recv($self._instanceVariableNames())._copy();
  14300. $1=$self._superclass();
  14301. $ctx1.sendIdx["superclass"]=1;
  14302. if(($receiver = $1) == null || $receiver.a$nil){
  14303. $1;
  14304. } else {
  14305. $recv(result)._addAll_($recv($self._superclass())._allInstanceVariableNames());
  14306. }
  14307. return result;
  14308. }, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result},$globals.Behavior)});
  14309. },
  14310. args: [],
  14311. source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09\x09result addAll: self superclass allInstanceVariableNames ].\x0a\x09^ result",
  14312. referencedClasses: [],
  14313. messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "superclass", "addAll:", "allInstanceVariableNames"]
  14314. }),
  14315. $globals.Behavior);
  14316. $core.addMethod(
  14317. $core.method({
  14318. selector: "allSelectors",
  14319. protocol: "accessing",
  14320. fn: function (){
  14321. var self=this,$self=this;
  14322. return $core.withContext(function($ctx1) {
  14323. var $1,$2;
  14324. $1=$self._allSuperclasses();
  14325. $2=$self._selectors();
  14326. $ctx1.sendIdx["selectors"]=1;
  14327. return $recv($1)._inject_into_($2,(function(acc,each){
  14328. return $core.withContext(function($ctx2) {
  14329. $recv(acc)._addAll_($recv(each)._selectors());
  14330. return $recv(acc)._yourself();
  14331. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  14332. }));
  14333. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Behavior)});
  14334. },
  14335. args: [],
  14336. source: "allSelectors\x0a\x09^ self allSuperclasses\x0a\x09\x09inject: self selectors\x0a\x09\x09into: [ :acc :each | acc addAll: each selectors; yourself ]",
  14337. referencedClasses: [],
  14338. messageSends: ["inject:into:", "allSuperclasses", "selectors", "addAll:", "yourself"]
  14339. }),
  14340. $globals.Behavior);
  14341. $core.addMethod(
  14342. $core.method({
  14343. selector: "allSubclasses",
  14344. protocol: "accessing",
  14345. fn: function (){
  14346. var self=this,$self=this;
  14347. return $core.withContext(function($ctx1) {
  14348. return $recv($globals.Array)._streamContents_((function(str){
  14349. return $core.withContext(function($ctx2) {
  14350. return $self._allSubclassesDo_((function(each){
  14351. return $core.withContext(function($ctx3) {
  14352. return $recv(str)._nextPut_(each);
  14353. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  14354. }));
  14355. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  14356. }));
  14357. }, function($ctx1) {$ctx1.fill(self,"allSubclasses",{},$globals.Behavior)});
  14358. },
  14359. args: [],
  14360. source: "allSubclasses\x0a\x09\x22Answer an collection of the receiver's and the receiver's descendent's subclasses. \x22\x0a\x0a\x09^ Array streamContents: [ :str | self allSubclassesDo: [ :each | str nextPut: each ] ]",
  14361. referencedClasses: ["Array"],
  14362. messageSends: ["streamContents:", "allSubclassesDo:", "nextPut:"]
  14363. }),
  14364. $globals.Behavior);
  14365. $core.addMethod(
  14366. $core.method({
  14367. selector: "allSubclassesDo:",
  14368. protocol: "enumerating",
  14369. fn: function (aBlock){
  14370. var self=this,$self=this;
  14371. return $core.withContext(function($ctx1) {
  14372. $core.traverseClassTree(self, function(subclass) {
  14373. if (subclass !== self) aBlock._value_(subclass);
  14374. });
  14375. return self;
  14376. }, function($ctx1) {$ctx1.fill(self,"allSubclassesDo:",{aBlock:aBlock},$globals.Behavior)});
  14377. },
  14378. args: ["aBlock"],
  14379. source: "allSubclassesDo: aBlock\x0a\x09\x22Evaluate the argument, aBlock, for each of the receiver's subclasses.\x22\x0a\x0a<inlineJS: '$core.traverseClassTree(self, function(subclass) {\x0a\x09if (subclass !== self) aBlock._value_(subclass);\x0a})'>",
  14380. referencedClasses: [],
  14381. messageSends: []
  14382. }),
  14383. $globals.Behavior);
  14384. $core.addMethod(
  14385. $core.method({
  14386. selector: "allSuperclasses",
  14387. protocol: "accessing",
  14388. fn: function (){
  14389. var self=this,$self=this;
  14390. return $core.withContext(function($ctx1) {
  14391. var $1,$3,$2,$receiver;
  14392. $1=$self._superclass();
  14393. $ctx1.sendIdx["superclass"]=1;
  14394. if(($receiver = $1) == null || $receiver.a$nil){
  14395. return [];
  14396. } else {
  14397. $1;
  14398. }
  14399. $3=$self._superclass();
  14400. $ctx1.sendIdx["superclass"]=2;
  14401. $2=$recv($globals.OrderedCollection)._with_($3);
  14402. $recv($2)._addAll_($recv($self._superclass())._allSuperclasses());
  14403. return $recv($2)._yourself();
  14404. }, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{},$globals.Behavior)});
  14405. },
  14406. args: [],
  14407. source: "allSuperclasses\x0a\x09\x0a\x09self superclass ifNil: [ ^ #() ].\x0a\x09\x0a\x09^ (OrderedCollection with: self superclass)\x0a\x09\x09addAll: self superclass allSuperclasses;\x0a\x09\x09yourself",
  14408. referencedClasses: ["OrderedCollection"],
  14409. messageSends: ["ifNil:", "superclass", "addAll:", "with:", "allSuperclasses", "yourself"]
  14410. }),
  14411. $globals.Behavior);
  14412. $core.addMethod(
  14413. $core.method({
  14414. selector: "basicNew",
  14415. protocol: "instance creation",
  14416. fn: function (){
  14417. var self=this,$self=this;
  14418. return $core.withContext(function($ctx1) {
  14419. return new self.fn();
  14420. return self;
  14421. }, function($ctx1) {$ctx1.fill(self,"basicNew",{},$globals.Behavior)});
  14422. },
  14423. args: [],
  14424. source: "basicNew\x0a\x09<inlineJS: 'return new self.fn()'>",
  14425. referencedClasses: [],
  14426. messageSends: []
  14427. }),
  14428. $globals.Behavior);
  14429. $core.addMethod(
  14430. $core.method({
  14431. selector: "basicOrganization",
  14432. protocol: "accessing",
  14433. fn: function (){
  14434. var self=this,$self=this;
  14435. return $self["@organization"];
  14436. },
  14437. args: [],
  14438. source: "basicOrganization\x0a\x09^ organization",
  14439. referencedClasses: [],
  14440. messageSends: []
  14441. }),
  14442. $globals.Behavior);
  14443. $core.addMethod(
  14444. $core.method({
  14445. selector: "basicOrganization:",
  14446. protocol: "accessing",
  14447. fn: function (aClassOrganizer){
  14448. var self=this,$self=this;
  14449. $self["@organization"]=aClassOrganizer;
  14450. return self;
  14451. },
  14452. args: ["aClassOrganizer"],
  14453. source: "basicOrganization: aClassOrganizer\x0a\x09organization := aClassOrganizer",
  14454. referencedClasses: [],
  14455. messageSends: []
  14456. }),
  14457. $globals.Behavior);
  14458. $core.addMethod(
  14459. $core.method({
  14460. selector: "canUnderstand:",
  14461. protocol: "testing",
  14462. fn: function (aSelector){
  14463. var self=this,$self=this;
  14464. return $core.withContext(function($ctx1) {
  14465. var $2,$1;
  14466. return $recv($self._includesSelector_($recv(aSelector)._asString()))._or_((function(){
  14467. return $core.withContext(function($ctx2) {
  14468. $2=$self._superclass();
  14469. $ctx2.sendIdx["superclass"]=1;
  14470. $1=$recv($2)._notNil();
  14471. return $recv($1)._and_((function(){
  14472. return $core.withContext(function($ctx3) {
  14473. return $recv($self._superclass())._canUnderstand_(aSelector);
  14474. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  14475. }));
  14476. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14477. }));
  14478. }, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector},$globals.Behavior)});
  14479. },
  14480. args: ["aSelector"],
  14481. source: "canUnderstand: aSelector\x0a\x09^ (self includesSelector: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [ self superclass canUnderstand: aSelector ]]",
  14482. referencedClasses: [],
  14483. messageSends: ["or:", "includesSelector:", "asString", "and:", "notNil", "superclass", "canUnderstand:"]
  14484. }),
  14485. $globals.Behavior);
  14486. $core.addMethod(
  14487. $core.method({
  14488. selector: "includesBehavior:",
  14489. protocol: "testing",
  14490. fn: function (aClass){
  14491. var self=this,$self=this;
  14492. return $core.withContext(function($ctx1) {
  14493. return $recv($self.__eq_eq(aClass))._or_((function(){
  14494. return $core.withContext(function($ctx2) {
  14495. return $self._inheritsFrom_(aClass);
  14496. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14497. }));
  14498. }, function($ctx1) {$ctx1.fill(self,"includesBehavior:",{aClass:aClass},$globals.Behavior)});
  14499. },
  14500. args: ["aClass"],
  14501. source: "includesBehavior: aClass\x0a\x09^ self == aClass or: [\x0a\x09\x09\x09self inheritsFrom: aClass ]",
  14502. referencedClasses: [],
  14503. messageSends: ["or:", "==", "inheritsFrom:"]
  14504. }),
  14505. $globals.Behavior);
  14506. $core.addMethod(
  14507. $core.method({
  14508. selector: "inheritsFrom:",
  14509. protocol: "testing",
  14510. fn: function (aClass){
  14511. var self=this,$self=this;
  14512. return $core.withContext(function($ctx1) {
  14513. var $1,$3,$2,$receiver;
  14514. $1=$self._superclass();
  14515. $ctx1.sendIdx["superclass"]=1;
  14516. if(($receiver = $1) == null || $receiver.a$nil){
  14517. return false;
  14518. } else {
  14519. $1;
  14520. }
  14521. $3=$self._superclass();
  14522. $ctx1.sendIdx["superclass"]=2;
  14523. $2=$recv(aClass).__eq_eq($3);
  14524. return $recv($2)._or_((function(){
  14525. return $core.withContext(function($ctx2) {
  14526. return $recv($self._superclass())._inheritsFrom_(aClass);
  14527. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  14528. }));
  14529. }, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass},$globals.Behavior)});
  14530. },
  14531. args: ["aClass"],
  14532. source: "inheritsFrom: aClass\x0a\x09self superclass ifNil: [ ^ false ].\x0a\x0a\x09^ aClass == self superclass or: [ \x0a\x09\x09self superclass inheritsFrom: aClass ]",
  14533. referencedClasses: [],
  14534. messageSends: ["ifNil:", "superclass", "or:", "==", "inheritsFrom:"]
  14535. }),
  14536. $globals.Behavior);
  14537. $core.addMethod(
  14538. $core.method({
  14539. selector: "instanceVariableNames",
  14540. protocol: "accessing",
  14541. fn: function (){
  14542. var self=this,$self=this;
  14543. return $core.withContext(function($ctx1) {
  14544. return self.iVarNames;
  14545. return self;
  14546. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames",{},$globals.Behavior)});
  14547. },
  14548. args: [],
  14549. source: "instanceVariableNames\x0a\x09<inlineJS: 'return self.iVarNames'>",
  14550. referencedClasses: [],
  14551. messageSends: []
  14552. }),
  14553. $globals.Behavior);
  14554. $core.addMethod(
  14555. $core.method({
  14556. selector: "isBehavior",
  14557. protocol: "testing",
  14558. fn: function (){
  14559. var self=this,$self=this;
  14560. return true;
  14561. },
  14562. args: [],
  14563. source: "isBehavior\x0a\x09^ true",
  14564. referencedClasses: [],
  14565. messageSends: []
  14566. }),
  14567. $globals.Behavior);
  14568. $core.addMethod(
  14569. $core.method({
  14570. selector: "javascriptConstructor",
  14571. protocol: "accessing",
  14572. fn: function (){
  14573. var self=this,$self=this;
  14574. return $core.withContext(function($ctx1) {
  14575. return self.fn;
  14576. return self;
  14577. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor",{},$globals.Behavior)});
  14578. },
  14579. args: [],
  14580. source: "javascriptConstructor\x0a\x09\x22Answer the JS constructor used to instantiate. See boot.js\x22\x0a\x09\x0a\x09<inlineJS: 'return self.fn'>",
  14581. referencedClasses: [],
  14582. messageSends: []
  14583. }),
  14584. $globals.Behavior);
  14585. $core.addMethod(
  14586. $core.method({
  14587. selector: "javascriptConstructor:",
  14588. protocol: "accessing",
  14589. fn: function (aJavaScriptFunction){
  14590. var self=this,$self=this;
  14591. return $core.withContext(function($ctx1) {
  14592. $core.setClassConstructor(self, aJavaScriptFunction);;
  14593. return self;
  14594. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor:",{aJavaScriptFunction:aJavaScriptFunction},$globals.Behavior)});
  14595. },
  14596. args: ["aJavaScriptFunction"],
  14597. source: "javascriptConstructor: aJavaScriptFunction\x0a\x09\x22Set the JS constructor used to instantiate.\x0a\x09See the JS counter-part in boot.js `$core.setClassConstructor'\x22\x0a\x09\x0a\x09<inlineJS: '$core.setClassConstructor(self, aJavaScriptFunction);'>",
  14598. referencedClasses: [],
  14599. messageSends: []
  14600. }),
  14601. $globals.Behavior);
  14602. $core.addMethod(
  14603. $core.method({
  14604. selector: "lookupSelector:",
  14605. protocol: "accessing",
  14606. fn: function (selector){
  14607. var self=this,$self=this;
  14608. var lookupClass;
  14609. return $core.withContext(function($ctx1) {
  14610. var $1;
  14611. var $early={};
  14612. try {
  14613. lookupClass=self;
  14614. $recv((function(){
  14615. return $core.withContext(function($ctx2) {
  14616. return $recv(lookupClass).__eq(nil);
  14617. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14618. }))._whileFalse_((function(){
  14619. return $core.withContext(function($ctx2) {
  14620. $1=$recv(lookupClass)._includesSelector_(selector);
  14621. if($core.assert($1)){
  14622. throw $early=[$recv(lookupClass)._methodAt_(selector)];
  14623. }
  14624. lookupClass=$recv(lookupClass)._superclass();
  14625. return lookupClass;
  14626. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  14627. }));
  14628. return nil;
  14629. }
  14630. catch(e) {if(e===$early)return e[0]; throw e}
  14631. }, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass},$globals.Behavior)});
  14632. },
  14633. args: ["selector"],
  14634. source: "lookupSelector: selector\x0a\x09\x22Look up the given selector in my methodDictionary.\x0a\x09Return the corresponding method if found.\x0a\x09Otherwise chase the superclass chain and try again.\x0a\x09Return nil if no method is found.\x22\x0a\x09\x0a\x09| lookupClass |\x0a\x09\x0a\x09lookupClass := self.\x0a\x09[ lookupClass = nil ] whileFalse: [\x0a\x09\x09(lookupClass includesSelector: selector)\x0a\x09\x09\x09\x09ifTrue: [ ^ lookupClass methodAt: selector ].\x0a\x09\x09\x09lookupClass := lookupClass superclass ].\x0a\x09^ nil",
  14635. referencedClasses: [],
  14636. messageSends: ["whileFalse:", "=", "ifTrue:", "includesSelector:", "methodAt:", "superclass"]
  14637. }),
  14638. $globals.Behavior);
  14639. $core.addMethod(
  14640. $core.method({
  14641. selector: "new",
  14642. protocol: "instance creation",
  14643. fn: function (){
  14644. var self=this,$self=this;
  14645. return $core.withContext(function($ctx1) {
  14646. return $recv($self._basicNew())._initialize();
  14647. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Behavior)});
  14648. },
  14649. args: [],
  14650. source: "new\x0a\x09^ self basicNew initialize",
  14651. referencedClasses: [],
  14652. messageSends: ["initialize", "basicNew"]
  14653. }),
  14654. $globals.Behavior);
  14655. $core.addMethod(
  14656. $core.method({
  14657. selector: "prototype",
  14658. protocol: "accessing",
  14659. fn: function (){
  14660. var self=this,$self=this;
  14661. return $core.withContext(function($ctx1) {
  14662. return self.fn.prototype;
  14663. return self;
  14664. }, function($ctx1) {$ctx1.fill(self,"prototype",{},$globals.Behavior)});
  14665. },
  14666. args: [],
  14667. source: "prototype\x0a\x09<inlineJS: 'return self.fn.prototype'>",
  14668. referencedClasses: [],
  14669. messageSends: []
  14670. }),
  14671. $globals.Behavior);
  14672. $core.addMethod(
  14673. $core.method({
  14674. selector: "subclasses",
  14675. protocol: "accessing",
  14676. fn: function (){
  14677. var self=this,$self=this;
  14678. return $core.withContext(function($ctx1) {
  14679. $self._subclassResponsibility();
  14680. return self;
  14681. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Behavior)});
  14682. },
  14683. args: [],
  14684. source: "subclasses\x0a\x09self subclassResponsibility",
  14685. referencedClasses: [],
  14686. messageSends: ["subclassResponsibility"]
  14687. }),
  14688. $globals.Behavior);
  14689. $core.addMethod(
  14690. $core.method({
  14691. selector: "superclass",
  14692. protocol: "accessing",
  14693. fn: function (){
  14694. var self=this,$self=this;
  14695. return $core.withContext(function($ctx1) {
  14696. return self.superclass;
  14697. return self;
  14698. }, function($ctx1) {$ctx1.fill(self,"superclass",{},$globals.Behavior)});
  14699. },
  14700. args: [],
  14701. source: "superclass\x0a\x09<inlineJS: 'return self.superclass'>",
  14702. referencedClasses: [],
  14703. messageSends: []
  14704. }),
  14705. $globals.Behavior);
  14706. $core.addMethod(
  14707. $core.method({
  14708. selector: "theMetaClass",
  14709. protocol: "accessing",
  14710. fn: function (){
  14711. var self=this,$self=this;
  14712. return $core.withContext(function($ctx1) {
  14713. $self._subclassResponsibility();
  14714. return self;
  14715. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Behavior)});
  14716. },
  14717. args: [],
  14718. source: "theMetaClass\x0a\x09self subclassResponsibility",
  14719. referencedClasses: [],
  14720. messageSends: ["subclassResponsibility"]
  14721. }),
  14722. $globals.Behavior);
  14723. $core.addMethod(
  14724. $core.method({
  14725. selector: "theNonMetaClass",
  14726. protocol: "accessing",
  14727. fn: function (){
  14728. var self=this,$self=this;
  14729. return $core.withContext(function($ctx1) {
  14730. $self._subclassResponsibility();
  14731. return self;
  14732. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Behavior)});
  14733. },
  14734. args: [],
  14735. source: "theNonMetaClass\x0a\x09self subclassResponsibility",
  14736. referencedClasses: [],
  14737. messageSends: ["subclassResponsibility"]
  14738. }),
  14739. $globals.Behavior);
  14740. $core.addMethod(
  14741. $core.method({
  14742. selector: "withAllSubclasses",
  14743. protocol: "accessing",
  14744. fn: function (){
  14745. var self=this,$self=this;
  14746. return $core.withContext(function($ctx1) {
  14747. var $1;
  14748. $1=$recv($globals.Array)._with_(self);
  14749. $recv($1)._addAll_($self._allSubclasses());
  14750. return $recv($1)._yourself();
  14751. }, function($ctx1) {$ctx1.fill(self,"withAllSubclasses",{},$globals.Behavior)});
  14752. },
  14753. args: [],
  14754. source: "withAllSubclasses\x0a\x09^ (Array with: self) addAll: self allSubclasses; yourself",
  14755. referencedClasses: ["Array"],
  14756. messageSends: ["addAll:", "with:", "allSubclasses", "yourself"]
  14757. }),
  14758. $globals.Behavior);
  14759. $core.addClass("Class", $globals.Behavior, ["package"], "Kernel-Classes");
  14760. $globals.Class.comment="I am __the__ class object.\x0a\x0aMy instances are the classes of the system.\x0aClass creation is done throught a `ClassBuilder` instance.";
  14761. $core.addMethod(
  14762. $core.method({
  14763. selector: "basicPackage:",
  14764. protocol: "accessing",
  14765. fn: function (aPackage){
  14766. var self=this,$self=this;
  14767. $self["@package"]=aPackage;
  14768. return self;
  14769. },
  14770. args: ["aPackage"],
  14771. source: "basicPackage: aPackage\x0a\x09package := aPackage",
  14772. referencedClasses: [],
  14773. messageSends: []
  14774. }),
  14775. $globals.Class);
  14776. $core.addMethod(
  14777. $core.method({
  14778. selector: "classTag",
  14779. protocol: "accessing",
  14780. fn: function (){
  14781. var self=this,$self=this;
  14782. return "class";
  14783. },
  14784. args: [],
  14785. source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'class'",
  14786. referencedClasses: [],
  14787. messageSends: []
  14788. }),
  14789. $globals.Class);
  14790. $core.addMethod(
  14791. $core.method({
  14792. selector: "definition",
  14793. protocol: "accessing",
  14794. fn: function (){
  14795. var self=this,$self=this;
  14796. return $core.withContext(function($ctx1) {
  14797. var $1,$2;
  14798. return $recv($globals.String)._streamContents_((function(stream){
  14799. return $core.withContext(function($ctx2) {
  14800. $recv(stream)._print_($self._superclass());
  14801. $ctx2.sendIdx["print:"]=1;
  14802. $recv(stream)._write_(" subclass: ");
  14803. $ctx2.sendIdx["write:"]=1;
  14804. $recv(stream)._printSymbol_($self._name());
  14805. $recv(stream)._lf();
  14806. $ctx2.sendIdx["lf"]=1;
  14807. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifNotEmpty_((function(tcd){
  14808. return $core.withContext(function($ctx3) {
  14809. $1=$recv($globals.String)._tab();
  14810. $ctx3.sendIdx["tab"]=1;
  14811. $2=$recv($globals.String)._lf();
  14812. $ctx3.sendIdx["lf"]=2;
  14813. return [$1,"uses: ",tcd,$2];
  14814. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,2)});
  14815. })));
  14816. $ctx2.sendIdx["write:"]=2;
  14817. $recv(stream)._tab();
  14818. $ctx2.sendIdx["tab"]=2;
  14819. $recv(stream)._write_("instanceVariableNames: ");
  14820. $ctx2.sendIdx["write:"]=3;
  14821. $recv(stream)._print_(" "._join_($self._instanceVariableNames()));
  14822. $ctx2.sendIdx["print:"]=2;
  14823. $recv(stream)._lf();
  14824. $recv(stream)._tab();
  14825. $recv(stream)._write_("package: ");
  14826. return $recv(stream)._print_($self._category());
  14827. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  14828. }));
  14829. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Class)});
  14830. },
  14831. args: [],
  14832. source: "definition\x0a\x09^ String streamContents: [ :stream | stream\x0a\x09\x09print: self superclass; write: ' subclass: '; printSymbol: self name; lf;\x0a\x09\x09write: (self traitCompositionDefinition ifNotEmpty: [ :tcd | { String tab. 'uses: '. tcd. String lf }]);\x0a\x09\x09tab; write: 'instanceVariableNames: '; print: (' ' join: self instanceVariableNames); lf;\x0a\x09\x09tab; write: 'package: '; print: self category ]",
  14833. referencedClasses: ["String"],
  14834. messageSends: ["streamContents:", "print:", "superclass", "write:", "printSymbol:", "name", "lf", "ifNotEmpty:", "traitCompositionDefinition", "tab", "join:", "instanceVariableNames", "category"]
  14835. }),
  14836. $globals.Class);
  14837. $core.addMethod(
  14838. $core.method({
  14839. selector: "isClass",
  14840. protocol: "testing",
  14841. fn: function (){
  14842. var self=this,$self=this;
  14843. return true;
  14844. },
  14845. args: [],
  14846. source: "isClass\x0a\x09^ true",
  14847. referencedClasses: [],
  14848. messageSends: []
  14849. }),
  14850. $globals.Class);
  14851. $core.addMethod(
  14852. $core.method({
  14853. selector: "package",
  14854. protocol: "accessing",
  14855. fn: function (){
  14856. var self=this,$self=this;
  14857. return $self["@package"];
  14858. },
  14859. args: [],
  14860. source: "package\x0a\x09^ package",
  14861. referencedClasses: [],
  14862. messageSends: []
  14863. }),
  14864. $globals.Class);
  14865. $core.addMethod(
  14866. $core.method({
  14867. selector: "provided",
  14868. protocol: "converting",
  14869. fn: function (){
  14870. var self=this,$self=this;
  14871. return $core.withContext(function($ctx1) {
  14872. return $recv($self._javascriptConstructor())._provided();
  14873. }, function($ctx1) {$ctx1.fill(self,"provided",{},$globals.Class)});
  14874. },
  14875. args: [],
  14876. source: "provided\x0a\x09\x22Returns JS proxy that allows to access 'static API', as in\x0a\x09 Number provided EPSILON\x0a\x09that forwards to (wrapped JS) constructor function.\x22\x0a\x09\x0a\x09^ self javascriptConstructor provided",
  14877. referencedClasses: [],
  14878. messageSends: ["provided", "javascriptConstructor"]
  14879. }),
  14880. $globals.Class);
  14881. $core.addMethod(
  14882. $core.method({
  14883. selector: "rename:",
  14884. protocol: "accessing",
  14885. fn: function (aString){
  14886. var self=this,$self=this;
  14887. return $core.withContext(function($ctx1) {
  14888. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(self,aString);
  14889. return self;
  14890. }, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString},$globals.Class)});
  14891. },
  14892. args: ["aString"],
  14893. source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
  14894. referencedClasses: ["ClassBuilder"],
  14895. messageSends: ["renameClass:to:", "new"]
  14896. }),
  14897. $globals.Class);
  14898. $core.addMethod(
  14899. $core.method({
  14900. selector: "subclasses",
  14901. protocol: "accessing",
  14902. fn: function (){
  14903. var self=this,$self=this;
  14904. return $core.withContext(function($ctx1) {
  14905. return self.subclasses._copy();
  14906. return self;
  14907. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Class)});
  14908. },
  14909. args: [],
  14910. source: "subclasses\x0a\x09<inlineJS: 'return self.subclasses._copy()'>",
  14911. referencedClasses: [],
  14912. messageSends: []
  14913. }),
  14914. $globals.Class);
  14915. $core.addMethod(
  14916. $core.method({
  14917. selector: "theMetaClass",
  14918. protocol: "accessing",
  14919. fn: function (){
  14920. var self=this,$self=this;
  14921. return $core.withContext(function($ctx1) {
  14922. return $self._class();
  14923. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Class)});
  14924. },
  14925. args: [],
  14926. source: "theMetaClass\x0a\x09^ self class",
  14927. referencedClasses: [],
  14928. messageSends: ["class"]
  14929. }),
  14930. $globals.Class);
  14931. $core.addClass("Metaclass", $globals.Behavior, [], "Kernel-Classes");
  14932. $globals.Metaclass.comment="I am the root of the class hierarchy.\x0a\x0aMy instances are metaclasses, one for each real class, and have a single instance, which they hold onto: the class that they are the metaclass of.";
  14933. $core.addMethod(
  14934. $core.method({
  14935. selector: "asJavaScriptSource",
  14936. protocol: "converting",
  14937. fn: function (){
  14938. var self=this,$self=this;
  14939. return $core.withContext(function($ctx1) {
  14940. var $1;
  14941. $1=$recv("$globals.".__comma($recv($self._instanceClass())._name())).__comma(".a$cls");
  14942. $ctx1.sendIdx[","]=1;
  14943. return $1;
  14944. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Metaclass)});
  14945. },
  14946. args: [],
  14947. source: "asJavaScriptSource\x0a\x09^ '$globals.', self instanceClass name, '.a$cls'",
  14948. referencedClasses: [],
  14949. messageSends: [",", "name", "instanceClass"]
  14950. }),
  14951. $globals.Metaclass);
  14952. $core.addMethod(
  14953. $core.method({
  14954. selector: "definition",
  14955. protocol: "accessing",
  14956. fn: function (){
  14957. var self=this,$self=this;
  14958. return $core.withContext(function($ctx1) {
  14959. var $1,$2;
  14960. return $recv($globals.String)._streamContents_((function(stream){
  14961. return $core.withContext(function($ctx2) {
  14962. $recv(stream)._print_(self);
  14963. $ctx2.sendIdx["print:"]=1;
  14964. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifEmpty_ifNotEmpty_((function(){
  14965. return " ";
  14966. }),(function(tcd){
  14967. return $core.withContext(function($ctx3) {
  14968. $1=$recv($globals.String)._lf();
  14969. $ctx3.sendIdx["lf"]=1;
  14970. $2=$recv($globals.String)._tab();
  14971. $ctx3.sendIdx["tab"]=1;
  14972. return [$1,$2,"uses: ",tcd,$recv($globals.String)._lf(),$recv($globals.String)._tab()];
  14973. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,3)});
  14974. })));
  14975. $ctx2.sendIdx["write:"]=1;
  14976. $recv(stream)._write_("instanceVariableNames: ");
  14977. return $recv(stream)._print_(" "._join_($self._instanceVariableNames()));
  14978. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  14979. }));
  14980. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Metaclass)});
  14981. },
  14982. args: [],
  14983. source: "definition\x0a\x09^ String streamContents: [ :stream | stream\x0a\x09\x09print: self;\x0a\x09\x09write: (self traitCompositionDefinition\x0a\x09\x09\x09ifEmpty: [' ']\x0a\x09\x09\x09ifNotEmpty: [ :tcd | { String lf. String tab. 'uses: '. tcd. String lf. String tab }]);\x0a\x09\x09write: 'instanceVariableNames: ';\x0a\x09\x09print: (' ' join: self instanceVariableNames) ]",
  14984. referencedClasses: ["String"],
  14985. messageSends: ["streamContents:", "print:", "write:", "ifEmpty:ifNotEmpty:", "traitCompositionDefinition", "lf", "tab", "join:", "instanceVariableNames"]
  14986. }),
  14987. $globals.Metaclass);
  14988. $core.addMethod(
  14989. $core.method({
  14990. selector: "instanceClass",
  14991. protocol: "accessing",
  14992. fn: function (){
  14993. var self=this,$self=this;
  14994. return $core.withContext(function($ctx1) {
  14995. return self.instanceClass;
  14996. return self;
  14997. }, function($ctx1) {$ctx1.fill(self,"instanceClass",{},$globals.Metaclass)});
  14998. },
  14999. args: [],
  15000. source: "instanceClass\x0a\x09<inlineJS: 'return self.instanceClass'>",
  15001. referencedClasses: [],
  15002. messageSends: []
  15003. }),
  15004. $globals.Metaclass);
  15005. $core.addMethod(
  15006. $core.method({
  15007. selector: "instanceVariableNames:",
  15008. protocol: "accessing",
  15009. fn: function (aCollection){
  15010. var self=this,$self=this;
  15011. return $core.withContext(function($ctx1) {
  15012. $recv($recv($globals.ClassBuilder)._new())._class_instanceVariableNames_(self,aCollection);
  15013. return self;
  15014. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aCollection:aCollection},$globals.Metaclass)});
  15015. },
  15016. args: ["aCollection"],
  15017. source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09\x09class: self instanceVariableNames: aCollection.\x0a\x09^ self",
  15018. referencedClasses: ["ClassBuilder"],
  15019. messageSends: ["class:instanceVariableNames:", "new"]
  15020. }),
  15021. $globals.Metaclass);
  15022. $core.addMethod(
  15023. $core.method({
  15024. selector: "isMetaclass",
  15025. protocol: "testing",
  15026. fn: function (){
  15027. var self=this,$self=this;
  15028. return true;
  15029. },
  15030. args: [],
  15031. source: "isMetaclass\x0a\x09^ true",
  15032. referencedClasses: [],
  15033. messageSends: []
  15034. }),
  15035. $globals.Metaclass);
  15036. $core.addMethod(
  15037. $core.method({
  15038. selector: "name",
  15039. protocol: "accessing",
  15040. fn: function (){
  15041. var self=this,$self=this;
  15042. return $core.withContext(function($ctx1) {
  15043. return $recv($recv($self._instanceClass())._name()).__comma(" class");
  15044. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Metaclass)});
  15045. },
  15046. args: [],
  15047. source: "name\x0a\x09^ self instanceClass name, ' class'",
  15048. referencedClasses: [],
  15049. messageSends: [",", "name", "instanceClass"]
  15050. }),
  15051. $globals.Metaclass);
  15052. $core.addMethod(
  15053. $core.method({
  15054. selector: "package",
  15055. protocol: "accessing",
  15056. fn: function (){
  15057. var self=this,$self=this;
  15058. return $core.withContext(function($ctx1) {
  15059. return $recv($self._instanceClass())._package();
  15060. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Metaclass)});
  15061. },
  15062. args: [],
  15063. source: "package\x0a\x09^ self instanceClass package",
  15064. referencedClasses: [],
  15065. messageSends: ["package", "instanceClass"]
  15066. }),
  15067. $globals.Metaclass);
  15068. $core.addMethod(
  15069. $core.method({
  15070. selector: "subclasses",
  15071. protocol: "accessing",
  15072. fn: function (){
  15073. var self=this,$self=this;
  15074. return $core.withContext(function($ctx1) {
  15075. return $core.metaSubclasses(self);
  15076. return self;
  15077. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Metaclass)});
  15078. },
  15079. args: [],
  15080. source: "subclasses\x0a\x09<inlineJS: 'return $core.metaSubclasses(self)'>",
  15081. referencedClasses: [],
  15082. messageSends: []
  15083. }),
  15084. $globals.Metaclass);
  15085. $core.addMethod(
  15086. $core.method({
  15087. selector: "theMetaClass",
  15088. protocol: "accessing",
  15089. fn: function (){
  15090. var self=this,$self=this;
  15091. return self;
  15092. },
  15093. args: [],
  15094. source: "theMetaClass\x0a\x09^ self",
  15095. referencedClasses: [],
  15096. messageSends: []
  15097. }),
  15098. $globals.Metaclass);
  15099. $core.addMethod(
  15100. $core.method({
  15101. selector: "theNonMetaClass",
  15102. protocol: "accessing",
  15103. fn: function (){
  15104. var self=this,$self=this;
  15105. return $core.withContext(function($ctx1) {
  15106. return $self._instanceClass();
  15107. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Metaclass)});
  15108. },
  15109. args: [],
  15110. source: "theNonMetaClass\x0a\x09^ self instanceClass",
  15111. referencedClasses: [],
  15112. messageSends: ["instanceClass"]
  15113. }),
  15114. $globals.Metaclass);
  15115. $core.addMethod(
  15116. $core.method({
  15117. selector: "uses:instanceVariableNames:",
  15118. protocol: "accessing",
  15119. fn: function (aTraitCompositionDescription,aCollection){
  15120. var self=this,$self=this;
  15121. var metaclass;
  15122. return $core.withContext(function($ctx1) {
  15123. metaclass=$self._instanceVariableNames_(aCollection);
  15124. $recv(metaclass)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  15125. return metaclass;
  15126. }, function($ctx1) {$ctx1.fill(self,"uses:instanceVariableNames:",{aTraitCompositionDescription:aTraitCompositionDescription,aCollection:aCollection,metaclass:metaclass},$globals.Metaclass)});
  15127. },
  15128. args: ["aTraitCompositionDescription", "aCollection"],
  15129. source: "uses: aTraitCompositionDescription instanceVariableNames: aCollection\x0a\x09| metaclass |\x0a\x09metaclass := self instanceVariableNames: aCollection.\x0a\x09metaclass setTraitComposition: aTraitCompositionDescription asTraitComposition.\x0a\x09^ metaclass",
  15130. referencedClasses: [],
  15131. messageSends: ["instanceVariableNames:", "setTraitComposition:", "asTraitComposition"]
  15132. }),
  15133. $globals.Metaclass);
  15134. $core.addClass("ClassBuilder", $globals.Object, [], "Kernel-Classes");
  15135. $globals.ClassBuilder.comment="I am responsible for compiling new classes or modifying existing classes in the system.\x0a\x0aRather than using me directly to compile a class, use `Class >> subclass:instanceVariableNames:package:`.";
  15136. $core.addMethod(
  15137. $core.method({
  15138. selector: "addSubclassOf:named:instanceVariableNames:package:",
  15139. protocol: "class definition",
  15140. fn: function (aClass,className,aCollection,packageName){
  15141. var self=this,$self=this;
  15142. var theClass,thePackage;
  15143. return $core.withContext(function($ctx1) {
  15144. var $1,$2,$3,$receiver;
  15145. theClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  15146. thePackage=$recv($globals.Package)._named_(packageName);
  15147. $1=theClass;
  15148. if(($receiver = $1) == null || $receiver.a$nil){
  15149. $1;
  15150. } else {
  15151. $recv(theClass)._package_(thePackage);
  15152. $2=$recv($recv(theClass)._superclass()).__eq_eq(aClass);
  15153. if(!$core.assert($2)){
  15154. return $self._migrateClassNamed_superclass_instanceVariableNames_package_(className,aClass,aCollection,packageName);
  15155. }
  15156. }
  15157. $3=$self._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,className,aCollection,packageName);
  15158. $recv($3)._recompile();
  15159. return $recv($3)._yourself();
  15160. }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,theClass:theClass,thePackage:thePackage},$globals.ClassBuilder)});
  15161. },
  15162. args: ["aClass", "className", "aCollection", "packageName"],
  15163. source: "addSubclassOf: aClass named: className instanceVariableNames: aCollection package: packageName\x0a\x09| theClass thePackage |\x0a\x09\x0a\x09theClass := Smalltalk globals at: className.\x0a\x09thePackage := Package named: packageName.\x0a\x09\x0a\x09theClass ifNotNil: [\x0a\x09\x09theClass package: thePackage.\x0a\x09\x09theClass superclass == aClass\x0a\x09\x09\x09ifFalse: [ ^ self\x0a\x09\x09\x09\x09migrateClassNamed: className\x0a\x09\x09\x09\x09superclass: aClass\x0a\x09\x09\x09\x09instanceVariableNames: aCollection\x0a\x09\x09\x09\x09package: packageName ] ].\x0a\x09\x09\x0a\x09^ (self\x0a\x09\x09basicAddSubclassOf: aClass\x0a\x09\x09named: className\x0a\x09\x09instanceVariableNames: aCollection\x0a\x09\x09package: packageName) recompile; yourself",
  15164. referencedClasses: ["Smalltalk", "Package"],
  15165. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "ifFalse:", "==", "superclass", "migrateClassNamed:superclass:instanceVariableNames:package:", "recompile", "basicAddSubclassOf:named:instanceVariableNames:package:", "yourself"]
  15166. }),
  15167. $globals.ClassBuilder);
  15168. $core.addMethod(
  15169. $core.method({
  15170. selector: "addTraitNamed:package:",
  15171. protocol: "class definition",
  15172. fn: function (traitName,packageName){
  15173. var self=this,$self=this;
  15174. var theTrait,thePackage;
  15175. return $core.withContext(function($ctx1) {
  15176. var $1,$2,$receiver;
  15177. theTrait=$recv($recv($globals.Smalltalk)._globals())._at_(traitName);
  15178. thePackage=$recv($globals.Package)._named_(packageName);
  15179. $1=theTrait;
  15180. if(($receiver = $1) == null || $receiver.a$nil){
  15181. $1;
  15182. } else {
  15183. $2=theTrait;
  15184. $recv($2)._package_(thePackage);
  15185. $recv($2)._recompile();
  15186. return $recv($2)._yourself();
  15187. }
  15188. return $self._basicAddTraitNamed_package_(traitName,packageName);
  15189. }, function($ctx1) {$ctx1.fill(self,"addTraitNamed:package:",{traitName:traitName,packageName:packageName,theTrait:theTrait,thePackage:thePackage},$globals.ClassBuilder)});
  15190. },
  15191. args: ["traitName", "packageName"],
  15192. source: "addTraitNamed: traitName package: packageName\x0a\x09| theTrait thePackage |\x0a\x09\x0a\x09theTrait := Smalltalk globals at: traitName.\x0a\x09thePackage := Package named: packageName.\x0a\x09\x0a\x09theTrait ifNotNil: [ ^ theTrait package: thePackage; recompile; yourself ].\x0a\x09\x09\x0a\x09^ self\x0a\x09\x09basicAddTraitNamed: traitName\x0a\x09\x09package: packageName",
  15193. referencedClasses: ["Smalltalk", "Package"],
  15194. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "recompile", "yourself", "basicAddTraitNamed:package:"]
  15195. }),
  15196. $globals.ClassBuilder);
  15197. $core.addMethod(
  15198. $core.method({
  15199. selector: "basicAddSubclassOf:named:instanceVariableNames:package:",
  15200. protocol: "private",
  15201. fn: function (aClass,aString,aCollection,packageName){
  15202. var self=this,$self=this;
  15203. return $core.withContext(function($ctx1) {
  15204. return $core.addClass(aString, aClass, aCollection, packageName);
  15205. ;
  15206. return self;
  15207. }, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName},$globals.ClassBuilder)});
  15208. },
  15209. args: ["aClass", "aString", "aCollection", "packageName"],
  15210. source: "basicAddSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a\x09<inlineJS: '\x0a\x09\x09return $core.addClass(aString, aClass, aCollection, packageName);\x0a\x09'>",
  15211. referencedClasses: [],
  15212. messageSends: []
  15213. }),
  15214. $globals.ClassBuilder);
  15215. $core.addMethod(
  15216. $core.method({
  15217. selector: "basicAddTraitNamed:package:",
  15218. protocol: "private",
  15219. fn: function (aString,anotherString){
  15220. var self=this,$self=this;
  15221. return $core.withContext(function($ctx1) {
  15222. return $core.addTrait(aString, anotherString);
  15223. return self;
  15224. }, function($ctx1) {$ctx1.fill(self,"basicAddTraitNamed:package:",{aString:aString,anotherString:anotherString},$globals.ClassBuilder)});
  15225. },
  15226. args: ["aString", "anotherString"],
  15227. source: "basicAddTraitNamed: aString package: anotherString\x0a\x09<inlineJS: 'return $core.addTrait(aString, anotherString)'>",
  15228. referencedClasses: [],
  15229. messageSends: []
  15230. }),
  15231. $globals.ClassBuilder);
  15232. $core.addMethod(
  15233. $core.method({
  15234. selector: "basicClass:instanceVariables:",
  15235. protocol: "private",
  15236. fn: function (aClass,aCollection){
  15237. var self=this,$self=this;
  15238. return $core.withContext(function($ctx1) {
  15239. var $1;
  15240. $1=$recv(aClass)._isMetaclass();
  15241. if(!$core.assert($1)){
  15242. $self._error_($recv($recv(aClass)._name()).__comma(" is not a metaclass"));
  15243. }
  15244. $recv(aClass)._basicAt_put_("iVarNames",aCollection);
  15245. return self;
  15246. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariables:",{aClass:aClass,aCollection:aCollection},$globals.ClassBuilder)});
  15247. },
  15248. args: ["aClass", "aCollection"],
  15249. source: "basicClass: aClass instanceVariables: aCollection\x0a\x0a\x09aClass isMetaclass ifFalse: [ self error: aClass name, ' is not a metaclass' ].\x0a\x09aClass basicAt: 'iVarNames' put: aCollection",
  15250. referencedClasses: [],
  15251. messageSends: ["ifFalse:", "isMetaclass", "error:", ",", "name", "basicAt:put:"]
  15252. }),
  15253. $globals.ClassBuilder);
  15254. $core.addMethod(
  15255. $core.method({
  15256. selector: "basicRemoveClass:",
  15257. protocol: "private",
  15258. fn: function (aClass){
  15259. var self=this,$self=this;
  15260. return $core.withContext(function($ctx1) {
  15261. $core.removeClass(aClass);
  15262. return self;
  15263. }, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass},$globals.ClassBuilder)});
  15264. },
  15265. args: ["aClass"],
  15266. source: "basicRemoveClass: aClass\x0a\x09<inlineJS: '$core.removeClass(aClass)'>",
  15267. referencedClasses: [],
  15268. messageSends: []
  15269. }),
  15270. $globals.ClassBuilder);
  15271. $core.addMethod(
  15272. $core.method({
  15273. selector: "basicRenameClass:to:",
  15274. protocol: "private",
  15275. fn: function (aClass,aString){
  15276. var self=this,$self=this;
  15277. return $core.withContext(function($ctx1) {
  15278. $globals[aString] = aClass;
  15279. delete $globals[aClass.name];
  15280. aClass.name = aString;
  15281. ;
  15282. return self;
  15283. }, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  15284. },
  15285. args: ["aClass", "aString"],
  15286. source: "basicRenameClass: aClass to: aString\x0a\x09<inlineJS: '\x0a\x09\x09$globals[aString] = aClass;\x0a\x09\x09delete $globals[aClass.name];\x0a\x09\x09aClass.name = aString;\x0a\x09'>",
  15287. referencedClasses: [],
  15288. messageSends: []
  15289. }),
  15290. $globals.ClassBuilder);
  15291. $core.addMethod(
  15292. $core.method({
  15293. selector: "basicSwapClassNames:with:",
  15294. protocol: "private",
  15295. fn: function (aClass,anotherClass){
  15296. var self=this,$self=this;
  15297. return $core.withContext(function($ctx1) {
  15298. var tmp = aClass.name;
  15299. aClass.name = anotherClass.name;
  15300. anotherClass.name = tmp;
  15301. ;
  15302. return self;
  15303. }, function($ctx1) {$ctx1.fill(self,"basicSwapClassNames:with:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  15304. },
  15305. args: ["aClass", "anotherClass"],
  15306. source: "basicSwapClassNames: aClass with: anotherClass\x0a\x09<inlineJS: '\x0a\x09\x09var tmp = aClass.name;\x0a\x09\x09aClass.name = anotherClass.name;\x0a\x09\x09anotherClass.name = tmp;\x0a\x09'>",
  15307. referencedClasses: [],
  15308. messageSends: []
  15309. }),
  15310. $globals.ClassBuilder);
  15311. $core.addMethod(
  15312. $core.method({
  15313. selector: "class:instanceVariableNames:",
  15314. protocol: "class definition",
  15315. fn: function (aClass,ivarNames){
  15316. var self=this,$self=this;
  15317. return $core.withContext(function($ctx1) {
  15318. $self._class_instanceVariables_(aClass,$self._instanceVariableNamesFor_(ivarNames));
  15319. return self;
  15320. }, function($ctx1) {$ctx1.fill(self,"class:instanceVariableNames:",{aClass:aClass,ivarNames:ivarNames},$globals.ClassBuilder)});
  15321. },
  15322. args: ["aClass", "ivarNames"],
  15323. source: "class: aClass instanceVariableNames: ivarNames\x0a\x09self class: aClass instanceVariables: (self instanceVariableNamesFor: ivarNames)",
  15324. referencedClasses: [],
  15325. messageSends: ["class:instanceVariables:", "instanceVariableNamesFor:"]
  15326. }),
  15327. $globals.ClassBuilder);
  15328. $core.addMethod(
  15329. $core.method({
  15330. selector: "class:instanceVariables:",
  15331. protocol: "class definition",
  15332. fn: function (aClass,aCollection){
  15333. var self=this,$self=this;
  15334. return $core.withContext(function($ctx1) {
  15335. var $1,$3,$2;
  15336. $self._basicClass_instanceVariables_(aClass,aCollection);
  15337. $1=$recv($globals.SystemAnnouncer)._current();
  15338. $3=$recv($globals.ClassDefinitionChanged)._new();
  15339. $recv($3)._theClass_(aClass);
  15340. $2=$recv($3)._yourself();
  15341. $recv($1)._announce_($2);
  15342. return self;
  15343. }, function($ctx1) {$ctx1.fill(self,"class:instanceVariables:",{aClass:aClass,aCollection:aCollection},$globals.ClassBuilder)});
  15344. },
  15345. args: ["aClass", "aCollection"],
  15346. source: "class: aClass instanceVariables: aCollection\x0a\x09self basicClass: aClass instanceVariables: aCollection.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassDefinitionChanged new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  15347. referencedClasses: ["SystemAnnouncer", "ClassDefinitionChanged"],
  15348. messageSends: ["basicClass:instanceVariables:", "announce:", "current", "theClass:", "new", "yourself"]
  15349. }),
  15350. $globals.ClassBuilder);
  15351. $core.addMethod(
  15352. $core.method({
  15353. selector: "copyClass:named:",
  15354. protocol: "copying",
  15355. fn: function (aClass,className){
  15356. var self=this,$self=this;
  15357. var newClass;
  15358. return $core.withContext(function($ctx1) {
  15359. var $1,$3,$2;
  15360. newClass=$self._addSubclassOf_named_instanceVariableNames_package_($recv(aClass)._superclass(),className,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  15361. $self._copyClass_to_(aClass,newClass);
  15362. $1=$recv($globals.SystemAnnouncer)._current();
  15363. $3=$recv($globals.ClassAdded)._new();
  15364. $recv($3)._theClass_(newClass);
  15365. $2=$recv($3)._yourself();
  15366. $recv($1)._announce_($2);
  15367. return newClass;
  15368. }, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,className:className,newClass:newClass},$globals.ClassBuilder)});
  15369. },
  15370. args: ["aClass", "className"],
  15371. source: "copyClass: aClass named: className\x0a\x09| newClass |\x0a\x0a\x09newClass := self\x0a\x09\x09addSubclassOf: aClass superclass\x0a\x09\x09named: className\x0a\x09\x09instanceVariableNames: aClass instanceVariableNames\x0a\x09\x09package: aClass package name.\x0a\x0a\x09self copyClass: aClass to: newClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassAdded new\x0a\x09\x09\x09theClass: newClass;\x0a\x09\x09\x09yourself).\x0a\x09\x0a\x09^ newClass",
  15372. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  15373. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "copyClass:to:", "announce:", "current", "theClass:", "new", "yourself"]
  15374. }),
  15375. $globals.ClassBuilder);
  15376. $core.addMethod(
  15377. $core.method({
  15378. selector: "copyClass:to:",
  15379. protocol: "copying",
  15380. fn: function (aClass,anotherClass){
  15381. var self=this,$self=this;
  15382. return $core.withContext(function($ctx1) {
  15383. var $1,$3,$2,$4,$5,$6,$7,$8,$10,$9,$12,$11,$14,$15,$13,$16,$17,$18,$19;
  15384. $recv(anotherClass)._comment_($recv(aClass)._comment());
  15385. $1=$recv(aClass)._methodDictionary();
  15386. $ctx1.sendIdx["methodDictionary"]=1;
  15387. $recv($1)._valuesDo_((function(each){
  15388. return $core.withContext(function($ctx2) {
  15389. $3=$recv(each)._methodClass();
  15390. $ctx2.sendIdx["methodClass"]=1;
  15391. $2=$recv($3).__eq(aClass);
  15392. $ctx2.sendIdx["="]=1;
  15393. if($core.assert($2)){
  15394. $4=$recv($globals.Compiler)._new();
  15395. $ctx2.sendIdx["new"]=1;
  15396. $5=$recv(each)._source();
  15397. $ctx2.sendIdx["source"]=1;
  15398. $6=$recv(each)._protocol();
  15399. $ctx2.sendIdx["protocol"]=1;
  15400. return $recv($4)._install_forClass_protocol_($5,anotherClass,$6);
  15401. $ctx2.sendIdx["install:forClass:protocol:"]=1;
  15402. }
  15403. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15404. }));
  15405. $ctx1.sendIdx["valuesDo:"]=1;
  15406. $7=$recv(aClass)._traitComposition();
  15407. $ctx1.sendIdx["traitComposition"]=1;
  15408. $recv(anotherClass)._setTraitComposition_($7);
  15409. $ctx1.sendIdx["setTraitComposition:"]=1;
  15410. $8=$recv(anotherClass)._class();
  15411. $ctx1.sendIdx["class"]=1;
  15412. $10=$recv(aClass)._class();
  15413. $ctx1.sendIdx["class"]=2;
  15414. $9=$recv($10)._instanceVariableNames();
  15415. $self._basicClass_instanceVariables_($8,$9);
  15416. $12=$recv(aClass)._class();
  15417. $ctx1.sendIdx["class"]=3;
  15418. $11=$recv($12)._methodDictionary();
  15419. $recv($11)._valuesDo_((function(each){
  15420. return $core.withContext(function($ctx2) {
  15421. $14=$recv(each)._methodClass();
  15422. $15=$recv(aClass)._class();
  15423. $ctx2.sendIdx["class"]=4;
  15424. $13=$recv($14).__eq($15);
  15425. if($core.assert($13)){
  15426. $16=$recv($globals.Compiler)._new();
  15427. $17=$recv(each)._source();
  15428. $18=$recv(anotherClass)._class();
  15429. $ctx2.sendIdx["class"]=5;
  15430. return $recv($16)._install_forClass_protocol_($17,$18,$recv(each)._protocol());
  15431. }
  15432. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  15433. }));
  15434. $19=$recv(anotherClass)._class();
  15435. $ctx1.sendIdx["class"]=6;
  15436. $recv($19)._setTraitComposition_($recv($recv(aClass)._class())._traitComposition());
  15437. return self;
  15438. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  15439. },
  15440. args: ["aClass", "anotherClass"],
  15441. source: "copyClass: aClass to: anotherClass\x0a\x0a\x09anotherClass comment: aClass comment.\x0a\x0a\x09aClass methodDictionary valuesDo: [ :each |\x0a\x09\x09each methodClass = aClass ifTrue: [\x0a\x09\x09\x09Compiler new install: each source forClass: anotherClass protocol: each protocol ] ].\x0a\x09anotherClass setTraitComposition: aClass traitComposition.\x0a\x0a\x09self basicClass: anotherClass class instanceVariables: aClass class instanceVariableNames.\x0a\x0a\x09aClass class methodDictionary valuesDo: [ :each |\x0a\x09\x09each methodClass = aClass class ifTrue: [\x0a\x09\x09\x09Compiler new install: each source forClass: anotherClass class protocol: each protocol ] ].\x0a\x09anotherClass class setTraitComposition: aClass class traitComposition",
  15442. referencedClasses: ["Compiler"],
  15443. messageSends: ["comment:", "comment", "valuesDo:", "methodDictionary", "ifTrue:", "=", "methodClass", "install:forClass:protocol:", "new", "source", "protocol", "setTraitComposition:", "traitComposition", "basicClass:instanceVariables:", "class", "instanceVariableNames"]
  15444. }),
  15445. $globals.ClassBuilder);
  15446. $core.addMethod(
  15447. $core.method({
  15448. selector: "installMethod:forClass:protocol:",
  15449. protocol: "method definition",
  15450. fn: function (aCompiledMethod,aBehavior,aString){
  15451. var self=this,$self=this;
  15452. return $core.withContext(function($ctx1) {
  15453. $recv(aCompiledMethod)._protocol_(aString);
  15454. $recv(aBehavior)._addCompiledMethod_(aCompiledMethod);
  15455. return aCompiledMethod;
  15456. }, function($ctx1) {$ctx1.fill(self,"installMethod:forClass:protocol:",{aCompiledMethod:aCompiledMethod,aBehavior:aBehavior,aString:aString},$globals.ClassBuilder)});
  15457. },
  15458. args: ["aCompiledMethod", "aBehavior", "aString"],
  15459. source: "installMethod: aCompiledMethod forClass: aBehavior protocol: aString\x0a\x09aCompiledMethod protocol: aString.\x0a\x09aBehavior addCompiledMethod: aCompiledMethod.\x0a\x09^ aCompiledMethod",
  15460. referencedClasses: [],
  15461. messageSends: ["protocol:", "addCompiledMethod:"]
  15462. }),
  15463. $globals.ClassBuilder);
  15464. $core.addMethod(
  15465. $core.method({
  15466. selector: "instanceVariableNamesFor:",
  15467. protocol: "accessing",
  15468. fn: function (aString){
  15469. var self=this,$self=this;
  15470. return $core.withContext(function($ctx1) {
  15471. return $recv($recv(aString)._tokenize_(" "))._reject_((function(each){
  15472. return $core.withContext(function($ctx2) {
  15473. return $recv(each)._isEmpty();
  15474. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15475. }));
  15476. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aString:aString},$globals.ClassBuilder)});
  15477. },
  15478. args: ["aString"],
  15479. source: "instanceVariableNamesFor: aString\x0a\x09^ (aString tokenize: ' ') reject: [ :each | each isEmpty ]",
  15480. referencedClasses: [],
  15481. messageSends: ["reject:", "tokenize:", "isEmpty"]
  15482. }),
  15483. $globals.ClassBuilder);
  15484. $core.addMethod(
  15485. $core.method({
  15486. selector: "migrateClass:superclass:",
  15487. protocol: "class migration",
  15488. fn: function (aClass,anotherClass){
  15489. var self=this,$self=this;
  15490. return $core.withContext(function($ctx1) {
  15491. var $1;
  15492. $1=$recv(aClass)._name();
  15493. $ctx1.sendIdx["name"]=1;
  15494. return $self._migrateClassNamed_superclass_instanceVariableNames_package_($1,anotherClass,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  15495. }, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  15496. },
  15497. args: ["aClass", "anotherClass"],
  15498. source: "migrateClass: aClass superclass: anotherClass\x0a\x09^ self\x0a\x09\x09migrateClassNamed: aClass name\x0a\x09\x09superclass: anotherClass\x0a\x09\x09instanceVariableNames: aClass instanceVariableNames\x0a\x09\x09package: aClass package name",
  15499. referencedClasses: [],
  15500. messageSends: ["migrateClassNamed:superclass:instanceVariableNames:package:", "name", "instanceVariableNames", "package"]
  15501. }),
  15502. $globals.ClassBuilder);
  15503. $core.addMethod(
  15504. $core.method({
  15505. selector: "migrateClassNamed:superclass:instanceVariableNames:package:",
  15506. protocol: "class migration",
  15507. fn: function (className,aClass,aCollection,packageName){
  15508. var self=this,$self=this;
  15509. var oldClass,newClass,tmp;
  15510. return $core.withContext(function($ctx1) {
  15511. var $1,$2,$4,$3;
  15512. tmp="new*".__comma(className);
  15513. oldClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  15514. newClass=$self._addSubclassOf_named_instanceVariableNames_package_(aClass,tmp,aCollection,packageName);
  15515. $self._basicSwapClassNames_with_(oldClass,newClass);
  15516. $ctx1.sendIdx["basicSwapClassNames:with:"]=1;
  15517. $recv((function(){
  15518. return $core.withContext(function($ctx2) {
  15519. return $self._copyClass_to_(oldClass,newClass);
  15520. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  15521. }))._on_do_($globals.Error,(function(exception){
  15522. return $core.withContext(function($ctx2) {
  15523. $self._basicSwapClassNames_with_(oldClass,newClass);
  15524. $1=$self._basicRemoveClass_(newClass);
  15525. $ctx2.sendIdx["basicRemoveClass:"]=1;
  15526. return $recv(exception)._pass();
  15527. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,2)});
  15528. }));
  15529. $self._rawRenameClass_to_(oldClass,tmp);
  15530. $ctx1.sendIdx["rawRenameClass:to:"]=1;
  15531. $self._rawRenameClass_to_(newClass,className);
  15532. $recv($recv(oldClass)._subclasses())._do_((function(each){
  15533. return $core.withContext(function($ctx2) {
  15534. return $self._migrateClass_superclass_(each,newClass);
  15535. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  15536. }));
  15537. $self._basicRemoveClass_(oldClass);
  15538. $2=$recv($globals.SystemAnnouncer)._current();
  15539. $4=$recv($globals.ClassMigrated)._new();
  15540. $recv($4)._theClass_(newClass);
  15541. $recv($4)._oldClass_(oldClass);
  15542. $3=$recv($4)._yourself();
  15543. $recv($2)._announce_($3);
  15544. return newClass;
  15545. }, function($ctx1) {$ctx1.fill(self,"migrateClassNamed:superclass:instanceVariableNames:package:",{className:className,aClass:aClass,aCollection:aCollection,packageName:packageName,oldClass:oldClass,newClass:newClass,tmp:tmp},$globals.ClassBuilder)});
  15546. },
  15547. args: ["className", "aClass", "aCollection", "packageName"],
  15548. source: "migrateClassNamed: className superclass: aClass instanceVariableNames: aCollection package: packageName\x0a\x09| oldClass newClass tmp |\x0a\x09\x0a\x09tmp := 'new*', className.\x0a\x09oldClass := Smalltalk globals at: className.\x0a\x09\x0a\x09newClass := self\x0a\x09\x09addSubclassOf: aClass\x0a\x09\x09named: tmp\x0a\x09\x09instanceVariableNames: aCollection\x0a\x09\x09package: packageName.\x0a\x0a\x09self basicSwapClassNames: oldClass with: newClass.\x0a\x0a\x09[ self copyClass: oldClass to: newClass ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :exception |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09basicSwapClassNames: oldClass with: newClass;\x0a\x09\x09\x09\x09basicRemoveClass: newClass.\x0a\x09\x09\x09\x09exception pass ].\x0a\x0a\x09self\x0a\x09\x09rawRenameClass: oldClass to: tmp;\x0a\x09\x09rawRenameClass: newClass to: className.\x0a\x0a\x09oldClass subclasses \x0a\x09\x09do: [ :each | self migrateClass: each superclass: newClass ].\x0a\x0a\x09self basicRemoveClass: oldClass.\x0a\x09\x0a\x09SystemAnnouncer current announce: (ClassMigrated new\x0a\x09\x09theClass: newClass;\x0a\x09\x09oldClass: oldClass;\x0a\x09\x09yourself).\x0a\x09\x0a\x09^ newClass",
  15549. referencedClasses: ["Smalltalk", "Error", "SystemAnnouncer", "ClassMigrated"],
  15550. messageSends: [",", "at:", "globals", "addSubclassOf:named:instanceVariableNames:package:", "basicSwapClassNames:with:", "on:do:", "copyClass:to:", "basicRemoveClass:", "pass", "rawRenameClass:to:", "do:", "subclasses", "migrateClass:superclass:", "announce:", "current", "theClass:", "new", "oldClass:", "yourself"]
  15551. }),
  15552. $globals.ClassBuilder);
  15553. $core.addMethod(
  15554. $core.method({
  15555. selector: "rawRenameClass:to:",
  15556. protocol: "private",
  15557. fn: function (aClass,aString){
  15558. var self=this,$self=this;
  15559. return $core.withContext(function($ctx1) {
  15560. $globals[aString] = aClass;
  15561. ;
  15562. return self;
  15563. }, function($ctx1) {$ctx1.fill(self,"rawRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  15564. },
  15565. args: ["aClass", "aString"],
  15566. source: "rawRenameClass: aClass to: aString\x0a\x09<inlineJS: '\x0a\x09\x09$globals[aString] = aClass;\x0a\x09'>",
  15567. referencedClasses: [],
  15568. messageSends: []
  15569. }),
  15570. $globals.ClassBuilder);
  15571. $core.addMethod(
  15572. $core.method({
  15573. selector: "renameClass:to:",
  15574. protocol: "class migration",
  15575. fn: function (aClass,className){
  15576. var self=this,$self=this;
  15577. return $core.withContext(function($ctx1) {
  15578. var $1,$3,$2;
  15579. $self._basicRenameClass_to_(aClass,className);
  15580. $recv(aClass)._recompile();
  15581. $1=$recv($globals.SystemAnnouncer)._current();
  15582. $3=$recv($globals.ClassRenamed)._new();
  15583. $recv($3)._theClass_(aClass);
  15584. $2=$recv($3)._yourself();
  15585. $recv($1)._announce_($2);
  15586. return self;
  15587. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  15588. },
  15589. args: ["aClass", "className"],
  15590. source: "renameClass: aClass to: className\x0a\x09self basicRenameClass: aClass to: className.\x0a\x09\x0a\x09\x22Recompile the class to fix potential issues with super sends\x22\x0a\x09aClass recompile.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassRenamed new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  15591. referencedClasses: ["SystemAnnouncer", "ClassRenamed"],
  15592. messageSends: ["basicRenameClass:to:", "recompile", "announce:", "current", "theClass:", "new", "yourself"]
  15593. }),
  15594. $globals.ClassBuilder);
  15595. $core.addMethod(
  15596. $core.method({
  15597. selector: "superclass:subclass:",
  15598. protocol: "class definition",
  15599. fn: function (aClass,className){
  15600. var self=this,$self=this;
  15601. return $core.withContext(function($ctx1) {
  15602. return $self._superclass_subclass_instanceVariableNames_package_(aClass,className,"",nil);
  15603. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  15604. },
  15605. args: ["aClass", "className"],
  15606. source: "superclass: aClass subclass: className\x0a\x09^ self superclass: aClass subclass: className instanceVariableNames: '' package: nil",
  15607. referencedClasses: [],
  15608. messageSends: ["superclass:subclass:instanceVariableNames:package:"]
  15609. }),
  15610. $globals.ClassBuilder);
  15611. $core.addMethod(
  15612. $core.method({
  15613. selector: "superclass:subclass:instanceVariableNames:package:",
  15614. protocol: "class definition",
  15615. fn: function (aClass,className,ivarNames,packageName){
  15616. var self=this,$self=this;
  15617. var newClass;
  15618. return $core.withContext(function($ctx1) {
  15619. var $1,$2,$3,$5,$4,$receiver;
  15620. $1=$self._instanceVariableNamesFor_(ivarNames);
  15621. if(($receiver = packageName) == null || $receiver.a$nil){
  15622. $2="unclassified";
  15623. } else {
  15624. $2=packageName;
  15625. }
  15626. newClass=$self._addSubclassOf_named_instanceVariableNames_package_(aClass,className,$1,$2);
  15627. $3=$recv($globals.SystemAnnouncer)._current();
  15628. $5=$recv($globals.ClassAdded)._new();
  15629. $recv($5)._theClass_(newClass);
  15630. $4=$recv($5)._yourself();
  15631. $recv($3)._announce_($4);
  15632. return newClass;
  15633. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:instanceVariableNames:package:",{aClass:aClass,className:className,ivarNames:ivarNames,packageName:packageName,newClass:newClass},$globals.ClassBuilder)});
  15634. },
  15635. args: ["aClass", "className", "ivarNames", "packageName"],
  15636. source: "superclass: aClass subclass: className instanceVariableNames: ivarNames package: packageName\x0a\x09| newClass |\x0a\x09\x0a\x09newClass := self addSubclassOf: aClass\x0a\x09\x09named: className instanceVariableNames: (self instanceVariableNamesFor: ivarNames)\x0a\x09\x09package: (packageName ifNil: [ 'unclassified' ]).\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassAdded new\x0a\x09\x09\x09theClass: newClass;\x0a\x09\x09\x09yourself).\x0a\x09\x0a\x09^ newClass",
  15637. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  15638. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "announce:", "current", "theClass:", "new", "yourself"]
  15639. }),
  15640. $globals.ClassBuilder);
  15641. $core.addClass("ClassSorterNode", $globals.Object, ["theClass", "level", "nodes"], "Kernel-Classes");
  15642. $globals.ClassSorterNode.comment="I provide an algorithm for sorting classes alphabetically.\x0a\x0aSee [Issue #143](https://lolg.it/amber/amber/issues/143).";
  15643. $core.addMethod(
  15644. $core.method({
  15645. selector: "getNodesFrom:",
  15646. protocol: "accessing",
  15647. fn: function (aCollection){
  15648. var self=this,$self=this;
  15649. var children,others;
  15650. return $core.withContext(function($ctx1) {
  15651. var $1;
  15652. children=[];
  15653. others=[];
  15654. $recv(aCollection)._do_((function(each){
  15655. return $core.withContext(function($ctx2) {
  15656. $1=$recv($recv(each)._superclass()).__eq($self._theClass());
  15657. if($core.assert($1)){
  15658. return $recv(children)._add_(each);
  15659. $ctx2.sendIdx["add:"]=1;
  15660. } else {
  15661. return $recv(others)._add_(each);
  15662. }
  15663. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15664. }));
  15665. $self["@nodes"]=$recv(children)._collect_((function(each){
  15666. return $core.withContext(function($ctx2) {
  15667. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,$recv($self._level()).__plus((1)));
  15668. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  15669. }));
  15670. return self;
  15671. }, function($ctx1) {$ctx1.fill(self,"getNodesFrom:",{aCollection:aCollection,children:children,others:others},$globals.ClassSorterNode)});
  15672. },
  15673. args: ["aCollection"],
  15674. source: "getNodesFrom: aCollection\x0a\x09| children others |\x0a\x09children := #().\x0a\x09others := #().\x0a\x09aCollection do: [ :each |\x0a\x09\x09(each superclass = self theClass)\x0a\x09\x09\x09ifTrue: [ children add: each ]\x0a\x09\x09\x09ifFalse: [ others add: each ]].\x0a\x09nodes:= children collect: [ :each |\x0a\x09\x09ClassSorterNode on: each classes: others level: self level + 1 ]",
  15675. referencedClasses: ["ClassSorterNode"],
  15676. messageSends: ["do:", "ifTrue:ifFalse:", "=", "superclass", "theClass", "add:", "collect:", "on:classes:level:", "+", "level"]
  15677. }),
  15678. $globals.ClassSorterNode);
  15679. $core.addMethod(
  15680. $core.method({
  15681. selector: "level",
  15682. protocol: "accessing",
  15683. fn: function (){
  15684. var self=this,$self=this;
  15685. return $self["@level"];
  15686. },
  15687. args: [],
  15688. source: "level\x0a\x09^ level",
  15689. referencedClasses: [],
  15690. messageSends: []
  15691. }),
  15692. $globals.ClassSorterNode);
  15693. $core.addMethod(
  15694. $core.method({
  15695. selector: "level:",
  15696. protocol: "accessing",
  15697. fn: function (anInteger){
  15698. var self=this,$self=this;
  15699. $self["@level"]=anInteger;
  15700. return self;
  15701. },
  15702. args: ["anInteger"],
  15703. source: "level: anInteger\x0a\x09level := anInteger",
  15704. referencedClasses: [],
  15705. messageSends: []
  15706. }),
  15707. $globals.ClassSorterNode);
  15708. $core.addMethod(
  15709. $core.method({
  15710. selector: "nodes",
  15711. protocol: "accessing",
  15712. fn: function (){
  15713. var self=this,$self=this;
  15714. return $self["@nodes"];
  15715. },
  15716. args: [],
  15717. source: "nodes\x0a\x09^ nodes",
  15718. referencedClasses: [],
  15719. messageSends: []
  15720. }),
  15721. $globals.ClassSorterNode);
  15722. $core.addMethod(
  15723. $core.method({
  15724. selector: "theClass",
  15725. protocol: "accessing",
  15726. fn: function (){
  15727. var self=this,$self=this;
  15728. return $self["@theClass"];
  15729. },
  15730. args: [],
  15731. source: "theClass\x0a\x09^ theClass",
  15732. referencedClasses: [],
  15733. messageSends: []
  15734. }),
  15735. $globals.ClassSorterNode);
  15736. $core.addMethod(
  15737. $core.method({
  15738. selector: "theClass:",
  15739. protocol: "accessing",
  15740. fn: function (aClass){
  15741. var self=this,$self=this;
  15742. $self["@theClass"]=aClass;
  15743. return self;
  15744. },
  15745. args: ["aClass"],
  15746. source: "theClass: aClass\x0a\x09theClass := aClass",
  15747. referencedClasses: [],
  15748. messageSends: []
  15749. }),
  15750. $globals.ClassSorterNode);
  15751. $core.addMethod(
  15752. $core.method({
  15753. selector: "traverseClassesWith:",
  15754. protocol: "visiting",
  15755. fn: function (aCollection){
  15756. var self=this,$self=this;
  15757. return $core.withContext(function($ctx1) {
  15758. var $1,$3,$2;
  15759. $1=$self._theClass();
  15760. $ctx1.sendIdx["theClass"]=1;
  15761. $recv(aCollection)._add_($1);
  15762. $recv($recv($self._nodes())._sorted_((function(a,b){
  15763. return $core.withContext(function($ctx2) {
  15764. $3=$recv(a)._theClass();
  15765. $ctx2.sendIdx["theClass"]=2;
  15766. $2=$recv($3)._name();
  15767. $ctx2.sendIdx["name"]=1;
  15768. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  15769. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  15770. })))._do_((function(aNode){
  15771. return $core.withContext(function($ctx2) {
  15772. return $recv(aNode)._traverseClassesWith_(aCollection);
  15773. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,2)});
  15774. }));
  15775. return self;
  15776. }, function($ctx1) {$ctx1.fill(self,"traverseClassesWith:",{aCollection:aCollection},$globals.ClassSorterNode)});
  15777. },
  15778. args: ["aCollection"],
  15779. source: "traverseClassesWith: aCollection\x0a\x09\x22sort classes alphabetically Issue #143\x22\x0a\x0a\x09aCollection add: self theClass.\x0a\x09(self nodes sorted: [ :a :b | a theClass name <= b theClass name ]) do: [ :aNode |\x0a\x09\x09aNode traverseClassesWith: aCollection ].",
  15780. referencedClasses: [],
  15781. messageSends: ["add:", "theClass", "do:", "sorted:", "nodes", "<=", "name", "traverseClassesWith:"]
  15782. }),
  15783. $globals.ClassSorterNode);
  15784. $core.addMethod(
  15785. $core.method({
  15786. selector: "on:classes:level:",
  15787. protocol: "instance creation",
  15788. fn: function (aClass,aCollection,anInteger){
  15789. var self=this,$self=this;
  15790. return $core.withContext(function($ctx1) {
  15791. var $1;
  15792. $1=$self._new();
  15793. $recv($1)._theClass_(aClass);
  15794. $recv($1)._level_(anInteger);
  15795. $recv($1)._getNodesFrom_(aCollection);
  15796. return $recv($1)._yourself();
  15797. }, function($ctx1) {$ctx1.fill(self,"on:classes:level:",{aClass:aClass,aCollection:aCollection,anInteger:anInteger},$globals.ClassSorterNode.a$cls)});
  15798. },
  15799. args: ["aClass", "aCollection", "anInteger"],
  15800. source: "on: aClass classes: aCollection level: anInteger\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09level: anInteger;\x0a\x09\x09getNodesFrom: aCollection;\x0a\x09\x09yourself",
  15801. referencedClasses: [],
  15802. messageSends: ["theClass:", "new", "level:", "getNodesFrom:", "yourself"]
  15803. }),
  15804. $globals.ClassSorterNode.a$cls);
  15805. $core.addTrait("TBehaviorDefaults", "Kernel-Classes");
  15806. $core.addMethod(
  15807. $core.method({
  15808. selector: "allInstanceVariableNames",
  15809. protocol: "accessing",
  15810. fn: function (){
  15811. var self=this,$self=this;
  15812. return [];
  15813. },
  15814. args: [],
  15815. source: "allInstanceVariableNames\x0a\x09\x22Default for non-classes; to be able to send #allInstanceVariableNames to any class / trait.\x22\x0a\x09^ #()",
  15816. referencedClasses: [],
  15817. messageSends: []
  15818. }),
  15819. $globals.TBehaviorDefaults);
  15820. $core.addMethod(
  15821. $core.method({
  15822. selector: "allSubclassesDo:",
  15823. protocol: "enumerating",
  15824. fn: function (aBlock){
  15825. var self=this,$self=this;
  15826. return self;
  15827. },
  15828. args: ["aBlock"],
  15829. source: "allSubclassesDo: aBlock\x0a\x09\x22Default for non-classes; to be able to send #allSubclassesDo: to any class / trait.\x22",
  15830. referencedClasses: [],
  15831. messageSends: []
  15832. }),
  15833. $globals.TBehaviorDefaults);
  15834. $core.addMethod(
  15835. $core.method({
  15836. selector: "name",
  15837. protocol: "accessing",
  15838. fn: function (){
  15839. var self=this,$self=this;
  15840. return nil;
  15841. },
  15842. args: [],
  15843. source: "name\x0a\x09^ nil",
  15844. referencedClasses: [],
  15845. messageSends: []
  15846. }),
  15847. $globals.TBehaviorDefaults);
  15848. $core.addMethod(
  15849. $core.method({
  15850. selector: "printOn:",
  15851. protocol: "printing",
  15852. fn: function (aStream){
  15853. var self=this,$self=this;
  15854. return $core.withContext(function($ctx1) {
  15855. var $1,$receiver;
  15856. $1=$self._name();
  15857. if(($receiver = $1) == null || $receiver.a$nil){
  15858. (
  15859. $ctx1.supercall = true,
  15860. ($globals.TBehaviorDefaults.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  15861. $ctx1.supercall = false;
  15862. } else {
  15863. var name;
  15864. name=$receiver;
  15865. $recv(aStream)._nextPutAll_(name);
  15866. }
  15867. return self;
  15868. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.TBehaviorDefaults)});
  15869. },
  15870. args: ["aStream"],
  15871. source: "printOn: aStream\x0a\x09self name\x0a\x09\x09ifNil: [ super printOn: aStream ]\x0a\x09\x09ifNotNil: [ :name | aStream nextPutAll: name ]",
  15872. referencedClasses: [],
  15873. messageSends: ["ifNil:ifNotNil:", "name", "printOn:", "nextPutAll:"]
  15874. }),
  15875. $globals.TBehaviorDefaults);
  15876. $core.addMethod(
  15877. $core.method({
  15878. selector: "superclass",
  15879. protocol: "accessing",
  15880. fn: function (){
  15881. var self=this,$self=this;
  15882. return nil;
  15883. },
  15884. args: [],
  15885. source: "superclass\x0a\x09\x22Default for non-classes; to be able to send #superclass to any class / trait.\x22\x0a\x09^ nil",
  15886. referencedClasses: [],
  15887. messageSends: []
  15888. }),
  15889. $globals.TBehaviorDefaults);
  15890. $core.addMethod(
  15891. $core.method({
  15892. selector: "traitUsers",
  15893. protocol: "accessing",
  15894. fn: function (){
  15895. var self=this,$self=this;
  15896. return [];
  15897. },
  15898. args: [],
  15899. source: "traitUsers\x0a\x09\x22Default for non-traits; to be able to send #traitUsers to any class / trait\x22\x0a\x09^ #()",
  15900. referencedClasses: [],
  15901. messageSends: []
  15902. }),
  15903. $globals.TBehaviorDefaults);
  15904. $core.addTrait("TBehaviorProvider", "Kernel-Classes");
  15905. $globals.TBehaviorProvider.comment="I have method dictionary and organization.";
  15906. $core.addMethod(
  15907. $core.method({
  15908. selector: ">>",
  15909. protocol: "accessing",
  15910. fn: function (aString){
  15911. var self=this,$self=this;
  15912. return $core.withContext(function($ctx1) {
  15913. return $self._methodAt_(aString);
  15914. }, function($ctx1) {$ctx1.fill(self,">>",{aString:aString},$globals.TBehaviorProvider)});
  15915. },
  15916. args: ["aString"],
  15917. source: ">> aString\x0a\x09^ self methodAt: aString",
  15918. referencedClasses: [],
  15919. messageSends: ["methodAt:"]
  15920. }),
  15921. $globals.TBehaviorProvider);
  15922. $core.addMethod(
  15923. $core.method({
  15924. selector: "addCompiledMethod:",
  15925. protocol: "compiling",
  15926. fn: function (aMethod){
  15927. var self=this,$self=this;
  15928. var oldMethod,announcement;
  15929. return $core.withContext(function($ctx1) {
  15930. var $1,$2,$3,$4,$receiver;
  15931. oldMethod=$recv($self._methodDictionary())._at_ifAbsent_($recv(aMethod)._selector(),(function(){
  15932. return nil;
  15933. }));
  15934. $self._basicAddCompiledMethod_(aMethod);
  15935. $1=oldMethod;
  15936. if(($receiver = $1) == null || $receiver.a$nil){
  15937. $2=$recv($globals.MethodAdded)._new();
  15938. $ctx1.sendIdx["new"]=1;
  15939. $recv($2)._method_(aMethod);
  15940. $ctx1.sendIdx["method:"]=1;
  15941. $3=$recv($2)._yourself();
  15942. $ctx1.sendIdx["yourself"]=1;
  15943. announcement=$3;
  15944. } else {
  15945. $4=$recv($globals.MethodModified)._new();
  15946. $recv($4)._oldMethod_(oldMethod);
  15947. $recv($4)._method_(aMethod);
  15948. announcement=$recv($4)._yourself();
  15949. }
  15950. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  15951. return self;
  15952. }, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement},$globals.TBehaviorProvider)});
  15953. },
  15954. args: ["aMethod"],
  15955. source: "addCompiledMethod: aMethod\x0a\x09| oldMethod announcement |\x0a\x09\x0a\x09oldMethod := self methodDictionary\x0a\x09\x09at: aMethod selector\x0a\x09\x09ifAbsent: [ nil ].\x0a\x09\x0a\x09self basicAddCompiledMethod: aMethod.\x0a\x09\x0a\x09announcement := oldMethod\x0a\x09\x09ifNil: [\x0a\x09\x09\x09MethodAdded new\x0a\x09\x09\x09\x09\x09method: aMethod;\x0a\x09\x09\x09\x09\x09yourself ]\x0a\x09\x09ifNotNil: [\x0a\x09\x09\x09MethodModified new\x0a\x09\x09\x09\x09\x09oldMethod: oldMethod;\x0a\x09\x09\x09\x09\x09method: aMethod;\x0a\x09\x09\x09\x09\x09yourself ].\x0a\x09\x09\x09\x09\x09\x0a\x09\x09\x09\x09\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09\x09\x09announce: announcement",
  15956. referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"],
  15957. messageSends: ["at:ifAbsent:", "methodDictionary", "selector", "basicAddCompiledMethod:", "ifNil:ifNotNil:", "method:", "new", "yourself", "oldMethod:", "announce:", "current"]
  15958. }),
  15959. $globals.TBehaviorProvider);
  15960. $core.addMethod(
  15961. $core.method({
  15962. selector: "basicAddCompiledMethod:",
  15963. protocol: "private",
  15964. fn: function (aMethod){
  15965. var self=this,$self=this;
  15966. return $core.withContext(function($ctx1) {
  15967. $core.addMethod(aMethod, self);
  15968. return self;
  15969. }, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod},$globals.TBehaviorProvider)});
  15970. },
  15971. args: ["aMethod"],
  15972. source: "basicAddCompiledMethod: aMethod\x0a\x09<inlineJS: '$core.addMethod(aMethod, self)'>",
  15973. referencedClasses: [],
  15974. messageSends: []
  15975. }),
  15976. $globals.TBehaviorProvider);
  15977. $core.addMethod(
  15978. $core.method({
  15979. selector: "basicRemoveCompiledMethod:",
  15980. protocol: "private",
  15981. fn: function (aMethod){
  15982. var self=this,$self=this;
  15983. return $core.withContext(function($ctx1) {
  15984. $core.removeMethod(aMethod,self);
  15985. return self;
  15986. }, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod},$globals.TBehaviorProvider)});
  15987. },
  15988. args: ["aMethod"],
  15989. source: "basicRemoveCompiledMethod: aMethod\x0a\x09<inlineJS: '$core.removeMethod(aMethod,self)'>",
  15990. referencedClasses: [],
  15991. messageSends: []
  15992. }),
  15993. $globals.TBehaviorProvider);
  15994. $core.addMethod(
  15995. $core.method({
  15996. selector: "compile:protocol:",
  15997. protocol: "compiling",
  15998. fn: function (aString,anotherString){
  15999. var self=this,$self=this;
  16000. return $core.withContext(function($ctx1) {
  16001. return $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,self,anotherString);
  16002. }, function($ctx1) {$ctx1.fill(self,"compile:protocol:",{aString:aString,anotherString:anotherString},$globals.TBehaviorProvider)});
  16003. },
  16004. args: ["aString", "anotherString"],
  16005. source: "compile: aString protocol: anotherString\x0a\x09^ Compiler new\x0a\x09\x09install: aString\x0a\x09\x09forClass: self\x0a\x09\x09protocol: anotherString",
  16006. referencedClasses: ["Compiler"],
  16007. messageSends: ["install:forClass:protocol:", "new"]
  16008. }),
  16009. $globals.TBehaviorProvider);
  16010. $core.addMethod(
  16011. $core.method({
  16012. selector: "includesSelector:",
  16013. protocol: "testing",
  16014. fn: function (aString){
  16015. var self=this,$self=this;
  16016. return $core.withContext(function($ctx1) {
  16017. return $recv($self._methodDictionary())._includesKey_(aString);
  16018. }, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString},$globals.TBehaviorProvider)});
  16019. },
  16020. args: ["aString"],
  16021. source: "includesSelector: aString\x0a\x09^ self methodDictionary includesKey: aString",
  16022. referencedClasses: [],
  16023. messageSends: ["includesKey:", "methodDictionary"]
  16024. }),
  16025. $globals.TBehaviorProvider);
  16026. $core.addMethod(
  16027. $core.method({
  16028. selector: "methodAt:",
  16029. protocol: "accessing",
  16030. fn: function (aString){
  16031. var self=this,$self=this;
  16032. return $core.withContext(function($ctx1) {
  16033. return $recv($self._methodDictionary())._at_(aString);
  16034. }, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString},$globals.TBehaviorProvider)});
  16035. },
  16036. args: ["aString"],
  16037. source: "methodAt: aString\x0a\x09^ self methodDictionary at: aString",
  16038. referencedClasses: [],
  16039. messageSends: ["at:", "methodDictionary"]
  16040. }),
  16041. $globals.TBehaviorProvider);
  16042. $core.addMethod(
  16043. $core.method({
  16044. selector: "methodDictionary",
  16045. protocol: "accessing",
  16046. fn: function (){
  16047. var self=this,$self=this;
  16048. return $core.withContext(function($ctx1) {
  16049. var dict = $globals.HashedCollection._new();
  16050. var methods = self.methods;
  16051. Object.keys(methods).forEach(function(i) {
  16052. if(methods[i].selector) {
  16053. dict._at_put_(methods[i].selector, methods[i]);
  16054. }
  16055. });
  16056. return dict;
  16057. return self;
  16058. }, function($ctx1) {$ctx1.fill(self,"methodDictionary",{},$globals.TBehaviorProvider)});
  16059. },
  16060. args: [],
  16061. source: "methodDictionary\x0a\x09<inlineJS: 'var dict = $globals.HashedCollection._new();\x0a\x09var methods = self.methods;\x0a\x09Object.keys(methods).forEach(function(i) {\x0a\x09\x09if(methods[i].selector) {\x0a\x09\x09\x09dict._at_put_(methods[i].selector, methods[i]);\x0a\x09\x09}\x0a\x09});\x0a\x09return dict'>",
  16062. referencedClasses: [],
  16063. messageSends: []
  16064. }),
  16065. $globals.TBehaviorProvider);
  16066. $core.addMethod(
  16067. $core.method({
  16068. selector: "methodOrganizationEnter:andLeave:",
  16069. protocol: "accessing",
  16070. fn: function (aMethod,oldMethod){
  16071. var self=this,$self=this;
  16072. return $core.withContext(function($ctx1) {
  16073. var $1,$2,$receiver;
  16074. if(($receiver = aMethod) == null || $receiver.a$nil){
  16075. aMethod;
  16076. } else {
  16077. $1=$self._organization();
  16078. $2=$recv(aMethod)._protocol();
  16079. $ctx1.sendIdx["protocol"]=1;
  16080. $recv($1)._addElement_($2);
  16081. }
  16082. if(($receiver = oldMethod) == null || $receiver.a$nil){
  16083. oldMethod;
  16084. } else {
  16085. $self._removeProtocolIfEmpty_($recv(oldMethod)._protocol());
  16086. }
  16087. return self;
  16088. }, function($ctx1) {$ctx1.fill(self,"methodOrganizationEnter:andLeave:",{aMethod:aMethod,oldMethod:oldMethod},$globals.TBehaviorProvider)});
  16089. },
  16090. args: ["aMethod", "oldMethod"],
  16091. source: "methodOrganizationEnter: aMethod andLeave: oldMethod\x0a\x09aMethod ifNotNil: [\x0a\x09\x09self organization addElement: aMethod protocol ].\x0a\x09\x0a\x09oldMethod ifNotNil: [\x0a\x09\x09self removeProtocolIfEmpty: oldMethod protocol ]",
  16092. referencedClasses: [],
  16093. messageSends: ["ifNotNil:", "addElement:", "organization", "protocol", "removeProtocolIfEmpty:"]
  16094. }),
  16095. $globals.TBehaviorProvider);
  16096. $core.addMethod(
  16097. $core.method({
  16098. selector: "methodTemplate",
  16099. protocol: "accessing",
  16100. fn: function (){
  16101. var self=this,$self=this;
  16102. return $core.withContext(function($ctx1) {
  16103. return $recv($globals.String)._streamContents_((function(stream){
  16104. return $core.withContext(function($ctx2) {
  16105. $recv(stream)._write_("messageSelectorAndArgumentNames");
  16106. $ctx2.sendIdx["write:"]=1;
  16107. $recv(stream)._lf();
  16108. $ctx2.sendIdx["lf"]=1;
  16109. $recv(stream)._tab();
  16110. $ctx2.sendIdx["tab"]=1;
  16111. $recv(stream)._write_("\x22comment stating purpose of message\x22");
  16112. $ctx2.sendIdx["write:"]=2;
  16113. $recv(stream)._lf();
  16114. $ctx2.sendIdx["lf"]=2;
  16115. $recv(stream)._lf();
  16116. $ctx2.sendIdx["lf"]=3;
  16117. $recv(stream)._tab();
  16118. $ctx2.sendIdx["tab"]=2;
  16119. $recv(stream)._write_("| temporary variable names |");
  16120. $ctx2.sendIdx["write:"]=3;
  16121. $recv(stream)._lf();
  16122. $recv(stream)._tab();
  16123. return $recv(stream)._write_("statements");
  16124. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  16125. }));
  16126. }, function($ctx1) {$ctx1.fill(self,"methodTemplate",{},$globals.TBehaviorProvider)});
  16127. },
  16128. args: [],
  16129. source: "methodTemplate\x0a\x09^ String streamContents: [ :stream | stream \x0a\x09\x09write: 'messageSelectorAndArgumentNames'; lf;\x0a\x09\x09tab; write: '\x22comment stating purpose of message\x22'; lf;\x0a\x09\x09lf;\x0a\x09\x09tab; write: '| temporary variable names |'; lf;\x0a\x09\x09tab; write: 'statements' ]",
  16130. referencedClasses: ["String"],
  16131. messageSends: ["streamContents:", "write:", "lf", "tab"]
  16132. }),
  16133. $globals.TBehaviorProvider);
  16134. $core.addMethod(
  16135. $core.method({
  16136. selector: "methods",
  16137. protocol: "accessing",
  16138. fn: function (){
  16139. var self=this,$self=this;
  16140. return $core.withContext(function($ctx1) {
  16141. return $recv($self._methodDictionary())._values();
  16142. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.TBehaviorProvider)});
  16143. },
  16144. args: [],
  16145. source: "methods\x0a\x09^ self methodDictionary values",
  16146. referencedClasses: [],
  16147. messageSends: ["values", "methodDictionary"]
  16148. }),
  16149. $globals.TBehaviorProvider);
  16150. $core.addMethod(
  16151. $core.method({
  16152. selector: "methodsInProtocol:",
  16153. protocol: "accessing",
  16154. fn: function (aString){
  16155. var self=this,$self=this;
  16156. return $core.withContext(function($ctx1) {
  16157. return $recv($self._methods())._select_((function(each){
  16158. return $core.withContext(function($ctx2) {
  16159. return $recv($recv(each)._protocol()).__eq(aString);
  16160. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16161. }));
  16162. }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString},$globals.TBehaviorProvider)});
  16163. },
  16164. args: ["aString"],
  16165. source: "methodsInProtocol: aString\x0a\x09^ self methods select: [ :each | each protocol = aString ]",
  16166. referencedClasses: [],
  16167. messageSends: ["select:", "methods", "=", "protocol"]
  16168. }),
  16169. $globals.TBehaviorProvider);
  16170. $core.addMethod(
  16171. $core.method({
  16172. selector: "organization",
  16173. protocol: "accessing",
  16174. fn: function (){
  16175. var self=this,$self=this;
  16176. return $core.withContext(function($ctx1) {
  16177. var $1,$receiver;
  16178. $1=$self._basicOrganization();
  16179. $ctx1.sendIdx["basicOrganization"]=1;
  16180. if(($receiver = $1) == null || $receiver.a$nil){
  16181. $self._basicOrganization_($recv($globals.ClassOrganizer)._on_(self));
  16182. return $self._basicOrganization();
  16183. } else {
  16184. return $1;
  16185. }
  16186. }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.TBehaviorProvider)});
  16187. },
  16188. args: [],
  16189. source: "organization\x0a\x09^ self basicOrganization ifNil: [\x0a\x09\x09self basicOrganization: (ClassOrganizer on: self).\x0a\x09\x09self basicOrganization ]",
  16190. referencedClasses: ["ClassOrganizer"],
  16191. messageSends: ["ifNil:", "basicOrganization", "basicOrganization:", "on:"]
  16192. }),
  16193. $globals.TBehaviorProvider);
  16194. $core.addMethod(
  16195. $core.method({
  16196. selector: "ownMethods",
  16197. protocol: "accessing",
  16198. fn: function (){
  16199. var self=this,$self=this;
  16200. return $core.withContext(function($ctx1) {
  16201. var $1;
  16202. return $recv($recv($self._ownProtocols())._inject_into_($recv($globals.OrderedCollection)._new(),(function(acc,each){
  16203. return $core.withContext(function($ctx2) {
  16204. return $recv(acc).__comma($self._ownMethodsInProtocol_(each));
  16205. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  16206. })))._sorted_((function(a,b){
  16207. return $core.withContext(function($ctx2) {
  16208. $1=$recv(a)._selector();
  16209. $ctx2.sendIdx["selector"]=1;
  16210. return $recv($1).__lt_eq($recv(b)._selector());
  16211. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)});
  16212. }));
  16213. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.TBehaviorProvider)});
  16214. },
  16215. args: [],
  16216. source: "ownMethods\x0a\x09\x22Answer the methods of the receiver that are not package extensions\x0a\x09nor obtained via trait composition\x22\x0a\x0a\x09^ (self ownProtocols \x0a\x09\x09inject: OrderedCollection new\x0a\x09\x09into: [ :acc :each | acc, (self ownMethodsInProtocol: each) ])\x0a\x09\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  16217. referencedClasses: ["OrderedCollection"],
  16218. messageSends: ["sorted:", "inject:into:", "ownProtocols", "new", ",", "ownMethodsInProtocol:", "<=", "selector"]
  16219. }),
  16220. $globals.TBehaviorProvider);
  16221. $core.addMethod(
  16222. $core.method({
  16223. selector: "ownMethodsInProtocol:",
  16224. protocol: "accessing",
  16225. fn: function (aString){
  16226. var self=this,$self=this;
  16227. return $core.withContext(function($ctx1) {
  16228. return $recv($self._methodsInProtocol_(aString))._select_((function(each){
  16229. return $core.withContext(function($ctx2) {
  16230. return $recv($recv(each)._methodClass()).__eq(self);
  16231. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16232. }));
  16233. }, function($ctx1) {$ctx1.fill(self,"ownMethodsInProtocol:",{aString:aString},$globals.TBehaviorProvider)});
  16234. },
  16235. args: ["aString"],
  16236. source: "ownMethodsInProtocol: aString\x0a\x09^ (self methodsInProtocol: aString) select: [ :each | each methodClass = self ]",
  16237. referencedClasses: [],
  16238. messageSends: ["select:", "methodsInProtocol:", "=", "methodClass"]
  16239. }),
  16240. $globals.TBehaviorProvider);
  16241. $core.addMethod(
  16242. $core.method({
  16243. selector: "ownProtocols",
  16244. protocol: "accessing",
  16245. fn: function (){
  16246. var self=this,$self=this;
  16247. return $core.withContext(function($ctx1) {
  16248. return $recv($self._protocols())._reject_((function(each){
  16249. return $core.withContext(function($ctx2) {
  16250. return $recv(each)._match_("^\x5c*");
  16251. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16252. }));
  16253. }, function($ctx1) {$ctx1.fill(self,"ownProtocols",{},$globals.TBehaviorProvider)});
  16254. },
  16255. args: [],
  16256. source: "ownProtocols\x0a\x09\x22Answer the protocols of the receiver that are not package extensions\x22\x0a\x0a\x09^ self protocols reject: [ :each |\x0a\x09\x09each match: '^\x5c*' ]",
  16257. referencedClasses: [],
  16258. messageSends: ["reject:", "protocols", "match:"]
  16259. }),
  16260. $globals.TBehaviorProvider);
  16261. $core.addMethod(
  16262. $core.method({
  16263. selector: "packageOfProtocol:",
  16264. protocol: "accessing",
  16265. fn: function (aString){
  16266. var self=this,$self=this;
  16267. return $core.withContext(function($ctx1) {
  16268. var $1;
  16269. $1=$recv(aString)._beginsWith_("*");
  16270. if(!$core.assert($1)){
  16271. return $self._package();
  16272. }
  16273. return $recv($globals.Package)._named_ifAbsent_($recv(aString)._allButFirst(),(function(){
  16274. return nil;
  16275. }));
  16276. }, function($ctx1) {$ctx1.fill(self,"packageOfProtocol:",{aString:aString},$globals.TBehaviorProvider)});
  16277. },
  16278. args: ["aString"],
  16279. source: "packageOfProtocol: aString\x0a\x09\x22Answer the package the method of receiver belongs to:\x0a\x09- if it is an extension method, answer the corresponding package\x0a\x09- else answer the receiver's package\x22\x0a\x09\x0a\x09(aString beginsWith: '*') ifFalse: [\x0a\x09\x09^ self package ].\x0a\x09\x09\x0a\x09^ Package \x0a\x09\x09named: aString allButFirst\x0a\x09\x09ifAbsent: [ nil ]",
  16280. referencedClasses: ["Package"],
  16281. messageSends: ["ifFalse:", "beginsWith:", "package", "named:ifAbsent:", "allButFirst"]
  16282. }),
  16283. $globals.TBehaviorProvider);
  16284. $core.addMethod(
  16285. $core.method({
  16286. selector: "protocols",
  16287. protocol: "accessing",
  16288. fn: function (){
  16289. var self=this,$self=this;
  16290. return $core.withContext(function($ctx1) {
  16291. return $recv($recv($recv($self._organization())._elements())._asArray())._sorted();
  16292. }, function($ctx1) {$ctx1.fill(self,"protocols",{},$globals.TBehaviorProvider)});
  16293. },
  16294. args: [],
  16295. source: "protocols\x0a\x09^ self organization elements asArray sorted",
  16296. referencedClasses: [],
  16297. messageSends: ["sorted", "asArray", "elements", "organization"]
  16298. }),
  16299. $globals.TBehaviorProvider);
  16300. $core.addMethod(
  16301. $core.method({
  16302. selector: "protocolsDo:",
  16303. protocol: "enumerating",
  16304. fn: function (aBlock){
  16305. var self=this,$self=this;
  16306. var methodsByProtocol;
  16307. return $core.withContext(function($ctx1) {
  16308. methodsByProtocol=$recv($globals.HashedCollection)._new();
  16309. $ctx1.sendIdx["new"]=1;
  16310. $recv($self._methodDictionary())._valuesDo_((function(m){
  16311. return $core.withContext(function($ctx2) {
  16312. return $recv($recv(methodsByProtocol)._at_ifAbsentPut_($recv(m)._protocol(),(function(){
  16313. return $core.withContext(function($ctx3) {
  16314. return $recv($globals.Array)._new();
  16315. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  16316. })))._add_(m);
  16317. }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
  16318. }));
  16319. $recv($self._protocols())._do_((function(protocol){
  16320. return $core.withContext(function($ctx2) {
  16321. return $recv(aBlock)._value_value_(protocol,$recv(methodsByProtocol)._at_(protocol));
  16322. }, function($ctx2) {$ctx2.fillBlock({protocol:protocol},$ctx1,3)});
  16323. }));
  16324. return self;
  16325. }, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByProtocol:methodsByProtocol},$globals.TBehaviorProvider)});
  16326. },
  16327. args: ["aBlock"],
  16328. source: "protocolsDo: aBlock\x0a\x09\x22Execute aBlock for each method protocol with\x0a\x09its collection of methods in the sort order of protocol name.\x22\x0a\x0a\x09| methodsByProtocol |\x0a\x09methodsByProtocol := HashedCollection new.\x0a\x09self methodDictionary valuesDo: [ :m |\x0a\x09\x09(methodsByProtocol at: m protocol ifAbsentPut: [ Array new ])\x0a\x09\x09\x09add: m ].\x0a\x09self protocols do: [ :protocol |\x0a\x09\x09aBlock value: protocol value: (methodsByProtocol at: protocol) ]",
  16329. referencedClasses: ["HashedCollection", "Array"],
  16330. messageSends: ["new", "valuesDo:", "methodDictionary", "add:", "at:ifAbsentPut:", "protocol", "do:", "protocols", "value:value:", "at:"]
  16331. }),
  16332. $globals.TBehaviorProvider);
  16333. $core.addMethod(
  16334. $core.method({
  16335. selector: "recompile",
  16336. protocol: "compiling",
  16337. fn: function (){
  16338. var self=this,$self=this;
  16339. return $core.withContext(function($ctx1) {
  16340. return $recv($recv($globals.Compiler)._new())._recompile_(self);
  16341. }, function($ctx1) {$ctx1.fill(self,"recompile",{},$globals.TBehaviorProvider)});
  16342. },
  16343. args: [],
  16344. source: "recompile\x0a\x09^ Compiler new recompile: self",
  16345. referencedClasses: ["Compiler"],
  16346. messageSends: ["recompile:", "new"]
  16347. }),
  16348. $globals.TBehaviorProvider);
  16349. $core.addMethod(
  16350. $core.method({
  16351. selector: "removeCompiledMethod:",
  16352. protocol: "compiling",
  16353. fn: function (aMethod){
  16354. var self=this,$self=this;
  16355. return $core.withContext(function($ctx1) {
  16356. var $1,$3,$2;
  16357. $self._basicRemoveCompiledMethod_(aMethod);
  16358. $1=$recv($globals.SystemAnnouncer)._current();
  16359. $3=$recv($globals.MethodRemoved)._new();
  16360. $recv($3)._method_(aMethod);
  16361. $2=$recv($3)._yourself();
  16362. $recv($1)._announce_($2);
  16363. return self;
  16364. }, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod},$globals.TBehaviorProvider)});
  16365. },
  16366. args: ["aMethod"],
  16367. source: "removeCompiledMethod: aMethod\x0a\x09self basicRemoveCompiledMethod: aMethod.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (MethodRemoved new\x0a\x09\x09\x09method: aMethod;\x0a\x09\x09\x09yourself)",
  16368. referencedClasses: ["SystemAnnouncer", "MethodRemoved"],
  16369. messageSends: ["basicRemoveCompiledMethod:", "announce:", "current", "method:", "new", "yourself"]
  16370. }),
  16371. $globals.TBehaviorProvider);
  16372. $core.addMethod(
  16373. $core.method({
  16374. selector: "removeProtocolIfEmpty:",
  16375. protocol: "accessing",
  16376. fn: function (aString){
  16377. var self=this,$self=this;
  16378. return $core.withContext(function($ctx1) {
  16379. $recv($self._methods())._detect_ifNone_((function(each){
  16380. return $core.withContext(function($ctx2) {
  16381. return $recv($recv(each)._protocol()).__eq(aString);
  16382. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16383. }),(function(){
  16384. return $core.withContext(function($ctx2) {
  16385. return $recv($self._organization())._removeElement_(aString);
  16386. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16387. }));
  16388. return self;
  16389. }, function($ctx1) {$ctx1.fill(self,"removeProtocolIfEmpty:",{aString:aString},$globals.TBehaviorProvider)});
  16390. },
  16391. args: ["aString"],
  16392. source: "removeProtocolIfEmpty: aString\x0a\x09self methods\x0a\x09\x09detect: [ :each | each protocol = aString ]\x0a\x09\x09ifNone: [ self organization removeElement: aString ]",
  16393. referencedClasses: [],
  16394. messageSends: ["detect:ifNone:", "methods", "=", "protocol", "removeElement:", "organization"]
  16395. }),
  16396. $globals.TBehaviorProvider);
  16397. $core.addMethod(
  16398. $core.method({
  16399. selector: "selectors",
  16400. protocol: "accessing",
  16401. fn: function (){
  16402. var self=this,$self=this;
  16403. return $core.withContext(function($ctx1) {
  16404. return $recv($self._methodDictionary())._keys();
  16405. }, function($ctx1) {$ctx1.fill(self,"selectors",{},$globals.TBehaviorProvider)});
  16406. },
  16407. args: [],
  16408. source: "selectors\x0a\x09^ self methodDictionary keys",
  16409. referencedClasses: [],
  16410. messageSends: ["keys", "methodDictionary"]
  16411. }),
  16412. $globals.TBehaviorProvider);
  16413. $core.addMethod(
  16414. $core.method({
  16415. selector: "setTraitComposition:",
  16416. protocol: "compiling",
  16417. fn: function (aTraitComposition){
  16418. var self=this,$self=this;
  16419. return $core.withContext(function($ctx1) {
  16420. $core.setTraitComposition(aTraitComposition._asJavaScriptObject(), self);
  16421. return self;
  16422. }, function($ctx1) {$ctx1.fill(self,"setTraitComposition:",{aTraitComposition:aTraitComposition},$globals.TBehaviorProvider)});
  16423. },
  16424. args: ["aTraitComposition"],
  16425. source: "setTraitComposition: aTraitComposition\x0a\x09<inlineJS: '$core.setTraitComposition(aTraitComposition._asJavaScriptObject(), self)'>",
  16426. referencedClasses: [],
  16427. messageSends: []
  16428. }),
  16429. $globals.TBehaviorProvider);
  16430. $core.addMethod(
  16431. $core.method({
  16432. selector: "traitComposition",
  16433. protocol: "accessing",
  16434. fn: function (){
  16435. var self=this,$self=this;
  16436. return $core.withContext(function($ctx1) {
  16437. var $1,$receiver;
  16438. $1=$self._basicAt_("traitComposition");
  16439. if(($receiver = $1) == null || $receiver.a$nil){
  16440. return [];
  16441. } else {
  16442. var aCollection;
  16443. aCollection=$receiver;
  16444. return $recv(aCollection)._collect_((function(each){
  16445. return $core.withContext(function($ctx2) {
  16446. return $recv($globals.TraitTransformation)._fromJSON_(each);
  16447. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  16448. }));
  16449. }
  16450. }, function($ctx1) {$ctx1.fill(self,"traitComposition",{},$globals.TBehaviorProvider)});
  16451. },
  16452. args: [],
  16453. source: "traitComposition\x0a\x09^ (self basicAt: 'traitComposition')\x0a\x09\x09ifNil: [ #() ]\x0a\x09\x09ifNotNil: [ :aCollection | aCollection collect: [ :each | TraitTransformation fromJSON: each ] ]",
  16454. referencedClasses: ["TraitTransformation"],
  16455. messageSends: ["ifNil:ifNotNil:", "basicAt:", "collect:", "fromJSON:"]
  16456. }),
  16457. $globals.TBehaviorProvider);
  16458. $core.addMethod(
  16459. $core.method({
  16460. selector: "traitCompositionDefinition",
  16461. protocol: "accessing",
  16462. fn: function (){
  16463. var self=this,$self=this;
  16464. return $core.withContext(function($ctx1) {
  16465. return $recv($self._traitComposition())._ifNotEmpty_((function(traitComposition){
  16466. return $core.withContext(function($ctx2) {
  16467. return $recv($globals.String)._streamContents_((function(str){
  16468. return $core.withContext(function($ctx3) {
  16469. $recv(str)._write_("{");
  16470. $ctx3.sendIdx["write:"]=1;
  16471. $recv(traitComposition)._do_separatedBy_((function(each){
  16472. return $core.withContext(function($ctx4) {
  16473. return $recv(str)._write_($recv(each)._definition());
  16474. $ctx4.sendIdx["write:"]=2;
  16475. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  16476. }),(function(){
  16477. return $core.withContext(function($ctx4) {
  16478. return $recv(str)._write_(". ");
  16479. $ctx4.sendIdx["write:"]=3;
  16480. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  16481. }));
  16482. return $recv(str)._write_("}");
  16483. }, function($ctx3) {$ctx3.fillBlock({str:str},$ctx2,2)});
  16484. }));
  16485. }, function($ctx2) {$ctx2.fillBlock({traitComposition:traitComposition},$ctx1,1)});
  16486. }));
  16487. }, function($ctx1) {$ctx1.fill(self,"traitCompositionDefinition",{},$globals.TBehaviorProvider)});
  16488. },
  16489. args: [],
  16490. source: "traitCompositionDefinition\x0a\x09^ self traitComposition ifNotEmpty: [ :traitComposition |\x0a\x09\x09String streamContents: [ :str |\x0a\x09\x09\x09str write: '{'.\x0a\x09\x09\x09traitComposition\x0a\x09\x09\x09\x09do: [ :each | str write: each definition ]\x0a\x09\x09\x09\x09separatedBy: [ str write: '. ' ].\x0a\x09\x09\x09str write: '}' ] ]",
  16491. referencedClasses: ["String"],
  16492. messageSends: ["ifNotEmpty:", "traitComposition", "streamContents:", "write:", "do:separatedBy:", "definition"]
  16493. }),
  16494. $globals.TBehaviorProvider);
  16495. $core.addTrait("TMasterBehavior", "Kernel-Classes");
  16496. $globals.TMasterBehavior.comment="I am the behavior on the instance-side of the browser.\x0a\x0aI define things like package, category, name, comment etc.\x0aas opposed to derived behaviors (metaclass, class trait, ...)\x0athat relate to me.";
  16497. $core.addMethod(
  16498. $core.method({
  16499. selector: "asJavaScriptSource",
  16500. protocol: "converting",
  16501. fn: function (){
  16502. var self=this,$self=this;
  16503. return $core.withContext(function($ctx1) {
  16504. return "$globals.".__comma($self._name());
  16505. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.TMasterBehavior)});
  16506. },
  16507. args: [],
  16508. source: "asJavaScriptSource\x0a\x09^ '$globals.', self name",
  16509. referencedClasses: [],
  16510. messageSends: [",", "name"]
  16511. }),
  16512. $globals.TMasterBehavior);
  16513. $core.addMethod(
  16514. $core.method({
  16515. selector: "browse",
  16516. protocol: "browsing",
  16517. fn: function (){
  16518. var self=this,$self=this;
  16519. return $core.withContext(function($ctx1) {
  16520. $recv($globals.Finder)._findClass_(self);
  16521. return self;
  16522. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.TMasterBehavior)});
  16523. },
  16524. args: [],
  16525. source: "browse\x0a\x09Finder findClass: self",
  16526. referencedClasses: ["Finder"],
  16527. messageSends: ["findClass:"]
  16528. }),
  16529. $globals.TMasterBehavior);
  16530. $core.addMethod(
  16531. $core.method({
  16532. selector: "category",
  16533. protocol: "accessing",
  16534. fn: function (){
  16535. var self=this,$self=this;
  16536. return $core.withContext(function($ctx1) {
  16537. var $1,$receiver;
  16538. $1=$self._package();
  16539. $ctx1.sendIdx["package"]=1;
  16540. if(($receiver = $1) == null || $receiver.a$nil){
  16541. return "Unclassified";
  16542. } else {
  16543. return $recv($self._package())._name();
  16544. }
  16545. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.TMasterBehavior)});
  16546. },
  16547. args: [],
  16548. source: "category\x0a\x09^ self package ifNil: [ 'Unclassified' ] ifNotNil: [ self package name ]",
  16549. referencedClasses: [],
  16550. messageSends: ["ifNil:ifNotNil:", "package", "name"]
  16551. }),
  16552. $globals.TMasterBehavior);
  16553. $core.addMethod(
  16554. $core.method({
  16555. selector: "classTag",
  16556. protocol: "accessing",
  16557. fn: function (){
  16558. var self=this,$self=this;
  16559. return $core.withContext(function($ctx1) {
  16560. return $self._subclassResponsibility();
  16561. }, function($ctx1) {$ctx1.fill(self,"classTag",{},$globals.TMasterBehavior)});
  16562. },
  16563. args: [],
  16564. source: "classTag\x0a\x09\x22Every master behavior should define a class tag.\x22\x0a\x09^ self subclassResponsibility",
  16565. referencedClasses: [],
  16566. messageSends: ["subclassResponsibility"]
  16567. }),
  16568. $globals.TMasterBehavior);
  16569. $core.addMethod(
  16570. $core.method({
  16571. selector: "comment",
  16572. protocol: "accessing",
  16573. fn: function (){
  16574. var self=this,$self=this;
  16575. return $core.withContext(function($ctx1) {
  16576. var $1,$receiver;
  16577. $1=$self._basicAt_("comment");
  16578. if(($receiver = $1) == null || $receiver.a$nil){
  16579. return "";
  16580. } else {
  16581. return $1;
  16582. }
  16583. }, function($ctx1) {$ctx1.fill(self,"comment",{},$globals.TMasterBehavior)});
  16584. },
  16585. args: [],
  16586. source: "comment\x0a\x09^ (self basicAt: 'comment') ifNil: [ '' ]",
  16587. referencedClasses: [],
  16588. messageSends: ["ifNil:", "basicAt:"]
  16589. }),
  16590. $globals.TMasterBehavior);
  16591. $core.addMethod(
  16592. $core.method({
  16593. selector: "comment:",
  16594. protocol: "accessing",
  16595. fn: function (aString){
  16596. var self=this,$self=this;
  16597. return $core.withContext(function($ctx1) {
  16598. var $1,$3,$2;
  16599. $self._basicAt_put_("comment",aString);
  16600. $1=$recv($globals.SystemAnnouncer)._current();
  16601. $3=$recv($globals.ClassCommentChanged)._new();
  16602. $recv($3)._theClass_(self);
  16603. $2=$recv($3)._yourself();
  16604. $recv($1)._announce_($2);
  16605. return self;
  16606. }, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString},$globals.TMasterBehavior)});
  16607. },
  16608. args: ["aString"],
  16609. source: "comment: aString\x0a\x09self basicAt: 'comment' put: aString.\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassCommentChanged new\x0a\x09\x09\x09theClass: self;\x0a\x09\x09\x09yourself)",
  16610. referencedClasses: ["SystemAnnouncer", "ClassCommentChanged"],
  16611. messageSends: ["basicAt:put:", "announce:", "current", "theClass:", "new", "yourself"]
  16612. }),
  16613. $globals.TMasterBehavior);
  16614. $core.addMethod(
  16615. $core.method({
  16616. selector: "definedMethods",
  16617. protocol: "accessing",
  16618. fn: function (){
  16619. var self=this,$self=this;
  16620. var methods;
  16621. return $core.withContext(function($ctx1) {
  16622. var $1,$receiver;
  16623. methods=$self._methods();
  16624. $ctx1.sendIdx["methods"]=1;
  16625. $1=$self._theMetaClass();
  16626. if(($receiver = $1) == null || $receiver.a$nil){
  16627. return methods;
  16628. } else {
  16629. var meta;
  16630. meta=$receiver;
  16631. return $recv(methods).__comma($recv(meta)._methods());
  16632. }
  16633. return self;
  16634. }, function($ctx1) {$ctx1.fill(self,"definedMethods",{methods:methods},$globals.TMasterBehavior)});
  16635. },
  16636. args: [],
  16637. source: "definedMethods\x0a\x09\x22Answers methods of me and derived 'meta' part if present\x22\x0a\x09| methods |\x0a\x09methods := self methods.\x0a\x09self theMetaClass\x0a\x09\x09ifNil: [ ^ methods ]\x0a\x09\x09ifNotNil: [ :meta | ^ methods, meta methods ]",
  16638. referencedClasses: [],
  16639. messageSends: ["methods", "ifNil:ifNotNil:", "theMetaClass", ","]
  16640. }),
  16641. $globals.TMasterBehavior);
  16642. $core.addMethod(
  16643. $core.method({
  16644. selector: "enterOrganization",
  16645. protocol: "accessing",
  16646. fn: function (){
  16647. var self=this,$self=this;
  16648. return $core.withContext(function($ctx1) {
  16649. var $1,$receiver;
  16650. if(($receiver = $globals.Smalltalk) == null || $receiver.a$nil){
  16651. $globals.Smalltalk;
  16652. } else {
  16653. $1=$self._basicAt_("category");
  16654. if(($receiver = $1) == null || $receiver.a$nil){
  16655. $self._basicPackage_(nil);
  16656. $ctx1.sendIdx["basicPackage:"]=1;
  16657. } else {
  16658. var category;
  16659. category=$receiver;
  16660. $self._basicPackage_($recv($globals.Package)._named_(category));
  16661. $recv($recv($self._package())._organization())._addElement_(self);
  16662. }
  16663. }
  16664. return self;
  16665. }, function($ctx1) {$ctx1.fill(self,"enterOrganization",{},$globals.TMasterBehavior)});
  16666. },
  16667. args: [],
  16668. source: "enterOrganization\x0a\x09Smalltalk ifNotNil: [\x0a\x09\x09(self basicAt: 'category')\x0a\x09\x09\x09ifNil: [ self basicPackage: nil ]\x0a\x09\x09\x09ifNotNil: [ :category |\x0a\x09\x09\x09\x09\x22Amber has 1-1 correspondence between cat and pkg, atm\x22\x0a\x09\x09\x09\x09self basicPackage: (Package named: category).\x0a\x09\x09\x09\x09self package organization addElement: self ] ]",
  16669. referencedClasses: ["Smalltalk", "Package"],
  16670. messageSends: ["ifNotNil:", "ifNil:ifNotNil:", "basicAt:", "basicPackage:", "named:", "addElement:", "organization", "package"]
  16671. }),
  16672. $globals.TMasterBehavior);
  16673. $core.addMethod(
  16674. $core.method({
  16675. selector: "leaveOrganization",
  16676. protocol: "accessing",
  16677. fn: function (){
  16678. var self=this,$self=this;
  16679. return $core.withContext(function($ctx1) {
  16680. var $receiver;
  16681. if(($receiver = $globals.Smalltalk) == null || $receiver.a$nil){
  16682. $globals.Smalltalk;
  16683. } else {
  16684. $recv($recv($self._package())._organization())._removeElement_(self);
  16685. }
  16686. return self;
  16687. }, function($ctx1) {$ctx1.fill(self,"leaveOrganization",{},$globals.TMasterBehavior)});
  16688. },
  16689. args: [],
  16690. source: "leaveOrganization\x0a\x09Smalltalk ifNotNil: [\x0a\x09\x09self package organization removeElement: self ]",
  16691. referencedClasses: ["Smalltalk"],
  16692. messageSends: ["ifNotNil:", "removeElement:", "organization", "package"]
  16693. }),
  16694. $globals.TMasterBehavior);
  16695. $core.addMethod(
  16696. $core.method({
  16697. selector: "name",
  16698. protocol: "accessing",
  16699. fn: function (){
  16700. var self=this,$self=this;
  16701. return $core.withContext(function($ctx1) {
  16702. return self.name;
  16703. return self;
  16704. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.TMasterBehavior)});
  16705. },
  16706. args: [],
  16707. source: "name\x0a\x09<inlineJS: 'return self.name'>",
  16708. referencedClasses: [],
  16709. messageSends: []
  16710. }),
  16711. $globals.TMasterBehavior);
  16712. $core.addMethod(
  16713. $core.method({
  16714. selector: "package:",
  16715. protocol: "accessing",
  16716. fn: function (aPackage){
  16717. var self=this,$self=this;
  16718. var oldPackage;
  16719. return $core.withContext(function($ctx1) {
  16720. var $2,$1,$3,$5,$4;
  16721. $2=$self._package();
  16722. $ctx1.sendIdx["package"]=1;
  16723. $1=$recv($2).__eq(aPackage);
  16724. if($core.assert($1)){
  16725. return self;
  16726. }
  16727. oldPackage=$self._package();
  16728. $self._leaveOrganization();
  16729. $self._basicAt_put_("category",$recv(aPackage)._name());
  16730. $self._enterOrganization();
  16731. $3=$recv($globals.SystemAnnouncer)._current();
  16732. $5=$recv($globals.ClassMoved)._new();
  16733. $recv($5)._theClass_(self);
  16734. $recv($5)._oldPackage_(oldPackage);
  16735. $4=$recv($5)._yourself();
  16736. $recv($3)._announce_($4);
  16737. return self;
  16738. }, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage},$globals.TMasterBehavior)});
  16739. },
  16740. args: ["aPackage"],
  16741. source: "package: aPackage\x0a\x09| oldPackage |\x0a\x09\x0a\x09self package = aPackage ifTrue: [ ^ self ].\x0a\x09\x0a\x09oldPackage := self package.\x0a\x09\x0a\x09self\x0a\x09\x09leaveOrganization;\x0a\x09\x09basicAt: 'category' put: aPackage name;\x0a\x09\x09enterOrganization.\x0a\x0a\x09SystemAnnouncer current announce: (ClassMoved new\x0a\x09\x09theClass: self;\x0a\x09\x09oldPackage: oldPackage;\x0a\x09\x09yourself)",
  16742. referencedClasses: ["SystemAnnouncer", "ClassMoved"],
  16743. messageSends: ["ifTrue:", "=", "package", "leaveOrganization", "basicAt:put:", "name", "enterOrganization", "announce:", "current", "theClass:", "new", "oldPackage:", "yourself"]
  16744. }),
  16745. $globals.TMasterBehavior);
  16746. $core.addMethod(
  16747. $core.method({
  16748. selector: "theNonMetaClass",
  16749. protocol: "accessing",
  16750. fn: function (){
  16751. var self=this,$self=this;
  16752. return self;
  16753. },
  16754. args: [],
  16755. source: "theNonMetaClass\x0a\x09^ self",
  16756. referencedClasses: [],
  16757. messageSends: []
  16758. }),
  16759. $globals.TMasterBehavior);
  16760. $core.addClass("Trait", $globals.Object, ["organization", "package"], "Kernel-Classes");
  16761. $core.addMethod(
  16762. $core.method({
  16763. selector: "-",
  16764. protocol: "composition",
  16765. fn: function (anArray){
  16766. var self=this,$self=this;
  16767. return $core.withContext(function($ctx1) {
  16768. return $recv($self._asTraitTransformation()).__minus(anArray);
  16769. }, function($ctx1) {$ctx1.fill(self,"-",{anArray:anArray},$globals.Trait)});
  16770. },
  16771. args: ["anArray"],
  16772. source: "- anArray\x0a\x09^ self asTraitTransformation - anArray",
  16773. referencedClasses: [],
  16774. messageSends: ["-", "asTraitTransformation"]
  16775. }),
  16776. $globals.Trait);
  16777. $core.addMethod(
  16778. $core.method({
  16779. selector: "@",
  16780. protocol: "composition",
  16781. fn: function (anArrayOfAssociations){
  16782. var self=this,$self=this;
  16783. return $core.withContext(function($ctx1) {
  16784. return $recv($self._asTraitTransformation()).__at(anArrayOfAssociations);
  16785. }, function($ctx1) {$ctx1.fill(self,"@",{anArrayOfAssociations:anArrayOfAssociations},$globals.Trait)});
  16786. },
  16787. args: ["anArrayOfAssociations"],
  16788. source: "@ anArrayOfAssociations\x0a\x09^ self asTraitTransformation @ anArrayOfAssociations",
  16789. referencedClasses: [],
  16790. messageSends: ["@", "asTraitTransformation"]
  16791. }),
  16792. $globals.Trait);
  16793. $core.addMethod(
  16794. $core.method({
  16795. selector: "asTraitComposition",
  16796. protocol: "converting",
  16797. fn: function (){
  16798. var self=this,$self=this;
  16799. return $core.withContext(function($ctx1) {
  16800. return $recv($self._asTraitTransformation())._asTraitComposition();
  16801. }, function($ctx1) {$ctx1.fill(self,"asTraitComposition",{},$globals.Trait)});
  16802. },
  16803. args: [],
  16804. source: "asTraitComposition\x0a\x09^ self asTraitTransformation asTraitComposition",
  16805. referencedClasses: [],
  16806. messageSends: ["asTraitComposition", "asTraitTransformation"]
  16807. }),
  16808. $globals.Trait);
  16809. $core.addMethod(
  16810. $core.method({
  16811. selector: "asTraitTransformation",
  16812. protocol: "converting",
  16813. fn: function (){
  16814. var self=this,$self=this;
  16815. return $core.withContext(function($ctx1) {
  16816. return $recv($globals.TraitTransformation)._on_(self);
  16817. }, function($ctx1) {$ctx1.fill(self,"asTraitTransformation",{},$globals.Trait)});
  16818. },
  16819. args: [],
  16820. source: "asTraitTransformation\x0a\x09^ TraitTransformation on: self",
  16821. referencedClasses: ["TraitTransformation"],
  16822. messageSends: ["on:"]
  16823. }),
  16824. $globals.Trait);
  16825. $core.addMethod(
  16826. $core.method({
  16827. selector: "basicOrganization",
  16828. protocol: "accessing",
  16829. fn: function (){
  16830. var self=this,$self=this;
  16831. return $self["@organization"];
  16832. },
  16833. args: [],
  16834. source: "basicOrganization\x0a\x09^ organization",
  16835. referencedClasses: [],
  16836. messageSends: []
  16837. }),
  16838. $globals.Trait);
  16839. $core.addMethod(
  16840. $core.method({
  16841. selector: "basicOrganization:",
  16842. protocol: "accessing",
  16843. fn: function (aClassOrganizer){
  16844. var self=this,$self=this;
  16845. $self["@organization"]=aClassOrganizer;
  16846. return self;
  16847. },
  16848. args: ["aClassOrganizer"],
  16849. source: "basicOrganization: aClassOrganizer\x0a\x09organization := aClassOrganizer",
  16850. referencedClasses: [],
  16851. messageSends: []
  16852. }),
  16853. $globals.Trait);
  16854. $core.addMethod(
  16855. $core.method({
  16856. selector: "basicPackage:",
  16857. protocol: "accessing",
  16858. fn: function (aPackage){
  16859. var self=this,$self=this;
  16860. $self["@package"]=aPackage;
  16861. return self;
  16862. },
  16863. args: ["aPackage"],
  16864. source: "basicPackage: aPackage\x0a\x09package := aPackage",
  16865. referencedClasses: [],
  16866. messageSends: []
  16867. }),
  16868. $globals.Trait);
  16869. $core.addMethod(
  16870. $core.method({
  16871. selector: "classTag",
  16872. protocol: "accessing",
  16873. fn: function (){
  16874. var self=this,$self=this;
  16875. return "trait";
  16876. },
  16877. args: [],
  16878. source: "classTag\x0a\x09^ 'trait'",
  16879. referencedClasses: [],
  16880. messageSends: []
  16881. }),
  16882. $globals.Trait);
  16883. $core.addMethod(
  16884. $core.method({
  16885. selector: "definition",
  16886. protocol: "accessing",
  16887. fn: function (){
  16888. var self=this,$self=this;
  16889. return $core.withContext(function($ctx1) {
  16890. var $1;
  16891. return $recv($globals.String)._streamContents_((function(stream){
  16892. return $core.withContext(function($ctx2) {
  16893. $recv(stream)._write_("Trait named: ");
  16894. $ctx2.sendIdx["write:"]=1;
  16895. $recv(stream)._printSymbol_($self._name());
  16896. $recv(stream)._lf();
  16897. $ctx2.sendIdx["lf"]=1;
  16898. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifNotEmpty_((function(tcd){
  16899. return $core.withContext(function($ctx3) {
  16900. $1=$recv($globals.String)._tab();
  16901. $ctx3.sendIdx["tab"]=1;
  16902. return [$1,"uses: ",tcd,$recv($globals.String)._lf()];
  16903. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,2)});
  16904. })));
  16905. $ctx2.sendIdx["write:"]=2;
  16906. $recv(stream)._tab();
  16907. $recv(stream)._write_("package: ");
  16908. return $recv(stream)._print_($self._category());
  16909. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  16910. }));
  16911. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Trait)});
  16912. },
  16913. args: [],
  16914. source: "definition\x0a\x09^ String streamContents: [ :stream | stream\x0a\x09\x09write: 'Trait named: '; printSymbol: self name; lf;\x0a\x09\x09write: (self traitCompositionDefinition ifNotEmpty: [ :tcd | { String tab. 'uses: '. tcd. String lf }]);\x0a\x09\x09tab; write: 'package: '; print: self category ]",
  16915. referencedClasses: ["String"],
  16916. messageSends: ["streamContents:", "write:", "printSymbol:", "name", "lf", "ifNotEmpty:", "traitCompositionDefinition", "tab", "print:", "category"]
  16917. }),
  16918. $globals.Trait);
  16919. $core.addMethod(
  16920. $core.method({
  16921. selector: "package",
  16922. protocol: "accessing",
  16923. fn: function (){
  16924. var self=this,$self=this;
  16925. return $self["@package"];
  16926. },
  16927. args: [],
  16928. source: "package\x0a\x09^ package",
  16929. referencedClasses: [],
  16930. messageSends: []
  16931. }),
  16932. $globals.Trait);
  16933. $core.addMethod(
  16934. $core.method({
  16935. selector: "theMetaClass",
  16936. protocol: "accessing",
  16937. fn: function (){
  16938. var self=this,$self=this;
  16939. return nil;
  16940. },
  16941. args: [],
  16942. source: "theMetaClass\x0a\x09^ nil",
  16943. referencedClasses: [],
  16944. messageSends: []
  16945. }),
  16946. $globals.Trait);
  16947. $core.addMethod(
  16948. $core.method({
  16949. selector: "traitUsers",
  16950. protocol: "accessing",
  16951. fn: function (){
  16952. var self=this,$self=this;
  16953. return $core.withContext(function($ctx1) {
  16954. return $recv($self._basicAt_("traitUsers"))._copy();
  16955. }, function($ctx1) {$ctx1.fill(self,"traitUsers",{},$globals.Trait)});
  16956. },
  16957. args: [],
  16958. source: "traitUsers\x0a\x09^ (self basicAt: 'traitUsers') copy",
  16959. referencedClasses: [],
  16960. messageSends: ["copy", "basicAt:"]
  16961. }),
  16962. $globals.Trait);
  16963. $core.addMethod(
  16964. $core.method({
  16965. selector: "named:package:",
  16966. protocol: "instance creation",
  16967. fn: function (aString,anotherString){
  16968. var self=this,$self=this;
  16969. return $core.withContext(function($ctx1) {
  16970. return $recv($recv($globals.ClassBuilder)._new())._addTraitNamed_package_(aString,anotherString);
  16971. }, function($ctx1) {$ctx1.fill(self,"named:package:",{aString:aString,anotherString:anotherString},$globals.Trait.a$cls)});
  16972. },
  16973. args: ["aString", "anotherString"],
  16974. source: "named: aString package: anotherString\x0a\x09^ ClassBuilder new addTraitNamed: aString package: anotherString",
  16975. referencedClasses: ["ClassBuilder"],
  16976. messageSends: ["addTraitNamed:package:", "new"]
  16977. }),
  16978. $globals.Trait.a$cls);
  16979. $core.addMethod(
  16980. $core.method({
  16981. selector: "named:uses:package:",
  16982. protocol: "instance creation",
  16983. fn: function (aString,aTraitCompositionDescription,anotherString){
  16984. var self=this,$self=this;
  16985. var trait;
  16986. return $core.withContext(function($ctx1) {
  16987. trait=$self._named_package_(aString,anotherString);
  16988. $recv(trait)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  16989. return trait;
  16990. }, function($ctx1) {$ctx1.fill(self,"named:uses:package:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,anotherString:anotherString,trait:trait},$globals.Trait.a$cls)});
  16991. },
  16992. args: ["aString", "aTraitCompositionDescription", "anotherString"],
  16993. source: "named: aString uses: aTraitCompositionDescription package: anotherString\x0a\x09| trait |\x0a\x09trait := self named: aString package: anotherString.\x0a\x09trait setTraitComposition: aTraitCompositionDescription asTraitComposition.\x0a\x09^ trait",
  16994. referencedClasses: [],
  16995. messageSends: ["named:package:", "setTraitComposition:", "asTraitComposition"]
  16996. }),
  16997. $globals.Trait.a$cls);
  16998. $core.addClass("TraitTransformation", $globals.Object, ["trait", "aliases", "exclusions"], "Kernel-Classes");
  16999. $globals.TraitTransformation.comment="I am a single step in trait composition.\x0a\x0aI represent one trait including its aliases and exclusions.";
  17000. $core.addMethod(
  17001. $core.method({
  17002. selector: "-",
  17003. protocol: "composition",
  17004. fn: function (anArray){
  17005. var self=this,$self=this;
  17006. return $core.withContext(function($ctx1) {
  17007. var $1;
  17008. $1=$self._copy();
  17009. $recv($1)._addExclusions_(anArray);
  17010. return $recv($1)._yourself();
  17011. }, function($ctx1) {$ctx1.fill(self,"-",{anArray:anArray},$globals.TraitTransformation)});
  17012. },
  17013. args: ["anArray"],
  17014. source: "- anArray\x0a\x09^ self copy addExclusions: anArray; yourself",
  17015. referencedClasses: [],
  17016. messageSends: ["addExclusions:", "copy", "yourself"]
  17017. }),
  17018. $globals.TraitTransformation);
  17019. $core.addMethod(
  17020. $core.method({
  17021. selector: "@",
  17022. protocol: "composition",
  17023. fn: function (anArrayOfAssociations){
  17024. var self=this,$self=this;
  17025. return $core.withContext(function($ctx1) {
  17026. var $1;
  17027. $1=$self._copy();
  17028. $recv($1)._addAliases_(anArrayOfAssociations);
  17029. return $recv($1)._yourself();
  17030. }, function($ctx1) {$ctx1.fill(self,"@",{anArrayOfAssociations:anArrayOfAssociations},$globals.TraitTransformation)});
  17031. },
  17032. args: ["anArrayOfAssociations"],
  17033. source: "@ anArrayOfAssociations\x0a\x09^ self copy addAliases: anArrayOfAssociations; yourself",
  17034. referencedClasses: [],
  17035. messageSends: ["addAliases:", "copy", "yourself"]
  17036. }),
  17037. $globals.TraitTransformation);
  17038. $core.addMethod(
  17039. $core.method({
  17040. selector: "addAliases:",
  17041. protocol: "accessing",
  17042. fn: function (anArrayOfAssociations){
  17043. var self=this,$self=this;
  17044. return $core.withContext(function($ctx1) {
  17045. $recv(anArrayOfAssociations)._do_((function(each){
  17046. var key;
  17047. return $core.withContext(function($ctx2) {
  17048. key=$recv(each)._key();
  17049. return $recv($self["@aliases"])._at_ifPresent_ifAbsent_(key,(function(){
  17050. return $core.withContext(function($ctx3) {
  17051. return $self._error_("Cannot use same alias name twice.");
  17052. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  17053. }),(function(){
  17054. return $core.withContext(function($ctx3) {
  17055. return $recv($self["@aliases"])._at_put_(key,$recv(each)._value());
  17056. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  17057. }));
  17058. }, function($ctx2) {$ctx2.fillBlock({each:each,key:key},$ctx1,1)});
  17059. }));
  17060. return anArrayOfAssociations;
  17061. }, function($ctx1) {$ctx1.fill(self,"addAliases:",{anArrayOfAssociations:anArrayOfAssociations},$globals.TraitTransformation)});
  17062. },
  17063. args: ["anArrayOfAssociations"],
  17064. source: "addAliases: anArrayOfAssociations\x0a\x09anArrayOfAssociations do: [ :each |\x0a\x09\x09| key |\x0a\x09\x09key := each key.\x0a\x09\x09aliases at: key\x0a\x09\x09\x09ifPresent: [ self error: 'Cannot use same alias name twice.' ]\x0a\x09\x09\x09ifAbsent: [ aliases at: key put: each value ] ].\x0a\x09^ anArrayOfAssociations",
  17065. referencedClasses: [],
  17066. messageSends: ["do:", "key", "at:ifPresent:ifAbsent:", "error:", "at:put:", "value"]
  17067. }),
  17068. $globals.TraitTransformation);
  17069. $core.addMethod(
  17070. $core.method({
  17071. selector: "addExclusions:",
  17072. protocol: "accessing",
  17073. fn: function (anArray){
  17074. var self=this,$self=this;
  17075. return $core.withContext(function($ctx1) {
  17076. $recv($self["@exclusions"])._addAll_(anArray);
  17077. return anArray;
  17078. }, function($ctx1) {$ctx1.fill(self,"addExclusions:",{anArray:anArray},$globals.TraitTransformation)});
  17079. },
  17080. args: ["anArray"],
  17081. source: "addExclusions: anArray\x0a\x09exclusions addAll: anArray.\x0a\x09^ anArray",
  17082. referencedClasses: [],
  17083. messageSends: ["addAll:"]
  17084. }),
  17085. $globals.TraitTransformation);
  17086. $core.addMethod(
  17087. $core.method({
  17088. selector: "aliases",
  17089. protocol: "accessing",
  17090. fn: function (){
  17091. var self=this,$self=this;
  17092. return $self["@aliases"];
  17093. },
  17094. args: [],
  17095. source: "aliases\x0a\x09^ aliases",
  17096. referencedClasses: [],
  17097. messageSends: []
  17098. }),
  17099. $globals.TraitTransformation);
  17100. $core.addMethod(
  17101. $core.method({
  17102. selector: "asJavaScriptObject",
  17103. protocol: "converting",
  17104. fn: function (){
  17105. var self=this,$self=this;
  17106. return $core.withContext(function($ctx1) {
  17107. return $globals.HashedCollection._newFromPairs_(["trait",$self._trait(),"aliases",$self._aliases(),"exclusions",$recv($recv($self._exclusions())._asArray())._sorted()]);
  17108. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.TraitTransformation)});
  17109. },
  17110. args: [],
  17111. source: "asJavaScriptObject\x0a\x09^ #{\x0a\x09\x09'trait' -> self trait.\x0a\x09\x09'aliases' -> self aliases.\x0a\x09\x09'exclusions' -> self exclusions asArray sorted }",
  17112. referencedClasses: [],
  17113. messageSends: ["trait", "aliases", "sorted", "asArray", "exclusions"]
  17114. }),
  17115. $globals.TraitTransformation);
  17116. $core.addMethod(
  17117. $core.method({
  17118. selector: "asJavaScriptSource",
  17119. protocol: "converting",
  17120. fn: function (){
  17121. var self=this,$self=this;
  17122. return $core.withContext(function($ctx1) {
  17123. var $2,$3,$1;
  17124. return $recv($globals.String)._streamContents_((function(str){
  17125. return $core.withContext(function($ctx2) {
  17126. $2=$recv($self._trait())._asJavaScriptSource();
  17127. $ctx2.sendIdx["asJavaScriptSource"]=1;
  17128. $3=$recv($self._aliases())._ifNotEmpty_((function(al){
  17129. return $core.withContext(function($ctx3) {
  17130. return [", aliases: ",$recv(al)._asJSONString()];
  17131. }, function($ctx3) {$ctx3.fillBlock({al:al},$ctx2,2)});
  17132. }));
  17133. $ctx2.sendIdx["ifNotEmpty:"]=1;
  17134. $1=["{trait: ",$2,$3,$recv($self._exclusions())._ifNotEmpty_((function(ex){
  17135. return $core.withContext(function($ctx3) {
  17136. return [", exclusions: ",$recv($recv($recv(ex)._asArray())._sorted())._asJavaScriptSource()];
  17137. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  17138. })),"}"];
  17139. return $recv(str)._write_($1);
  17140. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  17141. }));
  17142. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.TraitTransformation)});
  17143. },
  17144. args: [],
  17145. source: "asJavaScriptSource\x0a\x09^ String streamContents: [ :str | str write: {\x0a\x09\x09'{trait: '. self trait asJavaScriptSource.\x0a\x09\x09self aliases ifNotEmpty: [ :al |\x0a\x09\x09\x09{', aliases: '. al asJSONString} ].\x0a\x09\x09self exclusions ifNotEmpty: [ :ex |\x0a\x09\x09\x09{', exclusions: '. ex asArray sorted asJavaScriptSource} ].\x0a\x09\x09'}' } ]",
  17146. referencedClasses: ["String"],
  17147. messageSends: ["streamContents:", "write:", "asJavaScriptSource", "trait", "ifNotEmpty:", "aliases", "asJSONString", "exclusions", "sorted", "asArray"]
  17148. }),
  17149. $globals.TraitTransformation);
  17150. $core.addMethod(
  17151. $core.method({
  17152. selector: "asTraitComposition",
  17153. protocol: "converting",
  17154. fn: function (){
  17155. var self=this,$self=this;
  17156. return [self];
  17157. },
  17158. args: [],
  17159. source: "asTraitComposition\x0a\x09^ { self }",
  17160. referencedClasses: [],
  17161. messageSends: []
  17162. }),
  17163. $globals.TraitTransformation);
  17164. $core.addMethod(
  17165. $core.method({
  17166. selector: "asTraitTransformation",
  17167. protocol: "converting",
  17168. fn: function (){
  17169. var self=this,$self=this;
  17170. return self;
  17171. },
  17172. args: [],
  17173. source: "asTraitTransformation\x0a\x09^ self",
  17174. referencedClasses: [],
  17175. messageSends: []
  17176. }),
  17177. $globals.TraitTransformation);
  17178. $core.addMethod(
  17179. $core.method({
  17180. selector: "definition",
  17181. protocol: "accessing",
  17182. fn: function (){
  17183. var self=this,$self=this;
  17184. return $core.withContext(function($ctx1) {
  17185. return $recv($globals.String)._streamContents_((function(str){
  17186. return $core.withContext(function($ctx2) {
  17187. $recv(str)._print_($self._trait());
  17188. $recv($self._aliases())._ifNotEmpty_((function(al){
  17189. return $core.withContext(function($ctx3) {
  17190. $recv(str)._write_(" @ {");
  17191. $ctx3.sendIdx["write:"]=1;
  17192. $recv($recv(al)._associations())._do_separatedBy_((function(each){
  17193. return $core.withContext(function($ctx4) {
  17194. $recv(str)._printSymbol_($recv(each)._key());
  17195. $ctx4.sendIdx["printSymbol:"]=1;
  17196. $recv(str)._write_(" -> ");
  17197. $ctx4.sendIdx["write:"]=2;
  17198. return $recv(str)._printSymbol_($recv(each)._value());
  17199. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  17200. }),(function(){
  17201. return $core.withContext(function($ctx4) {
  17202. return $recv(str)._write_(". ");
  17203. $ctx4.sendIdx["write:"]=3;
  17204. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  17205. }));
  17206. $ctx3.sendIdx["do:separatedBy:"]=1;
  17207. return $recv(str)._write_("}");
  17208. $ctx3.sendIdx["write:"]=4;
  17209. }, function($ctx3) {$ctx3.fillBlock({al:al},$ctx2,2)});
  17210. }));
  17211. $ctx2.sendIdx["ifNotEmpty:"]=1;
  17212. return $recv($self._exclusions())._ifNotEmpty_((function(ex){
  17213. return $core.withContext(function($ctx3) {
  17214. $recv(str)._write_(" - #(");
  17215. $ctx3.sendIdx["write:"]=5;
  17216. $recv($recv($recv(ex)._asArray())._sorted())._do_separatedBy_((function(each){
  17217. return $core.withContext(function($ctx4) {
  17218. return $recv(str)._write_($recv($recv(each)._symbolPrintString())._allButFirst());
  17219. $ctx4.sendIdx["write:"]=6;
  17220. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,6)});
  17221. }),(function(){
  17222. return $core.withContext(function($ctx4) {
  17223. return $recv(str)._space();
  17224. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,7)});
  17225. }));
  17226. return $recv(str)._write_(")");
  17227. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,5)});
  17228. }));
  17229. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  17230. }));
  17231. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.TraitTransformation)});
  17232. },
  17233. args: [],
  17234. source: "definition\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09str print: self trait.\x0a\x09\x09self aliases ifNotEmpty: [ :al |\x0a\x09\x09\x09str write: ' @ {'.\x0a\x09\x09\x09al associations\x0a\x09\x09\x09\x09do: [ :each | str printSymbol: each key; write: ' -> '; printSymbol: each value ]\x0a\x09\x09\x09\x09separatedBy: [ str write: '. ' ].\x0a\x09\x09\x09str write: '}' ].\x0a\x09\x09self exclusions ifNotEmpty: [ :ex |\x0a\x09\x09\x09str write: ' - #('.\x0a\x09\x09\x09ex asArray sorted \x0a\x09\x09\x09\x09do: [ :each | str write: each symbolPrintString allButFirst ]\x0a\x09\x09\x09\x09separatedBy: [ str space ].\x0a\x09\x09\x09str write: ')' ] ]",
  17235. referencedClasses: ["String"],
  17236. messageSends: ["streamContents:", "print:", "trait", "ifNotEmpty:", "aliases", "write:", "do:separatedBy:", "associations", "printSymbol:", "key", "value", "exclusions", "sorted", "asArray", "allButFirst", "symbolPrintString", "space"]
  17237. }),
  17238. $globals.TraitTransformation);
  17239. $core.addMethod(
  17240. $core.method({
  17241. selector: "exclusions",
  17242. protocol: "accessing",
  17243. fn: function (){
  17244. var self=this,$self=this;
  17245. return $self["@exclusions"];
  17246. },
  17247. args: [],
  17248. source: "exclusions\x0a\x09^ exclusions",
  17249. referencedClasses: [],
  17250. messageSends: []
  17251. }),
  17252. $globals.TraitTransformation);
  17253. $core.addMethod(
  17254. $core.method({
  17255. selector: "initialize",
  17256. protocol: "initialization",
  17257. fn: function (){
  17258. var self=this,$self=this;
  17259. return $core.withContext(function($ctx1) {
  17260. (
  17261. $ctx1.supercall = true,
  17262. ($globals.TraitTransformation.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  17263. $ctx1.supercall = false;
  17264. $self["@aliases"]=$globals.HashedCollection._newFromPairs_([]);
  17265. $self["@exclusions"]=$recv($globals.Set)._new();
  17266. $self["@trait"]=nil;
  17267. return self;
  17268. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TraitTransformation)});
  17269. },
  17270. args: [],
  17271. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09aliases := #{}.\x0a\x09exclusions := Set new.\x0a\x09trait := nil",
  17272. referencedClasses: ["Set"],
  17273. messageSends: ["initialize", "new"]
  17274. }),
  17275. $globals.TraitTransformation);
  17276. $core.addMethod(
  17277. $core.method({
  17278. selector: "postCopy",
  17279. protocol: "copying",
  17280. fn: function (){
  17281. var self=this,$self=this;
  17282. return $core.withContext(function($ctx1) {
  17283. $self["@aliases"]=$recv($self["@aliases"])._copy();
  17284. $ctx1.sendIdx["copy"]=1;
  17285. $self["@exclusions"]=$recv($self["@exclusions"])._copy();
  17286. return self;
  17287. }, function($ctx1) {$ctx1.fill(self,"postCopy",{},$globals.TraitTransformation)});
  17288. },
  17289. args: [],
  17290. source: "postCopy\x0a\x09aliases := aliases copy.\x0a\x09exclusions := exclusions copy",
  17291. referencedClasses: [],
  17292. messageSends: ["copy"]
  17293. }),
  17294. $globals.TraitTransformation);
  17295. $core.addMethod(
  17296. $core.method({
  17297. selector: "trait",
  17298. protocol: "accessing",
  17299. fn: function (){
  17300. var self=this,$self=this;
  17301. return $self["@trait"];
  17302. },
  17303. args: [],
  17304. source: "trait\x0a\x09^ trait",
  17305. referencedClasses: [],
  17306. messageSends: []
  17307. }),
  17308. $globals.TraitTransformation);
  17309. $core.addMethod(
  17310. $core.method({
  17311. selector: "trait:",
  17312. protocol: "accessing",
  17313. fn: function (anObject){
  17314. var self=this,$self=this;
  17315. $self["@trait"]=anObject;
  17316. return self;
  17317. },
  17318. args: ["anObject"],
  17319. source: "trait: anObject\x0a\x09trait := anObject",
  17320. referencedClasses: [],
  17321. messageSends: []
  17322. }),
  17323. $globals.TraitTransformation);
  17324. $core.addMethod(
  17325. $core.method({
  17326. selector: "fromJSON:",
  17327. protocol: "instance creation",
  17328. fn: function (aJSObject){
  17329. var self=this,$self=this;
  17330. return $core.withContext(function($ctx1) {
  17331. var $1,$4,$3,$2;
  17332. $1=(
  17333. $ctx1.supercall = true,
  17334. ($globals.TraitTransformation.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  17335. $ctx1.supercall = false;
  17336. $recv($1)._trait_($recv(aJSObject)._at_("trait"));
  17337. $4=$recv(aJSObject)._at_ifAbsent_("aliases",(function(){
  17338. return $globals.HashedCollection._newFromPairs_([]);
  17339. }));
  17340. $ctx1.sendIdx["at:ifAbsent:"]=1;
  17341. $3=$recv($globals.Smalltalk)._readJSObject_($4);
  17342. $2=$recv($3)._associations();
  17343. $recv($1)._addAliases_($2);
  17344. $recv($1)._addExclusions_($recv(aJSObject)._at_ifAbsent_("exclusions",(function(){
  17345. return [];
  17346. })));
  17347. return $recv($1)._yourself();
  17348. }, function($ctx1) {$ctx1.fill(self,"fromJSON:",{aJSObject:aJSObject},$globals.TraitTransformation.a$cls)});
  17349. },
  17350. args: ["aJSObject"],
  17351. source: "fromJSON: aJSObject\x0a\x09^ super new\x0a\x09\x09trait: (aJSObject at: #trait);\x0a\x09\x09addAliases: (Smalltalk readJSObject: (aJSObject at: #aliases ifAbsent: [#{}])) associations;\x0a\x09\x09addExclusions: (aJSObject at: #exclusions ifAbsent: [#()]);\x0a\x09\x09yourself",
  17352. referencedClasses: ["Smalltalk"],
  17353. messageSends: ["trait:", "new", "at:", "addAliases:", "associations", "readJSObject:", "at:ifAbsent:", "addExclusions:", "yourself"]
  17354. }),
  17355. $globals.TraitTransformation.a$cls);
  17356. $core.addMethod(
  17357. $core.method({
  17358. selector: "on:",
  17359. protocol: "instance creation",
  17360. fn: function (aTrait){
  17361. var self=this,$self=this;
  17362. return $core.withContext(function($ctx1) {
  17363. var $1;
  17364. $1=(
  17365. $ctx1.supercall = true,
  17366. ($globals.TraitTransformation.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  17367. $ctx1.supercall = false;
  17368. $recv($1)._trait_(aTrait);
  17369. return $recv($1)._yourself();
  17370. }, function($ctx1) {$ctx1.fill(self,"on:",{aTrait:aTrait},$globals.TraitTransformation.a$cls)});
  17371. },
  17372. args: ["aTrait"],
  17373. source: "on: aTrait\x0a\x09^ super new trait: aTrait; yourself",
  17374. referencedClasses: [],
  17375. messageSends: ["trait:", "new", "yourself"]
  17376. }),
  17377. $globals.TraitTransformation.a$cls);
  17378. $core.setTraitComposition([{trait: $globals.TBehaviorDefaults}, {trait: $globals.TBehaviorProvider}], $globals.Behavior);
  17379. $core.setTraitComposition([{trait: $globals.TMasterBehavior}, {trait: $globals.TSubclassable}], $globals.Class);
  17380. $core.setTraitComposition([{trait: $globals.TBehaviorDefaults}, {trait: $globals.TBehaviorProvider}, {trait: $globals.TMasterBehavior}], $globals.Trait);
  17381. $core.addMethod(
  17382. $core.method({
  17383. selector: "asTraitComposition",
  17384. protocol: "*Kernel-Classes",
  17385. fn: function (){
  17386. var self=this,$self=this;
  17387. return $core.withContext(function($ctx1) {
  17388. return $self._collect_((function(each){
  17389. return $core.withContext(function($ctx2) {
  17390. return $recv(each)._asTraitTransformation();
  17391. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  17392. }));
  17393. }, function($ctx1) {$ctx1.fill(self,"asTraitComposition",{},$globals.Array)});
  17394. },
  17395. args: [],
  17396. source: "asTraitComposition\x0a\x09\x22not implemented yet, noop atm\x22\x0a\x09^ self collect: [ :each | each asTraitTransformation ]",
  17397. referencedClasses: [],
  17398. messageSends: ["collect:", "asTraitTransformation"]
  17399. }),
  17400. $globals.Array);
  17401. });
  17402. define('amber_core/Kernel-Methods',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  17403. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  17404. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  17405. var $pkg = $core.addPackage("Kernel-Methods");
  17406. $pkg.innerEval = function (expr) { return eval(expr); };
  17407. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  17408. $core.addClass("BlockClosure", $globals.Object, [], "Kernel-Methods");
  17409. $globals.BlockClosure.comment="I represent a lexical closure.\x0aI am is directly mapped to JavaScript Function.\x0a\x0a## API\x0a\x0a1. Evaluation\x0a\x0a My instances get evaluated with the `#value*` methods in the 'evaluating' protocol.\x0a\x0a Example: ` [ :x | x + 1 ] value: 3 \x22Answers 4\x22 `\x0a\x0a2. Control structures\x0a\x0a Blocks are used (together with `Boolean`) for control structures (methods in the `controlling` protocol).\x0a\x0a Example: `aBlock whileTrue: [ ... ]`\x0a\x0a3. Error handling\x0a\x0a I provide the `#on:do:` method for handling exceptions.\x0a\x0a Example: ` aBlock on: MessageNotUnderstood do: [ :ex | ... ] `";
  17410. $core.addMethod(
  17411. $core.method({
  17412. selector: "applyTo:arguments:",
  17413. protocol: "evaluating",
  17414. fn: function (anObject,aCollection){
  17415. var self=this,$self=this;
  17416. return $core.withContext(function($ctx1) {
  17417. return self.apply(anObject, aCollection);
  17418. return self;
  17419. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.BlockClosure)});
  17420. },
  17421. args: ["anObject", "aCollection"],
  17422. source: "applyTo: anObject arguments: aCollection\x0a\x09<inlineJS: 'return self.apply(anObject, aCollection)'>",
  17423. referencedClasses: [],
  17424. messageSends: []
  17425. }),
  17426. $globals.BlockClosure);
  17427. $core.addMethod(
  17428. $core.method({
  17429. selector: "asCompiledMethod:",
  17430. protocol: "converting",
  17431. fn: function (aString){
  17432. var self=this,$self=this;
  17433. return $core.withContext(function($ctx1) {
  17434. return $core.method({selector:aString, fn:self});;
  17435. return self;
  17436. }, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString},$globals.BlockClosure)});
  17437. },
  17438. args: ["aString"],
  17439. source: "asCompiledMethod: aString\x0a\x09<inlineJS: 'return $core.method({selector:aString, fn:self});'>",
  17440. referencedClasses: [],
  17441. messageSends: []
  17442. }),
  17443. $globals.BlockClosure);
  17444. $core.addMethod(
  17445. $core.method({
  17446. selector: "compiledSource",
  17447. protocol: "accessing",
  17448. fn: function (){
  17449. var self=this,$self=this;
  17450. return $core.withContext(function($ctx1) {
  17451. return self.toString();
  17452. return self;
  17453. }, function($ctx1) {$ctx1.fill(self,"compiledSource",{},$globals.BlockClosure)});
  17454. },
  17455. args: [],
  17456. source: "compiledSource\x0a\x09<inlineJS: 'return self.toString()'>",
  17457. referencedClasses: [],
  17458. messageSends: []
  17459. }),
  17460. $globals.BlockClosure);
  17461. $core.addMethod(
  17462. $core.method({
  17463. selector: "currySelf",
  17464. protocol: "converting",
  17465. fn: function (){
  17466. var self=this,$self=this;
  17467. return $core.withContext(function($ctx1) {
  17468. return function () {
  17469. var args = [ this ];
  17470. args.push.apply(args, arguments);
  17471. return self.apply(null, args);
  17472. }
  17473. ;
  17474. return self;
  17475. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.BlockClosure)});
  17476. },
  17477. args: [],
  17478. source: "currySelf\x0a\x09\x22Transforms [ :selfarg :x :y | stcode ] block\x0a\x09which represents JS function (selfarg, x, y, ...) {jscode}\x0a\x09into function (x, y, ...) {jscode} that takes selfarg from 'this'.\x0a\x09IOW, it is usable as JS method and first arg takes the receiver.\x22\x0a\x09\x0a\x09<inlineJS: '\x0a\x09\x09return function () {\x0a\x09\x09\x09var args = [ this ];\x0a\x09\x09\x09args.push.apply(args, arguments);\x0a\x09\x09\x09return self.apply(null, args);\x0a\x09\x09}\x0a\x09'>",
  17479. referencedClasses: [],
  17480. messageSends: []
  17481. }),
  17482. $globals.BlockClosure);
  17483. $core.addMethod(
  17484. $core.method({
  17485. selector: "ensure:",
  17486. protocol: "evaluating",
  17487. fn: function (aBlock){
  17488. var self=this,$self=this;
  17489. return $core.withContext(function($ctx1) {
  17490. try{return $self._value()}finally{aBlock._value()};
  17491. return self;
  17492. }, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock},$globals.BlockClosure)});
  17493. },
  17494. args: ["aBlock"],
  17495. source: "ensure: aBlock\x0a\x09<inlineJS: 'try{return $self._value()}finally{aBlock._value()}'>",
  17496. referencedClasses: [],
  17497. messageSends: []
  17498. }),
  17499. $globals.BlockClosure);
  17500. $core.addMethod(
  17501. $core.method({
  17502. selector: "fork",
  17503. protocol: "timeout/interval",
  17504. fn: function (){
  17505. var self=this,$self=this;
  17506. return $core.withContext(function($ctx1) {
  17507. $recv($recv($globals.ForkPool)._default())._fork_(self);
  17508. return self;
  17509. }, function($ctx1) {$ctx1.fill(self,"fork",{},$globals.BlockClosure)});
  17510. },
  17511. args: [],
  17512. source: "fork\x0a\x09ForkPool default fork: self",
  17513. referencedClasses: ["ForkPool"],
  17514. messageSends: ["fork:", "default"]
  17515. }),
  17516. $globals.BlockClosure);
  17517. $core.addMethod(
  17518. $core.method({
  17519. selector: "new",
  17520. protocol: "evaluating",
  17521. fn: function (){
  17522. var self=this,$self=this;
  17523. return $core.withContext(function($ctx1) {
  17524. return new self();
  17525. return self;
  17526. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.BlockClosure)});
  17527. },
  17528. args: [],
  17529. source: "new\x0a\x09\x22Use the receiver as a JS constructor.\x0a\x09*Do not* use this method to instanciate Smalltalk objects!\x22\x0a\x09<inlineJS: 'return new self()'>",
  17530. referencedClasses: [],
  17531. messageSends: []
  17532. }),
  17533. $globals.BlockClosure);
  17534. $core.addMethod(
  17535. $core.method({
  17536. selector: "newValue:",
  17537. protocol: "evaluating",
  17538. fn: function (anObject){
  17539. var self=this,$self=this;
  17540. return $core.withContext(function($ctx1) {
  17541. return $self._newWithValues_([anObject]);
  17542. }, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject},$globals.BlockClosure)});
  17543. },
  17544. args: ["anObject"],
  17545. source: "newValue: anObject\x0a\x09^ self newWithValues: { anObject }",
  17546. referencedClasses: [],
  17547. messageSends: ["newWithValues:"]
  17548. }),
  17549. $globals.BlockClosure);
  17550. $core.addMethod(
  17551. $core.method({
  17552. selector: "newValue:value:",
  17553. protocol: "evaluating",
  17554. fn: function (anObject,anObject2){
  17555. var self=this,$self=this;
  17556. return $core.withContext(function($ctx1) {
  17557. return $self._newWithValues_([anObject,anObject2]);
  17558. }, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2},$globals.BlockClosure)});
  17559. },
  17560. args: ["anObject", "anObject2"],
  17561. source: "newValue: anObject value: anObject2\x0a\x09^ self newWithValues: { anObject. anObject2 }.",
  17562. referencedClasses: [],
  17563. messageSends: ["newWithValues:"]
  17564. }),
  17565. $globals.BlockClosure);
  17566. $core.addMethod(
  17567. $core.method({
  17568. selector: "newValue:value:value:",
  17569. protocol: "evaluating",
  17570. fn: function (anObject,anObject2,anObject3){
  17571. var self=this,$self=this;
  17572. return $core.withContext(function($ctx1) {
  17573. return $self._newWithValues_([anObject,anObject2,anObject3]);
  17574. }, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.BlockClosure)});
  17575. },
  17576. args: ["anObject", "anObject2", "anObject3"],
  17577. source: "newValue: anObject value: anObject2 value: anObject3\x0a\x09^ self newWithValues: { anObject. anObject2. anObject3 }.",
  17578. referencedClasses: [],
  17579. messageSends: ["newWithValues:"]
  17580. }),
  17581. $globals.BlockClosure);
  17582. $core.addMethod(
  17583. $core.method({
  17584. selector: "newWithValues:",
  17585. protocol: "evaluating",
  17586. fn: function (aCollection){
  17587. var self=this,$self=this;
  17588. return $core.withContext(function($ctx1) {
  17589. var object = Object.create(self.prototype);
  17590. var result = self.apply(object, aCollection);
  17591. return typeof result === "object" ? result : object;
  17592. ;
  17593. return self;
  17594. }, function($ctx1) {$ctx1.fill(self,"newWithValues:",{aCollection:aCollection},$globals.BlockClosure)});
  17595. },
  17596. args: ["aCollection"],
  17597. source: "newWithValues: aCollection\x0a\x09\x22Simulates JS new operator by combination of Object.create and .apply\x22\x0a\x09<inlineJS: '\x0a\x09\x09var object = Object.create(self.prototype);\x0a\x09\x09var result = self.apply(object, aCollection);\x0a\x09\x09return typeof result === \x22object\x22 ? result : object;\x0a\x09'>",
  17598. referencedClasses: [],
  17599. messageSends: []
  17600. }),
  17601. $globals.BlockClosure);
  17602. $core.addMethod(
  17603. $core.method({
  17604. selector: "numArgs",
  17605. protocol: "accessing",
  17606. fn: function (){
  17607. var self=this,$self=this;
  17608. return $core.withContext(function($ctx1) {
  17609. return self.length;
  17610. return self;
  17611. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.BlockClosure)});
  17612. },
  17613. args: [],
  17614. source: "numArgs\x0a\x09<inlineJS: 'return self.length'>",
  17615. referencedClasses: [],
  17616. messageSends: []
  17617. }),
  17618. $globals.BlockClosure);
  17619. $core.addMethod(
  17620. $core.method({
  17621. selector: "on:do:",
  17622. protocol: "error handling",
  17623. fn: function (anErrorClass,aBlock){
  17624. var self=this,$self=this;
  17625. return $core.withContext(function($ctx1) {
  17626. var $1;
  17627. return $self._tryCatch_((function(error){
  17628. var smalltalkError;
  17629. return $core.withContext(function($ctx2) {
  17630. smalltalkError=$recv($globals.Smalltalk)._asSmalltalkException_(error);
  17631. $1=$recv(smalltalkError)._isKindOf_(anErrorClass);
  17632. if($core.assert($1)){
  17633. return $recv(aBlock)._value_(smalltalkError);
  17634. } else {
  17635. return $recv(smalltalkError)._pass();
  17636. }
  17637. }, function($ctx2) {$ctx2.fillBlock({error:error,smalltalkError:smalltalkError},$ctx1,1)});
  17638. }));
  17639. }, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock},$globals.BlockClosure)});
  17640. },
  17641. args: ["anErrorClass", "aBlock"],
  17642. source: "on: anErrorClass do: aBlock\x0a\x09\x22All exceptions thrown in the Smalltalk stack are cought.\x0a\x09Convert all JS exceptions to JavaScriptException instances.\x22\x0a\x09\x0a\x09^ self tryCatch: [ :error | | smalltalkError |\x0a\x09\x09smalltalkError := Smalltalk asSmalltalkException: error.\x0a\x09\x09(smalltalkError isKindOf: anErrorClass)\x0a\x09\x09ifTrue: [ aBlock value: smalltalkError ]\x0a\x09\x09ifFalse: [ smalltalkError pass ] ]",
  17643. referencedClasses: ["Smalltalk"],
  17644. messageSends: ["tryCatch:", "asSmalltalkException:", "ifTrue:ifFalse:", "isKindOf:", "value:", "pass"]
  17645. }),
  17646. $globals.BlockClosure);
  17647. $core.addMethod(
  17648. $core.method({
  17649. selector: "provided",
  17650. protocol: "converting",
  17651. fn: function (){
  17652. var self=this,$self=this;
  17653. return $core.withContext(function($ctx1) {
  17654. return $recv($globals.JSObjectProxy)._on_(self);
  17655. }, function($ctx1) {$ctx1.fill(self,"provided",{},$globals.BlockClosure)});
  17656. },
  17657. args: [],
  17658. source: "provided\x0a\x09\x22Returns JS proxy that allows to access 'static API', as in\x0a\x09 require provided resolve: ...\x0a\x09or\x0a\x09 XMLHttpRequest provided DONE\x22\x0a\x09\x0a\x09^ JSObjectProxy on: self",
  17659. referencedClasses: ["JSObjectProxy"],
  17660. messageSends: ["on:"]
  17661. }),
  17662. $globals.BlockClosure);
  17663. $core.addMethod(
  17664. $core.method({
  17665. selector: "receiver",
  17666. protocol: "accessing",
  17667. fn: function (){
  17668. var self=this,$self=this;
  17669. return nil;
  17670. },
  17671. args: [],
  17672. source: "receiver\x0a\x09^ nil",
  17673. referencedClasses: [],
  17674. messageSends: []
  17675. }),
  17676. $globals.BlockClosure);
  17677. $core.addMethod(
  17678. $core.method({
  17679. selector: "timeToRun",
  17680. protocol: "evaluating",
  17681. fn: function (){
  17682. var self=this,$self=this;
  17683. return $core.withContext(function($ctx1) {
  17684. return $recv($globals.Date)._millisecondsToRun_(self);
  17685. }, function($ctx1) {$ctx1.fill(self,"timeToRun",{},$globals.BlockClosure)});
  17686. },
  17687. args: [],
  17688. source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
  17689. referencedClasses: ["Date"],
  17690. messageSends: ["millisecondsToRun:"]
  17691. }),
  17692. $globals.BlockClosure);
  17693. $core.addMethod(
  17694. $core.method({
  17695. selector: "tryCatch:",
  17696. protocol: "error handling",
  17697. fn: function (aBlock){
  17698. var self=this,$self=this;
  17699. return $core.withContext(function($ctx1) {
  17700. try {
  17701. return $self._value();
  17702. } catch(error) {
  17703. // pass non-local returns undetected
  17704. if (Array.isArray(error) && error.length === 1) throw error;
  17705. return aBlock._value_(error);
  17706. }
  17707. ;
  17708. return self;
  17709. }, function($ctx1) {$ctx1.fill(self,"tryCatch:",{aBlock:aBlock},$globals.BlockClosure)});
  17710. },
  17711. args: ["aBlock"],
  17712. source: "tryCatch: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09try {\x0a\x09\x09\x09return $self._value();\x0a\x09\x09} catch(error) {\x0a\x09\x09\x09// pass non-local returns undetected\x0a\x09\x09\x09if (Array.isArray(error) && error.length === 1) throw error;\x0a\x09\x09\x09return aBlock._value_(error);\x0a\x09\x09}\x0a\x09'>",
  17713. referencedClasses: [],
  17714. messageSends: []
  17715. }),
  17716. $globals.BlockClosure);
  17717. $core.addMethod(
  17718. $core.method({
  17719. selector: "value",
  17720. protocol: "evaluating",
  17721. fn: function (){
  17722. var self=this,$self=this;
  17723. return $core.withContext(function($ctx1) {
  17724. return self();;
  17725. return self;
  17726. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.BlockClosure)});
  17727. },
  17728. args: [],
  17729. source: "value\x0a\x09<inlineJS: 'return self();'>",
  17730. referencedClasses: [],
  17731. messageSends: []
  17732. }),
  17733. $globals.BlockClosure);
  17734. $core.addMethod(
  17735. $core.method({
  17736. selector: "value:",
  17737. protocol: "evaluating",
  17738. fn: function (anArg){
  17739. var self=this,$self=this;
  17740. return $core.withContext(function($ctx1) {
  17741. return self(anArg);;
  17742. return self;
  17743. }, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg},$globals.BlockClosure)});
  17744. },
  17745. args: ["anArg"],
  17746. source: "value: anArg\x0a\x09<inlineJS: 'return self(anArg);'>",
  17747. referencedClasses: [],
  17748. messageSends: []
  17749. }),
  17750. $globals.BlockClosure);
  17751. $core.addMethod(
  17752. $core.method({
  17753. selector: "value:value:",
  17754. protocol: "evaluating",
  17755. fn: function (firstArg,secondArg){
  17756. var self=this,$self=this;
  17757. return $core.withContext(function($ctx1) {
  17758. return self(firstArg, secondArg);;
  17759. return self;
  17760. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg},$globals.BlockClosure)});
  17761. },
  17762. args: ["firstArg", "secondArg"],
  17763. source: "value: firstArg value: secondArg\x0a\x09<inlineJS: 'return self(firstArg, secondArg);'>",
  17764. referencedClasses: [],
  17765. messageSends: []
  17766. }),
  17767. $globals.BlockClosure);
  17768. $core.addMethod(
  17769. $core.method({
  17770. selector: "value:value:value:",
  17771. protocol: "evaluating",
  17772. fn: function (firstArg,secondArg,thirdArg){
  17773. var self=this,$self=this;
  17774. return $core.withContext(function($ctx1) {
  17775. return self(firstArg, secondArg, thirdArg);;
  17776. return self;
  17777. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg},$globals.BlockClosure)});
  17778. },
  17779. args: ["firstArg", "secondArg", "thirdArg"],
  17780. source: "value: firstArg value: secondArg value: thirdArg\x0a\x09<inlineJS: 'return self(firstArg, secondArg, thirdArg);'>",
  17781. referencedClasses: [],
  17782. messageSends: []
  17783. }),
  17784. $globals.BlockClosure);
  17785. $core.addMethod(
  17786. $core.method({
  17787. selector: "valueWithInterval:",
  17788. protocol: "timeout/interval",
  17789. fn: function (aNumber){
  17790. var self=this,$self=this;
  17791. return $core.withContext(function($ctx1) {
  17792. var interval = setInterval(self, aNumber);
  17793. return $globals.Timeout._on_(interval);
  17794. ;
  17795. return self;
  17796. }, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber},$globals.BlockClosure)});
  17797. },
  17798. args: ["aNumber"],
  17799. source: "valueWithInterval: aNumber\x0a\x09<inlineJS: '\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(interval);\x0a\x09'>",
  17800. referencedClasses: [],
  17801. messageSends: []
  17802. }),
  17803. $globals.BlockClosure);
  17804. $core.addMethod(
  17805. $core.method({
  17806. selector: "valueWithPossibleArguments:",
  17807. protocol: "evaluating",
  17808. fn: function (aCollection){
  17809. var self=this,$self=this;
  17810. return $core.withContext(function($ctx1) {
  17811. return self.apply(null, aCollection);;
  17812. return self;
  17813. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.BlockClosure)});
  17814. },
  17815. args: ["aCollection"],
  17816. source: "valueWithPossibleArguments: aCollection\x0a\x09<inlineJS: 'return self.apply(null, aCollection);'>",
  17817. referencedClasses: [],
  17818. messageSends: []
  17819. }),
  17820. $globals.BlockClosure);
  17821. $core.addMethod(
  17822. $core.method({
  17823. selector: "valueWithTimeout:",
  17824. protocol: "timeout/interval",
  17825. fn: function (aNumber){
  17826. var self=this,$self=this;
  17827. return $core.withContext(function($ctx1) {
  17828. var timeout = setTimeout(self, aNumber);
  17829. return $globals.Timeout._on_(timeout);
  17830. ;
  17831. return self;
  17832. }, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber},$globals.BlockClosure)});
  17833. },
  17834. args: ["aNumber"],
  17835. source: "valueWithTimeout: aNumber\x0a\x09<inlineJS: '\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(timeout);\x0a\x09'>",
  17836. referencedClasses: [],
  17837. messageSends: []
  17838. }),
  17839. $globals.BlockClosure);
  17840. $core.addMethod(
  17841. $core.method({
  17842. selector: "whileFalse",
  17843. protocol: "controlling",
  17844. fn: function (){
  17845. var self=this,$self=this;
  17846. return $core.withContext(function($ctx1) {
  17847. $self._whileFalse_((function(){
  17848. }));
  17849. return self;
  17850. }, function($ctx1) {$ctx1.fill(self,"whileFalse",{},$globals.BlockClosure)});
  17851. },
  17852. args: [],
  17853. source: "whileFalse\x0a\x09self whileFalse: []",
  17854. referencedClasses: [],
  17855. messageSends: ["whileFalse:"]
  17856. }),
  17857. $globals.BlockClosure);
  17858. $core.addMethod(
  17859. $core.method({
  17860. selector: "whileFalse:",
  17861. protocol: "controlling",
  17862. fn: function (aBlock){
  17863. var self=this,$self=this;
  17864. return $core.withContext(function($ctx1) {
  17865. while(!$core.assert($self._value())) {aBlock._value()};
  17866. return self;
  17867. }, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock},$globals.BlockClosure)});
  17868. },
  17869. args: ["aBlock"],
  17870. source: "whileFalse: aBlock\x0a\x09<inlineJS: 'while(!$core.assert($self._value())) {aBlock._value()}'>",
  17871. referencedClasses: [],
  17872. messageSends: []
  17873. }),
  17874. $globals.BlockClosure);
  17875. $core.addMethod(
  17876. $core.method({
  17877. selector: "whileTrue",
  17878. protocol: "controlling",
  17879. fn: function (){
  17880. var self=this,$self=this;
  17881. return $core.withContext(function($ctx1) {
  17882. $self._whileTrue_((function(){
  17883. }));
  17884. return self;
  17885. }, function($ctx1) {$ctx1.fill(self,"whileTrue",{},$globals.BlockClosure)});
  17886. },
  17887. args: [],
  17888. source: "whileTrue\x0a\x09self whileTrue: []",
  17889. referencedClasses: [],
  17890. messageSends: ["whileTrue:"]
  17891. }),
  17892. $globals.BlockClosure);
  17893. $core.addMethod(
  17894. $core.method({
  17895. selector: "whileTrue:",
  17896. protocol: "controlling",
  17897. fn: function (aBlock){
  17898. var self=this,$self=this;
  17899. return $core.withContext(function($ctx1) {
  17900. while($core.assert($self._value())) {aBlock._value()};
  17901. return self;
  17902. }, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock},$globals.BlockClosure)});
  17903. },
  17904. args: ["aBlock"],
  17905. source: "whileTrue: aBlock\x0a\x09<inlineJS: 'while($core.assert($self._value())) {aBlock._value()}'>",
  17906. referencedClasses: [],
  17907. messageSends: []
  17908. }),
  17909. $globals.BlockClosure);
  17910. $core.addClass("CompiledMethod", $globals.Object, [], "Kernel-Methods");
  17911. $globals.CompiledMethod.comment="I represent a class method of the system. I hold the source and compiled code of a class method.\x0a\x0a## API\x0aMy instances can be accessed using `Behavior >> #methodAt:`\x0a\x0a Object methodAt: 'asString'\x0a\x0aSource code access:\x0a\x0a\x09(String methodAt: 'lines') source\x0a\x0aReferenced classes:\x0a\x0a\x09(String methodAt: 'lines') referencedClasses\x0a\x0aMessages sent from an instance:\x0a\x09\x0a\x09(String methodAt: 'lines') messageSends";
  17912. $core.addMethod(
  17913. $core.method({
  17914. selector: "arguments",
  17915. protocol: "accessing",
  17916. fn: function (){
  17917. var self=this,$self=this;
  17918. return $core.withContext(function($ctx1) {
  17919. return self.args || [];
  17920. return self;
  17921. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.CompiledMethod)});
  17922. },
  17923. args: [],
  17924. source: "arguments\x0a\x09<inlineJS: 'return self.args || []'>",
  17925. referencedClasses: [],
  17926. messageSends: []
  17927. }),
  17928. $globals.CompiledMethod);
  17929. $core.addMethod(
  17930. $core.method({
  17931. selector: "browse",
  17932. protocol: "browsing",
  17933. fn: function (){
  17934. var self=this,$self=this;
  17935. return $core.withContext(function($ctx1) {
  17936. $recv($globals.Finder)._findMethod_(self);
  17937. return self;
  17938. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.CompiledMethod)});
  17939. },
  17940. args: [],
  17941. source: "browse\x0a\x09Finder findMethod: self",
  17942. referencedClasses: ["Finder"],
  17943. messageSends: ["findMethod:"]
  17944. }),
  17945. $globals.CompiledMethod);
  17946. $core.addMethod(
  17947. $core.method({
  17948. selector: "category",
  17949. protocol: "accessing",
  17950. fn: function (){
  17951. var self=this,$self=this;
  17952. return $core.withContext(function($ctx1) {
  17953. return $self._protocol();
  17954. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.CompiledMethod)});
  17955. },
  17956. args: [],
  17957. source: "category\x0a\x09^ self protocol",
  17958. referencedClasses: [],
  17959. messageSends: ["protocol"]
  17960. }),
  17961. $globals.CompiledMethod);
  17962. $core.addMethod(
  17963. $core.method({
  17964. selector: "defaultProtocol",
  17965. protocol: "defaults",
  17966. fn: function (){
  17967. var self=this,$self=this;
  17968. return "as yet unclassified";
  17969. },
  17970. args: [],
  17971. source: "defaultProtocol\x0a\x09^ 'as yet unclassified'",
  17972. referencedClasses: [],
  17973. messageSends: []
  17974. }),
  17975. $globals.CompiledMethod);
  17976. $core.addMethod(
  17977. $core.method({
  17978. selector: "fn",
  17979. protocol: "accessing",
  17980. fn: function (){
  17981. var self=this,$self=this;
  17982. return $core.withContext(function($ctx1) {
  17983. return $self._basicAt_("fn");
  17984. }, function($ctx1) {$ctx1.fill(self,"fn",{},$globals.CompiledMethod)});
  17985. },
  17986. args: [],
  17987. source: "fn\x0a\x09^ self basicAt: 'fn'",
  17988. referencedClasses: [],
  17989. messageSends: ["basicAt:"]
  17990. }),
  17991. $globals.CompiledMethod);
  17992. $core.addMethod(
  17993. $core.method({
  17994. selector: "fn:",
  17995. protocol: "accessing",
  17996. fn: function (aBlock){
  17997. var self=this,$self=this;
  17998. return $core.withContext(function($ctx1) {
  17999. $self._basicAt_put_("fn",aBlock);
  18000. return self;
  18001. }, function($ctx1) {$ctx1.fill(self,"fn:",{aBlock:aBlock},$globals.CompiledMethod)});
  18002. },
  18003. args: ["aBlock"],
  18004. source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock",
  18005. referencedClasses: [],
  18006. messageSends: ["basicAt:put:"]
  18007. }),
  18008. $globals.CompiledMethod);
  18009. $core.addMethod(
  18010. $core.method({
  18011. selector: "isCompiledMethod",
  18012. protocol: "testing",
  18013. fn: function (){
  18014. var self=this,$self=this;
  18015. return true;
  18016. },
  18017. args: [],
  18018. source: "isCompiledMethod\x0a\x09^ true",
  18019. referencedClasses: [],
  18020. messageSends: []
  18021. }),
  18022. $globals.CompiledMethod);
  18023. $core.addMethod(
  18024. $core.method({
  18025. selector: "isOverridden",
  18026. protocol: "testing",
  18027. fn: function (){
  18028. var self=this,$self=this;
  18029. var selector;
  18030. return $core.withContext(function($ctx1) {
  18031. var $1;
  18032. var $early={};
  18033. try {
  18034. selector=$self._selector();
  18035. $recv($self._methodClass())._allSubclassesDo_((function(each){
  18036. return $core.withContext(function($ctx2) {
  18037. $1=$recv(each)._includesSelector_(selector);
  18038. if($core.assert($1)){
  18039. throw $early=[true];
  18040. }
  18041. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18042. }));
  18043. return false;
  18044. }
  18045. catch(e) {if(e===$early)return e[0]; throw e}
  18046. }, function($ctx1) {$ctx1.fill(self,"isOverridden",{selector:selector},$globals.CompiledMethod)});
  18047. },
  18048. args: [],
  18049. source: "isOverridden\x0a\x09| selector |\x0a \x0a selector := self selector.\x0a self methodClass allSubclassesDo: [ :each |\x0a\x09 (each includesSelector: selector)\x0a \x09ifTrue: [ ^ true ] ].\x0a\x09^ false",
  18050. referencedClasses: [],
  18051. messageSends: ["selector", "allSubclassesDo:", "methodClass", "ifTrue:", "includesSelector:"]
  18052. }),
  18053. $globals.CompiledMethod);
  18054. $core.addMethod(
  18055. $core.method({
  18056. selector: "isOverride",
  18057. protocol: "testing",
  18058. fn: function (){
  18059. var self=this,$self=this;
  18060. var superclass;
  18061. return $core.withContext(function($ctx1) {
  18062. var $1,$2,$receiver;
  18063. $1=$self._methodClass();
  18064. $ctx1.sendIdx["methodClass"]=1;
  18065. superclass=$recv($1)._superclass();
  18066. $ctx1.sendIdx["superclass"]=1;
  18067. $2=superclass;
  18068. if(($receiver = $2) == null || $receiver.a$nil){
  18069. return false;
  18070. } else {
  18071. $2;
  18072. }
  18073. return $recv($recv($recv($self._methodClass())._superclass())._lookupSelector_($self._selector()))._notNil();
  18074. }, function($ctx1) {$ctx1.fill(self,"isOverride",{superclass:superclass},$globals.CompiledMethod)});
  18075. },
  18076. args: [],
  18077. source: "isOverride\x0a\x09| superclass |\x0a \x0a superclass := self methodClass superclass.\x0a\x09superclass ifNil: [ ^ false ].\x0a\x09\x0a ^ (self methodClass superclass lookupSelector: self selector) notNil",
  18078. referencedClasses: [],
  18079. messageSends: ["superclass", "methodClass", "ifNil:", "notNil", "lookupSelector:", "selector"]
  18080. }),
  18081. $globals.CompiledMethod);
  18082. $core.addMethod(
  18083. $core.method({
  18084. selector: "messageSends",
  18085. protocol: "accessing",
  18086. fn: function (){
  18087. var self=this,$self=this;
  18088. return $core.withContext(function($ctx1) {
  18089. return $self._basicAt_("messageSends");
  18090. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.CompiledMethod)});
  18091. },
  18092. args: [],
  18093. source: "messageSends\x0a\x09^ self basicAt: 'messageSends'",
  18094. referencedClasses: [],
  18095. messageSends: ["basicAt:"]
  18096. }),
  18097. $globals.CompiledMethod);
  18098. $core.addMethod(
  18099. $core.method({
  18100. selector: "methodClass",
  18101. protocol: "accessing",
  18102. fn: function (){
  18103. var self=this,$self=this;
  18104. return $core.withContext(function($ctx1) {
  18105. return $self._basicAt_("owner");
  18106. }, function($ctx1) {$ctx1.fill(self,"methodClass",{},$globals.CompiledMethod)});
  18107. },
  18108. args: [],
  18109. source: "methodClass\x0a\x09^ self basicAt: 'owner'",
  18110. referencedClasses: [],
  18111. messageSends: ["basicAt:"]
  18112. }),
  18113. $globals.CompiledMethod);
  18114. $core.addMethod(
  18115. $core.method({
  18116. selector: "package",
  18117. protocol: "accessing",
  18118. fn: function (){
  18119. var self=this,$self=this;
  18120. return $core.withContext(function($ctx1) {
  18121. var $1,$receiver;
  18122. $1=$self._methodClass();
  18123. if(($receiver = $1) == null || $receiver.a$nil){
  18124. return $1;
  18125. } else {
  18126. var class_;
  18127. class_=$receiver;
  18128. return $recv(class_)._packageOfProtocol_($self._protocol());
  18129. }
  18130. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.CompiledMethod)});
  18131. },
  18132. args: [],
  18133. source: "package\x0a\x09\x22Answer the package the receiver belongs to:\x0a\x09- if it is an extension method, answer the corresponding package\x0a\x09- else answer the `methodClass` package\x22\x0a\x09\x0a\x09^ self methodClass ifNotNil: [ :class | class packageOfProtocol: self protocol ]",
  18134. referencedClasses: [],
  18135. messageSends: ["ifNotNil:", "methodClass", "packageOfProtocol:", "protocol"]
  18136. }),
  18137. $globals.CompiledMethod);
  18138. $core.addMethod(
  18139. $core.method({
  18140. selector: "protocol",
  18141. protocol: "accessing",
  18142. fn: function (){
  18143. var self=this,$self=this;
  18144. return $core.withContext(function($ctx1) {
  18145. var $1,$receiver;
  18146. $1=$self._basicAt_("protocol");
  18147. if(($receiver = $1) == null || $receiver.a$nil){
  18148. return $self._defaultProtocol();
  18149. } else {
  18150. return $1;
  18151. }
  18152. }, function($ctx1) {$ctx1.fill(self,"protocol",{},$globals.CompiledMethod)});
  18153. },
  18154. args: [],
  18155. source: "protocol\x0a\x09^ (self basicAt: 'protocol') ifNil: [ self defaultProtocol ]",
  18156. referencedClasses: [],
  18157. messageSends: ["ifNil:", "basicAt:", "defaultProtocol"]
  18158. }),
  18159. $globals.CompiledMethod);
  18160. $core.addMethod(
  18161. $core.method({
  18162. selector: "protocol:",
  18163. protocol: "accessing",
  18164. fn: function (aString){
  18165. var self=this,$self=this;
  18166. var oldProtocol;
  18167. return $core.withContext(function($ctx1) {
  18168. var $1,$3,$2,$4,$receiver;
  18169. oldProtocol=$self._protocol();
  18170. $self._basicAt_put_("protocol",aString);
  18171. $1=$recv($globals.SystemAnnouncer)._current();
  18172. $3=$recv($globals.MethodMoved)._new();
  18173. $recv($3)._method_(self);
  18174. $recv($3)._oldProtocol_(oldProtocol);
  18175. $2=$recv($3)._yourself();
  18176. $recv($1)._announce_($2);
  18177. $4=$self._methodClass();
  18178. if(($receiver = $4) == null || $receiver.a$nil){
  18179. $4;
  18180. } else {
  18181. var methodClass;
  18182. methodClass=$receiver;
  18183. $recv($recv(methodClass)._organization())._addElement_(aString);
  18184. $recv(methodClass)._removeProtocolIfEmpty_(oldProtocol);
  18185. }
  18186. return self;
  18187. }, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString,oldProtocol:oldProtocol},$globals.CompiledMethod)});
  18188. },
  18189. args: ["aString"],
  18190. source: "protocol: aString\x0a\x09| oldProtocol |\x0a\x09oldProtocol := self protocol.\x0a\x09self basicAt: 'protocol' put: aString.\x0a\x0a\x09SystemAnnouncer current announce: (MethodMoved new\x0a\x09\x09method: self;\x0a\x09\x09oldProtocol: oldProtocol;\x0a\x09\x09yourself).\x0a\x0a\x09self methodClass ifNotNil: [ :methodClass |\x0a\x09\x09methodClass organization addElement: aString.\x0a\x09\x09methodClass removeProtocolIfEmpty: oldProtocol ]",
  18191. referencedClasses: ["SystemAnnouncer", "MethodMoved"],
  18192. messageSends: ["protocol", "basicAt:put:", "announce:", "current", "method:", "new", "oldProtocol:", "yourself", "ifNotNil:", "methodClass", "addElement:", "organization", "removeProtocolIfEmpty:"]
  18193. }),
  18194. $globals.CompiledMethod);
  18195. $core.addMethod(
  18196. $core.method({
  18197. selector: "referencedClasses",
  18198. protocol: "accessing",
  18199. fn: function (){
  18200. var self=this,$self=this;
  18201. return $core.withContext(function($ctx1) {
  18202. return $self._basicAt_("referencedClasses");
  18203. }, function($ctx1) {$ctx1.fill(self,"referencedClasses",{},$globals.CompiledMethod)});
  18204. },
  18205. args: [],
  18206. source: "referencedClasses\x0a\x09^ self basicAt: 'referencedClasses'",
  18207. referencedClasses: [],
  18208. messageSends: ["basicAt:"]
  18209. }),
  18210. $globals.CompiledMethod);
  18211. $core.addMethod(
  18212. $core.method({
  18213. selector: "selector",
  18214. protocol: "accessing",
  18215. fn: function (){
  18216. var self=this,$self=this;
  18217. return $core.withContext(function($ctx1) {
  18218. return $self._basicAt_("selector");
  18219. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.CompiledMethod)});
  18220. },
  18221. args: [],
  18222. source: "selector\x0a\x09^ self basicAt: 'selector'",
  18223. referencedClasses: [],
  18224. messageSends: ["basicAt:"]
  18225. }),
  18226. $globals.CompiledMethod);
  18227. $core.addMethod(
  18228. $core.method({
  18229. selector: "selector:",
  18230. protocol: "accessing",
  18231. fn: function (aString){
  18232. var self=this,$self=this;
  18233. return $core.withContext(function($ctx1) {
  18234. $self._basicAt_put_("selector",aString);
  18235. return self;
  18236. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.CompiledMethod)});
  18237. },
  18238. args: ["aString"],
  18239. source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString",
  18240. referencedClasses: [],
  18241. messageSends: ["basicAt:put:"]
  18242. }),
  18243. $globals.CompiledMethod);
  18244. $core.addMethod(
  18245. $core.method({
  18246. selector: "sendTo:arguments:",
  18247. protocol: "evaluating",
  18248. fn: function (anObject,aCollection){
  18249. var self=this,$self=this;
  18250. return $core.withContext(function($ctx1) {
  18251. return $recv($self._fn())._applyTo_arguments_(anObject,aCollection);
  18252. }, function($ctx1) {$ctx1.fill(self,"sendTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.CompiledMethod)});
  18253. },
  18254. args: ["anObject", "aCollection"],
  18255. source: "sendTo: anObject arguments: aCollection\x0a\x09^ self fn applyTo: anObject arguments: aCollection",
  18256. referencedClasses: [],
  18257. messageSends: ["applyTo:arguments:", "fn"]
  18258. }),
  18259. $globals.CompiledMethod);
  18260. $core.addMethod(
  18261. $core.method({
  18262. selector: "source",
  18263. protocol: "accessing",
  18264. fn: function (){
  18265. var self=this,$self=this;
  18266. return $core.withContext(function($ctx1) {
  18267. var $1,$receiver;
  18268. $1=$self._basicAt_("source");
  18269. if(($receiver = $1) == null || $receiver.a$nil){
  18270. return "";
  18271. } else {
  18272. return $1;
  18273. }
  18274. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.CompiledMethod)});
  18275. },
  18276. args: [],
  18277. source: "source\x0a\x09^ (self basicAt: 'source') ifNil: [ '' ]",
  18278. referencedClasses: [],
  18279. messageSends: ["ifNil:", "basicAt:"]
  18280. }),
  18281. $globals.CompiledMethod);
  18282. $core.addMethod(
  18283. $core.method({
  18284. selector: "source:",
  18285. protocol: "accessing",
  18286. fn: function (aString){
  18287. var self=this,$self=this;
  18288. return $core.withContext(function($ctx1) {
  18289. $self._basicAt_put_("source",aString);
  18290. return self;
  18291. }, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},$globals.CompiledMethod)});
  18292. },
  18293. args: ["aString"],
  18294. source: "source: aString\x0a\x09self basicAt: 'source' put: aString",
  18295. referencedClasses: [],
  18296. messageSends: ["basicAt:put:"]
  18297. }),
  18298. $globals.CompiledMethod);
  18299. $core.addClass("ForkPool", $globals.Object, ["poolSize", "maxPoolSize", "queue", "worker"], "Kernel-Methods");
  18300. $globals.ForkPool.comment="I am responsible for handling forked blocks.\x0aThe pool size sets the maximum concurrent forked blocks.\x0a\x0a## API\x0a\x0aThe default instance is accessed with `#default`.\x0aThe maximum concurrent forked blocks can be set with `#maxPoolSize:`.\x0a\x0aForking is done via `BlockClosure >> #fork`";
  18301. $core.addMethod(
  18302. $core.method({
  18303. selector: "addWorker",
  18304. protocol: "private",
  18305. fn: function (){
  18306. var self=this,$self=this;
  18307. return $core.withContext(function($ctx1) {
  18308. $recv($self["@worker"])._valueWithTimeout_((0));
  18309. $self["@poolSize"]=$recv($self["@poolSize"]).__plus((1));
  18310. return self;
  18311. }, function($ctx1) {$ctx1.fill(self,"addWorker",{},$globals.ForkPool)});
  18312. },
  18313. args: [],
  18314. source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a\x09poolSize := poolSize + 1",
  18315. referencedClasses: [],
  18316. messageSends: ["valueWithTimeout:", "+"]
  18317. }),
  18318. $globals.ForkPool);
  18319. $core.addMethod(
  18320. $core.method({
  18321. selector: "defaultMaxPoolSize",
  18322. protocol: "defaults",
  18323. fn: function (){
  18324. var self=this,$self=this;
  18325. return $core.withContext(function($ctx1) {
  18326. return $recv($self._class())._defaultMaxPoolSize();
  18327. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},$globals.ForkPool)});
  18328. },
  18329. args: [],
  18330. source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize",
  18331. referencedClasses: [],
  18332. messageSends: ["defaultMaxPoolSize", "class"]
  18333. }),
  18334. $globals.ForkPool);
  18335. $core.addMethod(
  18336. $core.method({
  18337. selector: "fork:",
  18338. protocol: "actions",
  18339. fn: function (aBlock){
  18340. var self=this,$self=this;
  18341. return $core.withContext(function($ctx1) {
  18342. var $1;
  18343. $1=$recv($self["@poolSize"]).__lt($self._maxPoolSize());
  18344. if($core.assert($1)){
  18345. $self._addWorker();
  18346. }
  18347. $recv($self["@queue"])._nextPut_(aBlock);
  18348. return self;
  18349. }, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock},$globals.ForkPool)});
  18350. },
  18351. args: ["aBlock"],
  18352. source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue nextPut: aBlock",
  18353. referencedClasses: [],
  18354. messageSends: ["ifTrue:", "<", "maxPoolSize", "addWorker", "nextPut:"]
  18355. }),
  18356. $globals.ForkPool);
  18357. $core.addMethod(
  18358. $core.method({
  18359. selector: "initialize",
  18360. protocol: "initialization",
  18361. fn: function (){
  18362. var self=this,$self=this;
  18363. return $core.withContext(function($ctx1) {
  18364. (
  18365. $ctx1.supercall = true,
  18366. ($globals.ForkPool.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  18367. $ctx1.supercall = false;
  18368. $self["@poolSize"]=(0);
  18369. $self["@queue"]=$recv($globals.Queue)._new();
  18370. $self["@worker"]=$self._makeWorker();
  18371. return self;
  18372. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ForkPool)});
  18373. },
  18374. args: [],
  18375. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09poolSize := 0.\x0a\x09queue := Queue new.\x0a\x09worker := self makeWorker",
  18376. referencedClasses: ["Queue"],
  18377. messageSends: ["initialize", "new", "makeWorker"]
  18378. }),
  18379. $globals.ForkPool);
  18380. $core.addMethod(
  18381. $core.method({
  18382. selector: "makeWorker",
  18383. protocol: "initialization",
  18384. fn: function (){
  18385. var self=this,$self=this;
  18386. var sentinel;
  18387. return $core.withContext(function($ctx1) {
  18388. var $1;
  18389. sentinel=$recv($globals.Object)._new();
  18390. return (function(){
  18391. var block;
  18392. return $core.withContext(function($ctx2) {
  18393. $self["@poolSize"]=$recv($self["@poolSize"]).__minus((1));
  18394. block=$recv($self["@queue"])._nextIfAbsent_((function(){
  18395. return sentinel;
  18396. }));
  18397. $1=$recv(block).__eq_eq(sentinel);
  18398. if(!$core.assert($1)){
  18399. return $recv((function(){
  18400. return $core.withContext(function($ctx3) {
  18401. return $recv(block)._value();
  18402. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  18403. }))._ensure_((function(){
  18404. return $core.withContext(function($ctx3) {
  18405. return $self._addWorker();
  18406. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  18407. }));
  18408. }
  18409. }, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1,1)});
  18410. });
  18411. }, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel},$globals.ForkPool)});
  18412. },
  18413. args: [],
  18414. source: "makeWorker\x0a\x09| sentinel |\x0a\x09sentinel := Object new.\x0a\x09^ [ | block |\x0a\x09\x09poolSize := poolSize - 1.\x0a\x09\x09block := queue nextIfAbsent: [ sentinel ].\x0a\x09\x09block == sentinel ifFalse: [\x0a\x09\x09\x09[ block value ] ensure: [ self addWorker ] ]]",
  18415. referencedClasses: ["Object"],
  18416. messageSends: ["new", "-", "nextIfAbsent:", "ifFalse:", "==", "ensure:", "value", "addWorker"]
  18417. }),
  18418. $globals.ForkPool);
  18419. $core.addMethod(
  18420. $core.method({
  18421. selector: "maxPoolSize",
  18422. protocol: "accessing",
  18423. fn: function (){
  18424. var self=this,$self=this;
  18425. return $core.withContext(function($ctx1) {
  18426. var $1,$receiver;
  18427. $1=$self["@maxPoolSize"];
  18428. if(($receiver = $1) == null || $receiver.a$nil){
  18429. return $self._defaultMaxPoolSize();
  18430. } else {
  18431. return $1;
  18432. }
  18433. }, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{},$globals.ForkPool)});
  18434. },
  18435. args: [],
  18436. source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]",
  18437. referencedClasses: [],
  18438. messageSends: ["ifNil:", "defaultMaxPoolSize"]
  18439. }),
  18440. $globals.ForkPool);
  18441. $core.addMethod(
  18442. $core.method({
  18443. selector: "maxPoolSize:",
  18444. protocol: "accessing",
  18445. fn: function (anInteger){
  18446. var self=this,$self=this;
  18447. $self["@maxPoolSize"]=anInteger;
  18448. return self;
  18449. },
  18450. args: ["anInteger"],
  18451. source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger",
  18452. referencedClasses: [],
  18453. messageSends: []
  18454. }),
  18455. $globals.ForkPool);
  18456. $globals.ForkPool.a$cls.iVarNames = ["default"];
  18457. $core.addMethod(
  18458. $core.method({
  18459. selector: "default",
  18460. protocol: "accessing",
  18461. fn: function (){
  18462. var self=this,$self=this;
  18463. return $core.withContext(function($ctx1) {
  18464. var $1,$receiver;
  18465. $1=$self["@default"];
  18466. if(($receiver = $1) == null || $receiver.a$nil){
  18467. $self["@default"]=$self._new();
  18468. return $self["@default"];
  18469. } else {
  18470. return $1;
  18471. }
  18472. }, function($ctx1) {$ctx1.fill(self,"default",{},$globals.ForkPool.a$cls)});
  18473. },
  18474. args: [],
  18475. source: "default\x0a\x09^ default ifNil: [ default := self new ]",
  18476. referencedClasses: [],
  18477. messageSends: ["ifNil:", "new"]
  18478. }),
  18479. $globals.ForkPool.a$cls);
  18480. $core.addMethod(
  18481. $core.method({
  18482. selector: "defaultMaxPoolSize",
  18483. protocol: "accessing",
  18484. fn: function (){
  18485. var self=this,$self=this;
  18486. return (100);
  18487. },
  18488. args: [],
  18489. source: "defaultMaxPoolSize\x0a\x09^ 100",
  18490. referencedClasses: [],
  18491. messageSends: []
  18492. }),
  18493. $globals.ForkPool.a$cls);
  18494. $core.addMethod(
  18495. $core.method({
  18496. selector: "resetDefault",
  18497. protocol: "accessing",
  18498. fn: function (){
  18499. var self=this,$self=this;
  18500. $self["@default"]=nil;
  18501. return self;
  18502. },
  18503. args: [],
  18504. source: "resetDefault\x0a\x09default := nil",
  18505. referencedClasses: [],
  18506. messageSends: []
  18507. }),
  18508. $globals.ForkPool.a$cls);
  18509. $core.addClass("Message", $globals.Object, ["selector", "arguments"], "Kernel-Methods");
  18510. $globals.Message.comment="In general, the system does not use instances of me for efficiency reasons.\x0aHowever, when a message is not understood by its receiver, the interpreter will make up an instance of it in order to capture the information involved in an actual message transmission.\x0aThis instance is sent it as an argument with the message `#doesNotUnderstand:` to the receiver.\x0a\x0aSee boot.js, `messageNotUnderstood` and its counterpart `Object >> #doesNotUnderstand:`\x0a\x0a## API\x0a\x0aBesides accessing methods, `#sendTo:` provides a convenient way to send a message to an object.";
  18511. $core.addMethod(
  18512. $core.method({
  18513. selector: "arguments",
  18514. protocol: "accessing",
  18515. fn: function (){
  18516. var self=this,$self=this;
  18517. return $self["@arguments"];
  18518. },
  18519. args: [],
  18520. source: "arguments\x0a\x09^ arguments",
  18521. referencedClasses: [],
  18522. messageSends: []
  18523. }),
  18524. $globals.Message);
  18525. $core.addMethod(
  18526. $core.method({
  18527. selector: "arguments:",
  18528. protocol: "accessing",
  18529. fn: function (anArray){
  18530. var self=this,$self=this;
  18531. $self["@arguments"]=anArray;
  18532. return self;
  18533. },
  18534. args: ["anArray"],
  18535. source: "arguments: anArray\x0a\x09arguments := anArray",
  18536. referencedClasses: [],
  18537. messageSends: []
  18538. }),
  18539. $globals.Message);
  18540. $core.addMethod(
  18541. $core.method({
  18542. selector: "printOn:",
  18543. protocol: "printing",
  18544. fn: function (aStream){
  18545. var self=this,$self=this;
  18546. return $core.withContext(function($ctx1) {
  18547. (
  18548. $ctx1.supercall = true,
  18549. ($globals.Message.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  18550. $ctx1.supercall = false;
  18551. $recv(aStream)._nextPutAll_("(");
  18552. $ctx1.sendIdx["nextPutAll:"]=1;
  18553. $recv(aStream)._nextPutAll_($self._selector());
  18554. $ctx1.sendIdx["nextPutAll:"]=2;
  18555. $recv(aStream)._nextPutAll_(")");
  18556. return self;
  18557. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Message)});
  18558. },
  18559. args: ["aStream"],
  18560. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
  18561. referencedClasses: [],
  18562. messageSends: ["printOn:", "nextPutAll:", "selector"]
  18563. }),
  18564. $globals.Message);
  18565. $core.addMethod(
  18566. $core.method({
  18567. selector: "selector",
  18568. protocol: "accessing",
  18569. fn: function (){
  18570. var self=this,$self=this;
  18571. return $self["@selector"];
  18572. },
  18573. args: [],
  18574. source: "selector\x0a\x09^ selector",
  18575. referencedClasses: [],
  18576. messageSends: []
  18577. }),
  18578. $globals.Message);
  18579. $core.addMethod(
  18580. $core.method({
  18581. selector: "selector:",
  18582. protocol: "accessing",
  18583. fn: function (aString){
  18584. var self=this,$self=this;
  18585. $self["@selector"]=aString;
  18586. return self;
  18587. },
  18588. args: ["aString"],
  18589. source: "selector: aString\x0a\x09selector := aString",
  18590. referencedClasses: [],
  18591. messageSends: []
  18592. }),
  18593. $globals.Message);
  18594. $core.addMethod(
  18595. $core.method({
  18596. selector: "sendTo:",
  18597. protocol: "actions",
  18598. fn: function (anObject){
  18599. var self=this,$self=this;
  18600. return $core.withContext(function($ctx1) {
  18601. return $recv(anObject)._perform_withArguments_($self._selector(),$self._arguments());
  18602. }, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject},$globals.Message)});
  18603. },
  18604. args: ["anObject"],
  18605. source: "sendTo: anObject\x0a\x09^ anObject perform: self selector withArguments: self arguments",
  18606. referencedClasses: [],
  18607. messageSends: ["perform:withArguments:", "selector", "arguments"]
  18608. }),
  18609. $globals.Message);
  18610. $core.addMethod(
  18611. $core.method({
  18612. selector: "selector:arguments:",
  18613. protocol: "instance creation",
  18614. fn: function (aString,anArray){
  18615. var self=this,$self=this;
  18616. return $core.withContext(function($ctx1) {
  18617. var $1;
  18618. $1=$self._new();
  18619. $recv($1)._selector_(aString);
  18620. $recv($1)._arguments_(anArray);
  18621. return $recv($1)._yourself();
  18622. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray},$globals.Message.a$cls)});
  18623. },
  18624. args: ["aString", "anArray"],
  18625. source: "selector: aString arguments: anArray\x0a\x09^ self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
  18626. referencedClasses: [],
  18627. messageSends: ["selector:", "new", "arguments:", "yourself"]
  18628. }),
  18629. $globals.Message.a$cls);
  18630. $core.addMethod(
  18631. $core.method({
  18632. selector: "selector:arguments:notUnderstoodBy:",
  18633. protocol: "dnu handling",
  18634. fn: function (aString,anArray,anObject){
  18635. var self=this,$self=this;
  18636. return $core.withContext(function($ctx1) {
  18637. return $recv(anObject)._doesNotUnderstand_($self._selector_arguments_(aString,anArray));
  18638. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:notUnderstoodBy:",{aString:aString,anArray:anArray,anObject:anObject},$globals.Message.a$cls)});
  18639. },
  18640. args: ["aString", "anArray", "anObject"],
  18641. source: "selector: aString arguments: anArray notUnderstoodBy: anObject\x0a\x09\x22Creates the message and passes it to #doesNotUnderstand:.\x0a\x09Used by kernel to handle MNU.\x22\x0a\x09^ anObject doesNotUnderstand:\x0a\x09\x09(self selector: aString arguments: anArray)",
  18642. referencedClasses: [],
  18643. messageSends: ["doesNotUnderstand:", "selector:arguments:"]
  18644. }),
  18645. $globals.Message.a$cls);
  18646. $core.addClass("MessageSend", $globals.Object, ["receiver", "message"], "Kernel-Methods");
  18647. $globals.MessageSend.comment="I encapsulate message sends to objects. Arguments can be either predefined or supplied when the message send is performed. \x0a\x0a## API\x0a\x0aUse `#value` to perform a message send with its predefined arguments and `#value:*` if additonal arguments have to supplied.";
  18648. $core.addMethod(
  18649. $core.method({
  18650. selector: "arguments",
  18651. protocol: "accessing",
  18652. fn: function (){
  18653. var self=this,$self=this;
  18654. return $core.withContext(function($ctx1) {
  18655. return $recv($self["@message"])._arguments();
  18656. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MessageSend)});
  18657. },
  18658. args: [],
  18659. source: "arguments\x0a\x09^ message arguments",
  18660. referencedClasses: [],
  18661. messageSends: ["arguments"]
  18662. }),
  18663. $globals.MessageSend);
  18664. $core.addMethod(
  18665. $core.method({
  18666. selector: "arguments:",
  18667. protocol: "accessing",
  18668. fn: function (aCollection){
  18669. var self=this,$self=this;
  18670. return $core.withContext(function($ctx1) {
  18671. $recv($self["@message"])._arguments_(aCollection);
  18672. return self;
  18673. }, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},$globals.MessageSend)});
  18674. },
  18675. args: ["aCollection"],
  18676. source: "arguments: aCollection\x0a\x09message arguments: aCollection",
  18677. referencedClasses: [],
  18678. messageSends: ["arguments:"]
  18679. }),
  18680. $globals.MessageSend);
  18681. $core.addMethod(
  18682. $core.method({
  18683. selector: "initialize",
  18684. protocol: "initialization",
  18685. fn: function (){
  18686. var self=this,$self=this;
  18687. return $core.withContext(function($ctx1) {
  18688. (
  18689. $ctx1.supercall = true,
  18690. ($globals.MessageSend.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  18691. $ctx1.supercall = false;
  18692. $self["@message"]=$recv($globals.Message)._new();
  18693. return self;
  18694. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.MessageSend)});
  18695. },
  18696. args: [],
  18697. source: "initialize\x0a\x09super initialize.\x0a\x09message := Message new",
  18698. referencedClasses: ["Message"],
  18699. messageSends: ["initialize", "new"]
  18700. }),
  18701. $globals.MessageSend);
  18702. $core.addMethod(
  18703. $core.method({
  18704. selector: "printOn:",
  18705. protocol: "printing",
  18706. fn: function (aStream){
  18707. var self=this,$self=this;
  18708. return $core.withContext(function($ctx1) {
  18709. (
  18710. $ctx1.supercall = true,
  18711. ($globals.MessageSend.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  18712. $ctx1.supercall = false;
  18713. $recv(aStream)._nextPutAll_("(");
  18714. $ctx1.sendIdx["nextPutAll:"]=1;
  18715. $recv(aStream)._nextPutAll_($self._receiver());
  18716. $ctx1.sendIdx["nextPutAll:"]=2;
  18717. $recv(aStream)._nextPutAll_(" >> ");
  18718. $ctx1.sendIdx["nextPutAll:"]=3;
  18719. $recv(aStream)._nextPutAll_($self._selector());
  18720. $ctx1.sendIdx["nextPutAll:"]=4;
  18721. $recv(aStream)._nextPutAll_(")");
  18722. return self;
  18723. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MessageSend)});
  18724. },
  18725. args: ["aStream"],
  18726. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self receiver;\x0a\x09\x09nextPutAll: ' >> ';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
  18727. referencedClasses: [],
  18728. messageSends: ["printOn:", "nextPutAll:", "receiver", "selector"]
  18729. }),
  18730. $globals.MessageSend);
  18731. $core.addMethod(
  18732. $core.method({
  18733. selector: "receiver",
  18734. protocol: "accessing",
  18735. fn: function (){
  18736. var self=this,$self=this;
  18737. return $self["@receiver"];
  18738. },
  18739. args: [],
  18740. source: "receiver\x0a\x09^ receiver",
  18741. referencedClasses: [],
  18742. messageSends: []
  18743. }),
  18744. $globals.MessageSend);
  18745. $core.addMethod(
  18746. $core.method({
  18747. selector: "receiver:",
  18748. protocol: "accessing",
  18749. fn: function (anObject){
  18750. var self=this,$self=this;
  18751. $self["@receiver"]=anObject;
  18752. return self;
  18753. },
  18754. args: ["anObject"],
  18755. source: "receiver: anObject\x0a\x09receiver := anObject",
  18756. referencedClasses: [],
  18757. messageSends: []
  18758. }),
  18759. $globals.MessageSend);
  18760. $core.addMethod(
  18761. $core.method({
  18762. selector: "selector",
  18763. protocol: "accessing",
  18764. fn: function (){
  18765. var self=this,$self=this;
  18766. return $core.withContext(function($ctx1) {
  18767. return $recv($self["@message"])._selector();
  18768. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MessageSend)});
  18769. },
  18770. args: [],
  18771. source: "selector\x0a\x09^ message selector",
  18772. referencedClasses: [],
  18773. messageSends: ["selector"]
  18774. }),
  18775. $globals.MessageSend);
  18776. $core.addMethod(
  18777. $core.method({
  18778. selector: "selector:",
  18779. protocol: "accessing",
  18780. fn: function (aString){
  18781. var self=this,$self=this;
  18782. return $core.withContext(function($ctx1) {
  18783. $recv($self["@message"])._selector_(aString);
  18784. return self;
  18785. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.MessageSend)});
  18786. },
  18787. args: ["aString"],
  18788. source: "selector: aString\x0a\x09message selector: aString",
  18789. referencedClasses: [],
  18790. messageSends: ["selector:"]
  18791. }),
  18792. $globals.MessageSend);
  18793. $core.addMethod(
  18794. $core.method({
  18795. selector: "value",
  18796. protocol: "evaluating",
  18797. fn: function (){
  18798. var self=this,$self=this;
  18799. return $core.withContext(function($ctx1) {
  18800. return $recv($self["@message"])._sendTo_($self._receiver());
  18801. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.MessageSend)});
  18802. },
  18803. args: [],
  18804. source: "value\x0a\x09^ message sendTo: self receiver",
  18805. referencedClasses: [],
  18806. messageSends: ["sendTo:", "receiver"]
  18807. }),
  18808. $globals.MessageSend);
  18809. $core.addMethod(
  18810. $core.method({
  18811. selector: "value:",
  18812. protocol: "evaluating",
  18813. fn: function (anObject){
  18814. var self=this,$self=this;
  18815. return $core.withContext(function($ctx1) {
  18816. var $1;
  18817. $1=$self["@message"];
  18818. $recv($1)._arguments_([anObject]);
  18819. return $recv($1)._sendTo_($self._receiver());
  18820. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.MessageSend)});
  18821. },
  18822. args: ["anObject"],
  18823. source: "value: anObject\x0a\x09^ message \x0a\x09\x09arguments: { anObject };\x0a\x09\x09sendTo: self receiver",
  18824. referencedClasses: [],
  18825. messageSends: ["arguments:", "sendTo:", "receiver"]
  18826. }),
  18827. $globals.MessageSend);
  18828. $core.addMethod(
  18829. $core.method({
  18830. selector: "value:value:",
  18831. protocol: "evaluating",
  18832. fn: function (firstArgument,secondArgument){
  18833. var self=this,$self=this;
  18834. return $core.withContext(function($ctx1) {
  18835. var $1;
  18836. $1=$self["@message"];
  18837. $recv($1)._arguments_([firstArgument,secondArgument]);
  18838. return $recv($1)._sendTo_($self._receiver());
  18839. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.MessageSend)});
  18840. },
  18841. args: ["firstArgument", "secondArgument"],
  18842. source: "value: firstArgument value: secondArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument };\x0a\x09\x09sendTo: self receiver",
  18843. referencedClasses: [],
  18844. messageSends: ["arguments:", "sendTo:", "receiver"]
  18845. }),
  18846. $globals.MessageSend);
  18847. $core.addMethod(
  18848. $core.method({
  18849. selector: "value:value:value:",
  18850. protocol: "evaluating",
  18851. fn: function (firstArgument,secondArgument,thirdArgument){
  18852. var self=this,$self=this;
  18853. return $core.withContext(function($ctx1) {
  18854. var $1;
  18855. $1=$self["@message"];
  18856. $recv($1)._arguments_([firstArgument,secondArgument,thirdArgument]);
  18857. return $recv($1)._sendTo_($self._receiver());
  18858. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.MessageSend)});
  18859. },
  18860. args: ["firstArgument", "secondArgument", "thirdArgument"],
  18861. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument. thirdArgument };\x0a\x09\x09sendTo: self receiver",
  18862. referencedClasses: [],
  18863. messageSends: ["arguments:", "sendTo:", "receiver"]
  18864. }),
  18865. $globals.MessageSend);
  18866. $core.addMethod(
  18867. $core.method({
  18868. selector: "valueWithPossibleArguments:",
  18869. protocol: "evaluating",
  18870. fn: function (aCollection){
  18871. var self=this,$self=this;
  18872. return $core.withContext(function($ctx1) {
  18873. $self._arguments_(aCollection);
  18874. return $self._value();
  18875. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.MessageSend)});
  18876. },
  18877. args: ["aCollection"],
  18878. source: "valueWithPossibleArguments: aCollection\x0a\x09self arguments: aCollection.\x0a\x09^ self value",
  18879. referencedClasses: [],
  18880. messageSends: ["arguments:", "value"]
  18881. }),
  18882. $globals.MessageSend);
  18883. $core.addClass("MethodContext", $globals.Object, [], "Kernel-Methods");
  18884. $globals.MethodContext.comment="I hold all the dynamic state associated with the execution of either a method activation resulting from a message send. I am used to build the call stack while debugging.\x0a\x0aMy instances are JavaScript `SmalltalkMethodContext` objects defined in `boot.js`.";
  18885. $core.addMethod(
  18886. $core.method({
  18887. selector: "asString",
  18888. protocol: "converting",
  18889. fn: function (){
  18890. var self=this,$self=this;
  18891. return $core.withContext(function($ctx1) {
  18892. var $2,$3,$5,$7,$6,$4,$11,$10,$9,$8,$12,$16,$15,$14,$13,$1;
  18893. $2=$self._isBlockContext();
  18894. if($core.assert($2)){
  18895. $3="a block (in ".__comma($recv($self._methodContext())._asString());
  18896. $ctx1.sendIdx[","]=2;
  18897. $1=$recv($3).__comma(")");
  18898. $ctx1.sendIdx[","]=1;
  18899. } else {
  18900. var methodClass;
  18901. methodClass=$recv($self._method())._methodClass();
  18902. $5=methodClass;
  18903. $7=$self._receiver();
  18904. $ctx1.sendIdx["receiver"]=1;
  18905. $6=$recv($7)._class();
  18906. $ctx1.sendIdx["class"]=1;
  18907. $4=$recv($5).__eq($6);
  18908. if($core.assert($4)){
  18909. $11=$self._receiver();
  18910. $ctx1.sendIdx["receiver"]=2;
  18911. $10=$recv($11)._class();
  18912. $ctx1.sendIdx["class"]=2;
  18913. $9=$recv($10)._name();
  18914. $ctx1.sendIdx["name"]=1;
  18915. $8=$recv($9).__comma(" >> ");
  18916. $ctx1.sendIdx[","]=4;
  18917. $12=$self._selector();
  18918. $ctx1.sendIdx["selector"]=1;
  18919. $1=$recv($8).__comma($12);
  18920. $ctx1.sendIdx[","]=3;
  18921. } else {
  18922. $16=$recv($recv($self._receiver())._class())._name();
  18923. $ctx1.sendIdx["name"]=2;
  18924. $15=$recv($16).__comma("(");
  18925. $14=$recv($15).__comma($recv(methodClass)._name());
  18926. $ctx1.sendIdx[","]=7;
  18927. $13=$recv($14).__comma(") >> ");
  18928. $ctx1.sendIdx[","]=6;
  18929. $1=$recv($13).__comma($self._selector());
  18930. $ctx1.sendIdx[","]=5;
  18931. }
  18932. }
  18933. return $1;
  18934. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.MethodContext)});
  18935. },
  18936. args: [],
  18937. source: "asString\x0a\x09^ self isBlockContext\x0a\x09\x09ifTrue: [ 'a block (in ', self methodContext asString, ')' ]\x0a\x09\x09ifFalse: [ \x0a\x09\x09\x09| methodClass |\x0a\x09\x09\x09methodClass := self method methodClass.\x0a\x09\x09\x09methodClass = self receiver class \x0a\x09\x09\x09\x09ifTrue: [ self receiver class name, ' >> ', self selector ]\x0a\x09\x09\x09\x09ifFalse: [ self receiver class name, '(', methodClass name, ') >> ', self selector ] ]",
  18938. referencedClasses: [],
  18939. messageSends: ["ifTrue:ifFalse:", "isBlockContext", ",", "asString", "methodContext", "methodClass", "method", "=", "class", "receiver", "name", "selector"]
  18940. }),
  18941. $globals.MethodContext);
  18942. $core.addMethod(
  18943. $core.method({
  18944. selector: "basicReceiver",
  18945. protocol: "accessing",
  18946. fn: function (){
  18947. var self=this,$self=this;
  18948. return $core.withContext(function($ctx1) {
  18949. return self.receiver;
  18950. return self;
  18951. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.MethodContext)});
  18952. },
  18953. args: [],
  18954. source: "basicReceiver\x0a\x09<inlineJS: 'return self.receiver'>",
  18955. referencedClasses: [],
  18956. messageSends: []
  18957. }),
  18958. $globals.MethodContext);
  18959. $core.addMethod(
  18960. $core.method({
  18961. selector: "evaluatedSelector",
  18962. protocol: "accessing",
  18963. fn: function (){
  18964. var self=this,$self=this;
  18965. return $core.withContext(function($ctx1) {
  18966. return self.evaluatedSelector;
  18967. return self;
  18968. }, function($ctx1) {$ctx1.fill(self,"evaluatedSelector",{},$globals.MethodContext)});
  18969. },
  18970. args: [],
  18971. source: "evaluatedSelector\x0a\x09<inlineJS: 'return self.evaluatedSelector'>",
  18972. referencedClasses: [],
  18973. messageSends: []
  18974. }),
  18975. $globals.MethodContext);
  18976. $core.addMethod(
  18977. $core.method({
  18978. selector: "findContextSuchThat:",
  18979. protocol: "accessing",
  18980. fn: function (testBlock){
  18981. var self=this,$self=this;
  18982. var context;
  18983. return $core.withContext(function($ctx1) {
  18984. var $1;
  18985. var $early={};
  18986. try {
  18987. context=self;
  18988. $recv((function(){
  18989. return $core.withContext(function($ctx2) {
  18990. return $recv(context)._isNil();
  18991. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  18992. }))._whileFalse_((function(){
  18993. return $core.withContext(function($ctx2) {
  18994. $1=$recv(testBlock)._value_(context);
  18995. if($core.assert($1)){
  18996. throw $early=[context];
  18997. }
  18998. context=$recv(context)._outerContext();
  18999. return context;
  19000. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  19001. }));
  19002. return nil;
  19003. }
  19004. catch(e) {if(e===$early)return e[0]; throw e}
  19005. }, function($ctx1) {$ctx1.fill(self,"findContextSuchThat:",{testBlock:testBlock,context:context},$globals.MethodContext)});
  19006. },
  19007. args: ["testBlock"],
  19008. source: "findContextSuchThat: testBlock\x0a\x09\x22Search self and my sender chain for first one that satisfies `testBlock`. \x0a\x09Answer `nil` if none satisfy\x22\x0a\x0a\x09| context |\x0a\x09\x0a\x09context := self.\x0a\x09[ context isNil] whileFalse: [\x0a\x09\x09(testBlock value: context) \x0a\x09\x09\x09ifTrue: [ ^ context ].\x0a\x09\x09context := context outerContext ].\x0a\x0a\x09^ nil",
  19009. referencedClasses: [],
  19010. messageSends: ["whileFalse:", "isNil", "ifTrue:", "value:", "outerContext"]
  19011. }),
  19012. $globals.MethodContext);
  19013. $core.addMethod(
  19014. $core.method({
  19015. selector: "home",
  19016. protocol: "accessing",
  19017. fn: function (){
  19018. var self=this,$self=this;
  19019. return $core.withContext(function($ctx1) {
  19020. return self.homeContext;
  19021. return self;
  19022. }, function($ctx1) {$ctx1.fill(self,"home",{},$globals.MethodContext)});
  19023. },
  19024. args: [],
  19025. source: "home\x0a\x09<inlineJS: 'return self.homeContext'>",
  19026. referencedClasses: [],
  19027. messageSends: []
  19028. }),
  19029. $globals.MethodContext);
  19030. $core.addMethod(
  19031. $core.method({
  19032. selector: "index",
  19033. protocol: "accessing",
  19034. fn: function (){
  19035. var self=this,$self=this;
  19036. return $core.withContext(function($ctx1) {
  19037. return self.index || 0;
  19038. return self;
  19039. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.MethodContext)});
  19040. },
  19041. args: [],
  19042. source: "index\x0a\x09<inlineJS: 'return self.index || 0'>",
  19043. referencedClasses: [],
  19044. messageSends: []
  19045. }),
  19046. $globals.MethodContext);
  19047. $core.addMethod(
  19048. $core.method({
  19049. selector: "isBlockContext",
  19050. protocol: "testing",
  19051. fn: function (){
  19052. var self=this,$self=this;
  19053. return $core.withContext(function($ctx1) {
  19054. return $recv($self._selector())._isNil();
  19055. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},$globals.MethodContext)});
  19056. },
  19057. args: [],
  19058. source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a\x09\x0a\x09^ self selector isNil",
  19059. referencedClasses: [],
  19060. messageSends: ["isNil", "selector"]
  19061. }),
  19062. $globals.MethodContext);
  19063. $core.addMethod(
  19064. $core.method({
  19065. selector: "locals",
  19066. protocol: "accessing",
  19067. fn: function (){
  19068. var self=this,$self=this;
  19069. return $core.withContext(function($ctx1) {
  19070. return self.locals || {};
  19071. return self;
  19072. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.MethodContext)});
  19073. },
  19074. args: [],
  19075. source: "locals\x0a\x09<inlineJS: 'return self.locals || {}'>",
  19076. referencedClasses: [],
  19077. messageSends: []
  19078. }),
  19079. $globals.MethodContext);
  19080. $core.addMethod(
  19081. $core.method({
  19082. selector: "method",
  19083. protocol: "accessing",
  19084. fn: function (){
  19085. var self=this,$self=this;
  19086. var method,lookupClass,receiverClass,supercall;
  19087. return $core.withContext(function($ctx1) {
  19088. var $1,$3,$2,$4,$6,$5,$7,$8,$receiver;
  19089. $1=$self._methodContext();
  19090. $ctx1.sendIdx["methodContext"]=1;
  19091. if(($receiver = $1) == null || $receiver.a$nil){
  19092. return nil;
  19093. } else {
  19094. $1;
  19095. }
  19096. $3=$self._methodContext();
  19097. $ctx1.sendIdx["methodContext"]=2;
  19098. $2=$recv($3)._receiver();
  19099. receiverClass=$recv($2)._class();
  19100. $4=receiverClass;
  19101. $6=$self._methodContext();
  19102. $ctx1.sendIdx["methodContext"]=3;
  19103. $5=$recv($6)._selector();
  19104. $ctx1.sendIdx["selector"]=1;
  19105. method=$recv($4)._lookupSelector_($5);
  19106. $ctx1.sendIdx["lookupSelector:"]=1;
  19107. $7=$self._outerContext();
  19108. if(($receiver = $7) == null || $receiver.a$nil){
  19109. supercall=false;
  19110. } else {
  19111. var outer;
  19112. outer=$receiver;
  19113. supercall=$recv(outer)._supercall();
  19114. }
  19115. $8=supercall;
  19116. if($core.assert($8)){
  19117. return $recv($recv($recv(method)._methodClass())._superclass())._lookupSelector_($recv($self._methodContext())._selector());
  19118. } else {
  19119. return method;
  19120. }
  19121. }, function($ctx1) {$ctx1.fill(self,"method",{method:method,lookupClass:lookupClass,receiverClass:receiverClass,supercall:supercall},$globals.MethodContext)});
  19122. },
  19123. args: [],
  19124. source: "method\x0a\x09| method lookupClass receiverClass supercall |\x0a\x09\x0a\x09self methodContext ifNil: [ ^ nil ].\x0a\x0a\x09receiverClass := self methodContext receiver class.\x0a\x09method := receiverClass lookupSelector: self methodContext selector.\x0a\x09supercall := self outerContext \x0a\x09\x09ifNil: [ false ]\x0a\x09\x09ifNotNil: [ :outer | outer supercall ].\x0a\x0a\x09^ supercall\x0a\x09\x09ifFalse: [ method ]\x0a\x09\x09ifTrue: [ method methodClass superclass lookupSelector: self methodContext selector ]",
  19125. referencedClasses: [],
  19126. messageSends: ["ifNil:", "methodContext", "class", "receiver", "lookupSelector:", "selector", "ifNil:ifNotNil:", "outerContext", "supercall", "ifFalse:ifTrue:", "superclass", "methodClass"]
  19127. }),
  19128. $globals.MethodContext);
  19129. $core.addMethod(
  19130. $core.method({
  19131. selector: "methodContext",
  19132. protocol: "accessing",
  19133. fn: function (){
  19134. var self=this,$self=this;
  19135. return $core.withContext(function($ctx1) {
  19136. var $1,$2,$receiver;
  19137. $1=$self._isBlockContext();
  19138. if(!$core.assert($1)){
  19139. return self;
  19140. }
  19141. $2=$self._outerContext();
  19142. if(($receiver = $2) == null || $receiver.a$nil){
  19143. return $2;
  19144. } else {
  19145. var outer;
  19146. outer=$receiver;
  19147. return $recv(outer)._methodContext();
  19148. }
  19149. }, function($ctx1) {$ctx1.fill(self,"methodContext",{},$globals.MethodContext)});
  19150. },
  19151. args: [],
  19152. source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self outerContext ifNotNil: [ :outer |\x0a\x09\x09outer methodContext ]",
  19153. referencedClasses: [],
  19154. messageSends: ["ifFalse:", "isBlockContext", "ifNotNil:", "outerContext", "methodContext"]
  19155. }),
  19156. $globals.MethodContext);
  19157. $core.addMethod(
  19158. $core.method({
  19159. selector: "outerContext",
  19160. protocol: "accessing",
  19161. fn: function (){
  19162. var self=this,$self=this;
  19163. return $core.withContext(function($ctx1) {
  19164. return self.outerContext || self.homeContext;
  19165. return self;
  19166. }, function($ctx1) {$ctx1.fill(self,"outerContext",{},$globals.MethodContext)});
  19167. },
  19168. args: [],
  19169. source: "outerContext\x0a\x09<inlineJS: 'return self.outerContext || self.homeContext'>",
  19170. referencedClasses: [],
  19171. messageSends: []
  19172. }),
  19173. $globals.MethodContext);
  19174. $core.addMethod(
  19175. $core.method({
  19176. selector: "printOn:",
  19177. protocol: "printing",
  19178. fn: function (aStream){
  19179. var self=this,$self=this;
  19180. return $core.withContext(function($ctx1) {
  19181. (
  19182. $ctx1.supercall = true,
  19183. ($globals.MethodContext.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  19184. $ctx1.supercall = false;
  19185. $recv(aStream)._nextPutAll_("(");
  19186. $ctx1.sendIdx["nextPutAll:"]=1;
  19187. $recv(aStream)._nextPutAll_($self._asString());
  19188. $ctx1.sendIdx["nextPutAll:"]=2;
  19189. $recv(aStream)._nextPutAll_(")");
  19190. return self;
  19191. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MethodContext)});
  19192. },
  19193. args: ["aStream"],
  19194. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self asString;\x0a\x09\x09nextPutAll: ')'",
  19195. referencedClasses: [],
  19196. messageSends: ["printOn:", "nextPutAll:", "asString"]
  19197. }),
  19198. $globals.MethodContext);
  19199. $core.addMethod(
  19200. $core.method({
  19201. selector: "receiver",
  19202. protocol: "accessing",
  19203. fn: function (){
  19204. var self=this,$self=this;
  19205. return $core.withContext(function($ctx1) {
  19206. var $2,$1;
  19207. $1=$recv($self._isBlockContext())._and_((function(){
  19208. return $core.withContext(function($ctx2) {
  19209. $2=$self._outerContext();
  19210. $ctx2.sendIdx["outerContext"]=1;
  19211. return $recv($2)._notNil();
  19212. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19213. }));
  19214. if($core.assert($1)){
  19215. return $recv($self._outerContext())._receiver();
  19216. } else {
  19217. return $self._basicReceiver();
  19218. }
  19219. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.MethodContext)});
  19220. },
  19221. args: [],
  19222. source: "receiver\x0a\x09^ (self isBlockContext and: [ self outerContext notNil ])\x0a\x09\x09ifTrue: [ self outerContext receiver ]\x0a\x09\x09ifFalse: [ self basicReceiver ]",
  19223. referencedClasses: [],
  19224. messageSends: ["ifTrue:ifFalse:", "and:", "isBlockContext", "notNil", "outerContext", "receiver", "basicReceiver"]
  19225. }),
  19226. $globals.MethodContext);
  19227. $core.addMethod(
  19228. $core.method({
  19229. selector: "selector",
  19230. protocol: "accessing",
  19231. fn: function (){
  19232. var self=this,$self=this;
  19233. return $core.withContext(function($ctx1) {
  19234. if(self.selector) {
  19235. return $core.js2st(self.selector);
  19236. } else {
  19237. return nil;
  19238. }
  19239. ;
  19240. return self;
  19241. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MethodContext)});
  19242. },
  19243. args: [],
  19244. source: "selector\x0a\x09<inlineJS: '\x0a\x09\x09if(self.selector) {\x0a\x09\x09\x09return $core.js2st(self.selector);\x0a\x09\x09} else {\x0a\x09\x09\x09return nil;\x0a\x09\x09}\x0a\x09'>",
  19245. referencedClasses: [],
  19246. messageSends: []
  19247. }),
  19248. $globals.MethodContext);
  19249. $core.addMethod(
  19250. $core.method({
  19251. selector: "sendIndexAt:",
  19252. protocol: "accessing",
  19253. fn: function (aSelector){
  19254. var self=this,$self=this;
  19255. return $core.withContext(function($ctx1) {
  19256. return self.sendIdx[aSelector] || 0;
  19257. return self;
  19258. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aSelector:aSelector},$globals.MethodContext)});
  19259. },
  19260. args: ["aSelector"],
  19261. source: "sendIndexAt: aSelector\x0a\x09<inlineJS: 'return self.sendIdx[aSelector] || 0'>",
  19262. referencedClasses: [],
  19263. messageSends: []
  19264. }),
  19265. $globals.MethodContext);
  19266. $core.addMethod(
  19267. $core.method({
  19268. selector: "sendIndexes",
  19269. protocol: "accessing",
  19270. fn: function (){
  19271. var self=this,$self=this;
  19272. return $core.withContext(function($ctx1) {
  19273. return self.sendIdx;
  19274. return self;
  19275. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.MethodContext)});
  19276. },
  19277. args: [],
  19278. source: "sendIndexes\x0a\x09<inlineJS: 'return self.sendIdx'>",
  19279. referencedClasses: [],
  19280. messageSends: []
  19281. }),
  19282. $globals.MethodContext);
  19283. $core.addMethod(
  19284. $core.method({
  19285. selector: "stubHere",
  19286. protocol: "accessing",
  19287. fn: function (){
  19288. var self=this,$self=this;
  19289. return $core.withContext(function($ctx1) {
  19290. self.homeContext = undefined;
  19291. return self;
  19292. }, function($ctx1) {$ctx1.fill(self,"stubHere",{},$globals.MethodContext)});
  19293. },
  19294. args: [],
  19295. source: "stubHere\x0a\x09<inlineJS: 'self.homeContext = undefined'>",
  19296. referencedClasses: [],
  19297. messageSends: []
  19298. }),
  19299. $globals.MethodContext);
  19300. $core.addMethod(
  19301. $core.method({
  19302. selector: "stubToAtMost:",
  19303. protocol: "error handling",
  19304. fn: function (anInteger){
  19305. var self=this,$self=this;
  19306. var context;
  19307. return $core.withContext(function($ctx1) {
  19308. var $1,$2,$receiver;
  19309. context=self;
  19310. $recv(anInteger)._timesRepeat_((function(){
  19311. return $core.withContext(function($ctx2) {
  19312. $1=context;
  19313. if(($receiver = $1) == null || $receiver.a$nil){
  19314. context=$1;
  19315. } else {
  19316. context=$recv(context)._home();
  19317. }
  19318. return context;
  19319. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19320. }));
  19321. $2=context;
  19322. if(($receiver = $2) == null || $receiver.a$nil){
  19323. $2;
  19324. } else {
  19325. $recv(context)._stubHere();
  19326. }
  19327. return self;
  19328. }, function($ctx1) {$ctx1.fill(self,"stubToAtMost:",{anInteger:anInteger,context:context},$globals.MethodContext)});
  19329. },
  19330. args: ["anInteger"],
  19331. source: "stubToAtMost: anInteger\x0a\x09| context |\x0a\x09context := self.\x0a\x09anInteger timesRepeat: [ context := context ifNotNil: [ context home ] ].\x0a\x09context ifNotNil: [ context stubHere ]",
  19332. referencedClasses: [],
  19333. messageSends: ["timesRepeat:", "ifNotNil:", "home", "stubHere"]
  19334. }),
  19335. $globals.MethodContext);
  19336. $core.addMethod(
  19337. $core.method({
  19338. selector: "supercall",
  19339. protocol: "accessing",
  19340. fn: function (){
  19341. var self=this,$self=this;
  19342. return $core.withContext(function($ctx1) {
  19343. return self.supercall == true;
  19344. return self;
  19345. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.MethodContext)});
  19346. },
  19347. args: [],
  19348. source: "supercall\x0a\x09<inlineJS: 'return self.supercall == true'>",
  19349. referencedClasses: [],
  19350. messageSends: []
  19351. }),
  19352. $globals.MethodContext);
  19353. $core.addClass("NativeFunction", $globals.Object, [], "Kernel-Methods");
  19354. $globals.NativeFunction.comment="I am a wrapper around native functions, such as `WebSocket`.\x0aFor 'normal' functions (whose constructor is the JavaScript `Function` object), use `BlockClosure`.\x0a\x0a## API\x0a\x0aSee the class-side `instance creation` methods for instance creation.\x0a\x0aCreated instances will most probably be instance of `JSObjectProxy`.\x0a\x0a## Usage example:\x0a\x0a\x09| ws |\x0a\x09ws := NativeFunction constructor: 'WebSocket' value: 'ws://localhost'.\x0a\x09ws at: 'onopen' put: [ ws send: 'hey there from Amber' ]";
  19355. $core.addMethod(
  19356. $core.method({
  19357. selector: "constructorNamed:",
  19358. protocol: "instance creation",
  19359. fn: function (aString){
  19360. var self=this,$self=this;
  19361. return $core.withContext(function($ctx1) {
  19362. var nativeFunc=$globals.Platform._globals()[aString];
  19363. return new nativeFunc();
  19364. ;
  19365. return self;
  19366. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:",{aString:aString},$globals.NativeFunction.a$cls)});
  19367. },
  19368. args: ["aString"],
  19369. source: "constructorNamed: aString\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc();\x0a\x09'>",
  19370. referencedClasses: [],
  19371. messageSends: []
  19372. }),
  19373. $globals.NativeFunction.a$cls);
  19374. $core.addMethod(
  19375. $core.method({
  19376. selector: "constructorNamed:value:",
  19377. protocol: "instance creation",
  19378. fn: function (aString,anObject){
  19379. var self=this,$self=this;
  19380. return $core.withContext(function($ctx1) {
  19381. var nativeFunc=$globals.Platform._globals()[aString];
  19382. return new nativeFunc(anObject);
  19383. ;
  19384. return self;
  19385. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.a$cls)});
  19386. },
  19387. args: ["aString", "anObject"],
  19388. source: "constructorNamed: aString value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09'>",
  19389. referencedClasses: [],
  19390. messageSends: []
  19391. }),
  19392. $globals.NativeFunction.a$cls);
  19393. $core.addMethod(
  19394. $core.method({
  19395. selector: "constructorNamed:value:value:",
  19396. protocol: "instance creation",
  19397. fn: function (aString,anObject,anObject2){
  19398. var self=this,$self=this;
  19399. return $core.withContext(function($ctx1) {
  19400. var nativeFunc=$globals.Platform._globals[aString];
  19401. return new nativeFunc(anObject,anObject2);
  19402. ;
  19403. return self;
  19404. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19405. },
  19406. args: ["aString", "anObject", "anObject2"],
  19407. source: "constructorNamed: aString value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09'>",
  19408. referencedClasses: [],
  19409. messageSends: []
  19410. }),
  19411. $globals.NativeFunction.a$cls);
  19412. $core.addMethod(
  19413. $core.method({
  19414. selector: "constructorNamed:value:value:value:",
  19415. protocol: "instance creation",
  19416. fn: function (aString,anObject,anObject2,anObject3){
  19417. var self=this,$self=this;
  19418. return $core.withContext(function($ctx1) {
  19419. var nativeFunc=$globals.Platform._globals[aString];
  19420. return new nativeFunc(anObject,anObject2, anObject3);
  19421. ;
  19422. return self;
  19423. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19424. },
  19425. args: ["aString", "anObject", "anObject2", "anObject3"],
  19426. source: "constructorNamed: aString value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  19427. referencedClasses: [],
  19428. messageSends: []
  19429. }),
  19430. $globals.NativeFunction.a$cls);
  19431. $core.addMethod(
  19432. $core.method({
  19433. selector: "constructorOf:",
  19434. protocol: "instance creation",
  19435. fn: function (nativeFunc){
  19436. var self=this,$self=this;
  19437. return $core.withContext(function($ctx1) {
  19438. return new nativeFunc();
  19439. ;
  19440. return self;
  19441. }, function($ctx1) {$ctx1.fill(self,"constructorOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.a$cls)});
  19442. },
  19443. args: ["nativeFunc"],
  19444. source: "constructorOf: nativeFunc\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc();\x0a\x09'>",
  19445. referencedClasses: [],
  19446. messageSends: []
  19447. }),
  19448. $globals.NativeFunction.a$cls);
  19449. $core.addMethod(
  19450. $core.method({
  19451. selector: "constructorOf:value:",
  19452. protocol: "instance creation",
  19453. fn: function (nativeFunc,anObject){
  19454. var self=this,$self=this;
  19455. return $core.withContext(function($ctx1) {
  19456. return new nativeFunc(anObject);
  19457. ;
  19458. return self;
  19459. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.a$cls)});
  19460. },
  19461. args: ["nativeFunc", "anObject"],
  19462. source: "constructorOf: nativeFunc value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09'>",
  19463. referencedClasses: [],
  19464. messageSends: []
  19465. }),
  19466. $globals.NativeFunction.a$cls);
  19467. $core.addMethod(
  19468. $core.method({
  19469. selector: "constructorOf:value:value:",
  19470. protocol: "instance creation",
  19471. fn: function (nativeFunc,anObject,anObject2){
  19472. var self=this,$self=this;
  19473. return $core.withContext(function($ctx1) {
  19474. return new nativeFunc(anObject,anObject2);
  19475. ;
  19476. return self;
  19477. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19478. },
  19479. args: ["nativeFunc", "anObject", "anObject2"],
  19480. source: "constructorOf: nativeFunc value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09'>",
  19481. referencedClasses: [],
  19482. messageSends: []
  19483. }),
  19484. $globals.NativeFunction.a$cls);
  19485. $core.addMethod(
  19486. $core.method({
  19487. selector: "constructorOf:value:value:value:",
  19488. protocol: "instance creation",
  19489. fn: function (nativeFunc,anObject,anObject2,anObject3){
  19490. var self=this,$self=this;
  19491. return $core.withContext(function($ctx1) {
  19492. return new nativeFunc(anObject,anObject2, anObject3);
  19493. ;
  19494. return self;
  19495. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19496. },
  19497. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  19498. source: "constructorOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  19499. referencedClasses: [],
  19500. messageSends: []
  19501. }),
  19502. $globals.NativeFunction.a$cls);
  19503. $core.addMethod(
  19504. $core.method({
  19505. selector: "exists:",
  19506. protocol: "testing",
  19507. fn: function (aString){
  19508. var self=this,$self=this;
  19509. return $core.withContext(function($ctx1) {
  19510. return $recv($globals.Platform)._includesGlobal_(aString);
  19511. }, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString},$globals.NativeFunction.a$cls)});
  19512. },
  19513. args: ["aString"],
  19514. source: "exists: aString\x0a\x09^ Platform includesGlobal: aString",
  19515. referencedClasses: ["Platform"],
  19516. messageSends: ["includesGlobal:"]
  19517. }),
  19518. $globals.NativeFunction.a$cls);
  19519. $core.addMethod(
  19520. $core.method({
  19521. selector: "functionNamed:",
  19522. protocol: "function calling",
  19523. fn: function (aString){
  19524. var self=this,$self=this;
  19525. return $core.withContext(function($ctx1) {
  19526. var nativeFunc=$globals.Platform._globals[aString];
  19527. return nativeFunc();
  19528. ;
  19529. return self;
  19530. }, function($ctx1) {$ctx1.fill(self,"functionNamed:",{aString:aString},$globals.NativeFunction.a$cls)});
  19531. },
  19532. args: ["aString"],
  19533. source: "functionNamed: aString\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals[aString];\x0a\x09\x09return nativeFunc();\x0a\x09'>",
  19534. referencedClasses: [],
  19535. messageSends: []
  19536. }),
  19537. $globals.NativeFunction.a$cls);
  19538. $core.addMethod(
  19539. $core.method({
  19540. selector: "functionNamed:value:",
  19541. protocol: "function calling",
  19542. fn: function (aString,anObject){
  19543. var self=this,$self=this;
  19544. return $core.withContext(function($ctx1) {
  19545. var nativeFunc=$globals.Platform._globals()[aString];
  19546. return nativeFunc(anObject);
  19547. ;
  19548. return self;
  19549. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.a$cls)});
  19550. },
  19551. args: ["aString", "anObject"],
  19552. source: "functionNamed: aString value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return nativeFunc(anObject);\x0a\x09'>",
  19553. referencedClasses: [],
  19554. messageSends: []
  19555. }),
  19556. $globals.NativeFunction.a$cls);
  19557. $core.addMethod(
  19558. $core.method({
  19559. selector: "functionNamed:value:value:",
  19560. protocol: "function calling",
  19561. fn: function (aString,anObject,anObject2){
  19562. var self=this,$self=this;
  19563. return $core.withContext(function($ctx1) {
  19564. var nativeFunc=$globals.Platform._globals()[aString];
  19565. return nativeFunc(anObject,anObject2);
  19566. ;
  19567. return self;
  19568. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19569. },
  19570. args: ["aString", "anObject", "anObject2"],
  19571. source: "functionNamed: aString value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09'>",
  19572. referencedClasses: [],
  19573. messageSends: []
  19574. }),
  19575. $globals.NativeFunction.a$cls);
  19576. $core.addMethod(
  19577. $core.method({
  19578. selector: "functionNamed:value:value:value:",
  19579. protocol: "function calling",
  19580. fn: function (aString,anObject,anObject2,anObject3){
  19581. var self=this,$self=this;
  19582. return $core.withContext(function($ctx1) {
  19583. var nativeFunc=$globals.Platform._globals()[aString];
  19584. return nativeFunc(anObject,anObject2, anObject3);
  19585. ;
  19586. return self;
  19587. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19588. },
  19589. args: ["aString", "anObject", "anObject2", "anObject3"],
  19590. source: "functionNamed: aString value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  19591. referencedClasses: [],
  19592. messageSends: []
  19593. }),
  19594. $globals.NativeFunction.a$cls);
  19595. $core.addMethod(
  19596. $core.method({
  19597. selector: "functionNamed:valueWithArgs:",
  19598. protocol: "function calling",
  19599. fn: function (aString,args){
  19600. var self=this,$self=this;
  19601. return $core.withContext(function($ctx1) {
  19602. var nativeFunc=$globals.Platform._globals()[aString];
  19603. return Function.prototype.apply.call(nativeFunc, null, args);
  19604. ;
  19605. return self;
  19606. }, function($ctx1) {$ctx1.fill(self,"functionNamed:valueWithArgs:",{aString:aString,args:args},$globals.NativeFunction.a$cls)});
  19607. },
  19608. args: ["aString", "args"],
  19609. source: "functionNamed: aString valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09'>",
  19610. referencedClasses: [],
  19611. messageSends: []
  19612. }),
  19613. $globals.NativeFunction.a$cls);
  19614. $core.addMethod(
  19615. $core.method({
  19616. selector: "functionOf:",
  19617. protocol: "function calling",
  19618. fn: function (nativeFunc){
  19619. var self=this,$self=this;
  19620. return $core.withContext(function($ctx1) {
  19621. return nativeFunc();
  19622. ;
  19623. return self;
  19624. }, function($ctx1) {$ctx1.fill(self,"functionOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.a$cls)});
  19625. },
  19626. args: ["nativeFunc"],
  19627. source: "functionOf: nativeFunc\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc();\x0a\x09'>",
  19628. referencedClasses: [],
  19629. messageSends: []
  19630. }),
  19631. $globals.NativeFunction.a$cls);
  19632. $core.addMethod(
  19633. $core.method({
  19634. selector: "functionOf:value:",
  19635. protocol: "function calling",
  19636. fn: function (nativeFunc,anObject){
  19637. var self=this,$self=this;
  19638. return $core.withContext(function($ctx1) {
  19639. return nativeFunc(anObject);
  19640. ;
  19641. return self;
  19642. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.a$cls)});
  19643. },
  19644. args: ["nativeFunc", "anObject"],
  19645. source: "functionOf: nativeFunc value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject);\x0a\x09'>",
  19646. referencedClasses: [],
  19647. messageSends: []
  19648. }),
  19649. $globals.NativeFunction.a$cls);
  19650. $core.addMethod(
  19651. $core.method({
  19652. selector: "functionOf:value:value:",
  19653. protocol: "function calling",
  19654. fn: function (nativeFunc,anObject,anObject2){
  19655. var self=this,$self=this;
  19656. return $core.withContext(function($ctx1) {
  19657. return nativeFunc(anObject,anObject2);
  19658. ;
  19659. return self;
  19660. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19661. },
  19662. args: ["nativeFunc", "anObject", "anObject2"],
  19663. source: "functionOf: nativeFunc value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09'>",
  19664. referencedClasses: [],
  19665. messageSends: []
  19666. }),
  19667. $globals.NativeFunction.a$cls);
  19668. $core.addMethod(
  19669. $core.method({
  19670. selector: "functionOf:value:value:value:",
  19671. protocol: "function calling",
  19672. fn: function (nativeFunc,anObject,anObject2,anObject3){
  19673. var self=this,$self=this;
  19674. return $core.withContext(function($ctx1) {
  19675. return nativeFunc(anObject,anObject2, anObject3);
  19676. ;
  19677. return self;
  19678. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19679. },
  19680. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  19681. source: "functionOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  19682. referencedClasses: [],
  19683. messageSends: []
  19684. }),
  19685. $globals.NativeFunction.a$cls);
  19686. $core.addMethod(
  19687. $core.method({
  19688. selector: "functionOf:valueWithArgs:",
  19689. protocol: "function calling",
  19690. fn: function (nativeFunc,args){
  19691. var self=this,$self=this;
  19692. return $core.withContext(function($ctx1) {
  19693. return Function.prototype.apply.call(nativeFunc, null, args);
  19694. ;
  19695. return self;
  19696. }, function($ctx1) {$ctx1.fill(self,"functionOf:valueWithArgs:",{nativeFunc:nativeFunc,args:args},$globals.NativeFunction.a$cls)});
  19697. },
  19698. args: ["nativeFunc", "args"],
  19699. source: "functionOf: nativeFunc valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09'>",
  19700. referencedClasses: [],
  19701. messageSends: []
  19702. }),
  19703. $globals.NativeFunction.a$cls);
  19704. $core.addMethod(
  19705. $core.method({
  19706. selector: "isNativeFunction:",
  19707. protocol: "testing",
  19708. fn: function (anObject){
  19709. var self=this,$self=this;
  19710. return $core.withContext(function($ctx1) {
  19711. return typeof anObject === "function";
  19712. return self;
  19713. }, function($ctx1) {$ctx1.fill(self,"isNativeFunction:",{anObject:anObject},$globals.NativeFunction.a$cls)});
  19714. },
  19715. args: ["anObject"],
  19716. source: "isNativeFunction: anObject\x0a\x09<inlineJS: 'return typeof anObject === \x22function\x22'>",
  19717. referencedClasses: [],
  19718. messageSends: []
  19719. }),
  19720. $globals.NativeFunction.a$cls);
  19721. $core.addMethod(
  19722. $core.method({
  19723. selector: "methodOf:this:",
  19724. protocol: "method calling",
  19725. fn: function (nativeFunc,thisObject){
  19726. var self=this,$self=this;
  19727. return $core.withContext(function($ctx1) {
  19728. return Function.prototype.call.call(nativeFunc, thisObject);
  19729. ;
  19730. return self;
  19731. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:",{nativeFunc:nativeFunc,thisObject:thisObject},$globals.NativeFunction.a$cls)});
  19732. },
  19733. args: ["nativeFunc", "thisObject"],
  19734. source: "methodOf: nativeFunc this: thisObject\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject);\x0a\x09'>",
  19735. referencedClasses: [],
  19736. messageSends: []
  19737. }),
  19738. $globals.NativeFunction.a$cls);
  19739. $core.addMethod(
  19740. $core.method({
  19741. selector: "methodOf:this:value:",
  19742. protocol: "method calling",
  19743. fn: function (nativeFunc,thisObject,anObject){
  19744. var self=this,$self=this;
  19745. return $core.withContext(function($ctx1) {
  19746. return Function.prototype.call.call(nativeFunc, thisObject, anObject);
  19747. ;
  19748. return self;
  19749. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject},$globals.NativeFunction.a$cls)});
  19750. },
  19751. args: ["nativeFunc", "thisObject", "anObject"],
  19752. source: "methodOf: nativeFunc this: thisObject value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject, anObject);\x0a\x09'>",
  19753. referencedClasses: [],
  19754. messageSends: []
  19755. }),
  19756. $globals.NativeFunction.a$cls);
  19757. $core.addMethod(
  19758. $core.method({
  19759. selector: "methodOf:this:value:value:",
  19760. protocol: "method calling",
  19761. fn: function (nativeFunc,thisObject,anObject,anObject2){
  19762. var self=this,$self=this;
  19763. return $core.withContext(function($ctx1) {
  19764. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);
  19765. ;
  19766. return self;
  19767. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19768. },
  19769. args: ["nativeFunc", "thisObject", "anObject", "anObject2"],
  19770. source: "methodOf: nativeFunc this: thisObject value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);\x0a\x09'>",
  19771. referencedClasses: [],
  19772. messageSends: []
  19773. }),
  19774. $globals.NativeFunction.a$cls);
  19775. $core.addMethod(
  19776. $core.method({
  19777. selector: "methodOf:this:value:value:value:",
  19778. protocol: "method calling",
  19779. fn: function (nativeFunc,thisObject,anObject,anObject2,anObject3){
  19780. var self=this,$self=this;
  19781. return $core.withContext(function($ctx1) {
  19782. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);
  19783. ;
  19784. return self;
  19785. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19786. },
  19787. args: ["nativeFunc", "thisObject", "anObject", "anObject2", "anObject3"],
  19788. source: "methodOf: nativeFunc this: thisObject value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);\x0a\x09'>",
  19789. referencedClasses: [],
  19790. messageSends: []
  19791. }),
  19792. $globals.NativeFunction.a$cls);
  19793. $core.addMethod(
  19794. $core.method({
  19795. selector: "methodOf:this:valueWithArgs:",
  19796. protocol: "method calling",
  19797. fn: function (nativeFunc,thisObject,args){
  19798. var self=this,$self=this;
  19799. return $core.withContext(function($ctx1) {
  19800. return Function.prototype.apply.call(nativeFunc, thisObject, args);
  19801. ;
  19802. return self;
  19803. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:valueWithArgs:",{nativeFunc:nativeFunc,thisObject:thisObject,args:args},$globals.NativeFunction.a$cls)});
  19804. },
  19805. args: ["nativeFunc", "thisObject", "args"],
  19806. source: "methodOf: nativeFunc this: thisObject valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, thisObject, args);\x0a\x09'>",
  19807. referencedClasses: [],
  19808. messageSends: []
  19809. }),
  19810. $globals.NativeFunction.a$cls);
  19811. $core.addClass("Timeout", $globals.Object, ["rawTimeout"], "Kernel-Methods");
  19812. $globals.Timeout.comment="I am wrapping the returns from `set{Timeout,Interval}`.\x0a\x0a## Motivation\x0a\x0aNumber suffices in browsers, but node.js returns an object.";
  19813. $core.addMethod(
  19814. $core.method({
  19815. selector: "clearInterval",
  19816. protocol: "timeout/interval",
  19817. fn: function (){
  19818. var self=this,$self=this;
  19819. return $core.withContext(function($ctx1) {
  19820. var interval = $self["@rawTimeout"];
  19821. clearInterval(interval);
  19822. ;
  19823. return self;
  19824. }, function($ctx1) {$ctx1.fill(self,"clearInterval",{},$globals.Timeout)});
  19825. },
  19826. args: [],
  19827. source: "clearInterval\x0a\x09<inlineJS: '\x0a\x09\x09var interval = $self[\x22@rawTimeout\x22];\x0a\x09\x09clearInterval(interval);\x0a\x09'>",
  19828. referencedClasses: [],
  19829. messageSends: []
  19830. }),
  19831. $globals.Timeout);
  19832. $core.addMethod(
  19833. $core.method({
  19834. selector: "clearTimeout",
  19835. protocol: "timeout/interval",
  19836. fn: function (){
  19837. var self=this,$self=this;
  19838. return $core.withContext(function($ctx1) {
  19839. var timeout = $self["@rawTimeout"];
  19840. clearTimeout(timeout);
  19841. ;
  19842. return self;
  19843. }, function($ctx1) {$ctx1.fill(self,"clearTimeout",{},$globals.Timeout)});
  19844. },
  19845. args: [],
  19846. source: "clearTimeout\x0a\x09<inlineJS: '\x0a\x09\x09var timeout = $self[\x22@rawTimeout\x22];\x0a\x09\x09clearTimeout(timeout);\x0a\x09'>",
  19847. referencedClasses: [],
  19848. messageSends: []
  19849. }),
  19850. $globals.Timeout);
  19851. $core.addMethod(
  19852. $core.method({
  19853. selector: "rawTimeout:",
  19854. protocol: "accessing",
  19855. fn: function (anObject){
  19856. var self=this,$self=this;
  19857. $self["@rawTimeout"]=anObject;
  19858. return self;
  19859. },
  19860. args: ["anObject"],
  19861. source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
  19862. referencedClasses: [],
  19863. messageSends: []
  19864. }),
  19865. $globals.Timeout);
  19866. $core.addMethod(
  19867. $core.method({
  19868. selector: "on:",
  19869. protocol: "instance creation",
  19870. fn: function (anObject){
  19871. var self=this,$self=this;
  19872. return $core.withContext(function($ctx1) {
  19873. var $1;
  19874. $1=$self._new();
  19875. $recv($1)._rawTimeout_(anObject);
  19876. return $recv($1)._yourself();
  19877. }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject},$globals.Timeout.a$cls)});
  19878. },
  19879. args: ["anObject"],
  19880. source: "on: anObject\x0a\x09^ self new rawTimeout: anObject; yourself",
  19881. referencedClasses: [],
  19882. messageSends: ["rawTimeout:", "new", "yourself"]
  19883. }),
  19884. $globals.Timeout.a$cls);
  19885. });
  19886. define('amber_core/Kernel-Dag',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  19887. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  19888. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  19889. var $pkg = $core.addPackage("Kernel-Dag");
  19890. $pkg.innerEval = function (expr) { return eval(expr); };
  19891. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  19892. $core.addClass("AbstractDagVisitor", $globals.Object, [], "Kernel-Dag");
  19893. $globals.AbstractDagVisitor.comment="I am base class of `DagNode` visitor.\x0a\x0aConcrete classes should implement `visitDagNode:`,\x0athey can reuse possible variants of implementation\x0aoffered directly: `visitDagNodeVariantSimple:`\x0aand `visitDagNodeVariantRedux:`.";
  19894. $core.addMethod(
  19895. $core.method({
  19896. selector: "value:",
  19897. protocol: "evaluating",
  19898. fn: function (anObject){
  19899. var self=this,$self=this;
  19900. return $core.withContext(function($ctx1) {
  19901. return $self._visit_(anObject);
  19902. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.AbstractDagVisitor)});
  19903. },
  19904. args: ["anObject"],
  19905. source: "value: anObject\x0a\x09^ self visit: anObject",
  19906. referencedClasses: [],
  19907. messageSends: ["visit:"]
  19908. }),
  19909. $globals.AbstractDagVisitor);
  19910. $core.addMethod(
  19911. $core.method({
  19912. selector: "visit:",
  19913. protocol: "visiting",
  19914. fn: function (aNode){
  19915. var self=this,$self=this;
  19916. return $core.withContext(function($ctx1) {
  19917. return $recv(aNode)._acceptDagVisitor_(self);
  19918. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.AbstractDagVisitor)});
  19919. },
  19920. args: ["aNode"],
  19921. source: "visit: aNode\x0a\x09^ aNode acceptDagVisitor: self",
  19922. referencedClasses: [],
  19923. messageSends: ["acceptDagVisitor:"]
  19924. }),
  19925. $globals.AbstractDagVisitor);
  19926. $core.addMethod(
  19927. $core.method({
  19928. selector: "visitAll:",
  19929. protocol: "visiting",
  19930. fn: function (aCollection){
  19931. var self=this,$self=this;
  19932. return $core.withContext(function($ctx1) {
  19933. return $recv(aCollection)._collect_((function(each){
  19934. return $core.withContext(function($ctx2) {
  19935. return $self._visit_(each);
  19936. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  19937. }));
  19938. }, function($ctx1) {$ctx1.fill(self,"visitAll:",{aCollection:aCollection},$globals.AbstractDagVisitor)});
  19939. },
  19940. args: ["aCollection"],
  19941. source: "visitAll: aCollection\x0a\x09^ aCollection collect: [ :each | self visit: each ]",
  19942. referencedClasses: [],
  19943. messageSends: ["collect:", "visit:"]
  19944. }),
  19945. $globals.AbstractDagVisitor);
  19946. $core.addMethod(
  19947. $core.method({
  19948. selector: "visitAllChildren:",
  19949. protocol: "visiting",
  19950. fn: function (aDagNode){
  19951. var self=this,$self=this;
  19952. return $core.withContext(function($ctx1) {
  19953. return $self._visitAll_($recv(aDagNode)._dagChildren());
  19954. }, function($ctx1) {$ctx1.fill(self,"visitAllChildren:",{aDagNode:aDagNode},$globals.AbstractDagVisitor)});
  19955. },
  19956. args: ["aDagNode"],
  19957. source: "visitAllChildren: aDagNode\x0a\x09^ self visitAll: aDagNode dagChildren",
  19958. referencedClasses: [],
  19959. messageSends: ["visitAll:", "dagChildren"]
  19960. }),
  19961. $globals.AbstractDagVisitor);
  19962. $core.addMethod(
  19963. $core.method({
  19964. selector: "visitDagNode:",
  19965. protocol: "visiting",
  19966. fn: function (aNode){
  19967. var self=this,$self=this;
  19968. return $core.withContext(function($ctx1) {
  19969. $self._subclassResponsibility();
  19970. return self;
  19971. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.AbstractDagVisitor)});
  19972. },
  19973. args: ["aNode"],
  19974. source: "visitDagNode: aNode\x0a\x09self subclassResponsibility",
  19975. referencedClasses: [],
  19976. messageSends: ["subclassResponsibility"]
  19977. }),
  19978. $globals.AbstractDagVisitor);
  19979. $core.addMethod(
  19980. $core.method({
  19981. selector: "visitDagNodeVariantRedux:",
  19982. protocol: "visiting",
  19983. fn: function (aNode){
  19984. var self=this,$self=this;
  19985. var newChildren,oldChildren;
  19986. return $core.withContext(function($ctx1) {
  19987. var $2,$3,$1,$4,$5;
  19988. var $early={};
  19989. try {
  19990. oldChildren=$recv(aNode)._dagChildren();
  19991. newChildren=$self._visitAllChildren_(aNode);
  19992. $2=$recv(oldChildren)._size();
  19993. $ctx1.sendIdx["size"]=1;
  19994. $3=$recv(newChildren)._size();
  19995. $ctx1.sendIdx["size"]=2;
  19996. $1=$recv($2).__eq($3);
  19997. if($core.assert($1)){
  19998. $recv((1)._to_($recv(oldChildren)._size()))._detect_ifNone_((function(i){
  19999. return $core.withContext(function($ctx2) {
  20000. $4=$recv(oldChildren)._at_(i);
  20001. $ctx2.sendIdx["at:"]=1;
  20002. return $recv($4).__tild_eq($recv(newChildren)._at_(i));
  20003. }, function($ctx2) {$ctx2.fillBlock({i:i},$ctx1,2)});
  20004. }),(function(){
  20005. throw $early=[aNode];
  20006. }));
  20007. }
  20008. $5=$recv(aNode)._copy();
  20009. $recv($5)._dagChildren_(newChildren);
  20010. return $recv($5)._yourself();
  20011. }
  20012. catch(e) {if(e===$early)return e[0]; throw e}
  20013. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantRedux:",{aNode:aNode,newChildren:newChildren,oldChildren:oldChildren},$globals.AbstractDagVisitor)});
  20014. },
  20015. args: ["aNode"],
  20016. source: "visitDagNodeVariantRedux: aNode\x0a\x09\x22Immutable-guarded implementation of visitDagNode:.\x0a\x09Visits all children and checks if there were changes.\x0a\x09If not, returns aNode.\x0a\x09If yes, returns copy of aNode with new children.\x22\x0a\x0a\x09| newChildren oldChildren |\x0a\x09oldChildren := aNode dagChildren.\x0a\x09newChildren := self visitAllChildren: aNode.\x0a\x09oldChildren size = newChildren size ifTrue: [\x0a\x09\x09(1 to: oldChildren size) detect: [ :i |\x0a\x09\x09\x09(oldChildren at: i) ~= (newChildren at: i)\x0a\x09\x09] ifNone: [ \x22no change\x22 ^ aNode ] ].\x0a\x09^ aNode copy dagChildren: newChildren; yourself",
  20017. referencedClasses: [],
  20018. messageSends: ["dagChildren", "visitAllChildren:", "ifTrue:", "=", "size", "detect:ifNone:", "to:", "~=", "at:", "dagChildren:", "copy", "yourself"]
  20019. }),
  20020. $globals.AbstractDagVisitor);
  20021. $core.addMethod(
  20022. $core.method({
  20023. selector: "visitDagNodeVariantSimple:",
  20024. protocol: "visiting",
  20025. fn: function (aNode){
  20026. var self=this,$self=this;
  20027. return $core.withContext(function($ctx1) {
  20028. $self._visitAllChildren_(aNode);
  20029. return aNode;
  20030. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantSimple:",{aNode:aNode},$globals.AbstractDagVisitor)});
  20031. },
  20032. args: ["aNode"],
  20033. source: "visitDagNodeVariantSimple: aNode\x0a\x09\x22Simple implementation of visitDagNode:.\x0a\x09Visits children, then returns aNode\x22\x0a\x0a\x09self visitAllChildren: aNode.\x0a\x09^ aNode",
  20034. referencedClasses: [],
  20035. messageSends: ["visitAllChildren:"]
  20036. }),
  20037. $globals.AbstractDagVisitor);
  20038. $core.addClass("PathDagVisitor", $globals.AbstractDagVisitor, ["path"], "Kernel-Dag");
  20039. $globals.PathDagVisitor.comment="I am base class of `DagNode` visitor.\x0a\x0aI hold the path of ancestors up to actual node\x0ain `self path`.";
  20040. $core.addMethod(
  20041. $core.method({
  20042. selector: "initialize",
  20043. protocol: "initialization",
  20044. fn: function (){
  20045. var self=this,$self=this;
  20046. return $core.withContext(function($ctx1) {
  20047. (
  20048. $ctx1.supercall = true,
  20049. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  20050. $ctx1.supercall = false;
  20051. $self["@path"]=[];
  20052. return self;
  20053. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PathDagVisitor)});
  20054. },
  20055. args: [],
  20056. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09path := #()",
  20057. referencedClasses: [],
  20058. messageSends: ["initialize"]
  20059. }),
  20060. $globals.PathDagVisitor);
  20061. $core.addMethod(
  20062. $core.method({
  20063. selector: "path",
  20064. protocol: "accessing",
  20065. fn: function (){
  20066. var self=this,$self=this;
  20067. return $self["@path"];
  20068. },
  20069. args: [],
  20070. source: "path\x0a\x09^ path",
  20071. referencedClasses: [],
  20072. messageSends: []
  20073. }),
  20074. $globals.PathDagVisitor);
  20075. $core.addMethod(
  20076. $core.method({
  20077. selector: "visit:",
  20078. protocol: "visiting",
  20079. fn: function (aNode){
  20080. var self=this,$self=this;
  20081. var oldPath,result;
  20082. return $core.withContext(function($ctx1) {
  20083. result=aNode;
  20084. oldPath=$self["@path"];
  20085. $recv((function(){
  20086. return $core.withContext(function($ctx2) {
  20087. $self["@path"]=$recv($self["@path"]).__comma([aNode]);
  20088. result=(
  20089. $ctx2.supercall = true,
  20090. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
  20091. $ctx2.supercall = false;
  20092. return result;
  20093. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20094. }))._ensure_((function(){
  20095. $self["@path"]=oldPath;
  20096. return $self["@path"];
  20097. }));
  20098. return result;
  20099. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode,oldPath:oldPath,result:result},$globals.PathDagVisitor)});
  20100. },
  20101. args: ["aNode"],
  20102. source: "visit: aNode\x0a\x09| oldPath result |\x0a\x09result := aNode.\x0a\x09oldPath := path.\x0a\x09[\x0a\x09\x09path := path, {aNode}.\x0a\x09\x09result := super visit: aNode\x0a\x09] ensure: [ path := oldPath ].\x0a\x09^ result",
  20103. referencedClasses: [],
  20104. messageSends: ["ensure:", ",", "visit:"]
  20105. }),
  20106. $globals.PathDagVisitor);
  20107. $core.addMethod(
  20108. $core.method({
  20109. selector: "visitDagNodeVariantRedux:",
  20110. protocol: "visiting",
  20111. fn: function (aNode){
  20112. var self=this,$self=this;
  20113. var newNode;
  20114. return $core.withContext(function($ctx1) {
  20115. var $1;
  20116. newNode=(
  20117. $ctx1.supercall = true,
  20118. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visitDagNodeVariantRedux_.apply($self, [aNode]));
  20119. $ctx1.supercall = false;
  20120. $1=$recv(aNode).__eq_eq(newNode);
  20121. if(!$core.assert($1)){
  20122. $recv($self["@path"])._at_put_($recv($self["@path"])._size(),newNode);
  20123. }
  20124. return newNode;
  20125. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantRedux:",{aNode:aNode,newNode:newNode},$globals.PathDagVisitor)});
  20126. },
  20127. args: ["aNode"],
  20128. source: "visitDagNodeVariantRedux: aNode\x0a\x09| newNode |\x0a\x09newNode := super visitDagNodeVariantRedux: aNode.\x0a\x09aNode == newNode ifFalse: [ path at: path size put: newNode ].\x0a\x09^ newNode",
  20129. referencedClasses: [],
  20130. messageSends: ["visitDagNodeVariantRedux:", "ifFalse:", "==", "at:put:", "size"]
  20131. }),
  20132. $globals.PathDagVisitor);
  20133. $core.addClass("DagNode", $globals.Object, [], "Kernel-Dag");
  20134. $globals.DagNode.comment="I am the abstract root class of any directed acyclic graph.\x0a\x0aConcrete classes should implement `dagChildren` and `dagChildren:`\x0ato get / set direct successor nodes (aka child nodes / subnodes).";
  20135. $core.addMethod(
  20136. $core.method({
  20137. selector: "acceptDagVisitor:",
  20138. protocol: "visiting",
  20139. fn: function (aVisitor){
  20140. var self=this,$self=this;
  20141. return $core.withContext(function($ctx1) {
  20142. return $recv(aVisitor)._visitDagNode_(self);
  20143. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DagNode)});
  20144. },
  20145. args: ["aVisitor"],
  20146. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDagNode: self",
  20147. referencedClasses: [],
  20148. messageSends: ["visitDagNode:"]
  20149. }),
  20150. $globals.DagNode);
  20151. $core.addMethod(
  20152. $core.method({
  20153. selector: "allDagChildren",
  20154. protocol: "accessing",
  20155. fn: function (){
  20156. var self=this,$self=this;
  20157. var allNodes;
  20158. return $core.withContext(function($ctx1) {
  20159. var $1;
  20160. $1=$self._dagChildren();
  20161. $ctx1.sendIdx["dagChildren"]=1;
  20162. allNodes=$recv($1)._asSet();
  20163. $recv($self._dagChildren())._do_((function(each){
  20164. return $core.withContext(function($ctx2) {
  20165. return $recv(allNodes)._addAll_($recv(each)._allDagChildren());
  20166. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  20167. }));
  20168. return allNodes;
  20169. }, function($ctx1) {$ctx1.fill(self,"allDagChildren",{allNodes:allNodes},$globals.DagNode)});
  20170. },
  20171. args: [],
  20172. source: "allDagChildren\x0a\x09| allNodes |\x0a\x09\x0a\x09allNodes := self dagChildren asSet.\x0a\x09self dagChildren do: [ :each | \x0a\x09\x09allNodes addAll: each allDagChildren ].\x0a\x09\x0a\x09^ allNodes",
  20173. referencedClasses: [],
  20174. messageSends: ["asSet", "dagChildren", "do:", "addAll:", "allDagChildren"]
  20175. }),
  20176. $globals.DagNode);
  20177. $core.addMethod(
  20178. $core.method({
  20179. selector: "dagChildren",
  20180. protocol: "accessing",
  20181. fn: function (){
  20182. var self=this,$self=this;
  20183. return $core.withContext(function($ctx1) {
  20184. $self._subclassResponsibility();
  20185. return self;
  20186. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.DagNode)});
  20187. },
  20188. args: [],
  20189. source: "dagChildren\x0a\x09self subclassResponsibility",
  20190. referencedClasses: [],
  20191. messageSends: ["subclassResponsibility"]
  20192. }),
  20193. $globals.DagNode);
  20194. $core.addMethod(
  20195. $core.method({
  20196. selector: "dagChildren:",
  20197. protocol: "accessing",
  20198. fn: function (aCollection){
  20199. var self=this,$self=this;
  20200. return $core.withContext(function($ctx1) {
  20201. $self._subclassResponsibility();
  20202. return self;
  20203. }, function($ctx1) {$ctx1.fill(self,"dagChildren:",{aCollection:aCollection},$globals.DagNode)});
  20204. },
  20205. args: ["aCollection"],
  20206. source: "dagChildren: aCollection\x0a\x09self subclassResponsibility",
  20207. referencedClasses: [],
  20208. messageSends: ["subclassResponsibility"]
  20209. }),
  20210. $globals.DagNode);
  20211. $core.addMethod(
  20212. $core.method({
  20213. selector: "isDagNode",
  20214. protocol: "testing",
  20215. fn: function (){
  20216. var self=this,$self=this;
  20217. return true;
  20218. },
  20219. args: [],
  20220. source: "isDagNode\x0a\x09^ true",
  20221. referencedClasses: [],
  20222. messageSends: []
  20223. }),
  20224. $globals.DagNode);
  20225. $core.addClass("DagParentNode", $globals.DagNode, ["nodes"], "Kernel-Dag");
  20226. $globals.DagParentNode.comment="I am `DagNode` that stores a collection of its children,\x0alazy initialized to empty array.\x0a\x0aI can `addDagChild:` to add a child.";
  20227. $core.addMethod(
  20228. $core.method({
  20229. selector: "addDagChild:",
  20230. protocol: "accessing",
  20231. fn: function (aDagNode){
  20232. var self=this,$self=this;
  20233. return $core.withContext(function($ctx1) {
  20234. $recv($self._dagChildren())._add_(aDagNode);
  20235. return self;
  20236. }, function($ctx1) {$ctx1.fill(self,"addDagChild:",{aDagNode:aDagNode},$globals.DagParentNode)});
  20237. },
  20238. args: ["aDagNode"],
  20239. source: "addDagChild: aDagNode\x0a\x09self dagChildren add: aDagNode",
  20240. referencedClasses: [],
  20241. messageSends: ["add:", "dagChildren"]
  20242. }),
  20243. $globals.DagParentNode);
  20244. $core.addMethod(
  20245. $core.method({
  20246. selector: "dagChildren",
  20247. protocol: "accessing",
  20248. fn: function (){
  20249. var self=this,$self=this;
  20250. return $core.withContext(function($ctx1) {
  20251. var $1,$receiver;
  20252. $1=$self["@nodes"];
  20253. if(($receiver = $1) == null || $receiver.a$nil){
  20254. $self["@nodes"]=$recv($globals.Array)._new();
  20255. return $self["@nodes"];
  20256. } else {
  20257. return $1;
  20258. }
  20259. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.DagParentNode)});
  20260. },
  20261. args: [],
  20262. source: "dagChildren\x0a\x09^ nodes ifNil: [ nodes := Array new ]",
  20263. referencedClasses: ["Array"],
  20264. messageSends: ["ifNil:", "new"]
  20265. }),
  20266. $globals.DagParentNode);
  20267. $core.addMethod(
  20268. $core.method({
  20269. selector: "dagChildren:",
  20270. protocol: "accessing",
  20271. fn: function (aCollection){
  20272. var self=this,$self=this;
  20273. $self["@nodes"]=aCollection;
  20274. return self;
  20275. },
  20276. args: ["aCollection"],
  20277. source: "dagChildren: aCollection\x0a\x09nodes := aCollection",
  20278. referencedClasses: [],
  20279. messageSends: []
  20280. }),
  20281. $globals.DagParentNode);
  20282. $core.addClass("DagSink", $globals.DagNode, ["nodes"], "Kernel-Dag");
  20283. $globals.DagSink.comment="I am `DagNode` with no direct successors.\x0a\x0aSending `dagChildren:` with empty collection is legal.";
  20284. $core.addMethod(
  20285. $core.method({
  20286. selector: "dagChildren",
  20287. protocol: "accessing",
  20288. fn: function (){
  20289. var self=this,$self=this;
  20290. return [];
  20291. },
  20292. args: [],
  20293. source: "dagChildren\x0a\x09^ #()",
  20294. referencedClasses: [],
  20295. messageSends: []
  20296. }),
  20297. $globals.DagSink);
  20298. $core.addMethod(
  20299. $core.method({
  20300. selector: "dagChildren:",
  20301. protocol: "accessing",
  20302. fn: function (aCollection){
  20303. var self=this,$self=this;
  20304. return $core.withContext(function($ctx1) {
  20305. $recv(aCollection)._ifNotEmpty_((function(){
  20306. return $core.withContext(function($ctx2) {
  20307. return $self._error_("A DagSink cannot have children.");
  20308. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20309. }));
  20310. return self;
  20311. }, function($ctx1) {$ctx1.fill(self,"dagChildren:",{aCollection:aCollection},$globals.DagSink)});
  20312. },
  20313. args: ["aCollection"],
  20314. source: "dagChildren: aCollection\x0a\x09aCollection ifNotEmpty: [ self error: 'A DagSink cannot have children.' ]",
  20315. referencedClasses: [],
  20316. messageSends: ["ifNotEmpty:", "error:"]
  20317. }),
  20318. $globals.DagSink);
  20319. $core.addMethod(
  20320. $core.method({
  20321. selector: "isDagNode",
  20322. protocol: "*Kernel-Dag",
  20323. fn: function (){
  20324. var self=this,$self=this;
  20325. return false;
  20326. },
  20327. args: [],
  20328. source: "isDagNode\x0a\x09^ false",
  20329. referencedClasses: [],
  20330. messageSends: []
  20331. }),
  20332. $globals.Object);
  20333. });
  20334. define('amber_core/Kernel-Exceptions',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  20335. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  20336. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  20337. var $pkg = $core.addPackage("Kernel-Exceptions");
  20338. $pkg.innerEval = function (expr) { return eval(expr); };
  20339. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  20340. $core.addClass("Error", $globals.Object, ["messageText"], "Kernel-Exceptions");
  20341. $globals.Error.comment="From the ANSI standard:\x0a\x0aThis protocol describes the behavior of instances of class `Error`.\x0aThese are used to represent error conditions that prevent the normal continuation of processing.\x0aActual error exceptions used by an application may be subclasses of this class.\x0aAs `Error` is explicitly specified to be subclassable, conforming implementations must implement its behavior in a non-fragile manner.";
  20342. $core.addMethod(
  20343. $core.method({
  20344. selector: "beHandled",
  20345. protocol: "accessing",
  20346. fn: function (){
  20347. var self=this,$self=this;
  20348. return $core.withContext(function($ctx1) {
  20349. self.amberHandled = true;
  20350. return self;
  20351. }, function($ctx1) {$ctx1.fill(self,"beHandled",{},$globals.Error)});
  20352. },
  20353. args: [],
  20354. source: "beHandled\x0a\x09<inlineJS: 'self.amberHandled = true'>",
  20355. referencedClasses: [],
  20356. messageSends: []
  20357. }),
  20358. $globals.Error);
  20359. $core.addMethod(
  20360. $core.method({
  20361. selector: "beUnhandled",
  20362. protocol: "accessing",
  20363. fn: function (){
  20364. var self=this,$self=this;
  20365. return $core.withContext(function($ctx1) {
  20366. self.amberHandled = false;
  20367. return self;
  20368. }, function($ctx1) {$ctx1.fill(self,"beUnhandled",{},$globals.Error)});
  20369. },
  20370. args: [],
  20371. source: "beUnhandled\x0a\x09<inlineJS: 'self.amberHandled = false'>",
  20372. referencedClasses: [],
  20373. messageSends: []
  20374. }),
  20375. $globals.Error);
  20376. $core.addMethod(
  20377. $core.method({
  20378. selector: "context",
  20379. protocol: "accessing",
  20380. fn: function (){
  20381. var self=this,$self=this;
  20382. return $core.withContext(function($ctx1) {
  20383. return self.context;
  20384. return self;
  20385. }, function($ctx1) {$ctx1.fill(self,"context",{},$globals.Error)});
  20386. },
  20387. args: [],
  20388. source: "context\x0a\x09<inlineJS: 'return self.context'>",
  20389. referencedClasses: [],
  20390. messageSends: []
  20391. }),
  20392. $globals.Error);
  20393. $core.addMethod(
  20394. $core.method({
  20395. selector: "initialize",
  20396. protocol: "initialization",
  20397. fn: function (){
  20398. var self=this,$self=this;
  20399. return $core.withContext(function($ctx1) {
  20400. $self._messageText_("Errorclass: ".__comma($recv($self._class())._name()));
  20401. return self;
  20402. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Error)});
  20403. },
  20404. args: [],
  20405. source: "initialize\x0a\x09self messageText: 'Errorclass: ', (self class name).",
  20406. referencedClasses: [],
  20407. messageSends: ["messageText:", ",", "name", "class"]
  20408. }),
  20409. $globals.Error);
  20410. $core.addMethod(
  20411. $core.method({
  20412. selector: "isSmalltalkError",
  20413. protocol: "testing",
  20414. fn: function (){
  20415. var self=this,$self=this;
  20416. return $core.withContext(function($ctx1) {
  20417. return self.smalltalkError === true;
  20418. return self;
  20419. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkError",{},$globals.Error)});
  20420. },
  20421. args: [],
  20422. source: "isSmalltalkError\x0a\x09<inlineJS: 'return self.smalltalkError === true'>",
  20423. referencedClasses: [],
  20424. messageSends: []
  20425. }),
  20426. $globals.Error);
  20427. $core.addMethod(
  20428. $core.method({
  20429. selector: "jsStack",
  20430. protocol: "accessing",
  20431. fn: function (){
  20432. var self=this,$self=this;
  20433. return $core.withContext(function($ctx1) {
  20434. return self.stack;
  20435. return self;
  20436. }, function($ctx1) {$ctx1.fill(self,"jsStack",{},$globals.Error)});
  20437. },
  20438. args: [],
  20439. source: "jsStack\x0a\x09<inlineJS: 'return self.stack'>",
  20440. referencedClasses: [],
  20441. messageSends: []
  20442. }),
  20443. $globals.Error);
  20444. $core.addMethod(
  20445. $core.method({
  20446. selector: "messageText",
  20447. protocol: "accessing",
  20448. fn: function (){
  20449. var self=this,$self=this;
  20450. return $self["@messageText"];
  20451. },
  20452. args: [],
  20453. source: "messageText\x0a\x09^ messageText",
  20454. referencedClasses: [],
  20455. messageSends: []
  20456. }),
  20457. $globals.Error);
  20458. $core.addMethod(
  20459. $core.method({
  20460. selector: "messageText:",
  20461. protocol: "accessing",
  20462. fn: function (aString){
  20463. var self=this,$self=this;
  20464. $self["@messageText"]=aString;
  20465. return self;
  20466. },
  20467. args: ["aString"],
  20468. source: "messageText: aString\x0a\x09messageText := aString",
  20469. referencedClasses: [],
  20470. messageSends: []
  20471. }),
  20472. $globals.Error);
  20473. $core.addMethod(
  20474. $core.method({
  20475. selector: "outer",
  20476. protocol: "signaling",
  20477. fn: function (){
  20478. var self=this,$self=this;
  20479. return $core.withContext(function($ctx1) {
  20480. return $self._pass();
  20481. }, function($ctx1) {$ctx1.fill(self,"outer",{},$globals.Error)});
  20482. },
  20483. args: [],
  20484. source: "outer\x0a\x09\x22Pharo compatibility. Just sends #pass.\x22\x0a\x09\x0a\x09^ self pass",
  20485. referencedClasses: [],
  20486. messageSends: ["pass"]
  20487. }),
  20488. $globals.Error);
  20489. $core.addMethod(
  20490. $core.method({
  20491. selector: "pass",
  20492. protocol: "signaling",
  20493. fn: function (){
  20494. var self=this,$self=this;
  20495. return $core.withContext(function($ctx1) {
  20496. self.amberHandled = false;
  20497. throw self;
  20498. ;
  20499. return self;
  20500. }, function($ctx1) {$ctx1.fill(self,"pass",{},$globals.Error)});
  20501. },
  20502. args: [],
  20503. source: "pass\x0a\x09\x22Let outer handler take care of this.\x22\x0a\x09\x0a\x09<inlineJS: '\x0a\x09\x09self.amberHandled = false;\x0a\x09\x09throw self;\x0a\x09'>",
  20504. referencedClasses: [],
  20505. messageSends: []
  20506. }),
  20507. $globals.Error);
  20508. $core.addMethod(
  20509. $core.method({
  20510. selector: "resignal",
  20511. protocol: "signaling",
  20512. fn: function (){
  20513. var self=this,$self=this;
  20514. return $core.withContext(function($ctx1) {
  20515. $self._deprecatedAPI_("Use #pass.");
  20516. return $self._pass();
  20517. }, function($ctx1) {$ctx1.fill(self,"resignal",{},$globals.Error)});
  20518. },
  20519. args: [],
  20520. source: "resignal\x0a\x09self deprecatedAPI: 'Use #pass.'.\x0a\x09^ self pass",
  20521. referencedClasses: [],
  20522. messageSends: ["deprecatedAPI:", "pass"]
  20523. }),
  20524. $globals.Error);
  20525. $core.addMethod(
  20526. $core.method({
  20527. selector: "signal",
  20528. protocol: "signaling",
  20529. fn: function (){
  20530. var self=this,$self=this;
  20531. return $core.withContext(function($ctx1) {
  20532. self.amberHandled = false;
  20533. self.context = $core.getThisContext();
  20534. self.smalltalkError = true;
  20535. throw self;
  20536. ;
  20537. return self;
  20538. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error)});
  20539. },
  20540. args: [],
  20541. source: "signal\x0a\x09<inlineJS: '\x0a\x09\x09self.amberHandled = false;\x0a\x09\x09self.context = $core.getThisContext(); \x0a\x09\x09self.smalltalkError = true;\x0a\x09\x09throw self;\x0a\x09'>",
  20542. referencedClasses: [],
  20543. messageSends: []
  20544. }),
  20545. $globals.Error);
  20546. $core.addMethod(
  20547. $core.method({
  20548. selector: "signal:",
  20549. protocol: "signaling",
  20550. fn: function (aString){
  20551. var self=this,$self=this;
  20552. return $core.withContext(function($ctx1) {
  20553. $self._messageText_(aString);
  20554. $self._signal();
  20555. return self;
  20556. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error)});
  20557. },
  20558. args: ["aString"],
  20559. source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal",
  20560. referencedClasses: [],
  20561. messageSends: ["messageText:", "signal"]
  20562. }),
  20563. $globals.Error);
  20564. $core.addMethod(
  20565. $core.method({
  20566. selector: "signalerContext",
  20567. protocol: "accessing",
  20568. fn: function (){
  20569. var self=this,$self=this;
  20570. return $core.withContext(function($ctx1) {
  20571. return $self._signalerContextFrom_($self._context());
  20572. }, function($ctx1) {$ctx1.fill(self,"signalerContext",{},$globals.Error)});
  20573. },
  20574. args: [],
  20575. source: "signalerContext\x0a\x09^ self signalerContextFrom: self context",
  20576. referencedClasses: [],
  20577. messageSends: ["signalerContextFrom:", "context"]
  20578. }),
  20579. $globals.Error);
  20580. $core.addMethod(
  20581. $core.method({
  20582. selector: "signalerContextFrom:",
  20583. protocol: "accessing",
  20584. fn: function (aContext){
  20585. var self=this,$self=this;
  20586. return $core.withContext(function($ctx1) {
  20587. var $3,$2,$1;
  20588. return $recv(aContext)._findContextSuchThat_((function(context){
  20589. return $core.withContext(function($ctx2) {
  20590. $3=$recv(context)._receiver();
  20591. $ctx2.sendIdx["receiver"]=1;
  20592. $2=$recv($3).__eq_eq(self);
  20593. $ctx2.sendIdx["=="]=1;
  20594. $1=$recv($2)._or_((function(){
  20595. return $core.withContext(function($ctx3) {
  20596. return $recv($recv(context)._receiver()).__eq_eq($self._class());
  20597. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  20598. }));
  20599. return $recv($1)._not();
  20600. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  20601. }));
  20602. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Error)});
  20603. },
  20604. args: ["aContext"],
  20605. source: "signalerContextFrom: aContext\x0a\x09\x22Find the first sender of signal(:), the first context which is neither \x0a\x09for an instance method nor for a class side method of Exception (or subclass).\x0a\x09This will make sure that the same context is found for both, `Error signal` \x0a\x09and `Error new signal`\x22\x0a\x0a\x09^ aContext findContextSuchThat: [ :context |\x0a\x09\x09(context receiver == self \x0a\x09\x09or: [ context receiver == self class ]) not ]",
  20606. referencedClasses: [],
  20607. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class"]
  20608. }),
  20609. $globals.Error);
  20610. $core.addMethod(
  20611. $core.method({
  20612. selector: "wasHandled",
  20613. protocol: "testing",
  20614. fn: function (){
  20615. var self=this,$self=this;
  20616. return $core.withContext(function($ctx1) {
  20617. return self.amberHandled || false;
  20618. return self;
  20619. }, function($ctx1) {$ctx1.fill(self,"wasHandled",{},$globals.Error)});
  20620. },
  20621. args: [],
  20622. source: "wasHandled\x0a\x09<inlineJS: 'return self.amberHandled || false'>",
  20623. referencedClasses: [],
  20624. messageSends: []
  20625. }),
  20626. $globals.Error);
  20627. $core.addMethod(
  20628. $core.method({
  20629. selector: "classTag",
  20630. protocol: "accessing",
  20631. fn: function (){
  20632. var self=this,$self=this;
  20633. return "exception";
  20634. },
  20635. args: [],
  20636. source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'exception'",
  20637. referencedClasses: [],
  20638. messageSends: []
  20639. }),
  20640. $globals.Error.a$cls);
  20641. $core.addMethod(
  20642. $core.method({
  20643. selector: "signal",
  20644. protocol: "instance creation",
  20645. fn: function (){
  20646. var self=this,$self=this;
  20647. return $core.withContext(function($ctx1) {
  20648. return $recv($self._new())._signal();
  20649. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error.a$cls)});
  20650. },
  20651. args: [],
  20652. source: "signal\x0a\x09^ self new signal",
  20653. referencedClasses: [],
  20654. messageSends: ["signal", "new"]
  20655. }),
  20656. $globals.Error.a$cls);
  20657. $core.addMethod(
  20658. $core.method({
  20659. selector: "signal:",
  20660. protocol: "instance creation",
  20661. fn: function (aString){
  20662. var self=this,$self=this;
  20663. return $core.withContext(function($ctx1) {
  20664. return $recv($self._new())._signal_(aString);
  20665. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error.a$cls)});
  20666. },
  20667. args: ["aString"],
  20668. source: "signal: aString\x0a\x09^ self new\x0a\x09\x09signal: aString",
  20669. referencedClasses: [],
  20670. messageSends: ["signal:", "new"]
  20671. }),
  20672. $globals.Error.a$cls);
  20673. $core.addClass("Halt", $globals.Error, [], "Kernel-Exceptions");
  20674. $globals.Halt.comment="I am provided to support `Object>>#halt`.";
  20675. $core.addMethod(
  20676. $core.method({
  20677. selector: "messageText",
  20678. protocol: "accessing",
  20679. fn: function (){
  20680. var self=this,$self=this;
  20681. return "Halt encountered";
  20682. },
  20683. args: [],
  20684. source: "messageText\x0a\x09^ 'Halt encountered'",
  20685. referencedClasses: [],
  20686. messageSends: []
  20687. }),
  20688. $globals.Halt);
  20689. $core.addMethod(
  20690. $core.method({
  20691. selector: "signalerContextFrom:",
  20692. protocol: "accessing",
  20693. fn: function (aContext){
  20694. var self=this,$self=this;
  20695. return $core.withContext(function($ctx1) {
  20696. var $3,$2,$1;
  20697. return $recv(aContext)._findContextSuchThat_((function(context){
  20698. return $core.withContext(function($ctx2) {
  20699. $3=$recv(context)._receiver();
  20700. $ctx2.sendIdx["receiver"]=1;
  20701. $2=$recv($3).__eq_eq(self);
  20702. $ctx2.sendIdx["=="]=1;
  20703. $1=$recv($2)._or_((function(){
  20704. return $core.withContext(function($ctx3) {
  20705. return $recv($recv($recv(context)._receiver()).__eq_eq($self._class()))._or_((function(){
  20706. return $core.withContext(function($ctx4) {
  20707. return $recv($recv($recv(context)._method())._selector()).__eq("halt");
  20708. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  20709. }));
  20710. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  20711. }));
  20712. $ctx2.sendIdx["or:"]=1;
  20713. return $recv($1)._not();
  20714. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  20715. }));
  20716. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Halt)});
  20717. },
  20718. args: ["aContext"],
  20719. source: "signalerContextFrom: aContext\x0a\x09\x22specialized version to find the proper context to open the debugger on.\x0a\x09This will find the first context whose method is no longer on `Halt` or \x0a\x09`Halt class` nor is `#halt` method itself.\x22\x0a\x09\x0a\x09^ aContext findContextSuchThat: [ :context |\x0a\x09\x09(context receiver == self \x0a\x09\x09or: [ (context receiver == self class) \x0a\x09\x09or: [ context method selector = #halt ]]) not ]",
  20720. referencedClasses: [],
  20721. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class", "=", "selector", "method"]
  20722. }),
  20723. $globals.Halt);
  20724. $core.addClass("JavaScriptException", $globals.Error, ["exception"], "Kernel-Exceptions");
  20725. $globals.JavaScriptException.comment="A JavaScriptException is thrown when a non-Smalltalk exception occurs while in the Smalltalk stack.\x0aSee `boot.js` `inContext()` and `BlockClosure >> on:do:`";
  20726. $core.addMethod(
  20727. $core.method({
  20728. selector: "context:",
  20729. protocol: "accessing",
  20730. fn: function (aMethodContext){
  20731. var self=this,$self=this;
  20732. return $core.withContext(function($ctx1) {
  20733. self.context = aMethodContext;
  20734. return self;
  20735. }, function($ctx1) {$ctx1.fill(self,"context:",{aMethodContext:aMethodContext},$globals.JavaScriptException)});
  20736. },
  20737. args: ["aMethodContext"],
  20738. source: "context: aMethodContext\x0a\x09\x22Set the context from the outside.\x0a\x09See boot.js `inContext()` exception handling\x22\x0a\x09\x0a\x09<inlineJS: 'self.context = aMethodContext'>",
  20739. referencedClasses: [],
  20740. messageSends: []
  20741. }),
  20742. $globals.JavaScriptException);
  20743. $core.addMethod(
  20744. $core.method({
  20745. selector: "exception",
  20746. protocol: "accessing",
  20747. fn: function (){
  20748. var self=this,$self=this;
  20749. return $self["@exception"];
  20750. },
  20751. args: [],
  20752. source: "exception\x0a\x09^ exception",
  20753. referencedClasses: [],
  20754. messageSends: []
  20755. }),
  20756. $globals.JavaScriptException);
  20757. $core.addMethod(
  20758. $core.method({
  20759. selector: "exception:",
  20760. protocol: "accessing",
  20761. fn: function (anException){
  20762. var self=this,$self=this;
  20763. $self["@exception"]=anException;
  20764. return self;
  20765. },
  20766. args: ["anException"],
  20767. source: "exception: anException\x0a\x09exception := anException",
  20768. referencedClasses: [],
  20769. messageSends: []
  20770. }),
  20771. $globals.JavaScriptException);
  20772. $core.addMethod(
  20773. $core.method({
  20774. selector: "messageText",
  20775. protocol: "accessing",
  20776. fn: function (){
  20777. var self=this,$self=this;
  20778. return $core.withContext(function($ctx1) {
  20779. return "JavaScript exception: " + $self["@exception"].toString();
  20780. return self;
  20781. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.JavaScriptException)});
  20782. },
  20783. args: [],
  20784. source: "messageText\x0a\x09<inlineJS: 'return \x22JavaScript exception: \x22 + $self[\x22@exception\x22].toString()'>",
  20785. referencedClasses: [],
  20786. messageSends: []
  20787. }),
  20788. $globals.JavaScriptException);
  20789. $core.addMethod(
  20790. $core.method({
  20791. selector: "shouldBeStubbed",
  20792. protocol: "testing",
  20793. fn: function (){
  20794. var self=this,$self=this;
  20795. return $core.withContext(function($ctx1) {
  20796. return $self["@exception"] instanceof RangeError;
  20797. return self;
  20798. }, function($ctx1) {$ctx1.fill(self,"shouldBeStubbed",{},$globals.JavaScriptException)});
  20799. },
  20800. args: [],
  20801. source: "shouldBeStubbed\x0a\x09<inlineJS: 'return $self[\x22@exception\x22] instanceof RangeError'>",
  20802. referencedClasses: [],
  20803. messageSends: []
  20804. }),
  20805. $globals.JavaScriptException);
  20806. $core.addMethod(
  20807. $core.method({
  20808. selector: "wrap",
  20809. protocol: "error handling",
  20810. fn: function (){
  20811. var self=this,$self=this;
  20812. return $core.withContext(function($ctx1) {
  20813. var $1;
  20814. $recv((function(){
  20815. return $core.withContext(function($ctx2) {
  20816. return $self._signal();
  20817. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20818. }))._tryCatch_((function(){
  20819. return $core.withContext(function($ctx2) {
  20820. $1=$self._shouldBeStubbed();
  20821. if($core.assert($1)){
  20822. return $recv($self._context())._stubToAtMost_((100));
  20823. }
  20824. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  20825. }));
  20826. return self;
  20827. }, function($ctx1) {$ctx1.fill(self,"wrap",{},$globals.JavaScriptException)});
  20828. },
  20829. args: [],
  20830. source: "wrap\x0a\x09[ self signal ] tryCatch:\x0a\x09\x09[ self shouldBeStubbed ifTrue: [ self context stubToAtMost: 100 ] ]",
  20831. referencedClasses: [],
  20832. messageSends: ["tryCatch:", "signal", "ifTrue:", "shouldBeStubbed", "stubToAtMost:", "context"]
  20833. }),
  20834. $globals.JavaScriptException);
  20835. $core.addMethod(
  20836. $core.method({
  20837. selector: "on:",
  20838. protocol: "instance creation",
  20839. fn: function (anException){
  20840. var self=this,$self=this;
  20841. return $core.withContext(function($ctx1) {
  20842. var $1;
  20843. $1=$self._new();
  20844. $recv($1)._exception_(anException);
  20845. return $recv($1)._yourself();
  20846. }, function($ctx1) {$ctx1.fill(self,"on:",{anException:anException},$globals.JavaScriptException.a$cls)});
  20847. },
  20848. args: ["anException"],
  20849. source: "on: anException\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09yourself",
  20850. referencedClasses: [],
  20851. messageSends: ["exception:", "new", "yourself"]
  20852. }),
  20853. $globals.JavaScriptException.a$cls);
  20854. $core.addMethod(
  20855. $core.method({
  20856. selector: "on:context:",
  20857. protocol: "instance creation",
  20858. fn: function (anException,aMethodContext){
  20859. var self=this,$self=this;
  20860. return $core.withContext(function($ctx1) {
  20861. var $1;
  20862. $1=$self._new();
  20863. $recv($1)._exception_(anException);
  20864. $recv($1)._context_(aMethodContext);
  20865. return $recv($1)._yourself();
  20866. }, function($ctx1) {$ctx1.fill(self,"on:context:",{anException:anException,aMethodContext:aMethodContext},$globals.JavaScriptException.a$cls)});
  20867. },
  20868. args: ["anException", "aMethodContext"],
  20869. source: "on: anException context: aMethodContext\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09context: aMethodContext;\x0a\x09\x09yourself",
  20870. referencedClasses: [],
  20871. messageSends: ["exception:", "new", "context:", "yourself"]
  20872. }),
  20873. $globals.JavaScriptException.a$cls);
  20874. $core.addClass("MessageNotUnderstood", $globals.Error, ["message", "receiver"], "Kernel-Exceptions");
  20875. $globals.MessageNotUnderstood.comment="This exception is provided to support `Object>>doesNotUnderstand:`.";
  20876. $core.addMethod(
  20877. $core.method({
  20878. selector: "message",
  20879. protocol: "accessing",
  20880. fn: function (){
  20881. var self=this,$self=this;
  20882. return $self["@message"];
  20883. },
  20884. args: [],
  20885. source: "message\x0a\x09^ message",
  20886. referencedClasses: [],
  20887. messageSends: []
  20888. }),
  20889. $globals.MessageNotUnderstood);
  20890. $core.addMethod(
  20891. $core.method({
  20892. selector: "message:",
  20893. protocol: "accessing",
  20894. fn: function (aMessage){
  20895. var self=this,$self=this;
  20896. $self["@message"]=aMessage;
  20897. return self;
  20898. },
  20899. args: ["aMessage"],
  20900. source: "message: aMessage\x0a\x09message := aMessage",
  20901. referencedClasses: [],
  20902. messageSends: []
  20903. }),
  20904. $globals.MessageNotUnderstood);
  20905. $core.addMethod(
  20906. $core.method({
  20907. selector: "messageText",
  20908. protocol: "accessing",
  20909. fn: function (){
  20910. var self=this,$self=this;
  20911. return $core.withContext(function($ctx1) {
  20912. var $1;
  20913. $1=$recv($recv($recv($self._receiver())._asString()).__comma(" does not understand #")).__comma($recv($self._message())._selector());
  20914. $ctx1.sendIdx[","]=1;
  20915. return $1;
  20916. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.MessageNotUnderstood)});
  20917. },
  20918. args: [],
  20919. source: "messageText\x0a\x09^ self receiver asString, ' does not understand #', self message selector",
  20920. referencedClasses: [],
  20921. messageSends: [",", "asString", "receiver", "selector", "message"]
  20922. }),
  20923. $globals.MessageNotUnderstood);
  20924. $core.addMethod(
  20925. $core.method({
  20926. selector: "receiver",
  20927. protocol: "accessing",
  20928. fn: function (){
  20929. var self=this,$self=this;
  20930. return $self["@receiver"];
  20931. },
  20932. args: [],
  20933. source: "receiver\x0a\x09^ receiver",
  20934. referencedClasses: [],
  20935. messageSends: []
  20936. }),
  20937. $globals.MessageNotUnderstood);
  20938. $core.addMethod(
  20939. $core.method({
  20940. selector: "receiver:",
  20941. protocol: "accessing",
  20942. fn: function (anObject){
  20943. var self=this,$self=this;
  20944. $self["@receiver"]=anObject;
  20945. return self;
  20946. },
  20947. args: ["anObject"],
  20948. source: "receiver: anObject\x0a\x09receiver := anObject",
  20949. referencedClasses: [],
  20950. messageSends: []
  20951. }),
  20952. $globals.MessageNotUnderstood);
  20953. $core.addClass("NonBooleanReceiver", $globals.Error, ["object"], "Kernel-Exceptions");
  20954. $globals.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver.";
  20955. $core.addMethod(
  20956. $core.method({
  20957. selector: "object",
  20958. protocol: "accessing",
  20959. fn: function (){
  20960. var self=this,$self=this;
  20961. return $self["@object"];
  20962. },
  20963. args: [],
  20964. source: "object\x0a\x09^ object",
  20965. referencedClasses: [],
  20966. messageSends: []
  20967. }),
  20968. $globals.NonBooleanReceiver);
  20969. $core.addMethod(
  20970. $core.method({
  20971. selector: "object:",
  20972. protocol: "accessing",
  20973. fn: function (anObject){
  20974. var self=this,$self=this;
  20975. $self["@object"]=anObject;
  20976. return self;
  20977. },
  20978. args: ["anObject"],
  20979. source: "object: anObject\x0a\x09object := anObject",
  20980. referencedClasses: [],
  20981. messageSends: []
  20982. }),
  20983. $globals.NonBooleanReceiver);
  20984. $core.addMethod(
  20985. $core.method({
  20986. selector: "signalOn:",
  20987. protocol: "instance creation",
  20988. fn: function (anObject){
  20989. var self=this,$self=this;
  20990. return $core.withContext(function($ctx1) {
  20991. var $1;
  20992. $1=$self._new();
  20993. $recv($1)._object_(anObject);
  20994. return $recv($1)._signal();
  20995. }, function($ctx1) {$ctx1.fill(self,"signalOn:",{anObject:anObject},$globals.NonBooleanReceiver.a$cls)});
  20996. },
  20997. args: ["anObject"],
  20998. source: "signalOn: anObject\x0a\x09^ self new\x0a\x09\x09object: anObject;\x0a\x09\x09signal",
  20999. referencedClasses: [],
  21000. messageSends: ["object:", "new", "signal"]
  21001. }),
  21002. $globals.NonBooleanReceiver.a$cls);
  21003. });
  21004. define('amber_core/Kernel-Promises',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  21005. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  21006. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  21007. var $pkg = $core.addPackage("Kernel-Promises");
  21008. $pkg.innerEval = function (expr) { return eval(expr); };
  21009. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  21010. $core.addClass("Promise", $globals.Object, [], "Kernel-Promises");
  21011. $core.addMethod(
  21012. $core.method({
  21013. selector: "all:",
  21014. protocol: "composites",
  21015. fn: function (aCollection){
  21016. var self=this,$self=this;
  21017. return $core.withContext(function($ctx1) {
  21018. return Promise.all($recv(aCollection)._asArray());
  21019. return self;
  21020. }, function($ctx1) {$ctx1.fill(self,"all:",{aCollection:aCollection},$globals.Promise.a$cls)});
  21021. },
  21022. args: ["aCollection"],
  21023. source: "all: aCollection\x0a\x22Returns a Promise resolved with results of sub-promises.\x22\x0a<inlineJS: 'return Promise.all($recv(aCollection)._asArray())'>",
  21024. referencedClasses: [],
  21025. messageSends: []
  21026. }),
  21027. $globals.Promise.a$cls);
  21028. $core.addMethod(
  21029. $core.method({
  21030. selector: "any:",
  21031. protocol: "composites",
  21032. fn: function (aCollection){
  21033. var self=this,$self=this;
  21034. return $core.withContext(function($ctx1) {
  21035. return Promise.race($recv(aCollection)._asArray());
  21036. return self;
  21037. }, function($ctx1) {$ctx1.fill(self,"any:",{aCollection:aCollection},$globals.Promise.a$cls)});
  21038. },
  21039. args: ["aCollection"],
  21040. source: "any: aCollection\x0a\x22Returns a Promise resolved with first result of sub-promises.\x22\x0a<inlineJS: 'return Promise.race($recv(aCollection)._asArray())'>",
  21041. referencedClasses: [],
  21042. messageSends: []
  21043. }),
  21044. $globals.Promise.a$cls);
  21045. $core.addMethod(
  21046. $core.method({
  21047. selector: "forBlock:",
  21048. protocol: "instance creation",
  21049. fn: function (aBlock){
  21050. var self=this,$self=this;
  21051. return $core.withContext(function($ctx1) {
  21052. return $recv($self._new())._then_(aBlock);
  21053. }, function($ctx1) {$ctx1.fill(self,"forBlock:",{aBlock:aBlock},$globals.Promise.a$cls)});
  21054. },
  21055. args: ["aBlock"],
  21056. source: "forBlock: aBlock\x0a\x22Returns a Promise that is resolved with the value of aBlock,\x0aand rejected if error happens while evaluating aBlock.\x22\x0a\x09^ self new then: aBlock",
  21057. referencedClasses: [],
  21058. messageSends: ["then:", "new"]
  21059. }),
  21060. $globals.Promise.a$cls);
  21061. $core.addMethod(
  21062. $core.method({
  21063. selector: "new",
  21064. protocol: "instance creation",
  21065. fn: function (){
  21066. var self=this,$self=this;
  21067. return $core.withContext(function($ctx1) {
  21068. return Promise.resolve();
  21069. return self;
  21070. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Promise.a$cls)});
  21071. },
  21072. args: [],
  21073. source: "new\x0a\x22Returns a dumb Promise resolved with nil.\x22\x0a<inlineJS: 'return Promise.resolve()'>",
  21074. referencedClasses: [],
  21075. messageSends: []
  21076. }),
  21077. $globals.Promise.a$cls);
  21078. $core.addMethod(
  21079. $core.method({
  21080. selector: "new:",
  21081. protocol: "instance creation",
  21082. fn: function (aBlock){
  21083. var self=this,$self=this;
  21084. return $core.withContext(function($ctx1) {
  21085. return new Promise(function (resolve, reject) {
  21086. var model = {value: resolve, signal: reject};
  21087. aBlock._value_(model);
  21088. });
  21089. return self;
  21090. }, function($ctx1) {$ctx1.fill(self,"new:",{aBlock:aBlock},$globals.Promise.a$cls)});
  21091. },
  21092. args: ["aBlock"],
  21093. source: "new: aBlock\x0a\x22Returns a Promise that is eventually resolved or rejected.\x0aPass a block that is called with one argument, model.\x0aYou should call model value: ... to resolve the promise\x0aand model signal: ... to reject the promise.\x0aIf error happens during run of the block,\x0apromise is rejected with that error as well.\x22\x0a<inlineJS: 'return new Promise(function (resolve, reject) {\x0a var model = {value: resolve, signal: reject};\x0a aBlock._value_(model);\x0a})'>",
  21094. referencedClasses: [],
  21095. messageSends: []
  21096. }),
  21097. $globals.Promise.a$cls);
  21098. $core.addMethod(
  21099. $core.method({
  21100. selector: "signal:",
  21101. protocol: "instance creation",
  21102. fn: function (anObject){
  21103. var self=this,$self=this;
  21104. return $core.withContext(function($ctx1) {
  21105. return $recv(anObject)._in_(function (x) {return Promise.reject(x)});
  21106. return self;
  21107. }, function($ctx1) {$ctx1.fill(self,"signal:",{anObject:anObject},$globals.Promise.a$cls)});
  21108. },
  21109. args: ["anObject"],
  21110. source: "signal: anObject\x0a\x22Returns a Promise rejected with anObject.\x22\x0a<inlineJS: 'return $recv(anObject)._in_(function (x) {return Promise.reject(x)})'>",
  21111. referencedClasses: [],
  21112. messageSends: []
  21113. }),
  21114. $globals.Promise.a$cls);
  21115. $core.addMethod(
  21116. $core.method({
  21117. selector: "value:",
  21118. protocol: "instance creation",
  21119. fn: function (anObject){
  21120. var self=this,$self=this;
  21121. return $core.withContext(function($ctx1) {
  21122. return $recv(anObject)._in_(function (x) {return Promise.resolve(x)});
  21123. return self;
  21124. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.Promise.a$cls)});
  21125. },
  21126. args: ["anObject"],
  21127. source: "value: anObject\x0a\x22Returns a Promise resolved with anObject.\x22\x0a<inlineJS: 'return $recv(anObject)._in_(function (x) {return Promise.resolve(x)})'>",
  21128. referencedClasses: [],
  21129. messageSends: []
  21130. }),
  21131. $globals.Promise.a$cls);
  21132. $core.addTrait("TThenable", "Kernel-Promises");
  21133. $core.addMethod(
  21134. $core.method({
  21135. selector: "catch:",
  21136. protocol: "promises",
  21137. fn: function (aBlock){
  21138. var self=this,$self=this;
  21139. return $core.withContext(function($ctx1) {
  21140. return self.then(null, function (err) {return $core.seamless(function () {
  21141. return aBlock._value_(err);
  21142. })});
  21143. return self;
  21144. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock},$globals.TThenable)});
  21145. },
  21146. args: ["aBlock"],
  21147. source: "catch: aBlock\x0a<inlineJS: 'return self.then(null, function (err) {return $core.seamless(function () {\x0a return aBlock._value_(err);\x0a})})'>",
  21148. referencedClasses: [],
  21149. messageSends: []
  21150. }),
  21151. $globals.TThenable);
  21152. $core.addMethod(
  21153. $core.method({
  21154. selector: "on:do:",
  21155. protocol: "promises",
  21156. fn: function (aClass,aBlock){
  21157. var self=this,$self=this;
  21158. return $core.withContext(function($ctx1) {
  21159. return self.then(null, function (err) {return $core.seamless(function () {
  21160. if (err._isKindOf_(aClass)) return aBlock._value_(err);
  21161. else throw err;
  21162. })});
  21163. return self;
  21164. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.TThenable)});
  21165. },
  21166. args: ["aClass", "aBlock"],
  21167. source: "on: aClass do: aBlock\x0a<inlineJS: 'return self.then(null, function (err) {return $core.seamless(function () {\x0a if (err._isKindOf_(aClass)) return aBlock._value_(err);\x0a else throw err;\x0a})})'>",
  21168. referencedClasses: [],
  21169. messageSends: []
  21170. }),
  21171. $globals.TThenable);
  21172. $core.addMethod(
  21173. $core.method({
  21174. selector: "on:do:catch:",
  21175. protocol: "promises",
  21176. fn: function (aClass,aBlock,anotherBlock){
  21177. var self=this,$self=this;
  21178. return $core.withContext(function($ctx1) {
  21179. return $recv($self._on_do_(aClass,aBlock))._catch_(anotherBlock);
  21180. }, function($ctx1) {$ctx1.fill(self,"on:do:catch:",{aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.TThenable)});
  21181. },
  21182. args: ["aClass", "aBlock", "anotherBlock"],
  21183. source: "on: aClass do: aBlock catch: anotherBlock\x0a\x09^ (self on: aClass do: aBlock) catch: anotherBlock",
  21184. referencedClasses: [],
  21185. messageSends: ["catch:", "on:do:"]
  21186. }),
  21187. $globals.TThenable);
  21188. $core.addMethod(
  21189. $core.method({
  21190. selector: "then:",
  21191. protocol: "promises",
  21192. fn: function (aBlockOrArray){
  21193. var self=this,$self=this;
  21194. return $core.withContext(function($ctx1) {
  21195. var array = Array.isArray(aBlockOrArray) ? aBlockOrArray : [aBlockOrArray];
  21196. return array.reduce(function (soFar, aBlock) {
  21197. return soFar.then(typeof aBlock === "function" && aBlock.length > 1 ?
  21198. function (result) {return $core.seamless(function () {
  21199. if (Array.isArray(result)) {
  21200. return aBlock._valueWithPossibleArguments_([result].concat(result.slice(0, aBlock.length-1)));
  21201. } else {
  21202. return aBlock._value_(result);
  21203. }
  21204. })} :
  21205. function (result) {return $core.seamless(function () {
  21206. return aBlock._value_(result);
  21207. })}
  21208. );
  21209. }, self);
  21210. return self;
  21211. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray},$globals.TThenable)});
  21212. },
  21213. args: ["aBlockOrArray"],
  21214. source: "then: aBlockOrArray\x0a\x22Accepts a block or array of blocks.\x0aEach of blocks in the array or the singleton one is\x0aused in .then call to a promise, to accept a result\x0aand transform it to the result for the next one.\x0aIn case a block has more than one argument\x0aand result is an array, first n-1 elements of the array\x0aare put into additional arguments beyond the first.\x0aThe first argument always contains the result as-is.\x22\x0a<inlineJS: '\x0avar array = Array.isArray(aBlockOrArray) ? aBlockOrArray : [aBlockOrArray];\x0areturn array.reduce(function (soFar, aBlock) {\x0a return soFar.then(typeof aBlock === \x22function\x22 && aBlock.length > 1 ?\x0a function (result) {return $core.seamless(function () {\x0a if (Array.isArray(result)) {\x0a return aBlock._valueWithPossibleArguments_([result].concat(result.slice(0, aBlock.length-1)));\x0a } else {\x0a return aBlock._value_(result);\x0a }\x0a })} :\x0a function (result) {return $core.seamless(function () {\x0a return aBlock._value_(result);\x0a })}\x0a );\x0a}, self)'>",
  21215. referencedClasses: [],
  21216. messageSends: []
  21217. }),
  21218. $globals.TThenable);
  21219. $core.addMethod(
  21220. $core.method({
  21221. selector: "then:catch:",
  21222. protocol: "promises",
  21223. fn: function (aBlockOrArray,anotherBlock){
  21224. var self=this,$self=this;
  21225. return $core.withContext(function($ctx1) {
  21226. return $recv($self._then_(aBlockOrArray))._catch_(anotherBlock);
  21227. }, function($ctx1) {$ctx1.fill(self,"then:catch:",{aBlockOrArray:aBlockOrArray,anotherBlock:anotherBlock},$globals.TThenable)});
  21228. },
  21229. args: ["aBlockOrArray", "anotherBlock"],
  21230. source: "then: aBlockOrArray catch: anotherBlock\x0a\x09^ (self then: aBlockOrArray) catch: anotherBlock",
  21231. referencedClasses: [],
  21232. messageSends: ["catch:", "then:"]
  21233. }),
  21234. $globals.TThenable);
  21235. $core.addMethod(
  21236. $core.method({
  21237. selector: "then:on:do:",
  21238. protocol: "promises",
  21239. fn: function (aBlockOrArray,aClass,aBlock){
  21240. var self=this,$self=this;
  21241. return $core.withContext(function($ctx1) {
  21242. return $recv($self._then_(aBlockOrArray))._on_do_(aClass,aBlock);
  21243. }, function($ctx1) {$ctx1.fill(self,"then:on:do:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock},$globals.TThenable)});
  21244. },
  21245. args: ["aBlockOrArray", "aClass", "aBlock"],
  21246. source: "then: aBlockOrArray on: aClass do: aBlock\x0a\x09^ (self then: aBlockOrArray) on: aClass do: aBlock",
  21247. referencedClasses: [],
  21248. messageSends: ["on:do:", "then:"]
  21249. }),
  21250. $globals.TThenable);
  21251. $core.addMethod(
  21252. $core.method({
  21253. selector: "then:on:do:catch:",
  21254. protocol: "promises",
  21255. fn: function (aBlockOrArray,aClass,aBlock,anotherBlock){
  21256. var self=this,$self=this;
  21257. return $core.withContext(function($ctx1) {
  21258. return $recv($recv($self._then_(aBlockOrArray))._on_do_(aClass,aBlock))._catch_(anotherBlock);
  21259. }, function($ctx1) {$ctx1.fill(self,"then:on:do:catch:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.TThenable)});
  21260. },
  21261. args: ["aBlockOrArray", "aClass", "aBlock", "anotherBlock"],
  21262. source: "then: aBlockOrArray on: aClass do: aBlock catch: anotherBlock\x0a\x09^ ((self then: aBlockOrArray) on: aClass do: aBlock) catch: anotherBlock",
  21263. referencedClasses: [],
  21264. messageSends: ["catch:", "on:do:", "then:"]
  21265. }),
  21266. $globals.TThenable);
  21267. $core.setTraitComposition([{trait: $globals.TThenable}], $globals.Promise);
  21268. });
  21269. define('amber_core/Kernel-Infrastructure',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Objects", "amber_core/Kernel-Promises"], function($boot){"use strict";
  21270. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  21271. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  21272. var $pkg = $core.addPackage("Kernel-Infrastructure");
  21273. $pkg.innerEval = function (expr) { return eval(expr); };
  21274. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  21275. $core.addClass("AmberBootstrapInitialization", $globals.Object, [], "Kernel-Infrastructure");
  21276. $core.addMethod(
  21277. $core.method({
  21278. selector: "organizeClasses",
  21279. protocol: "organization",
  21280. fn: function (){
  21281. var self=this,$self=this;
  21282. return $core.withContext(function($ctx1) {
  21283. $recv($recv($globals.Smalltalk)._classes())._do_((function(each){
  21284. return $core.withContext(function($ctx2) {
  21285. return $recv(each)._enterOrganization();
  21286. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21287. }));
  21288. return self;
  21289. }, function($ctx1) {$ctx1.fill(self,"organizeClasses",{},$globals.AmberBootstrapInitialization.a$cls)});
  21290. },
  21291. args: [],
  21292. source: "organizeClasses\x0a\x09Smalltalk classes do: [ :each | each enterOrganization ]",
  21293. referencedClasses: ["Smalltalk"],
  21294. messageSends: ["do:", "classes", "enterOrganization"]
  21295. }),
  21296. $globals.AmberBootstrapInitialization.a$cls);
  21297. $core.addMethod(
  21298. $core.method({
  21299. selector: "organizeMethods",
  21300. protocol: "organization",
  21301. fn: function (){
  21302. var self=this,$self=this;
  21303. return $core.withContext(function($ctx1) {
  21304. $recv($recv($globals.Smalltalk)._classes())._do_((function(eachClass){
  21305. return $core.withContext(function($ctx2) {
  21306. return $recv($recv(eachClass)._definedMethods())._do_((function(eachMethod){
  21307. return $core.withContext(function($ctx3) {
  21308. return $recv($recv(eachMethod)._methodClass())._methodOrganizationEnter_andLeave_(eachMethod,nil);
  21309. }, function($ctx3) {$ctx3.fillBlock({eachMethod:eachMethod},$ctx2,2)});
  21310. }));
  21311. }, function($ctx2) {$ctx2.fillBlock({eachClass:eachClass},$ctx1,1)});
  21312. }));
  21313. $ctx1.sendIdx["do:"]=1;
  21314. return self;
  21315. }, function($ctx1) {$ctx1.fill(self,"organizeMethods",{},$globals.AmberBootstrapInitialization.a$cls)});
  21316. },
  21317. args: [],
  21318. source: "organizeMethods\x0a\x09Smalltalk classes do: [ :eachClass |\x0a\x09\x09eachClass definedMethods do: [ :eachMethod |\x0a\x09\x09\x09eachMethod methodClass methodOrganizationEnter: eachMethod andLeave: nil ] ]",
  21319. referencedClasses: ["Smalltalk"],
  21320. messageSends: ["do:", "classes", "definedMethods", "methodOrganizationEnter:andLeave:", "methodClass"]
  21321. }),
  21322. $globals.AmberBootstrapInitialization.a$cls);
  21323. $core.addMethod(
  21324. $core.method({
  21325. selector: "run",
  21326. protocol: "public api",
  21327. fn: function (){
  21328. var self=this,$self=this;
  21329. return $core.withContext(function($ctx1) {
  21330. $recv($globals.SmalltalkImage)._initialize();
  21331. $self._organizeClasses();
  21332. $self._organizeMethods();
  21333. return $recv($globals.Smalltalk)._postLoad();
  21334. }, function($ctx1) {$ctx1.fill(self,"run",{},$globals.AmberBootstrapInitialization.a$cls)});
  21335. },
  21336. args: [],
  21337. source: "run\x0a\x09SmalltalkImage initialize.\x0a\x09self\x0a\x09\x09organizeClasses;\x0a\x09\x09organizeMethods.\x0a\x09^ Smalltalk postLoad",
  21338. referencedClasses: ["SmalltalkImage", "Smalltalk"],
  21339. messageSends: ["initialize", "organizeClasses", "organizeMethods", "postLoad"]
  21340. }),
  21341. $globals.AmberBootstrapInitialization.a$cls);
  21342. $core.addClass("JSObjectProxy", $globals.ProtoObject, ["jsObject"], "Kernel-Infrastructure");
  21343. $globals.JSObjectProxy.comment="I handle sending messages to JavaScript objects, making JavaScript object accessing from Amber fully transparent.\x0aMy instances make intensive use of `#doesNotUnderstand:`.\x0a\x0aMy instances are automatically created by Amber whenever a message is sent to a JavaScript object.\x0a\x0a## Usage examples\x0a\x0aJSObjectProxy objects are instanciated by Amber when a Smalltalk message is sent to a JavaScript object.\x0a\x0a\x09window alert: 'hello world'.\x0a\x09window inspect.\x0a\x09(window jQuery: 'body') append: 'hello world'\x0a\x0aAmber messages sends are converted to JavaScript function calls or object property access _(in this order)_. If n one of them match, a `MessageNotUnderstood` error will be thrown.\x0a\x0a## Message conversion rules\x0a\x0a- `someUser name` becomes `someUser.name`\x0a- `someUser name: 'John'` becomes `someUser name = \x22John\x22`\x0a- `console log: 'hello world'` becomes `console.log('hello world')`\x0a- `(window jQuery: 'foo') css: 'background' color: 'red'` becomes `window.jQuery('foo').css('background', 'red')`\x0a\x0a__Note:__ For keyword-based messages, only the first keyword is kept: `window foo: 1 bar: 2` is equivalent to `window foo: 1 baz: 2`.";
  21344. $core.addMethod(
  21345. $core.method({
  21346. selector: "=",
  21347. protocol: "comparing",
  21348. fn: function (anObject){
  21349. var self=this,$self=this;
  21350. return $core.withContext(function($ctx1) {
  21351. var $2,$1;
  21352. $2=$recv(anObject)._class();
  21353. $ctx1.sendIdx["class"]=1;
  21354. $1=$recv($2).__eq_eq($self._class());
  21355. if(!$core.assert($1)){
  21356. return false;
  21357. }
  21358. return $recv($globals.JSObjectProxy)._compareJSObjectOfProxy_withProxy_(self,anObject);
  21359. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.JSObjectProxy)});
  21360. },
  21361. args: ["anObject"],
  21362. source: "= anObject\x0a\x09anObject class == self class ifFalse: [ ^ false ].\x0a\x09^ JSObjectProxy compareJSObjectOfProxy: self withProxy: anObject",
  21363. referencedClasses: ["JSObjectProxy"],
  21364. messageSends: ["ifFalse:", "==", "class", "compareJSObjectOfProxy:withProxy:"]
  21365. }),
  21366. $globals.JSObjectProxy);
  21367. $core.addMethod(
  21368. $core.method({
  21369. selector: "asJavaScriptObject",
  21370. protocol: "converting",
  21371. fn: function (){
  21372. var self=this,$self=this;
  21373. return $self["@jsObject"];
  21374. },
  21375. args: [],
  21376. source: "asJavaScriptObject\x0a\x09\x22Answers the receiver in a stringify-friendly fashion\x22\x0a\x0a\x09^ jsObject",
  21377. referencedClasses: [],
  21378. messageSends: []
  21379. }),
  21380. $globals.JSObjectProxy);
  21381. $core.addMethod(
  21382. $core.method({
  21383. selector: "at:",
  21384. protocol: "accessing",
  21385. fn: function (aString){
  21386. var self=this,$self=this;
  21387. return $core.withContext(function($ctx1) {
  21388. return $self['@jsObject'][aString];
  21389. return self;
  21390. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},$globals.JSObjectProxy)});
  21391. },
  21392. args: ["aString"],
  21393. source: "at: aString\x0a\x09<inlineJS: 'return $self[''@jsObject''][aString]'>",
  21394. referencedClasses: [],
  21395. messageSends: []
  21396. }),
  21397. $globals.JSObjectProxy);
  21398. $core.addMethod(
  21399. $core.method({
  21400. selector: "at:ifAbsent:",
  21401. protocol: "accessing",
  21402. fn: function (aString,aBlock){
  21403. var self=this,$self=this;
  21404. return $core.withContext(function($ctx1) {
  21405. var obj = $self['@jsObject'];
  21406. return aString in obj ? obj[aString] : aBlock._value();
  21407. ;
  21408. return self;
  21409. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  21410. },
  21411. args: ["aString", "aBlock"],
  21412. source: "at: aString ifAbsent: aBlock\x0a\x09\x22return the aString property or evaluate aBlock if the property is not defined on the object\x22\x0a\x09<inlineJS: '\x0a\x09\x09var obj = $self[''@jsObject''];\x0a\x09\x09return aString in obj ? obj[aString] : aBlock._value();\x0a\x09'>",
  21413. referencedClasses: [],
  21414. messageSends: []
  21415. }),
  21416. $globals.JSObjectProxy);
  21417. $core.addMethod(
  21418. $core.method({
  21419. selector: "at:ifPresent:",
  21420. protocol: "accessing",
  21421. fn: function (aString,aBlock){
  21422. var self=this,$self=this;
  21423. return $core.withContext(function($ctx1) {
  21424. var obj = $self['@jsObject'];
  21425. return aString in obj ? aBlock._value_(obj[aString]) : nil;
  21426. ;
  21427. return self;
  21428. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  21429. },
  21430. args: ["aString", "aBlock"],
  21431. source: "at: aString ifPresent: aBlock\x0a\x09\x22return the evaluation of aBlock with the value if the property is defined or return nil\x22\x0a\x09<inlineJS: '\x0a\x09\x09var obj = $self[''@jsObject''];\x0a\x09\x09return aString in obj ? aBlock._value_(obj[aString]) : nil;\x0a\x09'>",
  21432. referencedClasses: [],
  21433. messageSends: []
  21434. }),
  21435. $globals.JSObjectProxy);
  21436. $core.addMethod(
  21437. $core.method({
  21438. selector: "at:ifPresent:ifAbsent:",
  21439. protocol: "accessing",
  21440. fn: function (aString,aBlock,anotherBlock){
  21441. var self=this,$self=this;
  21442. return $core.withContext(function($ctx1) {
  21443. var obj = $self['@jsObject'];
  21444. return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();
  21445. ;
  21446. return self;
  21447. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  21448. },
  21449. args: ["aString", "aBlock", "anotherBlock"],
  21450. source: "at: aString ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09\x22return the evaluation of aBlock with the value if the property is defined\x0a\x09or return value of anotherBlock\x22\x0a\x09<inlineJS: '\x0a\x09\x09var obj = $self[''@jsObject''];\x0a\x09\x09return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();\x0a\x09'>",
  21451. referencedClasses: [],
  21452. messageSends: []
  21453. }),
  21454. $globals.JSObjectProxy);
  21455. $core.addMethod(
  21456. $core.method({
  21457. selector: "at:put:",
  21458. protocol: "accessing",
  21459. fn: function (aString,anObject){
  21460. var self=this,$self=this;
  21461. return $core.withContext(function($ctx1) {
  21462. return $self['@jsObject'][aString] = anObject;
  21463. return self;
  21464. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},$globals.JSObjectProxy)});
  21465. },
  21466. args: ["aString", "anObject"],
  21467. source: "at: aString put: anObject\x0a\x09<inlineJS: 'return $self[''@jsObject''][aString] = anObject'>",
  21468. referencedClasses: [],
  21469. messageSends: []
  21470. }),
  21471. $globals.JSObjectProxy);
  21472. $core.addMethod(
  21473. $core.method({
  21474. selector: "catch:",
  21475. protocol: "promises",
  21476. fn: function (aBlock){
  21477. var self=this,$self=this;
  21478. return $core.withContext(function($ctx1) {
  21479. var $1,$2;
  21480. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  21481. if($core.assert($1)){
  21482. return $recv($recv($globals.TThenable).__gt_gt("catch:"))._sendTo_arguments_($self["@jsObject"],[aBlock]);
  21483. } else {
  21484. $2=(
  21485. $ctx1.supercall = true,
  21486. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._catch_.apply($self, [aBlock]));
  21487. $ctx1.supercall = false;
  21488. return $2;
  21489. }
  21490. return self;
  21491. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock},$globals.JSObjectProxy)});
  21492. },
  21493. args: ["aBlock"],
  21494. source: "catch: aBlock\x0a(NativeFunction isNativeFunction: (self at: #then))\x0a\x09ifTrue: [ ^ (TThenable >> #catch:) sendTo: jsObject arguments: {aBlock} ]\x0a\x09ifFalse: [ ^ super catch: aBlock ]",
  21495. referencedClasses: ["NativeFunction", "TThenable"],
  21496. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "catch:"]
  21497. }),
  21498. $globals.JSObjectProxy);
  21499. $core.addMethod(
  21500. $core.method({
  21501. selector: "doesNotUnderstand:",
  21502. protocol: "proxy",
  21503. fn: function (aMessage){
  21504. var self=this,$self=this;
  21505. return $core.withContext(function($ctx1) {
  21506. var $1,$receiver;
  21507. $1=$recv($globals.JSObjectProxy)._lookupProperty_ofProxy_($recv($recv(aMessage)._selector())._asJavaScriptPropertyName(),self);
  21508. if(($receiver = $1) == null || $receiver.a$nil){
  21509. return (
  21510. $ctx1.supercall = true,
  21511. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._doesNotUnderstand_.apply($self, [aMessage]));
  21512. $ctx1.supercall = false;
  21513. } else {
  21514. var jsSelector;
  21515. jsSelector=$receiver;
  21516. return $recv($globals.JSObjectProxy)._forwardMessage_withArguments_ofProxy_(jsSelector,$recv(aMessage)._arguments(),self);
  21517. }
  21518. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.JSObjectProxy)});
  21519. },
  21520. args: ["aMessage"],
  21521. source: "doesNotUnderstand: aMessage\x0a\x09^ (JSObjectProxy lookupProperty: aMessage selector asJavaScriptPropertyName ofProxy: self)\x0a\x09\x09ifNil: [ super doesNotUnderstand: aMessage ]\x0a\x09\x09ifNotNil: [ :jsSelector | \x0a\x09\x09\x09JSObjectProxy \x0a\x09\x09\x09\x09forwardMessage: jsSelector \x0a\x09\x09\x09\x09withArguments: aMessage arguments\x0a\x09\x09\x09\x09ofProxy: self ]",
  21522. referencedClasses: ["JSObjectProxy"],
  21523. messageSends: ["ifNil:ifNotNil:", "lookupProperty:ofProxy:", "asJavaScriptPropertyName", "selector", "doesNotUnderstand:", "forwardMessage:withArguments:ofProxy:", "arguments"]
  21524. }),
  21525. $globals.JSObjectProxy);
  21526. $core.addMethod(
  21527. $core.method({
  21528. selector: "in:",
  21529. protocol: "accessing",
  21530. fn: function (aValuable){
  21531. var self=this,$self=this;
  21532. return $core.withContext(function($ctx1) {
  21533. return $recv(aValuable)._value_($self["@jsObject"]);
  21534. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.JSObjectProxy)});
  21535. },
  21536. args: ["aValuable"],
  21537. source: "in: aValuable\x0a\x09^ aValuable value: jsObject",
  21538. referencedClasses: [],
  21539. messageSends: ["value:"]
  21540. }),
  21541. $globals.JSObjectProxy);
  21542. $core.addMethod(
  21543. $core.method({
  21544. selector: "jsObject",
  21545. protocol: "accessing",
  21546. fn: function (){
  21547. var self=this,$self=this;
  21548. return $self["@jsObject"];
  21549. },
  21550. args: [],
  21551. source: "jsObject\x0a\x09^ jsObject",
  21552. referencedClasses: [],
  21553. messageSends: []
  21554. }),
  21555. $globals.JSObjectProxy);
  21556. $core.addMethod(
  21557. $core.method({
  21558. selector: "keysAndValuesDo:",
  21559. protocol: "enumerating",
  21560. fn: function (aBlock){
  21561. var self=this,$self=this;
  21562. return $core.withContext(function($ctx1) {
  21563. var o = $self['@jsObject'];
  21564. for(var i in o) {
  21565. aBlock._value_value_(i, o[i]);
  21566. }
  21567. ;
  21568. return self;
  21569. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.JSObjectProxy)});
  21570. },
  21571. args: ["aBlock"],
  21572. source: "keysAndValuesDo: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var o = $self[''@jsObject''];\x0a\x09\x09for(var i in o) {\x0a\x09\x09\x09aBlock._value_value_(i, o[i]);\x0a\x09\x09}\x0a\x09'>",
  21573. referencedClasses: [],
  21574. messageSends: []
  21575. }),
  21576. $globals.JSObjectProxy);
  21577. $core.addMethod(
  21578. $core.method({
  21579. selector: "on:do:",
  21580. protocol: "promises",
  21581. fn: function (aClass,aBlock){
  21582. var self=this,$self=this;
  21583. return $core.withContext(function($ctx1) {
  21584. var $1,$2;
  21585. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  21586. if($core.assert($1)){
  21587. return $recv($recv($globals.TThenable).__gt_gt("on:do:"))._sendTo_arguments_($self["@jsObject"],[aClass,aBlock]);
  21588. } else {
  21589. $2=(
  21590. $ctx1.supercall = true,
  21591. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._on_do_.apply($self, [aClass,aBlock]));
  21592. $ctx1.supercall = false;
  21593. return $2;
  21594. }
  21595. return self;
  21596. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.JSObjectProxy)});
  21597. },
  21598. args: ["aClass", "aBlock"],
  21599. source: "on: aClass do: aBlock\x0a(NativeFunction isNativeFunction: (self at: #then))\x0a\x09ifTrue: [ ^ (TThenable >> #on:do:) sendTo: jsObject arguments: {aClass. aBlock} ]\x0a\x09ifFalse: [ ^ super on: aClass do: aBlock ]",
  21600. referencedClasses: ["NativeFunction", "TThenable"],
  21601. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "on:do:"]
  21602. }),
  21603. $globals.JSObjectProxy);
  21604. $core.addMethod(
  21605. $core.method({
  21606. selector: "printOn:",
  21607. protocol: "printing",
  21608. fn: function (aStream){
  21609. var self=this,$self=this;
  21610. return $core.withContext(function($ctx1) {
  21611. $recv(aStream)._nextPutAll_($self._printString());
  21612. return self;
  21613. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.JSObjectProxy)});
  21614. },
  21615. args: ["aStream"],
  21616. source: "printOn: aStream\x0a\x09aStream nextPutAll: self printString",
  21617. referencedClasses: [],
  21618. messageSends: ["nextPutAll:", "printString"]
  21619. }),
  21620. $globals.JSObjectProxy);
  21621. $core.addMethod(
  21622. $core.method({
  21623. selector: "printString",
  21624. protocol: "printing",
  21625. fn: function (){
  21626. var self=this,$self=this;
  21627. return $core.withContext(function($ctx1) {
  21628. var js = $self['@jsObject'];
  21629. return js.toString
  21630. ? js.toString()
  21631. : Object.prototype.toString.call(js)
  21632. ;
  21633. return self;
  21634. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.JSObjectProxy)});
  21635. },
  21636. args: [],
  21637. source: "printString\x0a\x09<inlineJS: '\x0a\x09\x09var js = $self[''@jsObject''];\x0a\x09\x09return js.toString\x0a\x09\x09\x09? js.toString()\x0a\x09\x09\x09: Object.prototype.toString.call(js)\x0a\x09'>",
  21638. referencedClasses: [],
  21639. messageSends: []
  21640. }),
  21641. $globals.JSObjectProxy);
  21642. $core.addMethod(
  21643. $core.method({
  21644. selector: "putOn:",
  21645. protocol: "streaming",
  21646. fn: function (aStream){
  21647. var self=this,$self=this;
  21648. return $core.withContext(function($ctx1) {
  21649. $recv(aStream)._nextPutJSObject_($self["@jsObject"]);
  21650. return self;
  21651. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.JSObjectProxy)});
  21652. },
  21653. args: ["aStream"],
  21654. source: "putOn: aStream\x0a\x09aStream nextPutJSObject: jsObject",
  21655. referencedClasses: [],
  21656. messageSends: ["nextPutJSObject:"]
  21657. }),
  21658. $globals.JSObjectProxy);
  21659. $core.addMethod(
  21660. $core.method({
  21661. selector: "removeKey:",
  21662. protocol: "accessing",
  21663. fn: function (aString){
  21664. var self=this,$self=this;
  21665. return $core.withContext(function($ctx1) {
  21666. delete $self['@jsObject'][aString]; return aString;
  21667. return self;
  21668. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aString:aString},$globals.JSObjectProxy)});
  21669. },
  21670. args: ["aString"],
  21671. source: "removeKey: aString\x0a\x09<inlineJS: 'delete $self[''@jsObject''][aString]; return aString'>",
  21672. referencedClasses: [],
  21673. messageSends: []
  21674. }),
  21675. $globals.JSObjectProxy);
  21676. $core.addMethod(
  21677. $core.method({
  21678. selector: "then:",
  21679. protocol: "promises",
  21680. fn: function (aBlockOrArray){
  21681. var self=this,$self=this;
  21682. return $core.withContext(function($ctx1) {
  21683. var $1,$2;
  21684. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  21685. if($core.assert($1)){
  21686. return $recv($recv($globals.TThenable).__gt_gt("then:"))._sendTo_arguments_($self["@jsObject"],[aBlockOrArray]);
  21687. } else {
  21688. $2=(
  21689. $ctx1.supercall = true,
  21690. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._then_.apply($self, [aBlockOrArray]));
  21691. $ctx1.supercall = false;
  21692. return $2;
  21693. }
  21694. return self;
  21695. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray},$globals.JSObjectProxy)});
  21696. },
  21697. args: ["aBlockOrArray"],
  21698. source: "then: aBlockOrArray\x0a(NativeFunction isNativeFunction: (self at: #then))\x0a\x09ifTrue: [ ^ (TThenable >> #then:) sendTo: jsObject arguments: {aBlockOrArray} ]\x0a\x09ifFalse: [ ^ super then: aBlockOrArray ]",
  21699. referencedClasses: ["NativeFunction", "TThenable"],
  21700. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "then:"]
  21701. }),
  21702. $globals.JSObjectProxy);
  21703. $core.addMethod(
  21704. $core.method({
  21705. selector: "addObjectVariablesTo:ofProxy:",
  21706. protocol: "proxy",
  21707. fn: function (aDictionary,aProxy){
  21708. var self=this,$self=this;
  21709. return $core.withContext(function($ctx1) {
  21710. var jsObject = aProxy['@jsObject'];
  21711. for(var i in jsObject) {
  21712. aDictionary._at_put_(i, jsObject[i]);
  21713. }
  21714. ;
  21715. return self;
  21716. }, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:ofProxy:",{aDictionary:aDictionary,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21717. },
  21718. args: ["aDictionary", "aProxy"],
  21719. source: "addObjectVariablesTo: aDictionary ofProxy: aProxy\x0a\x09<inlineJS: '\x0a\x09\x09var jsObject = aProxy[''@jsObject''];\x0a\x09\x09for(var i in jsObject) {\x0a\x09\x09\x09aDictionary._at_put_(i, jsObject[i]);\x0a\x09\x09}\x0a\x09'>",
  21720. referencedClasses: [],
  21721. messageSends: []
  21722. }),
  21723. $globals.JSObjectProxy.a$cls);
  21724. $core.addMethod(
  21725. $core.method({
  21726. selector: "compareJSObjectOfProxy:withProxy:",
  21727. protocol: "proxy",
  21728. fn: function (aProxy,anotherProxy){
  21729. var self=this,$self=this;
  21730. return $core.withContext(function($ctx1) {
  21731. var anotherJSObject = anotherProxy.a$cls ? anotherProxy["@jsObject"] : anotherProxy;
  21732. return aProxy["@jsObject"] === anotherJSObject;
  21733. return self;
  21734. }, function($ctx1) {$ctx1.fill(self,"compareJSObjectOfProxy:withProxy:",{aProxy:aProxy,anotherProxy:anotherProxy},$globals.JSObjectProxy.a$cls)});
  21735. },
  21736. args: ["aProxy", "anotherProxy"],
  21737. source: "compareJSObjectOfProxy: aProxy withProxy: anotherProxy\x0a<inlineJS: '\x0a\x09var anotherJSObject = anotherProxy.a$cls ? anotherProxy[\x22@jsObject\x22] : anotherProxy;\x0a\x09return aProxy[\x22@jsObject\x22] === anotherJSObject\x0a'>",
  21738. referencedClasses: [],
  21739. messageSends: []
  21740. }),
  21741. $globals.JSObjectProxy.a$cls);
  21742. $core.addMethod(
  21743. $core.method({
  21744. selector: "forwardMessage:withArguments:ofProxy:",
  21745. protocol: "proxy",
  21746. fn: function (aString,anArray,aProxy){
  21747. var self=this,$self=this;
  21748. return $core.withContext(function($ctx1) {
  21749. return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);
  21750. ;
  21751. return self;
  21752. }, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:ofProxy:",{aString:aString,anArray:anArray,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21753. },
  21754. args: ["aString", "anArray", "aProxy"],
  21755. source: "forwardMessage: aString withArguments: anArray ofProxy: aProxy\x0a\x09<inlineJS: '\x0a\x09\x09return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);\x0a\x09'>",
  21756. referencedClasses: [],
  21757. messageSends: []
  21758. }),
  21759. $globals.JSObjectProxy.a$cls);
  21760. $core.addMethod(
  21761. $core.method({
  21762. selector: "jsObject:ofProxy:",
  21763. protocol: "proxy",
  21764. fn: function (aJSObject,aProxy){
  21765. var self=this,$self=this;
  21766. return $core.withContext(function($ctx1) {
  21767. aProxy['@jsObject'] = aJSObject;
  21768. return self;
  21769. }, function($ctx1) {$ctx1.fill(self,"jsObject:ofProxy:",{aJSObject:aJSObject,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21770. },
  21771. args: ["aJSObject", "aProxy"],
  21772. source: "jsObject: aJSObject ofProxy: aProxy\x0a\x09<inlineJS: 'aProxy[''@jsObject''] = aJSObject'>",
  21773. referencedClasses: [],
  21774. messageSends: []
  21775. }),
  21776. $globals.JSObjectProxy.a$cls);
  21777. $core.addMethod(
  21778. $core.method({
  21779. selector: "lookupProperty:ofProxy:",
  21780. protocol: "proxy",
  21781. fn: function (aString,aProxy){
  21782. var self=this,$self=this;
  21783. return $core.withContext(function($ctx1) {
  21784. return aString in aProxy._jsObject() ? aString : nil;
  21785. return self;
  21786. }, function($ctx1) {$ctx1.fill(self,"lookupProperty:ofProxy:",{aString:aString,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21787. },
  21788. args: ["aString", "aProxy"],
  21789. source: "lookupProperty: aString ofProxy: aProxy\x0a\x09\x22Looks up a property in JS object.\x0a\x09Answer the property if it is present, or nil if it is not present.\x22\x0a\x09\x0a\x09<inlineJS: 'return aString in aProxy._jsObject() ? aString : nil'>",
  21790. referencedClasses: [],
  21791. messageSends: []
  21792. }),
  21793. $globals.JSObjectProxy.a$cls);
  21794. $core.addMethod(
  21795. $core.method({
  21796. selector: "null",
  21797. protocol: "accessing",
  21798. fn: function (){
  21799. var self=this,$self=this;
  21800. return $core.withContext(function($ctx1) {
  21801. return null;
  21802. return self;
  21803. }, function($ctx1) {$ctx1.fill(self,"null",{},$globals.JSObjectProxy.a$cls)});
  21804. },
  21805. args: [],
  21806. source: "null\x0a\x09<inlineJS: 'return null'>",
  21807. referencedClasses: [],
  21808. messageSends: []
  21809. }),
  21810. $globals.JSObjectProxy.a$cls);
  21811. $core.addMethod(
  21812. $core.method({
  21813. selector: "on:",
  21814. protocol: "instance creation",
  21815. fn: function (aJSObject){
  21816. var self=this,$self=this;
  21817. var instance;
  21818. return $core.withContext(function($ctx1) {
  21819. instance=$self._new();
  21820. $self._jsObject_ofProxy_(aJSObject,instance);
  21821. return instance;
  21822. }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject,instance:instance},$globals.JSObjectProxy.a$cls)});
  21823. },
  21824. args: ["aJSObject"],
  21825. source: "on: aJSObject\x0a\x09| instance |\x0a\x09instance := self new.\x0a\x09self jsObject: aJSObject ofProxy: instance.\x0a\x09^ instance",
  21826. referencedClasses: [],
  21827. messageSends: ["new", "jsObject:ofProxy:"]
  21828. }),
  21829. $globals.JSObjectProxy.a$cls);
  21830. $core.addMethod(
  21831. $core.method({
  21832. selector: "undefined",
  21833. protocol: "accessing",
  21834. fn: function (){
  21835. var self=this,$self=this;
  21836. return $core.withContext(function($ctx1) {
  21837. return undefined;
  21838. return self;
  21839. }, function($ctx1) {$ctx1.fill(self,"undefined",{},$globals.JSObjectProxy.a$cls)});
  21840. },
  21841. args: [],
  21842. source: "undefined\x0a\x09<inlineJS: 'return undefined'>",
  21843. referencedClasses: [],
  21844. messageSends: []
  21845. }),
  21846. $globals.JSObjectProxy.a$cls);
  21847. $core.addClass("Organizer", $globals.Object, ["elements"], "Kernel-Infrastructure");
  21848. $globals.Organizer.comment="I represent categorization information. \x0a\x0a## API\x0a\x0aUse `#addElement:` and `#removeElement:` to manipulate instances.";
  21849. $core.addMethod(
  21850. $core.method({
  21851. selector: "addElement:",
  21852. protocol: "accessing",
  21853. fn: function (anObject){
  21854. var self=this,$self=this;
  21855. return $core.withContext(function($ctx1) {
  21856. $recv($self._elements())._add_(anObject);
  21857. return self;
  21858. }, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject},$globals.Organizer)});
  21859. },
  21860. args: ["anObject"],
  21861. source: "addElement: anObject\x0a\x09self elements add: anObject",
  21862. referencedClasses: [],
  21863. messageSends: ["add:", "elements"]
  21864. }),
  21865. $globals.Organizer);
  21866. $core.addMethod(
  21867. $core.method({
  21868. selector: "elements",
  21869. protocol: "accessing",
  21870. fn: function (){
  21871. var self=this,$self=this;
  21872. return $self["@elements"];
  21873. },
  21874. args: [],
  21875. source: "elements\x0a\x09^ elements",
  21876. referencedClasses: [],
  21877. messageSends: []
  21878. }),
  21879. $globals.Organizer);
  21880. $core.addMethod(
  21881. $core.method({
  21882. selector: "initialize",
  21883. protocol: "initialization",
  21884. fn: function (){
  21885. var self=this,$self=this;
  21886. return $core.withContext(function($ctx1) {
  21887. (
  21888. $ctx1.supercall = true,
  21889. ($globals.Organizer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  21890. $ctx1.supercall = false;
  21891. $self["@elements"]=$recv($globals.Set)._new();
  21892. return self;
  21893. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Organizer)});
  21894. },
  21895. args: [],
  21896. source: "initialize\x0a\x09super initialize.\x0a\x09elements := Set new",
  21897. referencedClasses: ["Set"],
  21898. messageSends: ["initialize", "new"]
  21899. }),
  21900. $globals.Organizer);
  21901. $core.addMethod(
  21902. $core.method({
  21903. selector: "removeElement:",
  21904. protocol: "accessing",
  21905. fn: function (anObject){
  21906. var self=this,$self=this;
  21907. return $core.withContext(function($ctx1) {
  21908. $recv($self._elements())._remove_ifAbsent_(anObject,(function(){
  21909. }));
  21910. return self;
  21911. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject},$globals.Organizer)});
  21912. },
  21913. args: ["anObject"],
  21914. source: "removeElement: anObject\x0a\x09self elements remove: anObject ifAbsent: []",
  21915. referencedClasses: [],
  21916. messageSends: ["remove:ifAbsent:", "elements"]
  21917. }),
  21918. $globals.Organizer);
  21919. $core.addClass("ClassOrganizer", $globals.Organizer, ["traitOrBehavior"], "Kernel-Infrastructure");
  21920. $globals.ClassOrganizer.comment="I am an organizer specific to classes. I hold method categorization information for classes.";
  21921. $core.addMethod(
  21922. $core.method({
  21923. selector: "addElement:",
  21924. protocol: "accessing",
  21925. fn: function (aString){
  21926. var self=this,$self=this;
  21927. return $core.withContext(function($ctx1) {
  21928. var $1,$3,$2;
  21929. (
  21930. $ctx1.supercall = true,
  21931. ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._addElement_.apply($self, [aString]));
  21932. $ctx1.supercall = false;
  21933. $1=$recv($globals.SystemAnnouncer)._current();
  21934. $3=$recv($globals.ProtocolAdded)._new();
  21935. $recv($3)._protocol_(aString);
  21936. $recv($3)._theClass_($self._theClass());
  21937. $2=$recv($3)._yourself();
  21938. $recv($1)._announce_($2);
  21939. return self;
  21940. }, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString},$globals.ClassOrganizer)});
  21941. },
  21942. args: ["aString"],
  21943. source: "addElement: aString\x0a\x09super addElement: aString.\x0a\x0a\x09SystemAnnouncer current announce: (ProtocolAdded new\x0a\x09\x09protocol: aString;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09yourself)",
  21944. referencedClasses: ["SystemAnnouncer", "ProtocolAdded"],
  21945. messageSends: ["addElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  21946. }),
  21947. $globals.ClassOrganizer);
  21948. $core.addMethod(
  21949. $core.method({
  21950. selector: "removeElement:",
  21951. protocol: "accessing",
  21952. fn: function (aString){
  21953. var self=this,$self=this;
  21954. return $core.withContext(function($ctx1) {
  21955. var $1,$3,$2;
  21956. (
  21957. $ctx1.supercall = true,
  21958. ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._removeElement_.apply($self, [aString]));
  21959. $ctx1.supercall = false;
  21960. $1=$recv($globals.SystemAnnouncer)._current();
  21961. $3=$recv($globals.ProtocolRemoved)._new();
  21962. $recv($3)._protocol_(aString);
  21963. $recv($3)._theClass_($self._theClass());
  21964. $2=$recv($3)._yourself();
  21965. $recv($1)._announce_($2);
  21966. return self;
  21967. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString},$globals.ClassOrganizer)});
  21968. },
  21969. args: ["aString"],
  21970. source: "removeElement: aString\x0a\x09super removeElement: aString.\x0a\x0a\x09SystemAnnouncer current announce: (ProtocolRemoved new\x0a\x09\x09protocol: aString;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09yourself)",
  21971. referencedClasses: ["SystemAnnouncer", "ProtocolRemoved"],
  21972. messageSends: ["removeElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  21973. }),
  21974. $globals.ClassOrganizer);
  21975. $core.addMethod(
  21976. $core.method({
  21977. selector: "theClass",
  21978. protocol: "accessing",
  21979. fn: function (){
  21980. var self=this,$self=this;
  21981. return $self["@traitOrBehavior"];
  21982. },
  21983. args: [],
  21984. source: "theClass\x0a\x09^ traitOrBehavior",
  21985. referencedClasses: [],
  21986. messageSends: []
  21987. }),
  21988. $globals.ClassOrganizer);
  21989. $core.addMethod(
  21990. $core.method({
  21991. selector: "theClass:",
  21992. protocol: "accessing",
  21993. fn: function (aClass){
  21994. var self=this,$self=this;
  21995. $self["@traitOrBehavior"]=aClass;
  21996. return self;
  21997. },
  21998. args: ["aClass"],
  21999. source: "theClass: aClass\x0a\x09traitOrBehavior := aClass",
  22000. referencedClasses: [],
  22001. messageSends: []
  22002. }),
  22003. $globals.ClassOrganizer);
  22004. $core.addMethod(
  22005. $core.method({
  22006. selector: "on:",
  22007. protocol: "instance creation",
  22008. fn: function (aClass){
  22009. var self=this,$self=this;
  22010. return $core.withContext(function($ctx1) {
  22011. var $1;
  22012. $1=$self._new();
  22013. $recv($1)._theClass_(aClass);
  22014. return $recv($1)._yourself();
  22015. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},$globals.ClassOrganizer.a$cls)});
  22016. },
  22017. args: ["aClass"],
  22018. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  22019. referencedClasses: [],
  22020. messageSends: ["theClass:", "new", "yourself"]
  22021. }),
  22022. $globals.ClassOrganizer.a$cls);
  22023. $core.addClass("PackageOrganizer", $globals.Organizer, [], "Kernel-Infrastructure");
  22024. $globals.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information.";
  22025. $core.addClass("Package", $globals.Object, ["evalBlock", "basicTransport", "name", "transport", "imports", "dirty", "organization", "isReady"], "Kernel-Infrastructure");
  22026. $globals.Package.comment="I am similar to a \x22class category\x22 typically found in other Smalltalks like Pharo or Squeak. Amber does not have class categories anymore, it had in the beginning but now each class in the system knows which package it belongs to.\x0a\x0aEach package has a name and can be queried for its classes, but it will then resort to a reverse scan of all classes to find them.\x0a\x0a## API\x0a\x0aPackages are manipulated through \x22Smalltalk current\x22, like for example finding one based on a name or with `Package class >> #name` directly:\x0a\x0a Smalltalk current packageAt: 'Kernel'\x0a Package named: 'Kernel'\x0a\x0aA package differs slightly from a Monticello package which can span multiple class categories using a naming convention based on hyphenation. But just as in Monticello a package supports \x22class extensions\x22 so a package can define behaviors in foreign classes using a naming convention for method categories where the category starts with an asterisk and then the name of the owning package follows.\x0a\x0aYou can fetch a package from the server:\x0a\x0a\x09Package load: 'Additional-Examples'";
  22027. $core.addMethod(
  22028. $core.method({
  22029. selector: "basicTransport",
  22030. protocol: "private",
  22031. fn: function (){
  22032. var self=this,$self=this;
  22033. return $self["@basicTransport"];
  22034. },
  22035. args: [],
  22036. source: "basicTransport\x0a\x09\x22Answer the transport literal JavaScript object as setup in the JavaScript file, if any\x22\x0a\x09\x0a\x09^ basicTransport",
  22037. referencedClasses: [],
  22038. messageSends: []
  22039. }),
  22040. $globals.Package);
  22041. $core.addMethod(
  22042. $core.method({
  22043. selector: "beClean",
  22044. protocol: "accessing",
  22045. fn: function (){
  22046. var self=this,$self=this;
  22047. return $core.withContext(function($ctx1) {
  22048. var $1,$3,$2;
  22049. $self["@dirty"]=false;
  22050. $1=$recv($globals.SystemAnnouncer)._current();
  22051. $3=$recv($globals.PackageClean)._new();
  22052. $recv($3)._package_(self);
  22053. $2=$recv($3)._yourself();
  22054. $recv($1)._announce_($2);
  22055. return self;
  22056. }, function($ctx1) {$ctx1.fill(self,"beClean",{},$globals.Package)});
  22057. },
  22058. args: [],
  22059. source: "beClean\x0a\x09dirty := false.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageClean new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  22060. referencedClasses: ["SystemAnnouncer", "PackageClean"],
  22061. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  22062. }),
  22063. $globals.Package);
  22064. $core.addMethod(
  22065. $core.method({
  22066. selector: "beDirty",
  22067. protocol: "accessing",
  22068. fn: function (){
  22069. var self=this,$self=this;
  22070. return $core.withContext(function($ctx1) {
  22071. var $1,$3,$2;
  22072. $self["@dirty"]=true;
  22073. $1=$recv($globals.SystemAnnouncer)._current();
  22074. $3=$recv($globals.PackageDirty)._new();
  22075. $recv($3)._package_(self);
  22076. $2=$recv($3)._yourself();
  22077. $recv($1)._announce_($2);
  22078. return self;
  22079. }, function($ctx1) {$ctx1.fill(self,"beDirty",{},$globals.Package)});
  22080. },
  22081. args: [],
  22082. source: "beDirty\x0a\x09dirty := true.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageDirty new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  22083. referencedClasses: ["SystemAnnouncer", "PackageDirty"],
  22084. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  22085. }),
  22086. $globals.Package);
  22087. $core.addMethod(
  22088. $core.method({
  22089. selector: "classTemplate",
  22090. protocol: "accessing",
  22091. fn: function (){
  22092. var self=this,$self=this;
  22093. return $core.withContext(function($ctx1) {
  22094. return $recv($globals.String)._streamContents_((function(stream){
  22095. return $core.withContext(function($ctx2) {
  22096. $recv(stream)._write_("Object subclass: #NameOfSubclass");
  22097. $ctx2.sendIdx["write:"]=1;
  22098. $recv(stream)._lf();
  22099. $ctx2.sendIdx["lf"]=1;
  22100. $recv(stream)._tab();
  22101. $ctx2.sendIdx["tab"]=1;
  22102. $recv(stream)._write_("instanceVariableNames: ''");
  22103. $ctx2.sendIdx["write:"]=2;
  22104. $recv(stream)._lf();
  22105. $recv(stream)._tab();
  22106. $recv(stream)._write_("package: ");
  22107. return $recv(stream)._print_($self._name());
  22108. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  22109. }));
  22110. }, function($ctx1) {$ctx1.fill(self,"classTemplate",{},$globals.Package)});
  22111. },
  22112. args: [],
  22113. source: "classTemplate\x0a\x09^ String streamContents: [ :stream | stream\x0a\x09\x09write: 'Object subclass: #NameOfSubclass'; lf;\x0a\x09\x09tab; write: 'instanceVariableNames: '''''; lf;\x0a\x09\x09tab; write: 'package: '; print: self name ]",
  22114. referencedClasses: ["String"],
  22115. messageSends: ["streamContents:", "write:", "lf", "tab", "print:", "name"]
  22116. }),
  22117. $globals.Package);
  22118. $core.addMethod(
  22119. $core.method({
  22120. selector: "classes",
  22121. protocol: "classes",
  22122. fn: function (){
  22123. var self=this,$self=this;
  22124. return $core.withContext(function($ctx1) {
  22125. return $recv($recv($self._organization())._elements())._copy();
  22126. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Package)});
  22127. },
  22128. args: [],
  22129. source: "classes\x0a\x09^ self organization elements copy",
  22130. referencedClasses: [],
  22131. messageSends: ["copy", "elements", "organization"]
  22132. }),
  22133. $globals.Package);
  22134. $core.addMethod(
  22135. $core.method({
  22136. selector: "definition",
  22137. protocol: "accessing",
  22138. fn: function (){
  22139. var self=this,$self=this;
  22140. return $core.withContext(function($ctx1) {
  22141. var $1;
  22142. return $recv($globals.String)._streamContents_((function(stream){
  22143. return $core.withContext(function($ctx2) {
  22144. $1=$recv($self._class())._name();
  22145. $ctx2.sendIdx["name"]=1;
  22146. $recv(stream)._write_($1);
  22147. $ctx2.sendIdx["write:"]=1;
  22148. $recv(stream)._lf();
  22149. $ctx2.sendIdx["lf"]=1;
  22150. $recv(stream)._tab();
  22151. $ctx2.sendIdx["tab"]=1;
  22152. $recv(stream)._write_("named: ");
  22153. $ctx2.sendIdx["write:"]=2;
  22154. $recv(stream)._print_($self._name());
  22155. $recv(stream)._lf();
  22156. $ctx2.sendIdx["lf"]=2;
  22157. $recv(stream)._tab();
  22158. $ctx2.sendIdx["tab"]=2;
  22159. $recv(stream)._write_(["imports: ",$self._importsDefinition()]);
  22160. $ctx2.sendIdx["write:"]=3;
  22161. $recv(stream)._lf();
  22162. $recv(stream)._tab();
  22163. return $recv(stream)._write_(["transport: (",$recv($self._transport())._definition(),")"]);
  22164. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  22165. }));
  22166. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Package)});
  22167. },
  22168. args: [],
  22169. source: "definition\x0a\x09^ String streamContents: [ :stream | stream\x0a\x09\x09write: self class name; lf;\x0a\x09\x09tab; write: 'named: '; print: self name; lf;\x0a\x09\x09tab; write: { 'imports: '. self importsDefinition }; lf;\x0a\x09\x09tab; write: { 'transport: ('. self transport definition. ')' } ]",
  22170. referencedClasses: ["String"],
  22171. messageSends: ["streamContents:", "write:", "name", "class", "lf", "tab", "print:", "importsDefinition", "definition", "transport"]
  22172. }),
  22173. $globals.Package);
  22174. $core.addMethod(
  22175. $core.method({
  22176. selector: "eval:",
  22177. protocol: "evaluating",
  22178. fn: function (aString){
  22179. var self=this,$self=this;
  22180. return $core.withContext(function($ctx1) {
  22181. var $1,$receiver;
  22182. $1=$self["@evalBlock"];
  22183. if(($receiver = $1) == null || $receiver.a$nil){
  22184. return $recv($globals.Compiler)._eval_(aString);
  22185. } else {
  22186. return $recv($self["@evalBlock"])._value_(aString);
  22187. }
  22188. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Package)});
  22189. },
  22190. args: ["aString"],
  22191. source: "eval: aString\x0a\x09^ evalBlock\x0a\x09\x09ifNotNil: [ evalBlock value: aString ]\x0a\x09\x09ifNil: [ Compiler eval: aString ]",
  22192. referencedClasses: ["Compiler"],
  22193. messageSends: ["ifNotNil:ifNil:", "value:", "eval:"]
  22194. }),
  22195. $globals.Package);
  22196. $core.addMethod(
  22197. $core.method({
  22198. selector: "evalBlock",
  22199. protocol: "accessing",
  22200. fn: function (){
  22201. var self=this,$self=this;
  22202. return $self["@evalBlock"];
  22203. },
  22204. args: [],
  22205. source: "evalBlock\x0a\x09^ evalBlock",
  22206. referencedClasses: [],
  22207. messageSends: []
  22208. }),
  22209. $globals.Package);
  22210. $core.addMethod(
  22211. $core.method({
  22212. selector: "evalBlock:",
  22213. protocol: "accessing",
  22214. fn: function (aBlock){
  22215. var self=this,$self=this;
  22216. $self["@evalBlock"]=aBlock;
  22217. return self;
  22218. },
  22219. args: ["aBlock"],
  22220. source: "evalBlock: aBlock\x0a\x09evalBlock := aBlock",
  22221. referencedClasses: [],
  22222. messageSends: []
  22223. }),
  22224. $globals.Package);
  22225. $core.addMethod(
  22226. $core.method({
  22227. selector: "imports",
  22228. protocol: "accessing",
  22229. fn: function (){
  22230. var self=this,$self=this;
  22231. return $core.withContext(function($ctx1) {
  22232. var $1,$receiver;
  22233. $1=$self["@imports"];
  22234. if(($receiver = $1) == null || $receiver.a$nil){
  22235. $self._imports_([]);
  22236. return $self["@imports"];
  22237. } else {
  22238. return $1;
  22239. }
  22240. }, function($ctx1) {$ctx1.fill(self,"imports",{},$globals.Package)});
  22241. },
  22242. args: [],
  22243. source: "imports\x0a\x09^ imports ifNil: [\x0a\x09\x09self imports: #().\x0a\x09\x09imports ]",
  22244. referencedClasses: [],
  22245. messageSends: ["ifNil:", "imports:"]
  22246. }),
  22247. $globals.Package);
  22248. $core.addMethod(
  22249. $core.method({
  22250. selector: "imports:",
  22251. protocol: "accessing",
  22252. fn: function (anArray){
  22253. var self=this,$self=this;
  22254. return $core.withContext(function($ctx1) {
  22255. $self._validateImports_(anArray);
  22256. $self["@imports"]=$recv(anArray)._asSet();
  22257. return self;
  22258. }, function($ctx1) {$ctx1.fill(self,"imports:",{anArray:anArray},$globals.Package)});
  22259. },
  22260. args: ["anArray"],
  22261. source: "imports: anArray\x0a\x09self validateImports: anArray.\x0a\x09imports := anArray asSet",
  22262. referencedClasses: [],
  22263. messageSends: ["validateImports:", "asSet"]
  22264. }),
  22265. $globals.Package);
  22266. $core.addMethod(
  22267. $core.method({
  22268. selector: "importsAsJson",
  22269. protocol: "converting",
  22270. fn: function (){
  22271. var self=this,$self=this;
  22272. return $core.withContext(function($ctx1) {
  22273. var $1;
  22274. return $recv($self._sortedImportsAsArray())._collect_((function(each){
  22275. return $core.withContext(function($ctx2) {
  22276. $1=$recv(each)._isString();
  22277. if($core.assert($1)){
  22278. return each;
  22279. } else {
  22280. return $recv($recv($recv(each)._key()).__comma("=")).__comma($recv(each)._value());
  22281. $ctx2.sendIdx[","]=1;
  22282. }
  22283. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22284. }));
  22285. }, function($ctx1) {$ctx1.fill(self,"importsAsJson",{},$globals.Package)});
  22286. },
  22287. args: [],
  22288. source: "importsAsJson\x0a\x0a\x09^ self sortedImportsAsArray collect: [ :each |\x0a\x09\x09each isString\x0a\x09\x09\x09ifTrue: [ each ]\x0a\x09\x09\x09ifFalse: [ each key, '=', each value ]]",
  22289. referencedClasses: [],
  22290. messageSends: ["collect:", "sortedImportsAsArray", "ifTrue:ifFalse:", "isString", ",", "key", "value"]
  22291. }),
  22292. $globals.Package);
  22293. $core.addMethod(
  22294. $core.method({
  22295. selector: "importsDefinition",
  22296. protocol: "accessing",
  22297. fn: function (){
  22298. var self=this,$self=this;
  22299. return $core.withContext(function($ctx1) {
  22300. return $recv($globals.String)._streamContents_((function(stream){
  22301. return $core.withContext(function($ctx2) {
  22302. $recv(stream)._write_("{");
  22303. $ctx2.sendIdx["write:"]=1;
  22304. $recv($self._sortedImportsAsArray())._do_separatedBy_((function(each){
  22305. return $core.withContext(function($ctx3) {
  22306. return $recv(stream)._print_(each);
  22307. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  22308. }),(function(){
  22309. return $core.withContext(function($ctx3) {
  22310. return $recv(stream)._write_(". ");
  22311. $ctx3.sendIdx["write:"]=2;
  22312. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  22313. }));
  22314. return $recv(stream)._write_("}");
  22315. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  22316. }));
  22317. }, function($ctx1) {$ctx1.fill(self,"importsDefinition",{},$globals.Package)});
  22318. },
  22319. args: [],
  22320. source: "importsDefinition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream write: '{'.\x0a\x09\x09self sortedImportsAsArray\x0a\x09\x09\x09do: [ :each | stream print: each ]\x0a\x09\x09\x09separatedBy: [ stream write: '. ' ].\x0a\x09\x09stream write: '}' ]",
  22321. referencedClasses: ["String"],
  22322. messageSends: ["streamContents:", "write:", "do:separatedBy:", "sortedImportsAsArray", "print:"]
  22323. }),
  22324. $globals.Package);
  22325. $core.addMethod(
  22326. $core.method({
  22327. selector: "importsFromJson:",
  22328. protocol: "converting",
  22329. fn: function (anArray){
  22330. var self=this,$self=this;
  22331. return $core.withContext(function($ctx1) {
  22332. var $1;
  22333. return $recv(anArray)._collect_((function(each){
  22334. var split;
  22335. return $core.withContext(function($ctx2) {
  22336. split=$recv(each)._tokenize_("=");
  22337. $1=$recv($recv(split)._size()).__eq((1));
  22338. if($core.assert($1)){
  22339. return $recv(split)._first();
  22340. $ctx2.sendIdx["first"]=1;
  22341. } else {
  22342. return $recv($recv(split)._first()).__minus_gt($recv(split)._second());
  22343. }
  22344. }, function($ctx2) {$ctx2.fillBlock({each:each,split:split},$ctx1,1)});
  22345. }));
  22346. }, function($ctx1) {$ctx1.fill(self,"importsFromJson:",{anArray:anArray},$globals.Package)});
  22347. },
  22348. args: ["anArray"],
  22349. source: "importsFromJson: anArray\x0a\x09\x22Parses array of string, eg. #('asdf' 'qwer=tyuo')\x0a\x09into array of Strings and Associations,\x0a\x09eg. {'asdf'. 'qwer'->'tyuo'}\x22\x0a\x0a\x09^ anArray collect: [ :each |\x0a\x09\x09| split |\x0a\x09\x09split := each tokenize: '='.\x0a\x09\x09split size = 1\x0a\x09\x09\x09ifTrue: [ split first ]\x0a\x09\x09\x09ifFalse: [ split first -> split second ]]",
  22350. referencedClasses: [],
  22351. messageSends: ["collect:", "tokenize:", "ifTrue:ifFalse:", "=", "size", "first", "->", "second"]
  22352. }),
  22353. $globals.Package);
  22354. $core.addMethod(
  22355. $core.method({
  22356. selector: "initialize",
  22357. protocol: "initialization",
  22358. fn: function (){
  22359. var self=this,$self=this;
  22360. return $core.withContext(function($ctx1) {
  22361. (
  22362. $ctx1.supercall = true,
  22363. ($globals.Package.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  22364. $ctx1.supercall = false;
  22365. $self["@organization"]=$recv($globals.PackageOrganizer)._new();
  22366. $ctx1.sendIdx["new"]=1;
  22367. $self["@evalBlock"]=nil;
  22368. $self["@dirty"]=nil;
  22369. $self["@imports"]=nil;
  22370. $self["@isReady"]=$recv($globals.Promise)._new();
  22371. $self["@transport"]=nil;
  22372. return self;
  22373. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Package)});
  22374. },
  22375. args: [],
  22376. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09organization := PackageOrganizer new.\x0a\x09evalBlock := nil.\x0a\x09dirty := nil.\x0a\x09imports := nil.\x0a\x09isReady := Promise new.\x0a\x09transport := nil",
  22377. referencedClasses: ["PackageOrganizer", "Promise"],
  22378. messageSends: ["initialize", "new"]
  22379. }),
  22380. $globals.Package);
  22381. $core.addMethod(
  22382. $core.method({
  22383. selector: "isDirty",
  22384. protocol: "testing",
  22385. fn: function (){
  22386. var self=this,$self=this;
  22387. return $core.withContext(function($ctx1) {
  22388. var $1,$receiver;
  22389. $1=$self["@dirty"];
  22390. if(($receiver = $1) == null || $receiver.a$nil){
  22391. return false;
  22392. } else {
  22393. return $1;
  22394. }
  22395. }, function($ctx1) {$ctx1.fill(self,"isDirty",{},$globals.Package)});
  22396. },
  22397. args: [],
  22398. source: "isDirty\x0a\x09^ dirty ifNil: [ false ]",
  22399. referencedClasses: [],
  22400. messageSends: ["ifNil:"]
  22401. }),
  22402. $globals.Package);
  22403. $core.addMethod(
  22404. $core.method({
  22405. selector: "isPackage",
  22406. protocol: "testing",
  22407. fn: function (){
  22408. var self=this,$self=this;
  22409. return true;
  22410. },
  22411. args: [],
  22412. source: "isPackage\x0a\x09^ true",
  22413. referencedClasses: [],
  22414. messageSends: []
  22415. }),
  22416. $globals.Package);
  22417. $core.addMethod(
  22418. $core.method({
  22419. selector: "isReady",
  22420. protocol: "accessing",
  22421. fn: function (){
  22422. var self=this,$self=this;
  22423. return $self["@isReady"];
  22424. },
  22425. args: [],
  22426. source: "isReady\x0a\x09^ isReady",
  22427. referencedClasses: [],
  22428. messageSends: []
  22429. }),
  22430. $globals.Package);
  22431. $core.addMethod(
  22432. $core.method({
  22433. selector: "isReady:",
  22434. protocol: "accessing",
  22435. fn: function (aPromise){
  22436. var self=this,$self=this;
  22437. $self["@isReady"]=aPromise;
  22438. return self;
  22439. },
  22440. args: ["aPromise"],
  22441. source: "isReady: aPromise\x0a\x09isReady := aPromise",
  22442. referencedClasses: [],
  22443. messageSends: []
  22444. }),
  22445. $globals.Package);
  22446. $core.addMethod(
  22447. $core.method({
  22448. selector: "javaScriptDescriptor:",
  22449. protocol: "accessing",
  22450. fn: function (anObject){
  22451. var self=this,$self=this;
  22452. var basicEval,basicImports;
  22453. return $core.withContext(function($ctx1) {
  22454. basicEval=$recv(anObject)._at_ifAbsent_("innerEval",(function(){
  22455. return $core.withContext(function($ctx2) {
  22456. return nil._asJavaScriptObject();
  22457. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22458. }));
  22459. $ctx1.sendIdx["at:ifAbsent:"]=1;
  22460. basicImports=$recv(anObject)._at_ifAbsent_("imports",(function(){
  22461. return [];
  22462. }));
  22463. $ctx1.sendIdx["at:ifAbsent:"]=2;
  22464. $self["@basicTransport"]=$recv(anObject)._at_ifAbsent_("transport",(function(){
  22465. }));
  22466. $recv(anObject)._at_ifPresent_("isReady",(function(aPromise){
  22467. return $core.withContext(function($ctx2) {
  22468. return $self._isReady_(aPromise);
  22469. }, function($ctx2) {$ctx2.fillBlock({aPromise:aPromise},$ctx1,4)});
  22470. }));
  22471. $self._evalBlock_(basicEval);
  22472. $self._imports_($self._importsFromJson_(basicImports));
  22473. return self;
  22474. }, function($ctx1) {$ctx1.fill(self,"javaScriptDescriptor:",{anObject:anObject,basicEval:basicEval,basicImports:basicImports},$globals.Package)});
  22475. },
  22476. args: ["anObject"],
  22477. 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)",
  22478. referencedClasses: [],
  22479. messageSends: ["at:ifAbsent:", "asJavaScriptObject", "at:ifPresent:", "isReady:", "evalBlock:", "imports:", "importsFromJson:"]
  22480. }),
  22481. $globals.Package);
  22482. $core.addMethod(
  22483. $core.method({
  22484. selector: "loadDependencies",
  22485. protocol: "dependencies",
  22486. fn: function (){
  22487. var self=this,$self=this;
  22488. var classes,packages;
  22489. return $core.withContext(function($ctx1) {
  22490. var $1;
  22491. classes=$self._loadDependencyClasses();
  22492. $1=$recv($recv(classes)._collect_((function(each){
  22493. return $core.withContext(function($ctx2) {
  22494. return $recv(each)._package();
  22495. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22496. })))._asSet();
  22497. $recv($1)._remove_ifAbsent_(self,(function(){
  22498. }));
  22499. return $recv($1)._yourself();
  22500. }, function($ctx1) {$ctx1.fill(self,"loadDependencies",{classes:classes,packages:packages},$globals.Package)});
  22501. },
  22502. args: [],
  22503. 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",
  22504. referencedClasses: [],
  22505. messageSends: ["loadDependencyClasses", "remove:ifAbsent:", "asSet", "collect:", "package", "yourself"]
  22506. }),
  22507. $globals.Package);
  22508. $core.addMethod(
  22509. $core.method({
  22510. selector: "loadDependencyClasses",
  22511. protocol: "dependencies",
  22512. fn: function (){
  22513. var self=this,$self=this;
  22514. var starCategoryName;
  22515. return $core.withContext(function($ctx1) {
  22516. var $3,$2,$1,$5,$7,$6,$4,$receiver;
  22517. starCategoryName="*".__comma($self._name());
  22518. $ctx1.sendIdx[","]=1;
  22519. $3=$self._classes();
  22520. $ctx1.sendIdx["classes"]=1;
  22521. $2=$recv($3)._collect_((function(each){
  22522. return $core.withContext(function($ctx2) {
  22523. return $recv(each)._superclass();
  22524. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22525. }));
  22526. $ctx1.sendIdx["collect:"]=1;
  22527. $1=$recv($2)._asSet();
  22528. $recv($1)._addAll_($recv($recv($globals.Smalltalk)._classes())._select_((function(each){
  22529. return $core.withContext(function($ctx2) {
  22530. $5=$recv(each)._protocols();
  22531. $ctx2.sendIdx["protocols"]=1;
  22532. $7=$recv(each)._theMetaClass();
  22533. if(($receiver = $7) == null || $receiver.a$nil){
  22534. $6=[];
  22535. } else {
  22536. var meta;
  22537. meta=$receiver;
  22538. $6=$recv(meta)._protocols();
  22539. }
  22540. $4=$recv($5).__comma($6);
  22541. return $recv($4)._includes_(starCategoryName);
  22542. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  22543. })));
  22544. $ctx1.sendIdx["addAll:"]=1;
  22545. $recv($1)._addAll_($recv($globals.Array)._streamContents_((function(as){
  22546. return $core.withContext(function($ctx2) {
  22547. return $recv($self._traitCompositions())._valuesDo_((function(each){
  22548. return $core.withContext(function($ctx3) {
  22549. return $recv(as)._write_($recv(each)._collect_((function(eachTT){
  22550. return $core.withContext(function($ctx4) {
  22551. return $recv(eachTT)._trait();
  22552. }, function($ctx4) {$ctx4.fillBlock({eachTT:eachTT},$ctx3,7)});
  22553. })));
  22554. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,6)});
  22555. }));
  22556. }, function($ctx2) {$ctx2.fillBlock({as:as},$ctx1,5)});
  22557. })));
  22558. $recv($1)._remove_ifAbsent_(nil,(function(){
  22559. }));
  22560. return $recv($1)._yourself();
  22561. }, function($ctx1) {$ctx1.fill(self,"loadDependencyClasses",{starCategoryName:starCategoryName},$globals.Package)});
  22562. },
  22563. args: [],
  22564. source: "loadDependencyClasses\x0a\x09\x22Returns classes needed at the time of loading a package.\x0a\x09These are all that are used to subclass\x0a\x09and to define an extension method\x0a\x09as well as all traits used\x22\x0a\x09\x0a\x09| starCategoryName |\x0a\x09starCategoryName := '*', self name.\x0a\x09^ (self classes collect: [ :each | each superclass ]) asSet\x0a\x09\x09addAll: (Smalltalk classes select: [ :each |\x0a\x09\x09\x09each protocols, (each theMetaClass ifNil: [ #() ] ifNotNil: [ :meta | meta protocols])\x0a\x09\x09\x09\x09includes: starCategoryName ]);\x0a\x09\x09addAll: (Array streamContents: [ :as | self traitCompositions valuesDo: [ :each | as write: (each collect: [ :eachTT | eachTT trait ])]]);\x0a\x09\x09remove: nil ifAbsent: [];\x0a\x09\x09yourself",
  22565. referencedClasses: ["Smalltalk", "Array"],
  22566. messageSends: [",", "name", "addAll:", "asSet", "collect:", "classes", "superclass", "select:", "includes:", "protocols", "ifNil:ifNotNil:", "theMetaClass", "streamContents:", "valuesDo:", "traitCompositions", "write:", "trait", "remove:ifAbsent:", "yourself"]
  22567. }),
  22568. $globals.Package);
  22569. $core.addMethod(
  22570. $core.method({
  22571. selector: "name",
  22572. protocol: "accessing",
  22573. fn: function (){
  22574. var self=this,$self=this;
  22575. return $self["@name"];
  22576. },
  22577. args: [],
  22578. source: "name\x0a\x09^ name",
  22579. referencedClasses: [],
  22580. messageSends: []
  22581. }),
  22582. $globals.Package);
  22583. $core.addMethod(
  22584. $core.method({
  22585. selector: "name:",
  22586. protocol: "accessing",
  22587. fn: function (aString){
  22588. var self=this,$self=this;
  22589. $self["@name"]=aString;
  22590. return self;
  22591. },
  22592. args: ["aString"],
  22593. source: "name: aString\x0a\x09name := aString",
  22594. referencedClasses: [],
  22595. messageSends: []
  22596. }),
  22597. $globals.Package);
  22598. $core.addMethod(
  22599. $core.method({
  22600. selector: "organization",
  22601. protocol: "accessing",
  22602. fn: function (){
  22603. var self=this,$self=this;
  22604. return $self["@organization"];
  22605. },
  22606. args: [],
  22607. source: "organization\x0a\x09^ organization",
  22608. referencedClasses: [],
  22609. messageSends: []
  22610. }),
  22611. $globals.Package);
  22612. $core.addMethod(
  22613. $core.method({
  22614. selector: "printOn:",
  22615. protocol: "printing",
  22616. fn: function (aStream){
  22617. var self=this,$self=this;
  22618. return $core.withContext(function($ctx1) {
  22619. (
  22620. $ctx1.supercall = true,
  22621. ($globals.Package.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  22622. $ctx1.supercall = false;
  22623. $recv(aStream)._nextPutAll_(" (");
  22624. $ctx1.sendIdx["nextPutAll:"]=1;
  22625. $recv(aStream)._nextPutAll_($self._name());
  22626. $ctx1.sendIdx["nextPutAll:"]=2;
  22627. $recv(aStream)._nextPutAll_(")");
  22628. return self;
  22629. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Package)});
  22630. },
  22631. args: ["aStream"],
  22632. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  22633. referencedClasses: [],
  22634. messageSends: ["printOn:", "nextPutAll:", "name"]
  22635. }),
  22636. $globals.Package);
  22637. $core.addMethod(
  22638. $core.method({
  22639. selector: "setupClasses",
  22640. protocol: "classes",
  22641. fn: function (){
  22642. var self=this,$self=this;
  22643. return $core.withContext(function($ctx1) {
  22644. $recv($self._classes())._do_((function(each){
  22645. return $core.withContext(function($ctx2) {
  22646. return $recv(each)._initialize();
  22647. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22648. }));
  22649. return self;
  22650. }, function($ctx1) {$ctx1.fill(self,"setupClasses",{},$globals.Package)});
  22651. },
  22652. args: [],
  22653. source: "setupClasses\x0a\x09self classes do: [ :each | each initialize ]",
  22654. referencedClasses: [],
  22655. messageSends: ["do:", "classes", "initialize"]
  22656. }),
  22657. $globals.Package);
  22658. $core.addMethod(
  22659. $core.method({
  22660. selector: "sortedClasses",
  22661. protocol: "classes",
  22662. fn: function (){
  22663. var self=this,$self=this;
  22664. return $core.withContext(function($ctx1) {
  22665. return $recv($self._class())._sortedClasses_($self._classes());
  22666. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},$globals.Package)});
  22667. },
  22668. args: [],
  22669. 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",
  22670. referencedClasses: [],
  22671. messageSends: ["sortedClasses:", "class", "classes"]
  22672. }),
  22673. $globals.Package);
  22674. $core.addMethod(
  22675. $core.method({
  22676. selector: "sortedImportsAsArray",
  22677. protocol: "private",
  22678. fn: function (){
  22679. var self=this,$self=this;
  22680. return $core.withContext(function($ctx1) {
  22681. var $3,$2,$4,$1,$6,$5,$7;
  22682. return $recv($recv($self._imports())._asArray())._sorted_((function(a,b){
  22683. return $core.withContext(function($ctx2) {
  22684. $3=$recv(a)._isString();
  22685. $ctx2.sendIdx["isString"]=1;
  22686. $2=$recv($3)._not();
  22687. $4=$recv(b)._isString();
  22688. $ctx2.sendIdx["isString"]=2;
  22689. $1=$recv($2).__and($4);
  22690. return $recv($1)._or_((function(){
  22691. return $core.withContext(function($ctx3) {
  22692. $6=$recv(a)._isString();
  22693. $ctx3.sendIdx["isString"]=3;
  22694. $5=$recv($6).__eq($recv(b)._isString());
  22695. return $recv($5)._and_((function(){
  22696. return $core.withContext(function($ctx4) {
  22697. $7=$recv(a)._value();
  22698. $ctx4.sendIdx["value"]=1;
  22699. return $recv($7).__lt_eq($recv(b)._value());
  22700. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  22701. }));
  22702. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  22703. }));
  22704. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  22705. }));
  22706. }, function($ctx1) {$ctx1.fill(self,"sortedImportsAsArray",{},$globals.Package)});
  22707. },
  22708. args: [],
  22709. 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 ]]]",
  22710. referencedClasses: [],
  22711. messageSends: ["sorted:", "asArray", "imports", "or:", "&", "not", "isString", "and:", "=", "<=", "value"]
  22712. }),
  22713. $globals.Package);
  22714. $core.addMethod(
  22715. $core.method({
  22716. selector: "traitCompositions",
  22717. protocol: "dependencies",
  22718. fn: function (){
  22719. var self=this,$self=this;
  22720. var traitCompositions;
  22721. return $core.withContext(function($ctx1) {
  22722. var $1,$2,$3,$receiver;
  22723. traitCompositions=$recv($globals.Dictionary)._new();
  22724. $recv($self._classes())._do_((function(each){
  22725. return $core.withContext(function($ctx2) {
  22726. $1=traitCompositions;
  22727. $2=$recv(each)._traitComposition();
  22728. $ctx2.sendIdx["traitComposition"]=1;
  22729. $recv($1)._at_put_(each,$2);
  22730. $ctx2.sendIdx["at:put:"]=1;
  22731. $3=$recv(each)._theMetaClass();
  22732. if(($receiver = $3) == null || $receiver.a$nil){
  22733. return $3;
  22734. } else {
  22735. var meta;
  22736. meta=$receiver;
  22737. return $recv(traitCompositions)._at_put_(meta,$recv(meta)._traitComposition());
  22738. }
  22739. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22740. }));
  22741. return $recv(traitCompositions)._reject_((function(each){
  22742. return $core.withContext(function($ctx2) {
  22743. return $recv(each)._isEmpty();
  22744. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  22745. }));
  22746. }, function($ctx1) {$ctx1.fill(self,"traitCompositions",{traitCompositions:traitCompositions},$globals.Package)});
  22747. },
  22748. args: [],
  22749. source: "traitCompositions\x0a\x09| traitCompositions |\x0a\x09traitCompositions := Dictionary new.\x0a\x09self classes do: [ :each |\x0a\x09\x09traitCompositions at: each put: each traitComposition.\x0a\x09\x09each theMetaClass ifNotNil: [ :meta | traitCompositions at: meta put: meta traitComposition ] ].\x0a\x09^ traitCompositions reject: [ :each | each isEmpty ]",
  22750. referencedClasses: ["Dictionary"],
  22751. messageSends: ["new", "do:", "classes", "at:put:", "traitComposition", "ifNotNil:", "theMetaClass", "reject:", "isEmpty"]
  22752. }),
  22753. $globals.Package);
  22754. $core.addMethod(
  22755. $core.method({
  22756. selector: "transport",
  22757. protocol: "accessing",
  22758. fn: function (){
  22759. var self=this,$self=this;
  22760. return $core.withContext(function($ctx1) {
  22761. var $1,$receiver;
  22762. $1=$self["@transport"];
  22763. if(($receiver = $1) == null || $receiver.a$nil){
  22764. $self._transport_($recv($globals.PackageTransport)._fromJson_($self._basicTransport()));
  22765. return $self["@transport"];
  22766. } else {
  22767. return $1;
  22768. }
  22769. }, function($ctx1) {$ctx1.fill(self,"transport",{},$globals.Package)});
  22770. },
  22771. args: [],
  22772. source: "transport\x0a\x09^ transport ifNil: [ \x0a\x09\x09self transport: (PackageTransport fromJson: self basicTransport).\x0a\x09\x09transport ]",
  22773. referencedClasses: ["PackageTransport"],
  22774. messageSends: ["ifNil:", "transport:", "fromJson:", "basicTransport"]
  22775. }),
  22776. $globals.Package);
  22777. $core.addMethod(
  22778. $core.method({
  22779. selector: "transport:",
  22780. protocol: "accessing",
  22781. fn: function (aPackageTransport){
  22782. var self=this,$self=this;
  22783. return $core.withContext(function($ctx1) {
  22784. $self["@transport"]=aPackageTransport;
  22785. $recv(aPackageTransport)._package_(self);
  22786. return self;
  22787. }, function($ctx1) {$ctx1.fill(self,"transport:",{aPackageTransport:aPackageTransport},$globals.Package)});
  22788. },
  22789. args: ["aPackageTransport"],
  22790. source: "transport: aPackageTransport\x0a\x09transport := aPackageTransport.\x0a\x09aPackageTransport package: self",
  22791. referencedClasses: [],
  22792. messageSends: ["package:"]
  22793. }),
  22794. $globals.Package);
  22795. $core.addMethod(
  22796. $core.method({
  22797. selector: "validateImports:",
  22798. protocol: "validation",
  22799. fn: function (aCollection){
  22800. var self=this,$self=this;
  22801. return $core.withContext(function($ctx1) {
  22802. var $1,$2,$5,$4,$3,$6;
  22803. $recv(aCollection)._do_((function(import_){
  22804. return $core.withContext(function($ctx2) {
  22805. $1=$recv(import_)._isString();
  22806. $ctx2.sendIdx["isString"]=1;
  22807. if(!$core.assert($1)){
  22808. $2=$recv(import_)._respondsTo_("key");
  22809. if(!$core.assert($2)){
  22810. $self._error_("Imports must be Strings or Associations");
  22811. $ctx2.sendIdx["error:"]=1;
  22812. }
  22813. $5=$recv(import_)._key();
  22814. $ctx2.sendIdx["key"]=1;
  22815. $4=$recv($5)._isString();
  22816. $ctx2.sendIdx["isString"]=2;
  22817. $3=$recv($4).__and($recv($recv(import_)._value())._isString());
  22818. if(!$core.assert($3)){
  22819. $self._error_("Key and value must be Strings");
  22820. $ctx2.sendIdx["error:"]=2;
  22821. }
  22822. $6=$recv($recv(import_)._key())._match_("^[a-zA-Z][a-zA-Z0-9]*$");
  22823. if(!$core.assert($6)){
  22824. return $self._error_("Keys must be identifiers");
  22825. }
  22826. }
  22827. }, function($ctx2) {$ctx2.fillBlock({import_:import_},$ctx1,1)});
  22828. }));
  22829. return self;
  22830. }, function($ctx1) {$ctx1.fill(self,"validateImports:",{aCollection:aCollection},$globals.Package)});
  22831. },
  22832. args: ["aCollection"],
  22833. 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' ]]]",
  22834. referencedClasses: [],
  22835. messageSends: ["do:", "ifFalse:", "isString", "respondsTo:", "error:", "&", "key", "value", "match:"]
  22836. }),
  22837. $globals.Package);
  22838. $globals.Package.a$cls.iVarNames = ["defaultCommitPathJs", "defaultCommitPathSt"];
  22839. $core.addMethod(
  22840. $core.method({
  22841. selector: "named:",
  22842. protocol: "accessing",
  22843. fn: function (aPackageName){
  22844. var self=this,$self=this;
  22845. return $core.withContext(function($ctx1) {
  22846. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,(function(){
  22847. return $core.withContext(function($ctx2) {
  22848. return $recv($globals.Smalltalk)._createPackage_(aPackageName);
  22849. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22850. }));
  22851. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},$globals.Package.a$cls)});
  22852. },
  22853. args: ["aPackageName"],
  22854. source: "named: aPackageName\x0a\x09^ Smalltalk \x0a\x09\x09packageAt: aPackageName\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09Smalltalk createPackage: aPackageName ]",
  22855. referencedClasses: ["Smalltalk"],
  22856. messageSends: ["packageAt:ifAbsent:", "createPackage:"]
  22857. }),
  22858. $globals.Package.a$cls);
  22859. $core.addMethod(
  22860. $core.method({
  22861. selector: "named:ifAbsent:",
  22862. protocol: "accessing",
  22863. fn: function (aPackageName,aBlock){
  22864. var self=this,$self=this;
  22865. return $core.withContext(function($ctx1) {
  22866. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,aBlock);
  22867. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},$globals.Package.a$cls)});
  22868. },
  22869. args: ["aPackageName", "aBlock"],
  22870. source: "named: aPackageName ifAbsent: aBlock\x0a\x09^ Smalltalk packageAt: aPackageName ifAbsent: aBlock",
  22871. referencedClasses: ["Smalltalk"],
  22872. messageSends: ["packageAt:ifAbsent:"]
  22873. }),
  22874. $globals.Package.a$cls);
  22875. $core.addMethod(
  22876. $core.method({
  22877. selector: "named:imports:transport:",
  22878. protocol: "accessing",
  22879. fn: function (aPackageName,anArray,aTransport){
  22880. var self=this,$self=this;
  22881. var pkg;
  22882. return $core.withContext(function($ctx1) {
  22883. pkg=$self._named_(aPackageName);
  22884. $recv(pkg)._imports_(anArray);
  22885. $recv(pkg)._transport_(aTransport);
  22886. return pkg;
  22887. }, function($ctx1) {$ctx1.fill(self,"named:imports:transport:",{aPackageName:aPackageName,anArray:anArray,aTransport:aTransport,pkg:pkg},$globals.Package.a$cls)});
  22888. },
  22889. args: ["aPackageName", "anArray", "aTransport"],
  22890. 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",
  22891. referencedClasses: [],
  22892. messageSends: ["named:", "imports:", "transport:"]
  22893. }),
  22894. $globals.Package.a$cls);
  22895. $core.addMethod(
  22896. $core.method({
  22897. selector: "named:javaScriptDescriptor:",
  22898. protocol: "instance creation",
  22899. fn: function (aString,anObject){
  22900. var self=this,$self=this;
  22901. var pkg;
  22902. return $core.withContext(function($ctx1) {
  22903. pkg=$recv($globals.Smalltalk)._createPackage_(aString);
  22904. $recv(pkg)._javaScriptDescriptor_(anObject);
  22905. return pkg;
  22906. }, function($ctx1) {$ctx1.fill(self,"named:javaScriptDescriptor:",{aString:aString,anObject:anObject,pkg:pkg},$globals.Package.a$cls)});
  22907. },
  22908. args: ["aString", "anObject"],
  22909. source: "named: aString javaScriptDescriptor: anObject\x0a\x09| pkg |\x0a\x09\x0a\x09pkg := Smalltalk createPackage: aString.\x0a\x09pkg javaScriptDescriptor: anObject.\x0a\x09^ pkg",
  22910. referencedClasses: ["Smalltalk"],
  22911. messageSends: ["createPackage:", "javaScriptDescriptor:"]
  22912. }),
  22913. $globals.Package.a$cls);
  22914. $core.addMethod(
  22915. $core.method({
  22916. selector: "named:transport:",
  22917. protocol: "accessing",
  22918. fn: function (aPackageName,aTransport){
  22919. var self=this,$self=this;
  22920. var pkg;
  22921. return $core.withContext(function($ctx1) {
  22922. pkg=$self._named_(aPackageName);
  22923. $recv(pkg)._transport_(aTransport);
  22924. return pkg;
  22925. }, function($ctx1) {$ctx1.fill(self,"named:transport:",{aPackageName:aPackageName,aTransport:aTransport,pkg:pkg},$globals.Package.a$cls)});
  22926. },
  22927. args: ["aPackageName", "aTransport"],
  22928. source: "named: aPackageName transport: aTransport\x0a\x09| pkg |\x0a\x09\x0a\x09pkg := self named: aPackageName.\x0a\x09pkg transport: aTransport.\x0a\x09\x0a\x09^ pkg",
  22929. referencedClasses: [],
  22930. messageSends: ["named:", "transport:"]
  22931. }),
  22932. $globals.Package.a$cls);
  22933. $core.addMethod(
  22934. $core.method({
  22935. selector: "new:",
  22936. protocol: "instance creation",
  22937. fn: function (aString){
  22938. var self=this,$self=this;
  22939. return $core.withContext(function($ctx1) {
  22940. var $1;
  22941. $1=$recv($globals.Package)._new();
  22942. $recv($1)._name_(aString);
  22943. return $recv($1)._yourself();
  22944. }, function($ctx1) {$ctx1.fill(self,"new:",{aString:aString},$globals.Package.a$cls)});
  22945. },
  22946. args: ["aString"],
  22947. source: "new: aString\x0a\x09^ Package new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  22948. referencedClasses: ["Package"],
  22949. messageSends: ["name:", "new", "yourself"]
  22950. }),
  22951. $globals.Package.a$cls);
  22952. $core.addMethod(
  22953. $core.method({
  22954. selector: "sortedClasses:",
  22955. protocol: "sorting",
  22956. fn: function (classes){
  22957. var self=this,$self=this;
  22958. var children,others,nodes,expandedClasses;
  22959. return $core.withContext(function($ctx1) {
  22960. var $1,$3,$2;
  22961. children=[];
  22962. others=[];
  22963. $recv(classes)._do_((function(each){
  22964. return $core.withContext(function($ctx2) {
  22965. $1=$recv(classes)._includes_($recv(each)._superclass());
  22966. if($core.assert($1)){
  22967. return $recv(others)._add_(each);
  22968. } else {
  22969. return $recv(children)._add_(each);
  22970. $ctx2.sendIdx["add:"]=1;
  22971. }
  22972. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22973. }));
  22974. $ctx1.sendIdx["do:"]=1;
  22975. nodes=$recv(children)._collect_((function(each){
  22976. return $core.withContext(function($ctx2) {
  22977. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,(0));
  22978. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  22979. }));
  22980. nodes=$recv(nodes)._sorted_((function(a,b){
  22981. return $core.withContext(function($ctx2) {
  22982. $3=$recv(a)._theClass();
  22983. $ctx2.sendIdx["theClass"]=1;
  22984. $2=$recv($3)._name();
  22985. $ctx2.sendIdx["name"]=1;
  22986. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  22987. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,5)});
  22988. }));
  22989. expandedClasses=$recv($globals.Array)._new();
  22990. $recv(nodes)._do_((function(aNode){
  22991. return $core.withContext(function($ctx2) {
  22992. return $recv(aNode)._traverseClassesWith_(expandedClasses);
  22993. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,6)});
  22994. }));
  22995. return expandedClasses;
  22996. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},$globals.Package.a$cls)});
  22997. },
  22998. args: ["classes"],
  22999. source: "sortedClasses: classes\x0a\x09\x22Answer classes, sorted by superclass/subclasses and by class name for common subclasses (Issue #143)\x22\x0a\x0a\x09| children others nodes expandedClasses |\x0a\x09children := #().\x0a\x09others := #().\x0a\x09classes do: [ :each |\x0a\x09\x09(classes includes: each superclass)\x0a\x09\x09\x09ifFalse: [ children add: each ]\x0a\x09\x09\x09ifTrue: [ others add: each ]].\x0a\x09nodes := children collect: [ :each |\x0a\x09\x09ClassSorterNode on: each classes: others level: 0 ].\x0a\x09nodes := nodes sorted: [ :a :b | a theClass name <= b theClass name ].\x0a\x09expandedClasses := Array new.\x0a\x09nodes do: [ :aNode |\x0a\x09\x09aNode traverseClassesWith: expandedClasses ].\x0a\x09^ expandedClasses",
  23000. referencedClasses: ["ClassSorterNode", "Array"],
  23001. messageSends: ["do:", "ifFalse:ifTrue:", "includes:", "superclass", "add:", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"]
  23002. }),
  23003. $globals.Package.a$cls);
  23004. $core.addClass("PackageStateObserver", $globals.Object, [], "Kernel-Infrastructure");
  23005. $globals.PackageStateObserver.comment="My current instance listens for any changes in the system that might affect the state of a package (being dirty).";
  23006. $core.addMethod(
  23007. $core.method({
  23008. selector: "announcer",
  23009. protocol: "accessing",
  23010. fn: function (){
  23011. var self=this,$self=this;
  23012. return $core.withContext(function($ctx1) {
  23013. return $recv($globals.SystemAnnouncer)._current();
  23014. }, function($ctx1) {$ctx1.fill(self,"announcer",{},$globals.PackageStateObserver)});
  23015. },
  23016. args: [],
  23017. source: "announcer\x0a\x09^ SystemAnnouncer current",
  23018. referencedClasses: ["SystemAnnouncer"],
  23019. messageSends: ["current"]
  23020. }),
  23021. $globals.PackageStateObserver);
  23022. $core.addMethod(
  23023. $core.method({
  23024. selector: "observeSystem",
  23025. protocol: "actions",
  23026. fn: function (){
  23027. var self=this,$self=this;
  23028. return $core.withContext(function($ctx1) {
  23029. var $1;
  23030. $1=$self._announcer();
  23031. $recv($1)._on_send_to_($globals.PackageAdded,"onPackageAdded:",self);
  23032. $ctx1.sendIdx["on:send:to:"]=1;
  23033. $recv($1)._on_send_to_($globals.ClassAnnouncement,"onClassModification:",self);
  23034. $ctx1.sendIdx["on:send:to:"]=2;
  23035. $recv($1)._on_send_to_($globals.MethodAnnouncement,"onMethodModification:",self);
  23036. $ctx1.sendIdx["on:send:to:"]=3;
  23037. $recv($1)._on_send_to_($globals.ProtocolAnnouncement,"onProtocolModification:",self);
  23038. return self;
  23039. }, function($ctx1) {$ctx1.fill(self,"observeSystem",{},$globals.PackageStateObserver)});
  23040. },
  23041. args: [],
  23042. 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",
  23043. referencedClasses: ["PackageAdded", "ClassAnnouncement", "MethodAnnouncement", "ProtocolAnnouncement"],
  23044. messageSends: ["on:send:to:", "announcer"]
  23045. }),
  23046. $globals.PackageStateObserver);
  23047. $core.addMethod(
  23048. $core.method({
  23049. selector: "onClassModification:",
  23050. protocol: "reactions",
  23051. fn: function (anAnnouncement){
  23052. var self=this,$self=this;
  23053. return $core.withContext(function($ctx1) {
  23054. var $1,$receiver;
  23055. $1=$recv(anAnnouncement)._theClass();
  23056. if(($receiver = $1) == null || $receiver.a$nil){
  23057. $1;
  23058. } else {
  23059. var theClass;
  23060. theClass=$receiver;
  23061. $recv($recv(theClass)._package())._beDirty();
  23062. }
  23063. return self;
  23064. }, function($ctx1) {$ctx1.fill(self,"onClassModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23065. },
  23066. args: ["anAnnouncement"],
  23067. source: "onClassModification: anAnnouncement\x0a\x09anAnnouncement theClass ifNotNil: [ :theClass | theClass package beDirty ]",
  23068. referencedClasses: [],
  23069. messageSends: ["ifNotNil:", "theClass", "beDirty", "package"]
  23070. }),
  23071. $globals.PackageStateObserver);
  23072. $core.addMethod(
  23073. $core.method({
  23074. selector: "onMethodModification:",
  23075. protocol: "reactions",
  23076. fn: function (anAnnouncement){
  23077. var self=this,$self=this;
  23078. return $core.withContext(function($ctx1) {
  23079. var $1,$receiver;
  23080. $1=$recv($recv(anAnnouncement)._method())._package();
  23081. if(($receiver = $1) == null || $receiver.a$nil){
  23082. $1;
  23083. } else {
  23084. var package_;
  23085. package_=$receiver;
  23086. $recv(package_)._beDirty();
  23087. }
  23088. return self;
  23089. }, function($ctx1) {$ctx1.fill(self,"onMethodModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23090. },
  23091. args: ["anAnnouncement"],
  23092. source: "onMethodModification: anAnnouncement\x0a\x09anAnnouncement method package ifNotNil: [ :package | package beDirty ]",
  23093. referencedClasses: [],
  23094. messageSends: ["ifNotNil:", "package", "method", "beDirty"]
  23095. }),
  23096. $globals.PackageStateObserver);
  23097. $core.addMethod(
  23098. $core.method({
  23099. selector: "onPackageAdded:",
  23100. protocol: "reactions",
  23101. fn: function (anAnnouncement){
  23102. var self=this,$self=this;
  23103. return $core.withContext(function($ctx1) {
  23104. $recv($recv(anAnnouncement)._package())._beDirty();
  23105. return self;
  23106. }, function($ctx1) {$ctx1.fill(self,"onPackageAdded:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23107. },
  23108. args: ["anAnnouncement"],
  23109. source: "onPackageAdded: anAnnouncement\x0a\x09anAnnouncement package beDirty",
  23110. referencedClasses: [],
  23111. messageSends: ["beDirty", "package"]
  23112. }),
  23113. $globals.PackageStateObserver);
  23114. $core.addMethod(
  23115. $core.method({
  23116. selector: "onProtocolModification:",
  23117. protocol: "reactions",
  23118. fn: function (anAnnouncement){
  23119. var self=this,$self=this;
  23120. return $core.withContext(function($ctx1) {
  23121. var $1,$receiver;
  23122. $1=$recv(anAnnouncement)._package();
  23123. if(($receiver = $1) == null || $receiver.a$nil){
  23124. $1;
  23125. } else {
  23126. var package_;
  23127. package_=$receiver;
  23128. $recv(package_)._beDirty();
  23129. }
  23130. return self;
  23131. }, function($ctx1) {$ctx1.fill(self,"onProtocolModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23132. },
  23133. args: ["anAnnouncement"],
  23134. source: "onProtocolModification: anAnnouncement\x0a\x09anAnnouncement package ifNotNil: [ :package | package beDirty ]",
  23135. referencedClasses: [],
  23136. messageSends: ["ifNotNil:", "package", "beDirty"]
  23137. }),
  23138. $globals.PackageStateObserver);
  23139. $globals.PackageStateObserver.a$cls.iVarNames = ["current"];
  23140. $core.addMethod(
  23141. $core.method({
  23142. selector: "current",
  23143. protocol: "accessing",
  23144. fn: function (){
  23145. var self=this,$self=this;
  23146. return $core.withContext(function($ctx1) {
  23147. var $1,$receiver;
  23148. $1=$self["@current"];
  23149. if(($receiver = $1) == null || $receiver.a$nil){
  23150. $self["@current"]=$self._new();
  23151. return $self["@current"];
  23152. } else {
  23153. return $1;
  23154. }
  23155. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.PackageStateObserver.a$cls)});
  23156. },
  23157. args: [],
  23158. source: "current\x0a\x09^ current ifNil: [ current := self new ]",
  23159. referencedClasses: [],
  23160. messageSends: ["ifNil:", "new"]
  23161. }),
  23162. $globals.PackageStateObserver.a$cls);
  23163. $core.addMethod(
  23164. $core.method({
  23165. selector: "initialize",
  23166. protocol: "initialization",
  23167. fn: function (){
  23168. var self=this,$self=this;
  23169. return $core.withContext(function($ctx1) {
  23170. $recv($self._current())._observeSystem();
  23171. return self;
  23172. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageStateObserver.a$cls)});
  23173. },
  23174. args: [],
  23175. source: "initialize\x0a\x09self current observeSystem",
  23176. referencedClasses: [],
  23177. messageSends: ["observeSystem", "current"]
  23178. }),
  23179. $globals.PackageStateObserver.a$cls);
  23180. $core.addClass("ParseError", $globals.Error, [], "Kernel-Infrastructure");
  23181. $globals.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`";
  23182. $core.addClass("Setting", $globals.Object, ["key", "value", "defaultValue"], "Kernel-Infrastructure");
  23183. $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`";
  23184. $core.addMethod(
  23185. $core.method({
  23186. selector: "defaultValue",
  23187. protocol: "accessing",
  23188. fn: function (){
  23189. var self=this,$self=this;
  23190. return $self["@defaultValue"];
  23191. },
  23192. args: [],
  23193. source: "defaultValue\x0a\x09^ defaultValue",
  23194. referencedClasses: [],
  23195. messageSends: []
  23196. }),
  23197. $globals.Setting);
  23198. $core.addMethod(
  23199. $core.method({
  23200. selector: "defaultValue:",
  23201. protocol: "accessing",
  23202. fn: function (aStringifiableObject){
  23203. var self=this,$self=this;
  23204. $self["@defaultValue"]=aStringifiableObject;
  23205. return self;
  23206. },
  23207. args: ["aStringifiableObject"],
  23208. source: "defaultValue: aStringifiableObject\x0a\x09defaultValue := aStringifiableObject",
  23209. referencedClasses: [],
  23210. messageSends: []
  23211. }),
  23212. $globals.Setting);
  23213. $core.addMethod(
  23214. $core.method({
  23215. selector: "key",
  23216. protocol: "accessing",
  23217. fn: function (){
  23218. var self=this,$self=this;
  23219. return $self["@key"];
  23220. },
  23221. args: [],
  23222. source: "key\x0a\x09^ key",
  23223. referencedClasses: [],
  23224. messageSends: []
  23225. }),
  23226. $globals.Setting);
  23227. $core.addMethod(
  23228. $core.method({
  23229. selector: "key:",
  23230. protocol: "accessing",
  23231. fn: function (aString){
  23232. var self=this,$self=this;
  23233. $self["@key"]=aString;
  23234. return self;
  23235. },
  23236. args: ["aString"],
  23237. source: "key: aString\x0a\x09key := aString",
  23238. referencedClasses: [],
  23239. messageSends: []
  23240. }),
  23241. $globals.Setting);
  23242. $core.addMethod(
  23243. $core.method({
  23244. selector: "value",
  23245. protocol: "accessing",
  23246. fn: function (){
  23247. var self=this,$self=this;
  23248. return $core.withContext(function($ctx1) {
  23249. return $recv($recv($globals.Smalltalk)._settings())._at_ifAbsent_($self._key(),(function(){
  23250. return $core.withContext(function($ctx2) {
  23251. return $self._defaultValue();
  23252. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23253. }));
  23254. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Setting)});
  23255. },
  23256. args: [],
  23257. source: "value\x0a\x09^ Smalltalk settings at: self key ifAbsent: [ self defaultValue ]",
  23258. referencedClasses: ["Smalltalk"],
  23259. messageSends: ["at:ifAbsent:", "settings", "key", "defaultValue"]
  23260. }),
  23261. $globals.Setting);
  23262. $core.addMethod(
  23263. $core.method({
  23264. selector: "value:",
  23265. protocol: "accessing",
  23266. fn: function (aStringifiableObject){
  23267. var self=this,$self=this;
  23268. return $core.withContext(function($ctx1) {
  23269. return $recv($recv($globals.Smalltalk)._settings())._at_put_($self._key(),aStringifiableObject);
  23270. }, function($ctx1) {$ctx1.fill(self,"value:",{aStringifiableObject:aStringifiableObject},$globals.Setting)});
  23271. },
  23272. args: ["aStringifiableObject"],
  23273. source: "value: aStringifiableObject\x0a\x09^ Smalltalk settings at: self key put: aStringifiableObject",
  23274. referencedClasses: ["Smalltalk"],
  23275. messageSends: ["at:put:", "settings", "key"]
  23276. }),
  23277. $globals.Setting);
  23278. $core.addMethod(
  23279. $core.method({
  23280. selector: "at:ifAbsent:",
  23281. protocol: "instance creation",
  23282. fn: function (aString,aDefaultValue){
  23283. var self=this,$self=this;
  23284. return $core.withContext(function($ctx1) {
  23285. var $1;
  23286. $1=(
  23287. $ctx1.supercall = true,
  23288. ($globals.Setting.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  23289. $ctx1.supercall = false;
  23290. $recv($1)._key_(aString);
  23291. $recv($1)._defaultValue_(aDefaultValue);
  23292. return $recv($1)._yourself();
  23293. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aDefaultValue:aDefaultValue},$globals.Setting.a$cls)});
  23294. },
  23295. args: ["aString", "aDefaultValue"],
  23296. source: "at: aString ifAbsent: aDefaultValue\x0a\x09\x0a\x09^ super new\x0a\x09\x09key: aString;\x0a\x09\x09defaultValue: aDefaultValue;\x0a\x09\x09yourself",
  23297. referencedClasses: [],
  23298. messageSends: ["key:", "new", "defaultValue:", "yourself"]
  23299. }),
  23300. $globals.Setting.a$cls);
  23301. $core.addMethod(
  23302. $core.method({
  23303. selector: "new",
  23304. protocol: "instance creation",
  23305. fn: function (){
  23306. var self=this,$self=this;
  23307. return $core.withContext(function($ctx1) {
  23308. $self._shouldNotImplement();
  23309. return self;
  23310. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Setting.a$cls)});
  23311. },
  23312. args: [],
  23313. source: "new\x0a\x09self shouldNotImplement",
  23314. referencedClasses: [],
  23315. messageSends: ["shouldNotImplement"]
  23316. }),
  23317. $globals.Setting.a$cls);
  23318. $core.addClass("SmalltalkImage", $globals.Object, ["globalJsVariables", "packageDictionary"], "Kernel-Infrastructure");
  23319. $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.";
  23320. $core.addMethod(
  23321. $core.method({
  23322. selector: "addGlobalJsVariable:",
  23323. protocol: "globals",
  23324. fn: function (aString){
  23325. var self=this,$self=this;
  23326. return $core.withContext(function($ctx1) {
  23327. $recv($self._globalJsVariables())._add_(aString);
  23328. return self;
  23329. }, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  23330. },
  23331. args: ["aString"],
  23332. source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString",
  23333. referencedClasses: [],
  23334. messageSends: ["add:", "globalJsVariables"]
  23335. }),
  23336. $globals.SmalltalkImage);
  23337. $core.addMethod(
  23338. $core.method({
  23339. selector: "adoptPackageDescriptors",
  23340. protocol: "private",
  23341. fn: function (){
  23342. var self=this,$self=this;
  23343. return $core.withContext(function($ctx1) {
  23344. return $self._tryAdoptPackageDescriptorsBeyond_($recv($globals.Set)._new());
  23345. }, function($ctx1) {$ctx1.fill(self,"adoptPackageDescriptors",{},$globals.SmalltalkImage)});
  23346. },
  23347. args: [],
  23348. source: "adoptPackageDescriptors\x0a\x09^ self tryAdoptPackageDescriptorsBeyond: Set new",
  23349. referencedClasses: ["Set"],
  23350. messageSends: ["tryAdoptPackageDescriptorsBeyond:", "new"]
  23351. }),
  23352. $globals.SmalltalkImage);
  23353. $core.addMethod(
  23354. $core.method({
  23355. selector: "amdRequire",
  23356. protocol: "accessing amd",
  23357. fn: function (){
  23358. var self=this,$self=this;
  23359. return $core.withContext(function($ctx1) {
  23360. return $recv($self._core())._at_("amdRequire");
  23361. }, function($ctx1) {$ctx1.fill(self,"amdRequire",{},$globals.SmalltalkImage)});
  23362. },
  23363. args: [],
  23364. source: "amdRequire\x0a\x09^ self core at: 'amdRequire'",
  23365. referencedClasses: [],
  23366. messageSends: ["at:", "core"]
  23367. }),
  23368. $globals.SmalltalkImage);
  23369. $core.addMethod(
  23370. $core.method({
  23371. selector: "asSmalltalkException:",
  23372. protocol: "error handling",
  23373. fn: function (anObject){
  23374. var self=this,$self=this;
  23375. return $core.withContext(function($ctx1) {
  23376. var $1;
  23377. $1=$recv($self._isSmalltalkObject_(anObject))._and_((function(){
  23378. return $core.withContext(function($ctx2) {
  23379. return $recv(anObject)._isKindOf_($globals.Error);
  23380. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23381. }));
  23382. if($core.assert($1)){
  23383. return anObject;
  23384. } else {
  23385. return $recv($globals.JavaScriptException)._on_(anObject);
  23386. }
  23387. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},$globals.SmalltalkImage)});
  23388. },
  23389. args: ["anObject"],
  23390. 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 ]",
  23391. referencedClasses: ["Error", "JavaScriptException"],
  23392. messageSends: ["ifTrue:ifFalse:", "and:", "isSmalltalkObject:", "isKindOf:", "on:"]
  23393. }),
  23394. $globals.SmalltalkImage);
  23395. $core.addMethod(
  23396. $core.method({
  23397. selector: "basicCreatePackage:",
  23398. protocol: "private",
  23399. fn: function (packageName){
  23400. var self=this,$self=this;
  23401. return $core.withContext(function($ctx1) {
  23402. return $recv($self._packageDictionary())._at_ifAbsentPut_(packageName,(function(){
  23403. return $core.withContext(function($ctx2) {
  23404. return $recv($globals.Package)._new_(packageName);
  23405. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23406. }));
  23407. }, function($ctx1) {$ctx1.fill(self,"basicCreatePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  23408. },
  23409. args: ["packageName"],
  23410. 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 ]",
  23411. referencedClasses: ["Package"],
  23412. messageSends: ["at:ifAbsentPut:", "packageDictionary", "new:"]
  23413. }),
  23414. $globals.SmalltalkImage);
  23415. $core.addMethod(
  23416. $core.method({
  23417. selector: "basicParse:",
  23418. protocol: "private",
  23419. fn: function (aString){
  23420. var self=this,$self=this;
  23421. return $core.withContext(function($ctx1) {
  23422. return $recv($globals.SmalltalkParser)._parse_(aString);
  23423. }, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},$globals.SmalltalkImage)});
  23424. },
  23425. args: ["aString"],
  23426. source: "basicParse: aString\x0a\x09^ SmalltalkParser parse: aString",
  23427. referencedClasses: ["SmalltalkParser"],
  23428. messageSends: ["parse:"]
  23429. }),
  23430. $globals.SmalltalkImage);
  23431. $core.addMethod(
  23432. $core.method({
  23433. selector: "cancelOptOut:",
  23434. protocol: "accessing",
  23435. fn: function (anObject){
  23436. var self=this,$self=this;
  23437. return $core.withContext(function($ctx1) {
  23438. delete anObject.klass; delete anObject.a$cls;;
  23439. return self;
  23440. }, function($ctx1) {$ctx1.fill(self,"cancelOptOut:",{anObject:anObject},$globals.SmalltalkImage)});
  23441. },
  23442. args: ["anObject"],
  23443. source: "cancelOptOut: anObject\x0a\x09\x22A Smalltalk object has a 'a$cls' property.\x0a\x09If this property is shadowed for anObject by optOut:,\x0a\x09the object is treated as plain JS object.\x0a\x09This removes the shadow and anObject is Smalltalk object\x0a\x09again if it was before.\x22\x0a\x09\x0a\x09<inlineJS: 'delete anObject.klass; delete anObject.a$cls;'>",
  23444. referencedClasses: [],
  23445. messageSends: []
  23446. }),
  23447. $globals.SmalltalkImage);
  23448. $core.addMethod(
  23449. $core.method({
  23450. selector: "classes",
  23451. protocol: "classes",
  23452. fn: function (){
  23453. var self=this,$self=this;
  23454. return $core.withContext(function($ctx1) {
  23455. return $recv($recv($self._core())._traitsOrClasses())._copy();
  23456. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.SmalltalkImage)});
  23457. },
  23458. args: [],
  23459. source: "classes\x0a\x09^ self core traitsOrClasses copy",
  23460. referencedClasses: [],
  23461. messageSends: ["copy", "traitsOrClasses", "core"]
  23462. }),
  23463. $globals.SmalltalkImage);
  23464. $core.addMethod(
  23465. $core.method({
  23466. selector: "core",
  23467. protocol: "accessing",
  23468. fn: function (){
  23469. var self=this,$self=this;
  23470. return $core.withContext(function($ctx1) {
  23471. return $core;
  23472. return self;
  23473. }, function($ctx1) {$ctx1.fill(self,"core",{},$globals.SmalltalkImage)});
  23474. },
  23475. args: [],
  23476. source: "core\x0a\x09<inlineJS: 'return $core'>",
  23477. referencedClasses: [],
  23478. messageSends: []
  23479. }),
  23480. $globals.SmalltalkImage);
  23481. $core.addMethod(
  23482. $core.method({
  23483. selector: "createPackage:",
  23484. protocol: "packages",
  23485. fn: function (packageName){
  23486. var self=this,$self=this;
  23487. var package_,announcement;
  23488. return $core.withContext(function($ctx1) {
  23489. var $1;
  23490. package_=$self._basicCreatePackage_(packageName);
  23491. $1=$recv($globals.PackageAdded)._new();
  23492. $recv($1)._package_(package_);
  23493. announcement=$recv($1)._yourself();
  23494. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  23495. return package_;
  23496. }, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName,package_:package_,announcement:announcement},$globals.SmalltalkImage)});
  23497. },
  23498. args: ["packageName"],
  23499. 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",
  23500. referencedClasses: ["PackageAdded", "SystemAnnouncer"],
  23501. messageSends: ["basicCreatePackage:", "package:", "new", "yourself", "announce:", "current"]
  23502. }),
  23503. $globals.SmalltalkImage);
  23504. $core.addMethod(
  23505. $core.method({
  23506. selector: "defaultAmdNamespace",
  23507. protocol: "accessing amd",
  23508. fn: function (){
  23509. var self=this,$self=this;
  23510. return $core.withContext(function($ctx1) {
  23511. return "transport.defaultAmdNamespace"._settingValue();
  23512. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{},$globals.SmalltalkImage)});
  23513. },
  23514. args: [],
  23515. source: "defaultAmdNamespace\x0a\x09^ 'transport.defaultAmdNamespace' settingValue",
  23516. referencedClasses: [],
  23517. messageSends: ["settingValue"]
  23518. }),
  23519. $globals.SmalltalkImage);
  23520. $core.addMethod(
  23521. $core.method({
  23522. selector: "defaultAmdNamespace:",
  23523. protocol: "accessing amd",
  23524. fn: function (aString){
  23525. var self=this,$self=this;
  23526. return $core.withContext(function($ctx1) {
  23527. "transport.defaultAmdNamespace"._settingValue_(aString);
  23528. return self;
  23529. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString},$globals.SmalltalkImage)});
  23530. },
  23531. args: ["aString"],
  23532. source: "defaultAmdNamespace: aString\x0a\x09'transport.defaultAmdNamespace' settingValue: aString",
  23533. referencedClasses: [],
  23534. messageSends: ["settingValue:"]
  23535. }),
  23536. $globals.SmalltalkImage);
  23537. $core.addMethod(
  23538. $core.method({
  23539. selector: "deleteClass:",
  23540. protocol: "private",
  23541. fn: function (aClass){
  23542. var self=this,$self=this;
  23543. return $core.withContext(function($ctx1) {
  23544. $core.removeClass(aClass);
  23545. return self;
  23546. }, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},$globals.SmalltalkImage)});
  23547. },
  23548. args: ["aClass"],
  23549. 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)'>",
  23550. referencedClasses: [],
  23551. messageSends: []
  23552. }),
  23553. $globals.SmalltalkImage);
  23554. $core.addMethod(
  23555. $core.method({
  23556. selector: "deleteGlobalJsVariable:",
  23557. protocol: "globals",
  23558. fn: function (aString){
  23559. var self=this,$self=this;
  23560. return $core.withContext(function($ctx1) {
  23561. $recv($self._globalJsVariables())._remove_ifAbsent_(aString,(function(){
  23562. }));
  23563. return self;
  23564. }, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  23565. },
  23566. args: ["aString"],
  23567. source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[]",
  23568. referencedClasses: [],
  23569. messageSends: ["remove:ifAbsent:", "globalJsVariables"]
  23570. }),
  23571. $globals.SmalltalkImage);
  23572. $core.addMethod(
  23573. $core.method({
  23574. selector: "existsJsGlobal:",
  23575. protocol: "testing",
  23576. fn: function (aString){
  23577. var self=this,$self=this;
  23578. return $core.withContext(function($ctx1) {
  23579. $self._deprecatedAPI_("Use Platform >> includesGlobal: instead");
  23580. return $recv($globals.Platform)._includesGlobal_(aString);
  23581. }, function($ctx1) {$ctx1.fill(self,"existsJsGlobal:",{aString:aString},$globals.SmalltalkImage)});
  23582. },
  23583. args: ["aString"],
  23584. source: "existsJsGlobal: aString\x0a\x09self deprecatedAPI: 'Use Platform >> includesGlobal: instead'.\x0a\x09^ Platform includesGlobal: aString",
  23585. referencedClasses: ["Platform"],
  23586. messageSends: ["deprecatedAPI:", "includesGlobal:"]
  23587. }),
  23588. $globals.SmalltalkImage);
  23589. $core.addMethod(
  23590. $core.method({
  23591. selector: "globalJsVariables",
  23592. protocol: "globals",
  23593. fn: function (){
  23594. var self=this,$self=this;
  23595. return $core.withContext(function($ctx1) {
  23596. var $1,$receiver;
  23597. $1=$self["@globalJsVariables"];
  23598. if(($receiver = $1) == null || $receiver.a$nil){
  23599. $self["@globalJsVariables"]=["window", "document", "process", "global"];
  23600. return $self["@globalJsVariables"];
  23601. } else {
  23602. return $1;
  23603. }
  23604. }, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{},$globals.SmalltalkImage)});
  23605. },
  23606. args: [],
  23607. source: "globalJsVariables\x0a\x09^ globalJsVariables ifNil: [\x0a\x09\x09globalJsVariables := #(window document process global) ]",
  23608. referencedClasses: [],
  23609. messageSends: ["ifNil:"]
  23610. }),
  23611. $globals.SmalltalkImage);
  23612. $core.addMethod(
  23613. $core.method({
  23614. selector: "globals",
  23615. protocol: "accessing",
  23616. fn: function (){
  23617. var self=this,$self=this;
  23618. return $core.withContext(function($ctx1) {
  23619. return $globals;
  23620. return self;
  23621. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.SmalltalkImage)});
  23622. },
  23623. args: [],
  23624. source: "globals\x0a\x09<inlineJS: 'return $globals'>",
  23625. referencedClasses: [],
  23626. messageSends: []
  23627. }),
  23628. $globals.SmalltalkImage);
  23629. $core.addMethod(
  23630. $core.method({
  23631. selector: "includesKey:",
  23632. protocol: "accessing",
  23633. fn: function (aKey){
  23634. var self=this,$self=this;
  23635. return $core.withContext(function($ctx1) {
  23636. return $core.hasOwnProperty(aKey);
  23637. return self;
  23638. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.SmalltalkImage)});
  23639. },
  23640. args: ["aKey"],
  23641. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $core.hasOwnProperty(aKey)'>",
  23642. referencedClasses: [],
  23643. messageSends: []
  23644. }),
  23645. $globals.SmalltalkImage);
  23646. $core.addMethod(
  23647. $core.method({
  23648. selector: "isSmalltalkObject:",
  23649. protocol: "testing",
  23650. fn: function (anObject){
  23651. var self=this,$self=this;
  23652. return $core.withContext(function($ctx1) {
  23653. return anObject.a$cls != null;
  23654. return self;
  23655. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},$globals.SmalltalkImage)});
  23656. },
  23657. args: ["anObject"],
  23658. 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'>",
  23659. referencedClasses: [],
  23660. messageSends: []
  23661. }),
  23662. $globals.SmalltalkImage);
  23663. $core.addMethod(
  23664. $core.method({
  23665. selector: "optOut:",
  23666. protocol: "accessing",
  23667. fn: function (anObject){
  23668. var self=this,$self=this;
  23669. return $core.withContext(function($ctx1) {
  23670. anObject.klass = null; anObject.a$cls = null;
  23671. return self;
  23672. }, function($ctx1) {$ctx1.fill(self,"optOut:",{anObject:anObject},$globals.SmalltalkImage)});
  23673. },
  23674. args: ["anObject"],
  23675. source: "optOut: anObject\x0a\x09\x22A Smalltalk object has a 'a$cls' property.\x0a\x09This shadows the property for anObject.\x0a\x09The object is treated as plain JS object following this.\x22\x0a\x09\x0a\x09<inlineJS: 'anObject.klass = null; anObject.a$cls = null'>",
  23676. referencedClasses: [],
  23677. messageSends: []
  23678. }),
  23679. $globals.SmalltalkImage);
  23680. $core.addMethod(
  23681. $core.method({
  23682. selector: "packageAt:ifAbsent:",
  23683. protocol: "packages",
  23684. fn: function (packageName,aBlock){
  23685. var self=this,$self=this;
  23686. return $core.withContext(function($ctx1) {
  23687. return $recv($self._packageDictionary())._at_ifAbsent_(packageName,aBlock);
  23688. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  23689. },
  23690. args: ["packageName", "aBlock"],
  23691. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^ self packageDictionary at: packageName ifAbsent: aBlock",
  23692. referencedClasses: [],
  23693. messageSends: ["at:ifAbsent:", "packageDictionary"]
  23694. }),
  23695. $globals.SmalltalkImage);
  23696. $core.addMethod(
  23697. $core.method({
  23698. selector: "packageAt:ifPresent:",
  23699. protocol: "packages",
  23700. fn: function (packageName,aBlock){
  23701. var self=this,$self=this;
  23702. return $core.withContext(function($ctx1) {
  23703. return $recv($self._packageDictionary())._at_ifPresent_(packageName,aBlock);
  23704. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifPresent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  23705. },
  23706. args: ["packageName", "aBlock"],
  23707. source: "packageAt: packageName ifPresent: aBlock\x0a\x09^ self packageDictionary at: packageName ifPresent: aBlock",
  23708. referencedClasses: [],
  23709. messageSends: ["at:ifPresent:", "packageDictionary"]
  23710. }),
  23711. $globals.SmalltalkImage);
  23712. $core.addMethod(
  23713. $core.method({
  23714. selector: "packageDictionary",
  23715. protocol: "packages",
  23716. fn: function (){
  23717. var self=this,$self=this;
  23718. return $core.withContext(function($ctx1) {
  23719. var $1,$receiver;
  23720. $1=$self["@packageDictionary"];
  23721. if(($receiver = $1) == null || $receiver.a$nil){
  23722. $self["@packageDictionary"]=$recv($globals.Dictionary)._new();
  23723. return $self["@packageDictionary"];
  23724. } else {
  23725. return $1;
  23726. }
  23727. }, function($ctx1) {$ctx1.fill(self,"packageDictionary",{},$globals.SmalltalkImage)});
  23728. },
  23729. args: [],
  23730. source: "packageDictionary\x0a\x09^ packageDictionary ifNil: [ packageDictionary := Dictionary new ]",
  23731. referencedClasses: ["Dictionary"],
  23732. messageSends: ["ifNil:", "new"]
  23733. }),
  23734. $globals.SmalltalkImage);
  23735. $core.addMethod(
  23736. $core.method({
  23737. selector: "packages",
  23738. protocol: "packages",
  23739. fn: function (){
  23740. var self=this,$self=this;
  23741. return $core.withContext(function($ctx1) {
  23742. return $recv($recv($self._packageDictionary())._values())._copy();
  23743. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.SmalltalkImage)});
  23744. },
  23745. args: [],
  23746. source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09^ self packageDictionary values copy",
  23747. referencedClasses: [],
  23748. messageSends: ["copy", "values", "packageDictionary"]
  23749. }),
  23750. $globals.SmalltalkImage);
  23751. $core.addMethod(
  23752. $core.method({
  23753. selector: "parse:",
  23754. protocol: "accessing",
  23755. fn: function (aString){
  23756. var self=this,$self=this;
  23757. var result;
  23758. return $core.withContext(function($ctx1) {
  23759. var $1;
  23760. $recv((function(){
  23761. return $core.withContext(function($ctx2) {
  23762. result=$self._basicParse_(aString);
  23763. return result;
  23764. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23765. }))._tryCatch_((function(ex){
  23766. return $core.withContext(function($ctx2) {
  23767. return $recv($self._parseError_parsing_(ex,aString))._signal();
  23768. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  23769. }));
  23770. $1=result;
  23771. $recv($1)._source_(aString);
  23772. return $recv($1)._yourself();
  23773. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},$globals.SmalltalkImage)});
  23774. },
  23775. args: ["aString"],
  23776. 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",
  23777. referencedClasses: [],
  23778. messageSends: ["tryCatch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"]
  23779. }),
  23780. $globals.SmalltalkImage);
  23781. $core.addMethod(
  23782. $core.method({
  23783. selector: "parseError:parsing:",
  23784. protocol: "error handling",
  23785. fn: function (anException,aString){
  23786. var self=this,$self=this;
  23787. return $core.withContext(function($ctx1) {
  23788. var $1,$2,$9,$8,$7,$6,$5,$4,$3,$receiver;
  23789. $1=$recv(anException)._basicAt_("location");
  23790. $ctx1.sendIdx["basicAt:"]=1;
  23791. if(($receiver = $1) == null || $receiver.a$nil){
  23792. return $recv(anException)._pass();
  23793. } else {
  23794. var loc;
  23795. loc=$receiver;
  23796. $2=$recv($globals.ParseError)._new();
  23797. $9=$recv(loc)._start();
  23798. $ctx1.sendIdx["start"]=1;
  23799. $8=$recv($9)._line();
  23800. $7="Parse error on line ".__comma($8);
  23801. $6=$recv($7).__comma(" column ");
  23802. $ctx1.sendIdx[","]=4;
  23803. $5=$recv($6).__comma($recv($recv(loc)._start())._column());
  23804. $ctx1.sendIdx[","]=3;
  23805. $4=$recv($5).__comma(" : Unexpected character ");
  23806. $ctx1.sendIdx[","]=2;
  23807. $3=$recv($4).__comma($recv(anException)._basicAt_("found"));
  23808. $ctx1.sendIdx[","]=1;
  23809. $recv($2)._messageText_($3);
  23810. return $recv($2)._yourself();
  23811. }
  23812. return self;
  23813. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString},$globals.SmalltalkImage)});
  23814. },
  23815. args: ["anException", "aString"],
  23816. 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 ]",
  23817. referencedClasses: ["ParseError"],
  23818. messageSends: ["ifNil:ifNotNil:", "basicAt:", "pass", "messageText:", "new", ",", "line", "start", "column", "yourself"]
  23819. }),
  23820. $globals.SmalltalkImage);
  23821. $core.addMethod(
  23822. $core.method({
  23823. selector: "postLoad",
  23824. protocol: "image",
  23825. fn: function (){
  23826. var self=this,$self=this;
  23827. return $core.withContext(function($ctx1) {
  23828. var $1;
  23829. return $recv($self._adoptPackageDescriptors())._then_((function(pkgs){
  23830. var classes;
  23831. return $core.withContext(function($ctx2) {
  23832. $recv(pkgs)._do_("beClean");
  23833. $ctx2.sendIdx["do:"]=1;
  23834. classes=$recv($recv($globals.Smalltalk)._classes())._select_((function(each){
  23835. return $core.withContext(function($ctx3) {
  23836. return $recv(pkgs)._includes_($recv(each)._package());
  23837. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  23838. }));
  23839. $recv(classes)._do_((function(each){
  23840. return $core.withContext(function($ctx3) {
  23841. $1=$recv(each).__eq($self._class());
  23842. if(!$core.assert($1)){
  23843. return $recv(each)._initialize();
  23844. }
  23845. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)});
  23846. }));
  23847. return $self._sweepPackageDescriptors_(pkgs);
  23848. }, function($ctx2) {$ctx2.fillBlock({pkgs:pkgs,classes:classes},$ctx1,1)});
  23849. }));
  23850. }, function($ctx1) {$ctx1.fill(self,"postLoad",{},$globals.SmalltalkImage)});
  23851. },
  23852. args: [],
  23853. 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 ]",
  23854. referencedClasses: ["Smalltalk"],
  23855. messageSends: ["then:", "adoptPackageDescriptors", "do:", "select:", "classes", "includes:", "package", "ifFalse:", "=", "class", "initialize", "sweepPackageDescriptors:"]
  23856. }),
  23857. $globals.SmalltalkImage);
  23858. $core.addMethod(
  23859. $core.method({
  23860. selector: "pseudoVariableNames",
  23861. protocol: "accessing",
  23862. fn: function (){
  23863. var self=this,$self=this;
  23864. return ["self", "super", "nil", "true", "false", "thisContext"];
  23865. },
  23866. args: [],
  23867. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  23868. referencedClasses: [],
  23869. messageSends: []
  23870. }),
  23871. $globals.SmalltalkImage);
  23872. $core.addMethod(
  23873. $core.method({
  23874. selector: "readJSObject:",
  23875. protocol: "accessing",
  23876. fn: function (anObject){
  23877. var self=this,$self=this;
  23878. return $core.withContext(function($ctx1) {
  23879. return $core.readJSObject(anObject);
  23880. return self;
  23881. }, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},$globals.SmalltalkImage)});
  23882. },
  23883. args: ["anObject"],
  23884. source: "readJSObject: anObject\x0a\x09<inlineJS: 'return $core.readJSObject(anObject)'>",
  23885. referencedClasses: [],
  23886. messageSends: []
  23887. }),
  23888. $globals.SmalltalkImage);
  23889. $core.addMethod(
  23890. $core.method({
  23891. selector: "removeClass:",
  23892. protocol: "classes",
  23893. fn: function (aClass){
  23894. var self=this,$self=this;
  23895. return $core.withContext(function($ctx1) {
  23896. var $1,$2,$5,$4,$6,$3,$7,$8,$10,$9,$receiver;
  23897. $1=$recv(aClass)._isMetaclass();
  23898. if($core.assert($1)){
  23899. $2=$recv($recv(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!");
  23900. $ctx1.sendIdx[","]=1;
  23901. $self._error_($2);
  23902. $ctx1.sendIdx["error:"]=1;
  23903. }
  23904. $recv(aClass)._allSubclassesDo_((function(subclass){
  23905. return $core.withContext(function($ctx2) {
  23906. $5=$recv(aClass)._name();
  23907. $ctx2.sendIdx["name"]=1;
  23908. $4=$recv($5).__comma(" has a subclass: ");
  23909. $ctx2.sendIdx[","]=3;
  23910. $6=$recv(subclass)._name();
  23911. $ctx2.sendIdx["name"]=2;
  23912. $3=$recv($4).__comma($6);
  23913. $ctx2.sendIdx[","]=2;
  23914. return $self._error_($3);
  23915. $ctx2.sendIdx["error:"]=2;
  23916. }, function($ctx2) {$ctx2.fillBlock({subclass:subclass},$ctx1,2)});
  23917. }));
  23918. $recv($recv(aClass)._traitUsers())._ifNotEmpty_((function(){
  23919. return $core.withContext(function($ctx2) {
  23920. return $self._error_($recv($recv(aClass)._name()).__comma(" has trait users."));
  23921. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  23922. }));
  23923. $self._deleteClass_(aClass);
  23924. $recv(aClass)._setTraitComposition_([]);
  23925. $ctx1.sendIdx["setTraitComposition:"]=1;
  23926. $7=$recv(aClass)._theMetaClass();
  23927. if(($receiver = $7) == null || $receiver.a$nil){
  23928. $7;
  23929. } else {
  23930. var meta;
  23931. meta=$receiver;
  23932. $recv(meta)._setTraitComposition_([]);
  23933. }
  23934. $8=$recv($globals.SystemAnnouncer)._current();
  23935. $10=$recv($globals.ClassRemoved)._new();
  23936. $recv($10)._theClass_(aClass);
  23937. $9=$recv($10)._yourself();
  23938. $recv($8)._announce_($9);
  23939. return self;
  23940. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.SmalltalkImage)});
  23941. },
  23942. args: ["aClass"],
  23943. source: "removeClass: aClass\x0a\x09aClass isMetaclass ifTrue: [ self error: aClass asString, ' is a Metaclass and cannot be removed!' ].\x0a\x09aClass allSubclassesDo: [ :subclass | self error: aClass name, ' has a subclass: ', subclass name ].\x0a\x09aClass traitUsers ifNotEmpty: [ self error: aClass name, ' has trait users.' ].\x0a\x09\x0a\x09self deleteClass: aClass.\x0a\x09aClass setTraitComposition: #().\x0a\x09aClass theMetaClass ifNotNil: [ :meta | meta setTraitComposition: #() ].\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassRemoved new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  23944. referencedClasses: ["SystemAnnouncer", "ClassRemoved"],
  23945. messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "allSubclassesDo:", "name", "ifNotEmpty:", "traitUsers", "deleteClass:", "setTraitComposition:", "ifNotNil:", "theMetaClass", "announce:", "current", "theClass:", "new", "yourself"]
  23946. }),
  23947. $globals.SmalltalkImage);
  23948. $core.addMethod(
  23949. $core.method({
  23950. selector: "removePackage:",
  23951. protocol: "packages",
  23952. fn: function (packageName){
  23953. var self=this,$self=this;
  23954. var pkg;
  23955. return $core.withContext(function($ctx1) {
  23956. pkg=$self._packageAt_ifAbsent_(packageName,(function(){
  23957. return $core.withContext(function($ctx2) {
  23958. return $self._error_("Missing package: ".__comma(packageName));
  23959. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23960. }));
  23961. $recv($recv(pkg)._classes())._do_((function(each){
  23962. return $core.withContext(function($ctx2) {
  23963. return $self._removeClass_(each);
  23964. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  23965. }));
  23966. $recv($self._packageDictionary())._removeKey_(packageName);
  23967. return self;
  23968. }, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},$globals.SmalltalkImage)});
  23969. },
  23970. args: ["packageName"],
  23971. 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",
  23972. referencedClasses: [],
  23973. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "removeKey:", "packageDictionary"]
  23974. }),
  23975. $globals.SmalltalkImage);
  23976. $core.addMethod(
  23977. $core.method({
  23978. selector: "renamePackage:to:",
  23979. protocol: "packages",
  23980. fn: function (packageName,newName){
  23981. var self=this,$self=this;
  23982. var pkg;
  23983. return $core.withContext(function($ctx1) {
  23984. var $1,$2,$3;
  23985. pkg=$self._packageAt_ifAbsent_(packageName,(function(){
  23986. return $core.withContext(function($ctx2) {
  23987. $1="Missing package: ".__comma(packageName);
  23988. $ctx2.sendIdx[","]=1;
  23989. return $self._error_($1);
  23990. $ctx2.sendIdx["error:"]=1;
  23991. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23992. }));
  23993. $self._packageAt_ifPresent_(newName,(function(){
  23994. return $core.withContext(function($ctx2) {
  23995. return $self._error_("Already exists a package called: ".__comma(newName));
  23996. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  23997. }));
  23998. $2=pkg;
  23999. $recv($2)._name_(newName);
  24000. $recv($2)._beDirty();
  24001. $3=$self._packageDictionary();
  24002. $recv($3)._at_put_(newName,pkg);
  24003. $recv($3)._removeKey_(packageName);
  24004. return self;
  24005. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},$globals.SmalltalkImage)});
  24006. },
  24007. args: ["packageName", "newName"],
  24008. 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",
  24009. referencedClasses: [],
  24010. messageSends: ["packageAt:ifAbsent:", "error:", ",", "packageAt:ifPresent:", "name:", "beDirty", "at:put:", "packageDictionary", "removeKey:"]
  24011. }),
  24012. $globals.SmalltalkImage);
  24013. $core.addMethod(
  24014. $core.method({
  24015. selector: "reservedWords",
  24016. protocol: "accessing",
  24017. fn: function (){
  24018. var self=this,$self=this;
  24019. 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"];
  24020. },
  24021. args: [],
  24022. 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)",
  24023. referencedClasses: [],
  24024. messageSends: []
  24025. }),
  24026. $globals.SmalltalkImage);
  24027. $core.addMethod(
  24028. $core.method({
  24029. selector: "settings",
  24030. protocol: "accessing",
  24031. fn: function (){
  24032. var self=this,$self=this;
  24033. return $globals.SmalltalkSettings;
  24034. },
  24035. args: [],
  24036. source: "settings\x0a\x09^ SmalltalkSettings",
  24037. referencedClasses: ["SmalltalkSettings"],
  24038. messageSends: []
  24039. }),
  24040. $globals.SmalltalkImage);
  24041. $core.addMethod(
  24042. $core.method({
  24043. selector: "sweepPackageDescriptors:",
  24044. protocol: "private",
  24045. fn: function (pkgs){
  24046. var self=this,$self=this;
  24047. var pd;
  24048. return $core.withContext(function($ctx1) {
  24049. pd=$recv($self._core())._packageDescriptors();
  24050. $recv(pkgs)._do_((function(each){
  24051. return $core.withContext(function($ctx2) {
  24052. return $recv(pd)._removeKey_($recv(each)._name());
  24053. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  24054. }));
  24055. return self;
  24056. }, function($ctx1) {$ctx1.fill(self,"sweepPackageDescriptors:",{pkgs:pkgs,pd:pd},$globals.SmalltalkImage)});
  24057. },
  24058. args: ["pkgs"],
  24059. source: "sweepPackageDescriptors: pkgs\x0a\x09| pd |\x09\x0a\x09pd := self core packageDescriptors.\x0a\x09pkgs do: [ :each | pd removeKey: each name ]",
  24060. referencedClasses: [],
  24061. messageSends: ["packageDescriptors", "core", "do:", "removeKey:", "name"]
  24062. }),
  24063. $globals.SmalltalkImage);
  24064. $core.addMethod(
  24065. $core.method({
  24066. selector: "tryAdoptPackageDescriptorsBeyond:",
  24067. protocol: "private",
  24068. fn: function (aSet){
  24069. var self=this,$self=this;
  24070. var original;
  24071. return $core.withContext(function($ctx1) {
  24072. var $1;
  24073. original=$recv(aSet)._copy();
  24074. $recv($recv($self._core())._packageDescriptors())._keysAndValuesDo_((function(key,value){
  24075. return $core.withContext(function($ctx2) {
  24076. return $recv(aSet)._add_($recv($globals.Package)._named_javaScriptDescriptor_(key,value));
  24077. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  24078. }));
  24079. $1=$recv(aSet)._allSatisfy_((function(each){
  24080. return $core.withContext(function($ctx2) {
  24081. return $recv(original)._includes_(each);
  24082. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  24083. }));
  24084. if($core.assert($1)){
  24085. return $recv($globals.Promise)._value_(aSet);
  24086. } else {
  24087. return $recv($recv($globals.Promise)._all_($recv(aSet)._collect_("isReady")))._then_((function(){
  24088. return $core.withContext(function($ctx2) {
  24089. return $self._tryAdoptPackageDescriptorsBeyond_(aSet);
  24090. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  24091. }));
  24092. }
  24093. }, function($ctx1) {$ctx1.fill(self,"tryAdoptPackageDescriptorsBeyond:",{aSet:aSet,original:original},$globals.SmalltalkImage)});
  24094. },
  24095. args: ["aSet"],
  24096. 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 ]",
  24097. referencedClasses: ["Package", "Promise"],
  24098. messageSends: ["copy", "keysAndValuesDo:", "packageDescriptors", "core", "add:", "named:javaScriptDescriptor:", "ifFalse:ifTrue:", "allSatisfy:", "includes:", "then:", "all:", "collect:", "tryAdoptPackageDescriptorsBeyond:", "value:"]
  24099. }),
  24100. $globals.SmalltalkImage);
  24101. $core.addMethod(
  24102. $core.method({
  24103. selector: "version",
  24104. protocol: "accessing",
  24105. fn: function (){
  24106. var self=this,$self=this;
  24107. return "0.22.6";
  24108. },
  24109. args: [],
  24110. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.22.6'",
  24111. referencedClasses: [],
  24112. messageSends: []
  24113. }),
  24114. $globals.SmalltalkImage);
  24115. $globals.SmalltalkImage.a$cls.iVarNames = ["current"];
  24116. $core.addMethod(
  24117. $core.method({
  24118. selector: "current",
  24119. protocol: "instance creation",
  24120. fn: function (){
  24121. var self=this,$self=this;
  24122. return $core.withContext(function($ctx1) {
  24123. var $1,$receiver;
  24124. $1=$self["@current"];
  24125. if(($receiver = $1) == null || $receiver.a$nil){
  24126. $self["@current"]=(
  24127. $ctx1.supercall = true,
  24128. ($globals.SmalltalkImage.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  24129. $ctx1.supercall = false;
  24130. return $self["@current"];
  24131. } else {
  24132. $self._deprecatedAPI();
  24133. return $self["@current"];
  24134. }
  24135. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SmalltalkImage.a$cls)});
  24136. },
  24137. args: [],
  24138. source: "current\x0a\x09^ current ifNil: [ current := super new ] ifNotNil: [ self deprecatedAPI. current ]",
  24139. referencedClasses: [],
  24140. messageSends: ["ifNil:ifNotNil:", "new", "deprecatedAPI"]
  24141. }),
  24142. $globals.SmalltalkImage.a$cls);
  24143. $core.addMethod(
  24144. $core.method({
  24145. selector: "initialize",
  24146. protocol: "initialization",
  24147. fn: function (){
  24148. var self=this,$self=this;
  24149. var st;
  24150. return $core.withContext(function($ctx1) {
  24151. st=$self._current();
  24152. $recv($recv(st)._globals())._at_put_("Smalltalk",st);
  24153. return self;
  24154. }, function($ctx1) {$ctx1.fill(self,"initialize",{st:st},$globals.SmalltalkImage.a$cls)});
  24155. },
  24156. args: [],
  24157. source: "initialize\x0a\x09| st |\x0a\x09st := self current.\x0a\x09st globals at: 'Smalltalk' put: st",
  24158. referencedClasses: [],
  24159. messageSends: ["current", "at:put:", "globals"]
  24160. }),
  24161. $globals.SmalltalkImage.a$cls);
  24162. $core.addMethod(
  24163. $core.method({
  24164. selector: "new",
  24165. protocol: "instance creation",
  24166. fn: function (){
  24167. var self=this,$self=this;
  24168. return $core.withContext(function($ctx1) {
  24169. $self._shouldNotImplement();
  24170. return self;
  24171. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SmalltalkImage.a$cls)});
  24172. },
  24173. args: [],
  24174. source: "new\x0a\x09self shouldNotImplement",
  24175. referencedClasses: [],
  24176. messageSends: ["shouldNotImplement"]
  24177. }),
  24178. $globals.SmalltalkImage.a$cls);
  24179. $core.setTraitComposition([{trait: $globals.TThenable}], $globals.JSObjectProxy);
  24180. $core.addMethod(
  24181. $core.method({
  24182. selector: "nextPutJSObject:",
  24183. protocol: "*Kernel-Infrastructure",
  24184. fn: function (aJSObject){
  24185. var self=this,$self=this;
  24186. return $core.withContext(function($ctx1) {
  24187. $self._nextPut_(aJSObject);
  24188. return self;
  24189. }, function($ctx1) {$ctx1.fill(self,"nextPutJSObject:",{aJSObject:aJSObject},$globals.ProtoStream)});
  24190. },
  24191. args: ["aJSObject"],
  24192. source: "nextPutJSObject: aJSObject\x0a\x09self nextPut: aJSObject",
  24193. referencedClasses: [],
  24194. messageSends: ["nextPut:"]
  24195. }),
  24196. $globals.ProtoStream);
  24197. $core.addMethod(
  24198. $core.method({
  24199. selector: "asJavaScriptPropertyName",
  24200. protocol: "*Kernel-Infrastructure",
  24201. fn: function (){
  24202. var self=this,$self=this;
  24203. return $core.withContext(function($ctx1) {
  24204. return $core.st2prop(self);
  24205. return self;
  24206. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptPropertyName",{},$globals.String)});
  24207. },
  24208. args: [],
  24209. source: "asJavaScriptPropertyName\x0a<inlineJS: 'return $core.st2prop(self)'>",
  24210. referencedClasses: [],
  24211. messageSends: []
  24212. }),
  24213. $globals.String);
  24214. $core.addMethod(
  24215. $core.method({
  24216. selector: "asSetting",
  24217. protocol: "*Kernel-Infrastructure",
  24218. fn: function (){
  24219. var self=this,$self=this;
  24220. return $core.withContext(function($ctx1) {
  24221. return $recv($globals.Setting)._at_ifAbsent_(self,nil);
  24222. }, function($ctx1) {$ctx1.fill(self,"asSetting",{},$globals.String)});
  24223. },
  24224. args: [],
  24225. 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",
  24226. referencedClasses: ["Setting"],
  24227. messageSends: ["at:ifAbsent:"]
  24228. }),
  24229. $globals.String);
  24230. $core.addMethod(
  24231. $core.method({
  24232. selector: "asSettingIfAbsent:",
  24233. protocol: "*Kernel-Infrastructure",
  24234. fn: function (aDefaultValue){
  24235. var self=this,$self=this;
  24236. return $core.withContext(function($ctx1) {
  24237. return $recv($globals.Setting)._at_ifAbsent_(self,aDefaultValue);
  24238. }, function($ctx1) {$ctx1.fill(self,"asSettingIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  24239. },
  24240. args: ["aDefaultValue"],
  24241. 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",
  24242. referencedClasses: ["Setting"],
  24243. messageSends: ["at:ifAbsent:"]
  24244. }),
  24245. $globals.String);
  24246. $core.addMethod(
  24247. $core.method({
  24248. selector: "settingValue",
  24249. protocol: "*Kernel-Infrastructure",
  24250. fn: function (){
  24251. var self=this,$self=this;
  24252. return $core.withContext(function($ctx1) {
  24253. return $recv($self._asSetting())._value();
  24254. }, function($ctx1) {$ctx1.fill(self,"settingValue",{},$globals.String)});
  24255. },
  24256. args: [],
  24257. source: "settingValue\x0a\x09^ self asSetting value",
  24258. referencedClasses: [],
  24259. messageSends: ["value", "asSetting"]
  24260. }),
  24261. $globals.String);
  24262. $core.addMethod(
  24263. $core.method({
  24264. selector: "settingValue:",
  24265. protocol: "*Kernel-Infrastructure",
  24266. fn: function (aValue){
  24267. var self=this,$self=this;
  24268. return $core.withContext(function($ctx1) {
  24269. return $recv($self._asSetting())._value_(aValue);
  24270. }, function($ctx1) {$ctx1.fill(self,"settingValue:",{aValue:aValue},$globals.String)});
  24271. },
  24272. args: ["aValue"],
  24273. 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",
  24274. referencedClasses: [],
  24275. messageSends: ["value:", "asSetting"]
  24276. }),
  24277. $globals.String);
  24278. $core.addMethod(
  24279. $core.method({
  24280. selector: "settingValueIfAbsent:",
  24281. protocol: "*Kernel-Infrastructure",
  24282. fn: function (aDefaultValue){
  24283. var self=this,$self=this;
  24284. return $core.withContext(function($ctx1) {
  24285. return $recv($self._asSettingIfAbsent_(aDefaultValue))._value();
  24286. }, function($ctx1) {$ctx1.fill(self,"settingValueIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  24287. },
  24288. args: ["aDefaultValue"],
  24289. 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",
  24290. referencedClasses: [],
  24291. messageSends: ["value", "asSettingIfAbsent:"]
  24292. }),
  24293. $globals.String);
  24294. });
  24295. define('amber_core/Kernel-Announcements',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  24296. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  24297. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  24298. var $pkg = $core.addPackage("Kernel-Announcements");
  24299. $pkg.innerEval = function (expr) { return eval(expr); };
  24300. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  24301. $core.addClass("AnnouncementSubscription", $globals.Object, ["valuable", "announcementClass"], "Kernel-Announcements");
  24302. $globals.AnnouncementSubscription.comment="I am a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible.";
  24303. $core.addMethod(
  24304. $core.method({
  24305. selector: "announcementClass",
  24306. protocol: "accessing",
  24307. fn: function (){
  24308. var self=this,$self=this;
  24309. return $self["@announcementClass"];
  24310. },
  24311. args: [],
  24312. source: "announcementClass\x0a\x09^ announcementClass",
  24313. referencedClasses: [],
  24314. messageSends: []
  24315. }),
  24316. $globals.AnnouncementSubscription);
  24317. $core.addMethod(
  24318. $core.method({
  24319. selector: "announcementClass:",
  24320. protocol: "accessing",
  24321. fn: function (aClass){
  24322. var self=this,$self=this;
  24323. return $core.withContext(function($ctx1) {
  24324. $self["@announcementClass"]=$recv($recv($globals.Smalltalk)._globals())._at_($recv(aClass)._name());
  24325. return self;
  24326. }, function($ctx1) {$ctx1.fill(self,"announcementClass:",{aClass:aClass},$globals.AnnouncementSubscription)});
  24327. },
  24328. args: ["aClass"],
  24329. source: "announcementClass: aClass\x0a\x09announcementClass := Smalltalk globals at: aClass name",
  24330. referencedClasses: ["Smalltalk"],
  24331. messageSends: ["at:", "globals", "name"]
  24332. }),
  24333. $globals.AnnouncementSubscription);
  24334. $core.addMethod(
  24335. $core.method({
  24336. selector: "deliver:",
  24337. protocol: "announcing",
  24338. fn: function (anAnnouncement){
  24339. var self=this,$self=this;
  24340. return $core.withContext(function($ctx1) {
  24341. var $1;
  24342. $1=$self._handlesAnnouncement_(anAnnouncement);
  24343. if($core.assert($1)){
  24344. $recv($self._valuable())._value_(anAnnouncement);
  24345. }
  24346. return self;
  24347. }, function($ctx1) {$ctx1.fill(self,"deliver:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  24348. },
  24349. args: ["anAnnouncement"],
  24350. source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [ self valuable value: anAnnouncement ]",
  24351. referencedClasses: [],
  24352. messageSends: ["ifTrue:", "handlesAnnouncement:", "value:", "valuable"]
  24353. }),
  24354. $globals.AnnouncementSubscription);
  24355. $core.addMethod(
  24356. $core.method({
  24357. selector: "handlesAnnouncement:",
  24358. protocol: "announcing",
  24359. fn: function (anAnnouncement){
  24360. var self=this,$self=this;
  24361. return $core.withContext(function($ctx1) {
  24362. return $recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv(anAnnouncement)._class())._name()))._includesBehavior_($self._announcementClass());
  24363. }, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  24364. },
  24365. args: ["anAnnouncement"],
  24366. 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",
  24367. referencedClasses: ["Smalltalk"],
  24368. messageSends: ["includesBehavior:", "at:", "globals", "name", "class", "announcementClass"]
  24369. }),
  24370. $globals.AnnouncementSubscription);
  24371. $core.addMethod(
  24372. $core.method({
  24373. selector: "receiver",
  24374. protocol: "accessing",
  24375. fn: function (){
  24376. var self=this,$self=this;
  24377. return $core.withContext(function($ctx1) {
  24378. return $recv($self._valuable())._receiver();
  24379. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.AnnouncementSubscription)});
  24380. },
  24381. args: [],
  24382. source: "receiver\x0a\x09^ self valuable receiver",
  24383. referencedClasses: [],
  24384. messageSends: ["receiver", "valuable"]
  24385. }),
  24386. $globals.AnnouncementSubscription);
  24387. $core.addMethod(
  24388. $core.method({
  24389. selector: "valuable",
  24390. protocol: "accessing",
  24391. fn: function (){
  24392. var self=this,$self=this;
  24393. return $self["@valuable"];
  24394. },
  24395. args: [],
  24396. source: "valuable\x0a\x09^ valuable",
  24397. referencedClasses: [],
  24398. messageSends: []
  24399. }),
  24400. $globals.AnnouncementSubscription);
  24401. $core.addMethod(
  24402. $core.method({
  24403. selector: "valuable:",
  24404. protocol: "accessing",
  24405. fn: function (aValuable){
  24406. var self=this,$self=this;
  24407. $self["@valuable"]=aValuable;
  24408. return self;
  24409. },
  24410. args: ["aValuable"],
  24411. source: "valuable: aValuable\x0a\x09valuable := aValuable",
  24412. referencedClasses: [],
  24413. messageSends: []
  24414. }),
  24415. $globals.AnnouncementSubscription);
  24416. $core.addClass("AnnouncementValuable", $globals.Object, ["valuable", "receiver"], "Kernel-Announcements");
  24417. $globals.AnnouncementValuable.comment="I wrap `valuable` objects (typically instances of `BlockClosure`) with a `receiver` to be able to unregister subscriptions based on a `receiver`.";
  24418. $core.addMethod(
  24419. $core.method({
  24420. selector: "receiver",
  24421. protocol: "accessing",
  24422. fn: function (){
  24423. var self=this,$self=this;
  24424. return $self["@receiver"];
  24425. },
  24426. args: [],
  24427. source: "receiver\x0a\x09^ receiver",
  24428. referencedClasses: [],
  24429. messageSends: []
  24430. }),
  24431. $globals.AnnouncementValuable);
  24432. $core.addMethod(
  24433. $core.method({
  24434. selector: "receiver:",
  24435. protocol: "accessing",
  24436. fn: function (anObject){
  24437. var self=this,$self=this;
  24438. $self["@receiver"]=anObject;
  24439. return self;
  24440. },
  24441. args: ["anObject"],
  24442. source: "receiver: anObject\x0a\x09receiver := anObject",
  24443. referencedClasses: [],
  24444. messageSends: []
  24445. }),
  24446. $globals.AnnouncementValuable);
  24447. $core.addMethod(
  24448. $core.method({
  24449. selector: "valuable",
  24450. protocol: "accessing",
  24451. fn: function (){
  24452. var self=this,$self=this;
  24453. return $self["@valuable"];
  24454. },
  24455. args: [],
  24456. source: "valuable\x0a\x09^ valuable",
  24457. referencedClasses: [],
  24458. messageSends: []
  24459. }),
  24460. $globals.AnnouncementValuable);
  24461. $core.addMethod(
  24462. $core.method({
  24463. selector: "valuable:",
  24464. protocol: "accessing",
  24465. fn: function (anObject){
  24466. var self=this,$self=this;
  24467. $self["@valuable"]=anObject;
  24468. return self;
  24469. },
  24470. args: ["anObject"],
  24471. source: "valuable: anObject\x0a\x09valuable := anObject",
  24472. referencedClasses: [],
  24473. messageSends: []
  24474. }),
  24475. $globals.AnnouncementValuable);
  24476. $core.addMethod(
  24477. $core.method({
  24478. selector: "value",
  24479. protocol: "evaluating",
  24480. fn: function (){
  24481. var self=this,$self=this;
  24482. return $core.withContext(function($ctx1) {
  24483. return $recv($self._valuable())._value();
  24484. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AnnouncementValuable)});
  24485. },
  24486. args: [],
  24487. source: "value\x0a\x09^ self valuable value",
  24488. referencedClasses: [],
  24489. messageSends: ["value", "valuable"]
  24490. }),
  24491. $globals.AnnouncementValuable);
  24492. $core.addMethod(
  24493. $core.method({
  24494. selector: "value:",
  24495. protocol: "evaluating",
  24496. fn: function (anObject){
  24497. var self=this,$self=this;
  24498. return $core.withContext(function($ctx1) {
  24499. return $recv($self._valuable())._value_(anObject);
  24500. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.AnnouncementValuable)});
  24501. },
  24502. args: ["anObject"],
  24503. source: "value: anObject\x0a\x09^ self valuable value: anObject",
  24504. referencedClasses: [],
  24505. messageSends: ["value:", "valuable"]
  24506. }),
  24507. $globals.AnnouncementValuable);
  24508. $core.addClass("Announcer", $globals.Object, ["registry", "subscriptions"], "Kernel-Announcements");
  24509. $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' ].";
  24510. $core.addMethod(
  24511. $core.method({
  24512. selector: "announce:",
  24513. protocol: "announcing",
  24514. fn: function (anAnnouncement){
  24515. var self=this,$self=this;
  24516. return $core.withContext(function($ctx1) {
  24517. $recv($self["@subscriptions"])._do_((function(each){
  24518. return $core.withContext(function($ctx2) {
  24519. return $recv(each)._deliver_(anAnnouncement);
  24520. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  24521. }));
  24522. return self;
  24523. }, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement},$globals.Announcer)});
  24524. },
  24525. args: ["anAnnouncement"],
  24526. source: "announce: anAnnouncement\x0a\x09subscriptions do: [ :each |\x0a\x09\x09each deliver: anAnnouncement ]",
  24527. referencedClasses: [],
  24528. messageSends: ["do:", "deliver:"]
  24529. }),
  24530. $globals.Announcer);
  24531. $core.addMethod(
  24532. $core.method({
  24533. selector: "initialize",
  24534. protocol: "initialization",
  24535. fn: function (){
  24536. var self=this,$self=this;
  24537. return $core.withContext(function($ctx1) {
  24538. (
  24539. $ctx1.supercall = true,
  24540. ($globals.Announcer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  24541. $ctx1.supercall = false;
  24542. $self["@subscriptions"]=$recv($globals.OrderedCollection)._new();
  24543. return self;
  24544. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Announcer)});
  24545. },
  24546. args: [],
  24547. source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := OrderedCollection new",
  24548. referencedClasses: ["OrderedCollection"],
  24549. messageSends: ["initialize", "new"]
  24550. }),
  24551. $globals.Announcer);
  24552. $core.addMethod(
  24553. $core.method({
  24554. selector: "on:do:",
  24555. protocol: "subscribing",
  24556. fn: function (aClass,aBlock){
  24557. var self=this,$self=this;
  24558. return $core.withContext(function($ctx1) {
  24559. $self._on_do_for_(aClass,aBlock,nil);
  24560. return self;
  24561. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.Announcer)});
  24562. },
  24563. args: ["aClass", "aBlock"],
  24564. source: "on: aClass do: aBlock\x0a\x09self on: aClass do: aBlock for: nil",
  24565. referencedClasses: [],
  24566. messageSends: ["on:do:for:"]
  24567. }),
  24568. $globals.Announcer);
  24569. $core.addMethod(
  24570. $core.method({
  24571. selector: "on:do:for:",
  24572. protocol: "subscribing",
  24573. fn: function (aClass,aBlock,aReceiver){
  24574. var self=this,$self=this;
  24575. return $core.withContext(function($ctx1) {
  24576. var $1,$3,$5,$6,$4,$2;
  24577. $1=$self["@subscriptions"];
  24578. $3=$recv($globals.AnnouncementSubscription)._new();
  24579. $ctx1.sendIdx["new"]=1;
  24580. $5=$recv($globals.AnnouncementValuable)._new();
  24581. $recv($5)._valuable_(aBlock);
  24582. $recv($5)._receiver_(aReceiver);
  24583. $6=$recv($5)._yourself();
  24584. $ctx1.sendIdx["yourself"]=1;
  24585. $4=$6;
  24586. $recv($3)._valuable_($4);
  24587. $ctx1.sendIdx["valuable:"]=1;
  24588. $recv($3)._announcementClass_(aClass);
  24589. $2=$recv($3)._yourself();
  24590. $recv($1)._add_($2);
  24591. return self;
  24592. }, function($ctx1) {$ctx1.fill(self,"on:do:for:",{aClass:aClass,aBlock:aBlock,aReceiver:aReceiver},$globals.Announcer)});
  24593. },
  24594. args: ["aClass", "aBlock", "aReceiver"],
  24595. 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)",
  24596. referencedClasses: ["AnnouncementSubscription", "AnnouncementValuable"],
  24597. messageSends: ["add:", "valuable:", "new", "receiver:", "yourself", "announcementClass:"]
  24598. }),
  24599. $globals.Announcer);
  24600. $core.addMethod(
  24601. $core.method({
  24602. selector: "on:doOnce:",
  24603. protocol: "subscribing",
  24604. fn: function (aClass,aBlock){
  24605. var self=this,$self=this;
  24606. var subscription;
  24607. return $core.withContext(function($ctx1) {
  24608. var $1;
  24609. $1=$recv($globals.AnnouncementSubscription)._new();
  24610. $recv($1)._announcementClass_(aClass);
  24611. subscription=$recv($1)._yourself();
  24612. $recv(subscription)._valuable_((function(ann){
  24613. return $core.withContext(function($ctx2) {
  24614. $recv($self["@subscriptions"])._remove_(subscription);
  24615. return $recv(aBlock)._value_(ann);
  24616. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,1)});
  24617. }));
  24618. $recv($self["@subscriptions"])._add_(subscription);
  24619. return self;
  24620. }, function($ctx1) {$ctx1.fill(self,"on:doOnce:",{aClass:aClass,aBlock:aBlock,subscription:subscription},$globals.Announcer)});
  24621. },
  24622. args: ["aClass", "aBlock"],
  24623. 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",
  24624. referencedClasses: ["AnnouncementSubscription"],
  24625. messageSends: ["announcementClass:", "new", "yourself", "valuable:", "remove:", "value:", "add:"]
  24626. }),
  24627. $globals.Announcer);
  24628. $core.addMethod(
  24629. $core.method({
  24630. selector: "on:send:to:",
  24631. protocol: "subscribing",
  24632. fn: function (aClass,aSelector,anObject){
  24633. var self=this,$self=this;
  24634. return $core.withContext(function($ctx1) {
  24635. var $1,$3,$5,$6,$4,$2;
  24636. $1=$self["@subscriptions"];
  24637. $3=$recv($globals.AnnouncementSubscription)._new();
  24638. $ctx1.sendIdx["new"]=1;
  24639. $5=$recv($globals.MessageSend)._new();
  24640. $recv($5)._receiver_(anObject);
  24641. $recv($5)._selector_(aSelector);
  24642. $6=$recv($5)._yourself();
  24643. $ctx1.sendIdx["yourself"]=1;
  24644. $4=$6;
  24645. $recv($3)._valuable_($4);
  24646. $recv($3)._announcementClass_(aClass);
  24647. $2=$recv($3)._yourself();
  24648. $recv($1)._add_($2);
  24649. return self;
  24650. }, function($ctx1) {$ctx1.fill(self,"on:send:to:",{aClass:aClass,aSelector:aSelector,anObject:anObject},$globals.Announcer)});
  24651. },
  24652. args: ["aClass", "aSelector", "anObject"],
  24653. 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)",
  24654. referencedClasses: ["AnnouncementSubscription", "MessageSend"],
  24655. messageSends: ["add:", "valuable:", "new", "receiver:", "selector:", "yourself", "announcementClass:"]
  24656. }),
  24657. $globals.Announcer);
  24658. $core.addMethod(
  24659. $core.method({
  24660. selector: "unsubscribe:",
  24661. protocol: "subscribing",
  24662. fn: function (anObject){
  24663. var self=this,$self=this;
  24664. return $core.withContext(function($ctx1) {
  24665. $self["@subscriptions"]=$recv($self["@subscriptions"])._reject_((function(each){
  24666. return $core.withContext(function($ctx2) {
  24667. return $recv($recv(each)._receiver()).__eq(anObject);
  24668. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  24669. }));
  24670. return self;
  24671. }, function($ctx1) {$ctx1.fill(self,"unsubscribe:",{anObject:anObject},$globals.Announcer)});
  24672. },
  24673. args: ["anObject"],
  24674. source: "unsubscribe: anObject\x0a\x09subscriptions := subscriptions reject: [ :each |\x0a\x09\x09each receiver = anObject ]",
  24675. referencedClasses: [],
  24676. messageSends: ["reject:", "=", "receiver"]
  24677. }),
  24678. $globals.Announcer);
  24679. $core.addClass("SystemAnnouncer", $globals.Announcer, [], "Kernel-Announcements");
  24680. $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`";
  24681. $globals.SystemAnnouncer.a$cls.iVarNames = ["current"];
  24682. $core.addMethod(
  24683. $core.method({
  24684. selector: "current",
  24685. protocol: "accessing",
  24686. fn: function (){
  24687. var self=this,$self=this;
  24688. return $core.withContext(function($ctx1) {
  24689. var $1,$receiver;
  24690. $1=$self["@current"];
  24691. if(($receiver = $1) == null || $receiver.a$nil){
  24692. $self["@current"]=(
  24693. $ctx1.supercall = true,
  24694. ($globals.SystemAnnouncer.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  24695. $ctx1.supercall = false;
  24696. return $self["@current"];
  24697. } else {
  24698. return $1;
  24699. }
  24700. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SystemAnnouncer.a$cls)});
  24701. },
  24702. args: [],
  24703. source: "current\x0a\x09^ current ifNil: [ current := super new ]",
  24704. referencedClasses: [],
  24705. messageSends: ["ifNil:", "new"]
  24706. }),
  24707. $globals.SystemAnnouncer.a$cls);
  24708. $core.addMethod(
  24709. $core.method({
  24710. selector: "new",
  24711. protocol: "instance creation",
  24712. fn: function (){
  24713. var self=this,$self=this;
  24714. return $core.withContext(function($ctx1) {
  24715. $self._shouldNotImplement();
  24716. return self;
  24717. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SystemAnnouncer.a$cls)});
  24718. },
  24719. args: [],
  24720. source: "new\x0a\x09self shouldNotImplement",
  24721. referencedClasses: [],
  24722. messageSends: ["shouldNotImplement"]
  24723. }),
  24724. $globals.SystemAnnouncer.a$cls);
  24725. $core.addClass("SystemAnnouncement", $globals.Object, [], "Kernel-Announcements");
  24726. $globals.SystemAnnouncement.comment="I am the superclass of all system announcements";
  24727. $core.addMethod(
  24728. $core.method({
  24729. selector: "classTag",
  24730. protocol: "accessing",
  24731. fn: function (){
  24732. var self=this,$self=this;
  24733. return "announcement";
  24734. },
  24735. args: [],
  24736. 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'",
  24737. referencedClasses: [],
  24738. messageSends: []
  24739. }),
  24740. $globals.SystemAnnouncement.a$cls);
  24741. $core.addClass("ClassAnnouncement", $globals.SystemAnnouncement, ["theClass"], "Kernel-Announcements");
  24742. $globals.ClassAnnouncement.comment="I am the abstract superclass of class-related announcements.";
  24743. $core.addMethod(
  24744. $core.method({
  24745. selector: "theClass",
  24746. protocol: "accessing",
  24747. fn: function (){
  24748. var self=this,$self=this;
  24749. return $self["@theClass"];
  24750. },
  24751. args: [],
  24752. source: "theClass\x0a\x09^ theClass",
  24753. referencedClasses: [],
  24754. messageSends: []
  24755. }),
  24756. $globals.ClassAnnouncement);
  24757. $core.addMethod(
  24758. $core.method({
  24759. selector: "theClass:",
  24760. protocol: "accessing",
  24761. fn: function (aClass){
  24762. var self=this,$self=this;
  24763. $self["@theClass"]=aClass;
  24764. return self;
  24765. },
  24766. args: ["aClass"],
  24767. source: "theClass: aClass\x0a\x09theClass := aClass",
  24768. referencedClasses: [],
  24769. messageSends: []
  24770. }),
  24771. $globals.ClassAnnouncement);
  24772. $core.addClass("ClassAdded", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24773. $globals.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods";
  24774. $core.addClass("ClassCommentChanged", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24775. $globals.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)";
  24776. $core.addClass("ClassDefinitionChanged", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24777. $globals.ClassDefinitionChanged.comment="I am emitted when the definition of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:";
  24778. $core.addClass("ClassMigrated", $globals.ClassAnnouncement, ["oldClass"], "Kernel-Announcements");
  24779. $globals.ClassMigrated.comment="I am emitted when a class is migrated.";
  24780. $core.addMethod(
  24781. $core.method({
  24782. selector: "oldClass",
  24783. protocol: "accessing",
  24784. fn: function (){
  24785. var self=this,$self=this;
  24786. return $self["@oldClass"];
  24787. },
  24788. args: [],
  24789. source: "oldClass\x0a\x09^ oldClass",
  24790. referencedClasses: [],
  24791. messageSends: []
  24792. }),
  24793. $globals.ClassMigrated);
  24794. $core.addMethod(
  24795. $core.method({
  24796. selector: "oldClass:",
  24797. protocol: "accessing",
  24798. fn: function (aClass){
  24799. var self=this,$self=this;
  24800. $self["@oldClass"]=aClass;
  24801. return self;
  24802. },
  24803. args: ["aClass"],
  24804. source: "oldClass: aClass\x0a\x09oldClass := aClass",
  24805. referencedClasses: [],
  24806. messageSends: []
  24807. }),
  24808. $globals.ClassMigrated);
  24809. $core.addClass("ClassMoved", $globals.ClassAnnouncement, ["oldPackage"], "Kernel-Announcements");
  24810. $globals.ClassMoved.comment="I am emitted when a class is moved from one package to another.";
  24811. $core.addMethod(
  24812. $core.method({
  24813. selector: "oldPackage",
  24814. protocol: "accessing",
  24815. fn: function (){
  24816. var self=this,$self=this;
  24817. return $self["@oldPackage"];
  24818. },
  24819. args: [],
  24820. source: "oldPackage\x0a\x09^ oldPackage",
  24821. referencedClasses: [],
  24822. messageSends: []
  24823. }),
  24824. $globals.ClassMoved);
  24825. $core.addMethod(
  24826. $core.method({
  24827. selector: "oldPackage:",
  24828. protocol: "accessing",
  24829. fn: function (aPackage){
  24830. var self=this,$self=this;
  24831. $self["@oldPackage"]=aPackage;
  24832. return self;
  24833. },
  24834. args: ["aPackage"],
  24835. source: "oldPackage: aPackage\x0a\x09oldPackage := aPackage",
  24836. referencedClasses: [],
  24837. messageSends: []
  24838. }),
  24839. $globals.ClassMoved);
  24840. $core.addClass("ClassRemoved", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24841. $globals.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:";
  24842. $core.addClass("ClassRenamed", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24843. $globals.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:";
  24844. $core.addClass("MethodAnnouncement", $globals.SystemAnnouncement, ["method"], "Kernel-Announcements");
  24845. $globals.MethodAnnouncement.comment="I am the abstract superclass of method-related announcements.";
  24846. $core.addMethod(
  24847. $core.method({
  24848. selector: "method",
  24849. protocol: "accessing",
  24850. fn: function (){
  24851. var self=this,$self=this;
  24852. return $self["@method"];
  24853. },
  24854. args: [],
  24855. source: "method\x0a\x09^ method",
  24856. referencedClasses: [],
  24857. messageSends: []
  24858. }),
  24859. $globals.MethodAnnouncement);
  24860. $core.addMethod(
  24861. $core.method({
  24862. selector: "method:",
  24863. protocol: "accessing",
  24864. fn: function (aCompiledMethod){
  24865. var self=this,$self=this;
  24866. $self["@method"]=aCompiledMethod;
  24867. return self;
  24868. },
  24869. args: ["aCompiledMethod"],
  24870. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  24871. referencedClasses: [],
  24872. messageSends: []
  24873. }),
  24874. $globals.MethodAnnouncement);
  24875. $core.addClass("MethodAdded", $globals.MethodAnnouncement, [], "Kernel-Announcements");
  24876. $globals.MethodAdded.comment="I am emitted when a `CompiledMethod` is added to a class.";
  24877. $core.addClass("MethodModified", $globals.MethodAnnouncement, ["oldMethod"], "Kernel-Announcements");
  24878. $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.";
  24879. $core.addMethod(
  24880. $core.method({
  24881. selector: "oldMethod",
  24882. protocol: "accessing",
  24883. fn: function (){
  24884. var self=this,$self=this;
  24885. return $self["@oldMethod"];
  24886. },
  24887. args: [],
  24888. source: "oldMethod\x0a\x09^ oldMethod",
  24889. referencedClasses: [],
  24890. messageSends: []
  24891. }),
  24892. $globals.MethodModified);
  24893. $core.addMethod(
  24894. $core.method({
  24895. selector: "oldMethod:",
  24896. protocol: "accessing",
  24897. fn: function (aMethod){
  24898. var self=this,$self=this;
  24899. $self["@oldMethod"]=aMethod;
  24900. return self;
  24901. },
  24902. args: ["aMethod"],
  24903. source: "oldMethod: aMethod\x0a\x09oldMethod := aMethod",
  24904. referencedClasses: [],
  24905. messageSends: []
  24906. }),
  24907. $globals.MethodModified);
  24908. $core.addClass("MethodMoved", $globals.MethodAnnouncement, ["oldProtocol"], "Kernel-Announcements");
  24909. $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.";
  24910. $core.addMethod(
  24911. $core.method({
  24912. selector: "oldProtocol",
  24913. protocol: "accessing",
  24914. fn: function (){
  24915. var self=this,$self=this;
  24916. return $self["@oldProtocol"];
  24917. },
  24918. args: [],
  24919. source: "oldProtocol\x0a\x09^ oldProtocol",
  24920. referencedClasses: [],
  24921. messageSends: []
  24922. }),
  24923. $globals.MethodMoved);
  24924. $core.addMethod(
  24925. $core.method({
  24926. selector: "oldProtocol:",
  24927. protocol: "accessing",
  24928. fn: function (aString){
  24929. var self=this,$self=this;
  24930. $self["@oldProtocol"]=aString;
  24931. return self;
  24932. },
  24933. args: ["aString"],
  24934. source: "oldProtocol: aString\x0a\x09oldProtocol := aString",
  24935. referencedClasses: [],
  24936. messageSends: []
  24937. }),
  24938. $globals.MethodMoved);
  24939. $core.addClass("MethodRemoved", $globals.MethodAnnouncement, [], "Kernel-Announcements");
  24940. $globals.MethodRemoved.comment="I am emitted when a `CompiledMethod` is removed from a class.";
  24941. $core.addClass("PackageAnnouncement", $globals.SystemAnnouncement, ["package"], "Kernel-Announcements");
  24942. $globals.PackageAnnouncement.comment="I am the abstract superclass of package-related announcements.";
  24943. $core.addMethod(
  24944. $core.method({
  24945. selector: "package",
  24946. protocol: "accessing",
  24947. fn: function (){
  24948. var self=this,$self=this;
  24949. return $self["@package"];
  24950. },
  24951. args: [],
  24952. source: "package\x0a\x09^ package",
  24953. referencedClasses: [],
  24954. messageSends: []
  24955. }),
  24956. $globals.PackageAnnouncement);
  24957. $core.addMethod(
  24958. $core.method({
  24959. selector: "package:",
  24960. protocol: "accessing",
  24961. fn: function (aPackage){
  24962. var self=this,$self=this;
  24963. $self["@package"]=aPackage;
  24964. return self;
  24965. },
  24966. args: ["aPackage"],
  24967. source: "package: aPackage\x0a\x09package := aPackage",
  24968. referencedClasses: [],
  24969. messageSends: []
  24970. }),
  24971. $globals.PackageAnnouncement);
  24972. $core.addClass("PackageAdded", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  24973. $globals.PackageAdded.comment="I am emitted when a `Package` is added to the system.";
  24974. $core.addClass("PackageClean", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  24975. $globals.PackageClean.comment="I am emitted when a package is committed and becomes clean.";
  24976. $core.addClass("PackageDirty", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  24977. $globals.PackageDirty.comment="I am emitted when a package becomes dirty.";
  24978. $core.addClass("PackageRemoved", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  24979. $globals.PackageRemoved.comment="I am emitted when a `Package` is removed from the system.";
  24980. $core.addClass("ProtocolAnnouncement", $globals.SystemAnnouncement, ["theClass", "protocol"], "Kernel-Announcements");
  24981. $globals.ProtocolAnnouncement.comment="I am the abstract superclass of protocol-related announcements.";
  24982. $core.addMethod(
  24983. $core.method({
  24984. selector: "package",
  24985. protocol: "accessing",
  24986. fn: function (){
  24987. var self=this,$self=this;
  24988. return $core.withContext(function($ctx1) {
  24989. var $1,$receiver;
  24990. $1=$self._theClass();
  24991. if(($receiver = $1) == null || $receiver.a$nil){
  24992. return $1;
  24993. } else {
  24994. var class_;
  24995. class_=$receiver;
  24996. return $recv(class_)._packageOfProtocol_($self._protocol());
  24997. }
  24998. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.ProtocolAnnouncement)});
  24999. },
  25000. args: [],
  25001. source: "package\x0a\x09\x0a\x09^ self theClass ifNotNil: [ :class | class packageOfProtocol: self protocol ]",
  25002. referencedClasses: [],
  25003. messageSends: ["ifNotNil:", "theClass", "packageOfProtocol:", "protocol"]
  25004. }),
  25005. $globals.ProtocolAnnouncement);
  25006. $core.addMethod(
  25007. $core.method({
  25008. selector: "protocol",
  25009. protocol: "accessing",
  25010. fn: function (){
  25011. var self=this,$self=this;
  25012. return $self["@protocol"];
  25013. },
  25014. args: [],
  25015. source: "protocol\x0a\x09^ protocol",
  25016. referencedClasses: [],
  25017. messageSends: []
  25018. }),
  25019. $globals.ProtocolAnnouncement);
  25020. $core.addMethod(
  25021. $core.method({
  25022. selector: "protocol:",
  25023. protocol: "accessing",
  25024. fn: function (aString){
  25025. var self=this,$self=this;
  25026. $self["@protocol"]=aString;
  25027. return self;
  25028. },
  25029. args: ["aString"],
  25030. source: "protocol: aString\x0a\x09protocol := aString",
  25031. referencedClasses: [],
  25032. messageSends: []
  25033. }),
  25034. $globals.ProtocolAnnouncement);
  25035. $core.addMethod(
  25036. $core.method({
  25037. selector: "theClass",
  25038. protocol: "accessing",
  25039. fn: function (){
  25040. var self=this,$self=this;
  25041. return $self["@theClass"];
  25042. },
  25043. args: [],
  25044. source: "theClass\x0a\x09^ theClass",
  25045. referencedClasses: [],
  25046. messageSends: []
  25047. }),
  25048. $globals.ProtocolAnnouncement);
  25049. $core.addMethod(
  25050. $core.method({
  25051. selector: "theClass:",
  25052. protocol: "accessing",
  25053. fn: function (aClass){
  25054. var self=this,$self=this;
  25055. $self["@theClass"]=aClass;
  25056. return self;
  25057. },
  25058. args: ["aClass"],
  25059. source: "theClass: aClass\x0a\x09theClass := aClass",
  25060. referencedClasses: [],
  25061. messageSends: []
  25062. }),
  25063. $globals.ProtocolAnnouncement);
  25064. $core.addClass("ProtocolAdded", $globals.ProtocolAnnouncement, [], "Kernel-Announcements");
  25065. $globals.ProtocolAdded.comment="I am emitted when a protocol is added to a class.";
  25066. $core.addClass("ProtocolRemoved", $globals.ProtocolAnnouncement, [], "Kernel-Announcements");
  25067. $globals.ProtocolRemoved.comment="I am emitted when a protocol is removed from a class.";
  25068. });
  25069. define('amber_core/Platform-Services',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Methods", "amber_core/Kernel-Objects"], function($boot){"use strict";
  25070. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  25071. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  25072. var $pkg = $core.addPackage("Platform-Services");
  25073. $pkg.innerEval = function (expr) { return eval(expr); };
  25074. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  25075. $core.addClass("ConsoleErrorHandler", $globals.Object, [], "Platform-Services");
  25076. $globals.ConsoleErrorHandler.comment="I am manage Smalltalk errors, displaying the stack in the console.";
  25077. $core.addMethod(
  25078. $core.method({
  25079. selector: "handleError:",
  25080. protocol: "error handling",
  25081. fn: function (anError){
  25082. var self=this,$self=this;
  25083. return $core.withContext(function($ctx1) {
  25084. var $1,$receiver;
  25085. $1=$recv(anError)._context();
  25086. $ctx1.sendIdx["context"]=1;
  25087. if(($receiver = $1) == null || $receiver.a$nil){
  25088. $1;
  25089. } else {
  25090. $self._logErrorContext_($recv(anError)._context());
  25091. }
  25092. $self._logError_(anError);
  25093. return self;
  25094. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ConsoleErrorHandler)});
  25095. },
  25096. args: ["anError"],
  25097. source: "handleError: anError\x0a\x09anError context ifNotNil: [ self logErrorContext: anError context ].\x0a\x09self logError: anError",
  25098. referencedClasses: [],
  25099. messageSends: ["ifNotNil:", "context", "logErrorContext:", "logError:"]
  25100. }),
  25101. $globals.ConsoleErrorHandler);
  25102. $core.addMethod(
  25103. $core.method({
  25104. selector: "log:",
  25105. protocol: "private",
  25106. fn: function (aString){
  25107. var self=this,$self=this;
  25108. return $core.withContext(function($ctx1) {
  25109. $recv(console)._log_(aString);
  25110. return self;
  25111. }, function($ctx1) {$ctx1.fill(self,"log:",{aString:aString},$globals.ConsoleErrorHandler)});
  25112. },
  25113. args: ["aString"],
  25114. source: "log: aString\x0a\x09console log: aString",
  25115. referencedClasses: [],
  25116. messageSends: ["log:"]
  25117. }),
  25118. $globals.ConsoleErrorHandler);
  25119. $core.addMethod(
  25120. $core.method({
  25121. selector: "logContext:",
  25122. protocol: "private",
  25123. fn: function (aContext){
  25124. var self=this,$self=this;
  25125. return $core.withContext(function($ctx1) {
  25126. var $1,$receiver;
  25127. $1=$recv(aContext)._home();
  25128. $ctx1.sendIdx["home"]=1;
  25129. if(($receiver = $1) == null || $receiver.a$nil){
  25130. $1;
  25131. } else {
  25132. $self._logContext_($recv(aContext)._home());
  25133. }
  25134. $self._log_($recv(aContext)._asString());
  25135. return self;
  25136. }, function($ctx1) {$ctx1.fill(self,"logContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  25137. },
  25138. args: ["aContext"],
  25139. source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home ].\x0a\x09self log: aContext asString",
  25140. referencedClasses: [],
  25141. messageSends: ["ifNotNil:", "home", "logContext:", "log:", "asString"]
  25142. }),
  25143. $globals.ConsoleErrorHandler);
  25144. $core.addMethod(
  25145. $core.method({
  25146. selector: "logError:",
  25147. protocol: "private",
  25148. fn: function (anError){
  25149. var self=this,$self=this;
  25150. return $core.withContext(function($ctx1) {
  25151. $self._log_($recv(anError)._messageText());
  25152. return self;
  25153. }, function($ctx1) {$ctx1.fill(self,"logError:",{anError:anError},$globals.ConsoleErrorHandler)});
  25154. },
  25155. args: ["anError"],
  25156. source: "logError: anError\x0a\x09self log: anError messageText",
  25157. referencedClasses: [],
  25158. messageSends: ["log:", "messageText"]
  25159. }),
  25160. $globals.ConsoleErrorHandler);
  25161. $core.addMethod(
  25162. $core.method({
  25163. selector: "logErrorContext:",
  25164. protocol: "private",
  25165. fn: function (aContext){
  25166. var self=this,$self=this;
  25167. return $core.withContext(function($ctx1) {
  25168. var $1,$receiver;
  25169. if(($receiver = aContext) == null || $receiver.a$nil){
  25170. aContext;
  25171. } else {
  25172. $1=$recv(aContext)._home();
  25173. $ctx1.sendIdx["home"]=1;
  25174. if(($receiver = $1) == null || $receiver.a$nil){
  25175. $1;
  25176. } else {
  25177. $self._logContext_($recv(aContext)._home());
  25178. }
  25179. }
  25180. return self;
  25181. }, function($ctx1) {$ctx1.fill(self,"logErrorContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  25182. },
  25183. args: ["aContext"],
  25184. source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home ]]",
  25185. referencedClasses: [],
  25186. messageSends: ["ifNotNil:", "home", "logContext:"]
  25187. }),
  25188. $globals.ConsoleErrorHandler);
  25189. $globals.ConsoleErrorHandler.a$cls.iVarNames = ["current"];
  25190. $core.addMethod(
  25191. $core.method({
  25192. selector: "initialize",
  25193. protocol: "initialization",
  25194. fn: function (){
  25195. var self=this,$self=this;
  25196. return $core.withContext(function($ctx1) {
  25197. $recv($globals.ErrorHandler)._registerIfNone_($self._new());
  25198. return self;
  25199. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleErrorHandler.a$cls)});
  25200. },
  25201. args: [],
  25202. source: "initialize\x0a\x09ErrorHandler registerIfNone: self new",
  25203. referencedClasses: ["ErrorHandler"],
  25204. messageSends: ["registerIfNone:", "new"]
  25205. }),
  25206. $globals.ConsoleErrorHandler.a$cls);
  25207. $core.addClass("ConsoleTranscript", $globals.Object, ["textarea"], "Platform-Services");
  25208. $globals.ConsoleTranscript.comment="I am a specific transcript emitting to the JavaScript console.\x0a\x0aIf no other transcript is registered, I am the default.";
  25209. $core.addMethod(
  25210. $core.method({
  25211. selector: "clear",
  25212. protocol: "printing",
  25213. fn: function (){
  25214. var self=this,$self=this;
  25215. return self;
  25216. },
  25217. args: [],
  25218. source: "clear\x0a\x09\x22no op\x22",
  25219. referencedClasses: [],
  25220. messageSends: []
  25221. }),
  25222. $globals.ConsoleTranscript);
  25223. $core.addMethod(
  25224. $core.method({
  25225. selector: "cr",
  25226. protocol: "printing",
  25227. fn: function (){
  25228. var self=this,$self=this;
  25229. return self;
  25230. },
  25231. args: [],
  25232. source: "cr\x0a\x09\x22no op\x22",
  25233. referencedClasses: [],
  25234. messageSends: []
  25235. }),
  25236. $globals.ConsoleTranscript);
  25237. $core.addMethod(
  25238. $core.method({
  25239. selector: "open",
  25240. protocol: "actions",
  25241. fn: function (){
  25242. var self=this,$self=this;
  25243. return self;
  25244. },
  25245. args: [],
  25246. source: "open",
  25247. referencedClasses: [],
  25248. messageSends: []
  25249. }),
  25250. $globals.ConsoleTranscript);
  25251. $core.addMethod(
  25252. $core.method({
  25253. selector: "show:",
  25254. protocol: "printing",
  25255. fn: function (anObject){
  25256. var self=this,$self=this;
  25257. return $core.withContext(function($ctx1) {
  25258. console.log(String($recv(anObject)._asString()));
  25259. return self;
  25260. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.ConsoleTranscript)});
  25261. },
  25262. args: ["anObject"],
  25263. 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()))'>",
  25264. referencedClasses: [],
  25265. messageSends: []
  25266. }),
  25267. $globals.ConsoleTranscript);
  25268. $core.addMethod(
  25269. $core.method({
  25270. selector: "initialize",
  25271. protocol: "initialization",
  25272. fn: function (){
  25273. var self=this,$self=this;
  25274. return $core.withContext(function($ctx1) {
  25275. $recv($globals.Transcript)._registerIfNone_($self._new());
  25276. return self;
  25277. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleTranscript.a$cls)});
  25278. },
  25279. args: [],
  25280. source: "initialize\x0a\x09Transcript registerIfNone: self new",
  25281. referencedClasses: ["Transcript"],
  25282. messageSends: ["registerIfNone:", "new"]
  25283. }),
  25284. $globals.ConsoleTranscript.a$cls);
  25285. $core.addClass("Environment", $globals.Object, [], "Platform-Services");
  25286. $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.";
  25287. $core.addMethod(
  25288. $core.method({
  25289. selector: "addInstVarNamed:to:",
  25290. protocol: "compiling",
  25291. fn: function (aString,aClass){
  25292. var self=this,$self=this;
  25293. var newInstVars;
  25294. return $core.withContext(function($ctx1) {
  25295. var $1,$2,$3,$4,$5;
  25296. newInstVars=$recv($recv(aClass)._instanceVariableNames())._copyWith_(aString);
  25297. $1=$recv(aClass)._isMetaclass();
  25298. if($core.assert($1)){
  25299. $2=$self._classBuilder();
  25300. $ctx1.sendIdx["classBuilder"]=1;
  25301. $recv($2)._class_instanceVariables_(aClass,newInstVars);
  25302. } else {
  25303. $3=$self._classBuilder();
  25304. $4=$recv(aClass)._superclass();
  25305. $5=$recv(aClass)._name();
  25306. $ctx1.sendIdx["name"]=1;
  25307. $recv($3)._addSubclassOf_named_instanceVariableNames_package_($4,$5,newInstVars,$recv($recv(aClass)._package())._name());
  25308. }
  25309. return self;
  25310. }, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass,newInstVars:newInstVars},$globals.Environment)});
  25311. },
  25312. args: ["aString", "aClass"],
  25313. source: "addInstVarNamed: aString to: aClass\x0a\x09| newInstVars |\x0a\x09newInstVars := aClass instanceVariableNames copyWith: aString.\x0a\x0a\x09aClass isMetaclass\x0a\x09\x09ifTrue: [ self classBuilder\x0a\x09\x09\x09class: aClass instanceVariables: newInstVars ]\x0a\x09\x09ifFalse: [ self classBuilder\x0a\x09\x09\x09addSubclassOf: aClass superclass \x0a\x09\x09\x09named: aClass name \x0a\x09\x09\x09instanceVariableNames: newInstVars\x0a\x09\x09\x09package: aClass package name ]",
  25314. referencedClasses: [],
  25315. messageSends: ["copyWith:", "instanceVariableNames", "ifTrue:ifFalse:", "isMetaclass", "class:instanceVariables:", "classBuilder", "addSubclassOf:named:instanceVariableNames:package:", "superclass", "name", "package"]
  25316. }),
  25317. $globals.Environment);
  25318. $core.addMethod(
  25319. $core.method({
  25320. selector: "allSelectors",
  25321. protocol: "accessing",
  25322. fn: function (){
  25323. var self=this,$self=this;
  25324. return $core.withContext(function($ctx1) {
  25325. return $recv($recv($globals.Smalltalk)._core())._allSelectors();
  25326. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Environment)});
  25327. },
  25328. args: [],
  25329. source: "allSelectors\x0a\x09^ Smalltalk core allSelectors",
  25330. referencedClasses: ["Smalltalk"],
  25331. messageSends: ["allSelectors", "core"]
  25332. }),
  25333. $globals.Environment);
  25334. $core.addMethod(
  25335. $core.method({
  25336. selector: "availableClassNames",
  25337. protocol: "accessing",
  25338. fn: function (){
  25339. var self=this,$self=this;
  25340. return $core.withContext(function($ctx1) {
  25341. return $recv($recv($globals.Smalltalk)._classes())._collect_((function(each){
  25342. return $core.withContext(function($ctx2) {
  25343. return $recv(each)._name();
  25344. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25345. }));
  25346. }, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},$globals.Environment)});
  25347. },
  25348. args: [],
  25349. source: "availableClassNames\x0a\x09^ Smalltalk classes \x0a\x09\x09collect: [ :each | each name ]",
  25350. referencedClasses: ["Smalltalk"],
  25351. messageSends: ["collect:", "classes", "name"]
  25352. }),
  25353. $globals.Environment);
  25354. $core.addMethod(
  25355. $core.method({
  25356. selector: "availablePackageNames",
  25357. protocol: "accessing",
  25358. fn: function (){
  25359. var self=this,$self=this;
  25360. return $core.withContext(function($ctx1) {
  25361. return $recv($recv($globals.Smalltalk)._packages())._collect_((function(each){
  25362. return $core.withContext(function($ctx2) {
  25363. return $recv(each)._name();
  25364. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25365. }));
  25366. }, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{},$globals.Environment)});
  25367. },
  25368. args: [],
  25369. source: "availablePackageNames\x0a\x09^ Smalltalk packages \x0a\x09\x09collect: [ :each | each name ]",
  25370. referencedClasses: ["Smalltalk"],
  25371. messageSends: ["collect:", "packages", "name"]
  25372. }),
  25373. $globals.Environment);
  25374. $core.addMethod(
  25375. $core.method({
  25376. selector: "availableProtocolsFor:",
  25377. protocol: "accessing",
  25378. fn: function (aClass){
  25379. var self=this,$self=this;
  25380. var protocols;
  25381. return $core.withContext(function($ctx1) {
  25382. var $1,$receiver;
  25383. protocols=$recv(aClass)._protocols();
  25384. $1=$recv(aClass)._superclass();
  25385. $ctx1.sendIdx["superclass"]=1;
  25386. if(($receiver = $1) == null || $receiver.a$nil){
  25387. $1;
  25388. } else {
  25389. $recv(protocols)._addAll_($self._availableProtocolsFor_($recv(aClass)._superclass()));
  25390. }
  25391. return $recv($recv($recv(protocols)._asSet())._asArray())._sort();
  25392. }, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},$globals.Environment)});
  25393. },
  25394. args: ["aClass"],
  25395. 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",
  25396. referencedClasses: [],
  25397. messageSends: ["protocols", "ifNotNil:", "superclass", "addAll:", "availableProtocolsFor:", "sort", "asArray", "asSet"]
  25398. }),
  25399. $globals.Environment);
  25400. $core.addMethod(
  25401. $core.method({
  25402. selector: "classBuilder",
  25403. protocol: "accessing",
  25404. fn: function (){
  25405. var self=this,$self=this;
  25406. return $core.withContext(function($ctx1) {
  25407. return $recv($globals.ClassBuilder)._new();
  25408. }, function($ctx1) {$ctx1.fill(self,"classBuilder",{},$globals.Environment)});
  25409. },
  25410. args: [],
  25411. source: "classBuilder\x0a\x09^ ClassBuilder new",
  25412. referencedClasses: ["ClassBuilder"],
  25413. messageSends: ["new"]
  25414. }),
  25415. $globals.Environment);
  25416. $core.addMethod(
  25417. $core.method({
  25418. selector: "classNamed:",
  25419. protocol: "accessing",
  25420. fn: function (aString){
  25421. var self=this,$self=this;
  25422. return $core.withContext(function($ctx1) {
  25423. var $1,$receiver;
  25424. $1=$recv($recv($globals.Smalltalk)._globals())._at_($recv(aString)._asSymbol());
  25425. if(($receiver = $1) == null || $receiver.a$nil){
  25426. return $self._error_("Invalid class name");
  25427. } else {
  25428. return $1;
  25429. }
  25430. }, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString},$globals.Environment)});
  25431. },
  25432. args: ["aString"],
  25433. source: "classNamed: aString\x0a\x09^ (Smalltalk globals at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
  25434. referencedClasses: ["Smalltalk"],
  25435. messageSends: ["ifNil:", "at:", "globals", "asSymbol", "error:"]
  25436. }),
  25437. $globals.Environment);
  25438. $core.addMethod(
  25439. $core.method({
  25440. selector: "classes",
  25441. protocol: "accessing",
  25442. fn: function (){
  25443. var self=this,$self=this;
  25444. return $core.withContext(function($ctx1) {
  25445. return $recv($globals.Smalltalk)._classes();
  25446. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Environment)});
  25447. },
  25448. args: [],
  25449. source: "classes\x0a\x09^ Smalltalk classes",
  25450. referencedClasses: ["Smalltalk"],
  25451. messageSends: ["classes"]
  25452. }),
  25453. $globals.Environment);
  25454. $core.addMethod(
  25455. $core.method({
  25456. selector: "commitPackage:onSuccess:onError:",
  25457. protocol: "actions",
  25458. fn: function (aPackage,aBlock,anotherBlock){
  25459. var self=this,$self=this;
  25460. return $core.withContext(function($ctx1) {
  25461. $recv($recv(aPackage)._transport())._commitOnSuccess_onError_(aBlock,anotherBlock);
  25462. return self;
  25463. }, function($ctx1) {$ctx1.fill(self,"commitPackage:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Environment)});
  25464. },
  25465. args: ["aPackage", "aBlock", "anotherBlock"],
  25466. source: "commitPackage: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09aPackage transport\x0a\x09\x09commitOnSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  25467. referencedClasses: [],
  25468. messageSends: ["commitOnSuccess:onError:", "transport"]
  25469. }),
  25470. $globals.Environment);
  25471. $core.addMethod(
  25472. $core.method({
  25473. selector: "compileClassComment:for:",
  25474. protocol: "compiling",
  25475. fn: function (aString,aClass){
  25476. var self=this,$self=this;
  25477. return $core.withContext(function($ctx1) {
  25478. $recv(aClass)._comment_(aString);
  25479. return self;
  25480. }, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass},$globals.Environment)});
  25481. },
  25482. args: ["aString", "aClass"],
  25483. source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString",
  25484. referencedClasses: [],
  25485. messageSends: ["comment:"]
  25486. }),
  25487. $globals.Environment);
  25488. $core.addMethod(
  25489. $core.method({
  25490. selector: "compileClassDefinition:",
  25491. protocol: "compiling",
  25492. fn: function (aString){
  25493. var self=this,$self=this;
  25494. return $core.withContext(function($ctx1) {
  25495. $recv((function(){
  25496. return $core.withContext(function($ctx2) {
  25497. return $self._evaluate_for_(aString,$recv($globals.DoIt)._new());
  25498. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  25499. }))._on_do_($globals.Error,(function(error){
  25500. return $core.withContext(function($ctx2) {
  25501. return $recv($globals.Terminal)._alert_($recv(error)._messageText());
  25502. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  25503. }));
  25504. return self;
  25505. }, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString},$globals.Environment)});
  25506. },
  25507. args: ["aString"],
  25508. source: "compileClassDefinition: aString\x0a\x09[ self evaluate: aString for: DoIt new ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error | Terminal alert: error messageText ]",
  25509. referencedClasses: ["DoIt", "Error", "Terminal"],
  25510. messageSends: ["on:do:", "evaluate:for:", "new", "alert:", "messageText"]
  25511. }),
  25512. $globals.Environment);
  25513. $core.addMethod(
  25514. $core.method({
  25515. selector: "compileMethod:for:protocol:",
  25516. protocol: "compiling",
  25517. fn: function (sourceCode,class_,protocol){
  25518. var self=this,$self=this;
  25519. return $core.withContext(function($ctx1) {
  25520. return $recv(class_)._compile_protocol_(sourceCode,protocol);
  25521. }, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol},$globals.Environment)});
  25522. },
  25523. args: ["sourceCode", "class", "protocol"],
  25524. source: "compileMethod: sourceCode for: class protocol: protocol\x0a\x09^ class\x0a\x09\x09compile: sourceCode\x0a\x09\x09protocol: protocol",
  25525. referencedClasses: [],
  25526. messageSends: ["compile:protocol:"]
  25527. }),
  25528. $globals.Environment);
  25529. $core.addMethod(
  25530. $core.method({
  25531. selector: "copyClass:to:",
  25532. protocol: "actions",
  25533. fn: function (aClass,aClassName){
  25534. var self=this,$self=this;
  25535. return $core.withContext(function($ctx1) {
  25536. var $1,$2,$receiver;
  25537. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  25538. if(($receiver = $1) == null || $receiver.a$nil){
  25539. $1;
  25540. } else {
  25541. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  25542. $ctx1.sendIdx[","]=1;
  25543. $self._error_($2);
  25544. }
  25545. $recv($recv($globals.ClassBuilder)._new())._copyClass_named_(aClass,aClassName);
  25546. return self;
  25547. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  25548. },
  25549. args: ["aClass", "aClassName"],
  25550. 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",
  25551. referencedClasses: ["Smalltalk", "ClassBuilder"],
  25552. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "copyClass:named:", "new"]
  25553. }),
  25554. $globals.Environment);
  25555. $core.addMethod(
  25556. $core.method({
  25557. selector: "doItReceiver",
  25558. protocol: "accessing",
  25559. fn: function (){
  25560. var self=this,$self=this;
  25561. return $core.withContext(function($ctx1) {
  25562. return $recv($globals.DoIt)._new();
  25563. }, function($ctx1) {$ctx1.fill(self,"doItReceiver",{},$globals.Environment)});
  25564. },
  25565. args: [],
  25566. source: "doItReceiver\x0a\x09^ DoIt new",
  25567. referencedClasses: ["DoIt"],
  25568. messageSends: ["new"]
  25569. }),
  25570. $globals.Environment);
  25571. $core.addMethod(
  25572. $core.method({
  25573. selector: "evaluate:for:",
  25574. protocol: "evaluating",
  25575. fn: function (aString,anObject){
  25576. var self=this,$self=this;
  25577. return $core.withContext(function($ctx1) {
  25578. return $recv($globals.Evaluator)._evaluate_for_(aString,anObject);
  25579. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Environment)});
  25580. },
  25581. args: ["aString", "anObject"],
  25582. source: "evaluate: aString for: anObject\x0a\x09^ Evaluator evaluate: aString for: anObject",
  25583. referencedClasses: ["Evaluator"],
  25584. messageSends: ["evaluate:for:"]
  25585. }),
  25586. $globals.Environment);
  25587. $core.addMethod(
  25588. $core.method({
  25589. selector: "evaluate:on:do:",
  25590. protocol: "error handling",
  25591. fn: function (aBlock,anErrorClass,exceptionBlock){
  25592. var self=this,$self=this;
  25593. return $core.withContext(function($ctx1) {
  25594. var $1;
  25595. $recv(aBlock)._tryCatch_((function(exception){
  25596. return $core.withContext(function($ctx2) {
  25597. $1=$recv(exception)._isKindOf_($self._classNamed_($recv(anErrorClass)._name()));
  25598. if($core.assert($1)){
  25599. return $recv(exceptionBlock)._value_(exception);
  25600. } else {
  25601. return $recv(exception)._pass();
  25602. }
  25603. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,1)});
  25604. }));
  25605. return self;
  25606. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:do:",{aBlock:aBlock,anErrorClass:anErrorClass,exceptionBlock:exceptionBlock},$globals.Environment)});
  25607. },
  25608. args: ["aBlock", "anErrorClass", "exceptionBlock"],
  25609. 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 ] ]",
  25610. referencedClasses: [],
  25611. messageSends: ["tryCatch:", "ifTrue:ifFalse:", "isKindOf:", "classNamed:", "name", "value:", "pass"]
  25612. }),
  25613. $globals.Environment);
  25614. $core.addMethod(
  25615. $core.method({
  25616. selector: "inspect:",
  25617. protocol: "actions",
  25618. fn: function (anObject){
  25619. var self=this,$self=this;
  25620. return $core.withContext(function($ctx1) {
  25621. $recv($globals.Inspector)._inspect_(anObject);
  25622. return self;
  25623. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Environment)});
  25624. },
  25625. args: ["anObject"],
  25626. source: "inspect: anObject\x0a\x09Inspector inspect: anObject",
  25627. referencedClasses: ["Inspector"],
  25628. messageSends: ["inspect:"]
  25629. }),
  25630. $globals.Environment);
  25631. $core.addMethod(
  25632. $core.method({
  25633. selector: "moveClass:toPackage:",
  25634. protocol: "actions",
  25635. fn: function (aClass,aPackageName){
  25636. var self=this,$self=this;
  25637. var package_;
  25638. return $core.withContext(function($ctx1) {
  25639. var $1,$2,$receiver;
  25640. package_=$recv($globals.Package)._named_(aPackageName);
  25641. $1=package_;
  25642. if(($receiver = $1) == null || $receiver.a$nil){
  25643. $self._error_("Invalid package name");
  25644. } else {
  25645. $1;
  25646. }
  25647. $2=$recv(package_).__eq_eq($recv(aClass)._package());
  25648. if($core.assert($2)){
  25649. return self;
  25650. }
  25651. $recv(aClass)._package_(package_);
  25652. $recv(aClass)._recompile();
  25653. return self;
  25654. }, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_},$globals.Environment)});
  25655. },
  25656. args: ["aClass", "aPackageName"],
  25657. 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",
  25658. referencedClasses: ["Package"],
  25659. messageSends: ["named:", "ifNil:", "error:", "ifTrue:", "==", "package", "package:", "recompile"]
  25660. }),
  25661. $globals.Environment);
  25662. $core.addMethod(
  25663. $core.method({
  25664. selector: "moveMethod:toClass:",
  25665. protocol: "actions",
  25666. fn: function (aMethod,aClassName){
  25667. var self=this,$self=this;
  25668. var destinationClass;
  25669. return $core.withContext(function($ctx1) {
  25670. var $2,$3,$1,$5,$4;
  25671. destinationClass=$self._classNamed_(aClassName);
  25672. $2=destinationClass;
  25673. $3=$recv(aMethod)._methodClass();
  25674. $ctx1.sendIdx["methodClass"]=1;
  25675. $1=$recv($2).__eq_eq($3);
  25676. if($core.assert($1)){
  25677. return self;
  25678. }
  25679. $5=$recv(aMethod)._methodClass();
  25680. $ctx1.sendIdx["methodClass"]=2;
  25681. $4=$recv($5)._isMetaclass();
  25682. if($core.assert($4)){
  25683. destinationClass=$recv(destinationClass)._theMetaClass();
  25684. destinationClass;
  25685. }
  25686. $recv(destinationClass)._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  25687. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  25688. return self;
  25689. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass},$globals.Environment)});
  25690. },
  25691. args: ["aMethod", "aClassName"],
  25692. source: "moveMethod: aMethod toClass: aClassName\x0a\x09| destinationClass |\x0a\x09\x0a\x09destinationClass := self classNamed: aClassName.\x0a\x09destinationClass == aMethod methodClass ifTrue: [ ^ self ].\x0a\x09\x0a\x09aMethod methodClass isMetaclass ifTrue: [ \x0a\x09\x09destinationClass := destinationClass theMetaClass ].\x0a\x09\x0a\x09destinationClass \x0a\x09\x09compile: aMethod source\x0a\x09\x09protocol: aMethod protocol.\x0a\x09aMethod methodClass \x0a\x09\x09removeCompiledMethod: aMethod",
  25693. referencedClasses: [],
  25694. messageSends: ["classNamed:", "ifTrue:", "==", "methodClass", "isMetaclass", "theMetaClass", "compile:protocol:", "source", "protocol", "removeCompiledMethod:"]
  25695. }),
  25696. $globals.Environment);
  25697. $core.addMethod(
  25698. $core.method({
  25699. selector: "moveMethod:toProtocol:",
  25700. protocol: "actions",
  25701. fn: function (aMethod,aProtocol){
  25702. var self=this,$self=this;
  25703. return $core.withContext(function($ctx1) {
  25704. $recv(aMethod)._protocol_(aProtocol);
  25705. $recv($recv(aMethod)._methodClass())._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  25706. return self;
  25707. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol},$globals.Environment)});
  25708. },
  25709. args: ["aMethod", "aProtocol"],
  25710. source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod protocol: aProtocol.\x0a\x0a\x09aMethod methodClass\x0a\x09\x09compile: aMethod source\x0a\x09\x09protocol: aMethod protocol",
  25711. referencedClasses: [],
  25712. messageSends: ["protocol:", "compile:protocol:", "methodClass", "source", "protocol"]
  25713. }),
  25714. $globals.Environment);
  25715. $core.addMethod(
  25716. $core.method({
  25717. selector: "packages",
  25718. protocol: "accessing",
  25719. fn: function (){
  25720. var self=this,$self=this;
  25721. return $core.withContext(function($ctx1) {
  25722. return $recv($globals.Smalltalk)._packages();
  25723. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.Environment)});
  25724. },
  25725. args: [],
  25726. source: "packages\x0a\x09^ Smalltalk packages",
  25727. referencedClasses: ["Smalltalk"],
  25728. messageSends: ["packages"]
  25729. }),
  25730. $globals.Environment);
  25731. $core.addMethod(
  25732. $core.method({
  25733. selector: "registerErrorHandler:",
  25734. protocol: "services",
  25735. fn: function (anErrorHandler){
  25736. var self=this,$self=this;
  25737. return $core.withContext(function($ctx1) {
  25738. $recv($globals.ErrorHandler)._register_(anErrorHandler);
  25739. return self;
  25740. }, function($ctx1) {$ctx1.fill(self,"registerErrorHandler:",{anErrorHandler:anErrorHandler},$globals.Environment)});
  25741. },
  25742. args: ["anErrorHandler"],
  25743. source: "registerErrorHandler: anErrorHandler\x0a\x09ErrorHandler register: anErrorHandler",
  25744. referencedClasses: ["ErrorHandler"],
  25745. messageSends: ["register:"]
  25746. }),
  25747. $globals.Environment);
  25748. $core.addMethod(
  25749. $core.method({
  25750. selector: "registerFinder:",
  25751. protocol: "services",
  25752. fn: function (aFinder){
  25753. var self=this,$self=this;
  25754. return $core.withContext(function($ctx1) {
  25755. $recv($globals.Finder)._register_(aFinder);
  25756. return self;
  25757. }, function($ctx1) {$ctx1.fill(self,"registerFinder:",{aFinder:aFinder},$globals.Environment)});
  25758. },
  25759. args: ["aFinder"],
  25760. source: "registerFinder: aFinder\x0a\x09Finder register: aFinder",
  25761. referencedClasses: ["Finder"],
  25762. messageSends: ["register:"]
  25763. }),
  25764. $globals.Environment);
  25765. $core.addMethod(
  25766. $core.method({
  25767. selector: "registerInspector:",
  25768. protocol: "services",
  25769. fn: function (anInspector){
  25770. var self=this,$self=this;
  25771. return $core.withContext(function($ctx1) {
  25772. $recv($globals.Inspector)._register_(anInspector);
  25773. return self;
  25774. }, function($ctx1) {$ctx1.fill(self,"registerInspector:",{anInspector:anInspector},$globals.Environment)});
  25775. },
  25776. args: ["anInspector"],
  25777. source: "registerInspector: anInspector\x0a\x09Inspector register: anInspector",
  25778. referencedClasses: ["Inspector"],
  25779. messageSends: ["register:"]
  25780. }),
  25781. $globals.Environment);
  25782. $core.addMethod(
  25783. $core.method({
  25784. selector: "registerProgressHandler:",
  25785. protocol: "services",
  25786. fn: function (aProgressHandler){
  25787. var self=this,$self=this;
  25788. return $core.withContext(function($ctx1) {
  25789. $recv($globals.ProgressHandler)._register_(aProgressHandler);
  25790. return self;
  25791. }, function($ctx1) {$ctx1.fill(self,"registerProgressHandler:",{aProgressHandler:aProgressHandler},$globals.Environment)});
  25792. },
  25793. args: ["aProgressHandler"],
  25794. source: "registerProgressHandler: aProgressHandler\x0a\x09ProgressHandler register: aProgressHandler",
  25795. referencedClasses: ["ProgressHandler"],
  25796. messageSends: ["register:"]
  25797. }),
  25798. $globals.Environment);
  25799. $core.addMethod(
  25800. $core.method({
  25801. selector: "registerTranscript:",
  25802. protocol: "services",
  25803. fn: function (aTranscript){
  25804. var self=this,$self=this;
  25805. return $core.withContext(function($ctx1) {
  25806. $recv($globals.Transcript)._register_(aTranscript);
  25807. return self;
  25808. }, function($ctx1) {$ctx1.fill(self,"registerTranscript:",{aTranscript:aTranscript},$globals.Environment)});
  25809. },
  25810. args: ["aTranscript"],
  25811. source: "registerTranscript: aTranscript\x0a\x09Transcript register: aTranscript",
  25812. referencedClasses: ["Transcript"],
  25813. messageSends: ["register:"]
  25814. }),
  25815. $globals.Environment);
  25816. $core.addMethod(
  25817. $core.method({
  25818. selector: "removeClass:",
  25819. protocol: "actions",
  25820. fn: function (aClass){
  25821. var self=this,$self=this;
  25822. return $core.withContext(function($ctx1) {
  25823. $recv($globals.Smalltalk)._removeClass_(aClass);
  25824. return self;
  25825. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.Environment)});
  25826. },
  25827. args: ["aClass"],
  25828. source: "removeClass: aClass\x0a\x09Smalltalk removeClass: aClass",
  25829. referencedClasses: ["Smalltalk"],
  25830. messageSends: ["removeClass:"]
  25831. }),
  25832. $globals.Environment);
  25833. $core.addMethod(
  25834. $core.method({
  25835. selector: "removeMethod:",
  25836. protocol: "actions",
  25837. fn: function (aMethod){
  25838. var self=this,$self=this;
  25839. return $core.withContext(function($ctx1) {
  25840. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  25841. return self;
  25842. }, function($ctx1) {$ctx1.fill(self,"removeMethod:",{aMethod:aMethod},$globals.Environment)});
  25843. },
  25844. args: ["aMethod"],
  25845. source: "removeMethod: aMethod\x0a\x09aMethod methodClass removeCompiledMethod: aMethod",
  25846. referencedClasses: [],
  25847. messageSends: ["removeCompiledMethod:", "methodClass"]
  25848. }),
  25849. $globals.Environment);
  25850. $core.addMethod(
  25851. $core.method({
  25852. selector: "removeProtocol:from:",
  25853. protocol: "actions",
  25854. fn: function (aString,aClass){
  25855. var self=this,$self=this;
  25856. return $core.withContext(function($ctx1) {
  25857. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  25858. return $core.withContext(function($ctx2) {
  25859. return $recv(aClass)._removeCompiledMethod_(each);
  25860. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25861. }));
  25862. return self;
  25863. }, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass},$globals.Environment)});
  25864. },
  25865. args: ["aString", "aClass"],
  25866. source: "removeProtocol: aString from: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | aClass removeCompiledMethod: each ]",
  25867. referencedClasses: [],
  25868. messageSends: ["do:", "methodsInProtocol:", "removeCompiledMethod:"]
  25869. }),
  25870. $globals.Environment);
  25871. $core.addMethod(
  25872. $core.method({
  25873. selector: "renameClass:to:",
  25874. protocol: "actions",
  25875. fn: function (aClass,aClassName){
  25876. var self=this,$self=this;
  25877. return $core.withContext(function($ctx1) {
  25878. var $1,$2,$receiver;
  25879. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  25880. if(($receiver = $1) == null || $receiver.a$nil){
  25881. $1;
  25882. } else {
  25883. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  25884. $ctx1.sendIdx[","]=1;
  25885. $self._error_($2);
  25886. }
  25887. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(aClass,aClassName);
  25888. return self;
  25889. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  25890. },
  25891. args: ["aClass", "aClassName"],
  25892. 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",
  25893. referencedClasses: ["Smalltalk", "ClassBuilder"],
  25894. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renameClass:to:", "new"]
  25895. }),
  25896. $globals.Environment);
  25897. $core.addMethod(
  25898. $core.method({
  25899. selector: "renamePackage:to:",
  25900. protocol: "actions",
  25901. fn: function (aPackageName,aNewPackageName){
  25902. var self=this,$self=this;
  25903. return $core.withContext(function($ctx1) {
  25904. $recv($globals.Smalltalk)._renamePackage_to_(aPackageName,aNewPackageName);
  25905. return self;
  25906. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{aPackageName:aPackageName,aNewPackageName:aNewPackageName},$globals.Environment)});
  25907. },
  25908. args: ["aPackageName", "aNewPackageName"],
  25909. source: "renamePackage: aPackageName to: aNewPackageName\x0a Smalltalk renamePackage: aPackageName to: aNewPackageName",
  25910. referencedClasses: ["Smalltalk"],
  25911. messageSends: ["renamePackage:to:"]
  25912. }),
  25913. $globals.Environment);
  25914. $core.addMethod(
  25915. $core.method({
  25916. selector: "renameProtocol:to:in:",
  25917. protocol: "actions",
  25918. fn: function (aString,anotherString,aClass){
  25919. var self=this,$self=this;
  25920. return $core.withContext(function($ctx1) {
  25921. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  25922. return $core.withContext(function($ctx2) {
  25923. return $recv(each)._protocol_(anotherString);
  25924. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25925. }));
  25926. return self;
  25927. }, function($ctx1) {$ctx1.fill(self,"renameProtocol:to:in:",{aString:aString,anotherString:anotherString,aClass:aClass},$globals.Environment)});
  25928. },
  25929. args: ["aString", "anotherString", "aClass"],
  25930. source: "renameProtocol: aString to: anotherString in: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | each protocol: anotherString ]",
  25931. referencedClasses: [],
  25932. messageSends: ["do:", "methodsInProtocol:", "protocol:"]
  25933. }),
  25934. $globals.Environment);
  25935. $core.addMethod(
  25936. $core.method({
  25937. selector: "setClassCommentOf:to:",
  25938. protocol: "actions",
  25939. fn: function (aClass,aString){
  25940. var self=this,$self=this;
  25941. return $core.withContext(function($ctx1) {
  25942. $recv(aClass)._comment_(aString);
  25943. return self;
  25944. }, function($ctx1) {$ctx1.fill(self,"setClassCommentOf:to:",{aClass:aClass,aString:aString},$globals.Environment)});
  25945. },
  25946. args: ["aClass", "aString"],
  25947. source: "setClassCommentOf: aClass to: aString\x0a\x09aClass comment: aString",
  25948. referencedClasses: [],
  25949. messageSends: ["comment:"]
  25950. }),
  25951. $globals.Environment);
  25952. $core.addMethod(
  25953. $core.method({
  25954. selector: "systemAnnouncer",
  25955. protocol: "accessing",
  25956. fn: function (){
  25957. var self=this,$self=this;
  25958. return $core.withContext(function($ctx1) {
  25959. return $recv($recv($recv($globals.Smalltalk)._globals())._at_("SystemAnnouncer"))._current();
  25960. }, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{},$globals.Environment)});
  25961. },
  25962. args: [],
  25963. source: "systemAnnouncer\x0a\x09^ (Smalltalk globals at: #SystemAnnouncer) current",
  25964. referencedClasses: ["Smalltalk"],
  25965. messageSends: ["current", "at:", "globals"]
  25966. }),
  25967. $globals.Environment);
  25968. $core.addClass("NullProgressHandler", $globals.Object, [], "Platform-Services");
  25969. $globals.NullProgressHandler.comment="I am the default progress handler. I do not display any progress, and simply iterate over the collection.";
  25970. $core.addMethod(
  25971. $core.method({
  25972. selector: "do:on:displaying:",
  25973. protocol: "progress handling",
  25974. fn: function (aBlock,aCollection,aString){
  25975. var self=this,$self=this;
  25976. return $core.withContext(function($ctx1) {
  25977. $recv(aCollection)._do_(aBlock);
  25978. return self;
  25979. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.NullProgressHandler)});
  25980. },
  25981. args: ["aBlock", "aCollection", "aString"],
  25982. source: "do: aBlock on: aCollection displaying: aString\x0a\x09aCollection do: aBlock",
  25983. referencedClasses: [],
  25984. messageSends: ["do:"]
  25985. }),
  25986. $globals.NullProgressHandler);
  25987. $globals.NullProgressHandler.a$cls.iVarNames = ["current"];
  25988. $core.addMethod(
  25989. $core.method({
  25990. selector: "initialize",
  25991. protocol: "initialization",
  25992. fn: function (){
  25993. var self=this,$self=this;
  25994. return $core.withContext(function($ctx1) {
  25995. $recv($globals.ProgressHandler)._registerIfNone_($self._new());
  25996. return self;
  25997. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NullProgressHandler.a$cls)});
  25998. },
  25999. args: [],
  26000. source: "initialize\x0a\x09ProgressHandler registerIfNone: self new",
  26001. referencedClasses: ["ProgressHandler"],
  26002. messageSends: ["registerIfNone:", "new"]
  26003. }),
  26004. $globals.NullProgressHandler.a$cls);
  26005. $core.addClass("Service", $globals.Object, [], "Platform-Services");
  26006. $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.";
  26007. $globals.Service.a$cls.iVarNames = ["current"];
  26008. $core.addMethod(
  26009. $core.method({
  26010. selector: "current",
  26011. protocol: "accessing",
  26012. fn: function (){
  26013. var self=this,$self=this;
  26014. return $self["@current"];
  26015. },
  26016. args: [],
  26017. source: "current\x0a\x09^ current",
  26018. referencedClasses: [],
  26019. messageSends: []
  26020. }),
  26021. $globals.Service.a$cls);
  26022. $core.addMethod(
  26023. $core.method({
  26024. selector: "new",
  26025. protocol: "instance creation",
  26026. fn: function (){
  26027. var self=this,$self=this;
  26028. return $core.withContext(function($ctx1) {
  26029. $self._shouldNotImplement();
  26030. return self;
  26031. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Service.a$cls)});
  26032. },
  26033. args: [],
  26034. source: "new\x0a\x09self shouldNotImplement",
  26035. referencedClasses: [],
  26036. messageSends: ["shouldNotImplement"]
  26037. }),
  26038. $globals.Service.a$cls);
  26039. $core.addMethod(
  26040. $core.method({
  26041. selector: "register:",
  26042. protocol: "registration",
  26043. fn: function (anObject){
  26044. var self=this,$self=this;
  26045. $self["@current"]=anObject;
  26046. return self;
  26047. },
  26048. args: ["anObject"],
  26049. source: "register: anObject\x0a\x09current := anObject",
  26050. referencedClasses: [],
  26051. messageSends: []
  26052. }),
  26053. $globals.Service.a$cls);
  26054. $core.addMethod(
  26055. $core.method({
  26056. selector: "registerIfNone:",
  26057. protocol: "registration",
  26058. fn: function (anObject){
  26059. var self=this,$self=this;
  26060. return $core.withContext(function($ctx1) {
  26061. var $1,$receiver;
  26062. $1=$self._current();
  26063. if(($receiver = $1) == null || $receiver.a$nil){
  26064. $self._register_(anObject);
  26065. } else {
  26066. $1;
  26067. }
  26068. return self;
  26069. }, function($ctx1) {$ctx1.fill(self,"registerIfNone:",{anObject:anObject},$globals.Service.a$cls)});
  26070. },
  26071. args: ["anObject"],
  26072. source: "registerIfNone: anObject\x0a\x09self current ifNil: [ self register: anObject ]",
  26073. referencedClasses: [],
  26074. messageSends: ["ifNil:", "current", "register:"]
  26075. }),
  26076. $globals.Service.a$cls);
  26077. $core.addClass("ErrorHandler", $globals.Service, [], "Platform-Services");
  26078. $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.";
  26079. $core.addMethod(
  26080. $core.method({
  26081. selector: "handleError:",
  26082. protocol: "error handling",
  26083. fn: function (anError){
  26084. var self=this,$self=this;
  26085. return $core.withContext(function($ctx1) {
  26086. var $1;
  26087. $1=$recv((function(){
  26088. return $core.withContext(function($ctx2) {
  26089. return $recv(anError)._isSmalltalkError();
  26090. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  26091. }))._tryCatch_((function(){
  26092. return false;
  26093. }));
  26094. if($core.assert($1)){
  26095. $self._handleUnhandledError_(anError);
  26096. $ctx1.sendIdx["handleUnhandledError:"]=1;
  26097. } else {
  26098. var smalltalkError;
  26099. smalltalkError=$recv($globals.JavaScriptException)._on_(anError);
  26100. $recv(smalltalkError)._wrap();
  26101. $self._handleUnhandledError_(smalltalkError);
  26102. }
  26103. return self;
  26104. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ErrorHandler.a$cls)});
  26105. },
  26106. args: ["anError"],
  26107. 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 ]",
  26108. referencedClasses: ["JavaScriptException"],
  26109. messageSends: ["ifTrue:ifFalse:", "tryCatch:", "isSmalltalkError", "handleUnhandledError:", "on:", "wrap"]
  26110. }),
  26111. $globals.ErrorHandler.a$cls);
  26112. $core.addMethod(
  26113. $core.method({
  26114. selector: "handleUnhandledError:",
  26115. protocol: "error handling",
  26116. fn: function (anError){
  26117. var self=this,$self=this;
  26118. return $core.withContext(function($ctx1) {
  26119. var $1;
  26120. $1=$recv(anError)._wasHandled();
  26121. if(!$core.assert($1)){
  26122. $recv($self._current())._handleError_(anError);
  26123. $recv(anError)._beHandled();
  26124. }
  26125. return self;
  26126. }, function($ctx1) {$ctx1.fill(self,"handleUnhandledError:",{anError:anError},$globals.ErrorHandler.a$cls)});
  26127. },
  26128. args: ["anError"],
  26129. source: "handleUnhandledError: anError\x0a\x09anError wasHandled ifFalse: [\x0a\x09\x09self current handleError: anError.\x0a\x09\x09anError beHandled ]",
  26130. referencedClasses: [],
  26131. messageSends: ["ifFalse:", "wasHandled", "handleError:", "current", "beHandled"]
  26132. }),
  26133. $globals.ErrorHandler.a$cls);
  26134. $core.addClass("Finder", $globals.Service, [], "Platform-Services");
  26135. $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.";
  26136. $core.addMethod(
  26137. $core.method({
  26138. selector: "findClass:",
  26139. protocol: "finding",
  26140. fn: function (aClass){
  26141. var self=this,$self=this;
  26142. return $core.withContext(function($ctx1) {
  26143. return $recv($self._current())._findClass_(aClass);
  26144. }, function($ctx1) {$ctx1.fill(self,"findClass:",{aClass:aClass},$globals.Finder.a$cls)});
  26145. },
  26146. args: ["aClass"],
  26147. source: "findClass: aClass\x0a\x09^ self current findClass: aClass",
  26148. referencedClasses: [],
  26149. messageSends: ["findClass:", "current"]
  26150. }),
  26151. $globals.Finder.a$cls);
  26152. $core.addMethod(
  26153. $core.method({
  26154. selector: "findMethod:",
  26155. protocol: "finding",
  26156. fn: function (aCompiledMethod){
  26157. var self=this,$self=this;
  26158. return $core.withContext(function($ctx1) {
  26159. return $recv($self._current())._findMethod_(aCompiledMethod);
  26160. }, function($ctx1) {$ctx1.fill(self,"findMethod:",{aCompiledMethod:aCompiledMethod},$globals.Finder.a$cls)});
  26161. },
  26162. args: ["aCompiledMethod"],
  26163. source: "findMethod: aCompiledMethod\x0a\x09^ self current findMethod: aCompiledMethod",
  26164. referencedClasses: [],
  26165. messageSends: ["findMethod:", "current"]
  26166. }),
  26167. $globals.Finder.a$cls);
  26168. $core.addMethod(
  26169. $core.method({
  26170. selector: "findString:",
  26171. protocol: "finding",
  26172. fn: function (aString){
  26173. var self=this,$self=this;
  26174. return $core.withContext(function($ctx1) {
  26175. return $recv($self._current())._findString_(aString);
  26176. }, function($ctx1) {$ctx1.fill(self,"findString:",{aString:aString},$globals.Finder.a$cls)});
  26177. },
  26178. args: ["aString"],
  26179. source: "findString: aString\x0a\x09^ self current findString: aString",
  26180. referencedClasses: [],
  26181. messageSends: ["findString:", "current"]
  26182. }),
  26183. $globals.Finder.a$cls);
  26184. $core.addClass("Inspector", $globals.Service, [], "Platform-Services");
  26185. $globals.Inspector.comment="I am the service responsible for inspecting objects.\x0a\x0aThe default inspector object is the transcript.";
  26186. $core.addMethod(
  26187. $core.method({
  26188. selector: "inspect:",
  26189. protocol: "inspecting",
  26190. fn: function (anObject){
  26191. var self=this,$self=this;
  26192. return $core.withContext(function($ctx1) {
  26193. return $recv($self._current())._inspect_(anObject);
  26194. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Inspector.a$cls)});
  26195. },
  26196. args: ["anObject"],
  26197. source: "inspect: anObject\x0a\x09^ self current inspect: anObject",
  26198. referencedClasses: [],
  26199. messageSends: ["inspect:", "current"]
  26200. }),
  26201. $globals.Inspector.a$cls);
  26202. $core.addClass("Platform", $globals.Service, [], "Platform-Services");
  26203. $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";
  26204. $core.addMethod(
  26205. $core.method({
  26206. selector: "globals",
  26207. protocol: "accessing",
  26208. fn: function (){
  26209. var self=this,$self=this;
  26210. return $core.withContext(function($ctx1) {
  26211. return $recv($self._current())._globals();
  26212. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.Platform.a$cls)});
  26213. },
  26214. args: [],
  26215. source: "globals\x0a\x09^ self current globals",
  26216. referencedClasses: [],
  26217. messageSends: ["globals", "current"]
  26218. }),
  26219. $globals.Platform.a$cls);
  26220. $core.addMethod(
  26221. $core.method({
  26222. selector: "includesGlobal:",
  26223. protocol: "testing",
  26224. fn: function (aString){
  26225. var self=this,$self=this;
  26226. return $core.withContext(function($ctx1) {
  26227. return $recv($self._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  26228. return true;
  26229. }),(function(){
  26230. return false;
  26231. }));
  26232. }, function($ctx1) {$ctx1.fill(self,"includesGlobal:",{aString:aString},$globals.Platform.a$cls)});
  26233. },
  26234. args: ["aString"],
  26235. source: "includesGlobal: aString\x0a\x09^ self globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
  26236. referencedClasses: [],
  26237. messageSends: ["at:ifPresent:ifAbsent:", "globals"]
  26238. }),
  26239. $globals.Platform.a$cls);
  26240. $core.addMethod(
  26241. $core.method({
  26242. selector: "newXhr",
  26243. protocol: "accessing",
  26244. fn: function (){
  26245. var self=this,$self=this;
  26246. return $core.withContext(function($ctx1) {
  26247. return $recv($self._current())._newXhr();
  26248. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.Platform.a$cls)});
  26249. },
  26250. args: [],
  26251. source: "newXhr\x0a\x09^ self current newXhr",
  26252. referencedClasses: [],
  26253. messageSends: ["newXhr", "current"]
  26254. }),
  26255. $globals.Platform.a$cls);
  26256. $core.addClass("ProgressHandler", $globals.Service, [], "Platform-Services");
  26257. $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`.";
  26258. $core.addMethod(
  26259. $core.method({
  26260. selector: "do:on:displaying:",
  26261. protocol: "progress handling",
  26262. fn: function (aBlock,aCollection,aString){
  26263. var self=this,$self=this;
  26264. return $core.withContext(function($ctx1) {
  26265. $recv($self._current())._do_on_displaying_(aBlock,aCollection,aString);
  26266. return self;
  26267. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.ProgressHandler.a$cls)});
  26268. },
  26269. args: ["aBlock", "aCollection", "aString"],
  26270. source: "do: aBlock on: aCollection displaying: aString\x0a\x09self current do: aBlock on: aCollection displaying: aString",
  26271. referencedClasses: [],
  26272. messageSends: ["do:on:displaying:", "current"]
  26273. }),
  26274. $globals.ProgressHandler.a$cls);
  26275. $core.addClass("Terminal", $globals.Service, [], "Platform-Services");
  26276. $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:'.";
  26277. $core.addMethod(
  26278. $core.method({
  26279. selector: "alert:",
  26280. protocol: "dialogs",
  26281. fn: function (aString){
  26282. var self=this,$self=this;
  26283. return $core.withContext(function($ctx1) {
  26284. return $recv($self._current())._alert_(aString);
  26285. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.Terminal.a$cls)});
  26286. },
  26287. args: ["aString"],
  26288. source: "alert: aString\x0a\x09^ self current alert: aString",
  26289. referencedClasses: [],
  26290. messageSends: ["alert:", "current"]
  26291. }),
  26292. $globals.Terminal.a$cls);
  26293. $core.addMethod(
  26294. $core.method({
  26295. selector: "confirm:",
  26296. protocol: "dialogs",
  26297. fn: function (aString){
  26298. var self=this,$self=this;
  26299. return $core.withContext(function($ctx1) {
  26300. return $recv($self._current())._confirm_(aString);
  26301. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.Terminal.a$cls)});
  26302. },
  26303. args: ["aString"],
  26304. source: "confirm: aString\x0a\x09^ self current confirm: aString",
  26305. referencedClasses: [],
  26306. messageSends: ["confirm:", "current"]
  26307. }),
  26308. $globals.Terminal.a$cls);
  26309. $core.addMethod(
  26310. $core.method({
  26311. selector: "prompt:",
  26312. protocol: "dialogs",
  26313. fn: function (aString){
  26314. var self=this,$self=this;
  26315. return $core.withContext(function($ctx1) {
  26316. return $recv($self._current())._prompt_(aString);
  26317. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.Terminal.a$cls)});
  26318. },
  26319. args: ["aString"],
  26320. source: "prompt: aString\x0a\x09^ self current prompt: aString",
  26321. referencedClasses: [],
  26322. messageSends: ["prompt:", "current"]
  26323. }),
  26324. $globals.Terminal.a$cls);
  26325. $core.addMethod(
  26326. $core.method({
  26327. selector: "prompt:default:",
  26328. protocol: "dialogs",
  26329. fn: function (aString,defaultString){
  26330. var self=this,$self=this;
  26331. return $core.withContext(function($ctx1) {
  26332. return $recv($self._current())._prompt_default_(aString,defaultString);
  26333. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.Terminal.a$cls)});
  26334. },
  26335. args: ["aString", "defaultString"],
  26336. source: "prompt: aString default: defaultString\x0a\x09^ self current prompt: aString default: defaultString",
  26337. referencedClasses: [],
  26338. messageSends: ["prompt:default:", "current"]
  26339. }),
  26340. $globals.Terminal.a$cls);
  26341. $core.addClass("Transcript", $globals.Service, [], "Platform-Services");
  26342. $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.";
  26343. $core.addMethod(
  26344. $core.method({
  26345. selector: "clear",
  26346. protocol: "printing",
  26347. fn: function (){
  26348. var self=this,$self=this;
  26349. return $core.withContext(function($ctx1) {
  26350. $recv($self._current())._clear();
  26351. return self;
  26352. }, function($ctx1) {$ctx1.fill(self,"clear",{},$globals.Transcript.a$cls)});
  26353. },
  26354. args: [],
  26355. source: "clear\x0a\x09self current clear",
  26356. referencedClasses: [],
  26357. messageSends: ["clear", "current"]
  26358. }),
  26359. $globals.Transcript.a$cls);
  26360. $core.addMethod(
  26361. $core.method({
  26362. selector: "cr",
  26363. protocol: "printing",
  26364. fn: function (){
  26365. var self=this,$self=this;
  26366. return $core.withContext(function($ctx1) {
  26367. $recv($self._current())._show_($recv($globals.String)._cr());
  26368. return self;
  26369. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.Transcript.a$cls)});
  26370. },
  26371. args: [],
  26372. source: "cr\x0a\x09self current show: String cr",
  26373. referencedClasses: ["String"],
  26374. messageSends: ["show:", "current", "cr"]
  26375. }),
  26376. $globals.Transcript.a$cls);
  26377. $core.addMethod(
  26378. $core.method({
  26379. selector: "inspect:",
  26380. protocol: "printing",
  26381. fn: function (anObject){
  26382. var self=this,$self=this;
  26383. return $core.withContext(function($ctx1) {
  26384. $self._show_(anObject);
  26385. return self;
  26386. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Transcript.a$cls)});
  26387. },
  26388. args: ["anObject"],
  26389. source: "inspect: anObject\x0a\x09self show: anObject",
  26390. referencedClasses: [],
  26391. messageSends: ["show:"]
  26392. }),
  26393. $globals.Transcript.a$cls);
  26394. $core.addMethod(
  26395. $core.method({
  26396. selector: "open",
  26397. protocol: "instance creation",
  26398. fn: function (){
  26399. var self=this,$self=this;
  26400. return $core.withContext(function($ctx1) {
  26401. $recv($self._current())._open();
  26402. return self;
  26403. }, function($ctx1) {$ctx1.fill(self,"open",{},$globals.Transcript.a$cls)});
  26404. },
  26405. args: [],
  26406. source: "open\x0a\x09self current open",
  26407. referencedClasses: [],
  26408. messageSends: ["open", "current"]
  26409. }),
  26410. $globals.Transcript.a$cls);
  26411. $core.addMethod(
  26412. $core.method({
  26413. selector: "show:",
  26414. protocol: "printing",
  26415. fn: function (anObject){
  26416. var self=this,$self=this;
  26417. return $core.withContext(function($ctx1) {
  26418. $recv($self._current())._show_(anObject);
  26419. return self;
  26420. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.Transcript.a$cls)});
  26421. },
  26422. args: ["anObject"],
  26423. source: "show: anObject\x0a\x09self current show: anObject",
  26424. referencedClasses: [],
  26425. messageSends: ["show:", "current"]
  26426. }),
  26427. $globals.Transcript.a$cls);
  26428. $core.addMethod(
  26429. $core.method({
  26430. selector: "inspectOn:",
  26431. protocol: "*Platform-Services",
  26432. fn: function (anInspector){
  26433. var self=this,$self=this;
  26434. var variables;
  26435. return $core.withContext(function($ctx1) {
  26436. variables=$recv($globals.Dictionary)._new();
  26437. $recv(variables)._at_put_("#self",self);
  26438. $ctx1.sendIdx["at:put:"]=1;
  26439. $recv(variables)._at_put_("#keys",$self._keys());
  26440. $ctx1.sendIdx["at:put:"]=2;
  26441. $self._keysAndValuesDo_((function(key,value){
  26442. return $core.withContext(function($ctx2) {
  26443. return $recv(variables)._at_put_(key,value);
  26444. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  26445. }));
  26446. $recv(anInspector)._setLabel_($self._printString());
  26447. $recv(anInspector)._setVariables_(variables);
  26448. return self;
  26449. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.AssociativeCollection)});
  26450. },
  26451. args: ["anInspector"],
  26452. 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",
  26453. referencedClasses: ["Dictionary"],
  26454. messageSends: ["new", "at:put:", "keys", "keysAndValuesDo:", "setLabel:", "printString", "setVariables:"]
  26455. }),
  26456. $globals.AssociativeCollection);
  26457. $core.addMethod(
  26458. $core.method({
  26459. selector: "inspectOn:",
  26460. protocol: "*Platform-Services",
  26461. fn: function (anInspector){
  26462. var self=this,$self=this;
  26463. var variables;
  26464. return $core.withContext(function($ctx1) {
  26465. variables=$recv($globals.Dictionary)._new();
  26466. $recv(variables)._at_put_("#self",self);
  26467. $ctx1.sendIdx["at:put:"]=1;
  26468. $self._withIndexDo_((function(each,i){
  26469. return $core.withContext(function($ctx2) {
  26470. return $recv(variables)._at_put_(i,each);
  26471. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  26472. }));
  26473. $recv(anInspector)._setLabel_($self._printString());
  26474. $recv(anInspector)._setVariables_(variables);
  26475. return self;
  26476. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Collection)});
  26477. },
  26478. args: ["anInspector"],
  26479. 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",
  26480. referencedClasses: ["Dictionary"],
  26481. messageSends: ["new", "at:put:", "withIndexDo:", "setLabel:", "printString", "setVariables:"]
  26482. }),
  26483. $globals.Collection);
  26484. $core.addMethod(
  26485. $core.method({
  26486. selector: "inspectOn:",
  26487. protocol: "*Platform-Services",
  26488. fn: function (anInspector){
  26489. var self=this,$self=this;
  26490. var variables;
  26491. return $core.withContext(function($ctx1) {
  26492. variables=$recv($globals.Dictionary)._new();
  26493. $recv(variables)._at_put_("#self",self);
  26494. $ctx1.sendIdx["at:put:"]=1;
  26495. $recv(variables)._at_put_("#year",$self._year());
  26496. $ctx1.sendIdx["at:put:"]=2;
  26497. $recv(variables)._at_put_("#month",$self._month());
  26498. $ctx1.sendIdx["at:put:"]=3;
  26499. $recv(variables)._at_put_("#day",$self._day());
  26500. $ctx1.sendIdx["at:put:"]=4;
  26501. $recv(variables)._at_put_("#hours",$self._hours());
  26502. $ctx1.sendIdx["at:put:"]=5;
  26503. $recv(variables)._at_put_("#minutes",$self._minutes());
  26504. $ctx1.sendIdx["at:put:"]=6;
  26505. $recv(variables)._at_put_("#seconds",$self._seconds());
  26506. $ctx1.sendIdx["at:put:"]=7;
  26507. $recv(variables)._at_put_("#milliseconds",$self._milliseconds());
  26508. $recv(anInspector)._setLabel_($self._printString());
  26509. $recv(anInspector)._setVariables_(variables);
  26510. return self;
  26511. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Date)});
  26512. },
  26513. args: ["anInspector"],
  26514. 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",
  26515. referencedClasses: ["Dictionary"],
  26516. messageSends: ["new", "at:put:", "year", "month", "day", "hours", "minutes", "seconds", "milliseconds", "setLabel:", "printString", "setVariables:"]
  26517. }),
  26518. $globals.Date);
  26519. $core.addMethod(
  26520. $core.method({
  26521. selector: "inspectOn:",
  26522. protocol: "*Platform-Services",
  26523. fn: function (anInspector){
  26524. var self=this,$self=this;
  26525. var variables;
  26526. return $core.withContext(function($ctx1) {
  26527. variables=$recv($globals.Dictionary)._new();
  26528. $recv(variables)._at_put_("#self",$self._jsObject());
  26529. $recv(anInspector)._setLabel_($self._printString());
  26530. $recv($globals.JSObjectProxy)._addObjectVariablesTo_ofProxy_(variables,self);
  26531. $recv(anInspector)._setVariables_(variables);
  26532. return self;
  26533. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.JSObjectProxy)});
  26534. },
  26535. args: ["anInspector"],
  26536. 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",
  26537. referencedClasses: ["Dictionary", "JSObjectProxy"],
  26538. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:ofProxy:", "setVariables:"]
  26539. }),
  26540. $globals.JSObjectProxy);
  26541. $core.addMethod(
  26542. $core.method({
  26543. selector: "inspectOn:",
  26544. protocol: "*Platform-Services",
  26545. fn: function (anInspector){
  26546. var self=this,$self=this;
  26547. var variables;
  26548. return $core.withContext(function($ctx1) {
  26549. variables=$recv($globals.Dictionary)._new();
  26550. $recv(variables)._at_put_("#self",self);
  26551. $ctx1.sendIdx["at:put:"]=1;
  26552. $recv(variables)._at_put_("#home",$self._home());
  26553. $ctx1.sendIdx["at:put:"]=2;
  26554. $recv(variables)._at_put_("#receiver",$self._receiver());
  26555. $ctx1.sendIdx["at:put:"]=3;
  26556. $recv(variables)._at_put_("#selector",$self._selector());
  26557. $ctx1.sendIdx["at:put:"]=4;
  26558. $recv(variables)._at_put_("#locals",$self._locals());
  26559. $ctx1.sendIdx["at:put:"]=5;
  26560. $recv($recv($self._class())._instanceVariableNames())._do_((function(each){
  26561. return $core.withContext(function($ctx2) {
  26562. return $recv(variables)._at_put_(each,$self._instVarAt_(each));
  26563. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26564. }));
  26565. $recv(anInspector)._setLabel_($self._printString());
  26566. $recv(anInspector)._setVariables_(variables);
  26567. return self;
  26568. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.MethodContext)});
  26569. },
  26570. args: ["anInspector"],
  26571. 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",
  26572. referencedClasses: ["Dictionary"],
  26573. messageSends: ["new", "at:put:", "home", "receiver", "selector", "locals", "do:", "instanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  26574. }),
  26575. $globals.MethodContext);
  26576. $core.addMethod(
  26577. $core.method({
  26578. selector: "inspectOn:",
  26579. protocol: "*Platform-Services",
  26580. fn: function (anInspector){
  26581. var self=this,$self=this;
  26582. var variables;
  26583. return $core.withContext(function($ctx1) {
  26584. variables=$recv($globals.Dictionary)._new();
  26585. $recv(variables)._at_put_("#self",self);
  26586. $ctx1.sendIdx["at:put:"]=1;
  26587. $recv($recv($self._class())._allInstanceVariableNames())._do_((function(each){
  26588. return $core.withContext(function($ctx2) {
  26589. return $recv(variables)._at_put_(each,$self._instVarAt_(each));
  26590. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26591. }));
  26592. $recv(anInspector)._setLabel_($self._printString());
  26593. $recv(anInspector)._setVariables_(variables);
  26594. return self;
  26595. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Object)});
  26596. },
  26597. args: ["anInspector"],
  26598. 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",
  26599. referencedClasses: ["Dictionary"],
  26600. messageSends: ["new", "at:put:", "do:", "allInstanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  26601. }),
  26602. $globals.Object);
  26603. $core.addMethod(
  26604. $core.method({
  26605. selector: "do:displayingProgress:",
  26606. protocol: "*Platform-Services",
  26607. fn: function (aBlock,aString){
  26608. var self=this,$self=this;
  26609. return $core.withContext(function($ctx1) {
  26610. $recv($globals.ProgressHandler)._do_on_displaying_(aBlock,self,aString);
  26611. return self;
  26612. }, function($ctx1) {$ctx1.fill(self,"do:displayingProgress:",{aBlock:aBlock,aString:aString},$globals.SequenceableCollection)});
  26613. },
  26614. args: ["aBlock", "aString"],
  26615. source: "do: aBlock displayingProgress: aString\x0a\x09ProgressHandler \x0a\x09\x09do: aBlock \x0a\x09\x09on: self \x0a\x09\x09displaying: aString",
  26616. referencedClasses: ["ProgressHandler"],
  26617. messageSends: ["do:on:displaying:"]
  26618. }),
  26619. $globals.SequenceableCollection);
  26620. $core.addMethod(
  26621. $core.method({
  26622. selector: "inspectOn:",
  26623. protocol: "*Platform-Services",
  26624. fn: function (anInspector){
  26625. var self=this,$self=this;
  26626. var variables,i;
  26627. return $core.withContext(function($ctx1) {
  26628. variables=$recv($globals.Dictionary)._new();
  26629. $recv(variables)._at_put_("#self",self);
  26630. $ctx1.sendIdx["at:put:"]=1;
  26631. i=(1);
  26632. $self._do_((function(each){
  26633. return $core.withContext(function($ctx2) {
  26634. $recv(variables)._at_put_(i,each);
  26635. i=$recv(i).__plus((1));
  26636. return i;
  26637. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26638. }));
  26639. $recv(anInspector)._setLabel_($self._printString());
  26640. $recv(anInspector)._setVariables_(variables);
  26641. return self;
  26642. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables,i:i},$globals.Set)});
  26643. },
  26644. args: ["anInspector"],
  26645. 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",
  26646. referencedClasses: ["Dictionary"],
  26647. messageSends: ["new", "at:put:", "do:", "+", "setLabel:", "printString", "setVariables:"]
  26648. }),
  26649. $globals.Set);
  26650. $core.addMethod(
  26651. $core.method({
  26652. selector: "inspectOn:",
  26653. protocol: "*Platform-Services",
  26654. fn: function (anInspector){
  26655. var self=this,$self=this;
  26656. var label;
  26657. return $core.withContext(function($ctx1) {
  26658. var $3,$2,$1,$5,$4;
  26659. (
  26660. $ctx1.supercall = true,
  26661. ($globals.String.superclass||$boot.nilAsClass).fn.prototype._inspectOn_.apply($self, [anInspector]));
  26662. $ctx1.supercall = false;
  26663. $3=$self._printString();
  26664. $ctx1.sendIdx["printString"]=1;
  26665. $2=$recv($3)._size();
  26666. $1=$recv($2).__gt((30));
  26667. if($core.assert($1)){
  26668. $5=$self._printString();
  26669. $ctx1.sendIdx["printString"]=2;
  26670. $4=$recv($5)._copyFrom_to_((1),(30));
  26671. label=$recv($4).__comma("...'");
  26672. label;
  26673. } else {
  26674. label=$self._printString();
  26675. label;
  26676. }
  26677. $recv(anInspector)._setLabel_(label);
  26678. return self;
  26679. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,label:label},$globals.String)});
  26680. },
  26681. args: ["anInspector"],
  26682. 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",
  26683. referencedClasses: [],
  26684. messageSends: ["inspectOn:", "ifTrue:ifFalse:", ">", "size", "printString", ",", "copyFrom:to:", "setLabel:"]
  26685. }),
  26686. $globals.String);
  26687. });
  26688. define('amber/deploy',[
  26689. './helpers',
  26690. './boot', // pre-fetch, dep of ./helpers
  26691. // --- packages of the core Amber begin here ---
  26692. 'amber_core/Kernel-Helpers',
  26693. 'amber_core/Kernel-Objects',
  26694. 'amber_core/Kernel-Classes',
  26695. 'amber_core/Kernel-Methods',
  26696. 'amber_core/Kernel-Collections',
  26697. 'amber_core/Kernel-Dag',
  26698. 'amber_core/Kernel-Infrastructure',
  26699. 'amber_core/Kernel-Promises',
  26700. 'amber_core/Kernel-Exceptions',
  26701. 'amber_core/Kernel-Announcements',
  26702. 'amber_core/Platform-Services',
  26703. // --- packages of the core Amber end here ---
  26704. ], function (amber) {
  26705. return amber;
  26706. });
  26707. // jshint ignore:start
  26708. define('amber/parser',['./boot'], function($boot) {
  26709. var $globals = $boot.globals;
  26710. $globals.SmalltalkParser = (function() {
  26711. "use strict";
  26712. /*
  26713. * Generated by PEG.js 0.9.0.
  26714. *
  26715. * http://pegjs.org/
  26716. */
  26717. function peg$subclass(child, parent) {
  26718. function ctor() { this.constructor = child; }
  26719. ctor.prototype = parent.prototype;
  26720. child.prototype = new ctor();
  26721. }
  26722. function peg$SyntaxError(message, expected, found, location) {
  26723. this.message = message;
  26724. this.expected = expected;
  26725. this.found = found;
  26726. this.location = location;
  26727. this.name = "SyntaxError";
  26728. if (typeof Error.captureStackTrace === "function") {
  26729. Error.captureStackTrace(this, peg$SyntaxError);
  26730. }
  26731. }
  26732. peg$subclass(peg$SyntaxError, Error);
  26733. function peg$parse(input) {
  26734. var options = arguments.length > 1 ? arguments[1] : {},
  26735. parser = this,
  26736. peg$FAILED = {},
  26737. peg$startRuleFunctions = { start: peg$parsestart },
  26738. peg$startRuleFunction = peg$parsestart,
  26739. peg$c0 = /^[ \t\x0B\f\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF\n\r\u2028\u2029]/,
  26740. peg$c1 = { type: "class", value: "[ \\t\\v\\f\\u00A0\\u1680\\u2000-\\u200A\\u202F\\u205F\\u3000\\uFEFF\\n\\r\\u2028\\u2029]", description: "[ \\t\\v\\f\\u00A0\\u1680\\u2000-\\u200A\\u202F\\u205F\\u3000\\uFEFF\\n\\r\\u2028\\u2029]" },
  26741. peg$c2 = "\"",
  26742. peg$c3 = { type: "literal", value: "\"", description: "\"\\\"\"" },
  26743. peg$c4 = /^[^"]/,
  26744. peg$c5 = { type: "class", value: "[^\"]", description: "[^\"]" },
  26745. peg$c6 = ".",
  26746. peg$c7 = { type: "literal", value: ".", description: "\".\"" },
  26747. peg$c8 = /^[a-zA-Z]/,
  26748. peg$c9 = { type: "class", value: "[a-zA-Z]", description: "[a-zA-Z]" },
  26749. peg$c10 = /^[a-zA-Z0-9]/,
  26750. peg$c11 = { type: "class", value: "[a-zA-Z0-9]", description: "[a-zA-Z0-9]" },
  26751. peg$c12 = ":",
  26752. peg$c13 = { type: "literal", value: ":", description: "\":\"" },
  26753. peg$c14 = /^[A-Z]/,
  26754. peg$c15 = { type: "class", value: "[A-Z]", description: "[A-Z]" },
  26755. peg$c16 = function(val) {
  26756. return $globals.ValueNode._new()
  26757. ._location_(location())
  26758. ._source_(text())
  26759. ._value_(val);
  26760. },
  26761. peg$c17 = "'",
  26762. peg$c18 = { type: "literal", value: "'", description: "\"'\"" },
  26763. peg$c19 = "''",
  26764. peg$c20 = { type: "literal", value: "''", description: "\"''\"" },
  26765. peg$c21 = function() {return '\'';},
  26766. peg$c22 = /^[^']/,
  26767. peg$c23 = { type: "class", value: "[^']", description: "[^']" },
  26768. peg$c24 = function(val) {return val.join('');},
  26769. peg$c25 = "$",
  26770. peg$c26 = { type: "literal", value: "$", description: "\"$\"" },
  26771. peg$c27 = { type: "any", description: "any character" },
  26772. peg$c28 = function(char) {
  26773. return $globals.ValueNode._new()
  26774. ._location_(location())
  26775. ._source_(text())
  26776. ._value_(char);
  26777. },
  26778. peg$c29 = "#",
  26779. peg$c30 = { type: "literal", value: "#", description: "\"#\"" },
  26780. peg$c31 = function(rest) {return rest;},
  26781. peg$c32 = "e",
  26782. peg$c33 = { type: "literal", value: "e", description: "\"e\"" },
  26783. peg$c34 = function(n) {return parseFloat(n);},
  26784. peg$c35 = "-",
  26785. peg$c36 = { type: "literal", value: "-", description: "\"-\"" },
  26786. peg$c37 = "16r",
  26787. peg$c38 = { type: "literal", value: "16r", description: "\"16r\"" },
  26788. peg$c39 = /^[0-9a-fA-F]/,
  26789. peg$c40 = { type: "class", value: "[0-9a-fA-F]", description: "[0-9a-fA-F]" },
  26790. peg$c41 = function(neg, num) {
  26791. return parseInt(((neg || '') + num), 16);
  26792. },
  26793. peg$c42 = /^[0-9]/,
  26794. peg$c43 = { type: "class", value: "[0-9]", description: "[0-9]" },
  26795. peg$c44 = function(n) {return parseFloat(n, 10);},
  26796. peg$c45 = function(n) {return parseInt(n, 10);},
  26797. peg$c46 = "#(",
  26798. peg$c47 = { type: "literal", value: "#(", description: "\"#(\"" },
  26799. peg$c48 = ")",
  26800. peg$c49 = { type: "literal", value: ")", description: "\")\"" },
  26801. peg$c50 = function(rest) {
  26802. return rest
  26803. ._location_(location())
  26804. ._source_(text());
  26805. },
  26806. peg$c51 = "(",
  26807. peg$c52 = { type: "literal", value: "(", description: "\"(\"" },
  26808. peg$c53 = function(lit) {return lit._value();},
  26809. peg$c54 = function(lits) {
  26810. return $globals.ValueNode._new()
  26811. ._value_(lits);
  26812. },
  26813. peg$c55 = "{",
  26814. peg$c56 = { type: "literal", value: "{", description: "\"{\"" },
  26815. peg$c57 = "}",
  26816. peg$c58 = { type: "literal", value: "}", description: "\"}\"" },
  26817. peg$c59 = function(expressions) {
  26818. return $globals.DynamicArrayNode._new()
  26819. ._location_(location())
  26820. ._source_(text())
  26821. ._dagChildren_(expressions || []);
  26822. },
  26823. peg$c60 = "#{",
  26824. peg$c61 = { type: "literal", value: "#{", description: "\"#{\"" },
  26825. peg$c62 = function(expressions) {
  26826. return $globals.DynamicDictionaryNode._new()
  26827. ._location_(location())
  26828. ._source_(text())
  26829. ._dagChildren_(expressions || []);
  26830. },
  26831. peg$c63 = "true",
  26832. peg$c64 = { type: "literal", value: "true", description: "\"true\"" },
  26833. peg$c65 = function() {return true;},
  26834. peg$c66 = "false",
  26835. peg$c67 = { type: "literal", value: "false", description: "\"false\"" },
  26836. peg$c68 = function() {return false;},
  26837. peg$c69 = "nil",
  26838. peg$c70 = { type: "literal", value: "nil", description: "\"nil\"" },
  26839. peg$c71 = function() {return null;},
  26840. peg$c72 = function(identifier) {
  26841. return $globals.VariableNode._new()
  26842. ._location_(location())
  26843. ._source_(text())
  26844. ._value_(identifier);
  26845. },
  26846. peg$c73 = /^[\\+*\/=><,@%~|&\-]/,
  26847. peg$c74 = { type: "class", value: "[\\\\+*/=><,@%~|&-]", description: "[\\\\+*/=><,@%~|&-]" },
  26848. peg$c75 = function(key, arg) {return {key:key, arg:arg};},
  26849. peg$c76 = function(pairs) {
  26850. var selector = '';
  26851. var params = [];
  26852. for(var i = 0; i < pairs.length; i++) {
  26853. selector += pairs[i].key;
  26854. params.push(pairs[i].arg);
  26855. }
  26856. return [selector, params];
  26857. },
  26858. peg$c77 = function(selector, arg) {
  26859. return [selector, [arg]];
  26860. },
  26861. peg$c78 = function(selector) {return [selector, []];},
  26862. peg$c79 = function(expression) {
  26863. return expression;
  26864. },
  26865. peg$c80 = function(first, others) {
  26866. return [first].concat(others);
  26867. },
  26868. peg$c81 = function(selector) {
  26869. return $globals.Message._selector_arguments_(selector, []);
  26870. },
  26871. peg$c82 = function(pairs) {
  26872. var selector = '';
  26873. var args = [];
  26874. for(var i = 0; i < pairs.length; i++) {
  26875. selector += pairs[i].key;
  26876. args.push(pairs[i].arg._value());
  26877. }
  26878. return $globals.Message._selector_arguments_(selector, args)
  26879. },
  26880. peg$c83 = "<",
  26881. peg$c84 = { type: "literal", value: "<", description: "\"<\"" },
  26882. peg$c85 = ">",
  26883. peg$c86 = { type: "literal", value: ">", description: "\">\"" },
  26884. peg$c87 = function(message) {return message;},
  26885. peg$c88 = ":=",
  26886. peg$c89 = { type: "literal", value: ":=", description: "\":=\"" },
  26887. peg$c90 = function(variable, expression) {
  26888. return $globals.AssignmentNode._new()
  26889. ._location_(location())
  26890. ._source_(text())
  26891. ._left_(variable)
  26892. ._right_(expression);
  26893. },
  26894. peg$c91 = "^",
  26895. peg$c92 = { type: "literal", value: "^", description: "\"^\"" },
  26896. peg$c93 = function(expression) {
  26897. return $globals.ReturnNode._new()
  26898. ._location_(location())
  26899. ._source_(text())
  26900. ._dagChildren_([expression]);
  26901. },
  26902. peg$c94 = "|",
  26903. peg$c95 = { type: "literal", value: "|", description: "\"|\"" },
  26904. peg$c96 = function(variable) {return variable;},
  26905. peg$c97 = function(vars) {
  26906. return vars;
  26907. },
  26908. peg$c98 = function(param) {return param;},
  26909. peg$c99 = function(params) {
  26910. return params;
  26911. },
  26912. peg$c100 = function(ret) {return [ret];},
  26913. peg$c101 = function(exps, ret) {
  26914. var expressions = exps;
  26915. expressions.push(ret);
  26916. return expressions;
  26917. },
  26918. peg$c102 = function(expressions) {return expressions || [];},
  26919. peg$c103 = function(aPragmas, temps, zPragmas, statements) {
  26920. return $globals.SequenceNode._new()
  26921. ._location_(location())
  26922. ._source_(text())
  26923. ._temps_(temps || [])
  26924. ._pragmas_((aPragmas || []).concat(zPragmas || []))
  26925. ._dagChildren_(statements || []);
  26926. },
  26927. peg$c104 = "[",
  26928. peg$c105 = { type: "literal", value: "[", description: "\"[\"" },
  26929. peg$c106 = "]",
  26930. peg$c107 = { type: "literal", value: "]", description: "\"]\"" },
  26931. peg$c108 = function(params, sequence) {
  26932. return $globals.BlockNode._new()
  26933. ._location_(location())
  26934. ._source_(text())
  26935. ._parameters_(params || [])
  26936. ._dagChildren_([sequence._asBlockSequenceNode()]);
  26937. },
  26938. peg$c109 = function(selector) {
  26939. return $globals.SendNode._new()
  26940. ._location_(location())
  26941. ._source_(text())
  26942. ._selector_(selector);
  26943. },
  26944. peg$c110 = function(receiver, tail) {
  26945. return receiver._withTail_(tail);
  26946. },
  26947. peg$c111 = function(selector, arg) {
  26948. return $globals.SendNode._new()
  26949. ._location_(location())
  26950. ._source_(text())
  26951. ._selector_(selector)
  26952. ._arguments_([arg]);
  26953. },
  26954. peg$c112 = function(unarys, binarys) { return unarys.concat(binarys); },
  26955. peg$c113 = function(pairs) {
  26956. var selector = '';
  26957. var args = [];
  26958. for(var i = 0; i < pairs.length; i++) {
  26959. selector += pairs[i].key;
  26960. args.push(pairs[i].arg);
  26961. }
  26962. return $globals.SendNode._new()
  26963. ._location_(location())
  26964. ._source_(text())
  26965. ._selector_(selector)
  26966. ._arguments_(args);
  26967. },
  26968. peg$c114 = function(binarys, final) {
  26969. if (final) binarys.push(final);
  26970. return binarys;
  26971. },
  26972. peg$c115 = function(receiver, tail) {return tail.length > 0;},
  26973. peg$c116 = ";",
  26974. peg$c117 = { type: "literal", value: ";", description: "\";\"" },
  26975. peg$c118 = function(receiver, tail, mess) {return mess;},
  26976. peg$c119 = function(receiver, tail, messages) {
  26977. messages.unshift(receiver._withTail_(tail));
  26978. return $globals.CascadeNode._new()
  26979. ._location_(location())
  26980. ._source_(text())
  26981. ._dagChildren_(messages);
  26982. },
  26983. peg$c120 = function(pattern, sequence) {
  26984. return $globals.MethodNode._new()
  26985. ._location_(location())
  26986. ._source_(text())
  26987. ._selector_(pattern[0])
  26988. ._arguments_(pattern[1])
  26989. ._dagChildren_([sequence]);
  26990. },
  26991. peg$c121 = function(receiver, tail) { return tail.length > 0 && tail[tail.length-1]._selector() === '->' },
  26992. peg$c122 = function(receiver, tail) {
  26993. var last = tail.pop();
  26994. return [receiver._withTail_(tail), last._arguments()[0]];
  26995. },
  26996. peg$c123 = function(first, others) {
  26997. return first.concat.apply(first, others);
  26998. },
  26999. peg$currPos = 0,
  27000. peg$savedPos = 0,
  27001. peg$posDetailsCache = [{ line: 1, column: 1, seenCR: false }],
  27002. peg$maxFailPos = 0,
  27003. peg$maxFailExpected = [],
  27004. peg$silentFails = 0,
  27005. peg$resultsCache = {},
  27006. peg$result;
  27007. if ("startRule" in options) {
  27008. if (!(options.startRule in peg$startRuleFunctions)) {
  27009. throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
  27010. }
  27011. peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
  27012. }
  27013. function text() {
  27014. return input.substring(peg$savedPos, peg$currPos);
  27015. }
  27016. function location() {
  27017. return peg$computeLocation(peg$savedPos, peg$currPos);
  27018. }
  27019. function expected(description) {
  27020. throw peg$buildException(
  27021. null,
  27022. [{ type: "other", description: description }],
  27023. input.substring(peg$savedPos, peg$currPos),
  27024. peg$computeLocation(peg$savedPos, peg$currPos)
  27025. );
  27026. }
  27027. function error(message) {
  27028. throw peg$buildException(
  27029. message,
  27030. null,
  27031. input.substring(peg$savedPos, peg$currPos),
  27032. peg$computeLocation(peg$savedPos, peg$currPos)
  27033. );
  27034. }
  27035. function peg$computePosDetails(pos) {
  27036. var details = peg$posDetailsCache[pos],
  27037. p, ch;
  27038. if (details) {
  27039. return details;
  27040. } else {
  27041. p = pos - 1;
  27042. while (!peg$posDetailsCache[p]) {
  27043. p--;
  27044. }
  27045. details = peg$posDetailsCache[p];
  27046. details = {
  27047. line: details.line,
  27048. column: details.column,
  27049. seenCR: details.seenCR
  27050. };
  27051. while (p < pos) {
  27052. ch = input.charAt(p);
  27053. if (ch === "\n") {
  27054. if (!details.seenCR) { details.line++; }
  27055. details.column = 1;
  27056. details.seenCR = false;
  27057. } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
  27058. details.line++;
  27059. details.column = 1;
  27060. details.seenCR = true;
  27061. } else {
  27062. details.column++;
  27063. details.seenCR = false;
  27064. }
  27065. p++;
  27066. }
  27067. peg$posDetailsCache[pos] = details;
  27068. return details;
  27069. }
  27070. }
  27071. function peg$computeLocation(startPos, endPos) {
  27072. var startPosDetails = peg$computePosDetails(startPos),
  27073. endPosDetails = peg$computePosDetails(endPos);
  27074. return {
  27075. start: {
  27076. offset: startPos,
  27077. line: startPosDetails.line,
  27078. column: startPosDetails.column
  27079. },
  27080. end: {
  27081. offset: endPos,
  27082. line: endPosDetails.line,
  27083. column: endPosDetails.column
  27084. }
  27085. };
  27086. }
  27087. function peg$fail(expected) {
  27088. if (peg$currPos < peg$maxFailPos) { return; }
  27089. if (peg$currPos > peg$maxFailPos) {
  27090. peg$maxFailPos = peg$currPos;
  27091. peg$maxFailExpected = [];
  27092. }
  27093. peg$maxFailExpected.push(expected);
  27094. }
  27095. function peg$buildException(message, expected, found, location) {
  27096. function cleanupExpected(expected) {
  27097. var i = 1;
  27098. expected.sort(function(a, b) {
  27099. if (a.description < b.description) {
  27100. return -1;
  27101. } else if (a.description > b.description) {
  27102. return 1;
  27103. } else {
  27104. return 0;
  27105. }
  27106. });
  27107. while (i < expected.length) {
  27108. if (expected[i - 1] === expected[i]) {
  27109. expected.splice(i, 1);
  27110. } else {
  27111. i++;
  27112. }
  27113. }
  27114. }
  27115. function buildMessage(expected, found) {
  27116. function stringEscape(s) {
  27117. function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }
  27118. return s
  27119. .replace(/\\/g, '\\\\')
  27120. .replace(/"/g, '\\"')
  27121. .replace(/\x08/g, '\\b')
  27122. .replace(/\t/g, '\\t')
  27123. .replace(/\n/g, '\\n')
  27124. .replace(/\f/g, '\\f')
  27125. .replace(/\r/g, '\\r')
  27126. .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
  27127. .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); })
  27128. .replace(/[\u0100-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
  27129. .replace(/[\u1000-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
  27130. }
  27131. var expectedDescs = new Array(expected.length),
  27132. expectedDesc, foundDesc, i;
  27133. for (i = 0; i < expected.length; i++) {
  27134. expectedDescs[i] = expected[i].description;
  27135. }
  27136. expectedDesc = expected.length > 1
  27137. ? expectedDescs.slice(0, -1).join(", ")
  27138. + " or "
  27139. + expectedDescs[expected.length - 1]
  27140. : expectedDescs[0];
  27141. foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input";
  27142. return "Expected " + expectedDesc + " but " + foundDesc + " found.";
  27143. }
  27144. if (expected !== null) {
  27145. cleanupExpected(expected);
  27146. }
  27147. return new peg$SyntaxError(
  27148. message !== null ? message : buildMessage(expected, found),
  27149. expected,
  27150. found,
  27151. location
  27152. );
  27153. }
  27154. function peg$parsestart() {
  27155. var s0;
  27156. var key = peg$currPos * 66 + 0,
  27157. cached = peg$resultsCache[key];
  27158. if (cached) {
  27159. peg$currPos = cached.nextPos;
  27160. return cached.result;
  27161. }
  27162. s0 = peg$parsemethod();
  27163. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27164. return s0;
  27165. }
  27166. function peg$parseseparator() {
  27167. var s0, s1;
  27168. var key = peg$currPos * 66 + 1,
  27169. cached = peg$resultsCache[key];
  27170. if (cached) {
  27171. peg$currPos = cached.nextPos;
  27172. return cached.result;
  27173. }
  27174. s0 = [];
  27175. if (peg$c0.test(input.charAt(peg$currPos))) {
  27176. s1 = input.charAt(peg$currPos);
  27177. peg$currPos++;
  27178. } else {
  27179. s1 = peg$FAILED;
  27180. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  27181. }
  27182. if (s1 !== peg$FAILED) {
  27183. while (s1 !== peg$FAILED) {
  27184. s0.push(s1);
  27185. if (peg$c0.test(input.charAt(peg$currPos))) {
  27186. s1 = input.charAt(peg$currPos);
  27187. peg$currPos++;
  27188. } else {
  27189. s1 = peg$FAILED;
  27190. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  27191. }
  27192. }
  27193. } else {
  27194. s0 = peg$FAILED;
  27195. }
  27196. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27197. return s0;
  27198. }
  27199. function peg$parsecomments() {
  27200. var s0, s1, s2, s3, s4;
  27201. var key = peg$currPos * 66 + 2,
  27202. cached = peg$resultsCache[key];
  27203. if (cached) {
  27204. peg$currPos = cached.nextPos;
  27205. return cached.result;
  27206. }
  27207. s0 = [];
  27208. s1 = peg$currPos;
  27209. if (input.charCodeAt(peg$currPos) === 34) {
  27210. s2 = peg$c2;
  27211. peg$currPos++;
  27212. } else {
  27213. s2 = peg$FAILED;
  27214. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27215. }
  27216. if (s2 !== peg$FAILED) {
  27217. s3 = [];
  27218. if (peg$c4.test(input.charAt(peg$currPos))) {
  27219. s4 = input.charAt(peg$currPos);
  27220. peg$currPos++;
  27221. } else {
  27222. s4 = peg$FAILED;
  27223. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27224. }
  27225. while (s4 !== peg$FAILED) {
  27226. s3.push(s4);
  27227. if (peg$c4.test(input.charAt(peg$currPos))) {
  27228. s4 = input.charAt(peg$currPos);
  27229. peg$currPos++;
  27230. } else {
  27231. s4 = peg$FAILED;
  27232. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27233. }
  27234. }
  27235. if (s3 !== peg$FAILED) {
  27236. if (input.charCodeAt(peg$currPos) === 34) {
  27237. s4 = peg$c2;
  27238. peg$currPos++;
  27239. } else {
  27240. s4 = peg$FAILED;
  27241. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27242. }
  27243. if (s4 !== peg$FAILED) {
  27244. s2 = [s2, s3, s4];
  27245. s1 = s2;
  27246. } else {
  27247. peg$currPos = s1;
  27248. s1 = peg$FAILED;
  27249. }
  27250. } else {
  27251. peg$currPos = s1;
  27252. s1 = peg$FAILED;
  27253. }
  27254. } else {
  27255. peg$currPos = s1;
  27256. s1 = peg$FAILED;
  27257. }
  27258. if (s1 !== peg$FAILED) {
  27259. while (s1 !== peg$FAILED) {
  27260. s0.push(s1);
  27261. s1 = peg$currPos;
  27262. if (input.charCodeAt(peg$currPos) === 34) {
  27263. s2 = peg$c2;
  27264. peg$currPos++;
  27265. } else {
  27266. s2 = peg$FAILED;
  27267. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27268. }
  27269. if (s2 !== peg$FAILED) {
  27270. s3 = [];
  27271. if (peg$c4.test(input.charAt(peg$currPos))) {
  27272. s4 = input.charAt(peg$currPos);
  27273. peg$currPos++;
  27274. } else {
  27275. s4 = peg$FAILED;
  27276. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27277. }
  27278. while (s4 !== peg$FAILED) {
  27279. s3.push(s4);
  27280. if (peg$c4.test(input.charAt(peg$currPos))) {
  27281. s4 = input.charAt(peg$currPos);
  27282. peg$currPos++;
  27283. } else {
  27284. s4 = peg$FAILED;
  27285. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27286. }
  27287. }
  27288. if (s3 !== peg$FAILED) {
  27289. if (input.charCodeAt(peg$currPos) === 34) {
  27290. s4 = peg$c2;
  27291. peg$currPos++;
  27292. } else {
  27293. s4 = peg$FAILED;
  27294. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27295. }
  27296. if (s4 !== peg$FAILED) {
  27297. s2 = [s2, s3, s4];
  27298. s1 = s2;
  27299. } else {
  27300. peg$currPos = s1;
  27301. s1 = peg$FAILED;
  27302. }
  27303. } else {
  27304. peg$currPos = s1;
  27305. s1 = peg$FAILED;
  27306. }
  27307. } else {
  27308. peg$currPos = s1;
  27309. s1 = peg$FAILED;
  27310. }
  27311. }
  27312. } else {
  27313. s0 = peg$FAILED;
  27314. }
  27315. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27316. return s0;
  27317. }
  27318. function peg$parsews() {
  27319. var s0, s1;
  27320. var key = peg$currPos * 66 + 3,
  27321. cached = peg$resultsCache[key];
  27322. if (cached) {
  27323. peg$currPos = cached.nextPos;
  27324. return cached.result;
  27325. }
  27326. s0 = [];
  27327. s1 = peg$parseseparator();
  27328. if (s1 === peg$FAILED) {
  27329. s1 = peg$parsecomments();
  27330. }
  27331. while (s1 !== peg$FAILED) {
  27332. s0.push(s1);
  27333. s1 = peg$parseseparator();
  27334. if (s1 === peg$FAILED) {
  27335. s1 = peg$parsecomments();
  27336. }
  27337. }
  27338. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27339. return s0;
  27340. }
  27341. function peg$parsemaybeDotsWs() {
  27342. var s0, s1;
  27343. var key = peg$currPos * 66 + 4,
  27344. cached = peg$resultsCache[key];
  27345. if (cached) {
  27346. peg$currPos = cached.nextPos;
  27347. return cached.result;
  27348. }
  27349. s0 = [];
  27350. if (input.charCodeAt(peg$currPos) === 46) {
  27351. s1 = peg$c6;
  27352. peg$currPos++;
  27353. } else {
  27354. s1 = peg$FAILED;
  27355. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27356. }
  27357. if (s1 === peg$FAILED) {
  27358. s1 = peg$parseseparator();
  27359. if (s1 === peg$FAILED) {
  27360. s1 = peg$parsecomments();
  27361. }
  27362. }
  27363. while (s1 !== peg$FAILED) {
  27364. s0.push(s1);
  27365. if (input.charCodeAt(peg$currPos) === 46) {
  27366. s1 = peg$c6;
  27367. peg$currPos++;
  27368. } else {
  27369. s1 = peg$FAILED;
  27370. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27371. }
  27372. if (s1 === peg$FAILED) {
  27373. s1 = peg$parseseparator();
  27374. if (s1 === peg$FAILED) {
  27375. s1 = peg$parsecomments();
  27376. }
  27377. }
  27378. }
  27379. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27380. return s0;
  27381. }
  27382. function peg$parsesomeDotsWs() {
  27383. var s0, s1, s2, s3;
  27384. var key = peg$currPos * 66 + 5,
  27385. cached = peg$resultsCache[key];
  27386. if (cached) {
  27387. peg$currPos = cached.nextPos;
  27388. return cached.result;
  27389. }
  27390. s0 = peg$currPos;
  27391. s1 = peg$parsews();
  27392. if (s1 !== peg$FAILED) {
  27393. if (input.charCodeAt(peg$currPos) === 46) {
  27394. s2 = peg$c6;
  27395. peg$currPos++;
  27396. } else {
  27397. s2 = peg$FAILED;
  27398. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27399. }
  27400. if (s2 !== peg$FAILED) {
  27401. s3 = peg$parsemaybeDotsWs();
  27402. if (s3 !== peg$FAILED) {
  27403. s1 = [s1, s2, s3];
  27404. s0 = s1;
  27405. } else {
  27406. peg$currPos = s0;
  27407. s0 = peg$FAILED;
  27408. }
  27409. } else {
  27410. peg$currPos = s0;
  27411. s0 = peg$FAILED;
  27412. }
  27413. } else {
  27414. peg$currPos = s0;
  27415. s0 = peg$FAILED;
  27416. }
  27417. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27418. return s0;
  27419. }
  27420. function peg$parseidentifier() {
  27421. var s0, s1, s2, s3, s4;
  27422. var key = peg$currPos * 66 + 6,
  27423. cached = peg$resultsCache[key];
  27424. if (cached) {
  27425. peg$currPos = cached.nextPos;
  27426. return cached.result;
  27427. }
  27428. s0 = peg$currPos;
  27429. s1 = peg$currPos;
  27430. if (peg$c8.test(input.charAt(peg$currPos))) {
  27431. s2 = input.charAt(peg$currPos);
  27432. peg$currPos++;
  27433. } else {
  27434. s2 = peg$FAILED;
  27435. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  27436. }
  27437. if (s2 !== peg$FAILED) {
  27438. s3 = [];
  27439. if (peg$c10.test(input.charAt(peg$currPos))) {
  27440. s4 = input.charAt(peg$currPos);
  27441. peg$currPos++;
  27442. } else {
  27443. s4 = peg$FAILED;
  27444. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27445. }
  27446. while (s4 !== peg$FAILED) {
  27447. s3.push(s4);
  27448. if (peg$c10.test(input.charAt(peg$currPos))) {
  27449. s4 = input.charAt(peg$currPos);
  27450. peg$currPos++;
  27451. } else {
  27452. s4 = peg$FAILED;
  27453. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27454. }
  27455. }
  27456. if (s3 !== peg$FAILED) {
  27457. s2 = [s2, s3];
  27458. s1 = s2;
  27459. } else {
  27460. peg$currPos = s1;
  27461. s1 = peg$FAILED;
  27462. }
  27463. } else {
  27464. peg$currPos = s1;
  27465. s1 = peg$FAILED;
  27466. }
  27467. if (s1 !== peg$FAILED) {
  27468. s0 = input.substring(s0, peg$currPos);
  27469. } else {
  27470. s0 = s1;
  27471. }
  27472. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27473. return s0;
  27474. }
  27475. function peg$parsekeyword() {
  27476. var s0, s1, s2, s3;
  27477. var key = peg$currPos * 66 + 7,
  27478. cached = peg$resultsCache[key];
  27479. if (cached) {
  27480. peg$currPos = cached.nextPos;
  27481. return cached.result;
  27482. }
  27483. s0 = peg$currPos;
  27484. s1 = peg$currPos;
  27485. s2 = peg$parseidentifier();
  27486. if (s2 !== peg$FAILED) {
  27487. if (input.charCodeAt(peg$currPos) === 58) {
  27488. s3 = peg$c12;
  27489. peg$currPos++;
  27490. } else {
  27491. s3 = peg$FAILED;
  27492. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  27493. }
  27494. if (s3 !== peg$FAILED) {
  27495. s2 = [s2, s3];
  27496. s1 = s2;
  27497. } else {
  27498. peg$currPos = s1;
  27499. s1 = peg$FAILED;
  27500. }
  27501. } else {
  27502. peg$currPos = s1;
  27503. s1 = peg$FAILED;
  27504. }
  27505. if (s1 !== peg$FAILED) {
  27506. s0 = input.substring(s0, peg$currPos);
  27507. } else {
  27508. s0 = s1;
  27509. }
  27510. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27511. return s0;
  27512. }
  27513. function peg$parseclassName() {
  27514. var s0, s1, s2, s3, s4;
  27515. var key = peg$currPos * 66 + 8,
  27516. cached = peg$resultsCache[key];
  27517. if (cached) {
  27518. peg$currPos = cached.nextPos;
  27519. return cached.result;
  27520. }
  27521. s0 = peg$currPos;
  27522. s1 = peg$currPos;
  27523. if (peg$c14.test(input.charAt(peg$currPos))) {
  27524. s2 = input.charAt(peg$currPos);
  27525. peg$currPos++;
  27526. } else {
  27527. s2 = peg$FAILED;
  27528. if (peg$silentFails === 0) { peg$fail(peg$c15); }
  27529. }
  27530. if (s2 !== peg$FAILED) {
  27531. s3 = [];
  27532. if (peg$c10.test(input.charAt(peg$currPos))) {
  27533. s4 = input.charAt(peg$currPos);
  27534. peg$currPos++;
  27535. } else {
  27536. s4 = peg$FAILED;
  27537. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27538. }
  27539. while (s4 !== peg$FAILED) {
  27540. s3.push(s4);
  27541. if (peg$c10.test(input.charAt(peg$currPos))) {
  27542. s4 = input.charAt(peg$currPos);
  27543. peg$currPos++;
  27544. } else {
  27545. s4 = peg$FAILED;
  27546. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27547. }
  27548. }
  27549. if (s3 !== peg$FAILED) {
  27550. s2 = [s2, s3];
  27551. s1 = s2;
  27552. } else {
  27553. peg$currPos = s1;
  27554. s1 = peg$FAILED;
  27555. }
  27556. } else {
  27557. peg$currPos = s1;
  27558. s1 = peg$FAILED;
  27559. }
  27560. if (s1 !== peg$FAILED) {
  27561. s0 = input.substring(s0, peg$currPos);
  27562. } else {
  27563. s0 = s1;
  27564. }
  27565. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27566. return s0;
  27567. }
  27568. function peg$parsestring() {
  27569. var s0, s1;
  27570. var key = peg$currPos * 66 + 9,
  27571. cached = peg$resultsCache[key];
  27572. if (cached) {
  27573. peg$currPos = cached.nextPos;
  27574. return cached.result;
  27575. }
  27576. s0 = peg$currPos;
  27577. s1 = peg$parserawString();
  27578. if (s1 !== peg$FAILED) {
  27579. peg$savedPos = s0;
  27580. s1 = peg$c16(s1);
  27581. }
  27582. s0 = s1;
  27583. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27584. return s0;
  27585. }
  27586. function peg$parserawString() {
  27587. var s0, s1, s2, s3, s4;
  27588. var key = peg$currPos * 66 + 10,
  27589. cached = peg$resultsCache[key];
  27590. if (cached) {
  27591. peg$currPos = cached.nextPos;
  27592. return cached.result;
  27593. }
  27594. s0 = peg$currPos;
  27595. if (input.charCodeAt(peg$currPos) === 39) {
  27596. s1 = peg$c17;
  27597. peg$currPos++;
  27598. } else {
  27599. s1 = peg$FAILED;
  27600. if (peg$silentFails === 0) { peg$fail(peg$c18); }
  27601. }
  27602. if (s1 !== peg$FAILED) {
  27603. s2 = [];
  27604. s3 = peg$currPos;
  27605. if (input.substr(peg$currPos, 2) === peg$c19) {
  27606. s4 = peg$c19;
  27607. peg$currPos += 2;
  27608. } else {
  27609. s4 = peg$FAILED;
  27610. if (peg$silentFails === 0) { peg$fail(peg$c20); }
  27611. }
  27612. if (s4 !== peg$FAILED) {
  27613. peg$savedPos = s3;
  27614. s4 = peg$c21();
  27615. }
  27616. s3 = s4;
  27617. if (s3 === peg$FAILED) {
  27618. if (peg$c22.test(input.charAt(peg$currPos))) {
  27619. s3 = input.charAt(peg$currPos);
  27620. peg$currPos++;
  27621. } else {
  27622. s3 = peg$FAILED;
  27623. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  27624. }
  27625. }
  27626. while (s3 !== peg$FAILED) {
  27627. s2.push(s3);
  27628. s3 = peg$currPos;
  27629. if (input.substr(peg$currPos, 2) === peg$c19) {
  27630. s4 = peg$c19;
  27631. peg$currPos += 2;
  27632. } else {
  27633. s4 = peg$FAILED;
  27634. if (peg$silentFails === 0) { peg$fail(peg$c20); }
  27635. }
  27636. if (s4 !== peg$FAILED) {
  27637. peg$savedPos = s3;
  27638. s4 = peg$c21();
  27639. }
  27640. s3 = s4;
  27641. if (s3 === peg$FAILED) {
  27642. if (peg$c22.test(input.charAt(peg$currPos))) {
  27643. s3 = input.charAt(peg$currPos);
  27644. peg$currPos++;
  27645. } else {
  27646. s3 = peg$FAILED;
  27647. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  27648. }
  27649. }
  27650. }
  27651. if (s2 !== peg$FAILED) {
  27652. if (input.charCodeAt(peg$currPos) === 39) {
  27653. s3 = peg$c17;
  27654. peg$currPos++;
  27655. } else {
  27656. s3 = peg$FAILED;
  27657. if (peg$silentFails === 0) { peg$fail(peg$c18); }
  27658. }
  27659. if (s3 !== peg$FAILED) {
  27660. peg$savedPos = s0;
  27661. s1 = peg$c24(s2);
  27662. s0 = s1;
  27663. } else {
  27664. peg$currPos = s0;
  27665. s0 = peg$FAILED;
  27666. }
  27667. } else {
  27668. peg$currPos = s0;
  27669. s0 = peg$FAILED;
  27670. }
  27671. } else {
  27672. peg$currPos = s0;
  27673. s0 = peg$FAILED;
  27674. }
  27675. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27676. return s0;
  27677. }
  27678. function peg$parsecharacter() {
  27679. var s0, s1, s2;
  27680. var key = peg$currPos * 66 + 11,
  27681. cached = peg$resultsCache[key];
  27682. if (cached) {
  27683. peg$currPos = cached.nextPos;
  27684. return cached.result;
  27685. }
  27686. s0 = peg$currPos;
  27687. if (input.charCodeAt(peg$currPos) === 36) {
  27688. s1 = peg$c25;
  27689. peg$currPos++;
  27690. } else {
  27691. s1 = peg$FAILED;
  27692. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  27693. }
  27694. if (s1 !== peg$FAILED) {
  27695. if (input.length > peg$currPos) {
  27696. s2 = input.charAt(peg$currPos);
  27697. peg$currPos++;
  27698. } else {
  27699. s2 = peg$FAILED;
  27700. if (peg$silentFails === 0) { peg$fail(peg$c27); }
  27701. }
  27702. if (s2 !== peg$FAILED) {
  27703. peg$savedPos = s0;
  27704. s1 = peg$c28(s2);
  27705. s0 = s1;
  27706. } else {
  27707. peg$currPos = s0;
  27708. s0 = peg$FAILED;
  27709. }
  27710. } else {
  27711. peg$currPos = s0;
  27712. s0 = peg$FAILED;
  27713. }
  27714. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27715. return s0;
  27716. }
  27717. function peg$parsesymbol() {
  27718. var s0, s1, s2;
  27719. var key = peg$currPos * 66 + 12,
  27720. cached = peg$resultsCache[key];
  27721. if (cached) {
  27722. peg$currPos = cached.nextPos;
  27723. return cached.result;
  27724. }
  27725. s0 = peg$currPos;
  27726. if (input.charCodeAt(peg$currPos) === 35) {
  27727. s1 = peg$c29;
  27728. peg$currPos++;
  27729. } else {
  27730. s1 = peg$FAILED;
  27731. if (peg$silentFails === 0) { peg$fail(peg$c30); }
  27732. }
  27733. if (s1 !== peg$FAILED) {
  27734. s2 = peg$parsebareSymbol();
  27735. if (s2 !== peg$FAILED) {
  27736. peg$savedPos = s0;
  27737. s1 = peg$c31(s2);
  27738. s0 = s1;
  27739. } else {
  27740. peg$currPos = s0;
  27741. s0 = peg$FAILED;
  27742. }
  27743. } else {
  27744. peg$currPos = s0;
  27745. s0 = peg$FAILED;
  27746. }
  27747. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27748. return s0;
  27749. }
  27750. function peg$parsebareSymbol() {
  27751. var s0, s1, s2, s3;
  27752. var key = peg$currPos * 66 + 13,
  27753. cached = peg$resultsCache[key];
  27754. if (cached) {
  27755. peg$currPos = cached.nextPos;
  27756. return cached.result;
  27757. }
  27758. s0 = peg$currPos;
  27759. s1 = peg$currPos;
  27760. s2 = [];
  27761. s3 = peg$parsekeyword();
  27762. if (s3 !== peg$FAILED) {
  27763. while (s3 !== peg$FAILED) {
  27764. s2.push(s3);
  27765. s3 = peg$parsekeyword();
  27766. }
  27767. } else {
  27768. s2 = peg$FAILED;
  27769. }
  27770. if (s2 !== peg$FAILED) {
  27771. s1 = input.substring(s1, peg$currPos);
  27772. } else {
  27773. s1 = s2;
  27774. }
  27775. if (s1 === peg$FAILED) {
  27776. s1 = peg$parsebinarySelector();
  27777. if (s1 === peg$FAILED) {
  27778. s1 = peg$parseidentifier();
  27779. if (s1 === peg$FAILED) {
  27780. s1 = peg$parserawString();
  27781. }
  27782. }
  27783. }
  27784. if (s1 !== peg$FAILED) {
  27785. peg$savedPos = s0;
  27786. s1 = peg$c16(s1);
  27787. }
  27788. s0 = s1;
  27789. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27790. return s0;
  27791. }
  27792. function peg$parsenumber() {
  27793. var s0, s1;
  27794. var key = peg$currPos * 66 + 14,
  27795. cached = peg$resultsCache[key];
  27796. if (cached) {
  27797. peg$currPos = cached.nextPos;
  27798. return cached.result;
  27799. }
  27800. s0 = peg$currPos;
  27801. s1 = peg$parserawNumber();
  27802. if (s1 !== peg$FAILED) {
  27803. peg$savedPos = s0;
  27804. s1 = peg$c16(s1);
  27805. }
  27806. s0 = s1;
  27807. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27808. return s0;
  27809. }
  27810. function peg$parserawNumber() {
  27811. var s0;
  27812. var key = peg$currPos * 66 + 15,
  27813. cached = peg$resultsCache[key];
  27814. if (cached) {
  27815. peg$currPos = cached.nextPos;
  27816. return cached.result;
  27817. }
  27818. s0 = peg$parsenumberExp();
  27819. if (s0 === peg$FAILED) {
  27820. s0 = peg$parsehex();
  27821. if (s0 === peg$FAILED) {
  27822. s0 = peg$parsefloat();
  27823. if (s0 === peg$FAILED) {
  27824. s0 = peg$parseinteger();
  27825. }
  27826. }
  27827. }
  27828. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27829. return s0;
  27830. }
  27831. function peg$parsenumberExp() {
  27832. var s0, s1, s2, s3, s4, s5;
  27833. var key = peg$currPos * 66 + 16,
  27834. cached = peg$resultsCache[key];
  27835. if (cached) {
  27836. peg$currPos = cached.nextPos;
  27837. return cached.result;
  27838. }
  27839. s0 = peg$currPos;
  27840. s1 = peg$currPos;
  27841. s2 = peg$currPos;
  27842. s3 = peg$parsefloat();
  27843. if (s3 === peg$FAILED) {
  27844. s3 = peg$parseinteger();
  27845. }
  27846. if (s3 !== peg$FAILED) {
  27847. if (input.charCodeAt(peg$currPos) === 101) {
  27848. s4 = peg$c32;
  27849. peg$currPos++;
  27850. } else {
  27851. s4 = peg$FAILED;
  27852. if (peg$silentFails === 0) { peg$fail(peg$c33); }
  27853. }
  27854. if (s4 !== peg$FAILED) {
  27855. s5 = peg$parseinteger();
  27856. if (s5 !== peg$FAILED) {
  27857. s3 = [s3, s4, s5];
  27858. s2 = s3;
  27859. } else {
  27860. peg$currPos = s2;
  27861. s2 = peg$FAILED;
  27862. }
  27863. } else {
  27864. peg$currPos = s2;
  27865. s2 = peg$FAILED;
  27866. }
  27867. } else {
  27868. peg$currPos = s2;
  27869. s2 = peg$FAILED;
  27870. }
  27871. if (s2 !== peg$FAILED) {
  27872. s1 = input.substring(s1, peg$currPos);
  27873. } else {
  27874. s1 = s2;
  27875. }
  27876. if (s1 !== peg$FAILED) {
  27877. peg$savedPos = s0;
  27878. s1 = peg$c34(s1);
  27879. }
  27880. s0 = s1;
  27881. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27882. return s0;
  27883. }
  27884. function peg$parsehex() {
  27885. var s0, s1, s2, s3, s4, s5;
  27886. var key = peg$currPos * 66 + 17,
  27887. cached = peg$resultsCache[key];
  27888. if (cached) {
  27889. peg$currPos = cached.nextPos;
  27890. return cached.result;
  27891. }
  27892. s0 = peg$currPos;
  27893. if (input.charCodeAt(peg$currPos) === 45) {
  27894. s1 = peg$c35;
  27895. peg$currPos++;
  27896. } else {
  27897. s1 = peg$FAILED;
  27898. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  27899. }
  27900. if (s1 === peg$FAILED) {
  27901. s1 = null;
  27902. }
  27903. if (s1 !== peg$FAILED) {
  27904. if (input.substr(peg$currPos, 3) === peg$c37) {
  27905. s2 = peg$c37;
  27906. peg$currPos += 3;
  27907. } else {
  27908. s2 = peg$FAILED;
  27909. if (peg$silentFails === 0) { peg$fail(peg$c38); }
  27910. }
  27911. if (s2 !== peg$FAILED) {
  27912. s3 = peg$currPos;
  27913. s4 = [];
  27914. if (peg$c39.test(input.charAt(peg$currPos))) {
  27915. s5 = input.charAt(peg$currPos);
  27916. peg$currPos++;
  27917. } else {
  27918. s5 = peg$FAILED;
  27919. if (peg$silentFails === 0) { peg$fail(peg$c40); }
  27920. }
  27921. if (s5 !== peg$FAILED) {
  27922. while (s5 !== peg$FAILED) {
  27923. s4.push(s5);
  27924. if (peg$c39.test(input.charAt(peg$currPos))) {
  27925. s5 = input.charAt(peg$currPos);
  27926. peg$currPos++;
  27927. } else {
  27928. s5 = peg$FAILED;
  27929. if (peg$silentFails === 0) { peg$fail(peg$c40); }
  27930. }
  27931. }
  27932. } else {
  27933. s4 = peg$FAILED;
  27934. }
  27935. if (s4 !== peg$FAILED) {
  27936. s3 = input.substring(s3, peg$currPos);
  27937. } else {
  27938. s3 = s4;
  27939. }
  27940. if (s3 !== peg$FAILED) {
  27941. peg$savedPos = s0;
  27942. s1 = peg$c41(s1, s3);
  27943. s0 = s1;
  27944. } else {
  27945. peg$currPos = s0;
  27946. s0 = peg$FAILED;
  27947. }
  27948. } else {
  27949. peg$currPos = s0;
  27950. s0 = peg$FAILED;
  27951. }
  27952. } else {
  27953. peg$currPos = s0;
  27954. s0 = peg$FAILED;
  27955. }
  27956. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27957. return s0;
  27958. }
  27959. function peg$parsefloat() {
  27960. var s0, s1, s2, s3, s4, s5, s6, s7;
  27961. var key = peg$currPos * 66 + 18,
  27962. cached = peg$resultsCache[key];
  27963. if (cached) {
  27964. peg$currPos = cached.nextPos;
  27965. return cached.result;
  27966. }
  27967. s0 = peg$currPos;
  27968. s1 = peg$currPos;
  27969. s2 = peg$currPos;
  27970. if (input.charCodeAt(peg$currPos) === 45) {
  27971. s3 = peg$c35;
  27972. peg$currPos++;
  27973. } else {
  27974. s3 = peg$FAILED;
  27975. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  27976. }
  27977. if (s3 === peg$FAILED) {
  27978. s3 = null;
  27979. }
  27980. if (s3 !== peg$FAILED) {
  27981. s4 = [];
  27982. if (peg$c42.test(input.charAt(peg$currPos))) {
  27983. s5 = input.charAt(peg$currPos);
  27984. peg$currPos++;
  27985. } else {
  27986. s5 = peg$FAILED;
  27987. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  27988. }
  27989. if (s5 !== peg$FAILED) {
  27990. while (s5 !== peg$FAILED) {
  27991. s4.push(s5);
  27992. if (peg$c42.test(input.charAt(peg$currPos))) {
  27993. s5 = input.charAt(peg$currPos);
  27994. peg$currPos++;
  27995. } else {
  27996. s5 = peg$FAILED;
  27997. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  27998. }
  27999. }
  28000. } else {
  28001. s4 = peg$FAILED;
  28002. }
  28003. if (s4 !== peg$FAILED) {
  28004. if (input.charCodeAt(peg$currPos) === 46) {
  28005. s5 = peg$c6;
  28006. peg$currPos++;
  28007. } else {
  28008. s5 = peg$FAILED;
  28009. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  28010. }
  28011. if (s5 !== peg$FAILED) {
  28012. s6 = [];
  28013. if (peg$c42.test(input.charAt(peg$currPos))) {
  28014. s7 = input.charAt(peg$currPos);
  28015. peg$currPos++;
  28016. } else {
  28017. s7 = peg$FAILED;
  28018. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28019. }
  28020. if (s7 !== peg$FAILED) {
  28021. while (s7 !== peg$FAILED) {
  28022. s6.push(s7);
  28023. if (peg$c42.test(input.charAt(peg$currPos))) {
  28024. s7 = input.charAt(peg$currPos);
  28025. peg$currPos++;
  28026. } else {
  28027. s7 = peg$FAILED;
  28028. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28029. }
  28030. }
  28031. } else {
  28032. s6 = peg$FAILED;
  28033. }
  28034. if (s6 !== peg$FAILED) {
  28035. s3 = [s3, s4, s5, s6];
  28036. s2 = s3;
  28037. } else {
  28038. peg$currPos = s2;
  28039. s2 = peg$FAILED;
  28040. }
  28041. } else {
  28042. peg$currPos = s2;
  28043. s2 = peg$FAILED;
  28044. }
  28045. } else {
  28046. peg$currPos = s2;
  28047. s2 = peg$FAILED;
  28048. }
  28049. } else {
  28050. peg$currPos = s2;
  28051. s2 = peg$FAILED;
  28052. }
  28053. if (s2 !== peg$FAILED) {
  28054. s1 = input.substring(s1, peg$currPos);
  28055. } else {
  28056. s1 = s2;
  28057. }
  28058. if (s1 !== peg$FAILED) {
  28059. peg$savedPos = s0;
  28060. s1 = peg$c44(s1);
  28061. }
  28062. s0 = s1;
  28063. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28064. return s0;
  28065. }
  28066. function peg$parseinteger() {
  28067. var s0, s1, s2, s3, s4, s5;
  28068. var key = peg$currPos * 66 + 19,
  28069. cached = peg$resultsCache[key];
  28070. if (cached) {
  28071. peg$currPos = cached.nextPos;
  28072. return cached.result;
  28073. }
  28074. s0 = peg$currPos;
  28075. s1 = peg$currPos;
  28076. s2 = peg$currPos;
  28077. if (input.charCodeAt(peg$currPos) === 45) {
  28078. s3 = peg$c35;
  28079. peg$currPos++;
  28080. } else {
  28081. s3 = peg$FAILED;
  28082. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  28083. }
  28084. if (s3 === peg$FAILED) {
  28085. s3 = null;
  28086. }
  28087. if (s3 !== peg$FAILED) {
  28088. s4 = [];
  28089. if (peg$c42.test(input.charAt(peg$currPos))) {
  28090. s5 = input.charAt(peg$currPos);
  28091. peg$currPos++;
  28092. } else {
  28093. s5 = peg$FAILED;
  28094. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28095. }
  28096. if (s5 !== peg$FAILED) {
  28097. while (s5 !== peg$FAILED) {
  28098. s4.push(s5);
  28099. if (peg$c42.test(input.charAt(peg$currPos))) {
  28100. s5 = input.charAt(peg$currPos);
  28101. peg$currPos++;
  28102. } else {
  28103. s5 = peg$FAILED;
  28104. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28105. }
  28106. }
  28107. } else {
  28108. s4 = peg$FAILED;
  28109. }
  28110. if (s4 !== peg$FAILED) {
  28111. s3 = [s3, s4];
  28112. s2 = s3;
  28113. } else {
  28114. peg$currPos = s2;
  28115. s2 = peg$FAILED;
  28116. }
  28117. } else {
  28118. peg$currPos = s2;
  28119. s2 = peg$FAILED;
  28120. }
  28121. if (s2 !== peg$FAILED) {
  28122. s1 = input.substring(s1, peg$currPos);
  28123. } else {
  28124. s1 = s2;
  28125. }
  28126. if (s1 !== peg$FAILED) {
  28127. peg$savedPos = s0;
  28128. s1 = peg$c45(s1);
  28129. }
  28130. s0 = s1;
  28131. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28132. return s0;
  28133. }
  28134. function peg$parseliteralArray() {
  28135. var s0, s1, s2, s3, s4;
  28136. var key = peg$currPos * 66 + 20,
  28137. cached = peg$resultsCache[key];
  28138. if (cached) {
  28139. peg$currPos = cached.nextPos;
  28140. return cached.result;
  28141. }
  28142. s0 = peg$currPos;
  28143. if (input.substr(peg$currPos, 2) === peg$c46) {
  28144. s1 = peg$c46;
  28145. peg$currPos += 2;
  28146. } else {
  28147. s1 = peg$FAILED;
  28148. if (peg$silentFails === 0) { peg$fail(peg$c47); }
  28149. }
  28150. if (s1 !== peg$FAILED) {
  28151. s2 = peg$parsewsLiteralArrayContents();
  28152. if (s2 !== peg$FAILED) {
  28153. s3 = peg$parsews();
  28154. if (s3 !== peg$FAILED) {
  28155. if (input.charCodeAt(peg$currPos) === 41) {
  28156. s4 = peg$c48;
  28157. peg$currPos++;
  28158. } else {
  28159. s4 = peg$FAILED;
  28160. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  28161. }
  28162. if (s4 !== peg$FAILED) {
  28163. peg$savedPos = s0;
  28164. s1 = peg$c50(s2);
  28165. s0 = s1;
  28166. } else {
  28167. peg$currPos = s0;
  28168. s0 = peg$FAILED;
  28169. }
  28170. } else {
  28171. peg$currPos = s0;
  28172. s0 = peg$FAILED;
  28173. }
  28174. } else {
  28175. peg$currPos = s0;
  28176. s0 = peg$FAILED;
  28177. }
  28178. } else {
  28179. peg$currPos = s0;
  28180. s0 = peg$FAILED;
  28181. }
  28182. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28183. return s0;
  28184. }
  28185. function peg$parsebareLiteralArray() {
  28186. var s0, s1, s2, s3, s4;
  28187. var key = peg$currPos * 66 + 21,
  28188. cached = peg$resultsCache[key];
  28189. if (cached) {
  28190. peg$currPos = cached.nextPos;
  28191. return cached.result;
  28192. }
  28193. s0 = peg$currPos;
  28194. if (input.charCodeAt(peg$currPos) === 40) {
  28195. s1 = peg$c51;
  28196. peg$currPos++;
  28197. } else {
  28198. s1 = peg$FAILED;
  28199. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  28200. }
  28201. if (s1 !== peg$FAILED) {
  28202. s2 = peg$parsewsLiteralArrayContents();
  28203. if (s2 !== peg$FAILED) {
  28204. s3 = peg$parsews();
  28205. if (s3 !== peg$FAILED) {
  28206. if (input.charCodeAt(peg$currPos) === 41) {
  28207. s4 = peg$c48;
  28208. peg$currPos++;
  28209. } else {
  28210. s4 = peg$FAILED;
  28211. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  28212. }
  28213. if (s4 !== peg$FAILED) {
  28214. peg$savedPos = s0;
  28215. s1 = peg$c50(s2);
  28216. s0 = s1;
  28217. } else {
  28218. peg$currPos = s0;
  28219. s0 = peg$FAILED;
  28220. }
  28221. } else {
  28222. peg$currPos = s0;
  28223. s0 = peg$FAILED;
  28224. }
  28225. } else {
  28226. peg$currPos = s0;
  28227. s0 = peg$FAILED;
  28228. }
  28229. } else {
  28230. peg$currPos = s0;
  28231. s0 = peg$FAILED;
  28232. }
  28233. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28234. return s0;
  28235. }
  28236. function peg$parseliteralArrayElement() {
  28237. var s0;
  28238. var key = peg$currPos * 66 + 22,
  28239. cached = peg$resultsCache[key];
  28240. if (cached) {
  28241. peg$currPos = cached.nextPos;
  28242. return cached.result;
  28243. }
  28244. s0 = peg$parseparseTimeLiteral();
  28245. if (s0 === peg$FAILED) {
  28246. s0 = peg$parsebareLiteralArray();
  28247. if (s0 === peg$FAILED) {
  28248. s0 = peg$parsebareSymbol();
  28249. }
  28250. }
  28251. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28252. return s0;
  28253. }
  28254. function peg$parsewsLiteralArrayContents() {
  28255. var s0, s1, s2, s3, s4;
  28256. var key = peg$currPos * 66 + 23,
  28257. cached = peg$resultsCache[key];
  28258. if (cached) {
  28259. peg$currPos = cached.nextPos;
  28260. return cached.result;
  28261. }
  28262. s0 = peg$currPos;
  28263. s1 = [];
  28264. s2 = peg$currPos;
  28265. s3 = peg$parsews();
  28266. if (s3 !== peg$FAILED) {
  28267. s4 = peg$parseliteralArrayElement();
  28268. if (s4 !== peg$FAILED) {
  28269. peg$savedPos = s2;
  28270. s3 = peg$c53(s4);
  28271. s2 = s3;
  28272. } else {
  28273. peg$currPos = s2;
  28274. s2 = peg$FAILED;
  28275. }
  28276. } else {
  28277. peg$currPos = s2;
  28278. s2 = peg$FAILED;
  28279. }
  28280. while (s2 !== peg$FAILED) {
  28281. s1.push(s2);
  28282. s2 = peg$currPos;
  28283. s3 = peg$parsews();
  28284. if (s3 !== peg$FAILED) {
  28285. s4 = peg$parseliteralArrayElement();
  28286. if (s4 !== peg$FAILED) {
  28287. peg$savedPos = s2;
  28288. s3 = peg$c53(s4);
  28289. s2 = s3;
  28290. } else {
  28291. peg$currPos = s2;
  28292. s2 = peg$FAILED;
  28293. }
  28294. } else {
  28295. peg$currPos = s2;
  28296. s2 = peg$FAILED;
  28297. }
  28298. }
  28299. if (s1 !== peg$FAILED) {
  28300. peg$savedPos = s0;
  28301. s1 = peg$c54(s1);
  28302. }
  28303. s0 = s1;
  28304. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28305. return s0;
  28306. }
  28307. function peg$parsedynamicArray() {
  28308. var s0, s1, s2, s3, s4;
  28309. var key = peg$currPos * 66 + 24,
  28310. cached = peg$resultsCache[key];
  28311. if (cached) {
  28312. peg$currPos = cached.nextPos;
  28313. return cached.result;
  28314. }
  28315. s0 = peg$currPos;
  28316. if (input.charCodeAt(peg$currPos) === 123) {
  28317. s1 = peg$c55;
  28318. peg$currPos++;
  28319. } else {
  28320. s1 = peg$FAILED;
  28321. if (peg$silentFails === 0) { peg$fail(peg$c56); }
  28322. }
  28323. if (s1 !== peg$FAILED) {
  28324. s2 = peg$parsewsExpressions();
  28325. if (s2 === peg$FAILED) {
  28326. s2 = null;
  28327. }
  28328. if (s2 !== peg$FAILED) {
  28329. s3 = peg$parsemaybeDotsWs();
  28330. if (s3 !== peg$FAILED) {
  28331. if (input.charCodeAt(peg$currPos) === 125) {
  28332. s4 = peg$c57;
  28333. peg$currPos++;
  28334. } else {
  28335. s4 = peg$FAILED;
  28336. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  28337. }
  28338. if (s4 !== peg$FAILED) {
  28339. peg$savedPos = s0;
  28340. s1 = peg$c59(s2);
  28341. s0 = s1;
  28342. } else {
  28343. peg$currPos = s0;
  28344. s0 = peg$FAILED;
  28345. }
  28346. } else {
  28347. peg$currPos = s0;
  28348. s0 = peg$FAILED;
  28349. }
  28350. } else {
  28351. peg$currPos = s0;
  28352. s0 = peg$FAILED;
  28353. }
  28354. } else {
  28355. peg$currPos = s0;
  28356. s0 = peg$FAILED;
  28357. }
  28358. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28359. return s0;
  28360. }
  28361. function peg$parsedynamicDictionary() {
  28362. var s0, s1, s2, s3, s4;
  28363. var key = peg$currPos * 66 + 25,
  28364. cached = peg$resultsCache[key];
  28365. if (cached) {
  28366. peg$currPos = cached.nextPos;
  28367. return cached.result;
  28368. }
  28369. s0 = peg$currPos;
  28370. if (input.substr(peg$currPos, 2) === peg$c60) {
  28371. s1 = peg$c60;
  28372. peg$currPos += 2;
  28373. } else {
  28374. s1 = peg$FAILED;
  28375. if (peg$silentFails === 0) { peg$fail(peg$c61); }
  28376. }
  28377. if (s1 !== peg$FAILED) {
  28378. s2 = peg$parsewsAssociations();
  28379. if (s2 === peg$FAILED) {
  28380. s2 = null;
  28381. }
  28382. if (s2 !== peg$FAILED) {
  28383. s3 = peg$parsemaybeDotsWs();
  28384. if (s3 !== peg$FAILED) {
  28385. if (input.charCodeAt(peg$currPos) === 125) {
  28386. s4 = peg$c57;
  28387. peg$currPos++;
  28388. } else {
  28389. s4 = peg$FAILED;
  28390. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  28391. }
  28392. if (s4 !== peg$FAILED) {
  28393. peg$savedPos = s0;
  28394. s1 = peg$c62(s2);
  28395. s0 = s1;
  28396. } else {
  28397. peg$currPos = s0;
  28398. s0 = peg$FAILED;
  28399. }
  28400. } else {
  28401. peg$currPos = s0;
  28402. s0 = peg$FAILED;
  28403. }
  28404. } else {
  28405. peg$currPos = s0;
  28406. s0 = peg$FAILED;
  28407. }
  28408. } else {
  28409. peg$currPos = s0;
  28410. s0 = peg$FAILED;
  28411. }
  28412. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28413. return s0;
  28414. }
  28415. function peg$parsepseudoVariable() {
  28416. var s0, s1, s2;
  28417. var key = peg$currPos * 66 + 26,
  28418. cached = peg$resultsCache[key];
  28419. if (cached) {
  28420. peg$currPos = cached.nextPos;
  28421. return cached.result;
  28422. }
  28423. s0 = peg$currPos;
  28424. s1 = peg$currPos;
  28425. if (input.substr(peg$currPos, 4) === peg$c63) {
  28426. s2 = peg$c63;
  28427. peg$currPos += 4;
  28428. } else {
  28429. s2 = peg$FAILED;
  28430. if (peg$silentFails === 0) { peg$fail(peg$c64); }
  28431. }
  28432. if (s2 !== peg$FAILED) {
  28433. peg$savedPos = s1;
  28434. s2 = peg$c65();
  28435. }
  28436. s1 = s2;
  28437. if (s1 === peg$FAILED) {
  28438. s1 = peg$currPos;
  28439. if (input.substr(peg$currPos, 5) === peg$c66) {
  28440. s2 = peg$c66;
  28441. peg$currPos += 5;
  28442. } else {
  28443. s2 = peg$FAILED;
  28444. if (peg$silentFails === 0) { peg$fail(peg$c67); }
  28445. }
  28446. if (s2 !== peg$FAILED) {
  28447. peg$savedPos = s1;
  28448. s2 = peg$c68();
  28449. }
  28450. s1 = s2;
  28451. if (s1 === peg$FAILED) {
  28452. s1 = peg$currPos;
  28453. if (input.substr(peg$currPos, 3) === peg$c69) {
  28454. s2 = peg$c69;
  28455. peg$currPos += 3;
  28456. } else {
  28457. s2 = peg$FAILED;
  28458. if (peg$silentFails === 0) { peg$fail(peg$c70); }
  28459. }
  28460. if (s2 !== peg$FAILED) {
  28461. peg$savedPos = s1;
  28462. s2 = peg$c71();
  28463. }
  28464. s1 = s2;
  28465. }
  28466. }
  28467. if (s1 !== peg$FAILED) {
  28468. peg$savedPos = s0;
  28469. s1 = peg$c16(s1);
  28470. }
  28471. s0 = s1;
  28472. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28473. return s0;
  28474. }
  28475. function peg$parseparseTimeLiteral() {
  28476. var s0;
  28477. var key = peg$currPos * 66 + 27,
  28478. cached = peg$resultsCache[key];
  28479. if (cached) {
  28480. peg$currPos = cached.nextPos;
  28481. return cached.result;
  28482. }
  28483. s0 = peg$parsepseudoVariable();
  28484. if (s0 === peg$FAILED) {
  28485. s0 = peg$parsenumber();
  28486. if (s0 === peg$FAILED) {
  28487. s0 = peg$parseliteralArray();
  28488. if (s0 === peg$FAILED) {
  28489. s0 = peg$parsestring();
  28490. if (s0 === peg$FAILED) {
  28491. s0 = peg$parsesymbol();
  28492. if (s0 === peg$FAILED) {
  28493. s0 = peg$parsecharacter();
  28494. }
  28495. }
  28496. }
  28497. }
  28498. }
  28499. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28500. return s0;
  28501. }
  28502. function peg$parseruntimeLiteral() {
  28503. var s0;
  28504. var key = peg$currPos * 66 + 28,
  28505. cached = peg$resultsCache[key];
  28506. if (cached) {
  28507. peg$currPos = cached.nextPos;
  28508. return cached.result;
  28509. }
  28510. s0 = peg$parsedynamicDictionary();
  28511. if (s0 === peg$FAILED) {
  28512. s0 = peg$parsedynamicArray();
  28513. if (s0 === peg$FAILED) {
  28514. s0 = peg$parseblock();
  28515. }
  28516. }
  28517. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28518. return s0;
  28519. }
  28520. function peg$parseliteral() {
  28521. var s0;
  28522. var key = peg$currPos * 66 + 29,
  28523. cached = peg$resultsCache[key];
  28524. if (cached) {
  28525. peg$currPos = cached.nextPos;
  28526. return cached.result;
  28527. }
  28528. s0 = peg$parseruntimeLiteral();
  28529. if (s0 === peg$FAILED) {
  28530. s0 = peg$parseparseTimeLiteral();
  28531. }
  28532. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28533. return s0;
  28534. }
  28535. function peg$parsevariable() {
  28536. var s0, s1;
  28537. var key = peg$currPos * 66 + 30,
  28538. cached = peg$resultsCache[key];
  28539. if (cached) {
  28540. peg$currPos = cached.nextPos;
  28541. return cached.result;
  28542. }
  28543. s0 = peg$currPos;
  28544. s1 = peg$parseidentifier();
  28545. if (s1 !== peg$FAILED) {
  28546. peg$savedPos = s0;
  28547. s1 = peg$c72(s1);
  28548. }
  28549. s0 = s1;
  28550. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28551. return s0;
  28552. }
  28553. function peg$parsebinarySelector() {
  28554. var s0, s1, s2;
  28555. var key = peg$currPos * 66 + 31,
  28556. cached = peg$resultsCache[key];
  28557. if (cached) {
  28558. peg$currPos = cached.nextPos;
  28559. return cached.result;
  28560. }
  28561. s0 = peg$currPos;
  28562. s1 = [];
  28563. if (peg$c73.test(input.charAt(peg$currPos))) {
  28564. s2 = input.charAt(peg$currPos);
  28565. peg$currPos++;
  28566. } else {
  28567. s2 = peg$FAILED;
  28568. if (peg$silentFails === 0) { peg$fail(peg$c74); }
  28569. }
  28570. if (s2 !== peg$FAILED) {
  28571. while (s2 !== peg$FAILED) {
  28572. s1.push(s2);
  28573. if (peg$c73.test(input.charAt(peg$currPos))) {
  28574. s2 = input.charAt(peg$currPos);
  28575. peg$currPos++;
  28576. } else {
  28577. s2 = peg$FAILED;
  28578. if (peg$silentFails === 0) { peg$fail(peg$c74); }
  28579. }
  28580. }
  28581. } else {
  28582. s1 = peg$FAILED;
  28583. }
  28584. if (s1 !== peg$FAILED) {
  28585. s0 = input.substring(s0, peg$currPos);
  28586. } else {
  28587. s0 = s1;
  28588. }
  28589. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28590. return s0;
  28591. }
  28592. function peg$parsewsKeywordPattern() {
  28593. var s0, s1, s2, s3, s4, s5, s6;
  28594. var key = peg$currPos * 66 + 32,
  28595. cached = peg$resultsCache[key];
  28596. if (cached) {
  28597. peg$currPos = cached.nextPos;
  28598. return cached.result;
  28599. }
  28600. s0 = peg$currPos;
  28601. s1 = [];
  28602. s2 = peg$currPos;
  28603. s3 = peg$parsews();
  28604. if (s3 !== peg$FAILED) {
  28605. s4 = peg$parsekeyword();
  28606. if (s4 !== peg$FAILED) {
  28607. s5 = peg$parsews();
  28608. if (s5 !== peg$FAILED) {
  28609. s6 = peg$parseidentifier();
  28610. if (s6 !== peg$FAILED) {
  28611. peg$savedPos = s2;
  28612. s3 = peg$c75(s4, s6);
  28613. s2 = s3;
  28614. } else {
  28615. peg$currPos = s2;
  28616. s2 = peg$FAILED;
  28617. }
  28618. } else {
  28619. peg$currPos = s2;
  28620. s2 = peg$FAILED;
  28621. }
  28622. } else {
  28623. peg$currPos = s2;
  28624. s2 = peg$FAILED;
  28625. }
  28626. } else {
  28627. peg$currPos = s2;
  28628. s2 = peg$FAILED;
  28629. }
  28630. if (s2 !== peg$FAILED) {
  28631. while (s2 !== peg$FAILED) {
  28632. s1.push(s2);
  28633. s2 = peg$currPos;
  28634. s3 = peg$parsews();
  28635. if (s3 !== peg$FAILED) {
  28636. s4 = peg$parsekeyword();
  28637. if (s4 !== peg$FAILED) {
  28638. s5 = peg$parsews();
  28639. if (s5 !== peg$FAILED) {
  28640. s6 = peg$parseidentifier();
  28641. if (s6 !== peg$FAILED) {
  28642. peg$savedPos = s2;
  28643. s3 = peg$c75(s4, s6);
  28644. s2 = s3;
  28645. } else {
  28646. peg$currPos = s2;
  28647. s2 = peg$FAILED;
  28648. }
  28649. } else {
  28650. peg$currPos = s2;
  28651. s2 = peg$FAILED;
  28652. }
  28653. } else {
  28654. peg$currPos = s2;
  28655. s2 = peg$FAILED;
  28656. }
  28657. } else {
  28658. peg$currPos = s2;
  28659. s2 = peg$FAILED;
  28660. }
  28661. }
  28662. } else {
  28663. s1 = peg$FAILED;
  28664. }
  28665. if (s1 !== peg$FAILED) {
  28666. peg$savedPos = s0;
  28667. s1 = peg$c76(s1);
  28668. }
  28669. s0 = s1;
  28670. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28671. return s0;
  28672. }
  28673. function peg$parsewsBinaryPattern() {
  28674. var s0, s1, s2, s3, s4;
  28675. var key = peg$currPos * 66 + 33,
  28676. cached = peg$resultsCache[key];
  28677. if (cached) {
  28678. peg$currPos = cached.nextPos;
  28679. return cached.result;
  28680. }
  28681. s0 = peg$currPos;
  28682. s1 = peg$parsews();
  28683. if (s1 !== peg$FAILED) {
  28684. s2 = peg$parsebinarySelector();
  28685. if (s2 !== peg$FAILED) {
  28686. s3 = peg$parsews();
  28687. if (s3 !== peg$FAILED) {
  28688. s4 = peg$parseidentifier();
  28689. if (s4 !== peg$FAILED) {
  28690. peg$savedPos = s0;
  28691. s1 = peg$c77(s2, s4);
  28692. s0 = s1;
  28693. } else {
  28694. peg$currPos = s0;
  28695. s0 = peg$FAILED;
  28696. }
  28697. } else {
  28698. peg$currPos = s0;
  28699. s0 = peg$FAILED;
  28700. }
  28701. } else {
  28702. peg$currPos = s0;
  28703. s0 = peg$FAILED;
  28704. }
  28705. } else {
  28706. peg$currPos = s0;
  28707. s0 = peg$FAILED;
  28708. }
  28709. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28710. return s0;
  28711. }
  28712. function peg$parsewsUnaryPattern() {
  28713. var s0, s1, s2;
  28714. var key = peg$currPos * 66 + 34,
  28715. cached = peg$resultsCache[key];
  28716. if (cached) {
  28717. peg$currPos = cached.nextPos;
  28718. return cached.result;
  28719. }
  28720. s0 = peg$currPos;
  28721. s1 = peg$parsews();
  28722. if (s1 !== peg$FAILED) {
  28723. s2 = peg$parseidentifier();
  28724. if (s2 !== peg$FAILED) {
  28725. peg$savedPos = s0;
  28726. s1 = peg$c78(s2);
  28727. s0 = s1;
  28728. } else {
  28729. peg$currPos = s0;
  28730. s0 = peg$FAILED;
  28731. }
  28732. } else {
  28733. peg$currPos = s0;
  28734. s0 = peg$FAILED;
  28735. }
  28736. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28737. return s0;
  28738. }
  28739. function peg$parseexpression() {
  28740. var s0;
  28741. var key = peg$currPos * 66 + 35,
  28742. cached = peg$resultsCache[key];
  28743. if (cached) {
  28744. peg$currPos = cached.nextPos;
  28745. return cached.result;
  28746. }
  28747. s0 = peg$parseassignment();
  28748. if (s0 === peg$FAILED) {
  28749. s0 = peg$parsecascade();
  28750. if (s0 === peg$FAILED) {
  28751. s0 = peg$parsekeywordSend();
  28752. }
  28753. }
  28754. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28755. return s0;
  28756. }
  28757. function peg$parsewsExpressionsRest() {
  28758. var s0, s1, s2;
  28759. var key = peg$currPos * 66 + 36,
  28760. cached = peg$resultsCache[key];
  28761. if (cached) {
  28762. peg$currPos = cached.nextPos;
  28763. return cached.result;
  28764. }
  28765. s0 = peg$currPos;
  28766. s1 = peg$parsesomeDotsWs();
  28767. if (s1 !== peg$FAILED) {
  28768. s2 = peg$parseexpression();
  28769. if (s2 !== peg$FAILED) {
  28770. peg$savedPos = s0;
  28771. s1 = peg$c79(s2);
  28772. s0 = s1;
  28773. } else {
  28774. peg$currPos = s0;
  28775. s0 = peg$FAILED;
  28776. }
  28777. } else {
  28778. peg$currPos = s0;
  28779. s0 = peg$FAILED;
  28780. }
  28781. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28782. return s0;
  28783. }
  28784. function peg$parsewsExpressions() {
  28785. var s0, s1, s2, s3, s4;
  28786. var key = peg$currPos * 66 + 37,
  28787. cached = peg$resultsCache[key];
  28788. if (cached) {
  28789. peg$currPos = cached.nextPos;
  28790. return cached.result;
  28791. }
  28792. s0 = peg$currPos;
  28793. s1 = peg$parsemaybeDotsWs();
  28794. if (s1 !== peg$FAILED) {
  28795. s2 = peg$parseexpression();
  28796. if (s2 !== peg$FAILED) {
  28797. s3 = [];
  28798. s4 = peg$parsewsExpressionsRest();
  28799. while (s4 !== peg$FAILED) {
  28800. s3.push(s4);
  28801. s4 = peg$parsewsExpressionsRest();
  28802. }
  28803. if (s3 !== peg$FAILED) {
  28804. peg$savedPos = s0;
  28805. s1 = peg$c80(s2, s3);
  28806. s0 = s1;
  28807. } else {
  28808. peg$currPos = s0;
  28809. s0 = peg$FAILED;
  28810. }
  28811. } else {
  28812. peg$currPos = s0;
  28813. s0 = peg$FAILED;
  28814. }
  28815. } else {
  28816. peg$currPos = s0;
  28817. s0 = peg$FAILED;
  28818. }
  28819. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28820. return s0;
  28821. }
  28822. function peg$parsewsUnaryPragmaMessage() {
  28823. var s0, s1, s2, s3, s4;
  28824. var key = peg$currPos * 66 + 38,
  28825. cached = peg$resultsCache[key];
  28826. if (cached) {
  28827. peg$currPos = cached.nextPos;
  28828. return cached.result;
  28829. }
  28830. s0 = peg$currPos;
  28831. s1 = peg$parsews();
  28832. if (s1 !== peg$FAILED) {
  28833. s2 = peg$parseidentifier();
  28834. if (s2 !== peg$FAILED) {
  28835. s3 = peg$currPos;
  28836. peg$silentFails++;
  28837. if (input.charCodeAt(peg$currPos) === 58) {
  28838. s4 = peg$c12;
  28839. peg$currPos++;
  28840. } else {
  28841. s4 = peg$FAILED;
  28842. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  28843. }
  28844. peg$silentFails--;
  28845. if (s4 === peg$FAILED) {
  28846. s3 = void 0;
  28847. } else {
  28848. peg$currPos = s3;
  28849. s3 = peg$FAILED;
  28850. }
  28851. if (s3 !== peg$FAILED) {
  28852. peg$savedPos = s0;
  28853. s1 = peg$c81(s2);
  28854. s0 = s1;
  28855. } else {
  28856. peg$currPos = s0;
  28857. s0 = peg$FAILED;
  28858. }
  28859. } else {
  28860. peg$currPos = s0;
  28861. s0 = peg$FAILED;
  28862. }
  28863. } else {
  28864. peg$currPos = s0;
  28865. s0 = peg$FAILED;
  28866. }
  28867. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28868. return s0;
  28869. }
  28870. function peg$parsewsKeywordPragmaMessage() {
  28871. var s0, s1, s2, s3, s4, s5, s6;
  28872. var key = peg$currPos * 66 + 39,
  28873. cached = peg$resultsCache[key];
  28874. if (cached) {
  28875. peg$currPos = cached.nextPos;
  28876. return cached.result;
  28877. }
  28878. s0 = peg$currPos;
  28879. s1 = [];
  28880. s2 = peg$currPos;
  28881. s3 = peg$parsews();
  28882. if (s3 !== peg$FAILED) {
  28883. s4 = peg$parsekeyword();
  28884. if (s4 !== peg$FAILED) {
  28885. s5 = peg$parsews();
  28886. if (s5 !== peg$FAILED) {
  28887. s6 = peg$parseparseTimeLiteral();
  28888. if (s6 !== peg$FAILED) {
  28889. peg$savedPos = s2;
  28890. s3 = peg$c75(s4, s6);
  28891. s2 = s3;
  28892. } else {
  28893. peg$currPos = s2;
  28894. s2 = peg$FAILED;
  28895. }
  28896. } else {
  28897. peg$currPos = s2;
  28898. s2 = peg$FAILED;
  28899. }
  28900. } else {
  28901. peg$currPos = s2;
  28902. s2 = peg$FAILED;
  28903. }
  28904. } else {
  28905. peg$currPos = s2;
  28906. s2 = peg$FAILED;
  28907. }
  28908. if (s2 !== peg$FAILED) {
  28909. while (s2 !== peg$FAILED) {
  28910. s1.push(s2);
  28911. s2 = peg$currPos;
  28912. s3 = peg$parsews();
  28913. if (s3 !== peg$FAILED) {
  28914. s4 = peg$parsekeyword();
  28915. if (s4 !== peg$FAILED) {
  28916. s5 = peg$parsews();
  28917. if (s5 !== peg$FAILED) {
  28918. s6 = peg$parseparseTimeLiteral();
  28919. if (s6 !== peg$FAILED) {
  28920. peg$savedPos = s2;
  28921. s3 = peg$c75(s4, s6);
  28922. s2 = s3;
  28923. } else {
  28924. peg$currPos = s2;
  28925. s2 = peg$FAILED;
  28926. }
  28927. } else {
  28928. peg$currPos = s2;
  28929. s2 = peg$FAILED;
  28930. }
  28931. } else {
  28932. peg$currPos = s2;
  28933. s2 = peg$FAILED;
  28934. }
  28935. } else {
  28936. peg$currPos = s2;
  28937. s2 = peg$FAILED;
  28938. }
  28939. }
  28940. } else {
  28941. s1 = peg$FAILED;
  28942. }
  28943. if (s1 !== peg$FAILED) {
  28944. peg$savedPos = s0;
  28945. s1 = peg$c82(s1);
  28946. }
  28947. s0 = s1;
  28948. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28949. return s0;
  28950. }
  28951. function peg$parsewsPragmaMessage() {
  28952. var s0;
  28953. var key = peg$currPos * 66 + 40,
  28954. cached = peg$resultsCache[key];
  28955. if (cached) {
  28956. peg$currPos = cached.nextPos;
  28957. return cached.result;
  28958. }
  28959. s0 = peg$parsewsUnaryPragmaMessage();
  28960. if (s0 === peg$FAILED) {
  28961. s0 = peg$parsewsKeywordPragmaMessage();
  28962. }
  28963. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28964. return s0;
  28965. }
  28966. function peg$parsewsPragmas() {
  28967. var s0, s1, s2, s3, s4, s5, s6;
  28968. var key = peg$currPos * 66 + 41,
  28969. cached = peg$resultsCache[key];
  28970. if (cached) {
  28971. peg$currPos = cached.nextPos;
  28972. return cached.result;
  28973. }
  28974. s0 = [];
  28975. s1 = peg$currPos;
  28976. s2 = peg$parsews();
  28977. if (s2 !== peg$FAILED) {
  28978. if (input.charCodeAt(peg$currPos) === 60) {
  28979. s3 = peg$c83;
  28980. peg$currPos++;
  28981. } else {
  28982. s3 = peg$FAILED;
  28983. if (peg$silentFails === 0) { peg$fail(peg$c84); }
  28984. }
  28985. if (s3 !== peg$FAILED) {
  28986. s4 = peg$parsewsPragmaMessage();
  28987. if (s4 !== peg$FAILED) {
  28988. s5 = peg$parsews();
  28989. if (s5 !== peg$FAILED) {
  28990. if (input.charCodeAt(peg$currPos) === 62) {
  28991. s6 = peg$c85;
  28992. peg$currPos++;
  28993. } else {
  28994. s6 = peg$FAILED;
  28995. if (peg$silentFails === 0) { peg$fail(peg$c86); }
  28996. }
  28997. if (s6 !== peg$FAILED) {
  28998. peg$savedPos = s1;
  28999. s2 = peg$c87(s4);
  29000. s1 = s2;
  29001. } else {
  29002. peg$currPos = s1;
  29003. s1 = peg$FAILED;
  29004. }
  29005. } else {
  29006. peg$currPos = s1;
  29007. s1 = peg$FAILED;
  29008. }
  29009. } else {
  29010. peg$currPos = s1;
  29011. s1 = peg$FAILED;
  29012. }
  29013. } else {
  29014. peg$currPos = s1;
  29015. s1 = peg$FAILED;
  29016. }
  29017. } else {
  29018. peg$currPos = s1;
  29019. s1 = peg$FAILED;
  29020. }
  29021. while (s1 !== peg$FAILED) {
  29022. s0.push(s1);
  29023. s1 = peg$currPos;
  29024. s2 = peg$parsews();
  29025. if (s2 !== peg$FAILED) {
  29026. if (input.charCodeAt(peg$currPos) === 60) {
  29027. s3 = peg$c83;
  29028. peg$currPos++;
  29029. } else {
  29030. s3 = peg$FAILED;
  29031. if (peg$silentFails === 0) { peg$fail(peg$c84); }
  29032. }
  29033. if (s3 !== peg$FAILED) {
  29034. s4 = peg$parsewsPragmaMessage();
  29035. if (s4 !== peg$FAILED) {
  29036. s5 = peg$parsews();
  29037. if (s5 !== peg$FAILED) {
  29038. if (input.charCodeAt(peg$currPos) === 62) {
  29039. s6 = peg$c85;
  29040. peg$currPos++;
  29041. } else {
  29042. s6 = peg$FAILED;
  29043. if (peg$silentFails === 0) { peg$fail(peg$c86); }
  29044. }
  29045. if (s6 !== peg$FAILED) {
  29046. peg$savedPos = s1;
  29047. s2 = peg$c87(s4);
  29048. s1 = s2;
  29049. } else {
  29050. peg$currPos = s1;
  29051. s1 = peg$FAILED;
  29052. }
  29053. } else {
  29054. peg$currPos = s1;
  29055. s1 = peg$FAILED;
  29056. }
  29057. } else {
  29058. peg$currPos = s1;
  29059. s1 = peg$FAILED;
  29060. }
  29061. } else {
  29062. peg$currPos = s1;
  29063. s1 = peg$FAILED;
  29064. }
  29065. } else {
  29066. peg$currPos = s1;
  29067. s1 = peg$FAILED;
  29068. }
  29069. }
  29070. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29071. return s0;
  29072. }
  29073. function peg$parseassignment() {
  29074. var s0, s1, s2, s3, s4, s5;
  29075. var key = peg$currPos * 66 + 42,
  29076. cached = peg$resultsCache[key];
  29077. if (cached) {
  29078. peg$currPos = cached.nextPos;
  29079. return cached.result;
  29080. }
  29081. s0 = peg$currPos;
  29082. s1 = peg$parsevariable();
  29083. if (s1 !== peg$FAILED) {
  29084. s2 = peg$parsews();
  29085. if (s2 !== peg$FAILED) {
  29086. if (input.substr(peg$currPos, 2) === peg$c88) {
  29087. s3 = peg$c88;
  29088. peg$currPos += 2;
  29089. } else {
  29090. s3 = peg$FAILED;
  29091. if (peg$silentFails === 0) { peg$fail(peg$c89); }
  29092. }
  29093. if (s3 !== peg$FAILED) {
  29094. s4 = peg$parsews();
  29095. if (s4 !== peg$FAILED) {
  29096. s5 = peg$parseexpression();
  29097. if (s5 !== peg$FAILED) {
  29098. peg$savedPos = s0;
  29099. s1 = peg$c90(s1, s5);
  29100. s0 = s1;
  29101. } else {
  29102. peg$currPos = s0;
  29103. s0 = peg$FAILED;
  29104. }
  29105. } else {
  29106. peg$currPos = s0;
  29107. s0 = peg$FAILED;
  29108. }
  29109. } else {
  29110. peg$currPos = s0;
  29111. s0 = peg$FAILED;
  29112. }
  29113. } else {
  29114. peg$currPos = s0;
  29115. s0 = peg$FAILED;
  29116. }
  29117. } else {
  29118. peg$currPos = s0;
  29119. s0 = peg$FAILED;
  29120. }
  29121. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29122. return s0;
  29123. }
  29124. function peg$parseret() {
  29125. var s0, s1, s2, s3;
  29126. var key = peg$currPos * 66 + 43,
  29127. cached = peg$resultsCache[key];
  29128. if (cached) {
  29129. peg$currPos = cached.nextPos;
  29130. return cached.result;
  29131. }
  29132. s0 = peg$currPos;
  29133. if (input.charCodeAt(peg$currPos) === 94) {
  29134. s1 = peg$c91;
  29135. peg$currPos++;
  29136. } else {
  29137. s1 = peg$FAILED;
  29138. if (peg$silentFails === 0) { peg$fail(peg$c92); }
  29139. }
  29140. if (s1 !== peg$FAILED) {
  29141. s2 = peg$parsews();
  29142. if (s2 !== peg$FAILED) {
  29143. s3 = peg$parseexpression();
  29144. if (s3 !== peg$FAILED) {
  29145. peg$savedPos = s0;
  29146. s1 = peg$c93(s3);
  29147. s0 = s1;
  29148. } else {
  29149. peg$currPos = s0;
  29150. s0 = peg$FAILED;
  29151. }
  29152. } else {
  29153. peg$currPos = s0;
  29154. s0 = peg$FAILED;
  29155. }
  29156. } else {
  29157. peg$currPos = s0;
  29158. s0 = peg$FAILED;
  29159. }
  29160. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29161. return s0;
  29162. }
  29163. function peg$parsetemps() {
  29164. var s0, s1, s2, s3, s4, s5;
  29165. var key = peg$currPos * 66 + 44,
  29166. cached = peg$resultsCache[key];
  29167. if (cached) {
  29168. peg$currPos = cached.nextPos;
  29169. return cached.result;
  29170. }
  29171. s0 = peg$currPos;
  29172. if (input.charCodeAt(peg$currPos) === 124) {
  29173. s1 = peg$c94;
  29174. peg$currPos++;
  29175. } else {
  29176. s1 = peg$FAILED;
  29177. if (peg$silentFails === 0) { peg$fail(peg$c95); }
  29178. }
  29179. if (s1 !== peg$FAILED) {
  29180. s2 = [];
  29181. s3 = peg$currPos;
  29182. s4 = peg$parsews();
  29183. if (s4 !== peg$FAILED) {
  29184. s5 = peg$parseidentifier();
  29185. if (s5 !== peg$FAILED) {
  29186. peg$savedPos = s3;
  29187. s4 = peg$c96(s5);
  29188. s3 = s4;
  29189. } else {
  29190. peg$currPos = s3;
  29191. s3 = peg$FAILED;
  29192. }
  29193. } else {
  29194. peg$currPos = s3;
  29195. s3 = peg$FAILED;
  29196. }
  29197. while (s3 !== peg$FAILED) {
  29198. s2.push(s3);
  29199. s3 = peg$currPos;
  29200. s4 = peg$parsews();
  29201. if (s4 !== peg$FAILED) {
  29202. s5 = peg$parseidentifier();
  29203. if (s5 !== peg$FAILED) {
  29204. peg$savedPos = s3;
  29205. s4 = peg$c96(s5);
  29206. s3 = s4;
  29207. } else {
  29208. peg$currPos = s3;
  29209. s3 = peg$FAILED;
  29210. }
  29211. } else {
  29212. peg$currPos = s3;
  29213. s3 = peg$FAILED;
  29214. }
  29215. }
  29216. if (s2 !== peg$FAILED) {
  29217. s3 = peg$parsews();
  29218. if (s3 !== peg$FAILED) {
  29219. if (input.charCodeAt(peg$currPos) === 124) {
  29220. s4 = peg$c94;
  29221. peg$currPos++;
  29222. } else {
  29223. s4 = peg$FAILED;
  29224. if (peg$silentFails === 0) { peg$fail(peg$c95); }
  29225. }
  29226. if (s4 !== peg$FAILED) {
  29227. peg$savedPos = s0;
  29228. s1 = peg$c97(s2);
  29229. s0 = s1;
  29230. } else {
  29231. peg$currPos = s0;
  29232. s0 = peg$FAILED;
  29233. }
  29234. } else {
  29235. peg$currPos = s0;
  29236. s0 = peg$FAILED;
  29237. }
  29238. } else {
  29239. peg$currPos = s0;
  29240. s0 = peg$FAILED;
  29241. }
  29242. } else {
  29243. peg$currPos = s0;
  29244. s0 = peg$FAILED;
  29245. }
  29246. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29247. return s0;
  29248. }
  29249. function peg$parsewsBlockParamList() {
  29250. var s0, s1, s2, s3, s4, s5, s6;
  29251. var key = peg$currPos * 66 + 45,
  29252. cached = peg$resultsCache[key];
  29253. if (cached) {
  29254. peg$currPos = cached.nextPos;
  29255. return cached.result;
  29256. }
  29257. s0 = peg$currPos;
  29258. s1 = [];
  29259. s2 = peg$currPos;
  29260. s3 = peg$parsews();
  29261. if (s3 !== peg$FAILED) {
  29262. if (input.charCodeAt(peg$currPos) === 58) {
  29263. s4 = peg$c12;
  29264. peg$currPos++;
  29265. } else {
  29266. s4 = peg$FAILED;
  29267. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  29268. }
  29269. if (s4 !== peg$FAILED) {
  29270. s5 = peg$parsews();
  29271. if (s5 !== peg$FAILED) {
  29272. s6 = peg$parseidentifier();
  29273. if (s6 !== peg$FAILED) {
  29274. peg$savedPos = s2;
  29275. s3 = peg$c98(s6);
  29276. s2 = s3;
  29277. } else {
  29278. peg$currPos = s2;
  29279. s2 = peg$FAILED;
  29280. }
  29281. } else {
  29282. peg$currPos = s2;
  29283. s2 = peg$FAILED;
  29284. }
  29285. } else {
  29286. peg$currPos = s2;
  29287. s2 = peg$FAILED;
  29288. }
  29289. } else {
  29290. peg$currPos = s2;
  29291. s2 = peg$FAILED;
  29292. }
  29293. if (s2 !== peg$FAILED) {
  29294. while (s2 !== peg$FAILED) {
  29295. s1.push(s2);
  29296. s2 = peg$currPos;
  29297. s3 = peg$parsews();
  29298. if (s3 !== peg$FAILED) {
  29299. if (input.charCodeAt(peg$currPos) === 58) {
  29300. s4 = peg$c12;
  29301. peg$currPos++;
  29302. } else {
  29303. s4 = peg$FAILED;
  29304. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  29305. }
  29306. if (s4 !== peg$FAILED) {
  29307. s5 = peg$parsews();
  29308. if (s5 !== peg$FAILED) {
  29309. s6 = peg$parseidentifier();
  29310. if (s6 !== peg$FAILED) {
  29311. peg$savedPos = s2;
  29312. s3 = peg$c98(s6);
  29313. s2 = s3;
  29314. } else {
  29315. peg$currPos = s2;
  29316. s2 = peg$FAILED;
  29317. }
  29318. } else {
  29319. peg$currPos = s2;
  29320. s2 = peg$FAILED;
  29321. }
  29322. } else {
  29323. peg$currPos = s2;
  29324. s2 = peg$FAILED;
  29325. }
  29326. } else {
  29327. peg$currPos = s2;
  29328. s2 = peg$FAILED;
  29329. }
  29330. }
  29331. } else {
  29332. s1 = peg$FAILED;
  29333. }
  29334. if (s1 !== peg$FAILED) {
  29335. s2 = peg$parsews();
  29336. if (s2 !== peg$FAILED) {
  29337. if (input.charCodeAt(peg$currPos) === 124) {
  29338. s3 = peg$c94;
  29339. peg$currPos++;
  29340. } else {
  29341. s3 = peg$FAILED;
  29342. if (peg$silentFails === 0) { peg$fail(peg$c95); }
  29343. }
  29344. if (s3 !== peg$FAILED) {
  29345. peg$savedPos = s0;
  29346. s1 = peg$c99(s1);
  29347. s0 = s1;
  29348. } else {
  29349. peg$currPos = s0;
  29350. s0 = peg$FAILED;
  29351. }
  29352. } else {
  29353. peg$currPos = s0;
  29354. s0 = peg$FAILED;
  29355. }
  29356. } else {
  29357. peg$currPos = s0;
  29358. s0 = peg$FAILED;
  29359. }
  29360. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29361. return s0;
  29362. }
  29363. function peg$parsesubexpression() {
  29364. var s0, s1, s2, s3, s4, s5;
  29365. var key = peg$currPos * 66 + 46,
  29366. cached = peg$resultsCache[key];
  29367. if (cached) {
  29368. peg$currPos = cached.nextPos;
  29369. return cached.result;
  29370. }
  29371. s0 = peg$currPos;
  29372. if (input.charCodeAt(peg$currPos) === 40) {
  29373. s1 = peg$c51;
  29374. peg$currPos++;
  29375. } else {
  29376. s1 = peg$FAILED;
  29377. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  29378. }
  29379. if (s1 !== peg$FAILED) {
  29380. s2 = peg$parsews();
  29381. if (s2 !== peg$FAILED) {
  29382. s3 = peg$parseexpression();
  29383. if (s3 !== peg$FAILED) {
  29384. s4 = peg$parsews();
  29385. if (s4 !== peg$FAILED) {
  29386. if (input.charCodeAt(peg$currPos) === 41) {
  29387. s5 = peg$c48;
  29388. peg$currPos++;
  29389. } else {
  29390. s5 = peg$FAILED;
  29391. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  29392. }
  29393. if (s5 !== peg$FAILED) {
  29394. peg$savedPos = s0;
  29395. s1 = peg$c79(s3);
  29396. s0 = s1;
  29397. } else {
  29398. peg$currPos = s0;
  29399. s0 = peg$FAILED;
  29400. }
  29401. } else {
  29402. peg$currPos = s0;
  29403. s0 = peg$FAILED;
  29404. }
  29405. } else {
  29406. peg$currPos = s0;
  29407. s0 = peg$FAILED;
  29408. }
  29409. } else {
  29410. peg$currPos = s0;
  29411. s0 = peg$FAILED;
  29412. }
  29413. } else {
  29414. peg$currPos = s0;
  29415. s0 = peg$FAILED;
  29416. }
  29417. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29418. return s0;
  29419. }
  29420. function peg$parsewsStatements() {
  29421. var s0, s1, s2, s3;
  29422. var key = peg$currPos * 66 + 47,
  29423. cached = peg$resultsCache[key];
  29424. if (cached) {
  29425. peg$currPos = cached.nextPos;
  29426. return cached.result;
  29427. }
  29428. s0 = peg$currPos;
  29429. s1 = peg$parsemaybeDotsWs();
  29430. if (s1 !== peg$FAILED) {
  29431. s2 = peg$parseret();
  29432. if (s2 !== peg$FAILED) {
  29433. peg$savedPos = s0;
  29434. s1 = peg$c100(s2);
  29435. s0 = s1;
  29436. } else {
  29437. peg$currPos = s0;
  29438. s0 = peg$FAILED;
  29439. }
  29440. } else {
  29441. peg$currPos = s0;
  29442. s0 = peg$FAILED;
  29443. }
  29444. if (s0 === peg$FAILED) {
  29445. s0 = peg$currPos;
  29446. s1 = peg$parsewsExpressions();
  29447. if (s1 !== peg$FAILED) {
  29448. s2 = peg$parsesomeDotsWs();
  29449. if (s2 !== peg$FAILED) {
  29450. s3 = peg$parseret();
  29451. if (s3 !== peg$FAILED) {
  29452. peg$savedPos = s0;
  29453. s1 = peg$c101(s1, s3);
  29454. s0 = s1;
  29455. } else {
  29456. peg$currPos = s0;
  29457. s0 = peg$FAILED;
  29458. }
  29459. } else {
  29460. peg$currPos = s0;
  29461. s0 = peg$FAILED;
  29462. }
  29463. } else {
  29464. peg$currPos = s0;
  29465. s0 = peg$FAILED;
  29466. }
  29467. if (s0 === peg$FAILED) {
  29468. s0 = peg$currPos;
  29469. s1 = peg$parsewsExpressions();
  29470. if (s1 === peg$FAILED) {
  29471. s1 = null;
  29472. }
  29473. if (s1 !== peg$FAILED) {
  29474. peg$savedPos = s0;
  29475. s1 = peg$c102(s1);
  29476. }
  29477. s0 = s1;
  29478. }
  29479. }
  29480. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29481. return s0;
  29482. }
  29483. function peg$parsewsSequenceWs() {
  29484. var s0, s1, s2, s3, s4, s5, s6;
  29485. var key = peg$currPos * 66 + 48,
  29486. cached = peg$resultsCache[key];
  29487. if (cached) {
  29488. peg$currPos = cached.nextPos;
  29489. return cached.result;
  29490. }
  29491. s0 = peg$currPos;
  29492. s1 = peg$parsewsPragmas();
  29493. if (s1 === peg$FAILED) {
  29494. s1 = null;
  29495. }
  29496. if (s1 !== peg$FAILED) {
  29497. s2 = peg$parsews();
  29498. if (s2 !== peg$FAILED) {
  29499. s3 = peg$parsetemps();
  29500. if (s3 === peg$FAILED) {
  29501. s3 = null;
  29502. }
  29503. if (s3 !== peg$FAILED) {
  29504. s4 = peg$parsewsPragmas();
  29505. if (s4 === peg$FAILED) {
  29506. s4 = null;
  29507. }
  29508. if (s4 !== peg$FAILED) {
  29509. s5 = peg$parsewsStatements();
  29510. if (s5 === peg$FAILED) {
  29511. s5 = null;
  29512. }
  29513. if (s5 !== peg$FAILED) {
  29514. s6 = peg$parsemaybeDotsWs();
  29515. if (s6 !== peg$FAILED) {
  29516. peg$savedPos = s0;
  29517. s1 = peg$c103(s1, s3, s4, s5);
  29518. s0 = s1;
  29519. } else {
  29520. peg$currPos = s0;
  29521. s0 = peg$FAILED;
  29522. }
  29523. } else {
  29524. peg$currPos = s0;
  29525. s0 = peg$FAILED;
  29526. }
  29527. } else {
  29528. peg$currPos = s0;
  29529. s0 = peg$FAILED;
  29530. }
  29531. } else {
  29532. peg$currPos = s0;
  29533. s0 = peg$FAILED;
  29534. }
  29535. } else {
  29536. peg$currPos = s0;
  29537. s0 = peg$FAILED;
  29538. }
  29539. } else {
  29540. peg$currPos = s0;
  29541. s0 = peg$FAILED;
  29542. }
  29543. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29544. return s0;
  29545. }
  29546. function peg$parseblock() {
  29547. var s0, s1, s2, s3, s4;
  29548. var key = peg$currPos * 66 + 49,
  29549. cached = peg$resultsCache[key];
  29550. if (cached) {
  29551. peg$currPos = cached.nextPos;
  29552. return cached.result;
  29553. }
  29554. s0 = peg$currPos;
  29555. if (input.charCodeAt(peg$currPos) === 91) {
  29556. s1 = peg$c104;
  29557. peg$currPos++;
  29558. } else {
  29559. s1 = peg$FAILED;
  29560. if (peg$silentFails === 0) { peg$fail(peg$c105); }
  29561. }
  29562. if (s1 !== peg$FAILED) {
  29563. s2 = peg$parsewsBlockParamList();
  29564. if (s2 === peg$FAILED) {
  29565. s2 = null;
  29566. }
  29567. if (s2 !== peg$FAILED) {
  29568. s3 = peg$parsewsSequenceWs();
  29569. if (s3 !== peg$FAILED) {
  29570. if (input.charCodeAt(peg$currPos) === 93) {
  29571. s4 = peg$c106;
  29572. peg$currPos++;
  29573. } else {
  29574. s4 = peg$FAILED;
  29575. if (peg$silentFails === 0) { peg$fail(peg$c107); }
  29576. }
  29577. if (s4 !== peg$FAILED) {
  29578. peg$savedPos = s0;
  29579. s1 = peg$c108(s2, s3);
  29580. s0 = s1;
  29581. } else {
  29582. peg$currPos = s0;
  29583. s0 = peg$FAILED;
  29584. }
  29585. } else {
  29586. peg$currPos = s0;
  29587. s0 = peg$FAILED;
  29588. }
  29589. } else {
  29590. peg$currPos = s0;
  29591. s0 = peg$FAILED;
  29592. }
  29593. } else {
  29594. peg$currPos = s0;
  29595. s0 = peg$FAILED;
  29596. }
  29597. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29598. return s0;
  29599. }
  29600. function peg$parseoperand() {
  29601. var s0;
  29602. var key = peg$currPos * 66 + 50,
  29603. cached = peg$resultsCache[key];
  29604. if (cached) {
  29605. peg$currPos = cached.nextPos;
  29606. return cached.result;
  29607. }
  29608. s0 = peg$parseliteral();
  29609. if (s0 === peg$FAILED) {
  29610. s0 = peg$parsevariable();
  29611. if (s0 === peg$FAILED) {
  29612. s0 = peg$parsesubexpression();
  29613. }
  29614. }
  29615. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29616. return s0;
  29617. }
  29618. function peg$parsewsUnaryMessage() {
  29619. var s0, s1, s2, s3, s4;
  29620. var key = peg$currPos * 66 + 51,
  29621. cached = peg$resultsCache[key];
  29622. if (cached) {
  29623. peg$currPos = cached.nextPos;
  29624. return cached.result;
  29625. }
  29626. s0 = peg$currPos;
  29627. s1 = peg$parsews();
  29628. if (s1 !== peg$FAILED) {
  29629. s2 = peg$parseidentifier();
  29630. if (s2 !== peg$FAILED) {
  29631. s3 = peg$currPos;
  29632. peg$silentFails++;
  29633. if (input.charCodeAt(peg$currPos) === 58) {
  29634. s4 = peg$c12;
  29635. peg$currPos++;
  29636. } else {
  29637. s4 = peg$FAILED;
  29638. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  29639. }
  29640. peg$silentFails--;
  29641. if (s4 === peg$FAILED) {
  29642. s3 = void 0;
  29643. } else {
  29644. peg$currPos = s3;
  29645. s3 = peg$FAILED;
  29646. }
  29647. if (s3 !== peg$FAILED) {
  29648. peg$savedPos = s0;
  29649. s1 = peg$c109(s2);
  29650. s0 = s1;
  29651. } else {
  29652. peg$currPos = s0;
  29653. s0 = peg$FAILED;
  29654. }
  29655. } else {
  29656. peg$currPos = s0;
  29657. s0 = peg$FAILED;
  29658. }
  29659. } else {
  29660. peg$currPos = s0;
  29661. s0 = peg$FAILED;
  29662. }
  29663. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29664. return s0;
  29665. }
  29666. function peg$parsewsUnaryTail() {
  29667. var s0, s1;
  29668. var key = peg$currPos * 66 + 52,
  29669. cached = peg$resultsCache[key];
  29670. if (cached) {
  29671. peg$currPos = cached.nextPos;
  29672. return cached.result;
  29673. }
  29674. s0 = [];
  29675. s1 = peg$parsewsUnaryMessage();
  29676. while (s1 !== peg$FAILED) {
  29677. s0.push(s1);
  29678. s1 = peg$parsewsUnaryMessage();
  29679. }
  29680. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29681. return s0;
  29682. }
  29683. function peg$parseunarySend() {
  29684. var s0, s1, s2;
  29685. var key = peg$currPos * 66 + 53,
  29686. cached = peg$resultsCache[key];
  29687. if (cached) {
  29688. peg$currPos = cached.nextPos;
  29689. return cached.result;
  29690. }
  29691. s0 = peg$currPos;
  29692. s1 = peg$parseoperand();
  29693. if (s1 !== peg$FAILED) {
  29694. s2 = peg$parsewsUnaryTail();
  29695. if (s2 !== peg$FAILED) {
  29696. peg$savedPos = s0;
  29697. s1 = peg$c110(s1, s2);
  29698. s0 = s1;
  29699. } else {
  29700. peg$currPos = s0;
  29701. s0 = peg$FAILED;
  29702. }
  29703. } else {
  29704. peg$currPos = s0;
  29705. s0 = peg$FAILED;
  29706. }
  29707. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29708. return s0;
  29709. }
  29710. function peg$parsewsBinaryMessage() {
  29711. var s0, s1, s2, s3, s4;
  29712. var key = peg$currPos * 66 + 54,
  29713. cached = peg$resultsCache[key];
  29714. if (cached) {
  29715. peg$currPos = cached.nextPos;
  29716. return cached.result;
  29717. }
  29718. s0 = peg$currPos;
  29719. s1 = peg$parsews();
  29720. if (s1 !== peg$FAILED) {
  29721. s2 = peg$parsebinarySelector();
  29722. if (s2 !== peg$FAILED) {
  29723. s3 = peg$parsews();
  29724. if (s3 !== peg$FAILED) {
  29725. s4 = peg$parseunarySend();
  29726. if (s4 !== peg$FAILED) {
  29727. peg$savedPos = s0;
  29728. s1 = peg$c111(s2, s4);
  29729. s0 = s1;
  29730. } else {
  29731. peg$currPos = s0;
  29732. s0 = peg$FAILED;
  29733. }
  29734. } else {
  29735. peg$currPos = s0;
  29736. s0 = peg$FAILED;
  29737. }
  29738. } else {
  29739. peg$currPos = s0;
  29740. s0 = peg$FAILED;
  29741. }
  29742. } else {
  29743. peg$currPos = s0;
  29744. s0 = peg$FAILED;
  29745. }
  29746. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29747. return s0;
  29748. }
  29749. function peg$parsewsBinaryTail() {
  29750. var s0, s1, s2, s3;
  29751. var key = peg$currPos * 66 + 55,
  29752. cached = peg$resultsCache[key];
  29753. if (cached) {
  29754. peg$currPos = cached.nextPos;
  29755. return cached.result;
  29756. }
  29757. s0 = peg$currPos;
  29758. s1 = peg$parsewsUnaryTail();
  29759. if (s1 !== peg$FAILED) {
  29760. s2 = [];
  29761. s3 = peg$parsewsBinaryMessage();
  29762. while (s3 !== peg$FAILED) {
  29763. s2.push(s3);
  29764. s3 = peg$parsewsBinaryMessage();
  29765. }
  29766. if (s2 !== peg$FAILED) {
  29767. peg$savedPos = s0;
  29768. s1 = peg$c112(s1, s2);
  29769. s0 = s1;
  29770. } else {
  29771. peg$currPos = s0;
  29772. s0 = peg$FAILED;
  29773. }
  29774. } else {
  29775. peg$currPos = s0;
  29776. s0 = peg$FAILED;
  29777. }
  29778. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29779. return s0;
  29780. }
  29781. function peg$parsebinarySend() {
  29782. var s0, s1, s2;
  29783. var key = peg$currPos * 66 + 56,
  29784. cached = peg$resultsCache[key];
  29785. if (cached) {
  29786. peg$currPos = cached.nextPos;
  29787. return cached.result;
  29788. }
  29789. s0 = peg$currPos;
  29790. s1 = peg$parseoperand();
  29791. if (s1 !== peg$FAILED) {
  29792. s2 = peg$parsewsBinaryTail();
  29793. if (s2 !== peg$FAILED) {
  29794. peg$savedPos = s0;
  29795. s1 = peg$c110(s1, s2);
  29796. s0 = s1;
  29797. } else {
  29798. peg$currPos = s0;
  29799. s0 = peg$FAILED;
  29800. }
  29801. } else {
  29802. peg$currPos = s0;
  29803. s0 = peg$FAILED;
  29804. }
  29805. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29806. return s0;
  29807. }
  29808. function peg$parsewsKeywordMessage() {
  29809. var s0, s1, s2, s3, s4, s5, s6;
  29810. var key = peg$currPos * 66 + 57,
  29811. cached = peg$resultsCache[key];
  29812. if (cached) {
  29813. peg$currPos = cached.nextPos;
  29814. return cached.result;
  29815. }
  29816. s0 = peg$currPos;
  29817. s1 = [];
  29818. s2 = peg$currPos;
  29819. s3 = peg$parsews();
  29820. if (s3 !== peg$FAILED) {
  29821. s4 = peg$parsekeyword();
  29822. if (s4 !== peg$FAILED) {
  29823. s5 = peg$parsews();
  29824. if (s5 !== peg$FAILED) {
  29825. s6 = peg$parsebinarySend();
  29826. if (s6 !== peg$FAILED) {
  29827. peg$savedPos = s2;
  29828. s3 = peg$c75(s4, s6);
  29829. s2 = s3;
  29830. } else {
  29831. peg$currPos = s2;
  29832. s2 = peg$FAILED;
  29833. }
  29834. } else {
  29835. peg$currPos = s2;
  29836. s2 = peg$FAILED;
  29837. }
  29838. } else {
  29839. peg$currPos = s2;
  29840. s2 = peg$FAILED;
  29841. }
  29842. } else {
  29843. peg$currPos = s2;
  29844. s2 = peg$FAILED;
  29845. }
  29846. if (s2 !== peg$FAILED) {
  29847. while (s2 !== peg$FAILED) {
  29848. s1.push(s2);
  29849. s2 = peg$currPos;
  29850. s3 = peg$parsews();
  29851. if (s3 !== peg$FAILED) {
  29852. s4 = peg$parsekeyword();
  29853. if (s4 !== peg$FAILED) {
  29854. s5 = peg$parsews();
  29855. if (s5 !== peg$FAILED) {
  29856. s6 = peg$parsebinarySend();
  29857. if (s6 !== peg$FAILED) {
  29858. peg$savedPos = s2;
  29859. s3 = peg$c75(s4, s6);
  29860. s2 = s3;
  29861. } else {
  29862. peg$currPos = s2;
  29863. s2 = peg$FAILED;
  29864. }
  29865. } else {
  29866. peg$currPos = s2;
  29867. s2 = peg$FAILED;
  29868. }
  29869. } else {
  29870. peg$currPos = s2;
  29871. s2 = peg$FAILED;
  29872. }
  29873. } else {
  29874. peg$currPos = s2;
  29875. s2 = peg$FAILED;
  29876. }
  29877. }
  29878. } else {
  29879. s1 = peg$FAILED;
  29880. }
  29881. if (s1 !== peg$FAILED) {
  29882. peg$savedPos = s0;
  29883. s1 = peg$c113(s1);
  29884. }
  29885. s0 = s1;
  29886. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29887. return s0;
  29888. }
  29889. function peg$parsewsKeywordTail() {
  29890. var s0, s1, s2;
  29891. var key = peg$currPos * 66 + 58,
  29892. cached = peg$resultsCache[key];
  29893. if (cached) {
  29894. peg$currPos = cached.nextPos;
  29895. return cached.result;
  29896. }
  29897. s0 = peg$currPos;
  29898. s1 = peg$parsewsBinaryTail();
  29899. if (s1 !== peg$FAILED) {
  29900. s2 = peg$parsewsKeywordMessage();
  29901. if (s2 === peg$FAILED) {
  29902. s2 = null;
  29903. }
  29904. if (s2 !== peg$FAILED) {
  29905. peg$savedPos = s0;
  29906. s1 = peg$c114(s1, s2);
  29907. s0 = s1;
  29908. } else {
  29909. peg$currPos = s0;
  29910. s0 = peg$FAILED;
  29911. }
  29912. } else {
  29913. peg$currPos = s0;
  29914. s0 = peg$FAILED;
  29915. }
  29916. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29917. return s0;
  29918. }
  29919. function peg$parsekeywordSend() {
  29920. var s0, s1, s2;
  29921. var key = peg$currPos * 66 + 59,
  29922. cached = peg$resultsCache[key];
  29923. if (cached) {
  29924. peg$currPos = cached.nextPos;
  29925. return cached.result;
  29926. }
  29927. s0 = peg$currPos;
  29928. s1 = peg$parseoperand();
  29929. if (s1 !== peg$FAILED) {
  29930. s2 = peg$parsewsKeywordTail();
  29931. if (s2 !== peg$FAILED) {
  29932. peg$savedPos = s0;
  29933. s1 = peg$c110(s1, s2);
  29934. s0 = s1;
  29935. } else {
  29936. peg$currPos = s0;
  29937. s0 = peg$FAILED;
  29938. }
  29939. } else {
  29940. peg$currPos = s0;
  29941. s0 = peg$FAILED;
  29942. }
  29943. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29944. return s0;
  29945. }
  29946. function peg$parsewsMessage() {
  29947. var s0;
  29948. var key = peg$currPos * 66 + 60,
  29949. cached = peg$resultsCache[key];
  29950. if (cached) {
  29951. peg$currPos = cached.nextPos;
  29952. return cached.result;
  29953. }
  29954. s0 = peg$parsewsBinaryMessage();
  29955. if (s0 === peg$FAILED) {
  29956. s0 = peg$parsewsUnaryMessage();
  29957. if (s0 === peg$FAILED) {
  29958. s0 = peg$parsewsKeywordMessage();
  29959. }
  29960. }
  29961. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29962. return s0;
  29963. }
  29964. function peg$parsecascade() {
  29965. var s0, s1, s2, s3, s4, s5, s6, s7, s8;
  29966. var key = peg$currPos * 66 + 61,
  29967. cached = peg$resultsCache[key];
  29968. if (cached) {
  29969. peg$currPos = cached.nextPos;
  29970. return cached.result;
  29971. }
  29972. s0 = peg$currPos;
  29973. s1 = peg$parseoperand();
  29974. if (s1 !== peg$FAILED) {
  29975. s2 = peg$parsewsKeywordTail();
  29976. if (s2 !== peg$FAILED) {
  29977. peg$savedPos = peg$currPos;
  29978. s3 = peg$c115(s1, s2);
  29979. if (s3) {
  29980. s3 = void 0;
  29981. } else {
  29982. s3 = peg$FAILED;
  29983. }
  29984. if (s3 !== peg$FAILED) {
  29985. s4 = [];
  29986. s5 = peg$currPos;
  29987. s6 = peg$parsews();
  29988. if (s6 !== peg$FAILED) {
  29989. if (input.charCodeAt(peg$currPos) === 59) {
  29990. s7 = peg$c116;
  29991. peg$currPos++;
  29992. } else {
  29993. s7 = peg$FAILED;
  29994. if (peg$silentFails === 0) { peg$fail(peg$c117); }
  29995. }
  29996. if (s7 !== peg$FAILED) {
  29997. s8 = peg$parsewsMessage();
  29998. if (s8 !== peg$FAILED) {
  29999. peg$savedPos = s5;
  30000. s6 = peg$c118(s1, s2, s8);
  30001. s5 = s6;
  30002. } else {
  30003. peg$currPos = s5;
  30004. s5 = peg$FAILED;
  30005. }
  30006. } else {
  30007. peg$currPos = s5;
  30008. s5 = peg$FAILED;
  30009. }
  30010. } else {
  30011. peg$currPos = s5;
  30012. s5 = peg$FAILED;
  30013. }
  30014. if (s5 !== peg$FAILED) {
  30015. while (s5 !== peg$FAILED) {
  30016. s4.push(s5);
  30017. s5 = peg$currPos;
  30018. s6 = peg$parsews();
  30019. if (s6 !== peg$FAILED) {
  30020. if (input.charCodeAt(peg$currPos) === 59) {
  30021. s7 = peg$c116;
  30022. peg$currPos++;
  30023. } else {
  30024. s7 = peg$FAILED;
  30025. if (peg$silentFails === 0) { peg$fail(peg$c117); }
  30026. }
  30027. if (s7 !== peg$FAILED) {
  30028. s8 = peg$parsewsMessage();
  30029. if (s8 !== peg$FAILED) {
  30030. peg$savedPos = s5;
  30031. s6 = peg$c118(s1, s2, s8);
  30032. s5 = s6;
  30033. } else {
  30034. peg$currPos = s5;
  30035. s5 = peg$FAILED;
  30036. }
  30037. } else {
  30038. peg$currPos = s5;
  30039. s5 = peg$FAILED;
  30040. }
  30041. } else {
  30042. peg$currPos = s5;
  30043. s5 = peg$FAILED;
  30044. }
  30045. }
  30046. } else {
  30047. s4 = peg$FAILED;
  30048. }
  30049. if (s4 !== peg$FAILED) {
  30050. peg$savedPos = s0;
  30051. s1 = peg$c119(s1, s2, s4);
  30052. s0 = s1;
  30053. } else {
  30054. peg$currPos = s0;
  30055. s0 = peg$FAILED;
  30056. }
  30057. } else {
  30058. peg$currPos = s0;
  30059. s0 = peg$FAILED;
  30060. }
  30061. } else {
  30062. peg$currPos = s0;
  30063. s0 = peg$FAILED;
  30064. }
  30065. } else {
  30066. peg$currPos = s0;
  30067. s0 = peg$FAILED;
  30068. }
  30069. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30070. return s0;
  30071. }
  30072. function peg$parsemethod() {
  30073. var s0, s1, s2;
  30074. var key = peg$currPos * 66 + 62,
  30075. cached = peg$resultsCache[key];
  30076. if (cached) {
  30077. peg$currPos = cached.nextPos;
  30078. return cached.result;
  30079. }
  30080. s0 = peg$currPos;
  30081. s1 = peg$parsewsKeywordPattern();
  30082. if (s1 === peg$FAILED) {
  30083. s1 = peg$parsewsBinaryPattern();
  30084. if (s1 === peg$FAILED) {
  30085. s1 = peg$parsewsUnaryPattern();
  30086. }
  30087. }
  30088. if (s1 !== peg$FAILED) {
  30089. s2 = peg$parsewsSequenceWs();
  30090. if (s2 !== peg$FAILED) {
  30091. peg$savedPos = s0;
  30092. s1 = peg$c120(s1, s2);
  30093. s0 = s1;
  30094. } else {
  30095. peg$currPos = s0;
  30096. s0 = peg$FAILED;
  30097. }
  30098. } else {
  30099. peg$currPos = s0;
  30100. s0 = peg$FAILED;
  30101. }
  30102. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30103. return s0;
  30104. }
  30105. function peg$parseassociationSend() {
  30106. var s0, s1, s2, s3;
  30107. var key = peg$currPos * 66 + 63,
  30108. cached = peg$resultsCache[key];
  30109. if (cached) {
  30110. peg$currPos = cached.nextPos;
  30111. return cached.result;
  30112. }
  30113. s0 = peg$currPos;
  30114. s1 = peg$parseoperand();
  30115. if (s1 !== peg$FAILED) {
  30116. s2 = peg$parsewsBinaryTail();
  30117. if (s2 !== peg$FAILED) {
  30118. peg$savedPos = peg$currPos;
  30119. s3 = peg$c121(s1, s2);
  30120. if (s3) {
  30121. s3 = void 0;
  30122. } else {
  30123. s3 = peg$FAILED;
  30124. }
  30125. if (s3 !== peg$FAILED) {
  30126. peg$savedPos = s0;
  30127. s1 = peg$c122(s1, s2);
  30128. s0 = s1;
  30129. } else {
  30130. peg$currPos = s0;
  30131. s0 = peg$FAILED;
  30132. }
  30133. } else {
  30134. peg$currPos = s0;
  30135. s0 = peg$FAILED;
  30136. }
  30137. } else {
  30138. peg$currPos = s0;
  30139. s0 = peg$FAILED;
  30140. }
  30141. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30142. return s0;
  30143. }
  30144. function peg$parsewsAssociationsRest() {
  30145. var s0, s1, s2;
  30146. var key = peg$currPos * 66 + 64,
  30147. cached = peg$resultsCache[key];
  30148. if (cached) {
  30149. peg$currPos = cached.nextPos;
  30150. return cached.result;
  30151. }
  30152. s0 = peg$currPos;
  30153. s1 = peg$parsesomeDotsWs();
  30154. if (s1 !== peg$FAILED) {
  30155. s2 = peg$parseassociationSend();
  30156. if (s2 !== peg$FAILED) {
  30157. peg$savedPos = s0;
  30158. s1 = peg$c79(s2);
  30159. s0 = s1;
  30160. } else {
  30161. peg$currPos = s0;
  30162. s0 = peg$FAILED;
  30163. }
  30164. } else {
  30165. peg$currPos = s0;
  30166. s0 = peg$FAILED;
  30167. }
  30168. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30169. return s0;
  30170. }
  30171. function peg$parsewsAssociations() {
  30172. var s0, s1, s2, s3, s4;
  30173. var key = peg$currPos * 66 + 65,
  30174. cached = peg$resultsCache[key];
  30175. if (cached) {
  30176. peg$currPos = cached.nextPos;
  30177. return cached.result;
  30178. }
  30179. s0 = peg$currPos;
  30180. s1 = peg$parsemaybeDotsWs();
  30181. if (s1 !== peg$FAILED) {
  30182. s2 = peg$parseassociationSend();
  30183. if (s2 !== peg$FAILED) {
  30184. s3 = [];
  30185. s4 = peg$parsewsAssociationsRest();
  30186. while (s4 !== peg$FAILED) {
  30187. s3.push(s4);
  30188. s4 = peg$parsewsAssociationsRest();
  30189. }
  30190. if (s3 !== peg$FAILED) {
  30191. peg$savedPos = s0;
  30192. s1 = peg$c123(s2, s3);
  30193. s0 = s1;
  30194. } else {
  30195. peg$currPos = s0;
  30196. s0 = peg$FAILED;
  30197. }
  30198. } else {
  30199. peg$currPos = s0;
  30200. s0 = peg$FAILED;
  30201. }
  30202. } else {
  30203. peg$currPos = s0;
  30204. s0 = peg$FAILED;
  30205. }
  30206. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30207. return s0;
  30208. }
  30209. peg$result = peg$startRuleFunction();
  30210. if (peg$result !== peg$FAILED && peg$currPos === input.length) {
  30211. return peg$result;
  30212. } else {
  30213. if (peg$result !== peg$FAILED && peg$currPos < input.length) {
  30214. peg$fail({ type: "end", description: "end of input" });
  30215. }
  30216. throw peg$buildException(
  30217. null,
  30218. peg$maxFailExpected,
  30219. peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
  30220. peg$maxFailPos < input.length
  30221. ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
  30222. : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
  30223. );
  30224. }
  30225. }
  30226. return {
  30227. SyntaxError: peg$SyntaxError,
  30228. parse: peg$parse
  30229. };
  30230. })();
  30231. });
  30232. define('amber_core/Platform-ImportExport',["amber/boot", "amber_core/Kernel-Classes", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Objects"], function($boot){"use strict";
  30233. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  30234. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  30235. var $pkg = $core.addPackage("Platform-ImportExport");
  30236. $pkg.innerEval = function (expr) { return eval(expr); };
  30237. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  30238. $core.addClass("AbstractExporter", $globals.Object, [], "Platform-ImportExport");
  30239. $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.";
  30240. $core.addMethod(
  30241. $core.method({
  30242. selector: "exportPackage:on:",
  30243. protocol: "output",
  30244. fn: function (aPackage,aStream){
  30245. var self=this,$self=this;
  30246. return $core.withContext(function($ctx1) {
  30247. $self._subclassResponsibility();
  30248. return self;
  30249. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.AbstractExporter)});
  30250. },
  30251. args: ["aPackage", "aStream"],
  30252. source: "exportPackage: aPackage on: aStream\x0a\x09self subclassResponsibility",
  30253. referencedClasses: [],
  30254. messageSends: ["subclassResponsibility"]
  30255. }),
  30256. $globals.AbstractExporter);
  30257. $core.addMethod(
  30258. $core.method({
  30259. selector: "extensionMethodsOfPackage:",
  30260. protocol: "accessing",
  30261. fn: function (aPackage){
  30262. var self=this,$self=this;
  30263. var result;
  30264. return $core.withContext(function($ctx1) {
  30265. result=$recv($globals.OrderedCollection)._new();
  30266. $recv($self._extensionProtocolsOfPackage_(aPackage))._do_((function(each){
  30267. return $core.withContext(function($ctx2) {
  30268. return $recv(result)._addAll_($recv(each)._ownMethods());
  30269. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30270. }));
  30271. return result;
  30272. }, function($ctx1) {$ctx1.fill(self,"extensionMethodsOfPackage:",{aPackage:aPackage,result:result},$globals.AbstractExporter)});
  30273. },
  30274. args: ["aPackage"],
  30275. 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",
  30276. referencedClasses: ["OrderedCollection"],
  30277. messageSends: ["new", "do:", "extensionProtocolsOfPackage:", "addAll:", "ownMethods"]
  30278. }),
  30279. $globals.AbstractExporter);
  30280. $core.addMethod(
  30281. $core.method({
  30282. selector: "extensionProtocolsOfPackage:",
  30283. protocol: "accessing",
  30284. fn: function (aPackage){
  30285. var self=this,$self=this;
  30286. var extensionName,result;
  30287. return $core.withContext(function($ctx1) {
  30288. var $1,$2,$3;
  30289. $1=$recv(aPackage)._name();
  30290. $ctx1.sendIdx["name"]=1;
  30291. extensionName="*".__comma($1);
  30292. result=$recv($globals.OrderedCollection)._new();
  30293. $recv($recv($recv($recv($globals.Smalltalk)._classes())._asArray())._sorted_((function(a,b){
  30294. return $core.withContext(function($ctx2) {
  30295. $2=$recv(a)._name();
  30296. $ctx2.sendIdx["name"]=2;
  30297. return $recv($2).__lt($recv(b)._name());
  30298. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  30299. })))._do_((function(each){
  30300. return $core.withContext(function($ctx2) {
  30301. return $recv($recv([each,$recv(each)._theMetaClass()])._copyWithout_(nil))._do_((function(behavior){
  30302. return $core.withContext(function($ctx3) {
  30303. $3=$recv($recv(behavior)._protocols())._includes_(extensionName);
  30304. if($core.assert($3)){
  30305. return $recv(result)._add_($recv($globals.ExportMethodProtocol)._name_theClass_(extensionName,behavior));
  30306. }
  30307. }, function($ctx3) {$ctx3.fillBlock({behavior:behavior},$ctx2,3)});
  30308. }));
  30309. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  30310. }));
  30311. $ctx1.sendIdx["do:"]=1;
  30312. return result;
  30313. }, function($ctx1) {$ctx1.fill(self,"extensionProtocolsOfPackage:",{aPackage:aPackage,extensionName:extensionName,result:result},$globals.AbstractExporter)});
  30314. },
  30315. args: ["aPackage"],
  30316. source: "extensionProtocolsOfPackage: aPackage\x0a\x09| extensionName result |\x0a\x09\x0a\x09extensionName := '*', aPackage name.\x0a\x09result := OrderedCollection new.\x0a\x09\x0a\x09\x22The classes must be loaded since it is extensions only.\x0a\x09Therefore topological sorting (dependency resolution) does not matter here.\x0a\x09Not sorting topologically improves the speed by a number of magnitude.\x0a\x09\x0a\x09Not to shuffle diffs, classes are sorted by their name.\x22\x0a\x09\x0a\x09(Smalltalk classes asArray sorted: [ :a :b | a name < b name ]) do: [ :each |\x0a\x09\x09({each. each theMetaClass} copyWithout: nil) do: [ :behavior |\x0a\x09\x09\x09(behavior protocols includes: extensionName) ifTrue: [\x0a\x09\x09\x09\x09result add: (ExportMethodProtocol name: extensionName theClass: behavior) ] ] ].\x0a\x0a\x09^ result",
  30317. referencedClasses: ["OrderedCollection", "Smalltalk", "ExportMethodProtocol"],
  30318. messageSends: [",", "name", "new", "do:", "sorted:", "asArray", "classes", "<", "copyWithout:", "theMetaClass", "ifTrue:", "includes:", "protocols", "add:", "name:theClass:"]
  30319. }),
  30320. $globals.AbstractExporter);
  30321. $core.addClass("ChunkExporter", $globals.AbstractExporter, [], "Platform-ImportExport");
  30322. $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.";
  30323. $core.addMethod(
  30324. $core.method({
  30325. selector: "chunkEscape:",
  30326. protocol: "convenience",
  30327. fn: function (aString){
  30328. var self=this,$self=this;
  30329. return $core.withContext(function($ctx1) {
  30330. return $recv($recv(aString)._replace_with_("!","!!"))._trimBoth();
  30331. }, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString},$globals.ChunkExporter)});
  30332. },
  30333. args: ["aString"],
  30334. source: "chunkEscape: aString\x0a\x09\x22Replace all occurrences of ! with !! and trim at both ends.\x22\x0a\x0a\x09^ (aString replace: '!' with: '!!') trimBoth",
  30335. referencedClasses: [],
  30336. messageSends: ["trimBoth", "replace:with:"]
  30337. }),
  30338. $globals.ChunkExporter);
  30339. $core.addMethod(
  30340. $core.method({
  30341. selector: "exportBehavior:on:",
  30342. protocol: "output",
  30343. fn: function (aBehavior,aStream){
  30344. var self=this,$self=this;
  30345. return $core.withContext(function($ctx1) {
  30346. $recv(aBehavior)._exportBehaviorDefinitionTo_using_(aStream,self);
  30347. $self._exportProtocols_on_($self._ownMethodProtocolsOfClass_(aBehavior),aStream);
  30348. return self;
  30349. }, function($ctx1) {$ctx1.fill(self,"exportBehavior:on:",{aBehavior:aBehavior,aStream:aStream},$globals.ChunkExporter)});
  30350. },
  30351. args: ["aBehavior", "aStream"],
  30352. source: "exportBehavior: aBehavior on: aStream\x0a\x09aBehavior exportBehaviorDefinitionTo: aStream using: self.\x0a\x09self \x0a\x09\x09exportProtocols: (self ownMethodProtocolsOfClass: aBehavior)\x0a\x09\x09on: aStream",
  30353. referencedClasses: [],
  30354. messageSends: ["exportBehaviorDefinitionTo:using:", "exportProtocols:on:", "ownMethodProtocolsOfClass:"]
  30355. }),
  30356. $globals.ChunkExporter);
  30357. $core.addMethod(
  30358. $core.method({
  30359. selector: "exportCategoryEpilogueOf:on:",
  30360. protocol: "output",
  30361. fn: function (aCategory,aStream){
  30362. var self=this,$self=this;
  30363. return $core.withContext(function($ctx1) {
  30364. $recv(aStream)._write_(" !");
  30365. $recv(aStream)._lf();
  30366. $ctx1.sendIdx["lf"]=1;
  30367. $recv(aStream)._lf();
  30368. return self;
  30369. }, function($ctx1) {$ctx1.fill(self,"exportCategoryEpilogueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  30370. },
  30371. args: ["aCategory", "aStream"],
  30372. source: "exportCategoryEpilogueOf: aCategory on: aStream\x0a\x09aStream write: ' !'; lf; lf",
  30373. referencedClasses: [],
  30374. messageSends: ["write:", "lf"]
  30375. }),
  30376. $globals.ChunkExporter);
  30377. $core.addMethod(
  30378. $core.method({
  30379. selector: "exportCategoryPrologueOf:on:",
  30380. protocol: "output",
  30381. fn: function (aCategory,aStream){
  30382. var self=this,$self=this;
  30383. return $core.withContext(function($ctx1) {
  30384. $recv(aStream)._write_("!");
  30385. $ctx1.sendIdx["write:"]=1;
  30386. $recv(aStream)._print_($recv(aCategory)._theClass());
  30387. $ctx1.sendIdx["print:"]=1;
  30388. $recv(aStream)._write_(" methodsFor: ");
  30389. $ctx1.sendIdx["write:"]=2;
  30390. $recv(aStream)._print_(aCategory);
  30391. $recv(aStream)._write_("!");
  30392. return self;
  30393. }, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  30394. },
  30395. args: ["aCategory", "aStream"],
  30396. 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: '!'",
  30397. referencedClasses: [],
  30398. messageSends: ["write:", "print:", "theClass"]
  30399. }),
  30400. $globals.ChunkExporter);
  30401. $core.addMethod(
  30402. $core.method({
  30403. selector: "exportDefinitionOf:on:",
  30404. protocol: "output",
  30405. fn: function (aClass,aStream){
  30406. var self=this,$self=this;
  30407. return $core.withContext(function($ctx1) {
  30408. var $1,$2,$3,$4;
  30409. $recv(aStream)._print_($recv(aClass)._superclass());
  30410. $ctx1.sendIdx["print:"]=1;
  30411. $recv(aStream)._write_(" subclass: ");
  30412. $ctx1.sendIdx["write:"]=1;
  30413. $recv(aStream)._printSymbol_($recv(aClass)._name());
  30414. $1=$recv(aStream)._lf();
  30415. $ctx1.sendIdx["lf"]=1;
  30416. $recv(aStream)._tab();
  30417. $ctx1.sendIdx["tab"]=1;
  30418. $recv(aStream)._write_("instanceVariableNames: ");
  30419. $ctx1.sendIdx["write:"]=2;
  30420. $recv(aStream)._print_(" "._join_($recv(aClass)._instanceVariableNames()));
  30421. $ctx1.sendIdx["print:"]=2;
  30422. $recv(aStream)._lf();
  30423. $ctx1.sendIdx["lf"]=2;
  30424. $recv(aStream)._tab();
  30425. $recv(aStream)._write_("package: ");
  30426. $ctx1.sendIdx["write:"]=3;
  30427. $recv(aStream)._print_($recv(aClass)._category());
  30428. $ctx1.sendIdx["print:"]=3;
  30429. $recv(aStream)._write_("!");
  30430. $ctx1.sendIdx["write:"]=4;
  30431. $2=$recv(aStream)._lf();
  30432. $ctx1.sendIdx["lf"]=3;
  30433. $3=$recv(aClass)._comment();
  30434. $ctx1.sendIdx["comment"]=1;
  30435. $recv($3)._ifNotEmpty_((function(){
  30436. return $core.withContext(function($ctx2) {
  30437. $recv(aStream)._write_("!");
  30438. $ctx2.sendIdx["write:"]=5;
  30439. $recv(aStream)._print_(aClass);
  30440. $recv(aStream)._write_(" commentStamp!");
  30441. $ctx2.sendIdx["write:"]=6;
  30442. $recv(aStream)._lf();
  30443. $ctx2.sendIdx["lf"]=4;
  30444. $recv(aStream)._write_([$self._chunkEscape_($recv(aClass)._comment()),"!"]);
  30445. $4=$recv(aStream)._lf();
  30446. $ctx2.sendIdx["lf"]=5;
  30447. return $4;
  30448. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30449. }));
  30450. $recv(aStream)._lf();
  30451. return self;
  30452. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  30453. },
  30454. args: ["aClass", "aStream"],
  30455. source: "exportDefinitionOf: aClass on: aStream\x0a\x09\x22Chunk format.\x22\x0a\x0a\x09aStream\x0a\x09\x09print: aClass superclass;\x0a\x09\x09write: ' subclass: ';\x0a\x09\x09printSymbol: aClass name;\x0a\x09\x09lf.\x0a\x09\x22aClass traitComposition\x0a\x09\x09ifNotEmpty: [ aStream tab; write: {'uses: '. aClass traitCompositionDefinition}; lf ].\x22\x0a\x09aStream\x0a\x09\x09tab;\x0a\x09\x09write: 'instanceVariableNames: ';\x0a\x09\x09print: (' ' join: aClass instanceVariableNames);\x0a\x09\x09lf;\x0a\x09\x09tab;\x0a\x09\x09write: 'package: ';\x0a\x09\x09print: aClass category;\x0a\x09\x09write: '!';\x0a\x09\x09lf.\x0a\x09aClass comment ifNotEmpty: [ aStream\x0a\x09\x09write: '!'; print: aClass; write: ' commentStamp!'; lf;\x0a\x09\x09write: { self chunkEscape: aClass comment. '!' }; lf ].\x0a\x09aStream lf",
  30456. referencedClasses: [],
  30457. messageSends: ["print:", "superclass", "write:", "printSymbol:", "name", "lf", "tab", "join:", "instanceVariableNames", "category", "ifNotEmpty:", "comment", "chunkEscape:"]
  30458. }),
  30459. $globals.ChunkExporter);
  30460. $core.addMethod(
  30461. $core.method({
  30462. selector: "exportMetaDefinitionOf:on:",
  30463. protocol: "output",
  30464. fn: function (aClass,aStream){
  30465. var self=this,$self=this;
  30466. var classIvars,classTraitComposition;
  30467. return $core.withContext(function($ctx1) {
  30468. var $1,$2;
  30469. $1=$recv(aClass)._class();
  30470. $ctx1.sendIdx["class"]=1;
  30471. classIvars=$recv($1)._instanceVariableNames();
  30472. classTraitComposition=$recv($recv(aClass)._class())._traitComposition();
  30473. $2=$recv(classIvars)._notEmpty();
  30474. if($core.assert($2)){
  30475. $recv(aStream)._print_($recv(aClass)._theMetaClass());
  30476. $ctx1.sendIdx["print:"]=1;
  30477. $recv(aStream)._space();
  30478. $recv(aStream)._write_("instanceVariableNames: ");
  30479. $ctx1.sendIdx["write:"]=1;
  30480. $recv(aStream)._print_(" "._join_(classIvars));
  30481. $recv(aStream)._write_("!");
  30482. $recv(aStream)._lf();
  30483. $ctx1.sendIdx["lf"]=1;
  30484. $recv(aStream)._lf();
  30485. }
  30486. return self;
  30487. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream,classIvars:classIvars,classTraitComposition:classTraitComposition},$globals.ChunkExporter)});
  30488. },
  30489. args: ["aClass", "aStream"],
  30490. source: "exportMetaDefinitionOf: aClass on: aStream\x0a\x0a\x09| classIvars classTraitComposition |\x0a\x09classIvars := aClass class instanceVariableNames.\x0a\x09classTraitComposition := aClass class traitComposition.\x0a\x0a\x09(classIvars notEmpty \x22or: [classTraitComposition notEmpty]\x22) ifTrue: [\x0a\x09\x09aStream\x0a\x09\x09\x09print: aClass theMetaClass.\x0a\x09\x09aStream space. \x22classTraitComposition\x0a\x09\x09\x09ifEmpty: [ aStream space ]\x0a\x09\x09\x09ifNotEmpty: [ aStream lf; tab; write: {'uses: '. aClass class traitCompositionDefinition}; lf; tab ].\x22\x0a\x09\x09aStream\x0a\x09\x09\x09write: 'instanceVariableNames: ';\x0a\x09\x09\x09print: (' ' join: classIvars);\x0a\x09\x09\x09write: '!'; lf; lf ]",
  30491. referencedClasses: [],
  30492. messageSends: ["instanceVariableNames", "class", "traitComposition", "ifTrue:", "notEmpty", "print:", "theMetaClass", "space", "write:", "join:", "lf"]
  30493. }),
  30494. $globals.ChunkExporter);
  30495. $core.addMethod(
  30496. $core.method({
  30497. selector: "exportMethod:on:",
  30498. protocol: "output",
  30499. fn: function (aMethod,aStream){
  30500. var self=this,$self=this;
  30501. return $core.withContext(function($ctx1) {
  30502. $recv(aStream)._lf();
  30503. $ctx1.sendIdx["lf"]=1;
  30504. $recv(aStream)._lf();
  30505. $ctx1.sendIdx["lf"]=2;
  30506. $recv(aStream)._write_($self._chunkEscape_($recv(aMethod)._source()));
  30507. $ctx1.sendIdx["write:"]=1;
  30508. $recv(aStream)._lf();
  30509. $recv(aStream)._write_("!");
  30510. return self;
  30511. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.ChunkExporter)});
  30512. },
  30513. args: ["aMethod", "aStream"],
  30514. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09lf; lf; write: (self chunkEscape: aMethod source); lf;\x0a\x09\x09write: '!'",
  30515. referencedClasses: [],
  30516. messageSends: ["lf", "write:", "chunkEscape:", "source"]
  30517. }),
  30518. $globals.ChunkExporter);
  30519. $core.addMethod(
  30520. $core.method({
  30521. selector: "exportPackage:on:",
  30522. protocol: "output",
  30523. fn: function (aPackage,aStream){
  30524. var self=this,$self=this;
  30525. return $core.withContext(function($ctx1) {
  30526. var $1,$receiver;
  30527. $self._exportPackageDefinitionOf_on_(aPackage,aStream);
  30528. $self._exportPackageImportsOf_on_(aPackage,aStream);
  30529. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  30530. return $core.withContext(function($ctx2) {
  30531. $self._exportBehavior_on_(each,aStream);
  30532. $ctx2.sendIdx["exportBehavior:on:"]=1;
  30533. $1=$recv(each)._theMetaClass();
  30534. if(($receiver = $1) == null || $receiver.a$nil){
  30535. return $1;
  30536. } else {
  30537. var meta;
  30538. meta=$receiver;
  30539. return $self._exportBehavior_on_(meta,aStream);
  30540. }
  30541. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30542. }));
  30543. $self._exportPackageTraitCompositionsOf_on_(aPackage,aStream);
  30544. $self._exportProtocols_on_($self._extensionProtocolsOfPackage_(aPackage),aStream);
  30545. return self;
  30546. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30547. },
  30548. args: ["aPackage", "aStream"],
  30549. source: "exportPackage: aPackage on: aStream\x0a\x0a\x09self\x0a\x09\x09exportPackageDefinitionOf: aPackage on: aStream;\x0a\x09\x09exportPackageImportsOf: aPackage on: aStream.\x0a\x09\x0a\x09aPackage sortedClasses do: [ :each |\x0a\x09\x09self exportBehavior: each on: aStream.\x0a\x09\x09each theMetaClass ifNotNil: [ :meta | self exportBehavior: meta on: aStream ] ].\x0a\x09\x0a\x09self exportPackageTraitCompositionsOf: aPackage on: aStream.\x0a\x0a\x09self \x0a\x09\x09exportProtocols: (self extensionProtocolsOfPackage: aPackage)\x0a\x09\x09on: aStream",
  30550. referencedClasses: [],
  30551. messageSends: ["exportPackageDefinitionOf:on:", "exportPackageImportsOf:on:", "do:", "sortedClasses", "exportBehavior:on:", "ifNotNil:", "theMetaClass", "exportPackageTraitCompositionsOf:on:", "exportProtocols:on:", "extensionProtocolsOfPackage:"]
  30552. }),
  30553. $globals.ChunkExporter);
  30554. $core.addMethod(
  30555. $core.method({
  30556. selector: "exportPackageDefinitionOf:on:",
  30557. protocol: "output",
  30558. fn: function (aPackage,aStream){
  30559. var self=this,$self=this;
  30560. return $core.withContext(function($ctx1) {
  30561. $recv(aStream)._write_("Smalltalk createPackage: ");
  30562. $ctx1.sendIdx["write:"]=1;
  30563. $recv(aStream)._print_($recv(aPackage)._name());
  30564. $recv(aStream)._write_("!");
  30565. $recv(aStream)._lf();
  30566. return self;
  30567. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30568. },
  30569. args: ["aPackage", "aStream"],
  30570. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: 'Smalltalk createPackage: ';\x0a\x09\x09print: aPackage name;\x0a\x09\x09write: '!';\x0a\x09\x09lf",
  30571. referencedClasses: [],
  30572. messageSends: ["write:", "print:", "name", "lf"]
  30573. }),
  30574. $globals.ChunkExporter);
  30575. $core.addMethod(
  30576. $core.method({
  30577. selector: "exportPackageImportsOf:on:",
  30578. protocol: "output",
  30579. fn: function (aPackage,aStream){
  30580. var self=this,$self=this;
  30581. return $core.withContext(function($ctx1) {
  30582. var $1;
  30583. $recv($recv(aPackage)._imports())._ifNotEmpty_((function(imports){
  30584. return $core.withContext(function($ctx2) {
  30585. $recv(aStream)._write_("(Smalltalk packageAt: ");
  30586. $ctx2.sendIdx["write:"]=1;
  30587. $1=$recv(aPackage)._name();
  30588. $ctx2.sendIdx["name"]=1;
  30589. $recv(aStream)._print_($1);
  30590. $ctx2.sendIdx["print:"]=1;
  30591. $recv(aStream)._write_(" ifAbsent: [ self error: ");
  30592. $ctx2.sendIdx["write:"]=2;
  30593. $recv(aStream)._print_("Package not created: ".__comma($recv(aPackage)._name()));
  30594. $recv(aStream)._write_([" ]) imports: ",$self._chunkEscape_($recv(aPackage)._importsDefinition()),"!"]);
  30595. return $recv(aStream)._lf();
  30596. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  30597. }));
  30598. return self;
  30599. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30600. },
  30601. args: ["aPackage", "aStream"],
  30602. 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 ]",
  30603. referencedClasses: [],
  30604. messageSends: ["ifNotEmpty:", "imports", "write:", "print:", "name", ",", "chunkEscape:", "importsDefinition", "lf"]
  30605. }),
  30606. $globals.ChunkExporter);
  30607. $core.addMethod(
  30608. $core.method({
  30609. selector: "exportPackageTraitCompositionsOf:on:",
  30610. protocol: "output",
  30611. fn: function (aPackage,aStream){
  30612. var self=this,$self=this;
  30613. return $core.withContext(function($ctx1) {
  30614. $recv($recv(aPackage)._traitCompositions())._ifNotEmpty_((function(traitCompositions){
  30615. return $core.withContext(function($ctx2) {
  30616. $recv(traitCompositions)._keysAndValuesDo_((function(key,value){
  30617. return $core.withContext(function($ctx3) {
  30618. return $self._exportTraitComposition_of_on_(value,key,aStream);
  30619. }, function($ctx3) {$ctx3.fillBlock({key:key,value:value},$ctx2,2)});
  30620. }));
  30621. $recv(aStream)._write_("! !");
  30622. $recv(aStream)._lf();
  30623. $ctx2.sendIdx["lf"]=1;
  30624. return $recv(aStream)._lf();
  30625. }, function($ctx2) {$ctx2.fillBlock({traitCompositions:traitCompositions},$ctx1,1)});
  30626. }));
  30627. return self;
  30628. }, function($ctx1) {$ctx1.fill(self,"exportPackageTraitCompositionsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30629. },
  30630. args: ["aPackage", "aStream"],
  30631. 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 ]",
  30632. referencedClasses: [],
  30633. messageSends: ["ifNotEmpty:", "traitCompositions", "keysAndValuesDo:", "exportTraitComposition:of:on:", "write:", "lf"]
  30634. }),
  30635. $globals.ChunkExporter);
  30636. $core.addMethod(
  30637. $core.method({
  30638. selector: "exportProtocol:on:",
  30639. protocol: "output",
  30640. fn: function (aProtocol,aStream){
  30641. var self=this,$self=this;
  30642. return $core.withContext(function($ctx1) {
  30643. $recv($recv(aProtocol)._ownMethods())._ifNotEmpty_((function(methods){
  30644. return $core.withContext(function($ctx2) {
  30645. $self._exportProtocolPrologueOf_on_(aProtocol,aStream);
  30646. $recv(methods)._do_((function(method){
  30647. return $core.withContext(function($ctx3) {
  30648. return $self._exportMethod_on_(method,aStream);
  30649. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,2)});
  30650. }));
  30651. return $self._exportProtocolEpilogueOf_on_(aProtocol,aStream);
  30652. }, function($ctx2) {$ctx2.fillBlock({methods:methods},$ctx1,1)});
  30653. }));
  30654. return self;
  30655. }, function($ctx1) {$ctx1.fill(self,"exportProtocol:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  30656. },
  30657. args: ["aProtocol", "aStream"],
  30658. 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 ]",
  30659. referencedClasses: [],
  30660. messageSends: ["ifNotEmpty:", "ownMethods", "exportProtocolPrologueOf:on:", "do:", "exportMethod:on:", "exportProtocolEpilogueOf:on:"]
  30661. }),
  30662. $globals.ChunkExporter);
  30663. $core.addMethod(
  30664. $core.method({
  30665. selector: "exportProtocolEpilogueOf:on:",
  30666. protocol: "output",
  30667. fn: function (aProtocol,aStream){
  30668. var self=this,$self=this;
  30669. return $core.withContext(function($ctx1) {
  30670. $recv(aStream)._write_(" !");
  30671. $recv(aStream)._lf();
  30672. $ctx1.sendIdx["lf"]=1;
  30673. $recv(aStream)._lf();
  30674. return self;
  30675. }, function($ctx1) {$ctx1.fill(self,"exportProtocolEpilogueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  30676. },
  30677. args: ["aProtocol", "aStream"],
  30678. source: "exportProtocolEpilogueOf: aProtocol on: aStream\x0a\x09aStream write: ' !'; lf; lf",
  30679. referencedClasses: [],
  30680. messageSends: ["write:", "lf"]
  30681. }),
  30682. $globals.ChunkExporter);
  30683. $core.addMethod(
  30684. $core.method({
  30685. selector: "exportProtocolPrologueOf:on:",
  30686. protocol: "output",
  30687. fn: function (aProtocol,aStream){
  30688. var self=this,$self=this;
  30689. return $core.withContext(function($ctx1) {
  30690. $recv(aStream)._write_("!");
  30691. $ctx1.sendIdx["write:"]=1;
  30692. $recv(aStream)._print_($recv(aProtocol)._theClass());
  30693. $ctx1.sendIdx["print:"]=1;
  30694. $recv(aStream)._write_(" methodsFor: ");
  30695. $ctx1.sendIdx["write:"]=2;
  30696. $recv(aStream)._print_($recv(aProtocol)._name());
  30697. $recv(aStream)._write_("!");
  30698. return self;
  30699. }, function($ctx1) {$ctx1.fill(self,"exportProtocolPrologueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  30700. },
  30701. args: ["aProtocol", "aStream"],
  30702. 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: '!'",
  30703. referencedClasses: [],
  30704. messageSends: ["write:", "print:", "theClass", "name"]
  30705. }),
  30706. $globals.ChunkExporter);
  30707. $core.addMethod(
  30708. $core.method({
  30709. selector: "exportProtocols:on:",
  30710. protocol: "output",
  30711. fn: function (aCollection,aStream){
  30712. var self=this,$self=this;
  30713. return $core.withContext(function($ctx1) {
  30714. $recv(aCollection)._do_((function(each){
  30715. return $core.withContext(function($ctx2) {
  30716. return $self._exportProtocol_on_(each,aStream);
  30717. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30718. }));
  30719. return self;
  30720. }, function($ctx1) {$ctx1.fill(self,"exportProtocols:on:",{aCollection:aCollection,aStream:aStream},$globals.ChunkExporter)});
  30721. },
  30722. args: ["aCollection", "aStream"],
  30723. source: "exportProtocols: aCollection on: aStream\x0a\x09aCollection do: [ :each |\x0a\x09\x09self exportProtocol: each on: aStream ]",
  30724. referencedClasses: [],
  30725. messageSends: ["do:", "exportProtocol:on:"]
  30726. }),
  30727. $globals.ChunkExporter);
  30728. $core.addMethod(
  30729. $core.method({
  30730. selector: "exportTraitComposition:of:on:",
  30731. protocol: "output",
  30732. fn: function (aTraitComposition,aBehavior,aStream){
  30733. var self=this,$self=this;
  30734. return $core.withContext(function($ctx1) {
  30735. $recv(aStream)._print_(aBehavior);
  30736. $recv(aStream)._write_(" setTraitComposition: ");
  30737. $ctx1.sendIdx["write:"]=1;
  30738. $recv(aStream)._write_($recv(aBehavior)._traitCompositionDefinition());
  30739. $ctx1.sendIdx["write:"]=2;
  30740. $recv(aStream)._write_(" asTraitComposition!");
  30741. $recv(aStream)._lf();
  30742. return self;
  30743. }, function($ctx1) {$ctx1.fill(self,"exportTraitComposition:of:on:",{aTraitComposition:aTraitComposition,aBehavior:aBehavior,aStream:aStream},$globals.ChunkExporter)});
  30744. },
  30745. args: ["aTraitComposition", "aBehavior", "aStream"],
  30746. 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",
  30747. referencedClasses: [],
  30748. messageSends: ["print:", "write:", "traitCompositionDefinition", "lf"]
  30749. }),
  30750. $globals.ChunkExporter);
  30751. $core.addMethod(
  30752. $core.method({
  30753. selector: "exportTraitDefinitionOf:on:",
  30754. protocol: "output",
  30755. fn: function (aClass,aStream){
  30756. var self=this,$self=this;
  30757. return $core.withContext(function($ctx1) {
  30758. var $1,$2,$3,$4;
  30759. $recv(aStream)._write_("Trait named: ");
  30760. $ctx1.sendIdx["write:"]=1;
  30761. $recv(aStream)._printSymbol_($recv(aClass)._name());
  30762. $1=$recv(aStream)._lf();
  30763. $ctx1.sendIdx["lf"]=1;
  30764. $recv(aStream)._tab();
  30765. $recv(aStream)._write_("package: ");
  30766. $ctx1.sendIdx["write:"]=2;
  30767. $recv(aStream)._print_($recv(aClass)._category());
  30768. $ctx1.sendIdx["print:"]=1;
  30769. $recv(aStream)._write_("!");
  30770. $ctx1.sendIdx["write:"]=3;
  30771. $2=$recv(aStream)._lf();
  30772. $ctx1.sendIdx["lf"]=2;
  30773. $3=$recv(aClass)._comment();
  30774. $ctx1.sendIdx["comment"]=1;
  30775. $recv($3)._ifNotEmpty_((function(){
  30776. return $core.withContext(function($ctx2) {
  30777. $recv(aStream)._write_("!");
  30778. $ctx2.sendIdx["write:"]=4;
  30779. $recv(aStream)._print_(aClass);
  30780. $recv(aStream)._write_(" commentStamp!");
  30781. $ctx2.sendIdx["write:"]=5;
  30782. $recv(aStream)._lf();
  30783. $ctx2.sendIdx["lf"]=3;
  30784. $recv(aStream)._write_([$self._chunkEscape_($recv(aClass)._comment()),"!"]);
  30785. $4=$recv(aStream)._lf();
  30786. $ctx2.sendIdx["lf"]=4;
  30787. return $4;
  30788. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30789. }));
  30790. $recv(aStream)._lf();
  30791. return self;
  30792. }, function($ctx1) {$ctx1.fill(self,"exportTraitDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  30793. },
  30794. args: ["aClass", "aStream"],
  30795. 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",
  30796. referencedClasses: [],
  30797. messageSends: ["write:", "printSymbol:", "name", "lf", "tab", "print:", "category", "ifNotEmpty:", "comment", "chunkEscape:"]
  30798. }),
  30799. $globals.ChunkExporter);
  30800. $core.addMethod(
  30801. $core.method({
  30802. selector: "extensionCategoriesOfPackage:",
  30803. protocol: "accessing",
  30804. fn: function (aPackage){
  30805. var self=this,$self=this;
  30806. var name,map,result;
  30807. return $core.withContext(function($ctx1) {
  30808. var $1;
  30809. name=$recv(aPackage)._name();
  30810. result=$recv($globals.OrderedCollection)._new();
  30811. $ctx1.sendIdx["new"]=1;
  30812. $recv($recv($globals.Package)._sortedClasses_($recv($globals.Smalltalk)._classes()))._do_((function(each){
  30813. return $core.withContext(function($ctx2) {
  30814. return $recv([each,$recv(each)._theMetaClass()])._do_((function(aClass){
  30815. return $core.withContext(function($ctx3) {
  30816. map=$recv($globals.Dictionary)._new();
  30817. $recv(aClass)._protocolsDo_((function(category,methods){
  30818. return $core.withContext(function($ctx4) {
  30819. $1=$recv(category).__eq("*".__comma(name));
  30820. if($core.assert($1)){
  30821. return $recv(map)._at_put_(category,methods);
  30822. }
  30823. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3,3)});
  30824. }));
  30825. return $recv(result)._addAll_($recv($recv($recv(map)._keys())._sorted_((function(a,b){
  30826. return $core.withContext(function($ctx4) {
  30827. return $recv(a).__lt_eq(b);
  30828. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3,5)});
  30829. })))._collect_((function(category){
  30830. return $core.withContext(function($ctx4) {
  30831. return $recv($globals.MethodCategory)._name_theClass_methods_(category,aClass,$recv(map)._at_(category));
  30832. }, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3,6)});
  30833. })));
  30834. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2,2)});
  30835. }));
  30836. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30837. }));
  30838. $ctx1.sendIdx["do:"]=1;
  30839. return result;
  30840. }, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{aPackage:aPackage,name:name,map:map,result:result},$globals.ChunkExporter)});
  30841. },
  30842. args: ["aPackage"],
  30843. source: "extensionCategoriesOfPackage: aPackage\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09| name map result |\x0a\x09name := aPackage name.\x0a\x09result := OrderedCollection new.\x0a\x09(Package sortedClasses: Smalltalk classes) do: [ :each |\x0a\x09\x09{each. each theMetaClass} do: [ :aClass |\x0a\x09\x09\x09map := Dictionary new.\x0a\x09\x09\x09aClass protocolsDo: [ :category :methods |\x0a\x09\x09\x09\x09category = ('*', name) ifTrue: [ map at: category put: methods ] ].\x0a\x09\x09\x09result addAll: ((map keys sorted: [ :a :b | a <= b ]) collect: [ :category |\x0a\x09\x09\x09\x09MethodCategory name: category theClass: aClass methods: (map at: category) ]) ] ].\x0a\x09^ result",
  30844. referencedClasses: ["OrderedCollection", "Package", "Smalltalk", "Dictionary", "MethodCategory"],
  30845. messageSends: ["name", "new", "do:", "sortedClasses:", "classes", "theMetaClass", "protocolsDo:", "ifTrue:", "=", ",", "at:put:", "addAll:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  30846. }),
  30847. $globals.ChunkExporter);
  30848. $core.addMethod(
  30849. $core.method({
  30850. selector: "ownCategoriesOfClass:",
  30851. protocol: "accessing",
  30852. fn: function (aClass){
  30853. var self=this,$self=this;
  30854. var map;
  30855. return $core.withContext(function($ctx1) {
  30856. var $1;
  30857. map=$recv($globals.Dictionary)._new();
  30858. $recv(aClass)._protocolsDo_((function(each,methods){
  30859. return $core.withContext(function($ctx2) {
  30860. $1=$recv(each)._match_("^\x5c*");
  30861. if(!$core.assert($1)){
  30862. return $recv(map)._at_put_(each,methods);
  30863. }
  30864. }, function($ctx2) {$ctx2.fillBlock({each:each,methods:methods},$ctx1,1)});
  30865. }));
  30866. return $recv($recv($recv(map)._keys())._sorted_((function(a,b){
  30867. return $core.withContext(function($ctx2) {
  30868. return $recv(a).__lt_eq(b);
  30869. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  30870. })))._collect_((function(each){
  30871. return $core.withContext(function($ctx2) {
  30872. return $recv($globals.MethodCategory)._name_theClass_methods_(each,aClass,$recv(map)._at_(each));
  30873. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  30874. }));
  30875. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map},$globals.ChunkExporter)});
  30876. },
  30877. args: ["aClass"],
  30878. 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) ]",
  30879. referencedClasses: ["Dictionary", "MethodCategory"],
  30880. messageSends: ["new", "protocolsDo:", "ifFalse:", "match:", "at:put:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  30881. }),
  30882. $globals.ChunkExporter);
  30883. $core.addMethod(
  30884. $core.method({
  30885. selector: "ownCategoriesOfMetaClass:",
  30886. protocol: "accessing",
  30887. fn: function (aClass){
  30888. var self=this,$self=this;
  30889. return $core.withContext(function($ctx1) {
  30890. return $self._ownCategoriesOfClass_($recv(aClass)._theMetaClass());
  30891. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfMetaClass:",{aClass:aClass},$globals.ChunkExporter)});
  30892. },
  30893. args: ["aClass"],
  30894. source: "ownCategoriesOfMetaClass: aClass\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09^ self ownCategoriesOfClass: aClass theMetaClass",
  30895. referencedClasses: [],
  30896. messageSends: ["ownCategoriesOfClass:", "theMetaClass"]
  30897. }),
  30898. $globals.ChunkExporter);
  30899. $core.addMethod(
  30900. $core.method({
  30901. selector: "ownMethodProtocolsOfClass:",
  30902. protocol: "accessing",
  30903. fn: function (aClass){
  30904. var self=this,$self=this;
  30905. return $core.withContext(function($ctx1) {
  30906. return $recv($recv(aClass)._ownProtocols())._collect_((function(each){
  30907. return $core.withContext(function($ctx2) {
  30908. return $recv($globals.ExportMethodProtocol)._name_theClass_(each,aClass);
  30909. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30910. }));
  30911. }, function($ctx1) {$ctx1.fill(self,"ownMethodProtocolsOfClass:",{aClass:aClass},$globals.ChunkExporter)});
  30912. },
  30913. args: ["aClass"],
  30914. 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 ]",
  30915. referencedClasses: ["ExportMethodProtocol"],
  30916. messageSends: ["collect:", "ownProtocols", "name:theClass:"]
  30917. }),
  30918. $globals.ChunkExporter);
  30919. $core.addClass("Exporter", $globals.AbstractExporter, [], "Platform-ImportExport");
  30920. $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.).";
  30921. $core.addMethod(
  30922. $core.method({
  30923. selector: "exportBehavior:on:",
  30924. protocol: "output",
  30925. fn: function (aBehavior,aStream){
  30926. var self=this,$self=this;
  30927. return $core.withContext(function($ctx1) {
  30928. $recv(aBehavior)._exportBehaviorDefinitionTo_using_(aStream,self);
  30929. $recv($recv(aBehavior)._ownMethods())._do_((function(method){
  30930. return $core.withContext(function($ctx2) {
  30931. return $self._exportMethod_on_(method,aStream);
  30932. }, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1,1)});
  30933. }));
  30934. return self;
  30935. }, function($ctx1) {$ctx1.fill(self,"exportBehavior:on:",{aBehavior:aBehavior,aStream:aStream},$globals.Exporter)});
  30936. },
  30937. args: ["aBehavior", "aStream"],
  30938. source: "exportBehavior: aBehavior on: aStream\x0a\x09aBehavior exportBehaviorDefinitionTo: aStream using: self.\x0a\x09aBehavior ownMethods do: [ :method |\x0a\x09\x09self exportMethod: method on: aStream ]",
  30939. referencedClasses: [],
  30940. messageSends: ["exportBehaviorDefinitionTo:using:", "do:", "ownMethods", "exportMethod:on:"]
  30941. }),
  30942. $globals.Exporter);
  30943. $core.addMethod(
  30944. $core.method({
  30945. selector: "exportDefinitionOf:on:",
  30946. protocol: "output",
  30947. fn: function (aClass,aStream){
  30948. var self=this,$self=this;
  30949. return $core.withContext(function($ctx1) {
  30950. var $3,$5,$4,$6,$7,$2,$1,$8,$10,$9,$receiver;
  30951. $recv(aStream)._lf();
  30952. $ctx1.sendIdx["lf"]=1;
  30953. $3=$recv($recv(aClass)._name())._asJavaScriptSource();
  30954. $ctx1.sendIdx["asJavaScriptSource"]=1;
  30955. $5=$recv(aClass)._superclass();
  30956. if(($receiver = $5) == null || $receiver.a$nil){
  30957. $4="null";
  30958. } else {
  30959. var superclass;
  30960. superclass=$receiver;
  30961. $4=$recv(superclass)._asJavaScriptSource();
  30962. $ctx1.sendIdx["asJavaScriptSource"]=2;
  30963. }
  30964. $6=$recv($recv(aClass)._instanceVariableNames())._asJavaScriptSource();
  30965. $ctx1.sendIdx["asJavaScriptSource"]=3;
  30966. $7=$recv($recv(aClass)._category())._asJavaScriptSource();
  30967. $ctx1.sendIdx["asJavaScriptSource"]=4;
  30968. $2=["$core.addClass(",$3,", ",$4,", ",$6,", ",$7,");"];
  30969. $1=$recv(aStream)._write_($2);
  30970. $ctx1.sendIdx["write:"]=1;
  30971. $8=$recv(aClass)._comment();
  30972. $ctx1.sendIdx["comment"]=1;
  30973. $recv($8)._ifNotEmpty_((function(){
  30974. return $core.withContext(function($ctx2) {
  30975. $recv(aStream)._lf();
  30976. $ctx2.sendIdx["lf"]=2;
  30977. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  30978. $ctx2.sendIdx["write:"]=2;
  30979. $recv(aStream)._lf();
  30980. $ctx2.sendIdx["lf"]=3;
  30981. $10=$recv(aClass)._asJavaScriptSource();
  30982. $ctx2.sendIdx["asJavaScriptSource"]=5;
  30983. $9=[$10,".comment=",$recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavaScriptSource(),";"];
  30984. $recv(aStream)._write_($9);
  30985. $ctx2.sendIdx["write:"]=3;
  30986. $recv(aStream)._lf();
  30987. $ctx2.sendIdx["lf"]=4;
  30988. return $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  30989. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  30990. }));
  30991. $recv(aStream)._lf();
  30992. return self;
  30993. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  30994. },
  30995. args: ["aClass", "aStream"],
  30996. 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",
  30997. referencedClasses: [],
  30998. messageSends: ["lf", "write:", "asJavaScriptSource", "name", "ifNil:ifNotNil:", "superclass", "instanceVariableNames", "category", "ifNotEmpty:", "comment", "crlfSanitized"]
  30999. }),
  31000. $globals.Exporter);
  31001. $core.addMethod(
  31002. $core.method({
  31003. selector: "exportMetaDefinitionOf:on:",
  31004. protocol: "output",
  31005. fn: function (aClass,aStream){
  31006. var self=this,$self=this;
  31007. return $core.withContext(function($ctx1) {
  31008. var $2,$1,$4,$3;
  31009. $recv(aStream)._lf();
  31010. $ctx1.sendIdx["lf"]=1;
  31011. $2=$recv(aClass)._theMetaClass();
  31012. $ctx1.sendIdx["theMetaClass"]=1;
  31013. $1=$recv($2)._instanceVariableNames();
  31014. $recv($1)._ifNotEmpty_((function(classIvars){
  31015. return $core.withContext(function($ctx2) {
  31016. $4=$recv($recv(aClass)._theMetaClass())._asJavaScriptSource();
  31017. $ctx2.sendIdx["asJavaScriptSource"]=1;
  31018. $3=[$4,".iVarNames = ",$recv(classIvars)._asJavaScriptSource(),";"];
  31019. $recv(aStream)._write_($3);
  31020. return $recv(aStream)._lf();
  31021. }, function($ctx2) {$ctx2.fillBlock({classIvars:classIvars},$ctx1,1)});
  31022. }));
  31023. return self;
  31024. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  31025. },
  31026. args: ["aClass", "aStream"],
  31027. source: "exportMetaDefinitionOf: aClass on: aStream\x0a\x09aStream lf.\x0a\x09aClass theMetaClass instanceVariableNames ifNotEmpty: [ :classIvars | aStream\x0a\x09\x09write: { aClass theMetaClass asJavaScriptSource. '.iVarNames = '. classIvars asJavaScriptSource. ';' };\x0a\x09\x09lf ]",
  31028. referencedClasses: [],
  31029. messageSends: ["lf", "ifNotEmpty:", "instanceVariableNames", "theMetaClass", "write:", "asJavaScriptSource"]
  31030. }),
  31031. $globals.Exporter);
  31032. $core.addMethod(
  31033. $core.method({
  31034. selector: "exportMethod:on:",
  31035. protocol: "output",
  31036. fn: function (aMethod,aStream){
  31037. var self=this,$self=this;
  31038. return $core.withContext(function($ctx1) {
  31039. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11;
  31040. $recv(aStream)._write_("$core.addMethod(");
  31041. $ctx1.sendIdx["write:"]=1;
  31042. $recv(aStream)._lf();
  31043. $ctx1.sendIdx["lf"]=1;
  31044. $recv(aStream)._write_("$core.method({");
  31045. $ctx1.sendIdx["write:"]=2;
  31046. $recv(aStream)._lf();
  31047. $ctx1.sendIdx["lf"]=2;
  31048. $2=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  31049. $ctx1.sendIdx["asJavaScriptSource"]=1;
  31050. $1=["selector: ",$2,","];
  31051. $recv(aStream)._write_($1);
  31052. $ctx1.sendIdx["write:"]=3;
  31053. $recv(aStream)._lf();
  31054. $ctx1.sendIdx["lf"]=3;
  31055. $4=$recv($recv(aMethod)._protocol())._asJavaScriptSource();
  31056. $ctx1.sendIdx["asJavaScriptSource"]=2;
  31057. $3=["protocol: ",$4,","];
  31058. $recv(aStream)._write_($3);
  31059. $ctx1.sendIdx["write:"]=4;
  31060. $recv(aStream)._lf();
  31061. $ctx1.sendIdx["lf"]=4;
  31062. $recv(aStream)._write_(["fn: ",$recv($recv(aMethod)._fn())._compiledSource(),","]);
  31063. $ctx1.sendIdx["write:"]=5;
  31064. $recv(aStream)._lf();
  31065. $ctx1.sendIdx["lf"]=5;
  31066. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  31067. $ctx1.sendIdx["write:"]=6;
  31068. $recv(aStream)._lf();
  31069. $ctx1.sendIdx["lf"]=6;
  31070. $6=$recv($recv(aMethod)._arguments())._asJavaScriptSource();
  31071. $ctx1.sendIdx["asJavaScriptSource"]=3;
  31072. $5=["args: ",$6,","];
  31073. $recv(aStream)._write_($5);
  31074. $ctx1.sendIdx["write:"]=7;
  31075. $recv(aStream)._lf();
  31076. $ctx1.sendIdx["lf"]=7;
  31077. $8=$recv($recv(aMethod)._source())._asJavaScriptSource();
  31078. $ctx1.sendIdx["asJavaScriptSource"]=4;
  31079. $7=["source: ",$8,","];
  31080. $recv(aStream)._write_($7);
  31081. $ctx1.sendIdx["write:"]=8;
  31082. $recv(aStream)._lf();
  31083. $ctx1.sendIdx["lf"]=8;
  31084. $10=$recv($recv(aMethod)._referencedClasses())._asJavaScriptSource();
  31085. $ctx1.sendIdx["asJavaScriptSource"]=5;
  31086. $9=["referencedClasses: ",$10,","];
  31087. $recv(aStream)._write_($9);
  31088. $ctx1.sendIdx["write:"]=9;
  31089. $recv(aStream)._lf();
  31090. $ctx1.sendIdx["lf"]=9;
  31091. $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  31092. $ctx1.sendIdx["write:"]=10;
  31093. $recv(aStream)._lf();
  31094. $ctx1.sendIdx["lf"]=10;
  31095. $12=$recv($recv(aMethod)._messageSends())._asJavaScriptSource();
  31096. $ctx1.sendIdx["asJavaScriptSource"]=6;
  31097. $11=["messageSends: ",$12];
  31098. $recv(aStream)._write_($11);
  31099. $ctx1.sendIdx["write:"]=11;
  31100. $recv(aStream)._lf();
  31101. $ctx1.sendIdx["lf"]=11;
  31102. $recv(aStream)._write_("}),");
  31103. $ctx1.sendIdx["write:"]=12;
  31104. $recv(aStream)._lf();
  31105. $ctx1.sendIdx["lf"]=12;
  31106. $recv(aStream)._write_([$recv($recv(aMethod)._methodClass())._asJavaScriptSource(),");"]);
  31107. $recv(aStream)._lf();
  31108. $ctx1.sendIdx["lf"]=13;
  31109. $recv(aStream)._lf();
  31110. return self;
  31111. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.Exporter)});
  31112. },
  31113. args: ["aMethod", "aStream"],
  31114. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09write: '$core.addMethod('; lf;\x0a\x09\x09write: '$core.method({'; lf;\x0a\x09\x09write: { 'selector: '. aMethod selector asJavaScriptSource. ',' }; lf;\x0a\x09\x09write: { 'protocol: '. aMethod protocol asJavaScriptSource. ',' }; lf;\x0a\x09\x09write: { 'fn: '. aMethod fn compiledSource. ',' }; lf;\x0a\x09\x09write: '//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);'; lf;\x0a\x09\x09write: { 'args: '. aMethod arguments asJavaScriptSource. ',' }; lf;\x0a\x09\x09write: { 'source: '. aMethod source asJavaScriptSource. ',' }; lf;\x0a\x09\x09write: { 'referencedClasses: '. aMethod referencedClasses asJavaScriptSource. ',' }; lf;\x0a\x09\x09write: '//>>excludeEnd(\x22ide\x22);'; lf;\x0a\x09\x09write: { 'messageSends: '. aMethod messageSends asJavaScriptSource }; lf;\x0a\x09\x09write: '}),'; lf;\x0a\x09\x09write: { aMethod methodClass asJavaScriptSource. ');' }; lf; lf",
  31115. referencedClasses: [],
  31116. messageSends: ["write:", "lf", "asJavaScriptSource", "selector", "protocol", "compiledSource", "fn", "arguments", "source", "referencedClasses", "messageSends", "methodClass"]
  31117. }),
  31118. $globals.Exporter);
  31119. $core.addMethod(
  31120. $core.method({
  31121. selector: "exportPackage:on:",
  31122. protocol: "output",
  31123. fn: function (aPackage,aStream){
  31124. var self=this,$self=this;
  31125. return $core.withContext(function($ctx1) {
  31126. var $1,$receiver;
  31127. $self._exportPackagePrologueOf_on_(aPackage,aStream);
  31128. $self._exportPackageDefinitionOf_on_(aPackage,aStream);
  31129. $self._exportPackageContextOf_on_(aPackage,aStream);
  31130. $self._exportPackageImportsOf_on_(aPackage,aStream);
  31131. $self._exportPackageTransportOf_on_(aPackage,aStream);
  31132. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  31133. return $core.withContext(function($ctx2) {
  31134. $self._exportBehavior_on_(each,aStream);
  31135. $ctx2.sendIdx["exportBehavior:on:"]=1;
  31136. $1=$recv(each)._theMetaClass();
  31137. if(($receiver = $1) == null || $receiver.a$nil){
  31138. return $1;
  31139. } else {
  31140. var meta;
  31141. meta=$receiver;
  31142. return $self._exportBehavior_on_(meta,aStream);
  31143. }
  31144. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31145. }));
  31146. $ctx1.sendIdx["do:"]=1;
  31147. $self._exportPackageTraitCompositionsOf_on_(aPackage,aStream);
  31148. $recv($self._extensionMethodsOfPackage_(aPackage))._do_((function(each){
  31149. return $core.withContext(function($ctx2) {
  31150. return $self._exportMethod_on_(each,aStream);
  31151. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  31152. }));
  31153. $self._exportPackageEpilogueOf_on_(aPackage,aStream);
  31154. return self;
  31155. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31156. },
  31157. args: ["aPackage", "aStream"],
  31158. source: "exportPackage: aPackage on: aStream\x0a\x09\x0a\x09self \x0a\x09\x09exportPackagePrologueOf: aPackage on: aStream;\x0a\x09\x09exportPackageDefinitionOf: aPackage on: aStream;\x0a\x09\x09exportPackageContextOf: aPackage on: aStream;\x0a\x09\x09exportPackageImportsOf: aPackage on: aStream;\x0a\x09\x09exportPackageTransportOf: aPackage on: aStream.\x0a\x09\x0a\x09aPackage sortedClasses do: [ :each |\x0a\x09\x09self exportBehavior: each on: aStream.\x0a\x09\x09each theMetaClass ifNotNil: [ :meta | self exportBehavior: meta on: aStream ] ].\x0a\x09\x09\x09\x0a\x09self exportPackageTraitCompositionsOf: aPackage on: aStream.\x0a\x0a\x09(self extensionMethodsOfPackage: aPackage) do: [ :each |\x0a\x09\x09self exportMethod: each on: aStream ].\x0a\x09\x09\x0a\x09self exportPackageEpilogueOf: aPackage on: aStream",
  31159. referencedClasses: [],
  31160. messageSends: ["exportPackagePrologueOf:on:", "exportPackageDefinitionOf:on:", "exportPackageContextOf:on:", "exportPackageImportsOf:on:", "exportPackageTransportOf:on:", "do:", "sortedClasses", "exportBehavior:on:", "ifNotNil:", "theMetaClass", "exportPackageTraitCompositionsOf:on:", "extensionMethodsOfPackage:", "exportMethod:on:", "exportPackageEpilogueOf:on:"]
  31161. }),
  31162. $globals.Exporter);
  31163. $core.addMethod(
  31164. $core.method({
  31165. selector: "exportPackageBodyBlockPrologueOf:on:",
  31166. protocol: "output",
  31167. fn: function (aPackage,aStream){
  31168. var self=this,$self=this;
  31169. return $core.withContext(function($ctx1) {
  31170. $recv(aStream)._write_("if(!(\x22nilAsValue\x22 in $boot))$boot.nilAsValue=$boot.nilAsReceiver;");
  31171. $ctx1.sendIdx["write:"]=1;
  31172. $recv(aStream)._lf();
  31173. $ctx1.sendIdx["lf"]=1;
  31174. $recv(aStream)._write_("var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;");
  31175. $recv(aStream)._lf();
  31176. return self;
  31177. }, function($ctx1) {$ctx1.fill(self,"exportPackageBodyBlockPrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31178. },
  31179. args: ["aPackage", "aStream"],
  31180. source: "exportPackageBodyBlockPrologueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: 'if(!(\x22nilAsValue\x22 in $boot))$boot.nilAsValue=$boot.nilAsReceiver;'; lf;\x0a\x09\x09write: 'var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;'; lf",
  31181. referencedClasses: [],
  31182. messageSends: ["write:", "lf"]
  31183. }),
  31184. $globals.Exporter);
  31185. $core.addMethod(
  31186. $core.method({
  31187. selector: "exportPackageContextOf:on:",
  31188. protocol: "output",
  31189. fn: function (aPackage,aStream){
  31190. var self=this,$self=this;
  31191. return $core.withContext(function($ctx1) {
  31192. $recv(aStream)._write_("$pkg.innerEval = function (expr) { return eval(expr); };");
  31193. $recv(aStream)._lf();
  31194. return self;
  31195. }, function($ctx1) {$ctx1.fill(self,"exportPackageContextOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31196. },
  31197. args: ["aPackage", "aStream"],
  31198. source: "exportPackageContextOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: '$pkg.innerEval = function (expr) { return eval(expr); };';\x0a\x09\x09lf",
  31199. referencedClasses: [],
  31200. messageSends: ["write:", "lf"]
  31201. }),
  31202. $globals.Exporter);
  31203. $core.addMethod(
  31204. $core.method({
  31205. selector: "exportPackageDefinitionOf:on:",
  31206. protocol: "output",
  31207. fn: function (aPackage,aStream){
  31208. var self=this,$self=this;
  31209. return $core.withContext(function($ctx1) {
  31210. $recv(aStream)._write_(["var $pkg = $core.addPackage(",$recv($recv(aPackage)._name())._asJavaScriptSource(),");"]);
  31211. $recv(aStream)._lf();
  31212. return self;
  31213. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31214. },
  31215. args: ["aPackage", "aStream"],
  31216. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: { 'var $pkg = $core.addPackage('. aPackage name asJavaScriptSource. ');' };\x0a\x09\x09lf",
  31217. referencedClasses: [],
  31218. messageSends: ["write:", "asJavaScriptSource", "name", "lf"]
  31219. }),
  31220. $globals.Exporter);
  31221. $core.addMethod(
  31222. $core.method({
  31223. selector: "exportPackageEpilogueOf:on:",
  31224. protocol: "output",
  31225. fn: function (aPackage,aStream){
  31226. var self=this,$self=this;
  31227. return $core.withContext(function($ctx1) {
  31228. $self._subclassResponsibility();
  31229. return self;
  31230. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31231. },
  31232. args: ["aPackage", "aStream"],
  31233. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  31234. referencedClasses: [],
  31235. messageSends: ["subclassResponsibility"]
  31236. }),
  31237. $globals.Exporter);
  31238. $core.addMethod(
  31239. $core.method({
  31240. selector: "exportPackageImportsOf:on:",
  31241. protocol: "output",
  31242. fn: function (aPackage,aStream){
  31243. var self=this,$self=this;
  31244. return $core.withContext(function($ctx1) {
  31245. $recv($recv(aPackage)._importsAsJson())._ifNotEmpty_((function(imports){
  31246. return $core.withContext(function($ctx2) {
  31247. $recv(aStream)._write_(["$pkg.imports = ",$recv(imports)._asJavaScriptSource(),";"]);
  31248. return $recv(aStream)._lf();
  31249. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  31250. }));
  31251. return self;
  31252. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31253. },
  31254. args: ["aPackage", "aStream"],
  31255. 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 ]",
  31256. referencedClasses: [],
  31257. messageSends: ["ifNotEmpty:", "importsAsJson", "write:", "asJavaScriptSource", "lf"]
  31258. }),
  31259. $globals.Exporter);
  31260. $core.addMethod(
  31261. $core.method({
  31262. selector: "exportPackagePrologueOf:on:",
  31263. protocol: "output",
  31264. fn: function (aPackage,aStream){
  31265. var self=this,$self=this;
  31266. return $core.withContext(function($ctx1) {
  31267. $self._subclassResponsibility();
  31268. return self;
  31269. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31270. },
  31271. args: ["aPackage", "aStream"],
  31272. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  31273. referencedClasses: [],
  31274. messageSends: ["subclassResponsibility"]
  31275. }),
  31276. $globals.Exporter);
  31277. $core.addMethod(
  31278. $core.method({
  31279. selector: "exportPackageTraitCompositionsOf:on:",
  31280. protocol: "output",
  31281. fn: function (aPackage,aStream){
  31282. var self=this,$self=this;
  31283. return $core.withContext(function($ctx1) {
  31284. $recv($recv(aPackage)._traitCompositions())._ifNotEmpty_((function(traitCompositions){
  31285. return $core.withContext(function($ctx2) {
  31286. $recv(traitCompositions)._keysAndValuesDo_((function(key,value){
  31287. return $core.withContext(function($ctx3) {
  31288. return $self._exportTraitComposition_of_on_(value,key,aStream);
  31289. }, function($ctx3) {$ctx3.fillBlock({key:key,value:value},$ctx2,2)});
  31290. }));
  31291. return $recv(aStream)._lf();
  31292. }, function($ctx2) {$ctx2.fillBlock({traitCompositions:traitCompositions},$ctx1,1)});
  31293. }));
  31294. return self;
  31295. }, function($ctx1) {$ctx1.fill(self,"exportPackageTraitCompositionsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31296. },
  31297. args: ["aPackage", "aStream"],
  31298. 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 ]",
  31299. referencedClasses: [],
  31300. messageSends: ["ifNotEmpty:", "traitCompositions", "keysAndValuesDo:", "exportTraitComposition:of:on:", "lf"]
  31301. }),
  31302. $globals.Exporter);
  31303. $core.addMethod(
  31304. $core.method({
  31305. selector: "exportPackageTransportOf:on:",
  31306. protocol: "output",
  31307. fn: function (aPackage,aStream){
  31308. var self=this,$self=this;
  31309. return $core.withContext(function($ctx1) {
  31310. $recv(aStream)._write_(["$pkg.transport = ",$recv($recv(aPackage)._transport())._asJSONString(),";"]);
  31311. $recv(aStream)._lf();
  31312. return self;
  31313. }, function($ctx1) {$ctx1.fill(self,"exportPackageTransportOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31314. },
  31315. args: ["aPackage", "aStream"],
  31316. source: "exportPackageTransportOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: { '$pkg.transport = '. aPackage transport asJSONString. ';' };\x0a\x09\x09lf",
  31317. referencedClasses: [],
  31318. messageSends: ["write:", "asJSONString", "transport", "lf"]
  31319. }),
  31320. $globals.Exporter);
  31321. $core.addMethod(
  31322. $core.method({
  31323. selector: "exportTraitComposition:of:on:",
  31324. protocol: "output",
  31325. fn: function (aTraitComposition,aBehavior,aStream){
  31326. var self=this,$self=this;
  31327. return $core.withContext(function($ctx1) {
  31328. var $2,$1;
  31329. $2=$recv(aTraitComposition)._asJavaScriptSource();
  31330. $ctx1.sendIdx["asJavaScriptSource"]=1;
  31331. $1=["$core.setTraitComposition(",$2,", ",$recv(aBehavior)._asJavaScriptSource(),");"];
  31332. $recv(aStream)._write_($1);
  31333. $recv(aStream)._lf();
  31334. return self;
  31335. }, function($ctx1) {$ctx1.fill(self,"exportTraitComposition:of:on:",{aTraitComposition:aTraitComposition,aBehavior:aBehavior,aStream:aStream},$globals.Exporter)});
  31336. },
  31337. args: ["aTraitComposition", "aBehavior", "aStream"],
  31338. 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",
  31339. referencedClasses: [],
  31340. messageSends: ["write:", "asJavaScriptSource", "lf"]
  31341. }),
  31342. $globals.Exporter);
  31343. $core.addMethod(
  31344. $core.method({
  31345. selector: "exportTraitDefinitionOf:on:",
  31346. protocol: "output",
  31347. fn: function (aClass,aStream){
  31348. var self=this,$self=this;
  31349. return $core.withContext(function($ctx1) {
  31350. var $3,$4,$2,$1,$5,$7,$6;
  31351. $recv(aStream)._lf();
  31352. $ctx1.sendIdx["lf"]=1;
  31353. $3=$recv($recv(aClass)._name())._asJavaScriptSource();
  31354. $ctx1.sendIdx["asJavaScriptSource"]=1;
  31355. $4=$recv($recv(aClass)._category())._asJavaScriptSource();
  31356. $ctx1.sendIdx["asJavaScriptSource"]=2;
  31357. $2=["$core.addTrait(",$3,", ",$4,");"];
  31358. $1=$recv(aStream)._write_($2);
  31359. $ctx1.sendIdx["write:"]=1;
  31360. $5=$recv(aClass)._comment();
  31361. $ctx1.sendIdx["comment"]=1;
  31362. $recv($5)._ifNotEmpty_((function(){
  31363. return $core.withContext(function($ctx2) {
  31364. $recv(aStream)._lf();
  31365. $ctx2.sendIdx["lf"]=2;
  31366. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  31367. $ctx2.sendIdx["write:"]=2;
  31368. $recv(aStream)._lf();
  31369. $ctx2.sendIdx["lf"]=3;
  31370. $7=$recv(aClass)._asJavaScriptSource();
  31371. $ctx2.sendIdx["asJavaScriptSource"]=3;
  31372. $6=[$7,".comment=",$recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavaScriptSource(),";"];
  31373. $recv(aStream)._write_($6);
  31374. $ctx2.sendIdx["write:"]=3;
  31375. $recv(aStream)._lf();
  31376. $ctx2.sendIdx["lf"]=4;
  31377. return $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  31378. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31379. }));
  31380. $recv(aStream)._lf();
  31381. return self;
  31382. }, function($ctx1) {$ctx1.fill(self,"exportTraitDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  31383. },
  31384. args: ["aClass", "aStream"],
  31385. 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",
  31386. referencedClasses: [],
  31387. messageSends: ["lf", "write:", "asJavaScriptSource", "name", "category", "ifNotEmpty:", "comment", "crlfSanitized"]
  31388. }),
  31389. $globals.Exporter);
  31390. $core.addMethod(
  31391. $core.method({
  31392. selector: "ownMethodsOfClass:",
  31393. protocol: "accessing",
  31394. fn: function (aClass){
  31395. var self=this,$self=this;
  31396. return $core.withContext(function($ctx1) {
  31397. var $1;
  31398. return $recv($recv($recv($recv(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  31399. return $core.withContext(function($ctx2) {
  31400. $1=$recv(a)._selector();
  31401. $ctx2.sendIdx["selector"]=1;
  31402. return $recv($1).__lt_eq($recv(b)._selector());
  31403. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  31404. })))._reject_((function(each){
  31405. return $core.withContext(function($ctx2) {
  31406. return $recv($recv(each)._protocol())._match_("^\x5c*");
  31407. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  31408. }));
  31409. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfClass:",{aClass:aClass},$globals.Exporter)});
  31410. },
  31411. args: ["aClass"],
  31412. 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*') ]",
  31413. referencedClasses: [],
  31414. messageSends: ["reject:", "sorted:", "values", "methodDictionary", "<=", "selector", "match:", "protocol"]
  31415. }),
  31416. $globals.Exporter);
  31417. $core.addMethod(
  31418. $core.method({
  31419. selector: "ownMethodsOfMetaClass:",
  31420. protocol: "accessing",
  31421. fn: function (aClass){
  31422. var self=this,$self=this;
  31423. return $core.withContext(function($ctx1) {
  31424. return $self._ownMethodsOfClass_($recv(aClass)._theMetaClass());
  31425. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfMetaClass:",{aClass:aClass},$globals.Exporter)});
  31426. },
  31427. args: ["aClass"],
  31428. source: "ownMethodsOfMetaClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^ self ownMethodsOfClass: aClass theMetaClass",
  31429. referencedClasses: [],
  31430. messageSends: ["ownMethodsOfClass:", "theMetaClass"]
  31431. }),
  31432. $globals.Exporter);
  31433. $core.addClass("AmdExporter", $globals.Exporter, ["namespace"], "Platform-ImportExport");
  31434. $globals.AmdExporter.comment="I am used to export Packages in an AMD (Asynchronous Module Definition) JavaScript format.";
  31435. $core.addMethod(
  31436. $core.method({
  31437. selector: "amdNamesOfPackages:",
  31438. protocol: "private",
  31439. fn: function (anArray){
  31440. var self=this,$self=this;
  31441. return $core.withContext(function($ctx1) {
  31442. var $1;
  31443. return $recv($recv(anArray)._select_((function(each){
  31444. return $core.withContext(function($ctx2) {
  31445. $1=$self._amdNamespaceOfPackage_(each);
  31446. $ctx2.sendIdx["amdNamespaceOfPackage:"]=1;
  31447. return $recv($1)._notNil();
  31448. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31449. })))._collect_((function(each){
  31450. return $core.withContext(function($ctx2) {
  31451. return $recv($recv($self._amdNamespaceOfPackage_(each)).__comma("/")).__comma($recv(each)._name());
  31452. $ctx2.sendIdx[","]=1;
  31453. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  31454. }));
  31455. }, function($ctx1) {$ctx1.fill(self,"amdNamesOfPackages:",{anArray:anArray},$globals.AmdExporter)});
  31456. },
  31457. args: ["anArray"],
  31458. source: "amdNamesOfPackages: anArray\x0a\x09^ (anArray\x0a\x09\x09select: [ :each | (self amdNamespaceOfPackage: each) notNil ])\x0a\x09\x09collect: [ :each | (self amdNamespaceOfPackage: each), '/', each name ]",
  31459. referencedClasses: [],
  31460. messageSends: ["collect:", "select:", "notNil", "amdNamespaceOfPackage:", ",", "name"]
  31461. }),
  31462. $globals.AmdExporter);
  31463. $core.addMethod(
  31464. $core.method({
  31465. selector: "amdNamespaceOfPackage:",
  31466. protocol: "private",
  31467. fn: function (aPackage){
  31468. var self=this,$self=this;
  31469. return $core.withContext(function($ctx1) {
  31470. var $3,$2,$1;
  31471. $3=$recv(aPackage)._transport();
  31472. $ctx1.sendIdx["transport"]=1;
  31473. $2=$recv($3)._type();
  31474. $1=$recv($2).__eq("amd");
  31475. if($core.assert($1)){
  31476. return $recv($recv(aPackage)._transport())._namespace();
  31477. } else {
  31478. return nil;
  31479. }
  31480. }, function($ctx1) {$ctx1.fill(self,"amdNamespaceOfPackage:",{aPackage:aPackage},$globals.AmdExporter)});
  31481. },
  31482. args: ["aPackage"],
  31483. source: "amdNamespaceOfPackage: aPackage\x0a\x09^ (aPackage transport type = 'amd')\x0a\x09\x09ifTrue: [ aPackage transport namespace ]\x0a\x09\x09ifFalse: [ nil ]",
  31484. referencedClasses: [],
  31485. messageSends: ["ifTrue:ifFalse:", "=", "type", "transport", "namespace"]
  31486. }),
  31487. $globals.AmdExporter);
  31488. $core.addMethod(
  31489. $core.method({
  31490. selector: "exportPackageEpilogueOf:on:",
  31491. protocol: "output",
  31492. fn: function (aPackage,aStream){
  31493. var self=this,$self=this;
  31494. return $core.withContext(function($ctx1) {
  31495. $recv(aStream)._write_("});");
  31496. $recv(aStream)._lf();
  31497. return self;
  31498. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.AmdExporter)});
  31499. },
  31500. args: ["aPackage", "aStream"],
  31501. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: '});';\x0a\x09\x09lf",
  31502. referencedClasses: [],
  31503. messageSends: ["write:", "lf"]
  31504. }),
  31505. $globals.AmdExporter);
  31506. $core.addMethod(
  31507. $core.method({
  31508. selector: "exportPackagePrologueOf:on:",
  31509. protocol: "output",
  31510. fn: function (aPackage,aStream){
  31511. var self=this,$self=this;
  31512. var importsForOutput,loadDependencies,pragmaStart,pragmaEnd;
  31513. return $core.withContext(function($ctx1) {
  31514. var $1,$3,$2,$4,$6,$5,$7,$14,$13,$12,$11,$10,$9,$18,$17,$16,$15,$8;
  31515. pragmaStart="";
  31516. pragmaEnd="";
  31517. importsForOutput=$self._importsForOutput_(aPackage);
  31518. loadDependencies=$self._amdNamesOfPackages_($recv(aPackage)._loadDependencies());
  31519. $1=$recv(importsForOutput)._value();
  31520. $ctx1.sendIdx["value"]=1;
  31521. $recv($1)._ifNotEmpty_((function(){
  31522. return $core.withContext(function($ctx2) {
  31523. $3=$recv($globals.String)._lf();
  31524. $ctx2.sendIdx["lf"]=1;
  31525. $2=$recv($3).__comma("//>>excludeStart(\x22imports\x22, pragmas.excludeImports);");
  31526. $ctx2.sendIdx[","]=2;
  31527. $4=$recv($globals.String)._lf();
  31528. $ctx2.sendIdx["lf"]=2;
  31529. pragmaStart=$recv($2).__comma($4);
  31530. $ctx2.sendIdx[","]=1;
  31531. $6=$recv($globals.String)._lf();
  31532. $ctx2.sendIdx["lf"]=3;
  31533. $5=$recv($6).__comma("//>>excludeEnd(\x22imports\x22);");
  31534. $ctx2.sendIdx[","]=4;
  31535. $7=$recv($globals.String)._lf();
  31536. $ctx2.sendIdx["lf"]=4;
  31537. pragmaEnd=$recv($5).__comma($7);
  31538. $ctx2.sendIdx[","]=3;
  31539. return pragmaEnd;
  31540. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31541. }));
  31542. $14=["amber/boot", ":1:"].__comma($recv(importsForOutput)._value());
  31543. $ctx1.sendIdx[","]=7;
  31544. $13=$recv($14).__comma([":2:"]);
  31545. $ctx1.sendIdx[","]=6;
  31546. $12=$recv($13).__comma($recv($recv(loadDependencies)._asArray())._sorted());
  31547. $ctx1.sendIdx[","]=5;
  31548. $11=$recv($12)._asJavaScriptSource();
  31549. $10=$recv($11)._replace_with_(",\x5cs*[\x22']:1:[\x22']",pragmaStart);
  31550. $ctx1.sendIdx["replace:with:"]=2;
  31551. $9=$recv($10)._replace_with_(",\x5cs*[\x22']:2:[\x22']",pragmaEnd);
  31552. $ctx1.sendIdx["replace:with:"]=1;
  31553. $18=$recv(["$boot", ":1:"].__comma($recv(importsForOutput)._key())).__comma([":2:"]);
  31554. $ctx1.sendIdx[","]=8;
  31555. $17=$recv($18)._join_(",");
  31556. $16=$recv($17)._replace_with_(",\x5cs*:1:",pragmaStart);
  31557. $15=$recv($16)._replace_with_(",\x5cs*:2:",pragmaEnd);
  31558. $ctx1.sendIdx["replace:with:"]=3;
  31559. $8=["define(",$9,", function(",$15,"){\x22use strict\x22;"];
  31560. $recv(aStream)._write_($8);
  31561. $recv(aStream)._lf();
  31562. $self._exportPackageBodyBlockPrologueOf_on_(aPackage,aStream);
  31563. return self;
  31564. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream,importsForOutput:importsForOutput,loadDependencies:loadDependencies,pragmaStart:pragmaStart,pragmaEnd:pragmaEnd},$globals.AmdExporter)});
  31565. },
  31566. args: ["aPackage", "aStream"],
  31567. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09| importsForOutput loadDependencies pragmaStart pragmaEnd |\x0a\x09pragmaStart := ''.\x0a\x09pragmaEnd := ''.\x0a\x09importsForOutput := self importsForOutput: aPackage.\x0a\x09loadDependencies := self amdNamesOfPackages: aPackage loadDependencies.\x0a\x09importsForOutput value ifNotEmpty: [\x0a\x09\x09pragmaStart := String lf, '//>>excludeStart(\x22imports\x22, pragmas.excludeImports);', String lf.\x0a\x09\x09pragmaEnd := String lf, '//>>excludeEnd(\x22imports\x22);', String lf ].\x0a\x09aStream\x0a\x09\x09write: {\x0a\x09\x09\x09'define('.\x0a\x09\x09\x09((#('amber/boot' ':1:'), importsForOutput value, #(':2:'), loadDependencies asArray sorted) asJavaScriptSource\x0a\x09\x09\x09\x09replace: ',\x5cs*[\x22'']:1:[\x22'']' with: pragmaStart)\x0a\x09\x09\x09\x09replace: ',\x5cs*[\x22'']:2:[\x22'']' with: pragmaEnd.\x0a\x09\x09\x09', function('.\x0a\x09\x09\x09((((#('$boot' ':1:'), importsForOutput key, #(':2:')) join: ',') \x0a\x09\x09\x09\x09replace: ',\x5cs*:1:' with: pragmaStart)\x0a\x09\x09\x09\x09replace: ',\x5cs*:2:' with: pragmaEnd).\x0a\x09\x09\x09'){\x22use strict\x22;' };\x0a\x09\x09lf.\x0a\x09self exportPackageBodyBlockPrologueOf: aPackage on: aStream",
  31568. referencedClasses: ["String"],
  31569. messageSends: ["importsForOutput:", "amdNamesOfPackages:", "loadDependencies", "ifNotEmpty:", "value", ",", "lf", "write:", "replace:with:", "asJavaScriptSource", "sorted", "asArray", "join:", "key", "exportPackageBodyBlockPrologueOf:on:"]
  31570. }),
  31571. $globals.AmdExporter);
  31572. $core.addMethod(
  31573. $core.method({
  31574. selector: "importsForOutput:",
  31575. protocol: "private",
  31576. fn: function (aPackage){
  31577. var self=this,$self=this;
  31578. var namedImports,anonImports,importVarNames;
  31579. return $core.withContext(function($ctx1) {
  31580. var $1;
  31581. namedImports=[];
  31582. anonImports=[];
  31583. importVarNames=[];
  31584. $recv($recv(aPackage)._imports())._do_((function(each){
  31585. return $core.withContext(function($ctx2) {
  31586. $1=$recv(each)._isString();
  31587. if($core.assert($1)){
  31588. return $recv(anonImports)._add_(each);
  31589. $ctx2.sendIdx["add:"]=1;
  31590. } else {
  31591. $recv(namedImports)._add_($recv(each)._value());
  31592. $ctx2.sendIdx["add:"]=2;
  31593. return $recv(importVarNames)._add_($recv(each)._key());
  31594. }
  31595. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31596. }));
  31597. return $recv(importVarNames).__minus_gt($recv(namedImports).__comma(anonImports));
  31598. }, function($ctx1) {$ctx1.fill(self,"importsForOutput:",{aPackage:aPackage,namedImports:namedImports,anonImports:anonImports,importVarNames:importVarNames},$globals.AmdExporter)});
  31599. },
  31600. args: ["aPackage"],
  31601. 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)",
  31602. referencedClasses: [],
  31603. messageSends: ["do:", "imports", "ifTrue:ifFalse:", "isString", "add:", "value", "key", "->", ","]
  31604. }),
  31605. $globals.AmdExporter);
  31606. $core.addClass("ChunkParser", $globals.Object, ["stream", "last"], "Platform-ImportExport");
  31607. $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";
  31608. $core.addMethod(
  31609. $core.method({
  31610. selector: "last",
  31611. protocol: "accessing",
  31612. fn: function (){
  31613. var self=this,$self=this;
  31614. return $self["@last"];
  31615. },
  31616. args: [],
  31617. source: "last\x0a\x09^ last",
  31618. referencedClasses: [],
  31619. messageSends: []
  31620. }),
  31621. $globals.ChunkParser);
  31622. $core.addMethod(
  31623. $core.method({
  31624. selector: "nextChunk",
  31625. protocol: "reading",
  31626. fn: function (){
  31627. var self=this,$self=this;
  31628. var char,result,chunk;
  31629. return $core.withContext(function($ctx1) {
  31630. var $1,$2,$3,$4;
  31631. var $early={};
  31632. try {
  31633. result=""._writeStream();
  31634. $recv((function(){
  31635. return $core.withContext(function($ctx2) {
  31636. char=$recv($self["@stream"])._next();
  31637. $ctx2.sendIdx["next"]=1;
  31638. return $recv(char)._notNil();
  31639. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31640. }))._whileTrue_((function(){
  31641. return $core.withContext(function($ctx2) {
  31642. $1=$recv(char).__eq("!");
  31643. $ctx2.sendIdx["="]=1;
  31644. if($core.assert($1)){
  31645. $2=$recv($recv($self["@stream"])._peek()).__eq("!");
  31646. if($core.assert($2)){
  31647. $recv($self["@stream"])._next();
  31648. } else {
  31649. $self["@last"]=$recv($recv(result)._contents())._trimBoth();
  31650. $3=$self["@last"];
  31651. throw $early=[$3];
  31652. }
  31653. }
  31654. return $recv(result)._nextPut_(char);
  31655. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  31656. }));
  31657. $self["@last"]=nil;
  31658. $4=$self["@last"];
  31659. return $4;
  31660. }
  31661. catch(e) {if(e===$early)return e[0]; throw e}
  31662. }, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk},$globals.ChunkParser)});
  31663. },
  31664. args: [],
  31665. 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",
  31666. referencedClasses: [],
  31667. messageSends: ["writeStream", "whileTrue:", "next", "notNil", "ifTrue:", "=", "ifTrue:ifFalse:", "peek", "trimBoth", "contents", "nextPut:"]
  31668. }),
  31669. $globals.ChunkParser);
  31670. $core.addMethod(
  31671. $core.method({
  31672. selector: "stream:",
  31673. protocol: "accessing",
  31674. fn: function (aStream){
  31675. var self=this,$self=this;
  31676. $self["@stream"]=aStream;
  31677. return self;
  31678. },
  31679. args: ["aStream"],
  31680. source: "stream: aStream\x0a\x09stream := aStream",
  31681. referencedClasses: [],
  31682. messageSends: []
  31683. }),
  31684. $globals.ChunkParser);
  31685. $core.addMethod(
  31686. $core.method({
  31687. selector: "on:",
  31688. protocol: "instance creation",
  31689. fn: function (aStream){
  31690. var self=this,$self=this;
  31691. return $core.withContext(function($ctx1) {
  31692. return $recv($self._new())._stream_(aStream);
  31693. }, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream},$globals.ChunkParser.a$cls)});
  31694. },
  31695. args: ["aStream"],
  31696. source: "on: aStream\x0a\x09^ self new stream: aStream",
  31697. referencedClasses: [],
  31698. messageSends: ["stream:", "new"]
  31699. }),
  31700. $globals.ChunkParser.a$cls);
  31701. $core.addClass("ClassCommentReader", $globals.Object, ["class"], "Platform-ImportExport");
  31702. $globals.ClassCommentReader.comment="I provide a mechanism for retrieving class comments stored on a file.\x0a\x0aSee also `ClassCategoryReader`.";
  31703. $core.addMethod(
  31704. $core.method({
  31705. selector: "class:",
  31706. protocol: "accessing",
  31707. fn: function (aClass){
  31708. var self=this,$self=this;
  31709. $self["@class"]=aClass;
  31710. return self;
  31711. },
  31712. args: ["aClass"],
  31713. source: "class: aClass\x0a\x09class := aClass",
  31714. referencedClasses: [],
  31715. messageSends: []
  31716. }),
  31717. $globals.ClassCommentReader);
  31718. $core.addMethod(
  31719. $core.method({
  31720. selector: "initialize",
  31721. protocol: "initialization",
  31722. fn: function (){
  31723. var self=this,$self=this;
  31724. return $core.withContext(function($ctx1) {
  31725. (
  31726. $ctx1.supercall = true,
  31727. ($globals.ClassCommentReader.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  31728. $ctx1.supercall = false;
  31729. return self;
  31730. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassCommentReader)});
  31731. },
  31732. args: [],
  31733. source: "initialize\x0a\x09super initialize.",
  31734. referencedClasses: [],
  31735. messageSends: ["initialize"]
  31736. }),
  31737. $globals.ClassCommentReader);
  31738. $core.addMethod(
  31739. $core.method({
  31740. selector: "scanFrom:",
  31741. protocol: "fileIn",
  31742. fn: function (aChunkParser){
  31743. var self=this,$self=this;
  31744. var chunk;
  31745. return $core.withContext(function($ctx1) {
  31746. chunk=$recv(aChunkParser)._nextChunk();
  31747. $recv(chunk)._ifNotEmpty_((function(){
  31748. return $core.withContext(function($ctx2) {
  31749. return $self._setComment_(chunk);
  31750. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31751. }));
  31752. return self;
  31753. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassCommentReader)});
  31754. },
  31755. args: ["aChunkParser"],
  31756. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk ifNotEmpty: [\x0a\x09\x09self setComment: chunk ].",
  31757. referencedClasses: [],
  31758. messageSends: ["nextChunk", "ifNotEmpty:", "setComment:"]
  31759. }),
  31760. $globals.ClassCommentReader);
  31761. $core.addMethod(
  31762. $core.method({
  31763. selector: "setComment:",
  31764. protocol: "private",
  31765. fn: function (aString){
  31766. var self=this,$self=this;
  31767. return $core.withContext(function($ctx1) {
  31768. $recv($self["@class"])._comment_(aString);
  31769. return self;
  31770. }, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString},$globals.ClassCommentReader)});
  31771. },
  31772. args: ["aString"],
  31773. source: "setComment: aString\x0a\x09class comment: aString",
  31774. referencedClasses: [],
  31775. messageSends: ["comment:"]
  31776. }),
  31777. $globals.ClassCommentReader);
  31778. $core.addClass("ClassProtocolReader", $globals.Object, ["class", "category"], "Platform-ImportExport");
  31779. $globals.ClassProtocolReader.comment="I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format.";
  31780. $core.addMethod(
  31781. $core.method({
  31782. selector: "class:category:",
  31783. protocol: "accessing",
  31784. fn: function (aClass,aString){
  31785. var self=this,$self=this;
  31786. $self["@class"]=aClass;
  31787. $self["@category"]=aString;
  31788. return self;
  31789. },
  31790. args: ["aClass", "aString"],
  31791. source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
  31792. referencedClasses: [],
  31793. messageSends: []
  31794. }),
  31795. $globals.ClassProtocolReader);
  31796. $core.addMethod(
  31797. $core.method({
  31798. selector: "compileMethod:",
  31799. protocol: "private",
  31800. fn: function (aString){
  31801. var self=this,$self=this;
  31802. return $core.withContext(function($ctx1) {
  31803. $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,$self["@class"],$self["@category"]);
  31804. return self;
  31805. }, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString},$globals.ClassProtocolReader)});
  31806. },
  31807. args: ["aString"],
  31808. source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class protocol: category",
  31809. referencedClasses: ["Compiler"],
  31810. messageSends: ["install:forClass:protocol:", "new"]
  31811. }),
  31812. $globals.ClassProtocolReader);
  31813. $core.addMethod(
  31814. $core.method({
  31815. selector: "initialize",
  31816. protocol: "initialization",
  31817. fn: function (){
  31818. var self=this,$self=this;
  31819. return $core.withContext(function($ctx1) {
  31820. (
  31821. $ctx1.supercall = true,
  31822. ($globals.ClassProtocolReader.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  31823. $ctx1.supercall = false;
  31824. return self;
  31825. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassProtocolReader)});
  31826. },
  31827. args: [],
  31828. source: "initialize\x0a\x09super initialize.",
  31829. referencedClasses: [],
  31830. messageSends: ["initialize"]
  31831. }),
  31832. $globals.ClassProtocolReader);
  31833. $core.addMethod(
  31834. $core.method({
  31835. selector: "scanFrom:",
  31836. protocol: "fileIn",
  31837. fn: function (aChunkParser){
  31838. var self=this,$self=this;
  31839. var chunk;
  31840. return $core.withContext(function($ctx1) {
  31841. $recv((function(){
  31842. return $core.withContext(function($ctx2) {
  31843. chunk=$recv(aChunkParser)._nextChunk();
  31844. return $recv(chunk)._isEmpty();
  31845. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31846. }))._whileFalse_((function(){
  31847. return $core.withContext(function($ctx2) {
  31848. return $self._compileMethod_(chunk);
  31849. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  31850. }));
  31851. return self;
  31852. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassProtocolReader)});
  31853. },
  31854. args: ["aChunkParser"],
  31855. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09[ chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ] whileFalse: [\x0a\x09\x09self compileMethod: chunk ]",
  31856. referencedClasses: [],
  31857. messageSends: ["whileFalse:", "nextChunk", "isEmpty", "compileMethod:"]
  31858. }),
  31859. $globals.ClassProtocolReader);
  31860. $core.addClass("ExportMethodProtocol", $globals.Object, ["name", "theClass"], "Platform-ImportExport");
  31861. $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.";
  31862. $core.addMethod(
  31863. $core.method({
  31864. selector: "methods",
  31865. protocol: "accessing",
  31866. fn: function (){
  31867. var self=this,$self=this;
  31868. return $core.withContext(function($ctx1) {
  31869. var $1;
  31870. return $recv($recv($self._theClass())._methodsInProtocol_($self._name()))._sorted_((function(a,b){
  31871. return $core.withContext(function($ctx2) {
  31872. $1=$recv(a)._selector();
  31873. $ctx2.sendIdx["selector"]=1;
  31874. return $recv($1).__lt_eq($recv(b)._selector());
  31875. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  31876. }));
  31877. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.ExportMethodProtocol)});
  31878. },
  31879. args: [],
  31880. source: "methods\x0a\x09^ (self theClass methodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  31881. referencedClasses: [],
  31882. messageSends: ["sorted:", "methodsInProtocol:", "theClass", "name", "<=", "selector"]
  31883. }),
  31884. $globals.ExportMethodProtocol);
  31885. $core.addMethod(
  31886. $core.method({
  31887. selector: "name",
  31888. protocol: "accessing",
  31889. fn: function (){
  31890. var self=this,$self=this;
  31891. return $self["@name"];
  31892. },
  31893. args: [],
  31894. source: "name\x0a\x09^ name",
  31895. referencedClasses: [],
  31896. messageSends: []
  31897. }),
  31898. $globals.ExportMethodProtocol);
  31899. $core.addMethod(
  31900. $core.method({
  31901. selector: "name:",
  31902. protocol: "accessing",
  31903. fn: function (aString){
  31904. var self=this,$self=this;
  31905. $self["@name"]=aString;
  31906. return self;
  31907. },
  31908. args: ["aString"],
  31909. source: "name: aString\x0a\x09name := aString",
  31910. referencedClasses: [],
  31911. messageSends: []
  31912. }),
  31913. $globals.ExportMethodProtocol);
  31914. $core.addMethod(
  31915. $core.method({
  31916. selector: "ownMethods",
  31917. protocol: "accessing",
  31918. fn: function (){
  31919. var self=this,$self=this;
  31920. return $core.withContext(function($ctx1) {
  31921. var $1;
  31922. return $recv($recv($self._theClass())._ownMethodsInProtocol_($self._name()))._sorted_((function(a,b){
  31923. return $core.withContext(function($ctx2) {
  31924. $1=$recv(a)._selector();
  31925. $ctx2.sendIdx["selector"]=1;
  31926. return $recv($1).__lt_eq($recv(b)._selector());
  31927. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  31928. }));
  31929. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.ExportMethodProtocol)});
  31930. },
  31931. args: [],
  31932. source: "ownMethods\x0a\x09^ (self theClass ownMethodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  31933. referencedClasses: [],
  31934. messageSends: ["sorted:", "ownMethodsInProtocol:", "theClass", "name", "<=", "selector"]
  31935. }),
  31936. $globals.ExportMethodProtocol);
  31937. $core.addMethod(
  31938. $core.method({
  31939. selector: "theClass",
  31940. protocol: "accessing",
  31941. fn: function (){
  31942. var self=this,$self=this;
  31943. return $self["@theClass"];
  31944. },
  31945. args: [],
  31946. source: "theClass\x0a\x09^ theClass",
  31947. referencedClasses: [],
  31948. messageSends: []
  31949. }),
  31950. $globals.ExportMethodProtocol);
  31951. $core.addMethod(
  31952. $core.method({
  31953. selector: "theClass:",
  31954. protocol: "accessing",
  31955. fn: function (aClass){
  31956. var self=this,$self=this;
  31957. $self["@theClass"]=aClass;
  31958. return self;
  31959. },
  31960. args: ["aClass"],
  31961. source: "theClass: aClass\x0a\x09theClass := aClass",
  31962. referencedClasses: [],
  31963. messageSends: []
  31964. }),
  31965. $globals.ExportMethodProtocol);
  31966. $core.addMethod(
  31967. $core.method({
  31968. selector: "name:theClass:",
  31969. protocol: "instance creation",
  31970. fn: function (aString,aClass){
  31971. var self=this,$self=this;
  31972. return $core.withContext(function($ctx1) {
  31973. var $1;
  31974. $1=$self._new();
  31975. $recv($1)._name_(aString);
  31976. $recv($1)._theClass_(aClass);
  31977. return $recv($1)._yourself();
  31978. }, function($ctx1) {$ctx1.fill(self,"name:theClass:",{aString:aString,aClass:aClass},$globals.ExportMethodProtocol.a$cls)});
  31979. },
  31980. args: ["aString", "aClass"],
  31981. source: "name: aString theClass: aClass\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  31982. referencedClasses: [],
  31983. messageSends: ["name:", "new", "theClass:", "yourself"]
  31984. }),
  31985. $globals.ExportMethodProtocol.a$cls);
  31986. $core.addClass("Importer", $globals.Object, ["lastSection", "lastChunk"], "Platform-ImportExport");
  31987. $globals.Importer.comment="I can import Amber code from a string in the chunk format.\x0a\x0a## API\x0a\x0a Importer new import: aString";
  31988. $core.addMethod(
  31989. $core.method({
  31990. selector: "import:",
  31991. protocol: "fileIn",
  31992. fn: function (aStream){
  31993. var self=this,$self=this;
  31994. var chunk,result,parser,lastEmpty;
  31995. return $core.withContext(function($ctx1) {
  31996. var $1;
  31997. parser=$recv($globals.ChunkParser)._on_(aStream);
  31998. lastEmpty=false;
  31999. $self["@lastSection"]="n/a, not started";
  32000. $self["@lastChunk"]=nil;
  32001. $recv((function(){
  32002. return $core.withContext(function($ctx2) {
  32003. $recv((function(){
  32004. return $core.withContext(function($ctx3) {
  32005. chunk=$recv(parser)._nextChunk();
  32006. return $recv(chunk)._isNil();
  32007. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  32008. }))._whileFalse_((function(){
  32009. return $core.withContext(function($ctx3) {
  32010. return $recv(chunk)._ifEmpty_ifNotEmpty_((function(){
  32011. lastEmpty=true;
  32012. return lastEmpty;
  32013. }),(function(){
  32014. return $core.withContext(function($ctx4) {
  32015. $self["@lastSection"]=chunk;
  32016. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_(chunk);
  32017. $1=lastEmpty;
  32018. if($core.assert($1)){
  32019. lastEmpty=false;
  32020. return $recv(result)._scanFrom_(parser);
  32021. }
  32022. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,5)});
  32023. }));
  32024. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  32025. }));
  32026. $self["@lastSection"]="n/a, finished";
  32027. return $self["@lastSection"];
  32028. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32029. }))._on_do_($globals.Error,(function(e){
  32030. return $core.withContext(function($ctx2) {
  32031. $self["@lastChunk"]=$recv(parser)._last();
  32032. return $recv(e)._pass();
  32033. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,7)});
  32034. }));
  32035. return self;
  32036. }, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty},$globals.Importer)});
  32037. },
  32038. args: ["aStream"],
  32039. 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 ].",
  32040. referencedClasses: ["ChunkParser", "Compiler", "Error"],
  32041. messageSends: ["on:", "on:do:", "whileFalse:", "nextChunk", "isNil", "ifEmpty:ifNotEmpty:", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "last", "pass"]
  32042. }),
  32043. $globals.Importer);
  32044. $core.addMethod(
  32045. $core.method({
  32046. selector: "lastChunk",
  32047. protocol: "accessing",
  32048. fn: function (){
  32049. var self=this,$self=this;
  32050. return $self["@lastChunk"];
  32051. },
  32052. args: [],
  32053. source: "lastChunk\x0a\x09^ lastChunk",
  32054. referencedClasses: [],
  32055. messageSends: []
  32056. }),
  32057. $globals.Importer);
  32058. $core.addMethod(
  32059. $core.method({
  32060. selector: "lastSection",
  32061. protocol: "accessing",
  32062. fn: function (){
  32063. var self=this,$self=this;
  32064. return $self["@lastSection"];
  32065. },
  32066. args: [],
  32067. source: "lastSection\x0a\x09^ lastSection",
  32068. referencedClasses: [],
  32069. messageSends: []
  32070. }),
  32071. $globals.Importer);
  32072. $core.addClass("PackageCommitError", $globals.Error, [], "Platform-ImportExport");
  32073. $globals.PackageCommitError.comment="I get signaled when an attempt to commit a package has failed.";
  32074. $core.addClass("PackageHandler", $globals.Object, [], "Platform-ImportExport");
  32075. $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.";
  32076. $core.addMethod(
  32077. $core.method({
  32078. selector: "ajaxPutAt:data:onSuccess:onError:",
  32079. protocol: "private",
  32080. fn: function (aURL,aString,aBlock,anotherBlock){
  32081. var self=this,$self=this;
  32082. var xhr;
  32083. return $core.withContext(function($ctx1) {
  32084. var $1,$4,$3,$2;
  32085. xhr=$recv($globals.Platform)._newXhr();
  32086. $recv(xhr)._open_url_async_("PUT",aURL,true);
  32087. $recv(xhr)._onreadystatechange_((function(){
  32088. return $core.withContext(function($ctx2) {
  32089. $1=$recv($recv(xhr)._readyState()).__eq((4));
  32090. if($core.assert($1)){
  32091. $4=$recv(xhr)._status();
  32092. $ctx2.sendIdx["status"]=1;
  32093. $3=$recv($4).__gt_eq((200));
  32094. $2=$recv($3)._and_((function(){
  32095. return $core.withContext(function($ctx3) {
  32096. return $recv($recv(xhr)._status()).__lt((300));
  32097. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  32098. }));
  32099. return $recv($2)._ifTrue_ifFalse_(aBlock,anotherBlock);
  32100. }
  32101. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32102. }));
  32103. $recv(xhr)._send_(aString);
  32104. return self;
  32105. }, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:onSuccess:onError:",{aURL:aURL,aString:aString,aBlock:aBlock,anotherBlock:anotherBlock,xhr:xhr},$globals.PackageHandler)});
  32106. },
  32107. args: ["aURL", "aString", "aBlock", "anotherBlock"],
  32108. 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",
  32109. referencedClasses: ["Platform"],
  32110. messageSends: ["newXhr", "open:url:async:", "onreadystatechange:", "ifTrue:", "=", "readyState", "ifTrue:ifFalse:", "and:", ">=", "status", "<", "send:"]
  32111. }),
  32112. $globals.PackageHandler);
  32113. $core.addMethod(
  32114. $core.method({
  32115. selector: "chunkContentsFor:",
  32116. protocol: "accessing",
  32117. fn: function (aPackage){
  32118. var self=this,$self=this;
  32119. return $core.withContext(function($ctx1) {
  32120. return $recv($globals.String)._streamContents_((function(str){
  32121. return $core.withContext(function($ctx2) {
  32122. return $recv($self._chunkExporter())._exportPackage_on_(aPackage,str);
  32123. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  32124. }));
  32125. }, function($ctx1) {$ctx1.fill(self,"chunkContentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32126. },
  32127. args: ["aPackage"],
  32128. source: "chunkContentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self chunkExporter exportPackage: aPackage on: str ]",
  32129. referencedClasses: ["String"],
  32130. messageSends: ["streamContents:", "exportPackage:on:", "chunkExporter"]
  32131. }),
  32132. $globals.PackageHandler);
  32133. $core.addMethod(
  32134. $core.method({
  32135. selector: "chunkExporter",
  32136. protocol: "factory",
  32137. fn: function (){
  32138. var self=this,$self=this;
  32139. return $core.withContext(function($ctx1) {
  32140. return $recv($self._chunkExporterClass())._new();
  32141. }, function($ctx1) {$ctx1.fill(self,"chunkExporter",{},$globals.PackageHandler)});
  32142. },
  32143. args: [],
  32144. source: "chunkExporter\x0a\x09^ self chunkExporterClass new",
  32145. referencedClasses: [],
  32146. messageSends: ["new", "chunkExporterClass"]
  32147. }),
  32148. $globals.PackageHandler);
  32149. $core.addMethod(
  32150. $core.method({
  32151. selector: "chunkExporterClass",
  32152. protocol: "accessing",
  32153. fn: function (){
  32154. var self=this,$self=this;
  32155. return $globals.ChunkExporter;
  32156. },
  32157. args: [],
  32158. source: "chunkExporterClass\x0a\x09^ ChunkExporter",
  32159. referencedClasses: ["ChunkExporter"],
  32160. messageSends: []
  32161. }),
  32162. $globals.PackageHandler);
  32163. $core.addMethod(
  32164. $core.method({
  32165. selector: "commit:",
  32166. protocol: "committing",
  32167. fn: function (aPackage){
  32168. var self=this,$self=this;
  32169. return $core.withContext(function($ctx1) {
  32170. var $1,$2;
  32171. $self._commit_onSuccess_onError_(aPackage,(function(){
  32172. }),(function(error){
  32173. return $core.withContext(function($ctx2) {
  32174. $1=$recv($globals.PackageCommitError)._new();
  32175. $2=$recv("Commiting failed with reason: \x22".__comma($recv(error)._responseText())).__comma("\x22");
  32176. $ctx2.sendIdx[","]=1;
  32177. $recv($1)._messageText_($2);
  32178. return $recv($1)._signal();
  32179. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  32180. }));
  32181. return self;
  32182. }, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage},$globals.PackageHandler)});
  32183. },
  32184. args: ["aPackage"],
  32185. 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 ]",
  32186. referencedClasses: ["PackageCommitError"],
  32187. messageSends: ["commit:onSuccess:onError:", "messageText:", "new", ",", "responseText", "signal"]
  32188. }),
  32189. $globals.PackageHandler);
  32190. $core.addMethod(
  32191. $core.method({
  32192. selector: "commit:onSuccess:onError:",
  32193. protocol: "committing",
  32194. fn: function (aPackage,aBlock,anotherBlock){
  32195. var self=this,$self=this;
  32196. return $core.withContext(function($ctx1) {
  32197. $self._commitJsFileFor_onSuccess_onError_(aPackage,(function(){
  32198. return $core.withContext(function($ctx2) {
  32199. return $self._commitStFileFor_onSuccess_onError_(aPackage,(function(){
  32200. return $core.withContext(function($ctx3) {
  32201. $recv(aPackage)._beClean();
  32202. return $recv(aBlock)._value();
  32203. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  32204. }),anotherBlock);
  32205. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32206. }),anotherBlock);
  32207. return self;
  32208. }, function($ctx1) {$ctx1.fill(self,"commit:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  32209. },
  32210. args: ["aPackage", "aBlock", "anotherBlock"],
  32211. 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",
  32212. referencedClasses: [],
  32213. messageSends: ["commitJsFileFor:onSuccess:onError:", "commitStFileFor:onSuccess:onError:", "beClean", "value"]
  32214. }),
  32215. $globals.PackageHandler);
  32216. $core.addMethod(
  32217. $core.method({
  32218. selector: "commitJsFileFor:onSuccess:onError:",
  32219. protocol: "committing",
  32220. fn: function (aPackage,aBlock,anotherBlock){
  32221. var self=this,$self=this;
  32222. return $core.withContext(function($ctx1) {
  32223. var $2,$1;
  32224. $2=$recv($recv($self._commitPathJsFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  32225. $ctx1.sendIdx[","]=2;
  32226. $1=$recv($2).__comma(".js");
  32227. $ctx1.sendIdx[","]=1;
  32228. $self._ajaxPutAt_data_onSuccess_onError_($1,$self._contentsFor_(aPackage),aBlock,anotherBlock);
  32229. return self;
  32230. }, function($ctx1) {$ctx1.fill(self,"commitJsFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  32231. },
  32232. args: ["aPackage", "aBlock", "anotherBlock"],
  32233. 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",
  32234. referencedClasses: [],
  32235. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathJsFor:", "name", "contentsFor:"]
  32236. }),
  32237. $globals.PackageHandler);
  32238. $core.addMethod(
  32239. $core.method({
  32240. selector: "commitPathJsFor:",
  32241. protocol: "accessing",
  32242. fn: function (aPackage){
  32243. var self=this,$self=this;
  32244. return $core.withContext(function($ctx1) {
  32245. $self._subclassResponsibility();
  32246. return self;
  32247. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32248. },
  32249. args: ["aPackage"],
  32250. source: "commitPathJsFor: aPackage\x0a\x09self subclassResponsibility",
  32251. referencedClasses: [],
  32252. messageSends: ["subclassResponsibility"]
  32253. }),
  32254. $globals.PackageHandler);
  32255. $core.addMethod(
  32256. $core.method({
  32257. selector: "commitPathStFor:",
  32258. protocol: "accessing",
  32259. fn: function (aPackage){
  32260. var self=this,$self=this;
  32261. return $core.withContext(function($ctx1) {
  32262. $self._subclassResponsibility();
  32263. return self;
  32264. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32265. },
  32266. args: ["aPackage"],
  32267. source: "commitPathStFor: aPackage\x0a\x09self subclassResponsibility",
  32268. referencedClasses: [],
  32269. messageSends: ["subclassResponsibility"]
  32270. }),
  32271. $globals.PackageHandler);
  32272. $core.addMethod(
  32273. $core.method({
  32274. selector: "commitStFileFor:onSuccess:onError:",
  32275. protocol: "committing",
  32276. fn: function (aPackage,aBlock,anotherBlock){
  32277. var self=this,$self=this;
  32278. return $core.withContext(function($ctx1) {
  32279. var $2,$1;
  32280. $2=$recv($recv($self._commitPathStFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  32281. $ctx1.sendIdx[","]=2;
  32282. $1=$recv($2).__comma(".st");
  32283. $ctx1.sendIdx[","]=1;
  32284. $self._ajaxPutAt_data_onSuccess_onError_($1,$self._chunkContentsFor_(aPackage),aBlock,anotherBlock);
  32285. return self;
  32286. }, function($ctx1) {$ctx1.fill(self,"commitStFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  32287. },
  32288. args: ["aPackage", "aBlock", "anotherBlock"],
  32289. 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",
  32290. referencedClasses: [],
  32291. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathStFor:", "name", "chunkContentsFor:"]
  32292. }),
  32293. $globals.PackageHandler);
  32294. $core.addMethod(
  32295. $core.method({
  32296. selector: "contentsFor:",
  32297. protocol: "accessing",
  32298. fn: function (aPackage){
  32299. var self=this,$self=this;
  32300. return $core.withContext(function($ctx1) {
  32301. return $recv($globals.String)._streamContents_((function(str){
  32302. return $core.withContext(function($ctx2) {
  32303. return $recv($self._exporter())._exportPackage_on_(aPackage,str);
  32304. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  32305. }));
  32306. }, function($ctx1) {$ctx1.fill(self,"contentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32307. },
  32308. args: ["aPackage"],
  32309. source: "contentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self exporter exportPackage: aPackage on: str ]",
  32310. referencedClasses: ["String"],
  32311. messageSends: ["streamContents:", "exportPackage:on:", "exporter"]
  32312. }),
  32313. $globals.PackageHandler);
  32314. $core.addMethod(
  32315. $core.method({
  32316. selector: "exporter",
  32317. protocol: "factory",
  32318. fn: function (){
  32319. var self=this,$self=this;
  32320. return $core.withContext(function($ctx1) {
  32321. return $recv($self._exporterClass())._new();
  32322. }, function($ctx1) {$ctx1.fill(self,"exporter",{},$globals.PackageHandler)});
  32323. },
  32324. args: [],
  32325. source: "exporter\x0a\x09^ self exporterClass new",
  32326. referencedClasses: [],
  32327. messageSends: ["new", "exporterClass"]
  32328. }),
  32329. $globals.PackageHandler);
  32330. $core.addMethod(
  32331. $core.method({
  32332. selector: "exporterClass",
  32333. protocol: "accessing",
  32334. fn: function (){
  32335. var self=this,$self=this;
  32336. return $core.withContext(function($ctx1) {
  32337. $self._subclassResponsibility();
  32338. return self;
  32339. }, function($ctx1) {$ctx1.fill(self,"exporterClass",{},$globals.PackageHandler)});
  32340. },
  32341. args: [],
  32342. source: "exporterClass\x0a\x09self subclassResponsibility",
  32343. referencedClasses: [],
  32344. messageSends: ["subclassResponsibility"]
  32345. }),
  32346. $globals.PackageHandler);
  32347. $core.addMethod(
  32348. $core.method({
  32349. selector: "load:",
  32350. protocol: "loading",
  32351. fn: function (aPackage){
  32352. var self=this,$self=this;
  32353. return $core.withContext(function($ctx1) {
  32354. $self._subclassResponsibility();
  32355. return self;
  32356. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.PackageHandler)});
  32357. },
  32358. args: ["aPackage"],
  32359. source: "load: aPackage\x0a\x09\x22Should return a TThenable\x22\x0a\x09self subclassResponsibility",
  32360. referencedClasses: [],
  32361. messageSends: ["subclassResponsibility"]
  32362. }),
  32363. $globals.PackageHandler);
  32364. $core.addMethod(
  32365. $core.method({
  32366. selector: "onCommitError:",
  32367. protocol: "error handling",
  32368. fn: function (anError){
  32369. var self=this,$self=this;
  32370. return $core.withContext(function($ctx1) {
  32371. var $1,$2;
  32372. $1=$recv($globals.PackageCommitError)._new();
  32373. $2=$recv("Commiting failed with reason: \x22".__comma($recv(anError)._responseText())).__comma("\x22");
  32374. $ctx1.sendIdx[","]=1;
  32375. $recv($1)._messageText_($2);
  32376. $recv($1)._signal();
  32377. return self;
  32378. }, function($ctx1) {$ctx1.fill(self,"onCommitError:",{anError:anError},$globals.PackageHandler)});
  32379. },
  32380. args: ["anError"],
  32381. source: "onCommitError: anError\x0a\x09PackageCommitError new\x0a\x09\x09messageText: 'Commiting failed with reason: \x22' , (anError responseText) , '\x22';\x0a\x09\x09signal",
  32382. referencedClasses: ["PackageCommitError"],
  32383. messageSends: ["messageText:", "new", ",", "responseText", "signal"]
  32384. }),
  32385. $globals.PackageHandler);
  32386. $core.addClass("AmdPackageHandler", $globals.PackageHandler, [], "Platform-ImportExport");
  32387. $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.";
  32388. $core.addMethod(
  32389. $core.method({
  32390. selector: "commitPathJsFor:",
  32391. protocol: "accessing",
  32392. fn: function (aPackage){
  32393. var self=this,$self=this;
  32394. return $core.withContext(function($ctx1) {
  32395. return $self._toUrl_($self._namespaceFor_(aPackage));
  32396. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  32397. },
  32398. args: ["aPackage"],
  32399. source: "commitPathJsFor: aPackage\x0a\x09^ self toUrl: (self namespaceFor: aPackage)",
  32400. referencedClasses: [],
  32401. messageSends: ["toUrl:", "namespaceFor:"]
  32402. }),
  32403. $globals.AmdPackageHandler);
  32404. $core.addMethod(
  32405. $core.method({
  32406. selector: "commitPathStFor:",
  32407. protocol: "accessing",
  32408. fn: function (aPackage){
  32409. var self=this,$self=this;
  32410. var path,pathWithout;
  32411. return $core.withContext(function($ctx1) {
  32412. var $1,$2;
  32413. $1=$recv($self._namespaceFor_(aPackage)).__comma("/_source");
  32414. $ctx1.sendIdx[","]=1;
  32415. path=$self._toUrl_($1);
  32416. pathWithout=$self._commitPathJsFor_(aPackage);
  32417. $2=$recv(path).__eq($recv(pathWithout).__comma("/_source"));
  32418. if($core.assert($2)){
  32419. return pathWithout;
  32420. } else {
  32421. return path;
  32422. }
  32423. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage,path:path,pathWithout:pathWithout},$globals.AmdPackageHandler)});
  32424. },
  32425. args: ["aPackage"],
  32426. 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 ]",
  32427. referencedClasses: [],
  32428. messageSends: ["toUrl:", ",", "namespaceFor:", "commitPathJsFor:", "ifTrue:ifFalse:", "="]
  32429. }),
  32430. $globals.AmdPackageHandler);
  32431. $core.addMethod(
  32432. $core.method({
  32433. selector: "exporterClass",
  32434. protocol: "accessing",
  32435. fn: function (){
  32436. var self=this,$self=this;
  32437. return $globals.AmdExporter;
  32438. },
  32439. args: [],
  32440. source: "exporterClass\x0a\x09^ AmdExporter",
  32441. referencedClasses: ["AmdExporter"],
  32442. messageSends: []
  32443. }),
  32444. $globals.AmdPackageHandler);
  32445. $core.addMethod(
  32446. $core.method({
  32447. selector: "load:",
  32448. protocol: "loading",
  32449. fn: function (aPackage){
  32450. var self=this,$self=this;
  32451. return $core.withContext(function($ctx1) {
  32452. var $1,$3,$2,$receiver;
  32453. return $recv($globals.Promise)._new_((function(model){
  32454. return $core.withContext(function($ctx2) {
  32455. $1=$recv($globals.Smalltalk)._amdRequire();
  32456. if(($receiver = $1) == null || $receiver.a$nil){
  32457. return $self._error_("AMD loader not present");
  32458. } else {
  32459. var require;
  32460. require=$receiver;
  32461. $3=$recv($recv($self._namespaceFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  32462. $ctx2.sendIdx[","]=1;
  32463. $2=[$3];
  32464. return $recv(require)._value_value_value_($2,(function(result){
  32465. return $core.withContext(function($ctx3) {
  32466. return $recv(model)._value_(result);
  32467. }, function($ctx3) {$ctx3.fillBlock({result:result},$ctx2,4)});
  32468. }),(function(error){
  32469. return $core.withContext(function($ctx3) {
  32470. return $recv(model)._signal_(error);
  32471. }, function($ctx3) {$ctx3.fillBlock({error:error},$ctx2,5)});
  32472. }));
  32473. }
  32474. }, function($ctx2) {$ctx2.fillBlock({model:model},$ctx1,1)});
  32475. }));
  32476. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  32477. },
  32478. args: ["aPackage"],
  32479. 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 ] ] ]",
  32480. referencedClasses: ["Promise", "Smalltalk"],
  32481. messageSends: ["new:", "ifNil:ifNotNil:", "amdRequire", "error:", "value:value:value:", ",", "namespaceFor:", "name", "value:", "signal:"]
  32482. }),
  32483. $globals.AmdPackageHandler);
  32484. $core.addMethod(
  32485. $core.method({
  32486. selector: "namespaceFor:",
  32487. protocol: "committing",
  32488. fn: function (aPackage){
  32489. var self=this,$self=this;
  32490. return $core.withContext(function($ctx1) {
  32491. return $recv($recv(aPackage)._transport())._namespace();
  32492. }, function($ctx1) {$ctx1.fill(self,"namespaceFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  32493. },
  32494. args: ["aPackage"],
  32495. source: "namespaceFor: aPackage\x0a\x09^ aPackage transport namespace",
  32496. referencedClasses: [],
  32497. messageSends: ["namespace", "transport"]
  32498. }),
  32499. $globals.AmdPackageHandler);
  32500. $core.addMethod(
  32501. $core.method({
  32502. selector: "toUrl:",
  32503. protocol: "private",
  32504. fn: function (aString){
  32505. var self=this,$self=this;
  32506. return $core.withContext(function($ctx1) {
  32507. var $1,$receiver;
  32508. $1=$recv($globals.Smalltalk)._amdRequire();
  32509. if(($receiver = $1) == null || $receiver.a$nil){
  32510. return $self._error_("AMD loader not present");
  32511. } else {
  32512. var require;
  32513. require=$receiver;
  32514. return $recv($recv(require)._provided())._toUrl_(aString);
  32515. }
  32516. }, function($ctx1) {$ctx1.fill(self,"toUrl:",{aString:aString},$globals.AmdPackageHandler)});
  32517. },
  32518. args: ["aString"],
  32519. source: "toUrl: aString\x0a\x09^ Smalltalk amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require | require provided toUrl: aString ]",
  32520. referencedClasses: ["Smalltalk"],
  32521. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "toUrl:", "provided"]
  32522. }),
  32523. $globals.AmdPackageHandler);
  32524. $core.addMethod(
  32525. $core.method({
  32526. selector: "defaultNamespace",
  32527. protocol: "commit paths",
  32528. fn: function (){
  32529. var self=this,$self=this;
  32530. return $core.withContext(function($ctx1) {
  32531. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  32532. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageHandler.a$cls)});
  32533. },
  32534. args: [],
  32535. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  32536. referencedClasses: ["Smalltalk"],
  32537. messageSends: ["defaultAmdNamespace"]
  32538. }),
  32539. $globals.AmdPackageHandler.a$cls);
  32540. $core.addMethod(
  32541. $core.method({
  32542. selector: "defaultNamespace:",
  32543. protocol: "commit paths",
  32544. fn: function (aString){
  32545. var self=this,$self=this;
  32546. return $core.withContext(function($ctx1) {
  32547. $recv($globals.Smalltalk)._defaultAmdNamespace_(aString);
  32548. return self;
  32549. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace:",{aString:aString},$globals.AmdPackageHandler.a$cls)});
  32550. },
  32551. args: ["aString"],
  32552. source: "defaultNamespace: aString\x0a\x09Smalltalk defaultAmdNamespace: aString",
  32553. referencedClasses: ["Smalltalk"],
  32554. messageSends: ["defaultAmdNamespace:"]
  32555. }),
  32556. $globals.AmdPackageHandler.a$cls);
  32557. $core.addClass("PackageTransport", $globals.Object, ["package"], "Platform-ImportExport");
  32558. $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.";
  32559. $core.addMethod(
  32560. $core.method({
  32561. selector: "asJavaScriptObject",
  32562. protocol: "converting",
  32563. fn: function (){
  32564. var self=this,$self=this;
  32565. return $core.withContext(function($ctx1) {
  32566. return $globals.HashedCollection._newFromPairs_(["type",$self._type()]);
  32567. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.PackageTransport)});
  32568. },
  32569. args: [],
  32570. source: "asJavaScriptObject\x0a\x09^ #{ 'type' -> self type }",
  32571. referencedClasses: [],
  32572. messageSends: ["type"]
  32573. }),
  32574. $globals.PackageTransport);
  32575. $core.addMethod(
  32576. $core.method({
  32577. selector: "commit",
  32578. protocol: "committing",
  32579. fn: function (){
  32580. var self=this,$self=this;
  32581. return $core.withContext(function($ctx1) {
  32582. $recv($self._commitHandler())._commit_($self._package());
  32583. return self;
  32584. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.PackageTransport)});
  32585. },
  32586. args: [],
  32587. source: "commit\x0a\x09self commitHandler commit: self package",
  32588. referencedClasses: [],
  32589. messageSends: ["commit:", "commitHandler", "package"]
  32590. }),
  32591. $globals.PackageTransport);
  32592. $core.addMethod(
  32593. $core.method({
  32594. selector: "commitHandler",
  32595. protocol: "factory",
  32596. fn: function (){
  32597. var self=this,$self=this;
  32598. return $core.withContext(function($ctx1) {
  32599. return $recv($self._commitHandlerClass())._new();
  32600. }, function($ctx1) {$ctx1.fill(self,"commitHandler",{},$globals.PackageTransport)});
  32601. },
  32602. args: [],
  32603. source: "commitHandler\x0a\x09^ self commitHandlerClass new",
  32604. referencedClasses: [],
  32605. messageSends: ["new", "commitHandlerClass"]
  32606. }),
  32607. $globals.PackageTransport);
  32608. $core.addMethod(
  32609. $core.method({
  32610. selector: "commitHandlerClass",
  32611. protocol: "accessing",
  32612. fn: function (){
  32613. var self=this,$self=this;
  32614. return $core.withContext(function($ctx1) {
  32615. $self._subclassResponsibility();
  32616. return self;
  32617. }, function($ctx1) {$ctx1.fill(self,"commitHandlerClass",{},$globals.PackageTransport)});
  32618. },
  32619. args: [],
  32620. source: "commitHandlerClass\x0a\x09self subclassResponsibility",
  32621. referencedClasses: [],
  32622. messageSends: ["subclassResponsibility"]
  32623. }),
  32624. $globals.PackageTransport);
  32625. $core.addMethod(
  32626. $core.method({
  32627. selector: "commitOnSuccess:onError:",
  32628. protocol: "committing",
  32629. fn: function (aBlock,anotherBlock){
  32630. var self=this,$self=this;
  32631. return $core.withContext(function($ctx1) {
  32632. $recv($self._commitHandler())._commit_onSuccess_onError_($self._package(),aBlock,anotherBlock);
  32633. return self;
  32634. }, function($ctx1) {$ctx1.fill(self,"commitOnSuccess:onError:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageTransport)});
  32635. },
  32636. args: ["aBlock", "anotherBlock"],
  32637. source: "commitOnSuccess: aBlock onError: anotherBlock\x0a\x09self commitHandler \x0a\x09\x09commit: self package\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  32638. referencedClasses: [],
  32639. messageSends: ["commit:onSuccess:onError:", "commitHandler", "package"]
  32640. }),
  32641. $globals.PackageTransport);
  32642. $core.addMethod(
  32643. $core.method({
  32644. selector: "definition",
  32645. protocol: "accessing",
  32646. fn: function (){
  32647. var self=this,$self=this;
  32648. return "";
  32649. },
  32650. args: [],
  32651. source: "definition\x0a\x09^ ''",
  32652. referencedClasses: [],
  32653. messageSends: []
  32654. }),
  32655. $globals.PackageTransport);
  32656. $core.addMethod(
  32657. $core.method({
  32658. selector: "load",
  32659. protocol: "loading",
  32660. fn: function (){
  32661. var self=this,$self=this;
  32662. return $core.withContext(function($ctx1) {
  32663. return $recv($recv($self._commitHandler())._load_($self._package()))._then_((function(){
  32664. return $core.withContext(function($ctx2) {
  32665. return $recv($globals.Smalltalk)._postLoad();
  32666. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32667. }));
  32668. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.PackageTransport)});
  32669. },
  32670. args: [],
  32671. source: "load\x0a\x09^ (self commitHandler load: self package)\x0a\x09\x09then: [ Smalltalk postLoad ]",
  32672. referencedClasses: ["Smalltalk"],
  32673. messageSends: ["then:", "load:", "commitHandler", "package", "postLoad"]
  32674. }),
  32675. $globals.PackageTransport);
  32676. $core.addMethod(
  32677. $core.method({
  32678. selector: "package",
  32679. protocol: "accessing",
  32680. fn: function (){
  32681. var self=this,$self=this;
  32682. return $self["@package"];
  32683. },
  32684. args: [],
  32685. source: "package\x0a\x09^ package",
  32686. referencedClasses: [],
  32687. messageSends: []
  32688. }),
  32689. $globals.PackageTransport);
  32690. $core.addMethod(
  32691. $core.method({
  32692. selector: "package:",
  32693. protocol: "accessing",
  32694. fn: function (aPackage){
  32695. var self=this,$self=this;
  32696. $self["@package"]=aPackage;
  32697. return self;
  32698. },
  32699. args: ["aPackage"],
  32700. source: "package: aPackage\x0a\x09package := aPackage",
  32701. referencedClasses: [],
  32702. messageSends: []
  32703. }),
  32704. $globals.PackageTransport);
  32705. $core.addMethod(
  32706. $core.method({
  32707. selector: "setupFromJson:",
  32708. protocol: "initialization",
  32709. fn: function (anObject){
  32710. var self=this,$self=this;
  32711. return self;
  32712. },
  32713. args: ["anObject"],
  32714. source: "setupFromJson: anObject\x0a\x09\x22no op. override if needed in subclasses\x22",
  32715. referencedClasses: [],
  32716. messageSends: []
  32717. }),
  32718. $globals.PackageTransport);
  32719. $core.addMethod(
  32720. $core.method({
  32721. selector: "type",
  32722. protocol: "accessing",
  32723. fn: function (){
  32724. var self=this,$self=this;
  32725. return $core.withContext(function($ctx1) {
  32726. return $recv($self._class())._type();
  32727. }, function($ctx1) {$ctx1.fill(self,"type",{},$globals.PackageTransport)});
  32728. },
  32729. args: [],
  32730. source: "type\x0a\x09^ self class type",
  32731. referencedClasses: [],
  32732. messageSends: ["type", "class"]
  32733. }),
  32734. $globals.PackageTransport);
  32735. $globals.PackageTransport.a$cls.iVarNames = ["registry"];
  32736. $core.addMethod(
  32737. $core.method({
  32738. selector: "classRegisteredFor:",
  32739. protocol: "accessing",
  32740. fn: function (aString){
  32741. var self=this,$self=this;
  32742. return $core.withContext(function($ctx1) {
  32743. return $recv($self["@registry"])._at_(aString);
  32744. }, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString},$globals.PackageTransport.a$cls)});
  32745. },
  32746. args: ["aString"],
  32747. source: "classRegisteredFor: aString\x0a\x09^ registry at: aString",
  32748. referencedClasses: [],
  32749. messageSends: ["at:"]
  32750. }),
  32751. $globals.PackageTransport.a$cls);
  32752. $core.addMethod(
  32753. $core.method({
  32754. selector: "defaultType",
  32755. protocol: "accessing",
  32756. fn: function (){
  32757. var self=this,$self=this;
  32758. return $core.withContext(function($ctx1) {
  32759. return $recv($globals.AmdPackageTransport)._type();
  32760. }, function($ctx1) {$ctx1.fill(self,"defaultType",{},$globals.PackageTransport.a$cls)});
  32761. },
  32762. args: [],
  32763. source: "defaultType\x0a\x09^ AmdPackageTransport type",
  32764. referencedClasses: ["AmdPackageTransport"],
  32765. messageSends: ["type"]
  32766. }),
  32767. $globals.PackageTransport.a$cls);
  32768. $core.addMethod(
  32769. $core.method({
  32770. selector: "for:",
  32771. protocol: "instance creation",
  32772. fn: function (aString){
  32773. var self=this,$self=this;
  32774. return $core.withContext(function($ctx1) {
  32775. return $recv($self._classRegisteredFor_(aString))._new();
  32776. }, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString},$globals.PackageTransport.a$cls)});
  32777. },
  32778. args: ["aString"],
  32779. source: "for: aString\x0a\x09^ (self classRegisteredFor: aString) new",
  32780. referencedClasses: [],
  32781. messageSends: ["new", "classRegisteredFor:"]
  32782. }),
  32783. $globals.PackageTransport.a$cls);
  32784. $core.addMethod(
  32785. $core.method({
  32786. selector: "fromJson:",
  32787. protocol: "instance creation",
  32788. fn: function (anObject){
  32789. var self=this,$self=this;
  32790. return $core.withContext(function($ctx1) {
  32791. var $1,$2,$receiver;
  32792. if(($receiver = anObject) == null || $receiver.a$nil){
  32793. $1=$self._for_($self._defaultType());
  32794. $ctx1.sendIdx["for:"]=1;
  32795. return $1;
  32796. } else {
  32797. anObject;
  32798. }
  32799. $2=$self._for_($recv(anObject)._type());
  32800. $recv($2)._setupFromJson_(anObject);
  32801. return $recv($2)._yourself();
  32802. }, function($ctx1) {$ctx1.fill(self,"fromJson:",{anObject:anObject},$globals.PackageTransport.a$cls)});
  32803. },
  32804. args: ["anObject"],
  32805. 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",
  32806. referencedClasses: [],
  32807. messageSends: ["ifNil:", "for:", "defaultType", "setupFromJson:", "type", "yourself"]
  32808. }),
  32809. $globals.PackageTransport.a$cls);
  32810. $core.addMethod(
  32811. $core.method({
  32812. selector: "initialize",
  32813. protocol: "initialization",
  32814. fn: function (){
  32815. var self=this,$self=this;
  32816. return $core.withContext(function($ctx1) {
  32817. var $1;
  32818. (
  32819. $ctx1.supercall = true,
  32820. ($globals.PackageTransport.a$cls.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  32821. $ctx1.supercall = false;
  32822. $1=$self.__eq_eq($globals.PackageTransport);
  32823. if($core.assert($1)){
  32824. $self["@registry"]=$globals.HashedCollection._newFromPairs_([]);
  32825. $self["@registry"];
  32826. } else {
  32827. $self._register();
  32828. }
  32829. return self;
  32830. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageTransport.a$cls)});
  32831. },
  32832. args: [],
  32833. source: "initialize\x0a\x09super initialize.\x0a\x09self == PackageTransport\x0a\x09\x09ifTrue: [ registry := #{} ]\x0a\x09\x09ifFalse: [ self register ]",
  32834. referencedClasses: ["PackageTransport"],
  32835. messageSends: ["initialize", "ifTrue:ifFalse:", "==", "register"]
  32836. }),
  32837. $globals.PackageTransport.a$cls);
  32838. $core.addMethod(
  32839. $core.method({
  32840. selector: "register",
  32841. protocol: "registration",
  32842. fn: function (){
  32843. var self=this,$self=this;
  32844. return $core.withContext(function($ctx1) {
  32845. $recv($globals.PackageTransport)._register_(self);
  32846. return self;
  32847. }, function($ctx1) {$ctx1.fill(self,"register",{},$globals.PackageTransport.a$cls)});
  32848. },
  32849. args: [],
  32850. source: "register\x0a\x09PackageTransport register: self",
  32851. referencedClasses: ["PackageTransport"],
  32852. messageSends: ["register:"]
  32853. }),
  32854. $globals.PackageTransport.a$cls);
  32855. $core.addMethod(
  32856. $core.method({
  32857. selector: "register:",
  32858. protocol: "registration",
  32859. fn: function (aClass){
  32860. var self=this,$self=this;
  32861. return $core.withContext(function($ctx1) {
  32862. var $1,$receiver;
  32863. $1=$recv(aClass)._type();
  32864. $ctx1.sendIdx["type"]=1;
  32865. if(($receiver = $1) == null || $receiver.a$nil){
  32866. $1;
  32867. } else {
  32868. $recv($self["@registry"])._at_put_($recv(aClass)._type(),aClass);
  32869. }
  32870. return self;
  32871. }, function($ctx1) {$ctx1.fill(self,"register:",{aClass:aClass},$globals.PackageTransport.a$cls)});
  32872. },
  32873. args: ["aClass"],
  32874. source: "register: aClass\x0a\x09aClass type ifNotNil: [\x0a\x09\x09registry at: aClass type put: aClass ]",
  32875. referencedClasses: [],
  32876. messageSends: ["ifNotNil:", "type", "at:put:"]
  32877. }),
  32878. $globals.PackageTransport.a$cls);
  32879. $core.addMethod(
  32880. $core.method({
  32881. selector: "type",
  32882. protocol: "accessing",
  32883. fn: function (){
  32884. var self=this,$self=this;
  32885. return nil;
  32886. },
  32887. args: [],
  32888. source: "type\x0a\x09\x22Override in subclasses\x22\x0a\x09^ nil",
  32889. referencedClasses: [],
  32890. messageSends: []
  32891. }),
  32892. $globals.PackageTransport.a$cls);
  32893. $core.addClass("AmdPackageTransport", $globals.PackageTransport, ["namespace"], "Platform-ImportExport");
  32894. $globals.AmdPackageTransport.comment="I am the default transport for committing packages.\x0a\x0aSee `AmdExporter` and `AmdPackageHandler`.";
  32895. $core.addMethod(
  32896. $core.method({
  32897. selector: "asJavaScriptObject",
  32898. protocol: "converting",
  32899. fn: function (){
  32900. var self=this,$self=this;
  32901. return $core.withContext(function($ctx1) {
  32902. var $1;
  32903. $1=(
  32904. $ctx1.supercall = true,
  32905. ($globals.AmdPackageTransport.superclass||$boot.nilAsClass).fn.prototype._asJavaScriptObject.apply($self, []));
  32906. $ctx1.supercall = false;
  32907. $recv($1)._at_put_("amdNamespace",$self._namespace());
  32908. return $recv($1)._yourself();
  32909. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.AmdPackageTransport)});
  32910. },
  32911. args: [],
  32912. source: "asJavaScriptObject\x0a\x09^ super asJavaScriptObject\x0a\x09\x09at: 'amdNamespace' put: self namespace;\x0a\x09\x09yourself",
  32913. referencedClasses: [],
  32914. messageSends: ["at:put:", "asJavaScriptObject", "namespace", "yourself"]
  32915. }),
  32916. $globals.AmdPackageTransport);
  32917. $core.addMethod(
  32918. $core.method({
  32919. selector: "commitHandlerClass",
  32920. protocol: "accessing",
  32921. fn: function (){
  32922. var self=this,$self=this;
  32923. return $globals.AmdPackageHandler;
  32924. },
  32925. args: [],
  32926. source: "commitHandlerClass\x0a\x09^ AmdPackageHandler",
  32927. referencedClasses: ["AmdPackageHandler"],
  32928. messageSends: []
  32929. }),
  32930. $globals.AmdPackageTransport);
  32931. $core.addMethod(
  32932. $core.method({
  32933. selector: "defaultNamespace",
  32934. protocol: "defaults",
  32935. fn: function (){
  32936. var self=this,$self=this;
  32937. return $core.withContext(function($ctx1) {
  32938. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  32939. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageTransport)});
  32940. },
  32941. args: [],
  32942. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  32943. referencedClasses: ["Smalltalk"],
  32944. messageSends: ["defaultAmdNamespace"]
  32945. }),
  32946. $globals.AmdPackageTransport);
  32947. $core.addMethod(
  32948. $core.method({
  32949. selector: "definition",
  32950. protocol: "accessing",
  32951. fn: function (){
  32952. var self=this,$self=this;
  32953. return $core.withContext(function($ctx1) {
  32954. return $recv($globals.String)._streamContents_((function(stream){
  32955. return $core.withContext(function($ctx2) {
  32956. $recv(stream)._write_([$recv($self._class())._name()," namespace: "]);
  32957. return $recv(stream)._print_($self._namespace());
  32958. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  32959. }));
  32960. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.AmdPackageTransport)});
  32961. },
  32962. args: [],
  32963. source: "definition\x0a\x09^ String streamContents: [ :stream | stream \x0a\x09\x09write: { self class name. ' namespace: ' }; print: self namespace ]",
  32964. referencedClasses: ["String"],
  32965. messageSends: ["streamContents:", "write:", "name", "class", "print:", "namespace"]
  32966. }),
  32967. $globals.AmdPackageTransport);
  32968. $core.addMethod(
  32969. $core.method({
  32970. selector: "namespace",
  32971. protocol: "accessing",
  32972. fn: function (){
  32973. var self=this,$self=this;
  32974. return $core.withContext(function($ctx1) {
  32975. var $1,$receiver;
  32976. $1=$self["@namespace"];
  32977. if(($receiver = $1) == null || $receiver.a$nil){
  32978. return $self._defaultNamespace();
  32979. } else {
  32980. return $1;
  32981. }
  32982. }, function($ctx1) {$ctx1.fill(self,"namespace",{},$globals.AmdPackageTransport)});
  32983. },
  32984. args: [],
  32985. source: "namespace\x0a\x09^ namespace ifNil: [ self defaultNamespace ]",
  32986. referencedClasses: [],
  32987. messageSends: ["ifNil:", "defaultNamespace"]
  32988. }),
  32989. $globals.AmdPackageTransport);
  32990. $core.addMethod(
  32991. $core.method({
  32992. selector: "namespace:",
  32993. protocol: "accessing",
  32994. fn: function (aString){
  32995. var self=this,$self=this;
  32996. $self["@namespace"]=aString;
  32997. return self;
  32998. },
  32999. args: ["aString"],
  33000. source: "namespace: aString\x0a\x09namespace := aString",
  33001. referencedClasses: [],
  33002. messageSends: []
  33003. }),
  33004. $globals.AmdPackageTransport);
  33005. $core.addMethod(
  33006. $core.method({
  33007. selector: "printOn:",
  33008. protocol: "printing",
  33009. fn: function (aStream){
  33010. var self=this,$self=this;
  33011. return $core.withContext(function($ctx1) {
  33012. (
  33013. $ctx1.supercall = true,
  33014. ($globals.AmdPackageTransport.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  33015. $ctx1.supercall = false;
  33016. $recv(aStream)._nextPutAll_(" (AMD Namespace: ");
  33017. $ctx1.sendIdx["nextPutAll:"]=1;
  33018. $recv(aStream)._nextPutAll_($self._namespace());
  33019. $ctx1.sendIdx["nextPutAll:"]=2;
  33020. $recv(aStream)._nextPutAll_(")");
  33021. return self;
  33022. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AmdPackageTransport)});
  33023. },
  33024. args: ["aStream"],
  33025. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: ' (AMD Namespace: ';\x0a\x09\x09nextPutAll: self namespace;\x0a\x09\x09nextPutAll: ')'",
  33026. referencedClasses: [],
  33027. messageSends: ["printOn:", "nextPutAll:", "namespace"]
  33028. }),
  33029. $globals.AmdPackageTransport);
  33030. $core.addMethod(
  33031. $core.method({
  33032. selector: "setPath:",
  33033. protocol: "actions",
  33034. fn: function (aString){
  33035. var self=this,$self=this;
  33036. return $core.withContext(function($ctx1) {
  33037. $recv($recv(require)._provided())._config_($globals.HashedCollection._newFromPairs_(["paths",$globals.HashedCollection._newFromPairs_([$self._namespace(),aString])]));
  33038. return self;
  33039. }, function($ctx1) {$ctx1.fill(self,"setPath:",{aString:aString},$globals.AmdPackageTransport)});
  33040. },
  33041. args: ["aString"],
  33042. source: "setPath: aString\x0a\x09\x22Set the path the the receiver's `namespace`\x22\x0a\x09\x0a\x09require provided config: #{\x0a\x09\x09'paths' -> #{\x0a\x09\x09\x09self namespace -> aString\x0a\x09\x09}\x0a\x09}.",
  33043. referencedClasses: [],
  33044. messageSends: ["config:", "provided", "namespace"]
  33045. }),
  33046. $globals.AmdPackageTransport);
  33047. $core.addMethod(
  33048. $core.method({
  33049. selector: "setupFromJson:",
  33050. protocol: "initialization",
  33051. fn: function (anObject){
  33052. var self=this,$self=this;
  33053. return $core.withContext(function($ctx1) {
  33054. $self._namespace_($recv(anObject)._at_("amdNamespace"));
  33055. return self;
  33056. }, function($ctx1) {$ctx1.fill(self,"setupFromJson:",{anObject:anObject},$globals.AmdPackageTransport)});
  33057. },
  33058. args: ["anObject"],
  33059. source: "setupFromJson: anObject\x0a\x09self namespace: (anObject at: 'amdNamespace')",
  33060. referencedClasses: [],
  33061. messageSends: ["namespace:", "at:"]
  33062. }),
  33063. $globals.AmdPackageTransport);
  33064. $core.addMethod(
  33065. $core.method({
  33066. selector: "namespace:",
  33067. protocol: "instance creation",
  33068. fn: function (aString){
  33069. var self=this,$self=this;
  33070. return $core.withContext(function($ctx1) {
  33071. var $1;
  33072. $1=$self._new();
  33073. $recv($1)._namespace_(aString);
  33074. return $recv($1)._yourself();
  33075. }, function($ctx1) {$ctx1.fill(self,"namespace:",{aString:aString},$globals.AmdPackageTransport.a$cls)});
  33076. },
  33077. args: ["aString"],
  33078. source: "namespace: aString\x0a\x09^ self new\x0a\x09\x09namespace: aString;\x0a\x09\x09yourself",
  33079. referencedClasses: [],
  33080. messageSends: ["namespace:", "new", "yourself"]
  33081. }),
  33082. $globals.AmdPackageTransport.a$cls);
  33083. $core.addMethod(
  33084. $core.method({
  33085. selector: "type",
  33086. protocol: "accessing",
  33087. fn: function (){
  33088. var self=this,$self=this;
  33089. return "amd";
  33090. },
  33091. args: [],
  33092. source: "type\x0a\x09^ 'amd'",
  33093. referencedClasses: [],
  33094. messageSends: []
  33095. }),
  33096. $globals.AmdPackageTransport.a$cls);
  33097. $core.addMethod(
  33098. $core.method({
  33099. selector: "exportBehaviorDefinitionTo:using:",
  33100. protocol: "*Platform-ImportExport",
  33101. fn: function (aStream,anExporter){
  33102. var self=this,$self=this;
  33103. return $core.withContext(function($ctx1) {
  33104. $recv(anExporter)._exportDefinitionOf_on_(self,aStream);
  33105. return self;
  33106. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.Class)});
  33107. },
  33108. args: ["aStream", "anExporter"],
  33109. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportDefinitionOf: self on: aStream",
  33110. referencedClasses: [],
  33111. messageSends: ["exportDefinitionOf:on:"]
  33112. }),
  33113. $globals.Class);
  33114. $core.addMethod(
  33115. $core.method({
  33116. selector: "exportBehaviorDefinitionTo:using:",
  33117. protocol: "*Platform-ImportExport",
  33118. fn: function (aStream,anExporter){
  33119. var self=this,$self=this;
  33120. return $core.withContext(function($ctx1) {
  33121. $recv(anExporter)._exportMetaDefinitionOf_on_($self._instanceClass(),aStream);
  33122. return self;
  33123. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.Metaclass)});
  33124. },
  33125. args: ["aStream", "anExporter"],
  33126. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportMetaDefinitionOf: self instanceClass on: aStream",
  33127. referencedClasses: [],
  33128. messageSends: ["exportMetaDefinitionOf:on:", "instanceClass"]
  33129. }),
  33130. $globals.Metaclass);
  33131. $core.addMethod(
  33132. $core.method({
  33133. selector: "commit",
  33134. protocol: "*Platform-ImportExport",
  33135. fn: function (){
  33136. var self=this,$self=this;
  33137. return $core.withContext(function($ctx1) {
  33138. return $recv($self._transport())._commit();
  33139. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.Package)});
  33140. },
  33141. args: [],
  33142. source: "commit\x0a\x09^ self transport commit",
  33143. referencedClasses: [],
  33144. messageSends: ["commit", "transport"]
  33145. }),
  33146. $globals.Package);
  33147. $core.addMethod(
  33148. $core.method({
  33149. selector: "load",
  33150. protocol: "*Platform-ImportExport",
  33151. fn: function (){
  33152. var self=this,$self=this;
  33153. return $core.withContext(function($ctx1) {
  33154. return $recv($self._transport())._load();
  33155. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.Package)});
  33156. },
  33157. args: [],
  33158. source: "load\x0a\x09^ self transport load",
  33159. referencedClasses: [],
  33160. messageSends: ["load", "transport"]
  33161. }),
  33162. $globals.Package);
  33163. $core.addMethod(
  33164. $core.method({
  33165. selector: "loadFromNamespace:",
  33166. protocol: "*Platform-ImportExport",
  33167. fn: function (aString){
  33168. var self=this,$self=this;
  33169. return $core.withContext(function($ctx1) {
  33170. var $1;
  33171. $1=$self._transport();
  33172. $recv($1)._namespace_(aString);
  33173. return $recv($1)._load();
  33174. }, function($ctx1) {$ctx1.fill(self,"loadFromNamespace:",{aString:aString},$globals.Package)});
  33175. },
  33176. args: ["aString"],
  33177. source: "loadFromNamespace: aString\x0a\x09^ self transport\x0a\x09\x09namespace: aString;\x0a\x09\x09load",
  33178. referencedClasses: [],
  33179. messageSends: ["namespace:", "transport", "load"]
  33180. }),
  33181. $globals.Package);
  33182. $core.addMethod(
  33183. $core.method({
  33184. selector: "load:",
  33185. protocol: "*Platform-ImportExport",
  33186. fn: function (aPackageName){
  33187. var self=this,$self=this;
  33188. return $core.withContext(function($ctx1) {
  33189. return $recv($self._named_(aPackageName))._load();
  33190. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackageName:aPackageName},$globals.Package.a$cls)});
  33191. },
  33192. args: ["aPackageName"],
  33193. source: "load: aPackageName\x0a\x09^ (self named: aPackageName) load",
  33194. referencedClasses: [],
  33195. messageSends: ["load", "named:"]
  33196. }),
  33197. $globals.Package.a$cls);
  33198. $core.addMethod(
  33199. $core.method({
  33200. selector: "load:fromNamespace:",
  33201. protocol: "*Platform-ImportExport",
  33202. fn: function (aPackageName,aString){
  33203. var self=this,$self=this;
  33204. return $core.withContext(function($ctx1) {
  33205. return $recv($self._named_(aPackageName))._loadFromNamespace_(aString);
  33206. }, function($ctx1) {$ctx1.fill(self,"load:fromNamespace:",{aPackageName:aPackageName,aString:aString},$globals.Package.a$cls)});
  33207. },
  33208. args: ["aPackageName", "aString"],
  33209. source: "load: aPackageName fromNamespace: aString\x0a\x09^ (self named: aPackageName) loadFromNamespace: aString",
  33210. referencedClasses: [],
  33211. messageSends: ["loadFromNamespace:", "named:"]
  33212. }),
  33213. $globals.Package.a$cls);
  33214. $core.addMethod(
  33215. $core.method({
  33216. selector: "methodsFor:",
  33217. protocol: "*Platform-ImportExport",
  33218. fn: function (aString){
  33219. var self=this,$self=this;
  33220. return $core.withContext(function($ctx1) {
  33221. var $1;
  33222. $1=$recv($globals.ClassProtocolReader)._new();
  33223. $recv($1)._class_category_(self,aString);
  33224. return $recv($1)._yourself();
  33225. }, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString},$globals.TBehaviorProvider)});
  33226. },
  33227. args: ["aString"],
  33228. source: "methodsFor: aString\x0a\x09^ ClassProtocolReader new\x0a\x09\x09class: self category: aString;\x0a\x09\x09yourself",
  33229. referencedClasses: ["ClassProtocolReader"],
  33230. messageSends: ["class:category:", "new", "yourself"]
  33231. }),
  33232. $globals.TBehaviorProvider);
  33233. $core.addMethod(
  33234. $core.method({
  33235. selector: "methodsFor:stamp:",
  33236. protocol: "*Platform-ImportExport",
  33237. fn: function (aString,aStamp){
  33238. var self=this,$self=this;
  33239. return $core.withContext(function($ctx1) {
  33240. return $self._methodsFor_(aString);
  33241. }, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp},$globals.TBehaviorProvider)});
  33242. },
  33243. args: ["aString", "aStamp"],
  33244. source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for file-in compatibility, ignores stamp.\x22\x0a\x09^ self methodsFor: aString",
  33245. referencedClasses: [],
  33246. messageSends: ["methodsFor:"]
  33247. }),
  33248. $globals.TBehaviorProvider);
  33249. $core.addMethod(
  33250. $core.method({
  33251. selector: "commentStamp",
  33252. protocol: "*Platform-ImportExport",
  33253. fn: function (){
  33254. var self=this,$self=this;
  33255. return $core.withContext(function($ctx1) {
  33256. var $1;
  33257. $1=$recv($globals.ClassCommentReader)._new();
  33258. $recv($1)._class_(self);
  33259. return $recv($1)._yourself();
  33260. }, function($ctx1) {$ctx1.fill(self,"commentStamp",{},$globals.TMasterBehavior)});
  33261. },
  33262. args: [],
  33263. source: "commentStamp\x0a\x09^ ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
  33264. referencedClasses: ["ClassCommentReader"],
  33265. messageSends: ["class:", "new", "yourself"]
  33266. }),
  33267. $globals.TMasterBehavior);
  33268. $core.addMethod(
  33269. $core.method({
  33270. selector: "commentStamp:prior:",
  33271. protocol: "*Platform-ImportExport",
  33272. fn: function (aStamp,prior){
  33273. var self=this,$self=this;
  33274. return $core.withContext(function($ctx1) {
  33275. return $self._commentStamp();
  33276. }, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior},$globals.TMasterBehavior)});
  33277. },
  33278. args: ["aStamp", "prior"],
  33279. source: "commentStamp: aStamp prior: prior\x0a\x09\x09^ self commentStamp",
  33280. referencedClasses: [],
  33281. messageSends: ["commentStamp"]
  33282. }),
  33283. $globals.TMasterBehavior);
  33284. $core.addMethod(
  33285. $core.method({
  33286. selector: "exportBehaviorDefinitionTo:using:",
  33287. protocol: "*Platform-ImportExport",
  33288. fn: function (aStream,anExporter){
  33289. var self=this,$self=this;
  33290. return $core.withContext(function($ctx1) {
  33291. $recv(anExporter)._exportTraitDefinitionOf_on_(self,aStream);
  33292. return self;
  33293. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.Trait)});
  33294. },
  33295. args: ["aStream", "anExporter"],
  33296. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportTraitDefinitionOf: self on: aStream",
  33297. referencedClasses: [],
  33298. messageSends: ["exportTraitDefinitionOf:on:"]
  33299. }),
  33300. $globals.Trait);
  33301. });
  33302. define('amber_core/Compiler-AST',["amber/boot", "amber_core/Kernel-Dag", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Methods"], function($boot){"use strict";
  33303. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  33304. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  33305. var $pkg = $core.addPackage("Compiler-AST");
  33306. $pkg.innerEval = function (expr) { return eval(expr); };
  33307. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  33308. $core.addClass("ASTNode", $globals.DagParentNode, ["parent", "position", "source", "shouldBeAliased"], "Compiler-AST");
  33309. $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.";
  33310. $core.addMethod(
  33311. $core.method({
  33312. selector: "inPosition:",
  33313. protocol: "testing",
  33314. fn: function (aPoint){
  33315. var self=this,$self=this;
  33316. return $core.withContext(function($ctx1) {
  33317. return $recv($recv($self._positionStart()).__lt_eq(aPoint))._and_((function(){
  33318. return $core.withContext(function($ctx2) {
  33319. return $recv($self._positionEnd()).__gt_eq(aPoint);
  33320. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33321. }));
  33322. }, function($ctx1) {$ctx1.fill(self,"inPosition:",{aPoint:aPoint},$globals.ASTNode)});
  33323. },
  33324. args: ["aPoint"],
  33325. source: "inPosition: aPoint\x0a\x09^ (self positionStart <= aPoint and: [\x0a\x09\x09self positionEnd >= aPoint ])",
  33326. referencedClasses: [],
  33327. messageSends: ["and:", "<=", "positionStart", ">=", "positionEnd"]
  33328. }),
  33329. $globals.ASTNode);
  33330. $core.addMethod(
  33331. $core.method({
  33332. selector: "isAssignmentNode",
  33333. protocol: "testing",
  33334. fn: function (){
  33335. var self=this,$self=this;
  33336. return false;
  33337. },
  33338. args: [],
  33339. source: "isAssignmentNode\x0a\x09^ false",
  33340. referencedClasses: [],
  33341. messageSends: []
  33342. }),
  33343. $globals.ASTNode);
  33344. $core.addMethod(
  33345. $core.method({
  33346. selector: "isBlockNode",
  33347. protocol: "testing",
  33348. fn: function (){
  33349. var self=this,$self=this;
  33350. return false;
  33351. },
  33352. args: [],
  33353. source: "isBlockNode\x0a\x09^ false",
  33354. referencedClasses: [],
  33355. messageSends: []
  33356. }),
  33357. $globals.ASTNode);
  33358. $core.addMethod(
  33359. $core.method({
  33360. selector: "isBlockSequenceNode",
  33361. protocol: "testing",
  33362. fn: function (){
  33363. var self=this,$self=this;
  33364. return false;
  33365. },
  33366. args: [],
  33367. source: "isBlockSequenceNode\x0a\x09^ false",
  33368. referencedClasses: [],
  33369. messageSends: []
  33370. }),
  33371. $globals.ASTNode);
  33372. $core.addMethod(
  33373. $core.method({
  33374. selector: "isCascadeNode",
  33375. protocol: "testing",
  33376. fn: function (){
  33377. var self=this,$self=this;
  33378. return false;
  33379. },
  33380. args: [],
  33381. source: "isCascadeNode\x0a\x09^ false",
  33382. referencedClasses: [],
  33383. messageSends: []
  33384. }),
  33385. $globals.ASTNode);
  33386. $core.addMethod(
  33387. $core.method({
  33388. selector: "isImmutable",
  33389. protocol: "testing",
  33390. fn: function (){
  33391. var self=this,$self=this;
  33392. return false;
  33393. },
  33394. args: [],
  33395. source: "isImmutable\x0a\x09^ false",
  33396. referencedClasses: [],
  33397. messageSends: []
  33398. }),
  33399. $globals.ASTNode);
  33400. $core.addMethod(
  33401. $core.method({
  33402. selector: "isJSStatementNode",
  33403. protocol: "testing",
  33404. fn: function (){
  33405. var self=this,$self=this;
  33406. return false;
  33407. },
  33408. args: [],
  33409. source: "isJSStatementNode\x0a\x09^ false",
  33410. referencedClasses: [],
  33411. messageSends: []
  33412. }),
  33413. $globals.ASTNode);
  33414. $core.addMethod(
  33415. $core.method({
  33416. selector: "isNavigationNode",
  33417. protocol: "testing",
  33418. fn: function (){
  33419. var self=this,$self=this;
  33420. return false;
  33421. },
  33422. args: [],
  33423. source: "isNavigationNode\x0a\x09\x22Answer true if the node can be navigated to\x22\x0a\x09\x0a\x09^ false",
  33424. referencedClasses: [],
  33425. messageSends: []
  33426. }),
  33427. $globals.ASTNode);
  33428. $core.addMethod(
  33429. $core.method({
  33430. selector: "isReturnNode",
  33431. protocol: "testing",
  33432. fn: function (){
  33433. var self=this,$self=this;
  33434. return false;
  33435. },
  33436. args: [],
  33437. source: "isReturnNode\x0a\x09^ false",
  33438. referencedClasses: [],
  33439. messageSends: []
  33440. }),
  33441. $globals.ASTNode);
  33442. $core.addMethod(
  33443. $core.method({
  33444. selector: "isSendNode",
  33445. protocol: "testing",
  33446. fn: function (){
  33447. var self=this,$self=this;
  33448. return false;
  33449. },
  33450. args: [],
  33451. source: "isSendNode\x0a\x09^ false",
  33452. referencedClasses: [],
  33453. messageSends: []
  33454. }),
  33455. $globals.ASTNode);
  33456. $core.addMethod(
  33457. $core.method({
  33458. selector: "isSequenceNode",
  33459. protocol: "testing",
  33460. fn: function (){
  33461. var self=this,$self=this;
  33462. return false;
  33463. },
  33464. args: [],
  33465. source: "isSequenceNode\x0a\x09^ false",
  33466. referencedClasses: [],
  33467. messageSends: []
  33468. }),
  33469. $globals.ASTNode);
  33470. $core.addMethod(
  33471. $core.method({
  33472. selector: "isSuperKeyword",
  33473. protocol: "testing",
  33474. fn: function (){
  33475. var self=this,$self=this;
  33476. return false;
  33477. },
  33478. args: [],
  33479. source: "isSuperKeyword\x0a\x09^ false",
  33480. referencedClasses: [],
  33481. messageSends: []
  33482. }),
  33483. $globals.ASTNode);
  33484. $core.addMethod(
  33485. $core.method({
  33486. selector: "isValueNode",
  33487. protocol: "testing",
  33488. fn: function (){
  33489. var self=this,$self=this;
  33490. return false;
  33491. },
  33492. args: [],
  33493. source: "isValueNode\x0a\x09^ false",
  33494. referencedClasses: [],
  33495. messageSends: []
  33496. }),
  33497. $globals.ASTNode);
  33498. $core.addMethod(
  33499. $core.method({
  33500. selector: "isVariableNode",
  33501. protocol: "testing",
  33502. fn: function (){
  33503. var self=this,$self=this;
  33504. return false;
  33505. },
  33506. args: [],
  33507. source: "isVariableNode\x0a\x09^ false",
  33508. referencedClasses: [],
  33509. messageSends: []
  33510. }),
  33511. $globals.ASTNode);
  33512. $core.addMethod(
  33513. $core.method({
  33514. selector: "location:",
  33515. protocol: "accessing",
  33516. fn: function (aLocation){
  33517. var self=this,$self=this;
  33518. return $core.withContext(function($ctx1) {
  33519. var $3,$2,$1;
  33520. $3=$recv(aLocation)._start();
  33521. $ctx1.sendIdx["start"]=1;
  33522. $2=$recv($3)._line();
  33523. $1=$recv($2).__at($recv($recv(aLocation)._start())._column());
  33524. $self._position_($1);
  33525. return self;
  33526. }, function($ctx1) {$ctx1.fill(self,"location:",{aLocation:aLocation},$globals.ASTNode)});
  33527. },
  33528. args: ["aLocation"],
  33529. source: "location: aLocation\x0a\x09self position: aLocation start line @ aLocation start column",
  33530. referencedClasses: [],
  33531. messageSends: ["position:", "@", "line", "start", "column"]
  33532. }),
  33533. $globals.ASTNode);
  33534. $core.addMethod(
  33535. $core.method({
  33536. selector: "method",
  33537. protocol: "accessing",
  33538. fn: function (){
  33539. var self=this,$self=this;
  33540. return $core.withContext(function($ctx1) {
  33541. var $1,$receiver;
  33542. $1=$self._parent();
  33543. if(($receiver = $1) == null || $receiver.a$nil){
  33544. return $1;
  33545. } else {
  33546. var node;
  33547. node=$receiver;
  33548. return $recv(node)._method();
  33549. }
  33550. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTNode)});
  33551. },
  33552. args: [],
  33553. source: "method\x0a\x09^ self parent ifNotNil: [ :node | node method ]",
  33554. referencedClasses: [],
  33555. messageSends: ["ifNotNil:", "parent", "method"]
  33556. }),
  33557. $globals.ASTNode);
  33558. $core.addMethod(
  33559. $core.method({
  33560. selector: "navigationNodeAt:ifAbsent:",
  33561. protocol: "accessing",
  33562. fn: function (aPoint,aBlock){
  33563. var self=this,$self=this;
  33564. var children;
  33565. return $core.withContext(function($ctx1) {
  33566. var $2,$1;
  33567. var $early={};
  33568. try {
  33569. children=$recv($self._allDagChildren())._select_((function(each){
  33570. return $core.withContext(function($ctx2) {
  33571. return $recv($recv(each)._isNavigationNode())._and_((function(){
  33572. return $core.withContext(function($ctx3) {
  33573. return $recv(each)._inPosition_(aPoint);
  33574. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  33575. }));
  33576. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33577. }));
  33578. $recv(children)._ifEmpty_((function(){
  33579. return $core.withContext(function($ctx2) {
  33580. throw $early=[$recv(aBlock)._value()];
  33581. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  33582. }));
  33583. return $recv($recv($recv(children)._asArray())._sort_((function(a,b){
  33584. return $core.withContext(function($ctx2) {
  33585. $2=$recv(a)._positionStart();
  33586. $ctx2.sendIdx["positionStart"]=1;
  33587. $1=$recv($2)._dist_(aPoint);
  33588. $ctx2.sendIdx["dist:"]=1;
  33589. return $recv($1).__lt_eq($recv($recv(b)._positionStart())._dist_(aPoint));
  33590. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,4)});
  33591. })))._first();
  33592. }
  33593. catch(e) {if(e===$early)return e[0]; throw e}
  33594. }, function($ctx1) {$ctx1.fill(self,"navigationNodeAt:ifAbsent:",{aPoint:aPoint,aBlock:aBlock,children:children},$globals.ASTNode)});
  33595. },
  33596. args: ["aPoint", "aBlock"],
  33597. 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",
  33598. referencedClasses: [],
  33599. messageSends: ["select:", "allDagChildren", "and:", "isNavigationNode", "inPosition:", "ifEmpty:", "value", "first", "sort:", "asArray", "<=", "dist:", "positionStart"]
  33600. }),
  33601. $globals.ASTNode);
  33602. $core.addMethod(
  33603. $core.method({
  33604. selector: "parent",
  33605. protocol: "accessing",
  33606. fn: function (){
  33607. var self=this,$self=this;
  33608. return $self["@parent"];
  33609. },
  33610. args: [],
  33611. source: "parent\x0a\x09^ parent",
  33612. referencedClasses: [],
  33613. messageSends: []
  33614. }),
  33615. $globals.ASTNode);
  33616. $core.addMethod(
  33617. $core.method({
  33618. selector: "parent:",
  33619. protocol: "accessing",
  33620. fn: function (aNode){
  33621. var self=this,$self=this;
  33622. $self["@parent"]=aNode;
  33623. return self;
  33624. },
  33625. args: ["aNode"],
  33626. source: "parent: aNode\x0a\x09parent := aNode",
  33627. referencedClasses: [],
  33628. messageSends: []
  33629. }),
  33630. $globals.ASTNode);
  33631. $core.addMethod(
  33632. $core.method({
  33633. selector: "position",
  33634. protocol: "accessing",
  33635. fn: function (){
  33636. var self=this,$self=this;
  33637. return $core.withContext(function($ctx1) {
  33638. var $1,$2,$receiver;
  33639. $1=$self["@position"];
  33640. if(($receiver = $1) == null || $receiver.a$nil){
  33641. $2=$self._parent();
  33642. if(($receiver = $2) == null || $receiver.a$nil){
  33643. return $2;
  33644. } else {
  33645. var node;
  33646. node=$receiver;
  33647. return $recv(node)._position();
  33648. }
  33649. } else {
  33650. return $1;
  33651. }
  33652. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.ASTNode)});
  33653. },
  33654. args: [],
  33655. 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 ] ]",
  33656. referencedClasses: [],
  33657. messageSends: ["ifNil:", "ifNotNil:", "parent", "position"]
  33658. }),
  33659. $globals.ASTNode);
  33660. $core.addMethod(
  33661. $core.method({
  33662. selector: "position:",
  33663. protocol: "accessing",
  33664. fn: function (aPosition){
  33665. var self=this,$self=this;
  33666. $self["@position"]=aPosition;
  33667. return self;
  33668. },
  33669. args: ["aPosition"],
  33670. source: "position: aPosition\x0a\x09position := aPosition",
  33671. referencedClasses: [],
  33672. messageSends: []
  33673. }),
  33674. $globals.ASTNode);
  33675. $core.addMethod(
  33676. $core.method({
  33677. selector: "positionEnd",
  33678. protocol: "accessing",
  33679. fn: function (){
  33680. var self=this,$self=this;
  33681. return $core.withContext(function($ctx1) {
  33682. var $1,$6,$5,$4,$3,$2;
  33683. $1=$self._positionStart();
  33684. $6=$self._source();
  33685. $ctx1.sendIdx["source"]=1;
  33686. $5=$recv($6)._lines();
  33687. $ctx1.sendIdx["lines"]=1;
  33688. $4=$recv($5)._size();
  33689. $ctx1.sendIdx["size"]=1;
  33690. $3=$recv($4).__minus((1));
  33691. $ctx1.sendIdx["-"]=1;
  33692. $2=$recv($3).__at($recv($recv($recv($recv($self._source())._lines())._last())._size()).__minus((1)));
  33693. return $recv($1).__plus($2);
  33694. }, function($ctx1) {$ctx1.fill(self,"positionEnd",{},$globals.ASTNode)});
  33695. },
  33696. args: [],
  33697. source: "positionEnd\x0a\x09^ self positionStart + ((self source lines size - 1) @ (self source lines last size - 1))",
  33698. referencedClasses: [],
  33699. messageSends: ["+", "positionStart", "@", "-", "size", "lines", "source", "last"]
  33700. }),
  33701. $globals.ASTNode);
  33702. $core.addMethod(
  33703. $core.method({
  33704. selector: "positionStart",
  33705. protocol: "accessing",
  33706. fn: function (){
  33707. var self=this,$self=this;
  33708. return $core.withContext(function($ctx1) {
  33709. return $self._position();
  33710. }, function($ctx1) {$ctx1.fill(self,"positionStart",{},$globals.ASTNode)});
  33711. },
  33712. args: [],
  33713. source: "positionStart\x0a\x09^ self position",
  33714. referencedClasses: [],
  33715. messageSends: ["position"]
  33716. }),
  33717. $globals.ASTNode);
  33718. $core.addMethod(
  33719. $core.method({
  33720. selector: "requiresSmalltalkContext",
  33721. protocol: "testing",
  33722. fn: function (){
  33723. var self=this,$self=this;
  33724. return $core.withContext(function($ctx1) {
  33725. return $recv($recv($self._dagChildren())._detect_ifNone_((function(each){
  33726. return $core.withContext(function($ctx2) {
  33727. return $recv(each)._requiresSmalltalkContext();
  33728. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33729. }),(function(){
  33730. return nil;
  33731. })))._notNil();
  33732. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.ASTNode)});
  33733. },
  33734. args: [],
  33735. 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",
  33736. referencedClasses: [],
  33737. messageSends: ["notNil", "detect:ifNone:", "dagChildren", "requiresSmalltalkContext"]
  33738. }),
  33739. $globals.ASTNode);
  33740. $core.addMethod(
  33741. $core.method({
  33742. selector: "shouldBeAliased",
  33743. protocol: "accessing",
  33744. fn: function (){
  33745. var self=this,$self=this;
  33746. return $core.withContext(function($ctx1) {
  33747. var $1,$receiver;
  33748. $1=$self["@shouldBeAliased"];
  33749. if(($receiver = $1) == null || $receiver.a$nil){
  33750. return false;
  33751. } else {
  33752. return $1;
  33753. }
  33754. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.ASTNode)});
  33755. },
  33756. args: [],
  33757. source: "shouldBeAliased\x0a\x09^ shouldBeAliased ifNil: [ false ]",
  33758. referencedClasses: [],
  33759. messageSends: ["ifNil:"]
  33760. }),
  33761. $globals.ASTNode);
  33762. $core.addMethod(
  33763. $core.method({
  33764. selector: "shouldBeAliased:",
  33765. protocol: "accessing",
  33766. fn: function (aBoolean){
  33767. var self=this,$self=this;
  33768. $self["@shouldBeAliased"]=aBoolean;
  33769. return self;
  33770. },
  33771. args: ["aBoolean"],
  33772. source: "shouldBeAliased: aBoolean\x0a\x09shouldBeAliased := aBoolean",
  33773. referencedClasses: [],
  33774. messageSends: []
  33775. }),
  33776. $globals.ASTNode);
  33777. $core.addMethod(
  33778. $core.method({
  33779. selector: "size",
  33780. protocol: "accessing",
  33781. fn: function (){
  33782. var self=this,$self=this;
  33783. return $core.withContext(function($ctx1) {
  33784. return $recv($self._source())._size();
  33785. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.ASTNode)});
  33786. },
  33787. args: [],
  33788. source: "size\x0a\x09^ self source size",
  33789. referencedClasses: [],
  33790. messageSends: ["size", "source"]
  33791. }),
  33792. $globals.ASTNode);
  33793. $core.addMethod(
  33794. $core.method({
  33795. selector: "source",
  33796. protocol: "accessing",
  33797. fn: function (){
  33798. var self=this,$self=this;
  33799. return $core.withContext(function($ctx1) {
  33800. var $1,$receiver;
  33801. $1=$self["@source"];
  33802. if(($receiver = $1) == null || $receiver.a$nil){
  33803. return "";
  33804. } else {
  33805. return $1;
  33806. }
  33807. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.ASTNode)});
  33808. },
  33809. args: [],
  33810. source: "source\x0a\x09^ source ifNil: [ '' ]",
  33811. referencedClasses: [],
  33812. messageSends: ["ifNil:"]
  33813. }),
  33814. $globals.ASTNode);
  33815. $core.addMethod(
  33816. $core.method({
  33817. selector: "source:",
  33818. protocol: "accessing",
  33819. fn: function (aString){
  33820. var self=this,$self=this;
  33821. $self["@source"]=aString;
  33822. return self;
  33823. },
  33824. args: ["aString"],
  33825. source: "source: aString\x0a\x09source := aString",
  33826. referencedClasses: [],
  33827. messageSends: []
  33828. }),
  33829. $globals.ASTNode);
  33830. $core.addMethod(
  33831. $core.method({
  33832. selector: "withTail:",
  33833. protocol: "building",
  33834. fn: function (aCollection){
  33835. var self=this,$self=this;
  33836. return $core.withContext(function($ctx1) {
  33837. var $1;
  33838. return $recv(aCollection)._inject_into_(self,(function(receiver,send){
  33839. return $core.withContext(function($ctx2) {
  33840. $1=$recv($globals.SendNode)._new();
  33841. $recv($1)._position_($recv(send)._position());
  33842. $recv($1)._source_($recv(send)._source());
  33843. $recv($1)._receiver_(receiver);
  33844. $recv($1)._selector_($recv(send)._selector());
  33845. $recv($1)._arguments_($recv(send)._arguments());
  33846. return $recv($1)._yourself();
  33847. }, function($ctx2) {$ctx2.fillBlock({receiver:receiver,send:send},$ctx1,1)});
  33848. }));
  33849. }, function($ctx1) {$ctx1.fill(self,"withTail:",{aCollection:aCollection},$globals.ASTNode)});
  33850. },
  33851. args: ["aCollection"],
  33852. 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 ]",
  33853. referencedClasses: ["SendNode"],
  33854. messageSends: ["inject:into:", "position:", "new", "position", "source:", "source", "receiver:", "selector:", "selector", "arguments:", "arguments", "yourself"]
  33855. }),
  33856. $globals.ASTNode);
  33857. $core.addClass("AssignmentNode", $globals.ASTNode, ["left", "right"], "Compiler-AST");
  33858. $globals.AssignmentNode.comment="I represent an assignment node.";
  33859. $core.addMethod(
  33860. $core.method({
  33861. selector: "acceptDagVisitor:",
  33862. protocol: "visiting",
  33863. fn: function (aVisitor){
  33864. var self=this,$self=this;
  33865. return $core.withContext(function($ctx1) {
  33866. return $recv(aVisitor)._visitAssignmentNode_(self);
  33867. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.AssignmentNode)});
  33868. },
  33869. args: ["aVisitor"],
  33870. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitAssignmentNode: self",
  33871. referencedClasses: [],
  33872. messageSends: ["visitAssignmentNode:"]
  33873. }),
  33874. $globals.AssignmentNode);
  33875. $core.addMethod(
  33876. $core.method({
  33877. selector: "dagChildren",
  33878. protocol: "accessing",
  33879. fn: function (){
  33880. var self=this,$self=this;
  33881. return $core.withContext(function($ctx1) {
  33882. return $recv($globals.Array)._with_with_($self._left(),$self._right());
  33883. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.AssignmentNode)});
  33884. },
  33885. args: [],
  33886. source: "dagChildren\x0a\x09^ Array with: self left with: self right",
  33887. referencedClasses: ["Array"],
  33888. messageSends: ["with:with:", "left", "right"]
  33889. }),
  33890. $globals.AssignmentNode);
  33891. $core.addMethod(
  33892. $core.method({
  33893. selector: "isAssignmentNode",
  33894. protocol: "testing",
  33895. fn: function (){
  33896. var self=this,$self=this;
  33897. return true;
  33898. },
  33899. args: [],
  33900. source: "isAssignmentNode\x0a\x09^ true",
  33901. referencedClasses: [],
  33902. messageSends: []
  33903. }),
  33904. $globals.AssignmentNode);
  33905. $core.addMethod(
  33906. $core.method({
  33907. selector: "left",
  33908. protocol: "accessing",
  33909. fn: function (){
  33910. var self=this,$self=this;
  33911. return $self["@left"];
  33912. },
  33913. args: [],
  33914. source: "left\x0a\x09^ left",
  33915. referencedClasses: [],
  33916. messageSends: []
  33917. }),
  33918. $globals.AssignmentNode);
  33919. $core.addMethod(
  33920. $core.method({
  33921. selector: "left:",
  33922. protocol: "accessing",
  33923. fn: function (aNode){
  33924. var self=this,$self=this;
  33925. $self["@left"]=aNode;
  33926. return self;
  33927. },
  33928. args: ["aNode"],
  33929. source: "left: aNode\x0a\x09left := aNode",
  33930. referencedClasses: [],
  33931. messageSends: []
  33932. }),
  33933. $globals.AssignmentNode);
  33934. $core.addMethod(
  33935. $core.method({
  33936. selector: "right",
  33937. protocol: "accessing",
  33938. fn: function (){
  33939. var self=this,$self=this;
  33940. return $self["@right"];
  33941. },
  33942. args: [],
  33943. source: "right\x0a\x09^ right",
  33944. referencedClasses: [],
  33945. messageSends: []
  33946. }),
  33947. $globals.AssignmentNode);
  33948. $core.addMethod(
  33949. $core.method({
  33950. selector: "right:",
  33951. protocol: "accessing",
  33952. fn: function (aNode){
  33953. var self=this,$self=this;
  33954. $self["@right"]=aNode;
  33955. return self;
  33956. },
  33957. args: ["aNode"],
  33958. source: "right: aNode\x0a\x09right := aNode",
  33959. referencedClasses: [],
  33960. messageSends: []
  33961. }),
  33962. $globals.AssignmentNode);
  33963. $core.addClass("BlockNode", $globals.ASTNode, ["parameters", "scope"], "Compiler-AST");
  33964. $globals.BlockNode.comment="I represent an block closure node.";
  33965. $core.addMethod(
  33966. $core.method({
  33967. selector: "acceptDagVisitor:",
  33968. protocol: "visiting",
  33969. fn: function (aVisitor){
  33970. var self=this,$self=this;
  33971. return $core.withContext(function($ctx1) {
  33972. return $recv(aVisitor)._visitBlockNode_(self);
  33973. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.BlockNode)});
  33974. },
  33975. args: ["aVisitor"],
  33976. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitBlockNode: self",
  33977. referencedClasses: [],
  33978. messageSends: ["visitBlockNode:"]
  33979. }),
  33980. $globals.BlockNode);
  33981. $core.addMethod(
  33982. $core.method({
  33983. selector: "isBlockNode",
  33984. protocol: "testing",
  33985. fn: function (){
  33986. var self=this,$self=this;
  33987. return true;
  33988. },
  33989. args: [],
  33990. source: "isBlockNode\x0a\x09^ true",
  33991. referencedClasses: [],
  33992. messageSends: []
  33993. }),
  33994. $globals.BlockNode);
  33995. $core.addMethod(
  33996. $core.method({
  33997. selector: "parameters",
  33998. protocol: "accessing",
  33999. fn: function (){
  34000. var self=this,$self=this;
  34001. return $core.withContext(function($ctx1) {
  34002. var $1,$receiver;
  34003. $1=$self["@parameters"];
  34004. if(($receiver = $1) == null || $receiver.a$nil){
  34005. $self["@parameters"]=$recv($globals.Array)._new();
  34006. return $self["@parameters"];
  34007. } else {
  34008. return $1;
  34009. }
  34010. }, function($ctx1) {$ctx1.fill(self,"parameters",{},$globals.BlockNode)});
  34011. },
  34012. args: [],
  34013. source: "parameters\x0a\x09^ parameters ifNil: [ parameters := Array new ]",
  34014. referencedClasses: ["Array"],
  34015. messageSends: ["ifNil:", "new"]
  34016. }),
  34017. $globals.BlockNode);
  34018. $core.addMethod(
  34019. $core.method({
  34020. selector: "parameters:",
  34021. protocol: "accessing",
  34022. fn: function (aCollection){
  34023. var self=this,$self=this;
  34024. $self["@parameters"]=aCollection;
  34025. return self;
  34026. },
  34027. args: ["aCollection"],
  34028. source: "parameters: aCollection\x0a\x09parameters := aCollection",
  34029. referencedClasses: [],
  34030. messageSends: []
  34031. }),
  34032. $globals.BlockNode);
  34033. $core.addMethod(
  34034. $core.method({
  34035. selector: "scope",
  34036. protocol: "accessing",
  34037. fn: function (){
  34038. var self=this,$self=this;
  34039. return $self["@scope"];
  34040. },
  34041. args: [],
  34042. source: "scope\x0a\x09^ scope",
  34043. referencedClasses: [],
  34044. messageSends: []
  34045. }),
  34046. $globals.BlockNode);
  34047. $core.addMethod(
  34048. $core.method({
  34049. selector: "scope:",
  34050. protocol: "accessing",
  34051. fn: function (aLexicalScope){
  34052. var self=this,$self=this;
  34053. $self["@scope"]=aLexicalScope;
  34054. return self;
  34055. },
  34056. args: ["aLexicalScope"],
  34057. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  34058. referencedClasses: [],
  34059. messageSends: []
  34060. }),
  34061. $globals.BlockNode);
  34062. $core.addClass("CascadeNode", $globals.ASTNode, ["receiver"], "Compiler-AST");
  34063. $globals.CascadeNode.comment="I represent an cascade node.";
  34064. $core.addMethod(
  34065. $core.method({
  34066. selector: "acceptDagVisitor:",
  34067. protocol: "visiting",
  34068. fn: function (aVisitor){
  34069. var self=this,$self=this;
  34070. return $core.withContext(function($ctx1) {
  34071. return $recv(aVisitor)._visitCascadeNode_(self);
  34072. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.CascadeNode)});
  34073. },
  34074. args: ["aVisitor"],
  34075. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitCascadeNode: self",
  34076. referencedClasses: [],
  34077. messageSends: ["visitCascadeNode:"]
  34078. }),
  34079. $globals.CascadeNode);
  34080. $core.addMethod(
  34081. $core.method({
  34082. selector: "isCascadeNode",
  34083. protocol: "testing",
  34084. fn: function (){
  34085. var self=this,$self=this;
  34086. return true;
  34087. },
  34088. args: [],
  34089. source: "isCascadeNode\x0a\x09^ true",
  34090. referencedClasses: [],
  34091. messageSends: []
  34092. }),
  34093. $globals.CascadeNode);
  34094. $core.addMethod(
  34095. $core.method({
  34096. selector: "receiver",
  34097. protocol: "accessing",
  34098. fn: function (){
  34099. var self=this,$self=this;
  34100. return $self["@receiver"];
  34101. },
  34102. args: [],
  34103. source: "receiver\x0a\x09^ receiver",
  34104. referencedClasses: [],
  34105. messageSends: []
  34106. }),
  34107. $globals.CascadeNode);
  34108. $core.addMethod(
  34109. $core.method({
  34110. selector: "receiver:",
  34111. protocol: "accessing",
  34112. fn: function (aNode){
  34113. var self=this,$self=this;
  34114. $self["@receiver"]=aNode;
  34115. return self;
  34116. },
  34117. args: ["aNode"],
  34118. source: "receiver: aNode\x0a\x09receiver := aNode",
  34119. referencedClasses: [],
  34120. messageSends: []
  34121. }),
  34122. $globals.CascadeNode);
  34123. $core.addClass("DynamicArrayNode", $globals.ASTNode, [], "Compiler-AST");
  34124. $globals.DynamicArrayNode.comment="I represent an dynamic array node.";
  34125. $core.addMethod(
  34126. $core.method({
  34127. selector: "acceptDagVisitor:",
  34128. protocol: "visiting",
  34129. fn: function (aVisitor){
  34130. var self=this,$self=this;
  34131. return $core.withContext(function($ctx1) {
  34132. return $recv(aVisitor)._visitDynamicArrayNode_(self);
  34133. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DynamicArrayNode)});
  34134. },
  34135. args: ["aVisitor"],
  34136. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDynamicArrayNode: self",
  34137. referencedClasses: [],
  34138. messageSends: ["visitDynamicArrayNode:"]
  34139. }),
  34140. $globals.DynamicArrayNode);
  34141. $core.addClass("DynamicDictionaryNode", $globals.ASTNode, [], "Compiler-AST");
  34142. $globals.DynamicDictionaryNode.comment="I represent an dynamic dictionary node.";
  34143. $core.addMethod(
  34144. $core.method({
  34145. selector: "acceptDagVisitor:",
  34146. protocol: "visiting",
  34147. fn: function (aVisitor){
  34148. var self=this,$self=this;
  34149. return $core.withContext(function($ctx1) {
  34150. return $recv(aVisitor)._visitDynamicDictionaryNode_(self);
  34151. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DynamicDictionaryNode)});
  34152. },
  34153. args: ["aVisitor"],
  34154. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDynamicDictionaryNode: self",
  34155. referencedClasses: [],
  34156. messageSends: ["visitDynamicDictionaryNode:"]
  34157. }),
  34158. $globals.DynamicDictionaryNode);
  34159. $core.addClass("JSStatementNode", $globals.ASTNode, [], "Compiler-AST");
  34160. $globals.JSStatementNode.comment="I represent an JavaScript statement node.";
  34161. $core.addMethod(
  34162. $core.method({
  34163. selector: "acceptDagVisitor:",
  34164. protocol: "visiting",
  34165. fn: function (aVisitor){
  34166. var self=this,$self=this;
  34167. return $core.withContext(function($ctx1) {
  34168. return $recv(aVisitor)._visitJSStatementNode_(self);
  34169. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.JSStatementNode)});
  34170. },
  34171. args: ["aVisitor"],
  34172. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitJSStatementNode: self",
  34173. referencedClasses: [],
  34174. messageSends: ["visitJSStatementNode:"]
  34175. }),
  34176. $globals.JSStatementNode);
  34177. $core.addMethod(
  34178. $core.method({
  34179. selector: "isJSStatementNode",
  34180. protocol: "testing",
  34181. fn: function (){
  34182. var self=this,$self=this;
  34183. return true;
  34184. },
  34185. args: [],
  34186. source: "isJSStatementNode\x0a\x09^ true",
  34187. referencedClasses: [],
  34188. messageSends: []
  34189. }),
  34190. $globals.JSStatementNode);
  34191. $core.addMethod(
  34192. $core.method({
  34193. selector: "requiresSmalltalkContext",
  34194. protocol: "testing",
  34195. fn: function (){
  34196. var self=this,$self=this;
  34197. return true;
  34198. },
  34199. args: [],
  34200. source: "requiresSmalltalkContext\x0a\x09^ true",
  34201. referencedClasses: [],
  34202. messageSends: []
  34203. }),
  34204. $globals.JSStatementNode);
  34205. $core.addClass("MethodNode", $globals.ASTNode, ["selector", "arguments", "source", "scope", "classReferences", "sendIndexes"], "Compiler-AST");
  34206. $globals.MethodNode.comment="I represent an method node.\x0a\x0aA method node must be the root and only method node of a valid AST.";
  34207. $core.addMethod(
  34208. $core.method({
  34209. selector: "acceptDagVisitor:",
  34210. protocol: "visiting",
  34211. fn: function (aVisitor){
  34212. var self=this,$self=this;
  34213. return $core.withContext(function($ctx1) {
  34214. return $recv(aVisitor)._visitMethodNode_(self);
  34215. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.MethodNode)});
  34216. },
  34217. args: ["aVisitor"],
  34218. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitMethodNode: self",
  34219. referencedClasses: [],
  34220. messageSends: ["visitMethodNode:"]
  34221. }),
  34222. $globals.MethodNode);
  34223. $core.addMethod(
  34224. $core.method({
  34225. selector: "arguments",
  34226. protocol: "accessing",
  34227. fn: function (){
  34228. var self=this,$self=this;
  34229. return $core.withContext(function($ctx1) {
  34230. var $1,$receiver;
  34231. $1=$self["@arguments"];
  34232. if(($receiver = $1) == null || $receiver.a$nil){
  34233. return [];
  34234. } else {
  34235. return $1;
  34236. }
  34237. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MethodNode)});
  34238. },
  34239. args: [],
  34240. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  34241. referencedClasses: [],
  34242. messageSends: ["ifNil:"]
  34243. }),
  34244. $globals.MethodNode);
  34245. $core.addMethod(
  34246. $core.method({
  34247. selector: "arguments:",
  34248. protocol: "accessing",
  34249. fn: function (aCollection){
  34250. var self=this,$self=this;
  34251. $self["@arguments"]=aCollection;
  34252. return self;
  34253. },
  34254. args: ["aCollection"],
  34255. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  34256. referencedClasses: [],
  34257. messageSends: []
  34258. }),
  34259. $globals.MethodNode);
  34260. $core.addMethod(
  34261. $core.method({
  34262. selector: "classReferences",
  34263. protocol: "accessing",
  34264. fn: function (){
  34265. var self=this,$self=this;
  34266. return $self["@classReferences"];
  34267. },
  34268. args: [],
  34269. source: "classReferences\x0a\x09^ classReferences",
  34270. referencedClasses: [],
  34271. messageSends: []
  34272. }),
  34273. $globals.MethodNode);
  34274. $core.addMethod(
  34275. $core.method({
  34276. selector: "classReferences:",
  34277. protocol: "accessing",
  34278. fn: function (aCollection){
  34279. var self=this,$self=this;
  34280. $self["@classReferences"]=aCollection;
  34281. return self;
  34282. },
  34283. args: ["aCollection"],
  34284. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  34285. referencedClasses: [],
  34286. messageSends: []
  34287. }),
  34288. $globals.MethodNode);
  34289. $core.addMethod(
  34290. $core.method({
  34291. selector: "messageSends",
  34292. protocol: "accessing",
  34293. fn: function (){
  34294. var self=this,$self=this;
  34295. return $core.withContext(function($ctx1) {
  34296. return $recv($self._sendIndexes())._keys();
  34297. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.MethodNode)});
  34298. },
  34299. args: [],
  34300. source: "messageSends\x0a\x09^ self sendIndexes keys",
  34301. referencedClasses: [],
  34302. messageSends: ["keys", "sendIndexes"]
  34303. }),
  34304. $globals.MethodNode);
  34305. $core.addMethod(
  34306. $core.method({
  34307. selector: "method",
  34308. protocol: "accessing",
  34309. fn: function (){
  34310. var self=this,$self=this;
  34311. return self;
  34312. },
  34313. args: [],
  34314. source: "method\x0a\x09^ self",
  34315. referencedClasses: [],
  34316. messageSends: []
  34317. }),
  34318. $globals.MethodNode);
  34319. $core.addMethod(
  34320. $core.method({
  34321. selector: "scope",
  34322. protocol: "accessing",
  34323. fn: function (){
  34324. var self=this,$self=this;
  34325. return $self["@scope"];
  34326. },
  34327. args: [],
  34328. source: "scope\x0a\x09^ scope",
  34329. referencedClasses: [],
  34330. messageSends: []
  34331. }),
  34332. $globals.MethodNode);
  34333. $core.addMethod(
  34334. $core.method({
  34335. selector: "scope:",
  34336. protocol: "accessing",
  34337. fn: function (aMethodScope){
  34338. var self=this,$self=this;
  34339. $self["@scope"]=aMethodScope;
  34340. return self;
  34341. },
  34342. args: ["aMethodScope"],
  34343. source: "scope: aMethodScope\x0a\x09scope := aMethodScope",
  34344. referencedClasses: [],
  34345. messageSends: []
  34346. }),
  34347. $globals.MethodNode);
  34348. $core.addMethod(
  34349. $core.method({
  34350. selector: "selector",
  34351. protocol: "accessing",
  34352. fn: function (){
  34353. var self=this,$self=this;
  34354. return $self["@selector"];
  34355. },
  34356. args: [],
  34357. source: "selector\x0a\x09^ selector",
  34358. referencedClasses: [],
  34359. messageSends: []
  34360. }),
  34361. $globals.MethodNode);
  34362. $core.addMethod(
  34363. $core.method({
  34364. selector: "selector:",
  34365. protocol: "accessing",
  34366. fn: function (aString){
  34367. var self=this,$self=this;
  34368. $self["@selector"]=aString;
  34369. return self;
  34370. },
  34371. args: ["aString"],
  34372. source: "selector: aString\x0a\x09selector := aString",
  34373. referencedClasses: [],
  34374. messageSends: []
  34375. }),
  34376. $globals.MethodNode);
  34377. $core.addMethod(
  34378. $core.method({
  34379. selector: "sendIndexes",
  34380. protocol: "accessing",
  34381. fn: function (){
  34382. var self=this,$self=this;
  34383. return $self["@sendIndexes"];
  34384. },
  34385. args: [],
  34386. source: "sendIndexes\x0a\x09^ sendIndexes",
  34387. referencedClasses: [],
  34388. messageSends: []
  34389. }),
  34390. $globals.MethodNode);
  34391. $core.addMethod(
  34392. $core.method({
  34393. selector: "sendIndexes:",
  34394. protocol: "accessing",
  34395. fn: function (aDictionary){
  34396. var self=this,$self=this;
  34397. $self["@sendIndexes"]=aDictionary;
  34398. return self;
  34399. },
  34400. args: ["aDictionary"],
  34401. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  34402. referencedClasses: [],
  34403. messageSends: []
  34404. }),
  34405. $globals.MethodNode);
  34406. $core.addMethod(
  34407. $core.method({
  34408. selector: "sequenceNode",
  34409. protocol: "accessing",
  34410. fn: function (){
  34411. var self=this,$self=this;
  34412. return $core.withContext(function($ctx1) {
  34413. var $1;
  34414. var $early={};
  34415. try {
  34416. $recv($self._dagChildren())._do_((function(each){
  34417. return $core.withContext(function($ctx2) {
  34418. $1=$recv(each)._isSequenceNode();
  34419. if($core.assert($1)){
  34420. throw $early=[each];
  34421. }
  34422. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  34423. }));
  34424. return nil;
  34425. }
  34426. catch(e) {if(e===$early)return e[0]; throw e}
  34427. }, function($ctx1) {$ctx1.fill(self,"sequenceNode",{},$globals.MethodNode)});
  34428. },
  34429. args: [],
  34430. source: "sequenceNode\x0a\x09self dagChildren do: [ :each |\x0a\x09\x09each isSequenceNode ifTrue: [ ^ each ] ].\x0a\x09\x09\x0a\x09^ nil",
  34431. referencedClasses: [],
  34432. messageSends: ["do:", "dagChildren", "ifTrue:", "isSequenceNode"]
  34433. }),
  34434. $globals.MethodNode);
  34435. $core.addMethod(
  34436. $core.method({
  34437. selector: "source",
  34438. protocol: "accessing",
  34439. fn: function (){
  34440. var self=this,$self=this;
  34441. return $self["@source"];
  34442. },
  34443. args: [],
  34444. source: "source\x0a\x09^ source",
  34445. referencedClasses: [],
  34446. messageSends: []
  34447. }),
  34448. $globals.MethodNode);
  34449. $core.addMethod(
  34450. $core.method({
  34451. selector: "source:",
  34452. protocol: "accessing",
  34453. fn: function (aString){
  34454. var self=this,$self=this;
  34455. $self["@source"]=aString;
  34456. return self;
  34457. },
  34458. args: ["aString"],
  34459. source: "source: aString\x0a\x09source := aString",
  34460. referencedClasses: [],
  34461. messageSends: []
  34462. }),
  34463. $globals.MethodNode);
  34464. $core.addClass("ReturnNode", $globals.ASTNode, ["scope"], "Compiler-AST");
  34465. $globals.ReturnNode.comment="I represent an return node. At the AST level, there is not difference between a local return or non-local return.";
  34466. $core.addMethod(
  34467. $core.method({
  34468. selector: "acceptDagVisitor:",
  34469. protocol: "visiting",
  34470. fn: function (aVisitor){
  34471. var self=this,$self=this;
  34472. return $core.withContext(function($ctx1) {
  34473. return $recv(aVisitor)._visitReturnNode_(self);
  34474. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.ReturnNode)});
  34475. },
  34476. args: ["aVisitor"],
  34477. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitReturnNode: self",
  34478. referencedClasses: [],
  34479. messageSends: ["visitReturnNode:"]
  34480. }),
  34481. $globals.ReturnNode);
  34482. $core.addMethod(
  34483. $core.method({
  34484. selector: "isReturnNode",
  34485. protocol: "testing",
  34486. fn: function (){
  34487. var self=this,$self=this;
  34488. return true;
  34489. },
  34490. args: [],
  34491. source: "isReturnNode\x0a\x09^ true",
  34492. referencedClasses: [],
  34493. messageSends: []
  34494. }),
  34495. $globals.ReturnNode);
  34496. $core.addMethod(
  34497. $core.method({
  34498. selector: "nonLocalReturn",
  34499. protocol: "testing",
  34500. fn: function (){
  34501. var self=this,$self=this;
  34502. return $core.withContext(function($ctx1) {
  34503. return $recv($recv($self._scope())._isMethodScope())._not();
  34504. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturn",{},$globals.ReturnNode)});
  34505. },
  34506. args: [],
  34507. source: "nonLocalReturn\x0a\x09^ self scope isMethodScope not",
  34508. referencedClasses: [],
  34509. messageSends: ["not", "isMethodScope", "scope"]
  34510. }),
  34511. $globals.ReturnNode);
  34512. $core.addMethod(
  34513. $core.method({
  34514. selector: "scope",
  34515. protocol: "accessing",
  34516. fn: function (){
  34517. var self=this,$self=this;
  34518. return $self["@scope"];
  34519. },
  34520. args: [],
  34521. source: "scope\x0a\x09^ scope",
  34522. referencedClasses: [],
  34523. messageSends: []
  34524. }),
  34525. $globals.ReturnNode);
  34526. $core.addMethod(
  34527. $core.method({
  34528. selector: "scope:",
  34529. protocol: "accessing",
  34530. fn: function (aLexicalScope){
  34531. var self=this,$self=this;
  34532. $self["@scope"]=aLexicalScope;
  34533. return self;
  34534. },
  34535. args: ["aLexicalScope"],
  34536. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  34537. referencedClasses: [],
  34538. messageSends: []
  34539. }),
  34540. $globals.ReturnNode);
  34541. $core.addClass("SendNode", $globals.ASTNode, ["selector", "arguments", "receiver", "index", "shouldBeInlined"], "Compiler-AST");
  34542. $globals.SendNode.comment="I represent an message send node.";
  34543. $core.addMethod(
  34544. $core.method({
  34545. selector: "acceptDagVisitor:",
  34546. protocol: "visiting",
  34547. fn: function (aVisitor){
  34548. var self=this,$self=this;
  34549. return $core.withContext(function($ctx1) {
  34550. return $recv(aVisitor)._visitSendNode_(self);
  34551. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.SendNode)});
  34552. },
  34553. args: ["aVisitor"],
  34554. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitSendNode: self",
  34555. referencedClasses: [],
  34556. messageSends: ["visitSendNode:"]
  34557. }),
  34558. $globals.SendNode);
  34559. $core.addMethod(
  34560. $core.method({
  34561. selector: "arguments",
  34562. protocol: "accessing",
  34563. fn: function (){
  34564. var self=this,$self=this;
  34565. return $core.withContext(function($ctx1) {
  34566. var $1,$receiver;
  34567. $1=$self["@arguments"];
  34568. if(($receiver = $1) == null || $receiver.a$nil){
  34569. $self["@arguments"]=[];
  34570. return $self["@arguments"];
  34571. } else {
  34572. return $1;
  34573. }
  34574. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.SendNode)});
  34575. },
  34576. args: [],
  34577. source: "arguments\x0a\x09^ arguments ifNil: [ arguments := #() ]",
  34578. referencedClasses: [],
  34579. messageSends: ["ifNil:"]
  34580. }),
  34581. $globals.SendNode);
  34582. $core.addMethod(
  34583. $core.method({
  34584. selector: "arguments:",
  34585. protocol: "accessing",
  34586. fn: function (aCollection){
  34587. var self=this,$self=this;
  34588. $self["@arguments"]=aCollection;
  34589. return self;
  34590. },
  34591. args: ["aCollection"],
  34592. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  34593. referencedClasses: [],
  34594. messageSends: []
  34595. }),
  34596. $globals.SendNode);
  34597. $core.addMethod(
  34598. $core.method({
  34599. selector: "dagChildren",
  34600. protocol: "accessing",
  34601. fn: function (){
  34602. var self=this,$self=this;
  34603. return $core.withContext(function($ctx1) {
  34604. var $1,$2,$3,$receiver;
  34605. $1=$self._receiver();
  34606. $ctx1.sendIdx["receiver"]=1;
  34607. if(($receiver = $1) == null || $receiver.a$nil){
  34608. $2=$self._arguments();
  34609. $ctx1.sendIdx["arguments"]=1;
  34610. return $recv($2)._copy();
  34611. } else {
  34612. $1;
  34613. }
  34614. $3=$recv($globals.Array)._with_($self._receiver());
  34615. $recv($3)._addAll_($self._arguments());
  34616. return $recv($3)._yourself();
  34617. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.SendNode)});
  34618. },
  34619. args: [],
  34620. 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",
  34621. referencedClasses: ["Array"],
  34622. messageSends: ["ifNil:", "receiver", "copy", "arguments", "addAll:", "with:", "yourself"]
  34623. }),
  34624. $globals.SendNode);
  34625. $core.addMethod(
  34626. $core.method({
  34627. selector: "index",
  34628. protocol: "accessing",
  34629. fn: function (){
  34630. var self=this,$self=this;
  34631. return $self["@index"];
  34632. },
  34633. args: [],
  34634. source: "index\x0a\x09^ index",
  34635. referencedClasses: [],
  34636. messageSends: []
  34637. }),
  34638. $globals.SendNode);
  34639. $core.addMethod(
  34640. $core.method({
  34641. selector: "index:",
  34642. protocol: "accessing",
  34643. fn: function (anInteger){
  34644. var self=this,$self=this;
  34645. $self["@index"]=anInteger;
  34646. return self;
  34647. },
  34648. args: ["anInteger"],
  34649. source: "index: anInteger\x0a\x09index := anInteger",
  34650. referencedClasses: [],
  34651. messageSends: []
  34652. }),
  34653. $globals.SendNode);
  34654. $core.addMethod(
  34655. $core.method({
  34656. selector: "isNavigationNode",
  34657. protocol: "testing",
  34658. fn: function (){
  34659. var self=this,$self=this;
  34660. return true;
  34661. },
  34662. args: [],
  34663. source: "isNavigationNode\x0a\x09^ true",
  34664. referencedClasses: [],
  34665. messageSends: []
  34666. }),
  34667. $globals.SendNode);
  34668. $core.addMethod(
  34669. $core.method({
  34670. selector: "isSendNode",
  34671. protocol: "testing",
  34672. fn: function (){
  34673. var self=this,$self=this;
  34674. return true;
  34675. },
  34676. args: [],
  34677. source: "isSendNode\x0a\x09^ true",
  34678. referencedClasses: [],
  34679. messageSends: []
  34680. }),
  34681. $globals.SendNode);
  34682. $core.addMethod(
  34683. $core.method({
  34684. selector: "navigationLink",
  34685. protocol: "accessing",
  34686. fn: function (){
  34687. var self=this,$self=this;
  34688. return $core.withContext(function($ctx1) {
  34689. return $self._selector();
  34690. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.SendNode)});
  34691. },
  34692. args: [],
  34693. source: "navigationLink\x0a\x09^ self selector",
  34694. referencedClasses: [],
  34695. messageSends: ["selector"]
  34696. }),
  34697. $globals.SendNode);
  34698. $core.addMethod(
  34699. $core.method({
  34700. selector: "receiver",
  34701. protocol: "accessing",
  34702. fn: function (){
  34703. var self=this,$self=this;
  34704. return $self["@receiver"];
  34705. },
  34706. args: [],
  34707. source: "receiver\x0a\x09^ receiver",
  34708. referencedClasses: [],
  34709. messageSends: []
  34710. }),
  34711. $globals.SendNode);
  34712. $core.addMethod(
  34713. $core.method({
  34714. selector: "receiver:",
  34715. protocol: "accessing",
  34716. fn: function (aNode){
  34717. var self=this,$self=this;
  34718. $self["@receiver"]=aNode;
  34719. return self;
  34720. },
  34721. args: ["aNode"],
  34722. source: "receiver: aNode\x0a\x09receiver := aNode",
  34723. referencedClasses: [],
  34724. messageSends: []
  34725. }),
  34726. $globals.SendNode);
  34727. $core.addMethod(
  34728. $core.method({
  34729. selector: "requiresSmalltalkContext",
  34730. protocol: "testing",
  34731. fn: function (){
  34732. var self=this,$self=this;
  34733. return true;
  34734. },
  34735. args: [],
  34736. source: "requiresSmalltalkContext\x0a\x09^ true",
  34737. referencedClasses: [],
  34738. messageSends: []
  34739. }),
  34740. $globals.SendNode);
  34741. $core.addMethod(
  34742. $core.method({
  34743. selector: "selector",
  34744. protocol: "accessing",
  34745. fn: function (){
  34746. var self=this,$self=this;
  34747. return $self["@selector"];
  34748. },
  34749. args: [],
  34750. source: "selector\x0a\x09^ selector",
  34751. referencedClasses: [],
  34752. messageSends: []
  34753. }),
  34754. $globals.SendNode);
  34755. $core.addMethod(
  34756. $core.method({
  34757. selector: "selector:",
  34758. protocol: "accessing",
  34759. fn: function (aString){
  34760. var self=this,$self=this;
  34761. $self["@selector"]=aString;
  34762. return self;
  34763. },
  34764. args: ["aString"],
  34765. source: "selector: aString\x0a\x09selector := aString",
  34766. referencedClasses: [],
  34767. messageSends: []
  34768. }),
  34769. $globals.SendNode);
  34770. $core.addMethod(
  34771. $core.method({
  34772. selector: "shouldBeInlined",
  34773. protocol: "accessing",
  34774. fn: function (){
  34775. var self=this,$self=this;
  34776. return $core.withContext(function($ctx1) {
  34777. var $1,$receiver;
  34778. $1=$self["@shouldBeInlined"];
  34779. if(($receiver = $1) == null || $receiver.a$nil){
  34780. return false;
  34781. } else {
  34782. return $1;
  34783. }
  34784. }, function($ctx1) {$ctx1.fill(self,"shouldBeInlined",{},$globals.SendNode)});
  34785. },
  34786. args: [],
  34787. source: "shouldBeInlined\x0a\x09^ shouldBeInlined ifNil: [ false ]",
  34788. referencedClasses: [],
  34789. messageSends: ["ifNil:"]
  34790. }),
  34791. $globals.SendNode);
  34792. $core.addMethod(
  34793. $core.method({
  34794. selector: "shouldBeInlined:",
  34795. protocol: "accessing",
  34796. fn: function (aBoolean){
  34797. var self=this,$self=this;
  34798. $self["@shouldBeInlined"]=aBoolean;
  34799. return self;
  34800. },
  34801. args: ["aBoolean"],
  34802. source: "shouldBeInlined: aBoolean\x0a\x09shouldBeInlined := aBoolean",
  34803. referencedClasses: [],
  34804. messageSends: []
  34805. }),
  34806. $globals.SendNode);
  34807. $core.addMethod(
  34808. $core.method({
  34809. selector: "superSend",
  34810. protocol: "accessing",
  34811. fn: function (){
  34812. var self=this,$self=this;
  34813. return $core.withContext(function($ctx1) {
  34814. var $2,$1;
  34815. $2=$self._receiver();
  34816. $ctx1.sendIdx["receiver"]=1;
  34817. $1=$recv($2)._notNil();
  34818. return $recv($1)._and_((function(){
  34819. return $core.withContext(function($ctx2) {
  34820. return $recv($self._receiver())._isSuperKeyword();
  34821. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34822. }));
  34823. }, function($ctx1) {$ctx1.fill(self,"superSend",{},$globals.SendNode)});
  34824. },
  34825. args: [],
  34826. source: "superSend\x0a\x09^ self receiver notNil and: [ self receiver isSuperKeyword ]",
  34827. referencedClasses: [],
  34828. messageSends: ["and:", "notNil", "receiver", "isSuperKeyword"]
  34829. }),
  34830. $globals.SendNode);
  34831. $core.addClass("SequenceNode", $globals.ASTNode, ["temps", "pragmas", "scope"], "Compiler-AST");
  34832. $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).";
  34833. $core.addMethod(
  34834. $core.method({
  34835. selector: "acceptDagVisitor:",
  34836. protocol: "visiting",
  34837. fn: function (aVisitor){
  34838. var self=this,$self=this;
  34839. return $core.withContext(function($ctx1) {
  34840. return $recv(aVisitor)._visitSequenceNode_(self);
  34841. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.SequenceNode)});
  34842. },
  34843. args: ["aVisitor"],
  34844. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitSequenceNode: self",
  34845. referencedClasses: [],
  34846. messageSends: ["visitSequenceNode:"]
  34847. }),
  34848. $globals.SequenceNode);
  34849. $core.addMethod(
  34850. $core.method({
  34851. selector: "asBlockSequenceNode",
  34852. protocol: "building",
  34853. fn: function (){
  34854. var self=this,$self=this;
  34855. return $core.withContext(function($ctx1) {
  34856. var $1;
  34857. $1=$recv($globals.BlockSequenceNode)._new();
  34858. $recv($1)._position_($self._position());
  34859. $recv($1)._source_($self._source());
  34860. $recv($1)._dagChildren_($self._dagChildren());
  34861. $recv($1)._temps_($self._temps());
  34862. $recv($1)._pragmas_($self._pragmas());
  34863. return $recv($1)._yourself();
  34864. }, function($ctx1) {$ctx1.fill(self,"asBlockSequenceNode",{},$globals.SequenceNode)});
  34865. },
  34866. args: [],
  34867. source: "asBlockSequenceNode\x0a\x09^ BlockSequenceNode new\x0a\x09\x09position: self position;\x0a\x09\x09source: self source;\x0a\x09\x09dagChildren: self dagChildren;\x0a\x09\x09temps: self temps;\x0a\x09\x09pragmas: self pragmas;\x0a\x09\x09yourself",
  34868. referencedClasses: ["BlockSequenceNode"],
  34869. messageSends: ["position:", "new", "position", "source:", "source", "dagChildren:", "dagChildren", "temps:", "temps", "pragmas:", "pragmas", "yourself"]
  34870. }),
  34871. $globals.SequenceNode);
  34872. $core.addMethod(
  34873. $core.method({
  34874. selector: "isSequenceNode",
  34875. protocol: "testing",
  34876. fn: function (){
  34877. var self=this,$self=this;
  34878. return true;
  34879. },
  34880. args: [],
  34881. source: "isSequenceNode\x0a\x09^ true",
  34882. referencedClasses: [],
  34883. messageSends: []
  34884. }),
  34885. $globals.SequenceNode);
  34886. $core.addMethod(
  34887. $core.method({
  34888. selector: "pragmas",
  34889. protocol: "accessing",
  34890. fn: function (){
  34891. var self=this,$self=this;
  34892. return $core.withContext(function($ctx1) {
  34893. var $1,$receiver;
  34894. $1=$self["@pragmas"];
  34895. if(($receiver = $1) == null || $receiver.a$nil){
  34896. return [];
  34897. } else {
  34898. return $1;
  34899. }
  34900. }, function($ctx1) {$ctx1.fill(self,"pragmas",{},$globals.SequenceNode)});
  34901. },
  34902. args: [],
  34903. source: "pragmas\x0a\x09^ pragmas ifNil: [ #() ]",
  34904. referencedClasses: [],
  34905. messageSends: ["ifNil:"]
  34906. }),
  34907. $globals.SequenceNode);
  34908. $core.addMethod(
  34909. $core.method({
  34910. selector: "pragmas:",
  34911. protocol: "accessing",
  34912. fn: function (aCollection){
  34913. var self=this,$self=this;
  34914. $self["@pragmas"]=aCollection;
  34915. return self;
  34916. },
  34917. args: ["aCollection"],
  34918. source: "pragmas: aCollection\x0a\x09pragmas := aCollection",
  34919. referencedClasses: [],
  34920. messageSends: []
  34921. }),
  34922. $globals.SequenceNode);
  34923. $core.addMethod(
  34924. $core.method({
  34925. selector: "scope",
  34926. protocol: "accessing",
  34927. fn: function (){
  34928. var self=this,$self=this;
  34929. return $self["@scope"];
  34930. },
  34931. args: [],
  34932. source: "scope\x0a\x09^ scope",
  34933. referencedClasses: [],
  34934. messageSends: []
  34935. }),
  34936. $globals.SequenceNode);
  34937. $core.addMethod(
  34938. $core.method({
  34939. selector: "scope:",
  34940. protocol: "accessing",
  34941. fn: function (aLexicalScope){
  34942. var self=this,$self=this;
  34943. $self["@scope"]=aLexicalScope;
  34944. return self;
  34945. },
  34946. args: ["aLexicalScope"],
  34947. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  34948. referencedClasses: [],
  34949. messageSends: []
  34950. }),
  34951. $globals.SequenceNode);
  34952. $core.addMethod(
  34953. $core.method({
  34954. selector: "temps",
  34955. protocol: "accessing",
  34956. fn: function (){
  34957. var self=this,$self=this;
  34958. return $core.withContext(function($ctx1) {
  34959. var $1,$receiver;
  34960. $1=$self["@temps"];
  34961. if(($receiver = $1) == null || $receiver.a$nil){
  34962. return [];
  34963. } else {
  34964. return $1;
  34965. }
  34966. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.SequenceNode)});
  34967. },
  34968. args: [],
  34969. source: "temps\x0a\x09^ temps ifNil: [ #() ]",
  34970. referencedClasses: [],
  34971. messageSends: ["ifNil:"]
  34972. }),
  34973. $globals.SequenceNode);
  34974. $core.addMethod(
  34975. $core.method({
  34976. selector: "temps:",
  34977. protocol: "accessing",
  34978. fn: function (aCollection){
  34979. var self=this,$self=this;
  34980. $self["@temps"]=aCollection;
  34981. return self;
  34982. },
  34983. args: ["aCollection"],
  34984. source: "temps: aCollection\x0a\x09temps := aCollection",
  34985. referencedClasses: [],
  34986. messageSends: []
  34987. }),
  34988. $globals.SequenceNode);
  34989. $core.addClass("BlockSequenceNode", $globals.SequenceNode, [], "Compiler-AST");
  34990. $globals.BlockSequenceNode.comment="I represent an special sequence node for block scopes.";
  34991. $core.addMethod(
  34992. $core.method({
  34993. selector: "acceptDagVisitor:",
  34994. protocol: "visiting",
  34995. fn: function (aVisitor){
  34996. var self=this,$self=this;
  34997. return $core.withContext(function($ctx1) {
  34998. return $recv(aVisitor)._visitBlockSequenceNode_(self);
  34999. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.BlockSequenceNode)});
  35000. },
  35001. args: ["aVisitor"],
  35002. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitBlockSequenceNode: self",
  35003. referencedClasses: [],
  35004. messageSends: ["visitBlockSequenceNode:"]
  35005. }),
  35006. $globals.BlockSequenceNode);
  35007. $core.addMethod(
  35008. $core.method({
  35009. selector: "isBlockSequenceNode",
  35010. protocol: "testing",
  35011. fn: function (){
  35012. var self=this,$self=this;
  35013. return true;
  35014. },
  35015. args: [],
  35016. source: "isBlockSequenceNode\x0a\x09^ true",
  35017. referencedClasses: [],
  35018. messageSends: []
  35019. }),
  35020. $globals.BlockSequenceNode);
  35021. $core.addMethod(
  35022. $core.method({
  35023. selector: "pragmas:",
  35024. protocol: "visiting",
  35025. fn: function (aCollection){
  35026. var self=this,$self=this;
  35027. return $core.withContext(function($ctx1) {
  35028. var $1;
  35029. $recv(aCollection)._ifNotEmpty_((function(){
  35030. return $core.withContext(function($ctx2) {
  35031. return $recv($globals.CompilerError)._signal_("Block must have no pragmas.");
  35032. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35033. }));
  35034. $1=(
  35035. $ctx1.supercall = true,
  35036. ($globals.BlockSequenceNode.superclass||$boot.nilAsClass).fn.prototype._pragmas_.apply($self, [aCollection]));
  35037. $ctx1.supercall = false;
  35038. return $1;
  35039. }, function($ctx1) {$ctx1.fill(self,"pragmas:",{aCollection:aCollection},$globals.BlockSequenceNode)});
  35040. },
  35041. args: ["aCollection"],
  35042. source: "pragmas: aCollection\x0a\x09aCollection ifNotEmpty: [\x0a\x09\x09CompilerError signal: 'Block must have no pragmas.' ].\x0a\x09^ super pragmas: aCollection",
  35043. referencedClasses: ["CompilerError"],
  35044. messageSends: ["ifNotEmpty:", "signal:", "pragmas:"]
  35045. }),
  35046. $globals.BlockSequenceNode);
  35047. $core.addClass("ValueNode", $globals.ASTNode, ["value"], "Compiler-AST");
  35048. $globals.ValueNode.comment="I represent a value node.";
  35049. $core.addMethod(
  35050. $core.method({
  35051. selector: "acceptDagVisitor:",
  35052. protocol: "visiting",
  35053. fn: function (aVisitor){
  35054. var self=this,$self=this;
  35055. return $core.withContext(function($ctx1) {
  35056. return $recv(aVisitor)._visitValueNode_(self);
  35057. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.ValueNode)});
  35058. },
  35059. args: ["aVisitor"],
  35060. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitValueNode: self",
  35061. referencedClasses: [],
  35062. messageSends: ["visitValueNode:"]
  35063. }),
  35064. $globals.ValueNode);
  35065. $core.addMethod(
  35066. $core.method({
  35067. selector: "isImmutable",
  35068. protocol: "testing",
  35069. fn: function (){
  35070. var self=this,$self=this;
  35071. return $core.withContext(function($ctx1) {
  35072. return $recv($self._value())._isImmutable();
  35073. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.ValueNode)});
  35074. },
  35075. args: [],
  35076. source: "isImmutable\x0a\x09^ self value isImmutable",
  35077. referencedClasses: [],
  35078. messageSends: ["isImmutable", "value"]
  35079. }),
  35080. $globals.ValueNode);
  35081. $core.addMethod(
  35082. $core.method({
  35083. selector: "isValueNode",
  35084. protocol: "testing",
  35085. fn: function (){
  35086. var self=this,$self=this;
  35087. return true;
  35088. },
  35089. args: [],
  35090. source: "isValueNode\x0a\x09^ true",
  35091. referencedClasses: [],
  35092. messageSends: []
  35093. }),
  35094. $globals.ValueNode);
  35095. $core.addMethod(
  35096. $core.method({
  35097. selector: "value",
  35098. protocol: "accessing",
  35099. fn: function (){
  35100. var self=this,$self=this;
  35101. return $self["@value"];
  35102. },
  35103. args: [],
  35104. source: "value\x0a\x09^ value",
  35105. referencedClasses: [],
  35106. messageSends: []
  35107. }),
  35108. $globals.ValueNode);
  35109. $core.addMethod(
  35110. $core.method({
  35111. selector: "value:",
  35112. protocol: "accessing",
  35113. fn: function (anObject){
  35114. var self=this,$self=this;
  35115. $self["@value"]=anObject;
  35116. return self;
  35117. },
  35118. args: ["anObject"],
  35119. source: "value: anObject\x0a\x09value := anObject",
  35120. referencedClasses: [],
  35121. messageSends: []
  35122. }),
  35123. $globals.ValueNode);
  35124. $core.addClass("VariableNode", $globals.ValueNode, ["assigned", "binding"], "Compiler-AST");
  35125. $globals.VariableNode.comment="I represent an variable node.";
  35126. $core.addMethod(
  35127. $core.method({
  35128. selector: "acceptDagVisitor:",
  35129. protocol: "visiting",
  35130. fn: function (aVisitor){
  35131. var self=this,$self=this;
  35132. return $core.withContext(function($ctx1) {
  35133. return $recv(aVisitor)._visitVariableNode_(self);
  35134. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.VariableNode)});
  35135. },
  35136. args: ["aVisitor"],
  35137. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitVariableNode: self",
  35138. referencedClasses: [],
  35139. messageSends: ["visitVariableNode:"]
  35140. }),
  35141. $globals.VariableNode);
  35142. $core.addMethod(
  35143. $core.method({
  35144. selector: "alias",
  35145. protocol: "accessing",
  35146. fn: function (){
  35147. var self=this,$self=this;
  35148. return $core.withContext(function($ctx1) {
  35149. return $recv($self._binding())._alias();
  35150. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.VariableNode)});
  35151. },
  35152. args: [],
  35153. source: "alias\x0a\x09^ self binding alias",
  35154. referencedClasses: [],
  35155. messageSends: ["alias", "binding"]
  35156. }),
  35157. $globals.VariableNode);
  35158. $core.addMethod(
  35159. $core.method({
  35160. selector: "assigned",
  35161. protocol: "accessing",
  35162. fn: function (){
  35163. var self=this,$self=this;
  35164. return $core.withContext(function($ctx1) {
  35165. var $1,$receiver;
  35166. $1=$self["@assigned"];
  35167. if(($receiver = $1) == null || $receiver.a$nil){
  35168. return false;
  35169. } else {
  35170. return $1;
  35171. }
  35172. }, function($ctx1) {$ctx1.fill(self,"assigned",{},$globals.VariableNode)});
  35173. },
  35174. args: [],
  35175. source: "assigned\x0a\x09^ assigned ifNil: [ false ]",
  35176. referencedClasses: [],
  35177. messageSends: ["ifNil:"]
  35178. }),
  35179. $globals.VariableNode);
  35180. $core.addMethod(
  35181. $core.method({
  35182. selector: "assigned:",
  35183. protocol: "accessing",
  35184. fn: function (aBoolean){
  35185. var self=this,$self=this;
  35186. $self["@assigned"]=aBoolean;
  35187. return self;
  35188. },
  35189. args: ["aBoolean"],
  35190. source: "assigned: aBoolean\x0a\x09assigned := aBoolean",
  35191. referencedClasses: [],
  35192. messageSends: []
  35193. }),
  35194. $globals.VariableNode);
  35195. $core.addMethod(
  35196. $core.method({
  35197. selector: "beAssigned",
  35198. protocol: "accessing",
  35199. fn: function (){
  35200. var self=this,$self=this;
  35201. return $core.withContext(function($ctx1) {
  35202. $recv($self._binding())._validateAssignment();
  35203. $self["@assigned"]=true;
  35204. return self;
  35205. }, function($ctx1) {$ctx1.fill(self,"beAssigned",{},$globals.VariableNode)});
  35206. },
  35207. args: [],
  35208. source: "beAssigned\x0a\x09self binding validateAssignment.\x0a\x09assigned := true",
  35209. referencedClasses: [],
  35210. messageSends: ["validateAssignment", "binding"]
  35211. }),
  35212. $globals.VariableNode);
  35213. $core.addMethod(
  35214. $core.method({
  35215. selector: "binding",
  35216. protocol: "accessing",
  35217. fn: function (){
  35218. var self=this,$self=this;
  35219. return $self["@binding"];
  35220. },
  35221. args: [],
  35222. source: "binding\x0a\x09^ binding",
  35223. referencedClasses: [],
  35224. messageSends: []
  35225. }),
  35226. $globals.VariableNode);
  35227. $core.addMethod(
  35228. $core.method({
  35229. selector: "binding:",
  35230. protocol: "accessing",
  35231. fn: function (aScopeVar){
  35232. var self=this,$self=this;
  35233. $self["@binding"]=aScopeVar;
  35234. return self;
  35235. },
  35236. args: ["aScopeVar"],
  35237. source: "binding: aScopeVar\x0a\x09binding := aScopeVar",
  35238. referencedClasses: [],
  35239. messageSends: []
  35240. }),
  35241. $globals.VariableNode);
  35242. $core.addMethod(
  35243. $core.method({
  35244. selector: "isArgument",
  35245. protocol: "testing",
  35246. fn: function (){
  35247. var self=this,$self=this;
  35248. return $core.withContext(function($ctx1) {
  35249. return $recv($self._binding())._isArgVar();
  35250. }, function($ctx1) {$ctx1.fill(self,"isArgument",{},$globals.VariableNode)});
  35251. },
  35252. args: [],
  35253. source: "isArgument\x0a\x09^ self binding isArgVar",
  35254. referencedClasses: [],
  35255. messageSends: ["isArgVar", "binding"]
  35256. }),
  35257. $globals.VariableNode);
  35258. $core.addMethod(
  35259. $core.method({
  35260. selector: "isImmutable",
  35261. protocol: "testing",
  35262. fn: function (){
  35263. var self=this,$self=this;
  35264. return $core.withContext(function($ctx1) {
  35265. return $recv($self._binding())._isImmutable();
  35266. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.VariableNode)});
  35267. },
  35268. args: [],
  35269. source: "isImmutable\x0a\x09^ self binding isImmutable",
  35270. referencedClasses: [],
  35271. messageSends: ["isImmutable", "binding"]
  35272. }),
  35273. $globals.VariableNode);
  35274. $core.addMethod(
  35275. $core.method({
  35276. selector: "isNavigationNode",
  35277. protocol: "testing",
  35278. fn: function (){
  35279. var self=this,$self=this;
  35280. return true;
  35281. },
  35282. args: [],
  35283. source: "isNavigationNode\x0a\x09^ true",
  35284. referencedClasses: [],
  35285. messageSends: []
  35286. }),
  35287. $globals.VariableNode);
  35288. $core.addMethod(
  35289. $core.method({
  35290. selector: "isSuperKeyword",
  35291. protocol: "testing",
  35292. fn: function (){
  35293. var self=this,$self=this;
  35294. return $core.withContext(function($ctx1) {
  35295. return $recv($self._value()).__eq("super");
  35296. }, function($ctx1) {$ctx1.fill(self,"isSuperKeyword",{},$globals.VariableNode)});
  35297. },
  35298. args: [],
  35299. source: "isSuperKeyword\x0a\x09^ self value = 'super'",
  35300. referencedClasses: [],
  35301. messageSends: ["=", "value"]
  35302. }),
  35303. $globals.VariableNode);
  35304. $core.addMethod(
  35305. $core.method({
  35306. selector: "isVariableNode",
  35307. protocol: "testing",
  35308. fn: function (){
  35309. var self=this,$self=this;
  35310. return true;
  35311. },
  35312. args: [],
  35313. source: "isVariableNode\x0a\x09^ true",
  35314. referencedClasses: [],
  35315. messageSends: []
  35316. }),
  35317. $globals.VariableNode);
  35318. $core.addMethod(
  35319. $core.method({
  35320. selector: "navigationLink",
  35321. protocol: "accessing",
  35322. fn: function (){
  35323. var self=this,$self=this;
  35324. return $core.withContext(function($ctx1) {
  35325. return $self._value();
  35326. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.VariableNode)});
  35327. },
  35328. args: [],
  35329. source: "navigationLink\x0a\x09^ self value",
  35330. referencedClasses: [],
  35331. messageSends: ["value"]
  35332. }),
  35333. $globals.VariableNode);
  35334. $core.addClass("CompilerError", $globals.Error, [], "Compiler-AST");
  35335. $globals.CompilerError.comment="I am the common superclass of all compiling errors.";
  35336. $core.addClass("ParentFakingPathDagVisitor", $globals.PathDagVisitor, ["setParentSelector"], "Compiler-AST");
  35337. $globals.ParentFakingPathDagVisitor.comment="I am base class of `DagNode` visitor.\x0a\x0aI hold the path of ancestors up to actual node\x0ain `self path`.";
  35338. $core.addMethod(
  35339. $core.method({
  35340. selector: "visit:",
  35341. protocol: "visiting",
  35342. fn: function (aNode){
  35343. var self=this,$self=this;
  35344. return $core.withContext(function($ctx1) {
  35345. var $1;
  35346. $recv($self._path())._ifNotEmpty_((function(p){
  35347. return $core.withContext(function($ctx2) {
  35348. return $recv(aNode)._parent_($recv(p)._last());
  35349. }, function($ctx2) {$ctx2.fillBlock({p:p},$ctx1,1)});
  35350. }));
  35351. $1=(
  35352. $ctx1.supercall = true,
  35353. ($globals.ParentFakingPathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
  35354. $ctx1.supercall = false;
  35355. return $1;
  35356. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ParentFakingPathDagVisitor)});
  35357. },
  35358. args: ["aNode"],
  35359. source: "visit: aNode\x0a\x09self path ifNotEmpty: [ :p | aNode parent: p last ].\x0a\x09^ super visit: aNode",
  35360. referencedClasses: [],
  35361. messageSends: ["ifNotEmpty:", "path", "parent:", "last", "visit:"]
  35362. }),
  35363. $globals.ParentFakingPathDagVisitor);
  35364. $core.addClass("NodeVisitor", $globals.ParentFakingPathDagVisitor, [], "Compiler-AST");
  35365. $globals.NodeVisitor.comment="I am the abstract super class of all AST node visitors.";
  35366. $core.addMethod(
  35367. $core.method({
  35368. selector: "visitAssignmentNode:",
  35369. protocol: "visiting",
  35370. fn: function (aNode){
  35371. var self=this,$self=this;
  35372. return $core.withContext(function($ctx1) {
  35373. return $self._visitDagNode_(aNode);
  35374. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.NodeVisitor)});
  35375. },
  35376. args: ["aNode"],
  35377. source: "visitAssignmentNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35378. referencedClasses: [],
  35379. messageSends: ["visitDagNode:"]
  35380. }),
  35381. $globals.NodeVisitor);
  35382. $core.addMethod(
  35383. $core.method({
  35384. selector: "visitBlockNode:",
  35385. protocol: "visiting",
  35386. fn: function (aNode){
  35387. var self=this,$self=this;
  35388. return $core.withContext(function($ctx1) {
  35389. return $self._visitDagNode_(aNode);
  35390. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.NodeVisitor)});
  35391. },
  35392. args: ["aNode"],
  35393. source: "visitBlockNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35394. referencedClasses: [],
  35395. messageSends: ["visitDagNode:"]
  35396. }),
  35397. $globals.NodeVisitor);
  35398. $core.addMethod(
  35399. $core.method({
  35400. selector: "visitBlockSequenceNode:",
  35401. protocol: "visiting",
  35402. fn: function (aNode){
  35403. var self=this,$self=this;
  35404. return $core.withContext(function($ctx1) {
  35405. return $self._visitSequenceNode_(aNode);
  35406. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  35407. },
  35408. args: ["aNode"],
  35409. source: "visitBlockSequenceNode: aNode\x0a\x09^ self visitSequenceNode: aNode",
  35410. referencedClasses: [],
  35411. messageSends: ["visitSequenceNode:"]
  35412. }),
  35413. $globals.NodeVisitor);
  35414. $core.addMethod(
  35415. $core.method({
  35416. selector: "visitCascadeNode:",
  35417. protocol: "visiting",
  35418. fn: function (aNode){
  35419. var self=this,$self=this;
  35420. return $core.withContext(function($ctx1) {
  35421. return $self._visitDagNode_(aNode);
  35422. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.NodeVisitor)});
  35423. },
  35424. args: ["aNode"],
  35425. source: "visitCascadeNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35426. referencedClasses: [],
  35427. messageSends: ["visitDagNode:"]
  35428. }),
  35429. $globals.NodeVisitor);
  35430. $core.addMethod(
  35431. $core.method({
  35432. selector: "visitDagNode:",
  35433. protocol: "visiting",
  35434. fn: function (aNode){
  35435. var self=this,$self=this;
  35436. return $core.withContext(function($ctx1) {
  35437. return $self._visitDagNodeVariantSimple_(aNode);
  35438. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.NodeVisitor)});
  35439. },
  35440. args: ["aNode"],
  35441. source: "visitDagNode: aNode\x0a\x09^ self visitDagNodeVariantSimple: aNode",
  35442. referencedClasses: [],
  35443. messageSends: ["visitDagNodeVariantSimple:"]
  35444. }),
  35445. $globals.NodeVisitor);
  35446. $core.addMethod(
  35447. $core.method({
  35448. selector: "visitDynamicArrayNode:",
  35449. protocol: "visiting",
  35450. fn: function (aNode){
  35451. var self=this,$self=this;
  35452. return $core.withContext(function($ctx1) {
  35453. return $self._visitDagNode_(aNode);
  35454. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode},$globals.NodeVisitor)});
  35455. },
  35456. args: ["aNode"],
  35457. source: "visitDynamicArrayNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35458. referencedClasses: [],
  35459. messageSends: ["visitDagNode:"]
  35460. }),
  35461. $globals.NodeVisitor);
  35462. $core.addMethod(
  35463. $core.method({
  35464. selector: "visitDynamicDictionaryNode:",
  35465. protocol: "visiting",
  35466. fn: function (aNode){
  35467. var self=this,$self=this;
  35468. return $core.withContext(function($ctx1) {
  35469. return $self._visitDagNode_(aNode);
  35470. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode},$globals.NodeVisitor)});
  35471. },
  35472. args: ["aNode"],
  35473. source: "visitDynamicDictionaryNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35474. referencedClasses: [],
  35475. messageSends: ["visitDagNode:"]
  35476. }),
  35477. $globals.NodeVisitor);
  35478. $core.addMethod(
  35479. $core.method({
  35480. selector: "visitJSStatementNode:",
  35481. protocol: "visiting",
  35482. fn: function (aNode){
  35483. var self=this,$self=this;
  35484. return $core.withContext(function($ctx1) {
  35485. return $self._visitDagNode_(aNode);
  35486. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.NodeVisitor)});
  35487. },
  35488. args: ["aNode"],
  35489. source: "visitJSStatementNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35490. referencedClasses: [],
  35491. messageSends: ["visitDagNode:"]
  35492. }),
  35493. $globals.NodeVisitor);
  35494. $core.addMethod(
  35495. $core.method({
  35496. selector: "visitMethodNode:",
  35497. protocol: "visiting",
  35498. fn: function (aNode){
  35499. var self=this,$self=this;
  35500. return $core.withContext(function($ctx1) {
  35501. return $self._visitDagNode_(aNode);
  35502. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.NodeVisitor)});
  35503. },
  35504. args: ["aNode"],
  35505. source: "visitMethodNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35506. referencedClasses: [],
  35507. messageSends: ["visitDagNode:"]
  35508. }),
  35509. $globals.NodeVisitor);
  35510. $core.addMethod(
  35511. $core.method({
  35512. selector: "visitReturnNode:",
  35513. protocol: "visiting",
  35514. fn: function (aNode){
  35515. var self=this,$self=this;
  35516. return $core.withContext(function($ctx1) {
  35517. return $self._visitDagNode_(aNode);
  35518. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.NodeVisitor)});
  35519. },
  35520. args: ["aNode"],
  35521. source: "visitReturnNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35522. referencedClasses: [],
  35523. messageSends: ["visitDagNode:"]
  35524. }),
  35525. $globals.NodeVisitor);
  35526. $core.addMethod(
  35527. $core.method({
  35528. selector: "visitSendNode:",
  35529. protocol: "visiting",
  35530. fn: function (aNode){
  35531. var self=this,$self=this;
  35532. return $core.withContext(function($ctx1) {
  35533. return $self._visitDagNode_(aNode);
  35534. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.NodeVisitor)});
  35535. },
  35536. args: ["aNode"],
  35537. source: "visitSendNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35538. referencedClasses: [],
  35539. messageSends: ["visitDagNode:"]
  35540. }),
  35541. $globals.NodeVisitor);
  35542. $core.addMethod(
  35543. $core.method({
  35544. selector: "visitSequenceNode:",
  35545. protocol: "visiting",
  35546. fn: function (aNode){
  35547. var self=this,$self=this;
  35548. return $core.withContext(function($ctx1) {
  35549. return $self._visitDagNode_(aNode);
  35550. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  35551. },
  35552. args: ["aNode"],
  35553. source: "visitSequenceNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35554. referencedClasses: [],
  35555. messageSends: ["visitDagNode:"]
  35556. }),
  35557. $globals.NodeVisitor);
  35558. $core.addMethod(
  35559. $core.method({
  35560. selector: "visitValueNode:",
  35561. protocol: "visiting",
  35562. fn: function (aNode){
  35563. var self=this,$self=this;
  35564. return $core.withContext(function($ctx1) {
  35565. return $self._visitDagNode_(aNode);
  35566. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.NodeVisitor)});
  35567. },
  35568. args: ["aNode"],
  35569. source: "visitValueNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35570. referencedClasses: [],
  35571. messageSends: ["visitDagNode:"]
  35572. }),
  35573. $globals.NodeVisitor);
  35574. $core.addMethod(
  35575. $core.method({
  35576. selector: "visitVariableNode:",
  35577. protocol: "visiting",
  35578. fn: function (aNode){
  35579. var self=this,$self=this;
  35580. return $core.withContext(function($ctx1) {
  35581. return $self._visitDagNode_(aNode);
  35582. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.NodeVisitor)});
  35583. },
  35584. args: ["aNode"],
  35585. source: "visitVariableNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35586. referencedClasses: [],
  35587. messageSends: ["visitDagNode:"]
  35588. }),
  35589. $globals.NodeVisitor);
  35590. $core.addMethod(
  35591. $core.method({
  35592. selector: "ast",
  35593. protocol: "*Compiler-AST",
  35594. fn: function (){
  35595. var self=this,$self=this;
  35596. return $core.withContext(function($ctx1) {
  35597. var $1;
  35598. $1=$self._source();
  35599. $ctx1.sendIdx["source"]=1;
  35600. $recv($1)._ifEmpty_((function(){
  35601. return $core.withContext(function($ctx2) {
  35602. return $recv($globals.CompilerError)._signal_("Method source is empty");
  35603. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35604. }));
  35605. return $recv($recv($globals.Compiler)._new())._ast_forClass_protocol_($self._source(),$self._methodClass(),$self._protocol());
  35606. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.CompiledMethod)});
  35607. },
  35608. args: [],
  35609. source: "ast\x0a\x09self source ifEmpty: [ CompilerError signal: 'Method source is empty' ].\x0a\x09\x0a\x09^ Compiler new\x0a\x09\x09ast: self source\x0a\x09\x09forClass: self methodClass\x0a\x09\x09protocol: self protocol",
  35610. referencedClasses: ["CompilerError", "Compiler"],
  35611. messageSends: ["ifEmpty:", "source", "signal:", "ast:forClass:protocol:", "new", "methodClass", "protocol"]
  35612. }),
  35613. $globals.CompiledMethod);
  35614. });
  35615. define('amber_core/Compiler-Core',["amber/boot", "amber_core/Compiler-AST", "amber_core/Kernel-Collections", "amber_core/Kernel-Objects"], function($boot){"use strict";
  35616. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  35617. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  35618. var $pkg = $core.addPackage("Compiler-Core");
  35619. $pkg.innerEval = function (expr) { return eval(expr); };
  35620. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  35621. $core.addClass("AbstractCodeGenerator", $globals.Object, ["currentClass", "currentPackage", "source"], "Compiler-Core");
  35622. $globals.AbstractCodeGenerator.comment="I am the abstract super class of all code generators and provide their common API.";
  35623. $core.addMethod(
  35624. $core.method({
  35625. selector: "compileNode:",
  35626. protocol: "compiling",
  35627. fn: function (aNode){
  35628. var self=this,$self=this;
  35629. return $core.withContext(function($ctx1) {
  35630. return $recv($self._transformers())._inject_into_(aNode,(function(input,transformer){
  35631. return $core.withContext(function($ctx2) {
  35632. return $recv(transformer)._value_(input);
  35633. }, function($ctx2) {$ctx2.fillBlock({input:input,transformer:transformer},$ctx1,1)});
  35634. }));
  35635. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode},$globals.AbstractCodeGenerator)});
  35636. },
  35637. args: ["aNode"],
  35638. source: "compileNode: aNode\x0a\x09^ self transformers\x0a\x09\x09inject: aNode\x0a\x09\x09into: [ :input :transformer | transformer value: input ]",
  35639. referencedClasses: [],
  35640. messageSends: ["inject:into:", "transformers", "value:"]
  35641. }),
  35642. $globals.AbstractCodeGenerator);
  35643. $core.addMethod(
  35644. $core.method({
  35645. selector: "currentClass",
  35646. protocol: "accessing",
  35647. fn: function (){
  35648. var self=this,$self=this;
  35649. return $self["@currentClass"];
  35650. },
  35651. args: [],
  35652. source: "currentClass\x0a\x09^ currentClass",
  35653. referencedClasses: [],
  35654. messageSends: []
  35655. }),
  35656. $globals.AbstractCodeGenerator);
  35657. $core.addMethod(
  35658. $core.method({
  35659. selector: "currentClass:",
  35660. protocol: "accessing",
  35661. fn: function (aClass){
  35662. var self=this,$self=this;
  35663. $self["@currentClass"]=aClass;
  35664. return self;
  35665. },
  35666. args: ["aClass"],
  35667. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  35668. referencedClasses: [],
  35669. messageSends: []
  35670. }),
  35671. $globals.AbstractCodeGenerator);
  35672. $core.addMethod(
  35673. $core.method({
  35674. selector: "currentPackage",
  35675. protocol: "accessing",
  35676. fn: function (){
  35677. var self=this,$self=this;
  35678. return $self["@currentPackage"];
  35679. },
  35680. args: [],
  35681. source: "currentPackage\x0a\x09^ currentPackage",
  35682. referencedClasses: [],
  35683. messageSends: []
  35684. }),
  35685. $globals.AbstractCodeGenerator);
  35686. $core.addMethod(
  35687. $core.method({
  35688. selector: "currentPackage:",
  35689. protocol: "accessing",
  35690. fn: function (anObject){
  35691. var self=this,$self=this;
  35692. $self["@currentPackage"]=anObject;
  35693. return self;
  35694. },
  35695. args: ["anObject"],
  35696. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  35697. referencedClasses: [],
  35698. messageSends: []
  35699. }),
  35700. $globals.AbstractCodeGenerator);
  35701. $core.addMethod(
  35702. $core.method({
  35703. selector: "pseudoVariables",
  35704. protocol: "accessing",
  35705. fn: function (){
  35706. var self=this,$self=this;
  35707. return $core.withContext(function($ctx1) {
  35708. return $recv($globals.Smalltalk)._pseudoVariableNames();
  35709. }, function($ctx1) {$ctx1.fill(self,"pseudoVariables",{},$globals.AbstractCodeGenerator)});
  35710. },
  35711. args: [],
  35712. source: "pseudoVariables\x0a\x09^ Smalltalk pseudoVariableNames",
  35713. referencedClasses: ["Smalltalk"],
  35714. messageSends: ["pseudoVariableNames"]
  35715. }),
  35716. $globals.AbstractCodeGenerator);
  35717. $core.addMethod(
  35718. $core.method({
  35719. selector: "source",
  35720. protocol: "accessing",
  35721. fn: function (){
  35722. var self=this,$self=this;
  35723. return $core.withContext(function($ctx1) {
  35724. var $1,$receiver;
  35725. $1=$self["@source"];
  35726. if(($receiver = $1) == null || $receiver.a$nil){
  35727. return "";
  35728. } else {
  35729. return $1;
  35730. }
  35731. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.AbstractCodeGenerator)});
  35732. },
  35733. args: [],
  35734. source: "source\x0a\x09^ source ifNil: [ '' ]",
  35735. referencedClasses: [],
  35736. messageSends: ["ifNil:"]
  35737. }),
  35738. $globals.AbstractCodeGenerator);
  35739. $core.addMethod(
  35740. $core.method({
  35741. selector: "source:",
  35742. protocol: "accessing",
  35743. fn: function (aString){
  35744. var self=this,$self=this;
  35745. $self["@source"]=aString;
  35746. return self;
  35747. },
  35748. args: ["aString"],
  35749. source: "source: aString\x0a\x09source := aString",
  35750. referencedClasses: [],
  35751. messageSends: []
  35752. }),
  35753. $globals.AbstractCodeGenerator);
  35754. $core.addMethod(
  35755. $core.method({
  35756. selector: "transformers",
  35757. protocol: "compiling",
  35758. fn: function (){
  35759. var self=this,$self=this;
  35760. var dict;
  35761. return $core.withContext(function($ctx1) {
  35762. dict=$self._transformersDictionary();
  35763. return $recv($recv($recv($recv(dict)._keys())._asArray())._sort())._collect_((function(each){
  35764. return $core.withContext(function($ctx2) {
  35765. return $recv(dict)._at_(each);
  35766. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35767. }));
  35768. }, function($ctx1) {$ctx1.fill(self,"transformers",{dict:dict},$globals.AbstractCodeGenerator)});
  35769. },
  35770. args: [],
  35771. source: "transformers\x0a\x09| dict |\x0a\x09dict := self transformersDictionary.\x0a\x09^ dict keys asArray sort collect: [ :each | dict at: each ]",
  35772. referencedClasses: [],
  35773. messageSends: ["transformersDictionary", "collect:", "sort", "asArray", "keys", "at:"]
  35774. }),
  35775. $globals.AbstractCodeGenerator);
  35776. $core.addMethod(
  35777. $core.method({
  35778. selector: "transformersDictionary",
  35779. protocol: "compiling",
  35780. fn: function (){
  35781. var self=this,$self=this;
  35782. return $core.withContext(function($ctx1) {
  35783. $self._subclassResponsibility();
  35784. return self;
  35785. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.AbstractCodeGenerator)});
  35786. },
  35787. args: [],
  35788. source: "transformersDictionary\x0a\x09self subclassResponsibility",
  35789. referencedClasses: [],
  35790. messageSends: ["subclassResponsibility"]
  35791. }),
  35792. $globals.AbstractCodeGenerator);
  35793. $core.addClass("CodeGenerator", $globals.AbstractCodeGenerator, ["transformersDictionary"], "Compiler-Core");
  35794. $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.";
  35795. $core.addMethod(
  35796. $core.method({
  35797. selector: "irTranslator",
  35798. protocol: "compiling",
  35799. fn: function (){
  35800. var self=this,$self=this;
  35801. return $core.withContext(function($ctx1) {
  35802. var $1;
  35803. $1=$recv($self._irTranslatorClass())._new();
  35804. $recv($1)._currentClass_($self._currentClass());
  35805. return $recv($1)._yourself();
  35806. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},$globals.CodeGenerator)});
  35807. },
  35808. args: [],
  35809. source: "irTranslator\x0a\x09^ self irTranslatorClass new\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09yourself",
  35810. referencedClasses: [],
  35811. messageSends: ["currentClass:", "new", "irTranslatorClass", "currentClass", "yourself"]
  35812. }),
  35813. $globals.CodeGenerator);
  35814. $core.addMethod(
  35815. $core.method({
  35816. selector: "irTranslatorClass",
  35817. protocol: "compiling",
  35818. fn: function (){
  35819. var self=this,$self=this;
  35820. return $globals.IRJSTranslator;
  35821. },
  35822. args: [],
  35823. source: "irTranslatorClass\x0a\x09^ IRJSTranslator",
  35824. referencedClasses: ["IRJSTranslator"],
  35825. messageSends: []
  35826. }),
  35827. $globals.CodeGenerator);
  35828. $core.addMethod(
  35829. $core.method({
  35830. selector: "semanticAnalyzer",
  35831. protocol: "compiling",
  35832. fn: function (){
  35833. var self=this,$self=this;
  35834. return $core.withContext(function($ctx1) {
  35835. var $1;
  35836. $1=$recv($globals.SemanticAnalyzer)._on_($self._currentClass());
  35837. $recv($1)._thePackage_($self._currentPackage());
  35838. return $recv($1)._yourself();
  35839. }, function($ctx1) {$ctx1.fill(self,"semanticAnalyzer",{},$globals.CodeGenerator)});
  35840. },
  35841. args: [],
  35842. source: "semanticAnalyzer\x0a\x09^ (SemanticAnalyzer on: self currentClass)\x0a\x09\x09thePackage: self currentPackage;\x0a\x09\x09yourself",
  35843. referencedClasses: ["SemanticAnalyzer"],
  35844. messageSends: ["thePackage:", "on:", "currentClass", "currentPackage", "yourself"]
  35845. }),
  35846. $globals.CodeGenerator);
  35847. $core.addMethod(
  35848. $core.method({
  35849. selector: "transformersDictionary",
  35850. protocol: "compiling",
  35851. fn: function (){
  35852. var self=this,$self=this;
  35853. return $core.withContext(function($ctx1) {
  35854. var $1,$2,$receiver;
  35855. $1=$self["@transformersDictionary"];
  35856. if(($receiver = $1) == null || $receiver.a$nil){
  35857. $2=$recv($globals.Dictionary)._new();
  35858. $ctx1.sendIdx["new"]=1;
  35859. $recv($2)._at_put_("1000-earlyPragmas",$recv($globals.EarlyPragmator)._new());
  35860. $ctx1.sendIdx["at:put:"]=1;
  35861. $recv($2)._at_put_("2000-semantic",$self._semanticAnalyzer());
  35862. $ctx1.sendIdx["at:put:"]=2;
  35863. $recv($2)._at_put_("5000-astToIr",$self._translator());
  35864. $ctx1.sendIdx["at:put:"]=3;
  35865. $recv($2)._at_put_("8000-irToJs",$self._irTranslator());
  35866. $self["@transformersDictionary"]=$recv($2)._yourself();
  35867. return $self["@transformersDictionary"];
  35868. } else {
  35869. return $1;
  35870. }
  35871. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.CodeGenerator)});
  35872. },
  35873. args: [],
  35874. source: "transformersDictionary\x0a\x09^ transformersDictionary ifNil: [ transformersDictionary := Dictionary new\x0a\x09\x09at: '1000-earlyPragmas' put: EarlyPragmator new;\x0a\x09\x09at: '2000-semantic' put: self semanticAnalyzer;\x0a\x09\x09at: '5000-astToIr' put: self translator;\x0a\x09\x09at: '8000-irToJs' put: self irTranslator;\x0a\x09\x09yourself ]",
  35875. referencedClasses: ["Dictionary", "EarlyPragmator"],
  35876. messageSends: ["ifNil:", "at:put:", "new", "semanticAnalyzer", "translator", "irTranslator", "yourself"]
  35877. }),
  35878. $globals.CodeGenerator);
  35879. $core.addMethod(
  35880. $core.method({
  35881. selector: "translator",
  35882. protocol: "compiling",
  35883. fn: function (){
  35884. var self=this,$self=this;
  35885. return $core.withContext(function($ctx1) {
  35886. var $1;
  35887. $1=$recv($globals.IRASTTranslator)._new();
  35888. $recv($1)._source_($self._source());
  35889. $recv($1)._theClass_($self._currentClass());
  35890. return $recv($1)._yourself();
  35891. }, function($ctx1) {$ctx1.fill(self,"translator",{},$globals.CodeGenerator)});
  35892. },
  35893. args: [],
  35894. source: "translator\x0a\x09^ IRASTTranslator new\x0a\x09\x09source: self source;\x0a\x09\x09theClass: self currentClass;\x0a\x09\x09yourself",
  35895. referencedClasses: ["IRASTTranslator"],
  35896. messageSends: ["source:", "new", "source", "theClass:", "currentClass", "yourself"]
  35897. }),
  35898. $globals.CodeGenerator);
  35899. $core.addClass("Compiler", $globals.Object, ["currentClass", "currentPackage", "source", "codeGeneratorClass", "codeGenerator"], "Compiler-Core");
  35900. $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`";
  35901. $core.addMethod(
  35902. $core.method({
  35903. selector: "ast:forClass:protocol:",
  35904. protocol: "compiling",
  35905. fn: function (aString,aClass,anotherString){
  35906. var self=this,$self=this;
  35907. return $core.withContext(function($ctx1) {
  35908. var $early={};
  35909. try {
  35910. $self._source_(aString);
  35911. $self._forClass_protocol_(aClass,anotherString);
  35912. $recv($recv($self._codeGenerator())._transformersDictionary())._at_put_("2500-astCheckpoint",(function(x){
  35913. throw $early=[x];
  35914. }));
  35915. $self._compileNode_($self._parse_(aString));
  35916. $recv($globals.CompilerError)._signal_("AST transformation failed.");
  35917. return self;
  35918. }
  35919. catch(e) {if(e===$early)return e[0]; throw e}
  35920. }, function($ctx1) {$ctx1.fill(self,"ast:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString},$globals.Compiler)});
  35921. },
  35922. args: ["aString", "aClass", "anotherString"],
  35923. 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.'",
  35924. referencedClasses: ["CompilerError"],
  35925. messageSends: ["source:", "forClass:protocol:", "at:put:", "transformersDictionary", "codeGenerator", "compileNode:", "parse:", "signal:"]
  35926. }),
  35927. $globals.Compiler);
  35928. $core.addMethod(
  35929. $core.method({
  35930. selector: "cleanCodeGenerator",
  35931. protocol: "accessing",
  35932. fn: function (){
  35933. var self=this,$self=this;
  35934. $self["@codeGenerator"]=nil;
  35935. return self;
  35936. },
  35937. args: [],
  35938. source: "cleanCodeGenerator\x0a\x09codeGenerator := nil",
  35939. referencedClasses: [],
  35940. messageSends: []
  35941. }),
  35942. $globals.Compiler);
  35943. $core.addMethod(
  35944. $core.method({
  35945. selector: "codeGenerator",
  35946. protocol: "accessing",
  35947. fn: function (){
  35948. var self=this,$self=this;
  35949. return $core.withContext(function($ctx1) {
  35950. var $1,$2,$receiver;
  35951. $1=$self["@codeGenerator"];
  35952. if(($receiver = $1) == null || $receiver.a$nil){
  35953. $2=$recv($self._codeGeneratorClass())._new();
  35954. $recv($2)._source_($self._source());
  35955. $recv($2)._currentClass_($self._currentClass());
  35956. $recv($2)._currentPackage_($self._currentPackage());
  35957. $self["@codeGenerator"]=$recv($2)._yourself();
  35958. return $self["@codeGenerator"];
  35959. } else {
  35960. return $1;
  35961. }
  35962. }, function($ctx1) {$ctx1.fill(self,"codeGenerator",{},$globals.Compiler)});
  35963. },
  35964. args: [],
  35965. 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 ]",
  35966. referencedClasses: [],
  35967. messageSends: ["ifNil:", "source:", "new", "codeGeneratorClass", "source", "currentClass:", "currentClass", "currentPackage:", "currentPackage", "yourself"]
  35968. }),
  35969. $globals.Compiler);
  35970. $core.addMethod(
  35971. $core.method({
  35972. selector: "codeGeneratorClass",
  35973. protocol: "accessing",
  35974. fn: function (){
  35975. var self=this,$self=this;
  35976. return $core.withContext(function($ctx1) {
  35977. var $1,$receiver;
  35978. $1=$self["@codeGeneratorClass"];
  35979. if(($receiver = $1) == null || $receiver.a$nil){
  35980. return $globals.InliningCodeGenerator;
  35981. } else {
  35982. return $1;
  35983. }
  35984. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},$globals.Compiler)});
  35985. },
  35986. args: [],
  35987. source: "codeGeneratorClass\x0a\x09^ codeGeneratorClass ifNil: [ InliningCodeGenerator ]",
  35988. referencedClasses: ["InliningCodeGenerator"],
  35989. messageSends: ["ifNil:"]
  35990. }),
  35991. $globals.Compiler);
  35992. $core.addMethod(
  35993. $core.method({
  35994. selector: "codeGeneratorClass:",
  35995. protocol: "accessing",
  35996. fn: function (aClass){
  35997. var self=this,$self=this;
  35998. $self["@codeGeneratorClass"]=aClass;
  35999. return self;
  36000. },
  36001. args: ["aClass"],
  36002. source: "codeGeneratorClass: aClass\x0a\x09codeGeneratorClass := aClass",
  36003. referencedClasses: [],
  36004. messageSends: []
  36005. }),
  36006. $globals.Compiler);
  36007. $core.addMethod(
  36008. $core.method({
  36009. selector: "compile:forClass:protocol:",
  36010. protocol: "compiling",
  36011. fn: function (aString,aClass,anotherString){
  36012. var self=this,$self=this;
  36013. return $core.withContext(function($ctx1) {
  36014. $self._source_(aString);
  36015. $self._forClass_protocol_(aClass,anotherString);
  36016. return $self._compileNode_($self._parse_(aString));
  36017. }, function($ctx1) {$ctx1.fill(self,"compile:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString},$globals.Compiler)});
  36018. },
  36019. args: ["aString", "aClass", "anotherString"],
  36020. source: "compile: aString forClass: aClass protocol: anotherString\x0a\x09^ self\x0a\x09\x09source: aString;\x0a\x09\x09forClass: aClass protocol: anotherString;\x0a\x09\x09compileNode: (self parse: aString)",
  36021. referencedClasses: [],
  36022. messageSends: ["source:", "forClass:protocol:", "compileNode:", "parse:"]
  36023. }),
  36024. $globals.Compiler);
  36025. $core.addMethod(
  36026. $core.method({
  36027. selector: "compileExpression:on:",
  36028. protocol: "compiling",
  36029. fn: function (aString,anObject){
  36030. var self=this,$self=this;
  36031. return $core.withContext(function($ctx1) {
  36032. var $1;
  36033. $1=$recv("xxxDoIt ^ [ ".__comma(aString)).__comma(" ] value");
  36034. $ctx1.sendIdx[","]=1;
  36035. return $self._compile_forClass_protocol_($1,$recv(anObject)._class(),"**xxxDoIt");
  36036. }, function($ctx1) {$ctx1.fill(self,"compileExpression:on:",{aString:aString,anObject:anObject},$globals.Compiler)});
  36037. },
  36038. args: ["aString", "anObject"],
  36039. source: "compileExpression: aString on: anObject\x0a\x09^ self\x0a\x09\x09compile: 'xxxDoIt ^ [ ', aString, ' ] value'\x0a\x09\x09forClass: anObject class\x0a\x09\x09protocol: '**xxxDoIt'",
  36040. referencedClasses: [],
  36041. messageSends: ["compile:forClass:protocol:", ",", "class"]
  36042. }),
  36043. $globals.Compiler);
  36044. $core.addMethod(
  36045. $core.method({
  36046. selector: "compileNode:",
  36047. protocol: "compiling",
  36048. fn: function (aNode){
  36049. var self=this,$self=this;
  36050. var result;
  36051. return $core.withContext(function($ctx1) {
  36052. result=$recv($self._codeGenerator())._compileNode_(aNode);
  36053. $self._cleanCodeGenerator();
  36054. return result;
  36055. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,result:result},$globals.Compiler)});
  36056. },
  36057. args: ["aNode"],
  36058. source: "compileNode: aNode\x0a | result |\x0a\x09result := self codeGenerator compileNode: aNode.\x0a\x09self cleanCodeGenerator.\x0a\x09^ result",
  36059. referencedClasses: [],
  36060. messageSends: ["compileNode:", "codeGenerator", "cleanCodeGenerator"]
  36061. }),
  36062. $globals.Compiler);
  36063. $core.addMethod(
  36064. $core.method({
  36065. selector: "currentClass",
  36066. protocol: "accessing",
  36067. fn: function (){
  36068. var self=this,$self=this;
  36069. return $self["@currentClass"];
  36070. },
  36071. args: [],
  36072. source: "currentClass\x0a\x09^ currentClass",
  36073. referencedClasses: [],
  36074. messageSends: []
  36075. }),
  36076. $globals.Compiler);
  36077. $core.addMethod(
  36078. $core.method({
  36079. selector: "currentClass:",
  36080. protocol: "accessing",
  36081. fn: function (aClass){
  36082. var self=this,$self=this;
  36083. $self["@currentClass"]=aClass;
  36084. return self;
  36085. },
  36086. args: ["aClass"],
  36087. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  36088. referencedClasses: [],
  36089. messageSends: []
  36090. }),
  36091. $globals.Compiler);
  36092. $core.addMethod(
  36093. $core.method({
  36094. selector: "currentPackage",
  36095. protocol: "accessing",
  36096. fn: function (){
  36097. var self=this,$self=this;
  36098. return $self["@currentPackage"];
  36099. },
  36100. args: [],
  36101. source: "currentPackage\x0a\x09^ currentPackage",
  36102. referencedClasses: [],
  36103. messageSends: []
  36104. }),
  36105. $globals.Compiler);
  36106. $core.addMethod(
  36107. $core.method({
  36108. selector: "currentPackage:",
  36109. protocol: "accessing",
  36110. fn: function (anObject){
  36111. var self=this,$self=this;
  36112. $self["@currentPackage"]=anObject;
  36113. return self;
  36114. },
  36115. args: ["anObject"],
  36116. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  36117. referencedClasses: [],
  36118. messageSends: []
  36119. }),
  36120. $globals.Compiler);
  36121. $core.addMethod(
  36122. $core.method({
  36123. selector: "eval:",
  36124. protocol: "compiling",
  36125. fn: function (aString){
  36126. var self=this,$self=this;
  36127. return $core.withContext(function($ctx1) {
  36128. return eval(aString);
  36129. return self;
  36130. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Compiler)});
  36131. },
  36132. args: ["aString"],
  36133. source: "eval: aString\x0a\x09<inlineJS: 'return eval(aString)'>",
  36134. referencedClasses: [],
  36135. messageSends: []
  36136. }),
  36137. $globals.Compiler);
  36138. $core.addMethod(
  36139. $core.method({
  36140. selector: "eval:forPackage:",
  36141. protocol: "compiling",
  36142. fn: function (aString,aPackage){
  36143. var self=this,$self=this;
  36144. return $core.withContext(function($ctx1) {
  36145. var $receiver;
  36146. if(($receiver = aPackage) == null || $receiver.a$nil){
  36147. return $self._eval_(aString);
  36148. $ctx1.sendIdx["eval:"]=1;
  36149. } else {
  36150. return $recv(aPackage)._eval_(aString);
  36151. }
  36152. }, function($ctx1) {$ctx1.fill(self,"eval:forPackage:",{aString:aString,aPackage:aPackage},$globals.Compiler)});
  36153. },
  36154. args: ["aString", "aPackage"],
  36155. source: "eval: aString forPackage: aPackage\x0a\x09^ aPackage\x0a\x09\x09ifNil: [ self eval: aString ]\x0a\x09\x09ifNotNil: [ aPackage eval: aString ]",
  36156. referencedClasses: [],
  36157. messageSends: ["ifNil:ifNotNil:", "eval:"]
  36158. }),
  36159. $globals.Compiler);
  36160. $core.addMethod(
  36161. $core.method({
  36162. selector: "evaluateExpression:",
  36163. protocol: "compiling",
  36164. fn: function (aString){
  36165. var self=this,$self=this;
  36166. return $core.withContext(function($ctx1) {
  36167. return $self._evaluateExpression_on_(aString,$recv($globals.DoIt)._new());
  36168. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:",{aString:aString},$globals.Compiler)});
  36169. },
  36170. args: ["aString"],
  36171. 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",
  36172. referencedClasses: ["DoIt"],
  36173. messageSends: ["evaluateExpression:on:", "new"]
  36174. }),
  36175. $globals.Compiler);
  36176. $core.addMethod(
  36177. $core.method({
  36178. selector: "evaluateExpression:on:",
  36179. protocol: "compiling",
  36180. fn: function (aString,anObject){
  36181. var self=this,$self=this;
  36182. var result,method;
  36183. return $core.withContext(function($ctx1) {
  36184. var $1;
  36185. method=$self._eval_($self._compileExpression_on_(aString,anObject));
  36186. $recv(method)._protocol_("**xxxDoIt");
  36187. $1=$recv(anObject)._class();
  36188. $ctx1.sendIdx["class"]=1;
  36189. $recv($1)._addCompiledMethod_(method);
  36190. result=$recv(anObject)._xxxDoIt();
  36191. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  36192. return result;
  36193. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:on:",{aString:aString,anObject:anObject,result:result,method:method},$globals.Compiler)});
  36194. },
  36195. args: ["aString", "anObject"],
  36196. source: "evaluateExpression: aString on: anObject\x0a\x09\x22Unlike #eval: evaluate a Smalltalk expression with anObject as the receiver and answer the returned object\x22\x0a\x09| result method |\x0a\x09method := self eval: (self compileExpression: aString on: anObject).\x0a\x09method protocol: '**xxxDoIt'.\x0a\x09anObject class addCompiledMethod: method.\x0a\x09result := anObject xxxDoIt.\x0a\x09anObject class removeCompiledMethod: method.\x0a\x09^ result",
  36197. referencedClasses: [],
  36198. messageSends: ["eval:", "compileExpression:on:", "protocol:", "addCompiledMethod:", "class", "xxxDoIt", "removeCompiledMethod:"]
  36199. }),
  36200. $globals.Compiler);
  36201. $core.addMethod(
  36202. $core.method({
  36203. selector: "forClass:protocol:",
  36204. protocol: "compiling",
  36205. fn: function (aClass,anotherString){
  36206. var self=this,$self=this;
  36207. return $core.withContext(function($ctx1) {
  36208. $self._currentPackage_($recv(aClass)._packageOfProtocol_(anotherString));
  36209. $self._currentClass_(aClass);
  36210. return self;
  36211. }, function($ctx1) {$ctx1.fill(self,"forClass:protocol:",{aClass:aClass,anotherString:anotherString},$globals.Compiler)});
  36212. },
  36213. args: ["aClass", "anotherString"],
  36214. source: "forClass: aClass protocol: anotherString\x0a\x09self\x0a\x09\x09currentPackage: (aClass packageOfProtocol: anotherString);\x0a\x09\x09currentClass: aClass",
  36215. referencedClasses: [],
  36216. messageSends: ["currentPackage:", "packageOfProtocol:", "currentClass:"]
  36217. }),
  36218. $globals.Compiler);
  36219. $core.addMethod(
  36220. $core.method({
  36221. selector: "install:forClass:protocol:",
  36222. protocol: "compiling",
  36223. fn: function (aString,aBehavior,anotherString){
  36224. var self=this,$self=this;
  36225. var compiledMethod;
  36226. return $core.withContext(function($ctx1) {
  36227. compiledMethod=$self._eval_forPackage_($self._compile_forClass_protocol_(aString,aBehavior,anotherString),$recv(aBehavior)._packageOfProtocol_(anotherString));
  36228. return $recv($recv($globals.ClassBuilder)._new())._installMethod_forClass_protocol_(compiledMethod,aBehavior,anotherString);
  36229. }, function($ctx1) {$ctx1.fill(self,"install:forClass:protocol:",{aString:aString,aBehavior:aBehavior,anotherString:anotherString,compiledMethod:compiledMethod},$globals.Compiler)});
  36230. },
  36231. args: ["aString", "aBehavior", "anotherString"],
  36232. source: "install: aString forClass: aBehavior protocol: anotherString\x0a\x09| compiledMethod |\x0a\x09compiledMethod := self\x0a\x09\x09eval: (self compile: aString forClass: aBehavior protocol: anotherString)\x0a\x09\x09forPackage: (aBehavior packageOfProtocol: anotherString).\x0a\x09^ ClassBuilder new\x0a\x09\x09installMethod: compiledMethod\x0a\x09\x09forClass: aBehavior\x0a\x09\x09protocol: anotherString",
  36233. referencedClasses: ["ClassBuilder"],
  36234. messageSends: ["eval:forPackage:", "compile:forClass:protocol:", "packageOfProtocol:", "installMethod:forClass:protocol:", "new"]
  36235. }),
  36236. $globals.Compiler);
  36237. $core.addMethod(
  36238. $core.method({
  36239. selector: "parse:",
  36240. protocol: "compiling",
  36241. fn: function (aString){
  36242. var self=this,$self=this;
  36243. return $core.withContext(function($ctx1) {
  36244. return $recv($globals.Smalltalk)._parse_(aString);
  36245. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.Compiler)});
  36246. },
  36247. args: ["aString"],
  36248. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  36249. referencedClasses: ["Smalltalk"],
  36250. messageSends: ["parse:"]
  36251. }),
  36252. $globals.Compiler);
  36253. $core.addMethod(
  36254. $core.method({
  36255. selector: "parseExpression:",
  36256. protocol: "compiling",
  36257. fn: function (aString){
  36258. var self=this,$self=this;
  36259. return $core.withContext(function($ctx1) {
  36260. var $1;
  36261. $1=$recv("doIt ^ [ ".__comma(aString)).__comma(" ] value");
  36262. $ctx1.sendIdx[","]=1;
  36263. return $self._parse_($1);
  36264. }, function($ctx1) {$ctx1.fill(self,"parseExpression:",{aString:aString},$globals.Compiler)});
  36265. },
  36266. args: ["aString"],
  36267. source: "parseExpression: aString\x0a\x09^ self parse: 'doIt ^ [ ', aString, ' ] value'",
  36268. referencedClasses: [],
  36269. messageSends: ["parse:", ","]
  36270. }),
  36271. $globals.Compiler);
  36272. $core.addMethod(
  36273. $core.method({
  36274. selector: "recompile:",
  36275. protocol: "compiling",
  36276. fn: function (aClass){
  36277. var self=this,$self=this;
  36278. return $core.withContext(function($ctx1) {
  36279. var $1,$2,$3,$receiver;
  36280. $recv($recv($recv(aClass)._methodDictionary())._values())._do_displayingProgress_((function(each){
  36281. return $core.withContext(function($ctx2) {
  36282. $1=$recv($recv(each)._methodClass()).__eq(aClass);
  36283. $ctx2.sendIdx["="]=1;
  36284. if($core.assert($1)){
  36285. return $self._install_forClass_protocol_($recv(each)._source(),aClass,$recv(each)._protocol());
  36286. }
  36287. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36288. }),"Recompiling ".__comma($recv(aClass)._name()));
  36289. $2=$recv(aClass)._theMetaClass();
  36290. if(($receiver = $2) == null || $receiver.a$nil){
  36291. $2;
  36292. } else {
  36293. var meta;
  36294. meta=$receiver;
  36295. $3=$recv(meta).__eq(aClass);
  36296. if(!$core.assert($3)){
  36297. $self._recompile_(meta);
  36298. }
  36299. }
  36300. return self;
  36301. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler)});
  36302. },
  36303. args: ["aClass"],
  36304. source: "recompile: aClass\x0a\x09aClass methodDictionary values\x0a\x09\x09do: [ :each | each methodClass = aClass ifTrue: [ \x0a\x09\x09\x09self \x0a\x09\x09\x09\x09install: each source \x0a\x09\x09\x09\x09forClass: aClass \x0a\x09\x09\x09\x09protocol: each protocol ] ]\x0a\x09\x09displayingProgress: 'Recompiling ', aClass name.\x0a\x09aClass theMetaClass ifNotNil: [ :meta |\x0a\x09\x09meta = aClass ifFalse: [ self recompile: meta ] ]",
  36305. referencedClasses: [],
  36306. messageSends: ["do:displayingProgress:", "values", "methodDictionary", "ifTrue:", "=", "methodClass", "install:forClass:protocol:", "source", "protocol", ",", "name", "ifNotNil:", "theMetaClass", "ifFalse:", "recompile:"]
  36307. }),
  36308. $globals.Compiler);
  36309. $core.addMethod(
  36310. $core.method({
  36311. selector: "recompileAll",
  36312. protocol: "compiling",
  36313. fn: function (){
  36314. var self=this,$self=this;
  36315. return $core.withContext(function($ctx1) {
  36316. $recv($recv($globals.Smalltalk)._classes())._do_displayingProgress_((function(each){
  36317. return $core.withContext(function($ctx2) {
  36318. return $self._recompile_(each);
  36319. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36320. }),"Compiling all classes...");
  36321. return self;
  36322. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler)});
  36323. },
  36324. args: [],
  36325. source: "recompileAll\x0a\x09Smalltalk classes \x0a\x09\x09do: [ :each | self recompile: each ]\x0a\x09\x09displayingProgress: 'Compiling all classes...'",
  36326. referencedClasses: ["Smalltalk"],
  36327. messageSends: ["do:displayingProgress:", "classes", "recompile:"]
  36328. }),
  36329. $globals.Compiler);
  36330. $core.addMethod(
  36331. $core.method({
  36332. selector: "source",
  36333. protocol: "accessing",
  36334. fn: function (){
  36335. var self=this,$self=this;
  36336. return $core.withContext(function($ctx1) {
  36337. var $1,$receiver;
  36338. $1=$self["@source"];
  36339. if(($receiver = $1) == null || $receiver.a$nil){
  36340. return "";
  36341. } else {
  36342. return $1;
  36343. }
  36344. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.Compiler)});
  36345. },
  36346. args: [],
  36347. source: "source\x0a\x09^ source ifNil: [ '' ]",
  36348. referencedClasses: [],
  36349. messageSends: ["ifNil:"]
  36350. }),
  36351. $globals.Compiler);
  36352. $core.addMethod(
  36353. $core.method({
  36354. selector: "source:",
  36355. protocol: "accessing",
  36356. fn: function (aString){
  36357. var self=this,$self=this;
  36358. $self["@source"]=aString;
  36359. return self;
  36360. },
  36361. args: ["aString"],
  36362. source: "source: aString\x0a\x09source := aString",
  36363. referencedClasses: [],
  36364. messageSends: []
  36365. }),
  36366. $globals.Compiler);
  36367. $core.addMethod(
  36368. $core.method({
  36369. selector: "eval:",
  36370. protocol: "evaluating",
  36371. fn: function (aString){
  36372. var self=this,$self=this;
  36373. return $core.withContext(function($ctx1) {
  36374. return $recv($self._new())._eval_(aString);
  36375. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Compiler.a$cls)});
  36376. },
  36377. args: ["aString"],
  36378. source: "eval: aString\x0a\x09^ self new eval: aString",
  36379. referencedClasses: [],
  36380. messageSends: ["eval:", "new"]
  36381. }),
  36382. $globals.Compiler.a$cls);
  36383. $core.addMethod(
  36384. $core.method({
  36385. selector: "recompile:",
  36386. protocol: "compiling",
  36387. fn: function (aClass){
  36388. var self=this,$self=this;
  36389. return $core.withContext(function($ctx1) {
  36390. $recv($self._new())._recompile_(aClass);
  36391. return self;
  36392. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler.a$cls)});
  36393. },
  36394. args: ["aClass"],
  36395. source: "recompile: aClass\x0a\x09self new recompile: aClass",
  36396. referencedClasses: [],
  36397. messageSends: ["recompile:", "new"]
  36398. }),
  36399. $globals.Compiler.a$cls);
  36400. $core.addMethod(
  36401. $core.method({
  36402. selector: "recompileAll",
  36403. protocol: "compiling",
  36404. fn: function (){
  36405. var self=this,$self=this;
  36406. return $core.withContext(function($ctx1) {
  36407. $recv($recv($globals.Smalltalk)._classes())._do_((function(each){
  36408. return $core.withContext(function($ctx2) {
  36409. return $self._recompile_(each);
  36410. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36411. }));
  36412. return self;
  36413. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler.a$cls)});
  36414. },
  36415. args: [],
  36416. source: "recompileAll\x0a\x09Smalltalk classes do: [ :each |\x0a\x09\x09self recompile: each ]",
  36417. referencedClasses: ["Smalltalk"],
  36418. messageSends: ["do:", "classes", "recompile:"]
  36419. }),
  36420. $globals.Compiler.a$cls);
  36421. $core.addClass("DoIt", $globals.Object, [], "Compiler-Core");
  36422. $globals.DoIt.comment="`DoIt` is the class used to compile and evaluate expressions. See `Compiler >> evaluateExpression:`.";
  36423. $core.addClass("Evaluator", $globals.Object, [], "Compiler-Core");
  36424. $globals.Evaluator.comment="I evaluate code against a receiver, dispatching #evaluate:on: to the receiver.";
  36425. $core.addMethod(
  36426. $core.method({
  36427. selector: "evaluate:context:",
  36428. protocol: "evaluating",
  36429. fn: function (aString,aContext){
  36430. var self=this,$self=this;
  36431. var compiler,ast;
  36432. return $core.withContext(function($ctx1) {
  36433. var $1;
  36434. var $early={};
  36435. try {
  36436. compiler=$recv($globals.Compiler)._new();
  36437. $recv((function(){
  36438. return $core.withContext(function($ctx2) {
  36439. ast=$recv(compiler)._parseExpression_(aString);
  36440. return ast;
  36441. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36442. }))._on_do_($globals.Error,(function(ex){
  36443. return $core.withContext(function($ctx2) {
  36444. throw $early=[$recv($globals.Terminal)._alert_($recv(ex)._messageText())];
  36445. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  36446. }));
  36447. $1=$recv($globals.AISemanticAnalyzer)._on_($recv($recv(aContext)._receiver())._class());
  36448. $recv($1)._context_(aContext);
  36449. $recv($1)._visit_(ast);
  36450. return $recv(aContext)._evaluateNode_(ast);
  36451. }
  36452. catch(e) {if(e===$early)return e[0]; throw e}
  36453. }, function($ctx1) {$ctx1.fill(self,"evaluate:context:",{aString:aString,aContext:aContext,compiler:compiler,ast:ast},$globals.Evaluator)});
  36454. },
  36455. args: ["aString", "aContext"],
  36456. 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",
  36457. referencedClasses: ["Compiler", "Error", "Terminal", "AISemanticAnalyzer"],
  36458. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "context:", "on:", "class", "receiver", "visit:", "evaluateNode:"]
  36459. }),
  36460. $globals.Evaluator);
  36461. $core.addMethod(
  36462. $core.method({
  36463. selector: "evaluate:for:",
  36464. protocol: "evaluating",
  36465. fn: function (aString,anObject){
  36466. var self=this,$self=this;
  36467. return $core.withContext(function($ctx1) {
  36468. return $recv(anObject)._evaluate_on_(aString,self);
  36469. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator)});
  36470. },
  36471. args: ["aString", "anObject"],
  36472. source: "evaluate: aString for: anObject\x0a\x09^ anObject evaluate: aString on: self",
  36473. referencedClasses: [],
  36474. messageSends: ["evaluate:on:"]
  36475. }),
  36476. $globals.Evaluator);
  36477. $core.addMethod(
  36478. $core.method({
  36479. selector: "evaluate:receiver:",
  36480. protocol: "evaluating",
  36481. fn: function (aString,anObject){
  36482. var self=this,$self=this;
  36483. var compiler;
  36484. return $core.withContext(function($ctx1) {
  36485. var $early={};
  36486. try {
  36487. compiler=$recv($globals.Compiler)._new();
  36488. $recv((function(){
  36489. return $core.withContext(function($ctx2) {
  36490. return $recv(compiler)._parseExpression_(aString);
  36491. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36492. }))._on_do_($globals.Error,(function(ex){
  36493. return $core.withContext(function($ctx2) {
  36494. throw $early=[$recv($globals.Terminal)._alert_($recv(ex)._messageText())];
  36495. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  36496. }));
  36497. return $recv(compiler)._evaluateExpression_on_(aString,anObject);
  36498. }
  36499. catch(e) {if(e===$early)return e[0]; throw e}
  36500. }, function($ctx1) {$ctx1.fill(self,"evaluate:receiver:",{aString:aString,anObject:anObject,compiler:compiler},$globals.Evaluator)});
  36501. },
  36502. args: ["aString", "anObject"],
  36503. 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",
  36504. referencedClasses: ["Compiler", "Error", "Terminal"],
  36505. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "evaluateExpression:on:"]
  36506. }),
  36507. $globals.Evaluator);
  36508. $core.addMethod(
  36509. $core.method({
  36510. selector: "evaluate:for:",
  36511. protocol: "instance creation",
  36512. fn: function (aString,anObject){
  36513. var self=this,$self=this;
  36514. return $core.withContext(function($ctx1) {
  36515. return $recv($self._new())._evaluate_for_(aString,anObject);
  36516. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator.a$cls)});
  36517. },
  36518. args: ["aString", "anObject"],
  36519. source: "evaluate: aString for: anObject\x0a\x09^ self new evaluate: aString for: anObject",
  36520. referencedClasses: [],
  36521. messageSends: ["evaluate:for:", "new"]
  36522. }),
  36523. $globals.Evaluator.a$cls);
  36524. $core.addClass("Pragmator", $globals.NodeVisitor, ["methodNode", "sequenceNode"], "Compiler-Core");
  36525. $globals.Pragmator.comment="I am abstract superclass for pragma-processing transformer.\x0a\x0aMy subclasses should implement messages for each pragma\x0athey process. Pragma processing checks if a message is known\x0ato a class but not to its superclass. IOW, each and only those\x0apragmas are processed which are defined as methods in the subclass.\x0a\x0aThese messages can access sequence node in which\x0aa pragma occurred and its containing method node\x0aas `self sequenceNode` and `self methodNode`.\x0a\x0aSee `EarlyPragmator` for an example.";
  36526. $core.addMethod(
  36527. $core.method({
  36528. selector: "canProcessPragma:",
  36529. protocol: "pragma processing",
  36530. fn: function (aMessage){
  36531. var self=this,$self=this;
  36532. var selector;
  36533. return $core.withContext(function($ctx1) {
  36534. selector=$recv(aMessage)._selector();
  36535. return $recv($self._respondsTo_(selector))._and_((function(){
  36536. return $core.withContext(function($ctx2) {
  36537. return $recv($recv($recv($self._class())._superclass())._canUnderstand_(selector))._not();
  36538. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36539. }));
  36540. }, function($ctx1) {$ctx1.fill(self,"canProcessPragma:",{aMessage:aMessage,selector:selector},$globals.Pragmator)});
  36541. },
  36542. args: ["aMessage"],
  36543. 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]",
  36544. referencedClasses: [],
  36545. messageSends: ["selector", "and:", "respondsTo:", "not", "canUnderstand:", "superclass", "class"]
  36546. }),
  36547. $globals.Pragmator);
  36548. $core.addMethod(
  36549. $core.method({
  36550. selector: "methodNode",
  36551. protocol: "accessing",
  36552. fn: function (){
  36553. var self=this,$self=this;
  36554. return $self["@methodNode"];
  36555. },
  36556. args: [],
  36557. source: "methodNode\x0a\x09^ methodNode",
  36558. referencedClasses: [],
  36559. messageSends: []
  36560. }),
  36561. $globals.Pragmator);
  36562. $core.addMethod(
  36563. $core.method({
  36564. selector: "methodNode:",
  36565. protocol: "accessing",
  36566. fn: function (anObject){
  36567. var self=this,$self=this;
  36568. $self["@methodNode"]=anObject;
  36569. return self;
  36570. },
  36571. args: ["anObject"],
  36572. source: "methodNode: anObject\x0a\x09methodNode := anObject",
  36573. referencedClasses: [],
  36574. messageSends: []
  36575. }),
  36576. $globals.Pragmator);
  36577. $core.addMethod(
  36578. $core.method({
  36579. selector: "processPragma:",
  36580. protocol: "pragma processing",
  36581. fn: function (aMessage){
  36582. var self=this,$self=this;
  36583. return $core.withContext(function($ctx1) {
  36584. var $1;
  36585. $1=$self._canProcessPragma_(aMessage);
  36586. if($core.assert($1)){
  36587. return $recv(aMessage)._sendTo_(self);
  36588. }
  36589. return self;
  36590. }, function($ctx1) {$ctx1.fill(self,"processPragma:",{aMessage:aMessage},$globals.Pragmator)});
  36591. },
  36592. args: ["aMessage"],
  36593. source: "processPragma: aMessage\x0a\x09(self canProcessPragma: aMessage) ifTrue: [\x0a\x09\x09^ aMessage sendTo: self ]",
  36594. referencedClasses: [],
  36595. messageSends: ["ifTrue:", "canProcessPragma:", "sendTo:"]
  36596. }),
  36597. $globals.Pragmator);
  36598. $core.addMethod(
  36599. $core.method({
  36600. selector: "sequenceNode",
  36601. protocol: "accessing",
  36602. fn: function (){
  36603. var self=this,$self=this;
  36604. return $self["@sequenceNode"];
  36605. },
  36606. args: [],
  36607. source: "sequenceNode\x0a\x09^ sequenceNode",
  36608. referencedClasses: [],
  36609. messageSends: []
  36610. }),
  36611. $globals.Pragmator);
  36612. $core.addMethod(
  36613. $core.method({
  36614. selector: "sequenceNode:",
  36615. protocol: "accessing",
  36616. fn: function (anObject){
  36617. var self=this,$self=this;
  36618. $self["@sequenceNode"]=anObject;
  36619. return self;
  36620. },
  36621. args: ["anObject"],
  36622. source: "sequenceNode: anObject\x0a\x09sequenceNode := anObject",
  36623. referencedClasses: [],
  36624. messageSends: []
  36625. }),
  36626. $globals.Pragmator);
  36627. $core.addMethod(
  36628. $core.method({
  36629. selector: "visitMethodNode:",
  36630. protocol: "pragma processing",
  36631. fn: function (aNode){
  36632. var self=this,$self=this;
  36633. return $core.withContext(function($ctx1) {
  36634. var $1;
  36635. $self._methodNode_(aNode);
  36636. $1=(
  36637. $ctx1.supercall = true,
  36638. ($globals.Pragmator.superclass||$boot.nilAsClass).fn.prototype._visitMethodNode_.apply($self, [aNode]));
  36639. $ctx1.supercall = false;
  36640. return $1;
  36641. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.Pragmator)});
  36642. },
  36643. args: ["aNode"],
  36644. source: "visitMethodNode: aNode\x0a\x09self methodNode: aNode.\x0a\x09^ super visitMethodNode: aNode",
  36645. referencedClasses: [],
  36646. messageSends: ["methodNode:", "visitMethodNode:"]
  36647. }),
  36648. $globals.Pragmator);
  36649. $core.addMethod(
  36650. $core.method({
  36651. selector: "visitSequenceNode:",
  36652. protocol: "pragma processing",
  36653. fn: function (aNode){
  36654. var self=this,$self=this;
  36655. return $core.withContext(function($ctx1) {
  36656. var $1;
  36657. $self._sequenceNode_(aNode);
  36658. $recv($recv(aNode)._pragmas())._do_((function(each){
  36659. return $core.withContext(function($ctx2) {
  36660. return $self._processPragma_(each);
  36661. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36662. }));
  36663. $1=(
  36664. $ctx1.supercall = true,
  36665. ($globals.Pragmator.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($self, [aNode]));
  36666. $ctx1.supercall = false;
  36667. return $1;
  36668. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.Pragmator)});
  36669. },
  36670. args: ["aNode"],
  36671. source: "visitSequenceNode: aNode\x0a\x09self sequenceNode: aNode.\x0a\x09aNode pragmas do: [ :each | self processPragma: each ].\x0a\x09^ super visitSequenceNode: aNode",
  36672. referencedClasses: [],
  36673. messageSends: ["sequenceNode:", "do:", "pragmas", "processPragma:", "visitSequenceNode:"]
  36674. }),
  36675. $globals.Pragmator);
  36676. $core.addClass("EarlyPragmator", $globals.Pragmator, [], "Compiler-Core");
  36677. $core.addMethod(
  36678. $core.method({
  36679. selector: "asVariableName",
  36680. protocol: "*Compiler-Core",
  36681. fn: function (){
  36682. var self=this,$self=this;
  36683. return $core.withContext(function($ctx1) {
  36684. var $1;
  36685. $1=$recv($recv($globals.Smalltalk)._reservedWords())._includes_(self);
  36686. if($core.assert($1)){
  36687. return $self.__comma("_");
  36688. } else {
  36689. return self;
  36690. }
  36691. }, function($ctx1) {$ctx1.fill(self,"asVariableName",{},$globals.String)});
  36692. },
  36693. args: [],
  36694. source: "asVariableName\x0a\x09^ (Smalltalk reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]",
  36695. referencedClasses: ["Smalltalk"],
  36696. messageSends: ["ifTrue:ifFalse:", "includes:", "reservedWords", ","]
  36697. }),
  36698. $globals.String);
  36699. });
  36700. define('amber_core/Compiler-Semantic',["amber/boot", "amber_core/Compiler-AST", "amber_core/Compiler-Core", "amber_core/Kernel-Objects"], function($boot){"use strict";
  36701. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  36702. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  36703. var $pkg = $core.addPackage("Compiler-Semantic");
  36704. $pkg.innerEval = function (expr) { return eval(expr); };
  36705. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  36706. $core.addClass("LexicalScope", $globals.Object, ["node", "instruction", "temps", "args", "outerScope", "blockIndex"], "Compiler-Semantic");
  36707. $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.";
  36708. $core.addMethod(
  36709. $core.method({
  36710. selector: "addArg:",
  36711. protocol: "adding",
  36712. fn: function (aString){
  36713. var self=this,$self=this;
  36714. return $core.withContext(function($ctx1) {
  36715. var $1;
  36716. $1=$self._args();
  36717. $ctx1.sendIdx["args"]=1;
  36718. $recv($1)._at_put_(aString,$recv($globals.ArgVar)._on_(aString));
  36719. $recv($recv($self._args())._at_(aString))._scope_(self);
  36720. return self;
  36721. }, function($ctx1) {$ctx1.fill(self,"addArg:",{aString:aString},$globals.LexicalScope)});
  36722. },
  36723. args: ["aString"],
  36724. source: "addArg: aString\x0a\x09self args at: aString put: (ArgVar on: aString).\x0a\x09(self args at: aString) scope: self",
  36725. referencedClasses: ["ArgVar"],
  36726. messageSends: ["at:put:", "args", "on:", "scope:", "at:"]
  36727. }),
  36728. $globals.LexicalScope);
  36729. $core.addMethod(
  36730. $core.method({
  36731. selector: "addTemp:",
  36732. protocol: "adding",
  36733. fn: function (aString){
  36734. var self=this,$self=this;
  36735. return $core.withContext(function($ctx1) {
  36736. var $1;
  36737. $1=$self._temps();
  36738. $ctx1.sendIdx["temps"]=1;
  36739. $recv($1)._at_put_(aString,$recv($globals.TempVar)._on_(aString));
  36740. $recv($recv($self._temps())._at_(aString))._scope_(self);
  36741. return self;
  36742. }, function($ctx1) {$ctx1.fill(self,"addTemp:",{aString:aString},$globals.LexicalScope)});
  36743. },
  36744. args: ["aString"],
  36745. source: "addTemp: aString\x0a\x09self temps at: aString put: (TempVar on: aString).\x0a\x09(self temps at: aString) scope: self",
  36746. referencedClasses: ["TempVar"],
  36747. messageSends: ["at:put:", "temps", "on:", "scope:", "at:"]
  36748. }),
  36749. $globals.LexicalScope);
  36750. $core.addMethod(
  36751. $core.method({
  36752. selector: "alias",
  36753. protocol: "accessing",
  36754. fn: function (){
  36755. var self=this,$self=this;
  36756. return $core.withContext(function($ctx1) {
  36757. return "$ctx".__comma($recv($self._scopeLevel())._asString());
  36758. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.LexicalScope)});
  36759. },
  36760. args: [],
  36761. source: "alias\x0a\x09^ '$ctx', self scopeLevel asString",
  36762. referencedClasses: [],
  36763. messageSends: [",", "asString", "scopeLevel"]
  36764. }),
  36765. $globals.LexicalScope);
  36766. $core.addMethod(
  36767. $core.method({
  36768. selector: "allVariableNames",
  36769. protocol: "accessing",
  36770. fn: function (){
  36771. var self=this,$self=this;
  36772. return $core.withContext(function($ctx1) {
  36773. var $1;
  36774. $1=$recv($self._args())._keys();
  36775. $ctx1.sendIdx["keys"]=1;
  36776. return $recv($1).__comma($recv($self._temps())._keys());
  36777. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.LexicalScope)});
  36778. },
  36779. args: [],
  36780. source: "allVariableNames\x0a\x09^ self args keys, self temps keys",
  36781. referencedClasses: [],
  36782. messageSends: [",", "keys", "args", "temps"]
  36783. }),
  36784. $globals.LexicalScope);
  36785. $core.addMethod(
  36786. $core.method({
  36787. selector: "args",
  36788. protocol: "accessing",
  36789. fn: function (){
  36790. var self=this,$self=this;
  36791. return $core.withContext(function($ctx1) {
  36792. var $1,$receiver;
  36793. $1=$self["@args"];
  36794. if(($receiver = $1) == null || $receiver.a$nil){
  36795. $self["@args"]=$recv($globals.Dictionary)._new();
  36796. return $self["@args"];
  36797. } else {
  36798. return $1;
  36799. }
  36800. }, function($ctx1) {$ctx1.fill(self,"args",{},$globals.LexicalScope)});
  36801. },
  36802. args: [],
  36803. source: "args\x0a\x09^ args ifNil: [ args := Dictionary new ]",
  36804. referencedClasses: ["Dictionary"],
  36805. messageSends: ["ifNil:", "new"]
  36806. }),
  36807. $globals.LexicalScope);
  36808. $core.addMethod(
  36809. $core.method({
  36810. selector: "bindingFor:",
  36811. protocol: "accessing",
  36812. fn: function (aStringOrNode){
  36813. var self=this,$self=this;
  36814. return $core.withContext(function($ctx1) {
  36815. var $2,$3,$4,$5,$1;
  36816. $2=$self._pseudoVars();
  36817. $3=$recv(aStringOrNode)._value();
  36818. $ctx1.sendIdx["value"]=1;
  36819. $1=$recv($2)._at_ifAbsent_($3,(function(){
  36820. return $core.withContext(function($ctx2) {
  36821. $4=$self._args();
  36822. $5=$recv(aStringOrNode)._value();
  36823. $ctx2.sendIdx["value"]=2;
  36824. return $recv($4)._at_ifAbsent_($5,(function(){
  36825. return $core.withContext(function($ctx3) {
  36826. return $recv($self._temps())._at_ifAbsent_($recv(aStringOrNode)._value(),(function(){
  36827. return nil;
  36828. }));
  36829. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  36830. }));
  36831. $ctx2.sendIdx["at:ifAbsent:"]=2;
  36832. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36833. }));
  36834. $ctx1.sendIdx["at:ifAbsent:"]=1;
  36835. return $1;
  36836. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aStringOrNode:aStringOrNode},$globals.LexicalScope)});
  36837. },
  36838. args: ["aStringOrNode"],
  36839. 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 ]]]",
  36840. referencedClasses: [],
  36841. messageSends: ["at:ifAbsent:", "pseudoVars", "value", "args", "temps"]
  36842. }),
  36843. $globals.LexicalScope);
  36844. $core.addMethod(
  36845. $core.method({
  36846. selector: "blockIndex",
  36847. protocol: "accessing",
  36848. fn: function (){
  36849. var self=this,$self=this;
  36850. return $core.withContext(function($ctx1) {
  36851. var $1,$receiver;
  36852. $1=$self["@blockIndex"];
  36853. if(($receiver = $1) == null || $receiver.a$nil){
  36854. return (0);
  36855. } else {
  36856. return $1;
  36857. }
  36858. }, function($ctx1) {$ctx1.fill(self,"blockIndex",{},$globals.LexicalScope)});
  36859. },
  36860. args: [],
  36861. source: "blockIndex\x0a\x09^ blockIndex ifNil: [ 0 ]",
  36862. referencedClasses: [],
  36863. messageSends: ["ifNil:"]
  36864. }),
  36865. $globals.LexicalScope);
  36866. $core.addMethod(
  36867. $core.method({
  36868. selector: "blockIndex:",
  36869. protocol: "accessing",
  36870. fn: function (anInteger){
  36871. var self=this,$self=this;
  36872. $self["@blockIndex"]=anInteger;
  36873. return self;
  36874. },
  36875. args: ["anInteger"],
  36876. source: "blockIndex: anInteger \x0a\x09blockIndex := anInteger",
  36877. referencedClasses: [],
  36878. messageSends: []
  36879. }),
  36880. $globals.LexicalScope);
  36881. $core.addMethod(
  36882. $core.method({
  36883. selector: "canInlineNonLocalReturns",
  36884. protocol: "testing",
  36885. fn: function (){
  36886. var self=this,$self=this;
  36887. return $core.withContext(function($ctx1) {
  36888. return $recv($self._isInlined())._and_((function(){
  36889. return $core.withContext(function($ctx2) {
  36890. return $recv($self._outerScope())._canInlineNonLocalReturns();
  36891. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36892. }));
  36893. }, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{},$globals.LexicalScope)});
  36894. },
  36895. args: [],
  36896. source: "canInlineNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]",
  36897. referencedClasses: [],
  36898. messageSends: ["and:", "isInlined", "canInlineNonLocalReturns", "outerScope"]
  36899. }),
  36900. $globals.LexicalScope);
  36901. $core.addMethod(
  36902. $core.method({
  36903. selector: "instruction",
  36904. protocol: "accessing",
  36905. fn: function (){
  36906. var self=this,$self=this;
  36907. return $self["@instruction"];
  36908. },
  36909. args: [],
  36910. source: "instruction\x0a\x09^ instruction",
  36911. referencedClasses: [],
  36912. messageSends: []
  36913. }),
  36914. $globals.LexicalScope);
  36915. $core.addMethod(
  36916. $core.method({
  36917. selector: "instruction:",
  36918. protocol: "accessing",
  36919. fn: function (anIRInstruction){
  36920. var self=this,$self=this;
  36921. $self["@instruction"]=anIRInstruction;
  36922. return self;
  36923. },
  36924. args: ["anIRInstruction"],
  36925. source: "instruction: anIRInstruction\x0a\x09instruction := anIRInstruction",
  36926. referencedClasses: [],
  36927. messageSends: []
  36928. }),
  36929. $globals.LexicalScope);
  36930. $core.addMethod(
  36931. $core.method({
  36932. selector: "isBlockScope",
  36933. protocol: "testing",
  36934. fn: function (){
  36935. var self=this,$self=this;
  36936. return $core.withContext(function($ctx1) {
  36937. return $recv($self._isMethodScope())._not();
  36938. }, function($ctx1) {$ctx1.fill(self,"isBlockScope",{},$globals.LexicalScope)});
  36939. },
  36940. args: [],
  36941. source: "isBlockScope\x0a\x09^ self isMethodScope not",
  36942. referencedClasses: [],
  36943. messageSends: ["not", "isMethodScope"]
  36944. }),
  36945. $globals.LexicalScope);
  36946. $core.addMethod(
  36947. $core.method({
  36948. selector: "isInlined",
  36949. protocol: "testing",
  36950. fn: function (){
  36951. var self=this,$self=this;
  36952. return $core.withContext(function($ctx1) {
  36953. var $2,$1;
  36954. $2=$self._instruction();
  36955. $ctx1.sendIdx["instruction"]=1;
  36956. $1=$recv($2)._notNil();
  36957. return $recv($1)._and_((function(){
  36958. return $core.withContext(function($ctx2) {
  36959. return $recv($self._instruction())._isInlined();
  36960. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36961. }));
  36962. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},$globals.LexicalScope)});
  36963. },
  36964. args: [],
  36965. source: "isInlined\x0a\x09^ self instruction notNil and: [\x0a\x09\x09self instruction isInlined ]",
  36966. referencedClasses: [],
  36967. messageSends: ["and:", "notNil", "instruction", "isInlined"]
  36968. }),
  36969. $globals.LexicalScope);
  36970. $core.addMethod(
  36971. $core.method({
  36972. selector: "isMethodScope",
  36973. protocol: "testing",
  36974. fn: function (){
  36975. var self=this,$self=this;
  36976. return false;
  36977. },
  36978. args: [],
  36979. source: "isMethodScope\x0a\x09^ false",
  36980. referencedClasses: [],
  36981. messageSends: []
  36982. }),
  36983. $globals.LexicalScope);
  36984. $core.addMethod(
  36985. $core.method({
  36986. selector: "lookupVariable:",
  36987. protocol: "accessing",
  36988. fn: function (aNode){
  36989. var self=this,$self=this;
  36990. var lookup;
  36991. return $core.withContext(function($ctx1) {
  36992. var $1,$2,$receiver;
  36993. lookup=$self._bindingFor_(aNode);
  36994. $1=lookup;
  36995. if(($receiver = $1) == null || $receiver.a$nil){
  36996. $2=$self._outerScope();
  36997. $ctx1.sendIdx["outerScope"]=1;
  36998. if(($receiver = $2) == null || $receiver.a$nil){
  36999. lookup=$2;
  37000. } else {
  37001. lookup=$recv($self._outerScope())._lookupVariable_(aNode);
  37002. }
  37003. lookup;
  37004. } else {
  37005. $1;
  37006. }
  37007. return lookup;
  37008. }, function($ctx1) {$ctx1.fill(self,"lookupVariable:",{aNode:aNode,lookup:lookup},$globals.LexicalScope)});
  37009. },
  37010. args: ["aNode"],
  37011. 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",
  37012. referencedClasses: [],
  37013. messageSends: ["bindingFor:", "ifNil:", "ifNotNil:", "outerScope", "lookupVariable:"]
  37014. }),
  37015. $globals.LexicalScope);
  37016. $core.addMethod(
  37017. $core.method({
  37018. selector: "methodScope",
  37019. protocol: "accessing",
  37020. fn: function (){
  37021. var self=this,$self=this;
  37022. return $core.withContext(function($ctx1) {
  37023. var $1,$receiver;
  37024. $1=$self._outerScope();
  37025. $ctx1.sendIdx["outerScope"]=1;
  37026. if(($receiver = $1) == null || $receiver.a$nil){
  37027. return $1;
  37028. } else {
  37029. return $recv($self._outerScope())._methodScope();
  37030. }
  37031. }, function($ctx1) {$ctx1.fill(self,"methodScope",{},$globals.LexicalScope)});
  37032. },
  37033. args: [],
  37034. source: "methodScope\x0a\x09^ self outerScope ifNotNil: [\x0a\x09\x09self outerScope methodScope ]",
  37035. referencedClasses: [],
  37036. messageSends: ["ifNotNil:", "outerScope", "methodScope"]
  37037. }),
  37038. $globals.LexicalScope);
  37039. $core.addMethod(
  37040. $core.method({
  37041. selector: "node",
  37042. protocol: "accessing",
  37043. fn: function (){
  37044. var self=this,$self=this;
  37045. return $self["@node"];
  37046. },
  37047. args: [],
  37048. source: "node\x0a\x09\x22Answer the node in which I am defined\x22\x0a\x09\x0a\x09^ node",
  37049. referencedClasses: [],
  37050. messageSends: []
  37051. }),
  37052. $globals.LexicalScope);
  37053. $core.addMethod(
  37054. $core.method({
  37055. selector: "node:",
  37056. protocol: "accessing",
  37057. fn: function (aNode){
  37058. var self=this,$self=this;
  37059. $self["@node"]=aNode;
  37060. return self;
  37061. },
  37062. args: ["aNode"],
  37063. source: "node: aNode\x0a\x09node := aNode",
  37064. referencedClasses: [],
  37065. messageSends: []
  37066. }),
  37067. $globals.LexicalScope);
  37068. $core.addMethod(
  37069. $core.method({
  37070. selector: "outerScope",
  37071. protocol: "accessing",
  37072. fn: function (){
  37073. var self=this,$self=this;
  37074. return $self["@outerScope"];
  37075. },
  37076. args: [],
  37077. source: "outerScope\x0a\x09^ outerScope",
  37078. referencedClasses: [],
  37079. messageSends: []
  37080. }),
  37081. $globals.LexicalScope);
  37082. $core.addMethod(
  37083. $core.method({
  37084. selector: "outerScope:",
  37085. protocol: "accessing",
  37086. fn: function (aLexicalScope){
  37087. var self=this,$self=this;
  37088. $self["@outerScope"]=aLexicalScope;
  37089. return self;
  37090. },
  37091. args: ["aLexicalScope"],
  37092. source: "outerScope: aLexicalScope\x0a\x09outerScope := aLexicalScope",
  37093. referencedClasses: [],
  37094. messageSends: []
  37095. }),
  37096. $globals.LexicalScope);
  37097. $core.addMethod(
  37098. $core.method({
  37099. selector: "pseudoVars",
  37100. protocol: "accessing",
  37101. fn: function (){
  37102. var self=this,$self=this;
  37103. return $core.withContext(function($ctx1) {
  37104. return $recv($self._methodScope())._pseudoVars();
  37105. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.LexicalScope)});
  37106. },
  37107. args: [],
  37108. source: "pseudoVars\x0a\x09^ self methodScope pseudoVars",
  37109. referencedClasses: [],
  37110. messageSends: ["pseudoVars", "methodScope"]
  37111. }),
  37112. $globals.LexicalScope);
  37113. $core.addMethod(
  37114. $core.method({
  37115. selector: "scopeLevel",
  37116. protocol: "accessing",
  37117. fn: function (){
  37118. var self=this,$self=this;
  37119. return $core.withContext(function($ctx1) {
  37120. var $1,$2,$4,$3,$receiver;
  37121. $1=$self._outerScope();
  37122. $ctx1.sendIdx["outerScope"]=1;
  37123. if(($receiver = $1) == null || $receiver.a$nil){
  37124. return (1);
  37125. } else {
  37126. $1;
  37127. }
  37128. $2=$self._isInlined();
  37129. if($core.assert($2)){
  37130. $4=$self._outerScope();
  37131. $ctx1.sendIdx["outerScope"]=2;
  37132. $3=$recv($4)._scopeLevel();
  37133. $ctx1.sendIdx["scopeLevel"]=1;
  37134. return $3;
  37135. }
  37136. return $recv($recv($self._outerScope())._scopeLevel()).__plus((1));
  37137. }, function($ctx1) {$ctx1.fill(self,"scopeLevel",{},$globals.LexicalScope)});
  37138. },
  37139. args: [],
  37140. source: "scopeLevel\x0a\x09self outerScope ifNil: [ ^ 1 ].\x0a\x09self isInlined ifTrue: [ ^ self outerScope scopeLevel ].\x0a\x09\x0a\x09^ self outerScope scopeLevel + 1",
  37141. referencedClasses: [],
  37142. messageSends: ["ifNil:", "outerScope", "ifTrue:", "isInlined", "scopeLevel", "+"]
  37143. }),
  37144. $globals.LexicalScope);
  37145. $core.addMethod(
  37146. $core.method({
  37147. selector: "temps",
  37148. protocol: "accessing",
  37149. fn: function (){
  37150. var self=this,$self=this;
  37151. return $core.withContext(function($ctx1) {
  37152. var $1,$receiver;
  37153. $1=$self["@temps"];
  37154. if(($receiver = $1) == null || $receiver.a$nil){
  37155. $self["@temps"]=$recv($globals.Dictionary)._new();
  37156. return $self["@temps"];
  37157. } else {
  37158. return $1;
  37159. }
  37160. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.LexicalScope)});
  37161. },
  37162. args: [],
  37163. source: "temps\x0a\x09^ temps ifNil: [ temps := Dictionary new ]",
  37164. referencedClasses: ["Dictionary"],
  37165. messageSends: ["ifNil:", "new"]
  37166. }),
  37167. $globals.LexicalScope);
  37168. $core.addClass("MethodLexicalScope", $globals.LexicalScope, ["iVars", "pseudoVars", "unknownVariables", "localReturn", "nonLocalReturns"], "Compiler-Semantic");
  37169. $globals.MethodLexicalScope.comment="I represent a method scope.";
  37170. $core.addMethod(
  37171. $core.method({
  37172. selector: "addIVar:",
  37173. protocol: "adding",
  37174. fn: function (aString){
  37175. var self=this,$self=this;
  37176. return $core.withContext(function($ctx1) {
  37177. var $1;
  37178. $1=$self._iVars();
  37179. $ctx1.sendIdx["iVars"]=1;
  37180. $recv($1)._at_put_(aString,$recv($globals.InstanceVar)._on_(aString));
  37181. $recv($recv($self._iVars())._at_(aString))._scope_(self);
  37182. return self;
  37183. }, function($ctx1) {$ctx1.fill(self,"addIVar:",{aString:aString},$globals.MethodLexicalScope)});
  37184. },
  37185. args: ["aString"],
  37186. source: "addIVar: aString\x0a\x09self iVars at: aString put: (InstanceVar on: aString).\x0a\x09(self iVars at: aString) scope: self",
  37187. referencedClasses: ["InstanceVar"],
  37188. messageSends: ["at:put:", "iVars", "on:", "scope:", "at:"]
  37189. }),
  37190. $globals.MethodLexicalScope);
  37191. $core.addMethod(
  37192. $core.method({
  37193. selector: "addNonLocalReturn:",
  37194. protocol: "adding",
  37195. fn: function (aScope){
  37196. var self=this,$self=this;
  37197. return $core.withContext(function($ctx1) {
  37198. $recv($self._nonLocalReturns())._add_(aScope);
  37199. return self;
  37200. }, function($ctx1) {$ctx1.fill(self,"addNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  37201. },
  37202. args: ["aScope"],
  37203. source: "addNonLocalReturn: aScope\x0a\x09self nonLocalReturns add: aScope",
  37204. referencedClasses: [],
  37205. messageSends: ["add:", "nonLocalReturns"]
  37206. }),
  37207. $globals.MethodLexicalScope);
  37208. $core.addMethod(
  37209. $core.method({
  37210. selector: "allVariableNames",
  37211. protocol: "accessing",
  37212. fn: function (){
  37213. var self=this,$self=this;
  37214. return $core.withContext(function($ctx1) {
  37215. var $1;
  37216. $1=(
  37217. $ctx1.supercall = true,
  37218. ($globals.MethodLexicalScope.superclass||$boot.nilAsClass).fn.prototype._allVariableNames.apply($self, []));
  37219. $ctx1.supercall = false;
  37220. return $recv($1).__comma($recv($self._iVars())._keys());
  37221. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.MethodLexicalScope)});
  37222. },
  37223. args: [],
  37224. source: "allVariableNames\x0a\x09^ super allVariableNames, self iVars keys",
  37225. referencedClasses: [],
  37226. messageSends: [",", "allVariableNames", "keys", "iVars"]
  37227. }),
  37228. $globals.MethodLexicalScope);
  37229. $core.addMethod(
  37230. $core.method({
  37231. selector: "bindingFor:",
  37232. protocol: "accessing",
  37233. fn: function (aNode){
  37234. var self=this,$self=this;
  37235. return $core.withContext(function($ctx1) {
  37236. var $1,$receiver;
  37237. $1=(
  37238. $ctx1.supercall = true,
  37239. ($globals.MethodLexicalScope.superclass||$boot.nilAsClass).fn.prototype._bindingFor_.apply($self, [aNode]));
  37240. $ctx1.supercall = false;
  37241. if(($receiver = $1) == null || $receiver.a$nil){
  37242. return $recv($self._iVars())._at_ifAbsent_($recv(aNode)._value(),(function(){
  37243. return nil;
  37244. }));
  37245. } else {
  37246. return $1;
  37247. }
  37248. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aNode:aNode},$globals.MethodLexicalScope)});
  37249. },
  37250. args: ["aNode"],
  37251. source: "bindingFor: aNode\x0a\x09^ (super bindingFor: aNode) ifNil: [\x0a\x09\x09self iVars at: aNode value ifAbsent: [ nil ]]",
  37252. referencedClasses: [],
  37253. messageSends: ["ifNil:", "bindingFor:", "at:ifAbsent:", "iVars", "value"]
  37254. }),
  37255. $globals.MethodLexicalScope);
  37256. $core.addMethod(
  37257. $core.method({
  37258. selector: "canInlineNonLocalReturns",
  37259. protocol: "testing",
  37260. fn: function (){
  37261. var self=this,$self=this;
  37262. return true;
  37263. },
  37264. args: [],
  37265. source: "canInlineNonLocalReturns\x0a\x09^ true",
  37266. referencedClasses: [],
  37267. messageSends: []
  37268. }),
  37269. $globals.MethodLexicalScope);
  37270. $core.addMethod(
  37271. $core.method({
  37272. selector: "hasLocalReturn",
  37273. protocol: "testing",
  37274. fn: function (){
  37275. var self=this,$self=this;
  37276. return $core.withContext(function($ctx1) {
  37277. return $self._localReturn();
  37278. }, function($ctx1) {$ctx1.fill(self,"hasLocalReturn",{},$globals.MethodLexicalScope)});
  37279. },
  37280. args: [],
  37281. source: "hasLocalReturn\x0a\x09^ self localReturn",
  37282. referencedClasses: [],
  37283. messageSends: ["localReturn"]
  37284. }),
  37285. $globals.MethodLexicalScope);
  37286. $core.addMethod(
  37287. $core.method({
  37288. selector: "hasNonLocalReturn",
  37289. protocol: "testing",
  37290. fn: function (){
  37291. var self=this,$self=this;
  37292. return $core.withContext(function($ctx1) {
  37293. return $recv($self._nonLocalReturns())._notEmpty();
  37294. }, function($ctx1) {$ctx1.fill(self,"hasNonLocalReturn",{},$globals.MethodLexicalScope)});
  37295. },
  37296. args: [],
  37297. source: "hasNonLocalReturn\x0a\x09^ self nonLocalReturns notEmpty",
  37298. referencedClasses: [],
  37299. messageSends: ["notEmpty", "nonLocalReturns"]
  37300. }),
  37301. $globals.MethodLexicalScope);
  37302. $core.addMethod(
  37303. $core.method({
  37304. selector: "iVars",
  37305. protocol: "accessing",
  37306. fn: function (){
  37307. var self=this,$self=this;
  37308. return $core.withContext(function($ctx1) {
  37309. var $1,$receiver;
  37310. $1=$self["@iVars"];
  37311. if(($receiver = $1) == null || $receiver.a$nil){
  37312. $self["@iVars"]=$recv($globals.Dictionary)._new();
  37313. return $self["@iVars"];
  37314. } else {
  37315. return $1;
  37316. }
  37317. }, function($ctx1) {$ctx1.fill(self,"iVars",{},$globals.MethodLexicalScope)});
  37318. },
  37319. args: [],
  37320. source: "iVars\x0a\x09^ iVars ifNil: [ iVars := Dictionary new ]",
  37321. referencedClasses: ["Dictionary"],
  37322. messageSends: ["ifNil:", "new"]
  37323. }),
  37324. $globals.MethodLexicalScope);
  37325. $core.addMethod(
  37326. $core.method({
  37327. selector: "isMethodScope",
  37328. protocol: "testing",
  37329. fn: function (){
  37330. var self=this,$self=this;
  37331. return true;
  37332. },
  37333. args: [],
  37334. source: "isMethodScope\x0a\x09^ true",
  37335. referencedClasses: [],
  37336. messageSends: []
  37337. }),
  37338. $globals.MethodLexicalScope);
  37339. $core.addMethod(
  37340. $core.method({
  37341. selector: "localReturn",
  37342. protocol: "accessing",
  37343. fn: function (){
  37344. var self=this,$self=this;
  37345. return $core.withContext(function($ctx1) {
  37346. var $1,$receiver;
  37347. $1=$self["@localReturn"];
  37348. if(($receiver = $1) == null || $receiver.a$nil){
  37349. return false;
  37350. } else {
  37351. return $1;
  37352. }
  37353. }, function($ctx1) {$ctx1.fill(self,"localReturn",{},$globals.MethodLexicalScope)});
  37354. },
  37355. args: [],
  37356. source: "localReturn\x0a\x09^ localReturn ifNil: [ false ]",
  37357. referencedClasses: [],
  37358. messageSends: ["ifNil:"]
  37359. }),
  37360. $globals.MethodLexicalScope);
  37361. $core.addMethod(
  37362. $core.method({
  37363. selector: "localReturn:",
  37364. protocol: "accessing",
  37365. fn: function (aBoolean){
  37366. var self=this,$self=this;
  37367. $self["@localReturn"]=aBoolean;
  37368. return self;
  37369. },
  37370. args: ["aBoolean"],
  37371. source: "localReturn: aBoolean\x0a\x09localReturn := aBoolean",
  37372. referencedClasses: [],
  37373. messageSends: []
  37374. }),
  37375. $globals.MethodLexicalScope);
  37376. $core.addMethod(
  37377. $core.method({
  37378. selector: "methodScope",
  37379. protocol: "accessing",
  37380. fn: function (){
  37381. var self=this,$self=this;
  37382. return self;
  37383. },
  37384. args: [],
  37385. source: "methodScope\x0a\x09^ self",
  37386. referencedClasses: [],
  37387. messageSends: []
  37388. }),
  37389. $globals.MethodLexicalScope);
  37390. $core.addMethod(
  37391. $core.method({
  37392. selector: "nonLocalReturns",
  37393. protocol: "accessing",
  37394. fn: function (){
  37395. var self=this,$self=this;
  37396. return $core.withContext(function($ctx1) {
  37397. var $1,$receiver;
  37398. $1=$self["@nonLocalReturns"];
  37399. if(($receiver = $1) == null || $receiver.a$nil){
  37400. $self["@nonLocalReturns"]=$recv($globals.OrderedCollection)._new();
  37401. return $self["@nonLocalReturns"];
  37402. } else {
  37403. return $1;
  37404. }
  37405. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturns",{},$globals.MethodLexicalScope)});
  37406. },
  37407. args: [],
  37408. source: "nonLocalReturns\x0a\x09^ nonLocalReturns ifNil: [ nonLocalReturns := OrderedCollection new ]",
  37409. referencedClasses: ["OrderedCollection"],
  37410. messageSends: ["ifNil:", "new"]
  37411. }),
  37412. $globals.MethodLexicalScope);
  37413. $core.addMethod(
  37414. $core.method({
  37415. selector: "pseudoVars",
  37416. protocol: "accessing",
  37417. fn: function (){
  37418. var self=this,$self=this;
  37419. return $core.withContext(function($ctx1) {
  37420. var $1,$2,$4,$3,$receiver;
  37421. $1=$self["@pseudoVars"];
  37422. if(($receiver = $1) == null || $receiver.a$nil){
  37423. $self["@pseudoVars"]=$recv($globals.Dictionary)._new();
  37424. $recv($recv($globals.Smalltalk)._pseudoVariableNames())._do_((function(each){
  37425. return $core.withContext(function($ctx2) {
  37426. $2=$self["@pseudoVars"];
  37427. $4=$recv($globals.PseudoVar)._on_(each);
  37428. $recv($4)._scope_($self._methodScope());
  37429. $3=$recv($4)._yourself();
  37430. return $recv($2)._at_put_(each,$3);
  37431. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  37432. }));
  37433. } else {
  37434. $1;
  37435. }
  37436. return $self["@pseudoVars"];
  37437. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.MethodLexicalScope)});
  37438. },
  37439. args: [],
  37440. 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",
  37441. referencedClasses: ["Dictionary", "Smalltalk", "PseudoVar"],
  37442. messageSends: ["ifNil:", "new", "do:", "pseudoVariableNames", "at:put:", "scope:", "on:", "methodScope", "yourself"]
  37443. }),
  37444. $globals.MethodLexicalScope);
  37445. $core.addMethod(
  37446. $core.method({
  37447. selector: "removeNonLocalReturn:",
  37448. protocol: "adding",
  37449. fn: function (aScope){
  37450. var self=this,$self=this;
  37451. return $core.withContext(function($ctx1) {
  37452. $recv($self._nonLocalReturns())._remove_ifAbsent_(aScope,(function(){
  37453. }));
  37454. return self;
  37455. }, function($ctx1) {$ctx1.fill(self,"removeNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  37456. },
  37457. args: ["aScope"],
  37458. source: "removeNonLocalReturn: aScope\x0a\x09self nonLocalReturns remove: aScope ifAbsent: []",
  37459. referencedClasses: [],
  37460. messageSends: ["remove:ifAbsent:", "nonLocalReturns"]
  37461. }),
  37462. $globals.MethodLexicalScope);
  37463. $core.addMethod(
  37464. $core.method({
  37465. selector: "unknownVariables",
  37466. protocol: "accessing",
  37467. fn: function (){
  37468. var self=this,$self=this;
  37469. return $core.withContext(function($ctx1) {
  37470. var $1,$receiver;
  37471. $1=$self["@unknownVariables"];
  37472. if(($receiver = $1) == null || $receiver.a$nil){
  37473. $self["@unknownVariables"]=$recv($globals.OrderedCollection)._new();
  37474. return $self["@unknownVariables"];
  37475. } else {
  37476. return $1;
  37477. }
  37478. }, function($ctx1) {$ctx1.fill(self,"unknownVariables",{},$globals.MethodLexicalScope)});
  37479. },
  37480. args: [],
  37481. source: "unknownVariables\x0a\x09^ unknownVariables ifNil: [ unknownVariables := OrderedCollection new ]",
  37482. referencedClasses: ["OrderedCollection"],
  37483. messageSends: ["ifNil:", "new"]
  37484. }),
  37485. $globals.MethodLexicalScope);
  37486. $core.addClass("ScopeVar", $globals.Object, ["scope", "name"], "Compiler-Semantic");
  37487. $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.";
  37488. $core.addMethod(
  37489. $core.method({
  37490. selector: "alias",
  37491. protocol: "accessing",
  37492. fn: function (){
  37493. var self=this,$self=this;
  37494. return $core.withContext(function($ctx1) {
  37495. return $recv($self._name())._asVariableName();
  37496. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ScopeVar)});
  37497. },
  37498. args: [],
  37499. source: "alias\x0a\x09^ self name asVariableName",
  37500. referencedClasses: [],
  37501. messageSends: ["asVariableName", "name"]
  37502. }),
  37503. $globals.ScopeVar);
  37504. $core.addMethod(
  37505. $core.method({
  37506. selector: "isArgVar",
  37507. protocol: "testing",
  37508. fn: function (){
  37509. var self=this,$self=this;
  37510. return false;
  37511. },
  37512. args: [],
  37513. source: "isArgVar\x0a\x09^ false",
  37514. referencedClasses: [],
  37515. messageSends: []
  37516. }),
  37517. $globals.ScopeVar);
  37518. $core.addMethod(
  37519. $core.method({
  37520. selector: "isClassRefVar",
  37521. protocol: "testing",
  37522. fn: function (){
  37523. var self=this,$self=this;
  37524. return false;
  37525. },
  37526. args: [],
  37527. source: "isClassRefVar\x0a\x09^ false",
  37528. referencedClasses: [],
  37529. messageSends: []
  37530. }),
  37531. $globals.ScopeVar);
  37532. $core.addMethod(
  37533. $core.method({
  37534. selector: "isImmutable",
  37535. protocol: "testing",
  37536. fn: function (){
  37537. var self=this,$self=this;
  37538. return false;
  37539. },
  37540. args: [],
  37541. source: "isImmutable\x0a\x09^ false",
  37542. referencedClasses: [],
  37543. messageSends: []
  37544. }),
  37545. $globals.ScopeVar);
  37546. $core.addMethod(
  37547. $core.method({
  37548. selector: "isInstanceVar",
  37549. protocol: "testing",
  37550. fn: function (){
  37551. var self=this,$self=this;
  37552. return false;
  37553. },
  37554. args: [],
  37555. source: "isInstanceVar\x0a\x09^ false",
  37556. referencedClasses: [],
  37557. messageSends: []
  37558. }),
  37559. $globals.ScopeVar);
  37560. $core.addMethod(
  37561. $core.method({
  37562. selector: "isPseudoVar",
  37563. protocol: "testing",
  37564. fn: function (){
  37565. var self=this,$self=this;
  37566. return false;
  37567. },
  37568. args: [],
  37569. source: "isPseudoVar\x0a\x09^ false",
  37570. referencedClasses: [],
  37571. messageSends: []
  37572. }),
  37573. $globals.ScopeVar);
  37574. $core.addMethod(
  37575. $core.method({
  37576. selector: "isSelf",
  37577. protocol: "testing",
  37578. fn: function (){
  37579. var self=this,$self=this;
  37580. return false;
  37581. },
  37582. args: [],
  37583. source: "isSelf\x0a\x09^ false",
  37584. referencedClasses: [],
  37585. messageSends: []
  37586. }),
  37587. $globals.ScopeVar);
  37588. $core.addMethod(
  37589. $core.method({
  37590. selector: "isSuper",
  37591. protocol: "testing",
  37592. fn: function (){
  37593. var self=this,$self=this;
  37594. return false;
  37595. },
  37596. args: [],
  37597. source: "isSuper\x0a\x09^ false",
  37598. referencedClasses: [],
  37599. messageSends: []
  37600. }),
  37601. $globals.ScopeVar);
  37602. $core.addMethod(
  37603. $core.method({
  37604. selector: "isTempVar",
  37605. protocol: "testing",
  37606. fn: function (){
  37607. var self=this,$self=this;
  37608. return false;
  37609. },
  37610. args: [],
  37611. source: "isTempVar\x0a\x09^ false",
  37612. referencedClasses: [],
  37613. messageSends: []
  37614. }),
  37615. $globals.ScopeVar);
  37616. $core.addMethod(
  37617. $core.method({
  37618. selector: "isUnknownVar",
  37619. protocol: "testing",
  37620. fn: function (){
  37621. var self=this,$self=this;
  37622. return false;
  37623. },
  37624. args: [],
  37625. source: "isUnknownVar\x0a\x09^ false",
  37626. referencedClasses: [],
  37627. messageSends: []
  37628. }),
  37629. $globals.ScopeVar);
  37630. $core.addMethod(
  37631. $core.method({
  37632. selector: "name",
  37633. protocol: "accessing",
  37634. fn: function (){
  37635. var self=this,$self=this;
  37636. return $self["@name"];
  37637. },
  37638. args: [],
  37639. source: "name\x0a\x09^ name",
  37640. referencedClasses: [],
  37641. messageSends: []
  37642. }),
  37643. $globals.ScopeVar);
  37644. $core.addMethod(
  37645. $core.method({
  37646. selector: "name:",
  37647. protocol: "accessing",
  37648. fn: function (aString){
  37649. var self=this,$self=this;
  37650. $self["@name"]=aString;
  37651. return self;
  37652. },
  37653. args: ["aString"],
  37654. source: "name: aString\x0a\x09name := aString",
  37655. referencedClasses: [],
  37656. messageSends: []
  37657. }),
  37658. $globals.ScopeVar);
  37659. $core.addMethod(
  37660. $core.method({
  37661. selector: "scope",
  37662. protocol: "accessing",
  37663. fn: function (){
  37664. var self=this,$self=this;
  37665. return $self["@scope"];
  37666. },
  37667. args: [],
  37668. source: "scope\x0a\x09^ scope",
  37669. referencedClasses: [],
  37670. messageSends: []
  37671. }),
  37672. $globals.ScopeVar);
  37673. $core.addMethod(
  37674. $core.method({
  37675. selector: "scope:",
  37676. protocol: "accessing",
  37677. fn: function (aScope){
  37678. var self=this,$self=this;
  37679. $self["@scope"]=aScope;
  37680. return self;
  37681. },
  37682. args: ["aScope"],
  37683. source: "scope: aScope\x0a\x09scope := aScope",
  37684. referencedClasses: [],
  37685. messageSends: []
  37686. }),
  37687. $globals.ScopeVar);
  37688. $core.addMethod(
  37689. $core.method({
  37690. selector: "validateAssignment",
  37691. protocol: "testing",
  37692. fn: function (){
  37693. var self=this,$self=this;
  37694. return $core.withContext(function($ctx1) {
  37695. var $1,$2;
  37696. $1=$recv($self._isArgVar())._or_((function(){
  37697. return $core.withContext(function($ctx2) {
  37698. return $self._isPseudoVar();
  37699. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37700. }));
  37701. if($core.assert($1)){
  37702. $2=$recv($globals.InvalidAssignmentError)._new();
  37703. $recv($2)._variableName_($self._name());
  37704. $recv($2)._signal();
  37705. }
  37706. return self;
  37707. }, function($ctx1) {$ctx1.fill(self,"validateAssignment",{},$globals.ScopeVar)});
  37708. },
  37709. args: [],
  37710. source: "validateAssignment\x0a\x09(self isArgVar or: [ self isPseudoVar ]) ifTrue: [\x0a\x09\x09InvalidAssignmentError new\x0a\x09\x09\x09variableName: self name;\x0a\x09\x09\x09signal]",
  37711. referencedClasses: ["InvalidAssignmentError"],
  37712. messageSends: ["ifTrue:", "or:", "isArgVar", "isPseudoVar", "variableName:", "new", "name", "signal"]
  37713. }),
  37714. $globals.ScopeVar);
  37715. $core.addMethod(
  37716. $core.method({
  37717. selector: "on:",
  37718. protocol: "instance creation",
  37719. fn: function (aString){
  37720. var self=this,$self=this;
  37721. return $core.withContext(function($ctx1) {
  37722. var $1;
  37723. $1=$self._new();
  37724. $recv($1)._name_(aString);
  37725. return $recv($1)._yourself();
  37726. }, function($ctx1) {$ctx1.fill(self,"on:",{aString:aString},$globals.ScopeVar.a$cls)});
  37727. },
  37728. args: ["aString"],
  37729. source: "on: aString\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  37730. referencedClasses: [],
  37731. messageSends: ["name:", "new", "yourself"]
  37732. }),
  37733. $globals.ScopeVar.a$cls);
  37734. $core.addClass("AliasVar", $globals.ScopeVar, ["node"], "Compiler-Semantic");
  37735. $globals.AliasVar.comment="I am an internally defined variable by the compiler";
  37736. $core.addMethod(
  37737. $core.method({
  37738. selector: "isImmutable",
  37739. protocol: "testing",
  37740. fn: function (){
  37741. var self=this,$self=this;
  37742. return true;
  37743. },
  37744. args: [],
  37745. source: "isImmutable\x0a\x09^ true",
  37746. referencedClasses: [],
  37747. messageSends: []
  37748. }),
  37749. $globals.AliasVar);
  37750. $core.addMethod(
  37751. $core.method({
  37752. selector: "node",
  37753. protocol: "accessing",
  37754. fn: function (){
  37755. var self=this,$self=this;
  37756. return $self["@node"];
  37757. },
  37758. args: [],
  37759. source: "node\x0a\x09^ node",
  37760. referencedClasses: [],
  37761. messageSends: []
  37762. }),
  37763. $globals.AliasVar);
  37764. $core.addMethod(
  37765. $core.method({
  37766. selector: "node:",
  37767. protocol: "accessing",
  37768. fn: function (aNode){
  37769. var self=this,$self=this;
  37770. $self["@node"]=aNode;
  37771. return self;
  37772. },
  37773. args: ["aNode"],
  37774. source: "node: aNode\x0a\x09node := aNode",
  37775. referencedClasses: [],
  37776. messageSends: []
  37777. }),
  37778. $globals.AliasVar);
  37779. $core.addClass("ArgVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37780. $globals.ArgVar.comment="I am an argument of a method or block.";
  37781. $core.addMethod(
  37782. $core.method({
  37783. selector: "isArgVar",
  37784. protocol: "testing",
  37785. fn: function (){
  37786. var self=this,$self=this;
  37787. return true;
  37788. },
  37789. args: [],
  37790. source: "isArgVar\x0a\x09^ true",
  37791. referencedClasses: [],
  37792. messageSends: []
  37793. }),
  37794. $globals.ArgVar);
  37795. $core.addMethod(
  37796. $core.method({
  37797. selector: "isImmutable",
  37798. protocol: "testing",
  37799. fn: function (){
  37800. var self=this,$self=this;
  37801. return true;
  37802. },
  37803. args: [],
  37804. source: "isImmutable\x0a\x09^ true",
  37805. referencedClasses: [],
  37806. messageSends: []
  37807. }),
  37808. $globals.ArgVar);
  37809. $core.addClass("ClassRefVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37810. $globals.ClassRefVar.comment="I am an class reference variable";
  37811. $core.addMethod(
  37812. $core.method({
  37813. selector: "alias",
  37814. protocol: "accessing",
  37815. fn: function (){
  37816. var self=this,$self=this;
  37817. return $core.withContext(function($ctx1) {
  37818. return "$globals.".__comma($self._name());
  37819. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ClassRefVar)});
  37820. },
  37821. args: [],
  37822. 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",
  37823. referencedClasses: [],
  37824. messageSends: [",", "name"]
  37825. }),
  37826. $globals.ClassRefVar);
  37827. $core.addMethod(
  37828. $core.method({
  37829. selector: "isClassRefVar",
  37830. protocol: "testing",
  37831. fn: function (){
  37832. var self=this,$self=this;
  37833. return true;
  37834. },
  37835. args: [],
  37836. source: "isClassRefVar\x0a\x09^ true",
  37837. referencedClasses: [],
  37838. messageSends: []
  37839. }),
  37840. $globals.ClassRefVar);
  37841. $core.addMethod(
  37842. $core.method({
  37843. selector: "isImmutable",
  37844. protocol: "testing",
  37845. fn: function (){
  37846. var self=this,$self=this;
  37847. return true;
  37848. },
  37849. args: [],
  37850. source: "isImmutable\x0a\x09^ true",
  37851. referencedClasses: [],
  37852. messageSends: []
  37853. }),
  37854. $globals.ClassRefVar);
  37855. $core.addClass("InstanceVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37856. $globals.InstanceVar.comment="I am an instance variable of a method or block.";
  37857. $core.addMethod(
  37858. $core.method({
  37859. selector: "alias",
  37860. protocol: "testing",
  37861. fn: function (){
  37862. var self=this,$self=this;
  37863. return $core.withContext(function($ctx1) {
  37864. var $1;
  37865. $1=$recv("$self[\x22@".__comma($self._name())).__comma("\x22]");
  37866. $ctx1.sendIdx[","]=1;
  37867. return $1;
  37868. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.InstanceVar)});
  37869. },
  37870. args: [],
  37871. source: "alias\x0a\x09^ '$self[\x22@', self name, '\x22]'",
  37872. referencedClasses: [],
  37873. messageSends: [",", "name"]
  37874. }),
  37875. $globals.InstanceVar);
  37876. $core.addMethod(
  37877. $core.method({
  37878. selector: "isInstanceVar",
  37879. protocol: "testing",
  37880. fn: function (){
  37881. var self=this,$self=this;
  37882. return true;
  37883. },
  37884. args: [],
  37885. source: "isInstanceVar\x0a\x09^ true",
  37886. referencedClasses: [],
  37887. messageSends: []
  37888. }),
  37889. $globals.InstanceVar);
  37890. $core.addClass("PseudoVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37891. $globals.PseudoVar.comment="I am an pseudo variable.\x0a\x0aThe five Smalltalk pseudo variables are: 'self', 'super', 'nil', 'true' and 'false'";
  37892. $core.addMethod(
  37893. $core.method({
  37894. selector: "alias",
  37895. protocol: "accessing",
  37896. fn: function (){
  37897. var self=this,$self=this;
  37898. return $core.withContext(function($ctx1) {
  37899. return $self._name();
  37900. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.PseudoVar)});
  37901. },
  37902. args: [],
  37903. source: "alias\x0a\x09^ self name",
  37904. referencedClasses: [],
  37905. messageSends: ["name"]
  37906. }),
  37907. $globals.PseudoVar);
  37908. $core.addMethod(
  37909. $core.method({
  37910. selector: "isImmutable",
  37911. protocol: "testing",
  37912. fn: function (){
  37913. var self=this,$self=this;
  37914. return true;
  37915. },
  37916. args: [],
  37917. source: "isImmutable\x0a\x09^ true",
  37918. referencedClasses: [],
  37919. messageSends: []
  37920. }),
  37921. $globals.PseudoVar);
  37922. $core.addMethod(
  37923. $core.method({
  37924. selector: "isPseudoVar",
  37925. protocol: "testing",
  37926. fn: function (){
  37927. var self=this,$self=this;
  37928. return true;
  37929. },
  37930. args: [],
  37931. source: "isPseudoVar\x0a\x09^ true",
  37932. referencedClasses: [],
  37933. messageSends: []
  37934. }),
  37935. $globals.PseudoVar);
  37936. $core.addMethod(
  37937. $core.method({
  37938. selector: "isSelf",
  37939. protocol: "testing",
  37940. fn: function (){
  37941. var self=this,$self=this;
  37942. return $core.withContext(function($ctx1) {
  37943. return $recv($self["@name"]).__eq("self");
  37944. }, function($ctx1) {$ctx1.fill(self,"isSelf",{},$globals.PseudoVar)});
  37945. },
  37946. args: [],
  37947. source: "isSelf\x0a\x09^ name = 'self'",
  37948. referencedClasses: [],
  37949. messageSends: ["="]
  37950. }),
  37951. $globals.PseudoVar);
  37952. $core.addMethod(
  37953. $core.method({
  37954. selector: "isSuper",
  37955. protocol: "testing",
  37956. fn: function (){
  37957. var self=this,$self=this;
  37958. return $core.withContext(function($ctx1) {
  37959. return $recv($self["@name"]).__eq("super");
  37960. }, function($ctx1) {$ctx1.fill(self,"isSuper",{},$globals.PseudoVar)});
  37961. },
  37962. args: [],
  37963. source: "isSuper\x0a\x09^ name = 'super'",
  37964. referencedClasses: [],
  37965. messageSends: ["="]
  37966. }),
  37967. $globals.PseudoVar);
  37968. $core.addClass("TempVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37969. $globals.TempVar.comment="I am an temporary variable of a method or block.";
  37970. $core.addMethod(
  37971. $core.method({
  37972. selector: "isTempVar",
  37973. protocol: "testing",
  37974. fn: function (){
  37975. var self=this,$self=this;
  37976. return true;
  37977. },
  37978. args: [],
  37979. source: "isTempVar\x0a\x09^ true",
  37980. referencedClasses: [],
  37981. messageSends: []
  37982. }),
  37983. $globals.TempVar);
  37984. $core.addClass("UnknownVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37985. $globals.UnknownVar.comment="I am an unknown variable. Amber uses unknown variables as JavaScript globals";
  37986. $core.addMethod(
  37987. $core.method({
  37988. selector: "isUnknownVar",
  37989. protocol: "testing",
  37990. fn: function (){
  37991. var self=this,$self=this;
  37992. return true;
  37993. },
  37994. args: [],
  37995. source: "isUnknownVar\x0a\x09^ true",
  37996. referencedClasses: [],
  37997. messageSends: []
  37998. }),
  37999. $globals.UnknownVar);
  38000. $core.addClass("SemanticAnalyzer", $globals.NodeVisitor, ["currentScope", "blockIndex", "thePackage", "theClass", "classReferences", "messageSends"], "Compiler-Semantic");
  38001. $globals.SemanticAnalyzer.comment="I semantically analyze the abstract syntax tree and annotate it with informations such as non local returns and variable scopes.";
  38002. $core.addMethod(
  38003. $core.method({
  38004. selector: "classReferences",
  38005. protocol: "accessing",
  38006. fn: function (){
  38007. var self=this,$self=this;
  38008. return $core.withContext(function($ctx1) {
  38009. var $1,$receiver;
  38010. $1=$self["@classReferences"];
  38011. if(($receiver = $1) == null || $receiver.a$nil){
  38012. $self["@classReferences"]=$recv($globals.Set)._new();
  38013. return $self["@classReferences"];
  38014. } else {
  38015. return $1;
  38016. }
  38017. }, function($ctx1) {$ctx1.fill(self,"classReferences",{},$globals.SemanticAnalyzer)});
  38018. },
  38019. args: [],
  38020. source: "classReferences\x0a\x09^ classReferences ifNil: [ classReferences := Set new ]",
  38021. referencedClasses: ["Set"],
  38022. messageSends: ["ifNil:", "new"]
  38023. }),
  38024. $globals.SemanticAnalyzer);
  38025. $core.addMethod(
  38026. $core.method({
  38027. selector: "errorShadowingVariable:",
  38028. protocol: "error handling",
  38029. fn: function (aString){
  38030. var self=this,$self=this;
  38031. return $core.withContext(function($ctx1) {
  38032. var $1;
  38033. $1=$recv($globals.ShadowingVariableError)._new();
  38034. $recv($1)._variableName_(aString);
  38035. $recv($1)._signal();
  38036. return self;
  38037. }, function($ctx1) {$ctx1.fill(self,"errorShadowingVariable:",{aString:aString},$globals.SemanticAnalyzer)});
  38038. },
  38039. args: ["aString"],
  38040. source: "errorShadowingVariable: aString\x0a\x09ShadowingVariableError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal",
  38041. referencedClasses: ["ShadowingVariableError"],
  38042. messageSends: ["variableName:", "new", "signal"]
  38043. }),
  38044. $globals.SemanticAnalyzer);
  38045. $core.addMethod(
  38046. $core.method({
  38047. selector: "errorUnknownVariable:",
  38048. protocol: "error handling",
  38049. fn: function (aNode){
  38050. var self=this,$self=this;
  38051. var identifier;
  38052. return $core.withContext(function($ctx1) {
  38053. var $1,$2,$3;
  38054. identifier=$recv(aNode)._value();
  38055. $ctx1.sendIdx["value"]=1;
  38056. $1=$recv($recv($recv($recv($globals.Smalltalk)._globalJsVariables())._includes_(identifier))._not())._and_((function(){
  38057. return $core.withContext(function($ctx2) {
  38058. return $self._isVariableUndefined_inPackage_(identifier,$self._thePackage());
  38059. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38060. }));
  38061. if($core.assert($1)){
  38062. $2=$recv($globals.UnknownVariableError)._new();
  38063. $3=$recv(aNode)._value();
  38064. $ctx1.sendIdx["value"]=2;
  38065. $recv($2)._variableName_($3);
  38066. $recv($2)._signal();
  38067. } else {
  38068. $recv($recv($recv($self["@currentScope"])._methodScope())._unknownVariables())._add_($recv(aNode)._value());
  38069. }
  38070. return self;
  38071. }, function($ctx1) {$ctx1.fill(self,"errorUnknownVariable:",{aNode:aNode,identifier:identifier},$globals.SemanticAnalyzer)});
  38072. },
  38073. args: ["aNode"],
  38074. 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 ]",
  38075. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  38076. messageSends: ["value", "ifTrue:ifFalse:", "and:", "not", "includes:", "globalJsVariables", "isVariableUndefined:inPackage:", "thePackage", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope"]
  38077. }),
  38078. $globals.SemanticAnalyzer);
  38079. $core.addMethod(
  38080. $core.method({
  38081. selector: "isVariableUndefined:inPackage:",
  38082. protocol: "testing",
  38083. fn: function (aString,aPackage){
  38084. var self=this,$self=this;
  38085. return $core.withContext(function($ctx1) {
  38086. var $1,$2,$receiver;
  38087. if(($receiver = aPackage) == null || $receiver.a$nil){
  38088. aPackage;
  38089. } else {
  38090. var packageKnownVars;
  38091. packageKnownVars=$recv($recv($recv(aPackage)._imports())._reject_("isString"))._collect_("key");
  38092. $1=$recv(packageKnownVars)._includes_(aString);
  38093. if($core.assert($1)){
  38094. return false;
  38095. }
  38096. }
  38097. $2=$recv("typeof ".__comma(aString)).__comma(" === \x22undefined\x22");
  38098. $ctx1.sendIdx[","]=1;
  38099. return $recv($globals.Compiler)._eval_($2);
  38100. }, function($ctx1) {$ctx1.fill(self,"isVariableUndefined:inPackage:",{aString:aString,aPackage:aPackage},$globals.SemanticAnalyzer)});
  38101. },
  38102. args: ["aString", "aPackage"],
  38103. 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'",
  38104. referencedClasses: ["Compiler"],
  38105. messageSends: ["ifNotNil:", "collect:", "reject:", "imports", "ifTrue:", "includes:", "eval:", ","]
  38106. }),
  38107. $globals.SemanticAnalyzer);
  38108. $core.addMethod(
  38109. $core.method({
  38110. selector: "messageSends",
  38111. protocol: "accessing",
  38112. fn: function (){
  38113. var self=this,$self=this;
  38114. return $core.withContext(function($ctx1) {
  38115. var $1,$receiver;
  38116. $1=$self["@messageSends"];
  38117. if(($receiver = $1) == null || $receiver.a$nil){
  38118. $self["@messageSends"]=$recv($globals.Dictionary)._new();
  38119. return $self["@messageSends"];
  38120. } else {
  38121. return $1;
  38122. }
  38123. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.SemanticAnalyzer)});
  38124. },
  38125. args: [],
  38126. source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Dictionary new ]",
  38127. referencedClasses: ["Dictionary"],
  38128. messageSends: ["ifNil:", "new"]
  38129. }),
  38130. $globals.SemanticAnalyzer);
  38131. $core.addMethod(
  38132. $core.method({
  38133. selector: "newBlockScope",
  38134. protocol: "factory",
  38135. fn: function (){
  38136. var self=this,$self=this;
  38137. return $core.withContext(function($ctx1) {
  38138. return $self._newScopeOfClass_($globals.LexicalScope);
  38139. }, function($ctx1) {$ctx1.fill(self,"newBlockScope",{},$globals.SemanticAnalyzer)});
  38140. },
  38141. args: [],
  38142. source: "newBlockScope\x0a\x09^ self newScopeOfClass: LexicalScope",
  38143. referencedClasses: ["LexicalScope"],
  38144. messageSends: ["newScopeOfClass:"]
  38145. }),
  38146. $globals.SemanticAnalyzer);
  38147. $core.addMethod(
  38148. $core.method({
  38149. selector: "newMethodScope",
  38150. protocol: "factory",
  38151. fn: function (){
  38152. var self=this,$self=this;
  38153. return $core.withContext(function($ctx1) {
  38154. return $self._newScopeOfClass_($globals.MethodLexicalScope);
  38155. }, function($ctx1) {$ctx1.fill(self,"newMethodScope",{},$globals.SemanticAnalyzer)});
  38156. },
  38157. args: [],
  38158. source: "newMethodScope\x0a\x09^ self newScopeOfClass: MethodLexicalScope",
  38159. referencedClasses: ["MethodLexicalScope"],
  38160. messageSends: ["newScopeOfClass:"]
  38161. }),
  38162. $globals.SemanticAnalyzer);
  38163. $core.addMethod(
  38164. $core.method({
  38165. selector: "newScopeOfClass:",
  38166. protocol: "factory",
  38167. fn: function (aLexicalScopeClass){
  38168. var self=this,$self=this;
  38169. return $core.withContext(function($ctx1) {
  38170. var $1;
  38171. $1=$recv(aLexicalScopeClass)._new();
  38172. $recv($1)._outerScope_($self["@currentScope"]);
  38173. return $recv($1)._yourself();
  38174. }, function($ctx1) {$ctx1.fill(self,"newScopeOfClass:",{aLexicalScopeClass:aLexicalScopeClass},$globals.SemanticAnalyzer)});
  38175. },
  38176. args: ["aLexicalScopeClass"],
  38177. source: "newScopeOfClass: aLexicalScopeClass\x0a\x09^ aLexicalScopeClass new\x0a\x09\x09outerScope: currentScope;\x0a\x09\x09yourself",
  38178. referencedClasses: [],
  38179. messageSends: ["outerScope:", "new", "yourself"]
  38180. }),
  38181. $globals.SemanticAnalyzer);
  38182. $core.addMethod(
  38183. $core.method({
  38184. selector: "nextBlockIndex",
  38185. protocol: "private",
  38186. fn: function (){
  38187. var self=this,$self=this;
  38188. return $core.withContext(function($ctx1) {
  38189. var $1,$receiver;
  38190. $1=$self["@blockIndex"];
  38191. if(($receiver = $1) == null || $receiver.a$nil){
  38192. $self["@blockIndex"]=(0);
  38193. $self["@blockIndex"];
  38194. } else {
  38195. $1;
  38196. }
  38197. $self["@blockIndex"]=$recv($self["@blockIndex"]).__plus((1));
  38198. return $self["@blockIndex"];
  38199. }, function($ctx1) {$ctx1.fill(self,"nextBlockIndex",{},$globals.SemanticAnalyzer)});
  38200. },
  38201. args: [],
  38202. source: "nextBlockIndex\x0a\x09blockIndex ifNil: [ blockIndex := 0 ].\x0a\x09\x0a\x09blockIndex := blockIndex + 1.\x0a\x09^ blockIndex",
  38203. referencedClasses: [],
  38204. messageSends: ["ifNil:", "+"]
  38205. }),
  38206. $globals.SemanticAnalyzer);
  38207. $core.addMethod(
  38208. $core.method({
  38209. selector: "popScope",
  38210. protocol: "scope",
  38211. fn: function (){
  38212. var self=this,$self=this;
  38213. return $core.withContext(function($ctx1) {
  38214. var $1,$receiver;
  38215. $1=$self["@currentScope"];
  38216. if(($receiver = $1) == null || $receiver.a$nil){
  38217. $1;
  38218. } else {
  38219. $self["@currentScope"]=$recv($self["@currentScope"])._outerScope();
  38220. $self["@currentScope"];
  38221. }
  38222. return self;
  38223. }, function($ctx1) {$ctx1.fill(self,"popScope",{},$globals.SemanticAnalyzer)});
  38224. },
  38225. args: [],
  38226. source: "popScope\x0a\x09currentScope ifNotNil: [\x0a\x09\x09currentScope := currentScope outerScope ]",
  38227. referencedClasses: [],
  38228. messageSends: ["ifNotNil:", "outerScope"]
  38229. }),
  38230. $globals.SemanticAnalyzer);
  38231. $core.addMethod(
  38232. $core.method({
  38233. selector: "pushScope:",
  38234. protocol: "scope",
  38235. fn: function (aScope){
  38236. var self=this,$self=this;
  38237. return $core.withContext(function($ctx1) {
  38238. $recv(aScope)._outerScope_($self["@currentScope"]);
  38239. $self["@currentScope"]=aScope;
  38240. return self;
  38241. }, function($ctx1) {$ctx1.fill(self,"pushScope:",{aScope:aScope},$globals.SemanticAnalyzer)});
  38242. },
  38243. args: ["aScope"],
  38244. source: "pushScope: aScope\x0a\x09aScope outerScope: currentScope.\x0a\x09currentScope := aScope",
  38245. referencedClasses: [],
  38246. messageSends: ["outerScope:"]
  38247. }),
  38248. $globals.SemanticAnalyzer);
  38249. $core.addMethod(
  38250. $core.method({
  38251. selector: "theClass",
  38252. protocol: "accessing",
  38253. fn: function (){
  38254. var self=this,$self=this;
  38255. return $self["@theClass"];
  38256. },
  38257. args: [],
  38258. source: "theClass\x0a\x09^ theClass",
  38259. referencedClasses: [],
  38260. messageSends: []
  38261. }),
  38262. $globals.SemanticAnalyzer);
  38263. $core.addMethod(
  38264. $core.method({
  38265. selector: "theClass:",
  38266. protocol: "accessing",
  38267. fn: function (aClass){
  38268. var self=this,$self=this;
  38269. $self["@theClass"]=aClass;
  38270. return self;
  38271. },
  38272. args: ["aClass"],
  38273. source: "theClass: aClass\x0a\x09theClass := aClass",
  38274. referencedClasses: [],
  38275. messageSends: []
  38276. }),
  38277. $globals.SemanticAnalyzer);
  38278. $core.addMethod(
  38279. $core.method({
  38280. selector: "thePackage",
  38281. protocol: "accessing",
  38282. fn: function (){
  38283. var self=this,$self=this;
  38284. return $self["@thePackage"];
  38285. },
  38286. args: [],
  38287. source: "thePackage\x0a\x09^ thePackage",
  38288. referencedClasses: [],
  38289. messageSends: []
  38290. }),
  38291. $globals.SemanticAnalyzer);
  38292. $core.addMethod(
  38293. $core.method({
  38294. selector: "thePackage:",
  38295. protocol: "accessing",
  38296. fn: function (aPackage){
  38297. var self=this,$self=this;
  38298. $self["@thePackage"]=aPackage;
  38299. return self;
  38300. },
  38301. args: ["aPackage"],
  38302. source: "thePackage: aPackage\x0a\x09thePackage := aPackage",
  38303. referencedClasses: [],
  38304. messageSends: []
  38305. }),
  38306. $globals.SemanticAnalyzer);
  38307. $core.addMethod(
  38308. $core.method({
  38309. selector: "validateVariableScope:",
  38310. protocol: "scope",
  38311. fn: function (aString){
  38312. var self=this,$self=this;
  38313. return $core.withContext(function($ctx1) {
  38314. var $1,$receiver;
  38315. $1=$recv($self["@currentScope"])._lookupVariable_(aString);
  38316. if(($receiver = $1) == null || $receiver.a$nil){
  38317. $1;
  38318. } else {
  38319. $self._errorShadowingVariable_(aString);
  38320. }
  38321. return self;
  38322. }, function($ctx1) {$ctx1.fill(self,"validateVariableScope:",{aString:aString},$globals.SemanticAnalyzer)});
  38323. },
  38324. args: ["aString"],
  38325. 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 ]",
  38326. referencedClasses: [],
  38327. messageSends: ["ifNotNil:", "lookupVariable:", "errorShadowingVariable:"]
  38328. }),
  38329. $globals.SemanticAnalyzer);
  38330. $core.addMethod(
  38331. $core.method({
  38332. selector: "visitAssignmentNode:",
  38333. protocol: "visiting",
  38334. fn: function (aNode){
  38335. var self=this,$self=this;
  38336. return $core.withContext(function($ctx1) {
  38337. (
  38338. $ctx1.supercall = true,
  38339. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitAssignmentNode_.apply($self, [aNode]));
  38340. $ctx1.supercall = false;
  38341. $recv($recv(aNode)._left())._beAssigned();
  38342. return self;
  38343. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38344. },
  38345. args: ["aNode"],
  38346. source: "visitAssignmentNode: aNode\x0a\x09super visitAssignmentNode: aNode.\x0a\x09aNode left beAssigned",
  38347. referencedClasses: [],
  38348. messageSends: ["visitAssignmentNode:", "beAssigned", "left"]
  38349. }),
  38350. $globals.SemanticAnalyzer);
  38351. $core.addMethod(
  38352. $core.method({
  38353. selector: "visitBlockNode:",
  38354. protocol: "visiting",
  38355. fn: function (aNode){
  38356. var self=this,$self=this;
  38357. return $core.withContext(function($ctx1) {
  38358. $self._pushScope_($self._newBlockScope());
  38359. $recv(aNode)._scope_($self["@currentScope"]);
  38360. $recv($self["@currentScope"])._node_(aNode);
  38361. $recv($self["@currentScope"])._blockIndex_($self._nextBlockIndex());
  38362. $recv($recv(aNode)._parameters())._do_((function(each){
  38363. return $core.withContext(function($ctx2) {
  38364. $self._validateVariableScope_(each);
  38365. return $recv($self["@currentScope"])._addArg_(each);
  38366. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38367. }));
  38368. (
  38369. $ctx1.supercall = true,
  38370. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitBlockNode_.apply($self, [aNode]));
  38371. $ctx1.supercall = false;
  38372. $self._popScope();
  38373. return self;
  38374. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38375. },
  38376. args: ["aNode"],
  38377. 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",
  38378. referencedClasses: [],
  38379. messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "blockIndex:", "nextBlockIndex", "do:", "parameters", "validateVariableScope:", "addArg:", "visitBlockNode:", "popScope"]
  38380. }),
  38381. $globals.SemanticAnalyzer);
  38382. $core.addMethod(
  38383. $core.method({
  38384. selector: "visitCascadeNode:",
  38385. protocol: "visiting",
  38386. fn: function (aNode){
  38387. var self=this,$self=this;
  38388. return $core.withContext(function($ctx1) {
  38389. $recv(aNode)._receiver_($recv($recv($recv(aNode)._dagChildren())._first())._receiver());
  38390. (
  38391. $ctx1.supercall = true,
  38392. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitCascadeNode_.apply($self, [aNode]));
  38393. $ctx1.supercall = false;
  38394. return self;
  38395. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38396. },
  38397. args: ["aNode"],
  38398. source: "visitCascadeNode: aNode\x0a\x09aNode receiver: aNode dagChildren first receiver.\x0a\x09super visitCascadeNode: aNode",
  38399. referencedClasses: [],
  38400. messageSends: ["receiver:", "receiver", "first", "dagChildren", "visitCascadeNode:"]
  38401. }),
  38402. $globals.SemanticAnalyzer);
  38403. $core.addMethod(
  38404. $core.method({
  38405. selector: "visitMethodNode:",
  38406. protocol: "visiting",
  38407. fn: function (aNode){
  38408. var self=this,$self=this;
  38409. return $core.withContext(function($ctx1) {
  38410. $self._pushScope_($self._newMethodScope());
  38411. $recv(aNode)._scope_($self["@currentScope"]);
  38412. $recv($self["@currentScope"])._node_(aNode);
  38413. $recv($recv($self._theClass())._allInstanceVariableNames())._do_((function(each){
  38414. return $core.withContext(function($ctx2) {
  38415. return $recv($self["@currentScope"])._addIVar_(each);
  38416. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38417. }));
  38418. $ctx1.sendIdx["do:"]=1;
  38419. $recv($recv(aNode)._arguments())._do_((function(each){
  38420. return $core.withContext(function($ctx2) {
  38421. $self._validateVariableScope_(each);
  38422. return $recv($self["@currentScope"])._addArg_(each);
  38423. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  38424. }));
  38425. (
  38426. $ctx1.supercall = true,
  38427. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitMethodNode_.apply($self, [aNode]));
  38428. $ctx1.supercall = false;
  38429. $recv(aNode)._classReferences_($self._classReferences());
  38430. $recv(aNode)._sendIndexes_($self._messageSends());
  38431. $self._popScope();
  38432. return aNode;
  38433. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38434. },
  38435. args: ["aNode"],
  38436. 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",
  38437. referencedClasses: [],
  38438. messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "allInstanceVariableNames", "theClass", "addIVar:", "arguments", "validateVariableScope:", "addArg:", "visitMethodNode:", "classReferences:", "classReferences", "sendIndexes:", "messageSends", "popScope"]
  38439. }),
  38440. $globals.SemanticAnalyzer);
  38441. $core.addMethod(
  38442. $core.method({
  38443. selector: "visitReturnNode:",
  38444. protocol: "visiting",
  38445. fn: function (aNode){
  38446. var self=this,$self=this;
  38447. return $core.withContext(function($ctx1) {
  38448. var $1;
  38449. $recv(aNode)._scope_($self["@currentScope"]);
  38450. $1=$recv($self["@currentScope"])._isMethodScope();
  38451. if($core.assert($1)){
  38452. $recv($self["@currentScope"])._localReturn_(true);
  38453. } else {
  38454. $recv($recv($self["@currentScope"])._methodScope())._addNonLocalReturn_($self["@currentScope"]);
  38455. }
  38456. (
  38457. $ctx1.supercall = true,
  38458. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitReturnNode_.apply($self, [aNode]));
  38459. $ctx1.supercall = false;
  38460. return self;
  38461. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38462. },
  38463. args: ["aNode"],
  38464. 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",
  38465. referencedClasses: [],
  38466. messageSends: ["scope:", "ifTrue:ifFalse:", "isMethodScope", "localReturn:", "addNonLocalReturn:", "methodScope", "visitReturnNode:"]
  38467. }),
  38468. $globals.SemanticAnalyzer);
  38469. $core.addMethod(
  38470. $core.method({
  38471. selector: "visitSendNode:",
  38472. protocol: "visiting",
  38473. fn: function (aNode){
  38474. var self=this,$self=this;
  38475. var sends;
  38476. return $core.withContext(function($ctx1) {
  38477. sends=$recv($self._messageSends())._at_ifAbsentPut_($recv(aNode)._selector(),(function(){
  38478. return $core.withContext(function($ctx2) {
  38479. return $recv($globals.OrderedCollection)._new();
  38480. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38481. }));
  38482. $recv(sends)._add_(aNode);
  38483. $recv(aNode)._index_($recv(sends)._size());
  38484. (
  38485. $ctx1.supercall = true,
  38486. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  38487. $ctx1.supercall = false;
  38488. return self;
  38489. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,sends:sends},$globals.SemanticAnalyzer)});
  38490. },
  38491. args: ["aNode"],
  38492. 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",
  38493. referencedClasses: ["OrderedCollection"],
  38494. messageSends: ["at:ifAbsentPut:", "messageSends", "selector", "new", "add:", "index:", "size", "visitSendNode:"]
  38495. }),
  38496. $globals.SemanticAnalyzer);
  38497. $core.addMethod(
  38498. $core.method({
  38499. selector: "visitSequenceNode:",
  38500. protocol: "visiting",
  38501. fn: function (aNode){
  38502. var self=this,$self=this;
  38503. return $core.withContext(function($ctx1) {
  38504. $recv($recv(aNode)._temps())._do_((function(each){
  38505. return $core.withContext(function($ctx2) {
  38506. $self._validateVariableScope_(each);
  38507. return $recv($self["@currentScope"])._addTemp_(each);
  38508. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38509. }));
  38510. (
  38511. $ctx1.supercall = true,
  38512. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($self, [aNode]));
  38513. $ctx1.supercall = false;
  38514. return self;
  38515. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38516. },
  38517. args: ["aNode"],
  38518. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addTemp: each ].\x0a\x0a\x09super visitSequenceNode: aNode",
  38519. referencedClasses: [],
  38520. messageSends: ["do:", "temps", "validateVariableScope:", "addTemp:", "visitSequenceNode:"]
  38521. }),
  38522. $globals.SemanticAnalyzer);
  38523. $core.addMethod(
  38524. $core.method({
  38525. selector: "visitVariableNode:",
  38526. protocol: "visiting",
  38527. fn: function (aNode){
  38528. var self=this,$self=this;
  38529. var binding;
  38530. return $core.withContext(function($ctx1) {
  38531. var $1,$3,$2,$4,$5,$6,$7,$8,$9,$receiver;
  38532. binding=$recv($self["@currentScope"])._lookupVariable_(aNode);
  38533. $1=binding;
  38534. if(($receiver = $1) == null || $receiver.a$nil){
  38535. $3=$recv(aNode)._value();
  38536. $ctx1.sendIdx["value"]=1;
  38537. $2=$recv($3)._isCapitalized();
  38538. if($core.assert($2)){
  38539. $4=$recv($globals.ClassRefVar)._new();
  38540. $ctx1.sendIdx["new"]=1;
  38541. $5=$recv(aNode)._value();
  38542. $ctx1.sendIdx["value"]=2;
  38543. $recv($4)._name_($5);
  38544. $ctx1.sendIdx["name:"]=1;
  38545. $6=$recv($4)._yourself();
  38546. $ctx1.sendIdx["yourself"]=1;
  38547. binding=$6;
  38548. $7=$self._classReferences();
  38549. $8=$recv(aNode)._value();
  38550. $ctx1.sendIdx["value"]=3;
  38551. $recv($7)._add_($8);
  38552. } else {
  38553. $self._errorUnknownVariable_(aNode);
  38554. $9=$recv($globals.UnknownVar)._new();
  38555. $recv($9)._name_($recv(aNode)._value());
  38556. binding=$recv($9)._yourself();
  38557. binding;
  38558. }
  38559. } else {
  38560. $1;
  38561. }
  38562. $recv(aNode)._binding_(binding);
  38563. return self;
  38564. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode,binding:binding},$globals.SemanticAnalyzer)});
  38565. },
  38566. args: ["aNode"],
  38567. 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.",
  38568. referencedClasses: ["ClassRefVar", "UnknownVar"],
  38569. messageSends: ["lookupVariable:", "ifNil:", "ifTrue:ifFalse:", "isCapitalized", "value", "name:", "new", "yourself", "add:", "classReferences", "errorUnknownVariable:", "binding:"]
  38570. }),
  38571. $globals.SemanticAnalyzer);
  38572. $core.addMethod(
  38573. $core.method({
  38574. selector: "on:",
  38575. protocol: "instance creation",
  38576. fn: function (aClass){
  38577. var self=this,$self=this;
  38578. return $core.withContext(function($ctx1) {
  38579. var $1;
  38580. $1=$self._new();
  38581. $recv($1)._theClass_(aClass);
  38582. return $recv($1)._yourself();
  38583. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},$globals.SemanticAnalyzer.a$cls)});
  38584. },
  38585. args: ["aClass"],
  38586. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  38587. referencedClasses: [],
  38588. messageSends: ["theClass:", "new", "yourself"]
  38589. }),
  38590. $globals.SemanticAnalyzer.a$cls);
  38591. $core.addClass("SemanticError", $globals.CompilerError, [], "Compiler-Semantic");
  38592. $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";
  38593. $core.addClass("InvalidAssignmentError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  38594. $globals.InvalidAssignmentError.comment="I get signaled when a pseudo variable gets assigned.";
  38595. $core.addMethod(
  38596. $core.method({
  38597. selector: "messageText",
  38598. protocol: "accessing",
  38599. fn: function (){
  38600. var self=this,$self=this;
  38601. return $core.withContext(function($ctx1) {
  38602. return " Invalid assignment to variable: ".__comma($self._variableName());
  38603. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.InvalidAssignmentError)});
  38604. },
  38605. args: [],
  38606. source: "messageText\x0a\x09^ ' Invalid assignment to variable: ', self variableName",
  38607. referencedClasses: [],
  38608. messageSends: [",", "variableName"]
  38609. }),
  38610. $globals.InvalidAssignmentError);
  38611. $core.addMethod(
  38612. $core.method({
  38613. selector: "variableName",
  38614. protocol: "accessing",
  38615. fn: function (){
  38616. var self=this,$self=this;
  38617. return $self["@variableName"];
  38618. },
  38619. args: [],
  38620. source: "variableName\x0a\x09^ variableName",
  38621. referencedClasses: [],
  38622. messageSends: []
  38623. }),
  38624. $globals.InvalidAssignmentError);
  38625. $core.addMethod(
  38626. $core.method({
  38627. selector: "variableName:",
  38628. protocol: "accessing",
  38629. fn: function (aString){
  38630. var self=this,$self=this;
  38631. $self["@variableName"]=aString;
  38632. return self;
  38633. },
  38634. args: ["aString"],
  38635. source: "variableName: aString\x0a\x09variableName := aString",
  38636. referencedClasses: [],
  38637. messageSends: []
  38638. }),
  38639. $globals.InvalidAssignmentError);
  38640. $core.addClass("ShadowingVariableError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  38641. $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.";
  38642. $core.addMethod(
  38643. $core.method({
  38644. selector: "messageText",
  38645. protocol: "accessing",
  38646. fn: function (){
  38647. var self=this,$self=this;
  38648. return $core.withContext(function($ctx1) {
  38649. var $1;
  38650. $1=$recv("Variable shadowing error: ".__comma($self._variableName())).__comma(" is already defined");
  38651. $ctx1.sendIdx[","]=1;
  38652. return $1;
  38653. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.ShadowingVariableError)});
  38654. },
  38655. args: [],
  38656. source: "messageText\x0a\x09^ 'Variable shadowing error: ', self variableName, ' is already defined'",
  38657. referencedClasses: [],
  38658. messageSends: [",", "variableName"]
  38659. }),
  38660. $globals.ShadowingVariableError);
  38661. $core.addMethod(
  38662. $core.method({
  38663. selector: "variableName",
  38664. protocol: "accessing",
  38665. fn: function (){
  38666. var self=this,$self=this;
  38667. return $self["@variableName"];
  38668. },
  38669. args: [],
  38670. source: "variableName\x0a\x09^ variableName",
  38671. referencedClasses: [],
  38672. messageSends: []
  38673. }),
  38674. $globals.ShadowingVariableError);
  38675. $core.addMethod(
  38676. $core.method({
  38677. selector: "variableName:",
  38678. protocol: "accessing",
  38679. fn: function (aString){
  38680. var self=this,$self=this;
  38681. $self["@variableName"]=aString;
  38682. return self;
  38683. },
  38684. args: ["aString"],
  38685. source: "variableName: aString\x0a\x09variableName := aString",
  38686. referencedClasses: [],
  38687. messageSends: []
  38688. }),
  38689. $globals.ShadowingVariableError);
  38690. $core.addClass("UnknownVariableError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  38691. $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.";
  38692. $core.addMethod(
  38693. $core.method({
  38694. selector: "messageText",
  38695. protocol: "accessing",
  38696. fn: function (){
  38697. var self=this,$self=this;
  38698. return $core.withContext(function($ctx1) {
  38699. var $1;
  38700. $1=$recv("Unknown Variable error: ".__comma($self._variableName())).__comma(" is not defined");
  38701. $ctx1.sendIdx[","]=1;
  38702. return $1;
  38703. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.UnknownVariableError)});
  38704. },
  38705. args: [],
  38706. source: "messageText\x0a\x09^ 'Unknown Variable error: ', self variableName, ' is not defined'",
  38707. referencedClasses: [],
  38708. messageSends: [",", "variableName"]
  38709. }),
  38710. $globals.UnknownVariableError);
  38711. $core.addMethod(
  38712. $core.method({
  38713. selector: "variableName",
  38714. protocol: "accessing",
  38715. fn: function (){
  38716. var self=this,$self=this;
  38717. return $self["@variableName"];
  38718. },
  38719. args: [],
  38720. source: "variableName\x0a\x09^ variableName",
  38721. referencedClasses: [],
  38722. messageSends: []
  38723. }),
  38724. $globals.UnknownVariableError);
  38725. $core.addMethod(
  38726. $core.method({
  38727. selector: "variableName:",
  38728. protocol: "accessing",
  38729. fn: function (aString){
  38730. var self=this,$self=this;
  38731. $self["@variableName"]=aString;
  38732. return self;
  38733. },
  38734. args: ["aString"],
  38735. source: "variableName: aString\x0a\x09variableName := aString",
  38736. referencedClasses: [],
  38737. messageSends: []
  38738. }),
  38739. $globals.UnknownVariableError);
  38740. $core.addMethod(
  38741. $core.method({
  38742. selector: "inlineJS:",
  38743. protocol: "*Compiler-Semantic",
  38744. fn: function (aString){
  38745. var self=this,$self=this;
  38746. return $core.withContext(function($ctx1) {
  38747. var $2,$1,$3,$5,$4;
  38748. $2=$self._sequenceNode();
  38749. $ctx1.sendIdx["sequenceNode"]=1;
  38750. $1=$recv($2)._dagChildren();
  38751. $recv($1)._ifNotEmpty_((function(){
  38752. return $core.withContext(function($ctx2) {
  38753. return $recv($globals.CompilerError)._signal_("inlineJS: does not allow smalltalk statements");
  38754. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38755. }));
  38756. $3=$self._sequenceNode();
  38757. $5=$recv($globals.JSStatementNode)._new();
  38758. $recv($5)._source_(aString);
  38759. $4=$recv($5)._yourself();
  38760. $recv($3)._addDagChild_($4);
  38761. return self;
  38762. }, function($ctx1) {$ctx1.fill(self,"inlineJS:",{aString:aString},$globals.EarlyPragmator)});
  38763. },
  38764. args: ["aString"],
  38765. source: "inlineJS: aString\x0a\x09self sequenceNode dagChildren ifNotEmpty: [\x0a\x09\x09CompilerError signal: 'inlineJS: does not allow smalltalk statements' ].\x0a\x09self sequenceNode addDagChild: (\x0a\x09\x09JSStatementNode new\x0a\x09\x09\x09source: aString;\x0a\x09\x09\x09yourself)",
  38766. referencedClasses: ["CompilerError", "JSStatementNode"],
  38767. messageSends: ["ifNotEmpty:", "dagChildren", "sequenceNode", "signal:", "addDagChild:", "source:", "new", "yourself"]
  38768. }),
  38769. $globals.EarlyPragmator);
  38770. });
  38771. define('amber_core/Compiler-IR',["amber/boot", "amber_core/Compiler-AST", "amber_core/Kernel-Dag", "amber_core/Kernel-Methods", "amber_core/Kernel-Objects"], function($boot){"use strict";
  38772. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  38773. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  38774. var $pkg = $core.addPackage("Compiler-IR");
  38775. $pkg.innerEval = function (expr) { return eval(expr); };
  38776. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  38777. $core.addClass("IRASTTranslator", $globals.NodeVisitor, ["source", "theClass", "method", "sequence", "nextAlias"], "Compiler-IR");
  38778. $globals.IRASTTranslator.comment="I am the AST (abstract syntax tree) visitor responsible for building the intermediate representation graph.";
  38779. $core.addMethod(
  38780. $core.method({
  38781. selector: "addToSequence:",
  38782. protocol: "visiting",
  38783. fn: function (anInstruction){
  38784. var self=this,$self=this;
  38785. return $core.withContext(function($ctx1) {
  38786. var $1,$receiver;
  38787. if(($receiver = anInstruction) == null || $receiver.a$nil){
  38788. anInstruction;
  38789. } else {
  38790. $1=$recv(anInstruction)._isVariable();
  38791. if(!$core.assert($1)){
  38792. $recv($self._sequence())._add_(anInstruction);
  38793. }
  38794. }
  38795. return anInstruction;
  38796. }, function($ctx1) {$ctx1.fill(self,"addToSequence:",{anInstruction:anInstruction},$globals.IRASTTranslator)});
  38797. },
  38798. args: ["anInstruction"],
  38799. source: "addToSequence: anInstruction\x0a\x09anInstruction ifNotNil: [\x0a\x09\x09anInstruction isVariable ifFalse: [\x0a\x09\x09\x09self sequence add: anInstruction ] ].\x0a\x09^ anInstruction",
  38800. referencedClasses: [],
  38801. messageSends: ["ifNotNil:", "ifFalse:", "isVariable", "add:", "sequence"]
  38802. }),
  38803. $globals.IRASTTranslator);
  38804. $core.addMethod(
  38805. $core.method({
  38806. selector: "alias:",
  38807. protocol: "visiting",
  38808. fn: function (aNode){
  38809. var self=this,$self=this;
  38810. var variable;
  38811. return $core.withContext(function($ctx1) {
  38812. var $1,$2,$3,$5,$4,$6,$8,$7;
  38813. $1=$recv(aNode)._isImmutable();
  38814. if($core.assert($1)){
  38815. $2=$self._visit_(aNode);
  38816. $ctx1.sendIdx["visit:"]=1;
  38817. return $2;
  38818. }
  38819. $3=$recv($globals.IRVariable)._new();
  38820. $ctx1.sendIdx["new"]=1;
  38821. $5=$recv($globals.AliasVar)._new();
  38822. $ctx1.sendIdx["new"]=2;
  38823. $4=$recv($5)._name_("$".__comma($self._nextAlias()));
  38824. $recv($3)._variable_($4);
  38825. $6=$recv($3)._yourself();
  38826. $ctx1.sendIdx["yourself"]=1;
  38827. variable=$6;
  38828. $8=$recv($globals.IRAssignment)._new();
  38829. $recv($8)._add_(variable);
  38830. $ctx1.sendIdx["add:"]=1;
  38831. $recv($8)._add_($self._visit_(aNode));
  38832. $ctx1.sendIdx["add:"]=2;
  38833. $7=$recv($8)._yourself();
  38834. $self._addToSequence_($7);
  38835. $recv($recv($self._method())._internalVariables())._add_(variable);
  38836. return variable;
  38837. }, function($ctx1) {$ctx1.fill(self,"alias:",{aNode:aNode,variable:variable},$globals.IRASTTranslator)});
  38838. },
  38839. args: ["aNode"],
  38840. 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",
  38841. referencedClasses: ["IRVariable", "AliasVar", "IRAssignment"],
  38842. messageSends: ["ifTrue:", "isImmutable", "visit:", "variable:", "new", "name:", ",", "nextAlias", "yourself", "addToSequence:", "add:", "internalVariables", "method"]
  38843. }),
  38844. $globals.IRASTTranslator);
  38845. $core.addMethod(
  38846. $core.method({
  38847. selector: "aliasTemporally:",
  38848. protocol: "visiting",
  38849. fn: function (aCollection){
  38850. var self=this,$self=this;
  38851. var threshold,result;
  38852. return $core.withContext(function($ctx1) {
  38853. var $1,$2,$4,$3;
  38854. threshold=(0);
  38855. $recv(aCollection)._withIndexDo_((function(each,i){
  38856. return $core.withContext(function($ctx2) {
  38857. $1=$recv(each)._subtreeNeedsAliasing();
  38858. if($core.assert($1)){
  38859. threshold=i;
  38860. return threshold;
  38861. }
  38862. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  38863. }));
  38864. $ctx1.sendIdx["withIndexDo:"]=1;
  38865. result=$recv($globals.OrderedCollection)._new();
  38866. $recv(aCollection)._withIndexDo_((function(each,i){
  38867. return $core.withContext(function($ctx2) {
  38868. $2=result;
  38869. $4=$recv(i).__lt_eq(threshold);
  38870. if($core.assert($4)){
  38871. $3=$self._alias_(each);
  38872. } else {
  38873. $3=$self._visit_(each);
  38874. }
  38875. return $recv($2)._add_($3);
  38876. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  38877. }));
  38878. return result;
  38879. }, function($ctx1) {$ctx1.fill(self,"aliasTemporally:",{aCollection:aCollection,threshold:threshold,result:result},$globals.IRASTTranslator)});
  38880. },
  38881. args: ["aCollection"],
  38882. 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",
  38883. referencedClasses: ["OrderedCollection"],
  38884. messageSends: ["withIndexDo:", "ifTrue:", "subtreeNeedsAliasing", "new", "add:", "ifTrue:ifFalse:", "<=", "alias:", "visit:"]
  38885. }),
  38886. $globals.IRASTTranslator);
  38887. $core.addMethod(
  38888. $core.method({
  38889. selector: "method",
  38890. protocol: "accessing",
  38891. fn: function (){
  38892. var self=this,$self=this;
  38893. return $self["@method"];
  38894. },
  38895. args: [],
  38896. source: "method\x0a\x09^ method",
  38897. referencedClasses: [],
  38898. messageSends: []
  38899. }),
  38900. $globals.IRASTTranslator);
  38901. $core.addMethod(
  38902. $core.method({
  38903. selector: "method:",
  38904. protocol: "accessing",
  38905. fn: function (anIRMethod){
  38906. var self=this,$self=this;
  38907. $self["@method"]=anIRMethod;
  38908. return self;
  38909. },
  38910. args: ["anIRMethod"],
  38911. source: "method: anIRMethod\x0a\x09method := anIRMethod",
  38912. referencedClasses: [],
  38913. messageSends: []
  38914. }),
  38915. $globals.IRASTTranslator);
  38916. $core.addMethod(
  38917. $core.method({
  38918. selector: "nextAlias",
  38919. protocol: "accessing",
  38920. fn: function (){
  38921. var self=this,$self=this;
  38922. return $core.withContext(function($ctx1) {
  38923. var $1,$receiver;
  38924. $1=$self["@nextAlias"];
  38925. if(($receiver = $1) == null || $receiver.a$nil){
  38926. $self["@nextAlias"]=(0);
  38927. $self["@nextAlias"];
  38928. } else {
  38929. $1;
  38930. }
  38931. $self["@nextAlias"]=$recv($self["@nextAlias"]).__plus((1));
  38932. return $recv($self["@nextAlias"])._asString();
  38933. }, function($ctx1) {$ctx1.fill(self,"nextAlias",{},$globals.IRASTTranslator)});
  38934. },
  38935. args: [],
  38936. source: "nextAlias\x0a\x09nextAlias ifNil: [ nextAlias := 0 ].\x0a\x09nextAlias := nextAlias + 1.\x0a\x09^ nextAlias asString",
  38937. referencedClasses: [],
  38938. messageSends: ["ifNil:", "+", "asString"]
  38939. }),
  38940. $globals.IRASTTranslator);
  38941. $core.addMethod(
  38942. $core.method({
  38943. selector: "sequence",
  38944. protocol: "accessing",
  38945. fn: function (){
  38946. var self=this,$self=this;
  38947. return $self["@sequence"];
  38948. },
  38949. args: [],
  38950. source: "sequence\x0a\x09^ sequence",
  38951. referencedClasses: [],
  38952. messageSends: []
  38953. }),
  38954. $globals.IRASTTranslator);
  38955. $core.addMethod(
  38956. $core.method({
  38957. selector: "sequence:",
  38958. protocol: "accessing",
  38959. fn: function (anIRSequence){
  38960. var self=this,$self=this;
  38961. $self["@sequence"]=anIRSequence;
  38962. return self;
  38963. },
  38964. args: ["anIRSequence"],
  38965. source: "sequence: anIRSequence\x0a\x09sequence := anIRSequence",
  38966. referencedClasses: [],
  38967. messageSends: []
  38968. }),
  38969. $globals.IRASTTranslator);
  38970. $core.addMethod(
  38971. $core.method({
  38972. selector: "source",
  38973. protocol: "accessing",
  38974. fn: function (){
  38975. var self=this,$self=this;
  38976. return $self["@source"];
  38977. },
  38978. args: [],
  38979. source: "source\x0a\x09^ source",
  38980. referencedClasses: [],
  38981. messageSends: []
  38982. }),
  38983. $globals.IRASTTranslator);
  38984. $core.addMethod(
  38985. $core.method({
  38986. selector: "source:",
  38987. protocol: "accessing",
  38988. fn: function (aString){
  38989. var self=this,$self=this;
  38990. $self["@source"]=aString;
  38991. return self;
  38992. },
  38993. args: ["aString"],
  38994. source: "source: aString\x0a\x09source := aString",
  38995. referencedClasses: [],
  38996. messageSends: []
  38997. }),
  38998. $globals.IRASTTranslator);
  38999. $core.addMethod(
  39000. $core.method({
  39001. selector: "theClass",
  39002. protocol: "accessing",
  39003. fn: function (){
  39004. var self=this,$self=this;
  39005. return $self["@theClass"];
  39006. },
  39007. args: [],
  39008. source: "theClass\x0a\x09^ theClass",
  39009. referencedClasses: [],
  39010. messageSends: []
  39011. }),
  39012. $globals.IRASTTranslator);
  39013. $core.addMethod(
  39014. $core.method({
  39015. selector: "theClass:",
  39016. protocol: "accessing",
  39017. fn: function (aClass){
  39018. var self=this,$self=this;
  39019. $self["@theClass"]=aClass;
  39020. return self;
  39021. },
  39022. args: ["aClass"],
  39023. source: "theClass: aClass\x0a\x09theClass := aClass",
  39024. referencedClasses: [],
  39025. messageSends: []
  39026. }),
  39027. $globals.IRASTTranslator);
  39028. $core.addMethod(
  39029. $core.method({
  39030. selector: "visitAssignmentNode:",
  39031. protocol: "visiting",
  39032. fn: function (aNode){
  39033. var self=this,$self=this;
  39034. var left,right,assignment;
  39035. return $core.withContext(function($ctx1) {
  39036. var $2,$1;
  39037. right=$self._visit_($recv(aNode)._right());
  39038. $ctx1.sendIdx["visit:"]=1;
  39039. left=$self._visit_($recv(aNode)._left());
  39040. $2=$recv($globals.IRAssignment)._new();
  39041. $recv($2)._add_(left);
  39042. $ctx1.sendIdx["add:"]=1;
  39043. $recv($2)._add_(right);
  39044. $1=$recv($2)._yourself();
  39045. $self._addToSequence_($1);
  39046. return left;
  39047. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,left:left,right:right,assignment:assignment},$globals.IRASTTranslator)});
  39048. },
  39049. args: ["aNode"],
  39050. 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",
  39051. referencedClasses: ["IRAssignment"],
  39052. messageSends: ["visit:", "right", "left", "addToSequence:", "add:", "new", "yourself"]
  39053. }),
  39054. $globals.IRASTTranslator);
  39055. $core.addMethod(
  39056. $core.method({
  39057. selector: "visitBlockNode:",
  39058. protocol: "visiting",
  39059. fn: function (aNode){
  39060. var self=this,$self=this;
  39061. var closure;
  39062. return $core.withContext(function($ctx1) {
  39063. var $1,$2,$3,$5,$4,$6,$8,$7;
  39064. $1=$recv($globals.IRClosure)._new();
  39065. $ctx1.sendIdx["new"]=1;
  39066. $recv($1)._arguments_($recv(aNode)._parameters());
  39067. $recv($1)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  39068. $2=$recv(aNode)._scope();
  39069. $ctx1.sendIdx["scope"]=1;
  39070. $recv($1)._scope_($2);
  39071. $ctx1.sendIdx["scope:"]=1;
  39072. $3=$recv($1)._yourself();
  39073. $ctx1.sendIdx["yourself"]=1;
  39074. closure=$3;
  39075. $5=$recv(aNode)._scope();
  39076. $ctx1.sendIdx["scope"]=2;
  39077. $4=$recv($5)._temps();
  39078. $recv($4)._do_((function(each){
  39079. return $core.withContext(function($ctx2) {
  39080. $6=closure;
  39081. $8=$recv($globals.IRTempDeclaration)._new();
  39082. $recv($8)._name_($recv(each)._name());
  39083. $recv($8)._scope_($recv(aNode)._scope());
  39084. $7=$recv($8)._yourself();
  39085. return $recv($6)._add_($7);
  39086. $ctx2.sendIdx["add:"]=1;
  39087. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39088. }));
  39089. $ctx1.sendIdx["do:"]=1;
  39090. $recv($recv(aNode)._dagChildren())._do_((function(each){
  39091. return $core.withContext(function($ctx2) {
  39092. return $recv(closure)._add_($self._visit_(each));
  39093. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39094. }));
  39095. return closure;
  39096. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,closure:closure},$globals.IRASTTranslator)});
  39097. },
  39098. args: ["aNode"],
  39099. 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",
  39100. referencedClasses: ["IRClosure", "IRTempDeclaration"],
  39101. messageSends: ["arguments:", "new", "parameters", "requiresSmalltalkContext:", "requiresSmalltalkContext", "scope:", "scope", "yourself", "do:", "temps", "add:", "name:", "name", "dagChildren", "visit:"]
  39102. }),
  39103. $globals.IRASTTranslator);
  39104. $core.addMethod(
  39105. $core.method({
  39106. selector: "visitBlockSequenceNode:",
  39107. protocol: "visiting",
  39108. fn: function (aNode){
  39109. var self=this,$self=this;
  39110. return $core.withContext(function($ctx1) {
  39111. var $1,$2,$4,$3,$5,$8,$7,$6,$10,$13,$12,$11,$9;
  39112. $1=$recv($globals.IRBlockSequence)._new();
  39113. $ctx1.sendIdx["new"]=1;
  39114. return $self._withSequence_do_($1,(function(){
  39115. return $core.withContext(function($ctx2) {
  39116. $2=$recv(aNode)._dagChildren();
  39117. $ctx2.sendIdx["dagChildren"]=1;
  39118. return $recv($2)._ifNotEmpty_((function(){
  39119. return $core.withContext(function($ctx3) {
  39120. $4=$recv(aNode)._dagChildren();
  39121. $ctx3.sendIdx["dagChildren"]=2;
  39122. $3=$recv($4)._allButLast();
  39123. $recv($3)._do_((function(each){
  39124. return $core.withContext(function($ctx4) {
  39125. $5=$self._visitOrAlias_(each);
  39126. $ctx4.sendIdx["visitOrAlias:"]=1;
  39127. return $self._addToSequence_($5);
  39128. $ctx4.sendIdx["addToSequence:"]=1;
  39129. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  39130. }));
  39131. $8=$recv(aNode)._dagChildren();
  39132. $ctx3.sendIdx["dagChildren"]=3;
  39133. $7=$recv($8)._last();
  39134. $ctx3.sendIdx["last"]=1;
  39135. $6=$recv($7)._isReturnNode();
  39136. if($core.assert($6)){
  39137. return $self._addToSequence_($self._visitOrAlias_($recv($recv(aNode)._dagChildren())._last()));
  39138. } else {
  39139. $10=$recv($globals.IRBlockReturn)._new();
  39140. $13=$recv(aNode)._dagChildren();
  39141. $ctx3.sendIdx["dagChildren"]=4;
  39142. $12=$recv($13)._last();
  39143. $ctx3.sendIdx["last"]=2;
  39144. $11=$self._visitOrAlias_($12);
  39145. $ctx3.sendIdx["visitOrAlias:"]=2;
  39146. $recv($10)._add_($11);
  39147. $9=$recv($10)._yourself();
  39148. return $self._addToSequence_($9);
  39149. $ctx3.sendIdx["addToSequence:"]=2;
  39150. }
  39151. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  39152. }));
  39153. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39154. }));
  39155. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39156. },
  39157. args: ["aNode"],
  39158. 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) ] ]]",
  39159. referencedClasses: ["IRBlockSequence", "IRBlockReturn"],
  39160. messageSends: ["withSequence:do:", "new", "ifNotEmpty:", "dagChildren", "do:", "allButLast", "addToSequence:", "visitOrAlias:", "ifFalse:ifTrue:", "isReturnNode", "last", "add:", "yourself"]
  39161. }),
  39162. $globals.IRASTTranslator);
  39163. $core.addMethod(
  39164. $core.method({
  39165. selector: "visitCascadeNode:",
  39166. protocol: "visiting",
  39167. fn: function (aNode){
  39168. var self=this,$self=this;
  39169. var receiver;
  39170. return $core.withContext(function($ctx1) {
  39171. var $1,$2,$4,$3;
  39172. receiver=$recv(aNode)._receiver();
  39173. $1=$recv(receiver)._isImmutable();
  39174. if(!$core.assert($1)){
  39175. var alias;
  39176. alias=$self._alias_(receiver);
  39177. receiver=$recv($recv($globals.VariableNode)._new())._binding_($recv(alias)._variable());
  39178. receiver;
  39179. }
  39180. $2=$recv(aNode)._dagChildren();
  39181. $ctx1.sendIdx["dagChildren"]=1;
  39182. $recv($2)._do_((function(each){
  39183. return $core.withContext(function($ctx2) {
  39184. return $recv(each)._receiver_(receiver);
  39185. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39186. }));
  39187. $ctx1.sendIdx["do:"]=1;
  39188. $4=$recv(aNode)._dagChildren();
  39189. $ctx1.sendIdx["dagChildren"]=2;
  39190. $3=$recv($4)._allButLast();
  39191. $recv($3)._do_((function(each){
  39192. return $core.withContext(function($ctx2) {
  39193. return $self._addToSequence_($self._visit_(each));
  39194. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  39195. }));
  39196. return $self._visitOrAlias_($recv($recv(aNode)._dagChildren())._last());
  39197. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode,receiver:receiver},$globals.IRASTTranslator)});
  39198. },
  39199. args: ["aNode"],
  39200. 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",
  39201. referencedClasses: ["VariableNode"],
  39202. messageSends: ["receiver", "ifFalse:", "isImmutable", "alias:", "binding:", "new", "variable", "do:", "dagChildren", "receiver:", "allButLast", "addToSequence:", "visit:", "visitOrAlias:", "last"]
  39203. }),
  39204. $globals.IRASTTranslator);
  39205. $core.addMethod(
  39206. $core.method({
  39207. selector: "visitDynamicArrayNode:",
  39208. protocol: "visiting",
  39209. fn: function (aNode){
  39210. var self=this,$self=this;
  39211. var array;
  39212. return $core.withContext(function($ctx1) {
  39213. array=$recv($globals.IRDynamicArray)._new();
  39214. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  39215. return $core.withContext(function($ctx2) {
  39216. return $recv(array)._add_(each);
  39217. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39218. }));
  39219. return array;
  39220. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.IRASTTranslator)});
  39221. },
  39222. args: ["aNode"],
  39223. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09array := IRDynamicArray new.\x0a\x09(self aliasTemporally: aNode dagChildren) do: [ :each | array add: each ].\x0a\x09^ array",
  39224. referencedClasses: ["IRDynamicArray"],
  39225. messageSends: ["new", "do:", "aliasTemporally:", "dagChildren", "add:"]
  39226. }),
  39227. $globals.IRASTTranslator);
  39228. $core.addMethod(
  39229. $core.method({
  39230. selector: "visitDynamicDictionaryNode:",
  39231. protocol: "visiting",
  39232. fn: function (aNode){
  39233. var self=this,$self=this;
  39234. var dictionary;
  39235. return $core.withContext(function($ctx1) {
  39236. dictionary=$recv($globals.IRDynamicDictionary)._new();
  39237. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  39238. return $core.withContext(function($ctx2) {
  39239. return $recv(dictionary)._add_(each);
  39240. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39241. }));
  39242. return dictionary;
  39243. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,dictionary:dictionary},$globals.IRASTTranslator)});
  39244. },
  39245. args: ["aNode"],
  39246. source: "visitDynamicDictionaryNode: aNode\x0a\x09| dictionary |\x0a\x09dictionary := IRDynamicDictionary new.\x0a\x09(self aliasTemporally: aNode dagChildren) do: [ :each | dictionary add: each ].\x0a\x09^ dictionary",
  39247. referencedClasses: ["IRDynamicDictionary"],
  39248. messageSends: ["new", "do:", "aliasTemporally:", "dagChildren", "add:"]
  39249. }),
  39250. $globals.IRASTTranslator);
  39251. $core.addMethod(
  39252. $core.method({
  39253. selector: "visitJSStatementNode:",
  39254. protocol: "visiting",
  39255. fn: function (aNode){
  39256. var self=this,$self=this;
  39257. return $core.withContext(function($ctx1) {
  39258. var $1;
  39259. $1=$recv($globals.IRVerbatim)._new();
  39260. $recv($1)._source_($recv($recv(aNode)._source())._crlfSanitized());
  39261. return $recv($1)._yourself();
  39262. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39263. },
  39264. args: ["aNode"],
  39265. source: "visitJSStatementNode: aNode\x0a\x09^ IRVerbatim new\x0a\x09\x09source: aNode source crlfSanitized;\x0a\x09\x09yourself",
  39266. referencedClasses: ["IRVerbatim"],
  39267. messageSends: ["source:", "new", "crlfSanitized", "source", "yourself"]
  39268. }),
  39269. $globals.IRASTTranslator);
  39270. $core.addMethod(
  39271. $core.method({
  39272. selector: "visitMethodNode:",
  39273. protocol: "visiting",
  39274. fn: function (aNode){
  39275. var self=this,$self=this;
  39276. return $core.withContext(function($ctx1) {
  39277. var $2,$3,$4,$1,$6,$5,$7,$9,$10,$11,$8,$12,$14,$13,$15,$17,$19,$20,$18,$21,$16,$23,$22;
  39278. $2=$recv($globals.IRMethod)._new();
  39279. $ctx1.sendIdx["new"]=1;
  39280. $recv($2)._source_($recv($self._source())._crlfSanitized());
  39281. $ctx1.sendIdx["source:"]=1;
  39282. $recv($2)._theClass_($self._theClass());
  39283. $recv($2)._arguments_($recv(aNode)._arguments());
  39284. $recv($2)._selector_($recv(aNode)._selector());
  39285. $recv($2)._sendIndexes_($recv(aNode)._sendIndexes());
  39286. $recv($2)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  39287. $recv($2)._classReferences_($recv(aNode)._classReferences());
  39288. $3=$recv(aNode)._scope();
  39289. $ctx1.sendIdx["scope"]=1;
  39290. $recv($2)._scope_($3);
  39291. $ctx1.sendIdx["scope:"]=1;
  39292. $4=$recv($2)._yourself();
  39293. $ctx1.sendIdx["yourself"]=1;
  39294. $1=$4;
  39295. $self._method_($1);
  39296. $6=$recv(aNode)._scope();
  39297. $ctx1.sendIdx["scope"]=2;
  39298. $5=$recv($6)._temps();
  39299. $recv($5)._do_((function(each){
  39300. return $core.withContext(function($ctx2) {
  39301. $7=$self._method();
  39302. $ctx2.sendIdx["method"]=1;
  39303. $9=$recv($globals.IRTempDeclaration)._new();
  39304. $ctx2.sendIdx["new"]=2;
  39305. $recv($9)._name_($recv(each)._name());
  39306. $10=$recv(aNode)._scope();
  39307. $ctx2.sendIdx["scope"]=3;
  39308. $recv($9)._scope_($10);
  39309. $11=$recv($9)._yourself();
  39310. $ctx2.sendIdx["yourself"]=2;
  39311. $8=$11;
  39312. return $recv($7)._add_($8);
  39313. $ctx2.sendIdx["add:"]=1;
  39314. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39315. }));
  39316. $ctx1.sendIdx["do:"]=1;
  39317. $recv($recv(aNode)._dagChildren())._do_((function(each){
  39318. return $core.withContext(function($ctx2) {
  39319. $12=$self._method();
  39320. $ctx2.sendIdx["method"]=2;
  39321. return $recv($12)._add_($self._visit_(each));
  39322. $ctx2.sendIdx["add:"]=2;
  39323. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39324. }));
  39325. $14=$recv(aNode)._scope();
  39326. $ctx1.sendIdx["scope"]=4;
  39327. $13=$recv($14)._hasLocalReturn();
  39328. if(!$core.assert($13)){
  39329. $15=$self._method();
  39330. $ctx1.sendIdx["method"]=3;
  39331. $17=$recv($globals.IRReturn)._new();
  39332. $ctx1.sendIdx["new"]=3;
  39333. $19=$recv($globals.IRVariable)._new();
  39334. $ctx1.sendIdx["new"]=4;
  39335. $recv($19)._variable_($recv($recv($recv(aNode)._scope())._pseudoVars())._at_("self"));
  39336. $20=$recv($19)._yourself();
  39337. $ctx1.sendIdx["yourself"]=3;
  39338. $18=$20;
  39339. $recv($17)._add_($18);
  39340. $ctx1.sendIdx["add:"]=4;
  39341. $21=$recv($17)._yourself();
  39342. $ctx1.sendIdx["yourself"]=4;
  39343. $16=$21;
  39344. $recv($15)._add_($16);
  39345. $ctx1.sendIdx["add:"]=3;
  39346. $23=$recv($globals.IRVerbatim)._new();
  39347. $recv($23)._source_(";".__comma($recv($globals.String)._lf()));
  39348. $22=$recv($23)._yourself();
  39349. $recv($15)._add_($22);
  39350. }
  39351. return $self._method();
  39352. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39353. },
  39354. args: ["aNode"],
  39355. source: "visitMethodNode: aNode\x0a\x0a\x09self method: (IRMethod new\x0a\x09\x09source: self source crlfSanitized;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09arguments: aNode arguments;\x0a\x09\x09selector: aNode selector;\x0a\x09\x09sendIndexes: aNode sendIndexes;\x0a\x09\x09requiresSmalltalkContext: aNode requiresSmalltalkContext;\x0a\x09\x09classReferences: aNode classReferences;\x0a\x09\x09scope: aNode scope;\x0a\x09\x09yourself).\x0a\x0a\x09aNode scope temps do: [ :each |\x0a\x09\x09self method add: (IRTempDeclaration new\x0a\x09\x09\x09name: each name;\x0a\x09\x09\x09scope: aNode scope;\x0a\x09\x09\x09yourself) ].\x0a\x0a\x09aNode dagChildren do: [ :each | self method add: (self visit: each) ].\x0a\x0a\x09aNode scope hasLocalReturn ifFalse: [self method\x0a\x09\x09add: (IRReturn new\x0a\x09\x09\x09add: (IRVariable new\x0a\x09\x09\x09\x09variable: (aNode scope pseudoVars at: 'self');\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself);\x0a\x09\x09add: (IRVerbatim new source: ';', String lf; yourself) ].\x0a\x0a\x09^ self method",
  39356. referencedClasses: ["IRMethod", "IRTempDeclaration", "IRReturn", "IRVariable", "IRVerbatim", "String"],
  39357. messageSends: ["method:", "source:", "new", "crlfSanitized", "source", "theClass:", "theClass", "arguments:", "arguments", "selector:", "selector", "sendIndexes:", "sendIndexes", "requiresSmalltalkContext:", "requiresSmalltalkContext", "classReferences:", "classReferences", "scope:", "scope", "yourself", "do:", "temps", "add:", "method", "name:", "name", "dagChildren", "visit:", "ifFalse:", "hasLocalReturn", "variable:", "at:", "pseudoVars", ",", "lf"]
  39358. }),
  39359. $globals.IRASTTranslator);
  39360. $core.addMethod(
  39361. $core.method({
  39362. selector: "visitOrAlias:",
  39363. protocol: "visiting",
  39364. fn: function (aNode){
  39365. var self=this,$self=this;
  39366. return $core.withContext(function($ctx1) {
  39367. var $1;
  39368. $1=$recv(aNode)._shouldBeAliased();
  39369. if($core.assert($1)){
  39370. return $self._alias_(aNode);
  39371. } else {
  39372. return $self._visit_(aNode);
  39373. }
  39374. }, function($ctx1) {$ctx1.fill(self,"visitOrAlias:",{aNode:aNode},$globals.IRASTTranslator)});
  39375. },
  39376. args: ["aNode"],
  39377. source: "visitOrAlias: aNode\x0a\x09^ aNode shouldBeAliased\x0a\x09\x09ifTrue: [ self alias: aNode ]\x0a\x09\x09ifFalse: [ self visit: aNode ]",
  39378. referencedClasses: [],
  39379. messageSends: ["ifTrue:ifFalse:", "shouldBeAliased", "alias:", "visit:"]
  39380. }),
  39381. $globals.IRASTTranslator);
  39382. $core.addMethod(
  39383. $core.method({
  39384. selector: "visitReturnNode:",
  39385. protocol: "visiting",
  39386. fn: function (aNode){
  39387. var self=this,$self=this;
  39388. var return_;
  39389. return $core.withContext(function($ctx1) {
  39390. var $1;
  39391. $1=$recv(aNode)._nonLocalReturn();
  39392. if($core.assert($1)){
  39393. return_=$recv($globals.IRNonLocalReturn)._new();
  39394. $ctx1.sendIdx["new"]=1;
  39395. } else {
  39396. return_=$recv($globals.IRReturn)._new();
  39397. }
  39398. $recv(return_)._scope_($recv(aNode)._scope());
  39399. $recv($recv(aNode)._dagChildren())._do_((function(each){
  39400. return $core.withContext(function($ctx2) {
  39401. return $recv(return_)._add_($self._visitOrAlias_(each));
  39402. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  39403. }));
  39404. return return_;
  39405. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode,return_:return_},$globals.IRASTTranslator)});
  39406. },
  39407. args: ["aNode"],
  39408. 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",
  39409. referencedClasses: ["IRNonLocalReturn", "IRReturn"],
  39410. messageSends: ["ifTrue:ifFalse:", "nonLocalReturn", "new", "scope:", "scope", "do:", "dagChildren", "add:", "visitOrAlias:"]
  39411. }),
  39412. $globals.IRASTTranslator);
  39413. $core.addMethod(
  39414. $core.method({
  39415. selector: "visitSendNode:",
  39416. protocol: "visiting",
  39417. fn: function (aNode){
  39418. var self=this,$self=this;
  39419. var send;
  39420. return $core.withContext(function($ctx1) {
  39421. var $1;
  39422. send=$recv($globals.IRSend)._new();
  39423. $1=send;
  39424. $recv($1)._selector_($recv(aNode)._selector());
  39425. $recv($1)._index_($recv(aNode)._index());
  39426. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  39427. return $core.withContext(function($ctx2) {
  39428. return $recv(send)._add_(each);
  39429. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39430. }));
  39431. return send;
  39432. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,send:send},$globals.IRASTTranslator)});
  39433. },
  39434. args: ["aNode"],
  39435. 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",
  39436. referencedClasses: ["IRSend"],
  39437. messageSends: ["new", "selector:", "selector", "index:", "index", "do:", "aliasTemporally:", "dagChildren", "add:"]
  39438. }),
  39439. $globals.IRASTTranslator);
  39440. $core.addMethod(
  39441. $core.method({
  39442. selector: "visitSequenceNode:",
  39443. protocol: "visiting",
  39444. fn: function (aNode){
  39445. var self=this,$self=this;
  39446. return $core.withContext(function($ctx1) {
  39447. return $self._withSequence_do_($recv($globals.IRSequence)._new(),(function(){
  39448. return $core.withContext(function($ctx2) {
  39449. return $recv($recv(aNode)._dagChildren())._do_((function(each){
  39450. return $core.withContext(function($ctx3) {
  39451. return $self._addToSequence_($self._visitOrAlias_(each));
  39452. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  39453. }));
  39454. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39455. }));
  39456. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39457. },
  39458. args: ["aNode"],
  39459. 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) ] ]",
  39460. referencedClasses: ["IRSequence"],
  39461. messageSends: ["withSequence:do:", "new", "do:", "dagChildren", "addToSequence:", "visitOrAlias:"]
  39462. }),
  39463. $globals.IRASTTranslator);
  39464. $core.addMethod(
  39465. $core.method({
  39466. selector: "visitValueNode:",
  39467. protocol: "visiting",
  39468. fn: function (aNode){
  39469. var self=this,$self=this;
  39470. return $core.withContext(function($ctx1) {
  39471. var $1;
  39472. $1=$recv($globals.IRValue)._new();
  39473. $recv($1)._value_($recv(aNode)._value());
  39474. return $recv($1)._yourself();
  39475. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39476. },
  39477. args: ["aNode"],
  39478. source: "visitValueNode: aNode\x0a\x09^ IRValue new\x0a\x09\x09value: aNode value;\x0a\x09\x09yourself",
  39479. referencedClasses: ["IRValue"],
  39480. messageSends: ["value:", "new", "value", "yourself"]
  39481. }),
  39482. $globals.IRASTTranslator);
  39483. $core.addMethod(
  39484. $core.method({
  39485. selector: "visitVariableNode:",
  39486. protocol: "visiting",
  39487. fn: function (aNode){
  39488. var self=this,$self=this;
  39489. return $core.withContext(function($ctx1) {
  39490. var $1;
  39491. $1=$recv($globals.IRVariable)._new();
  39492. $recv($1)._variable_($recv(aNode)._binding());
  39493. return $recv($1)._yourself();
  39494. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39495. },
  39496. args: ["aNode"],
  39497. source: "visitVariableNode: aNode\x0a\x09^ IRVariable new\x0a\x09\x09variable: aNode binding;\x0a\x09\x09yourself",
  39498. referencedClasses: ["IRVariable"],
  39499. messageSends: ["variable:", "new", "binding", "yourself"]
  39500. }),
  39501. $globals.IRASTTranslator);
  39502. $core.addMethod(
  39503. $core.method({
  39504. selector: "withSequence:do:",
  39505. protocol: "accessing",
  39506. fn: function (aSequence,aBlock){
  39507. var self=this,$self=this;
  39508. var outerSequence;
  39509. return $core.withContext(function($ctx1) {
  39510. outerSequence=$self._sequence();
  39511. $self._sequence_(aSequence);
  39512. $ctx1.sendIdx["sequence:"]=1;
  39513. $recv(aBlock)._value();
  39514. $self._sequence_(outerSequence);
  39515. return aSequence;
  39516. }, function($ctx1) {$ctx1.fill(self,"withSequence:do:",{aSequence:aSequence,aBlock:aBlock,outerSequence:outerSequence},$globals.IRASTTranslator)});
  39517. },
  39518. args: ["aSequence", "aBlock"],
  39519. 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",
  39520. referencedClasses: [],
  39521. messageSends: ["sequence", "sequence:", "value"]
  39522. }),
  39523. $globals.IRASTTranslator);
  39524. $core.addClass("IRInstruction", $globals.DagParentNode, ["parent"], "Compiler-IR");
  39525. $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.";
  39526. $core.addMethod(
  39527. $core.method({
  39528. selector: "add:",
  39529. protocol: "building",
  39530. fn: function (anObject){
  39531. var self=this,$self=this;
  39532. return $core.withContext(function($ctx1) {
  39533. $recv(anObject)._parent_(self);
  39534. return $recv($self._dagChildren())._add_(anObject);
  39535. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.IRInstruction)});
  39536. },
  39537. args: ["anObject"],
  39538. source: "add: anObject\x0a\x09anObject parent: self.\x0a\x09^ self dagChildren add: anObject",
  39539. referencedClasses: [],
  39540. messageSends: ["parent:", "add:", "dagChildren"]
  39541. }),
  39542. $globals.IRInstruction);
  39543. $core.addMethod(
  39544. $core.method({
  39545. selector: "isClosure",
  39546. protocol: "testing",
  39547. fn: function (){
  39548. var self=this,$self=this;
  39549. return false;
  39550. },
  39551. args: [],
  39552. source: "isClosure\x0a\x09^ false",
  39553. referencedClasses: [],
  39554. messageSends: []
  39555. }),
  39556. $globals.IRInstruction);
  39557. $core.addMethod(
  39558. $core.method({
  39559. selector: "isInlined",
  39560. protocol: "testing",
  39561. fn: function (){
  39562. var self=this,$self=this;
  39563. return false;
  39564. },
  39565. args: [],
  39566. source: "isInlined\x0a\x09^ false",
  39567. referencedClasses: [],
  39568. messageSends: []
  39569. }),
  39570. $globals.IRInstruction);
  39571. $core.addMethod(
  39572. $core.method({
  39573. selector: "isMethod",
  39574. protocol: "testing",
  39575. fn: function (){
  39576. var self=this,$self=this;
  39577. return false;
  39578. },
  39579. args: [],
  39580. source: "isMethod\x0a\x09^ false",
  39581. referencedClasses: [],
  39582. messageSends: []
  39583. }),
  39584. $globals.IRInstruction);
  39585. $core.addMethod(
  39586. $core.method({
  39587. selector: "isSelf",
  39588. protocol: "testing",
  39589. fn: function (){
  39590. var self=this,$self=this;
  39591. return false;
  39592. },
  39593. args: [],
  39594. source: "isSelf\x0a\x09^ false",
  39595. referencedClasses: [],
  39596. messageSends: []
  39597. }),
  39598. $globals.IRInstruction);
  39599. $core.addMethod(
  39600. $core.method({
  39601. selector: "isSend",
  39602. protocol: "testing",
  39603. fn: function (){
  39604. var self=this,$self=this;
  39605. return false;
  39606. },
  39607. args: [],
  39608. source: "isSend\x0a\x09^ false",
  39609. referencedClasses: [],
  39610. messageSends: []
  39611. }),
  39612. $globals.IRInstruction);
  39613. $core.addMethod(
  39614. $core.method({
  39615. selector: "isSequence",
  39616. protocol: "testing",
  39617. fn: function (){
  39618. var self=this,$self=this;
  39619. return false;
  39620. },
  39621. args: [],
  39622. source: "isSequence\x0a\x09^ false",
  39623. referencedClasses: [],
  39624. messageSends: []
  39625. }),
  39626. $globals.IRInstruction);
  39627. $core.addMethod(
  39628. $core.method({
  39629. selector: "isSuper",
  39630. protocol: "testing",
  39631. fn: function (){
  39632. var self=this,$self=this;
  39633. return false;
  39634. },
  39635. args: [],
  39636. source: "isSuper\x0a\x09^ false",
  39637. referencedClasses: [],
  39638. messageSends: []
  39639. }),
  39640. $globals.IRInstruction);
  39641. $core.addMethod(
  39642. $core.method({
  39643. selector: "isTempDeclaration",
  39644. protocol: "testing",
  39645. fn: function (){
  39646. var self=this,$self=this;
  39647. return false;
  39648. },
  39649. args: [],
  39650. source: "isTempDeclaration\x0a\x09^ false",
  39651. referencedClasses: [],
  39652. messageSends: []
  39653. }),
  39654. $globals.IRInstruction);
  39655. $core.addMethod(
  39656. $core.method({
  39657. selector: "isVariable",
  39658. protocol: "testing",
  39659. fn: function (){
  39660. var self=this,$self=this;
  39661. return false;
  39662. },
  39663. args: [],
  39664. source: "isVariable\x0a\x09^ false",
  39665. referencedClasses: [],
  39666. messageSends: []
  39667. }),
  39668. $globals.IRInstruction);
  39669. $core.addMethod(
  39670. $core.method({
  39671. selector: "method",
  39672. protocol: "accessing",
  39673. fn: function (){
  39674. var self=this,$self=this;
  39675. return $core.withContext(function($ctx1) {
  39676. return $recv($self._parent())._method();
  39677. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.IRInstruction)});
  39678. },
  39679. args: [],
  39680. source: "method\x0a\x09^ self parent method",
  39681. referencedClasses: [],
  39682. messageSends: ["method", "parent"]
  39683. }),
  39684. $globals.IRInstruction);
  39685. $core.addMethod(
  39686. $core.method({
  39687. selector: "needsBoxingAsReceiver",
  39688. protocol: "testing",
  39689. fn: function (){
  39690. var self=this,$self=this;
  39691. return true;
  39692. },
  39693. args: [],
  39694. source: "needsBoxingAsReceiver\x0a\x09^ true",
  39695. referencedClasses: [],
  39696. messageSends: []
  39697. }),
  39698. $globals.IRInstruction);
  39699. $core.addMethod(
  39700. $core.method({
  39701. selector: "parent",
  39702. protocol: "accessing",
  39703. fn: function (){
  39704. var self=this,$self=this;
  39705. return $self["@parent"];
  39706. },
  39707. args: [],
  39708. source: "parent\x0a\x09^ parent",
  39709. referencedClasses: [],
  39710. messageSends: []
  39711. }),
  39712. $globals.IRInstruction);
  39713. $core.addMethod(
  39714. $core.method({
  39715. selector: "parent:",
  39716. protocol: "accessing",
  39717. fn: function (anIRInstruction){
  39718. var self=this,$self=this;
  39719. $self["@parent"]=anIRInstruction;
  39720. return self;
  39721. },
  39722. args: ["anIRInstruction"],
  39723. source: "parent: anIRInstruction\x0a\x09parent := anIRInstruction",
  39724. referencedClasses: [],
  39725. messageSends: []
  39726. }),
  39727. $globals.IRInstruction);
  39728. $core.addMethod(
  39729. $core.method({
  39730. selector: "remove:",
  39731. protocol: "building",
  39732. fn: function (anIRInstruction){
  39733. var self=this,$self=this;
  39734. return $core.withContext(function($ctx1) {
  39735. $recv($self._dagChildren())._remove_(anIRInstruction);
  39736. return self;
  39737. }, function($ctx1) {$ctx1.fill(self,"remove:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  39738. },
  39739. args: ["anIRInstruction"],
  39740. source: "remove: anIRInstruction\x0a\x09self dagChildren remove: anIRInstruction",
  39741. referencedClasses: [],
  39742. messageSends: ["remove:", "dagChildren"]
  39743. }),
  39744. $globals.IRInstruction);
  39745. $core.addMethod(
  39746. $core.method({
  39747. selector: "replace:with:",
  39748. protocol: "building",
  39749. fn: function (anIRInstruction,anotherIRInstruction){
  39750. var self=this,$self=this;
  39751. return $core.withContext(function($ctx1) {
  39752. var $1;
  39753. $recv(anotherIRInstruction)._parent_(self);
  39754. $1=$self._dagChildren();
  39755. $ctx1.sendIdx["dagChildren"]=1;
  39756. $recv($1)._at_put_($recv($self._dagChildren())._indexOf_(anIRInstruction),anotherIRInstruction);
  39757. return self;
  39758. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRInstruction)});
  39759. },
  39760. args: ["anIRInstruction", "anotherIRInstruction"],
  39761. source: "replace: anIRInstruction with: anotherIRInstruction\x0a\x09anotherIRInstruction parent: self.\x0a\x09self dagChildren\x0a\x09\x09at: (self dagChildren indexOf: anIRInstruction)\x0a\x09\x09put: anotherIRInstruction",
  39762. referencedClasses: [],
  39763. messageSends: ["parent:", "at:put:", "dagChildren", "indexOf:"]
  39764. }),
  39765. $globals.IRInstruction);
  39766. $core.addMethod(
  39767. $core.method({
  39768. selector: "replaceWith:",
  39769. protocol: "building",
  39770. fn: function (anIRInstruction){
  39771. var self=this,$self=this;
  39772. return $core.withContext(function($ctx1) {
  39773. $recv($self._parent())._replace_with_(self,anIRInstruction);
  39774. return self;
  39775. }, function($ctx1) {$ctx1.fill(self,"replaceWith:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  39776. },
  39777. args: ["anIRInstruction"],
  39778. source: "replaceWith: anIRInstruction\x0a\x09self parent replace: self with: anIRInstruction",
  39779. referencedClasses: [],
  39780. messageSends: ["replace:with:", "parent"]
  39781. }),
  39782. $globals.IRInstruction);
  39783. $core.addMethod(
  39784. $core.method({
  39785. selector: "scope",
  39786. protocol: "accessing",
  39787. fn: function (){
  39788. var self=this,$self=this;
  39789. return $core.withContext(function($ctx1) {
  39790. var $1,$receiver;
  39791. $1=$self._parent();
  39792. if(($receiver = $1) == null || $receiver.a$nil){
  39793. return $1;
  39794. } else {
  39795. var node;
  39796. node=$receiver;
  39797. return $recv(node)._scope();
  39798. }
  39799. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRInstruction)});
  39800. },
  39801. args: [],
  39802. source: "scope\x0a\x09^ self parent ifNotNil: [ :node | \x0a\x09\x09node scope ]",
  39803. referencedClasses: [],
  39804. messageSends: ["ifNotNil:", "parent", "scope"]
  39805. }),
  39806. $globals.IRInstruction);
  39807. $core.addMethod(
  39808. $core.method({
  39809. selector: "yieldsValue",
  39810. protocol: "testing",
  39811. fn: function (){
  39812. var self=this,$self=this;
  39813. return true;
  39814. },
  39815. args: [],
  39816. source: "yieldsValue\x0a\x09^ true",
  39817. referencedClasses: [],
  39818. messageSends: []
  39819. }),
  39820. $globals.IRInstruction);
  39821. $core.addMethod(
  39822. $core.method({
  39823. selector: "on:",
  39824. protocol: "instance creation",
  39825. fn: function (aBuilder){
  39826. var self=this,$self=this;
  39827. return $core.withContext(function($ctx1) {
  39828. var $1;
  39829. $1=$self._new();
  39830. $recv($1)._builder_(aBuilder);
  39831. return $recv($1)._yourself();
  39832. }, function($ctx1) {$ctx1.fill(self,"on:",{aBuilder:aBuilder},$globals.IRInstruction.a$cls)});
  39833. },
  39834. args: ["aBuilder"],
  39835. source: "on: aBuilder\x0a\x09^ self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself",
  39836. referencedClasses: [],
  39837. messageSends: ["builder:", "new", "yourself"]
  39838. }),
  39839. $globals.IRInstruction.a$cls);
  39840. $core.addClass("IRAssignment", $globals.IRInstruction, [], "Compiler-IR");
  39841. $core.addMethod(
  39842. $core.method({
  39843. selector: "acceptDagVisitor:",
  39844. protocol: "visiting",
  39845. fn: function (aVisitor){
  39846. var self=this,$self=this;
  39847. return $core.withContext(function($ctx1) {
  39848. return $recv(aVisitor)._visitIRAssignment_(self);
  39849. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRAssignment)});
  39850. },
  39851. args: ["aVisitor"],
  39852. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRAssignment: self",
  39853. referencedClasses: [],
  39854. messageSends: ["visitIRAssignment:"]
  39855. }),
  39856. $globals.IRAssignment);
  39857. $core.addMethod(
  39858. $core.method({
  39859. selector: "left",
  39860. protocol: "accessing",
  39861. fn: function (){
  39862. var self=this,$self=this;
  39863. return $core.withContext(function($ctx1) {
  39864. return $recv($self._dagChildren())._first();
  39865. }, function($ctx1) {$ctx1.fill(self,"left",{},$globals.IRAssignment)});
  39866. },
  39867. args: [],
  39868. source: "left\x0a\x09^ self dagChildren first",
  39869. referencedClasses: [],
  39870. messageSends: ["first", "dagChildren"]
  39871. }),
  39872. $globals.IRAssignment);
  39873. $core.addMethod(
  39874. $core.method({
  39875. selector: "right",
  39876. protocol: "accessing",
  39877. fn: function (){
  39878. var self=this,$self=this;
  39879. return $core.withContext(function($ctx1) {
  39880. return $recv($self._dagChildren())._last();
  39881. }, function($ctx1) {$ctx1.fill(self,"right",{},$globals.IRAssignment)});
  39882. },
  39883. args: [],
  39884. source: "right\x0a\x09^ self dagChildren last",
  39885. referencedClasses: [],
  39886. messageSends: ["last", "dagChildren"]
  39887. }),
  39888. $globals.IRAssignment);
  39889. $core.addClass("IRDynamicArray", $globals.IRInstruction, [], "Compiler-IR");
  39890. $core.addMethod(
  39891. $core.method({
  39892. selector: "acceptDagVisitor:",
  39893. protocol: "visiting",
  39894. fn: function (aVisitor){
  39895. var self=this,$self=this;
  39896. return $core.withContext(function($ctx1) {
  39897. return $recv(aVisitor)._visitIRDynamicArray_(self);
  39898. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRDynamicArray)});
  39899. },
  39900. args: ["aVisitor"],
  39901. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRDynamicArray: self",
  39902. referencedClasses: [],
  39903. messageSends: ["visitIRDynamicArray:"]
  39904. }),
  39905. $globals.IRDynamicArray);
  39906. $core.addClass("IRDynamicDictionary", $globals.IRInstruction, [], "Compiler-IR");
  39907. $core.addMethod(
  39908. $core.method({
  39909. selector: "acceptDagVisitor:",
  39910. protocol: "visiting",
  39911. fn: function (aVisitor){
  39912. var self=this,$self=this;
  39913. return $core.withContext(function($ctx1) {
  39914. return $recv(aVisitor)._visitIRDynamicDictionary_(self);
  39915. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRDynamicDictionary)});
  39916. },
  39917. args: ["aVisitor"],
  39918. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRDynamicDictionary: self",
  39919. referencedClasses: [],
  39920. messageSends: ["visitIRDynamicDictionary:"]
  39921. }),
  39922. $globals.IRDynamicDictionary);
  39923. $core.addClass("IRScopedInstruction", $globals.IRInstruction, ["scope"], "Compiler-IR");
  39924. $core.addMethod(
  39925. $core.method({
  39926. selector: "scope",
  39927. protocol: "accessing",
  39928. fn: function (){
  39929. var self=this,$self=this;
  39930. return $self["@scope"];
  39931. },
  39932. args: [],
  39933. source: "scope\x0a\x09^ scope",
  39934. referencedClasses: [],
  39935. messageSends: []
  39936. }),
  39937. $globals.IRScopedInstruction);
  39938. $core.addMethod(
  39939. $core.method({
  39940. selector: "scope:",
  39941. protocol: "accessing",
  39942. fn: function (aScope){
  39943. var self=this,$self=this;
  39944. $self["@scope"]=aScope;
  39945. return self;
  39946. },
  39947. args: ["aScope"],
  39948. source: "scope: aScope\x0a\x09scope := aScope",
  39949. referencedClasses: [],
  39950. messageSends: []
  39951. }),
  39952. $globals.IRScopedInstruction);
  39953. $core.addClass("IRClosureInstruction", $globals.IRScopedInstruction, ["arguments", "requiresSmalltalkContext"], "Compiler-IR");
  39954. $core.addMethod(
  39955. $core.method({
  39956. selector: "arguments",
  39957. protocol: "accessing",
  39958. fn: function (){
  39959. var self=this,$self=this;
  39960. return $core.withContext(function($ctx1) {
  39961. var $1,$receiver;
  39962. $1=$self["@arguments"];
  39963. if(($receiver = $1) == null || $receiver.a$nil){
  39964. return [];
  39965. } else {
  39966. return $1;
  39967. }
  39968. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRClosureInstruction)});
  39969. },
  39970. args: [],
  39971. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  39972. referencedClasses: [],
  39973. messageSends: ["ifNil:"]
  39974. }),
  39975. $globals.IRClosureInstruction);
  39976. $core.addMethod(
  39977. $core.method({
  39978. selector: "arguments:",
  39979. protocol: "accessing",
  39980. fn: function (aCollection){
  39981. var self=this,$self=this;
  39982. $self["@arguments"]=aCollection;
  39983. return self;
  39984. },
  39985. args: ["aCollection"],
  39986. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  39987. referencedClasses: [],
  39988. messageSends: []
  39989. }),
  39990. $globals.IRClosureInstruction);
  39991. $core.addMethod(
  39992. $core.method({
  39993. selector: "locals",
  39994. protocol: "accessing",
  39995. fn: function (){
  39996. var self=this,$self=this;
  39997. return $core.withContext(function($ctx1) {
  39998. var $1;
  39999. $1=$recv($self._arguments())._copy();
  40000. $recv($1)._addAll_($recv($self._tempDeclarations())._collect_((function(each){
  40001. return $core.withContext(function($ctx2) {
  40002. return $recv(each)._name();
  40003. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40004. })));
  40005. return $recv($1)._yourself();
  40006. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.IRClosureInstruction)});
  40007. },
  40008. args: [],
  40009. source: "locals\x0a\x09^ self arguments copy\x0a\x09\x09addAll: (self tempDeclarations collect: [ :each | each name ]);\x0a\x09\x09yourself",
  40010. referencedClasses: [],
  40011. messageSends: ["addAll:", "copy", "arguments", "collect:", "tempDeclarations", "name", "yourself"]
  40012. }),
  40013. $globals.IRClosureInstruction);
  40014. $core.addMethod(
  40015. $core.method({
  40016. selector: "requiresSmalltalkContext",
  40017. protocol: "accessing",
  40018. fn: function (){
  40019. var self=this,$self=this;
  40020. return $core.withContext(function($ctx1) {
  40021. var $1,$receiver;
  40022. $1=$self["@requiresSmalltalkContext"];
  40023. if(($receiver = $1) == null || $receiver.a$nil){
  40024. return false;
  40025. } else {
  40026. return $1;
  40027. }
  40028. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.IRClosureInstruction)});
  40029. },
  40030. args: [],
  40031. source: "requiresSmalltalkContext\x0a\x09^ requiresSmalltalkContext ifNil: [ false ]",
  40032. referencedClasses: [],
  40033. messageSends: ["ifNil:"]
  40034. }),
  40035. $globals.IRClosureInstruction);
  40036. $core.addMethod(
  40037. $core.method({
  40038. selector: "requiresSmalltalkContext:",
  40039. protocol: "accessing",
  40040. fn: function (anObject){
  40041. var self=this,$self=this;
  40042. $self["@requiresSmalltalkContext"]=anObject;
  40043. return self;
  40044. },
  40045. args: ["anObject"],
  40046. source: "requiresSmalltalkContext: anObject\x0a\x09requiresSmalltalkContext := anObject",
  40047. referencedClasses: [],
  40048. messageSends: []
  40049. }),
  40050. $globals.IRClosureInstruction);
  40051. $core.addMethod(
  40052. $core.method({
  40053. selector: "scope:",
  40054. protocol: "accessing",
  40055. fn: function (aScope){
  40056. var self=this,$self=this;
  40057. return $core.withContext(function($ctx1) {
  40058. (
  40059. $ctx1.supercall = true,
  40060. ($globals.IRClosureInstruction.superclass||$boot.nilAsClass).fn.prototype._scope_.apply($self, [aScope]));
  40061. $ctx1.supercall = false;
  40062. $recv(aScope)._instruction_(self);
  40063. return self;
  40064. }, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope},$globals.IRClosureInstruction)});
  40065. },
  40066. args: ["aScope"],
  40067. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  40068. referencedClasses: [],
  40069. messageSends: ["scope:", "instruction:"]
  40070. }),
  40071. $globals.IRClosureInstruction);
  40072. $core.addMethod(
  40073. $core.method({
  40074. selector: "tempDeclarations",
  40075. protocol: "accessing",
  40076. fn: function (){
  40077. var self=this,$self=this;
  40078. return $core.withContext(function($ctx1) {
  40079. return $recv($self._dagChildren())._select_((function(each){
  40080. return $core.withContext(function($ctx2) {
  40081. return $recv(each)._isTempDeclaration();
  40082. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40083. }));
  40084. }, function($ctx1) {$ctx1.fill(self,"tempDeclarations",{},$globals.IRClosureInstruction)});
  40085. },
  40086. args: [],
  40087. source: "tempDeclarations\x0a\x09^ self dagChildren select: [ :each |\x0a\x09\x09each isTempDeclaration ]",
  40088. referencedClasses: [],
  40089. messageSends: ["select:", "dagChildren", "isTempDeclaration"]
  40090. }),
  40091. $globals.IRClosureInstruction);
  40092. $core.addClass("IRClosure", $globals.IRClosureInstruction, [], "Compiler-IR");
  40093. $core.addMethod(
  40094. $core.method({
  40095. selector: "acceptDagVisitor:",
  40096. protocol: "visiting",
  40097. fn: function (aVisitor){
  40098. var self=this,$self=this;
  40099. return $core.withContext(function($ctx1) {
  40100. return $recv(aVisitor)._visitIRClosure_(self);
  40101. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRClosure)});
  40102. },
  40103. args: ["aVisitor"],
  40104. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRClosure: self",
  40105. referencedClasses: [],
  40106. messageSends: ["visitIRClosure:"]
  40107. }),
  40108. $globals.IRClosure);
  40109. $core.addMethod(
  40110. $core.method({
  40111. selector: "isClosure",
  40112. protocol: "testing",
  40113. fn: function (){
  40114. var self=this,$self=this;
  40115. return true;
  40116. },
  40117. args: [],
  40118. source: "isClosure\x0a\x09^ true",
  40119. referencedClasses: [],
  40120. messageSends: []
  40121. }),
  40122. $globals.IRClosure);
  40123. $core.addMethod(
  40124. $core.method({
  40125. selector: "sequence",
  40126. protocol: "accessing",
  40127. fn: function (){
  40128. var self=this,$self=this;
  40129. return $core.withContext(function($ctx1) {
  40130. return $recv($self._dagChildren())._last();
  40131. }, function($ctx1) {$ctx1.fill(self,"sequence",{},$globals.IRClosure)});
  40132. },
  40133. args: [],
  40134. source: "sequence\x0a\x09^ self dagChildren last",
  40135. referencedClasses: [],
  40136. messageSends: ["last", "dagChildren"]
  40137. }),
  40138. $globals.IRClosure);
  40139. $core.addClass("IRMethod", $globals.IRClosureInstruction, ["theClass", "source", "selector", "classReferences", "sendIndexes", "requiresSmalltalkContext", "internalVariables"], "Compiler-IR");
  40140. $globals.IRMethod.comment="I am a method instruction";
  40141. $core.addMethod(
  40142. $core.method({
  40143. selector: "acceptDagVisitor:",
  40144. protocol: "visiting",
  40145. fn: function (aVisitor){
  40146. var self=this,$self=this;
  40147. return $core.withContext(function($ctx1) {
  40148. return $recv(aVisitor)._visitIRMethod_(self);
  40149. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRMethod)});
  40150. },
  40151. args: ["aVisitor"],
  40152. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRMethod: self",
  40153. referencedClasses: [],
  40154. messageSends: ["visitIRMethod:"]
  40155. }),
  40156. $globals.IRMethod);
  40157. $core.addMethod(
  40158. $core.method({
  40159. selector: "classReferences",
  40160. protocol: "accessing",
  40161. fn: function (){
  40162. var self=this,$self=this;
  40163. return $self["@classReferences"];
  40164. },
  40165. args: [],
  40166. source: "classReferences\x0a\x09^ classReferences",
  40167. referencedClasses: [],
  40168. messageSends: []
  40169. }),
  40170. $globals.IRMethod);
  40171. $core.addMethod(
  40172. $core.method({
  40173. selector: "classReferences:",
  40174. protocol: "accessing",
  40175. fn: function (aCollection){
  40176. var self=this,$self=this;
  40177. $self["@classReferences"]=aCollection;
  40178. return self;
  40179. },
  40180. args: ["aCollection"],
  40181. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  40182. referencedClasses: [],
  40183. messageSends: []
  40184. }),
  40185. $globals.IRMethod);
  40186. $core.addMethod(
  40187. $core.method({
  40188. selector: "internalVariables",
  40189. protocol: "accessing",
  40190. fn: function (){
  40191. var self=this,$self=this;
  40192. return $core.withContext(function($ctx1) {
  40193. var $1,$receiver;
  40194. $1=$self["@internalVariables"];
  40195. if(($receiver = $1) == null || $receiver.a$nil){
  40196. $self["@internalVariables"]=$recv($globals.Set)._new();
  40197. return $self["@internalVariables"];
  40198. } else {
  40199. return $1;
  40200. }
  40201. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRMethod)});
  40202. },
  40203. args: [],
  40204. source: "internalVariables\x0a\x09^ internalVariables ifNil: [ internalVariables := Set new ]",
  40205. referencedClasses: ["Set"],
  40206. messageSends: ["ifNil:", "new"]
  40207. }),
  40208. $globals.IRMethod);
  40209. $core.addMethod(
  40210. $core.method({
  40211. selector: "isMethod",
  40212. protocol: "testing",
  40213. fn: function (){
  40214. var self=this,$self=this;
  40215. return true;
  40216. },
  40217. args: [],
  40218. source: "isMethod\x0a\x09^ true",
  40219. referencedClasses: [],
  40220. messageSends: []
  40221. }),
  40222. $globals.IRMethod);
  40223. $core.addMethod(
  40224. $core.method({
  40225. selector: "messageSends",
  40226. protocol: "accessing",
  40227. fn: function (){
  40228. var self=this,$self=this;
  40229. return $core.withContext(function($ctx1) {
  40230. return $recv($self._sendIndexes())._keys();
  40231. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.IRMethod)});
  40232. },
  40233. args: [],
  40234. source: "messageSends\x0a\x09^ self sendIndexes keys",
  40235. referencedClasses: [],
  40236. messageSends: ["keys", "sendIndexes"]
  40237. }),
  40238. $globals.IRMethod);
  40239. $core.addMethod(
  40240. $core.method({
  40241. selector: "method",
  40242. protocol: "accessing",
  40243. fn: function (){
  40244. var self=this,$self=this;
  40245. return self;
  40246. },
  40247. args: [],
  40248. source: "method\x0a\x09^ self",
  40249. referencedClasses: [],
  40250. messageSends: []
  40251. }),
  40252. $globals.IRMethod);
  40253. $core.addMethod(
  40254. $core.method({
  40255. selector: "selector",
  40256. protocol: "accessing",
  40257. fn: function (){
  40258. var self=this,$self=this;
  40259. return $self["@selector"];
  40260. },
  40261. args: [],
  40262. source: "selector\x0a\x09^ selector",
  40263. referencedClasses: [],
  40264. messageSends: []
  40265. }),
  40266. $globals.IRMethod);
  40267. $core.addMethod(
  40268. $core.method({
  40269. selector: "selector:",
  40270. protocol: "accessing",
  40271. fn: function (aString){
  40272. var self=this,$self=this;
  40273. $self["@selector"]=aString;
  40274. return self;
  40275. },
  40276. args: ["aString"],
  40277. source: "selector: aString\x0a\x09selector := aString",
  40278. referencedClasses: [],
  40279. messageSends: []
  40280. }),
  40281. $globals.IRMethod);
  40282. $core.addMethod(
  40283. $core.method({
  40284. selector: "sendIndexes",
  40285. protocol: "accessing",
  40286. fn: function (){
  40287. var self=this,$self=this;
  40288. return $self["@sendIndexes"];
  40289. },
  40290. args: [],
  40291. source: "sendIndexes\x0a\x09^ sendIndexes",
  40292. referencedClasses: [],
  40293. messageSends: []
  40294. }),
  40295. $globals.IRMethod);
  40296. $core.addMethod(
  40297. $core.method({
  40298. selector: "sendIndexes:",
  40299. protocol: "accessing",
  40300. fn: function (aDictionary){
  40301. var self=this,$self=this;
  40302. $self["@sendIndexes"]=aDictionary;
  40303. return self;
  40304. },
  40305. args: ["aDictionary"],
  40306. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  40307. referencedClasses: [],
  40308. messageSends: []
  40309. }),
  40310. $globals.IRMethod);
  40311. $core.addMethod(
  40312. $core.method({
  40313. selector: "source",
  40314. protocol: "accessing",
  40315. fn: function (){
  40316. var self=this,$self=this;
  40317. return $self["@source"];
  40318. },
  40319. args: [],
  40320. source: "source\x0a\x09^ source",
  40321. referencedClasses: [],
  40322. messageSends: []
  40323. }),
  40324. $globals.IRMethod);
  40325. $core.addMethod(
  40326. $core.method({
  40327. selector: "source:",
  40328. protocol: "accessing",
  40329. fn: function (aString){
  40330. var self=this,$self=this;
  40331. $self["@source"]=aString;
  40332. return self;
  40333. },
  40334. args: ["aString"],
  40335. source: "source: aString\x0a\x09source := aString",
  40336. referencedClasses: [],
  40337. messageSends: []
  40338. }),
  40339. $globals.IRMethod);
  40340. $core.addMethod(
  40341. $core.method({
  40342. selector: "theClass",
  40343. protocol: "accessing",
  40344. fn: function (){
  40345. var self=this,$self=this;
  40346. return $self["@theClass"];
  40347. },
  40348. args: [],
  40349. source: "theClass\x0a\x09^ theClass",
  40350. referencedClasses: [],
  40351. messageSends: []
  40352. }),
  40353. $globals.IRMethod);
  40354. $core.addMethod(
  40355. $core.method({
  40356. selector: "theClass:",
  40357. protocol: "accessing",
  40358. fn: function (aClass){
  40359. var self=this,$self=this;
  40360. $self["@theClass"]=aClass;
  40361. return self;
  40362. },
  40363. args: ["aClass"],
  40364. source: "theClass: aClass\x0a\x09theClass := aClass",
  40365. referencedClasses: [],
  40366. messageSends: []
  40367. }),
  40368. $globals.IRMethod);
  40369. $core.addClass("IRReturn", $globals.IRScopedInstruction, [], "Compiler-IR");
  40370. $globals.IRReturn.comment="I am a local return instruction.";
  40371. $core.addMethod(
  40372. $core.method({
  40373. selector: "acceptDagVisitor:",
  40374. protocol: "visiting",
  40375. fn: function (aVisitor){
  40376. var self=this,$self=this;
  40377. return $core.withContext(function($ctx1) {
  40378. return $recv(aVisitor)._visitIRReturn_(self);
  40379. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRReturn)});
  40380. },
  40381. args: ["aVisitor"],
  40382. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRReturn: self",
  40383. referencedClasses: [],
  40384. messageSends: ["visitIRReturn:"]
  40385. }),
  40386. $globals.IRReturn);
  40387. $core.addMethod(
  40388. $core.method({
  40389. selector: "expression",
  40390. protocol: "accessing",
  40391. fn: function (){
  40392. var self=this,$self=this;
  40393. return $core.withContext(function($ctx1) {
  40394. return $recv($self._dagChildren())._single();
  40395. }, function($ctx1) {$ctx1.fill(self,"expression",{},$globals.IRReturn)});
  40396. },
  40397. args: [],
  40398. source: "expression\x0a\x09^ self dagChildren single",
  40399. referencedClasses: [],
  40400. messageSends: ["single", "dagChildren"]
  40401. }),
  40402. $globals.IRReturn);
  40403. $core.addMethod(
  40404. $core.method({
  40405. selector: "scope",
  40406. protocol: "accessing",
  40407. fn: function (){
  40408. var self=this,$self=this;
  40409. return $core.withContext(function($ctx1) {
  40410. var $1,$receiver;
  40411. $1=$self["@scope"];
  40412. if(($receiver = $1) == null || $receiver.a$nil){
  40413. return $recv($self._parent())._scope();
  40414. } else {
  40415. return $1;
  40416. }
  40417. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRReturn)});
  40418. },
  40419. args: [],
  40420. source: "scope\x0a\x09^ scope ifNil: [ self parent scope ]",
  40421. referencedClasses: [],
  40422. messageSends: ["ifNil:", "scope", "parent"]
  40423. }),
  40424. $globals.IRReturn);
  40425. $core.addMethod(
  40426. $core.method({
  40427. selector: "yieldsValue",
  40428. protocol: "testing",
  40429. fn: function (){
  40430. var self=this,$self=this;
  40431. return false;
  40432. },
  40433. args: [],
  40434. source: "yieldsValue\x0a\x09^ false",
  40435. referencedClasses: [],
  40436. messageSends: []
  40437. }),
  40438. $globals.IRReturn);
  40439. $core.addClass("IRBlockReturn", $globals.IRReturn, [], "Compiler-IR");
  40440. $globals.IRBlockReturn.comment="Smalltalk blocks return their last statement. I am a implicit block return instruction.";
  40441. $core.addMethod(
  40442. $core.method({
  40443. selector: "acceptDagVisitor:",
  40444. protocol: "visiting",
  40445. fn: function (aVisitor){
  40446. var self=this,$self=this;
  40447. return $core.withContext(function($ctx1) {
  40448. return $recv(aVisitor)._visitIRBlockReturn_(self);
  40449. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRBlockReturn)});
  40450. },
  40451. args: ["aVisitor"],
  40452. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRBlockReturn: self",
  40453. referencedClasses: [],
  40454. messageSends: ["visitIRBlockReturn:"]
  40455. }),
  40456. $globals.IRBlockReturn);
  40457. $core.addClass("IRNonLocalReturn", $globals.IRReturn, [], "Compiler-IR");
  40458. $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.";
  40459. $core.addMethod(
  40460. $core.method({
  40461. selector: "acceptDagVisitor:",
  40462. protocol: "visiting",
  40463. fn: function (aVisitor){
  40464. var self=this,$self=this;
  40465. return $core.withContext(function($ctx1) {
  40466. return $recv(aVisitor)._visitIRNonLocalReturn_(self);
  40467. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRNonLocalReturn)});
  40468. },
  40469. args: ["aVisitor"],
  40470. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturn: self",
  40471. referencedClasses: [],
  40472. messageSends: ["visitIRNonLocalReturn:"]
  40473. }),
  40474. $globals.IRNonLocalReturn);
  40475. $core.addClass("IRTempDeclaration", $globals.IRScopedInstruction, ["name"], "Compiler-IR");
  40476. $core.addMethod(
  40477. $core.method({
  40478. selector: "acceptDagVisitor:",
  40479. protocol: "visiting",
  40480. fn: function (aVisitor){
  40481. var self=this,$self=this;
  40482. return $core.withContext(function($ctx1) {
  40483. return $recv(aVisitor)._visitIRTempDeclaration_(self);
  40484. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRTempDeclaration)});
  40485. },
  40486. args: ["aVisitor"],
  40487. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self",
  40488. referencedClasses: [],
  40489. messageSends: ["visitIRTempDeclaration:"]
  40490. }),
  40491. $globals.IRTempDeclaration);
  40492. $core.addMethod(
  40493. $core.method({
  40494. selector: "isTempDeclaration",
  40495. protocol: "testing",
  40496. fn: function (){
  40497. var self=this,$self=this;
  40498. return true;
  40499. },
  40500. args: [],
  40501. source: "isTempDeclaration\x0a\x09^ true",
  40502. referencedClasses: [],
  40503. messageSends: []
  40504. }),
  40505. $globals.IRTempDeclaration);
  40506. $core.addMethod(
  40507. $core.method({
  40508. selector: "name",
  40509. protocol: "accessing",
  40510. fn: function (){
  40511. var self=this,$self=this;
  40512. return $self["@name"];
  40513. },
  40514. args: [],
  40515. source: "name\x0a\x09^ name",
  40516. referencedClasses: [],
  40517. messageSends: []
  40518. }),
  40519. $globals.IRTempDeclaration);
  40520. $core.addMethod(
  40521. $core.method({
  40522. selector: "name:",
  40523. protocol: "accessing",
  40524. fn: function (aString){
  40525. var self=this,$self=this;
  40526. $self["@name"]=aString;
  40527. return self;
  40528. },
  40529. args: ["aString"],
  40530. source: "name: aString\x0a\x09name := aString",
  40531. referencedClasses: [],
  40532. messageSends: []
  40533. }),
  40534. $globals.IRTempDeclaration);
  40535. $core.addClass("IRSend", $globals.IRInstruction, ["selector", "index"], "Compiler-IR");
  40536. $globals.IRSend.comment="I am a message send instruction.";
  40537. $core.addMethod(
  40538. $core.method({
  40539. selector: "acceptDagVisitor:",
  40540. protocol: "visiting",
  40541. fn: function (aVisitor){
  40542. var self=this,$self=this;
  40543. return $core.withContext(function($ctx1) {
  40544. return $recv(aVisitor)._visitIRSend_(self);
  40545. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRSend)});
  40546. },
  40547. args: ["aVisitor"],
  40548. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRSend: self",
  40549. referencedClasses: [],
  40550. messageSends: ["visitIRSend:"]
  40551. }),
  40552. $globals.IRSend);
  40553. $core.addMethod(
  40554. $core.method({
  40555. selector: "arguments",
  40556. protocol: "accessing",
  40557. fn: function (){
  40558. var self=this,$self=this;
  40559. return $core.withContext(function($ctx1) {
  40560. return $recv($self._dagChildren())._allButFirst();
  40561. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRSend)});
  40562. },
  40563. args: [],
  40564. source: "arguments\x0a\x09^ self dagChildren allButFirst",
  40565. referencedClasses: [],
  40566. messageSends: ["allButFirst", "dagChildren"]
  40567. }),
  40568. $globals.IRSend);
  40569. $core.addMethod(
  40570. $core.method({
  40571. selector: "index",
  40572. protocol: "accessing",
  40573. fn: function (){
  40574. var self=this,$self=this;
  40575. return $self["@index"];
  40576. },
  40577. args: [],
  40578. source: "index\x0a\x09^ index",
  40579. referencedClasses: [],
  40580. messageSends: []
  40581. }),
  40582. $globals.IRSend);
  40583. $core.addMethod(
  40584. $core.method({
  40585. selector: "index:",
  40586. protocol: "accessing",
  40587. fn: function (anInteger){
  40588. var self=this,$self=this;
  40589. $self["@index"]=anInteger;
  40590. return self;
  40591. },
  40592. args: ["anInteger"],
  40593. source: "index: anInteger\x0a\x09index := anInteger",
  40594. referencedClasses: [],
  40595. messageSends: []
  40596. }),
  40597. $globals.IRSend);
  40598. $core.addMethod(
  40599. $core.method({
  40600. selector: "isSend",
  40601. protocol: "testing",
  40602. fn: function (){
  40603. var self=this,$self=this;
  40604. return true;
  40605. },
  40606. args: [],
  40607. source: "isSend\x0a\x09^ true",
  40608. referencedClasses: [],
  40609. messageSends: []
  40610. }),
  40611. $globals.IRSend);
  40612. $core.addMethod(
  40613. $core.method({
  40614. selector: "receiver",
  40615. protocol: "accessing",
  40616. fn: function (){
  40617. var self=this,$self=this;
  40618. return $core.withContext(function($ctx1) {
  40619. return $recv($self._dagChildren())._first();
  40620. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.IRSend)});
  40621. },
  40622. args: [],
  40623. source: "receiver\x0a\x09^ self dagChildren first",
  40624. referencedClasses: [],
  40625. messageSends: ["first", "dagChildren"]
  40626. }),
  40627. $globals.IRSend);
  40628. $core.addMethod(
  40629. $core.method({
  40630. selector: "selector",
  40631. protocol: "accessing",
  40632. fn: function (){
  40633. var self=this,$self=this;
  40634. return $self["@selector"];
  40635. },
  40636. args: [],
  40637. source: "selector\x0a\x09^ selector",
  40638. referencedClasses: [],
  40639. messageSends: []
  40640. }),
  40641. $globals.IRSend);
  40642. $core.addMethod(
  40643. $core.method({
  40644. selector: "selector:",
  40645. protocol: "accessing",
  40646. fn: function (aString){
  40647. var self=this,$self=this;
  40648. $self["@selector"]=aString;
  40649. return self;
  40650. },
  40651. args: ["aString"],
  40652. source: "selector: aString\x0a\x09selector := aString",
  40653. referencedClasses: [],
  40654. messageSends: []
  40655. }),
  40656. $globals.IRSend);
  40657. $core.addClass("IRSequence", $globals.IRInstruction, [], "Compiler-IR");
  40658. $core.addMethod(
  40659. $core.method({
  40660. selector: "acceptDagVisitor:",
  40661. protocol: "visiting",
  40662. fn: function (aVisitor){
  40663. var self=this,$self=this;
  40664. return $core.withContext(function($ctx1) {
  40665. return $recv(aVisitor)._visitIRSequence_(self);
  40666. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRSequence)});
  40667. },
  40668. args: ["aVisitor"],
  40669. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRSequence: self",
  40670. referencedClasses: [],
  40671. messageSends: ["visitIRSequence:"]
  40672. }),
  40673. $globals.IRSequence);
  40674. $core.addMethod(
  40675. $core.method({
  40676. selector: "isSequence",
  40677. protocol: "testing",
  40678. fn: function (){
  40679. var self=this,$self=this;
  40680. return true;
  40681. },
  40682. args: [],
  40683. source: "isSequence\x0a\x09^ true",
  40684. referencedClasses: [],
  40685. messageSends: []
  40686. }),
  40687. $globals.IRSequence);
  40688. $core.addClass("IRBlockSequence", $globals.IRSequence, [], "Compiler-IR");
  40689. $core.addMethod(
  40690. $core.method({
  40691. selector: "acceptDagVisitor:",
  40692. protocol: "visiting",
  40693. fn: function (aVisitor){
  40694. var self=this,$self=this;
  40695. return $core.withContext(function($ctx1) {
  40696. return $recv(aVisitor)._visitIRBlockSequence_(self);
  40697. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRBlockSequence)});
  40698. },
  40699. args: ["aVisitor"],
  40700. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self",
  40701. referencedClasses: [],
  40702. messageSends: ["visitIRBlockSequence:"]
  40703. }),
  40704. $globals.IRBlockSequence);
  40705. $core.addClass("IRValue", $globals.IRInstruction, ["value"], "Compiler-IR");
  40706. $globals.IRValue.comment="I am the simplest possible instruction. I represent a value.";
  40707. $core.addMethod(
  40708. $core.method({
  40709. selector: "acceptDagVisitor:",
  40710. protocol: "visiting",
  40711. fn: function (aVisitor){
  40712. var self=this,$self=this;
  40713. return $core.withContext(function($ctx1) {
  40714. return $recv(aVisitor)._visitIRValue_(self);
  40715. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRValue)});
  40716. },
  40717. args: ["aVisitor"],
  40718. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRValue: self",
  40719. referencedClasses: [],
  40720. messageSends: ["visitIRValue:"]
  40721. }),
  40722. $globals.IRValue);
  40723. $core.addMethod(
  40724. $core.method({
  40725. selector: "needsBoxingAsReceiver",
  40726. protocol: "testing",
  40727. fn: function (){
  40728. var self=this,$self=this;
  40729. return false;
  40730. },
  40731. args: [],
  40732. source: "needsBoxingAsReceiver\x0a\x09^ false",
  40733. referencedClasses: [],
  40734. messageSends: []
  40735. }),
  40736. $globals.IRValue);
  40737. $core.addMethod(
  40738. $core.method({
  40739. selector: "value",
  40740. protocol: "accessing",
  40741. fn: function (){
  40742. var self=this,$self=this;
  40743. return $self["@value"];
  40744. },
  40745. args: [],
  40746. source: "value\x0a\x09^ value",
  40747. referencedClasses: [],
  40748. messageSends: []
  40749. }),
  40750. $globals.IRValue);
  40751. $core.addMethod(
  40752. $core.method({
  40753. selector: "value:",
  40754. protocol: "accessing",
  40755. fn: function (aString){
  40756. var self=this,$self=this;
  40757. $self["@value"]=aString;
  40758. return self;
  40759. },
  40760. args: ["aString"],
  40761. source: "value: aString\x0a\x09value := aString",
  40762. referencedClasses: [],
  40763. messageSends: []
  40764. }),
  40765. $globals.IRValue);
  40766. $core.addClass("IRVariable", $globals.IRInstruction, ["variable"], "Compiler-IR");
  40767. $globals.IRVariable.comment="I am a variable instruction.";
  40768. $core.addMethod(
  40769. $core.method({
  40770. selector: "acceptDagVisitor:",
  40771. protocol: "visiting",
  40772. fn: function (aVisitor){
  40773. var self=this,$self=this;
  40774. return $core.withContext(function($ctx1) {
  40775. return $recv(aVisitor)._visitIRVariable_(self);
  40776. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRVariable)});
  40777. },
  40778. args: ["aVisitor"],
  40779. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRVariable: self",
  40780. referencedClasses: [],
  40781. messageSends: ["visitIRVariable:"]
  40782. }),
  40783. $globals.IRVariable);
  40784. $core.addMethod(
  40785. $core.method({
  40786. selector: "isSelf",
  40787. protocol: "testing",
  40788. fn: function (){
  40789. var self=this,$self=this;
  40790. return $core.withContext(function($ctx1) {
  40791. return $recv($self._variable())._isSelf();
  40792. }, function($ctx1) {$ctx1.fill(self,"isSelf",{},$globals.IRVariable)});
  40793. },
  40794. args: [],
  40795. source: "isSelf\x0a\x09^ self variable isSelf",
  40796. referencedClasses: [],
  40797. messageSends: ["isSelf", "variable"]
  40798. }),
  40799. $globals.IRVariable);
  40800. $core.addMethod(
  40801. $core.method({
  40802. selector: "isSuper",
  40803. protocol: "testing",
  40804. fn: function (){
  40805. var self=this,$self=this;
  40806. return $core.withContext(function($ctx1) {
  40807. return $recv($self._variable())._isSuper();
  40808. }, function($ctx1) {$ctx1.fill(self,"isSuper",{},$globals.IRVariable)});
  40809. },
  40810. args: [],
  40811. source: "isSuper\x0a\x09^ self variable isSuper",
  40812. referencedClasses: [],
  40813. messageSends: ["isSuper", "variable"]
  40814. }),
  40815. $globals.IRVariable);
  40816. $core.addMethod(
  40817. $core.method({
  40818. selector: "isVariable",
  40819. protocol: "testing",
  40820. fn: function (){
  40821. var self=this,$self=this;
  40822. return true;
  40823. },
  40824. args: [],
  40825. source: "isVariable\x0a\x09^ true",
  40826. referencedClasses: [],
  40827. messageSends: []
  40828. }),
  40829. $globals.IRVariable);
  40830. $core.addMethod(
  40831. $core.method({
  40832. selector: "needsBoxingAsReceiver",
  40833. protocol: "testing",
  40834. fn: function (){
  40835. var self=this,$self=this;
  40836. return $core.withContext(function($ctx1) {
  40837. return $recv($recv($self._variable())._isPseudoVar())._not();
  40838. }, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{},$globals.IRVariable)});
  40839. },
  40840. args: [],
  40841. source: "needsBoxingAsReceiver\x0a\x09^ self variable isPseudoVar not",
  40842. referencedClasses: [],
  40843. messageSends: ["not", "isPseudoVar", "variable"]
  40844. }),
  40845. $globals.IRVariable);
  40846. $core.addMethod(
  40847. $core.method({
  40848. selector: "variable",
  40849. protocol: "accessing",
  40850. fn: function (){
  40851. var self=this,$self=this;
  40852. return $self["@variable"];
  40853. },
  40854. args: [],
  40855. source: "variable\x0a\x09^ variable",
  40856. referencedClasses: [],
  40857. messageSends: []
  40858. }),
  40859. $globals.IRVariable);
  40860. $core.addMethod(
  40861. $core.method({
  40862. selector: "variable:",
  40863. protocol: "accessing",
  40864. fn: function (aScopeVariable){
  40865. var self=this,$self=this;
  40866. $self["@variable"]=aScopeVariable;
  40867. return self;
  40868. },
  40869. args: ["aScopeVariable"],
  40870. source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable",
  40871. referencedClasses: [],
  40872. messageSends: []
  40873. }),
  40874. $globals.IRVariable);
  40875. $core.addClass("IRVerbatim", $globals.IRInstruction, ["source"], "Compiler-IR");
  40876. $core.addMethod(
  40877. $core.method({
  40878. selector: "acceptDagVisitor:",
  40879. protocol: "visiting",
  40880. fn: function (aVisitor){
  40881. var self=this,$self=this;
  40882. return $core.withContext(function($ctx1) {
  40883. return $recv(aVisitor)._visitIRVerbatim_(self);
  40884. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRVerbatim)});
  40885. },
  40886. args: ["aVisitor"],
  40887. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self",
  40888. referencedClasses: [],
  40889. messageSends: ["visitIRVerbatim:"]
  40890. }),
  40891. $globals.IRVerbatim);
  40892. $core.addMethod(
  40893. $core.method({
  40894. selector: "source",
  40895. protocol: "accessing",
  40896. fn: function (){
  40897. var self=this,$self=this;
  40898. return $self["@source"];
  40899. },
  40900. args: [],
  40901. source: "source\x0a\x09^ source",
  40902. referencedClasses: [],
  40903. messageSends: []
  40904. }),
  40905. $globals.IRVerbatim);
  40906. $core.addMethod(
  40907. $core.method({
  40908. selector: "source:",
  40909. protocol: "accessing",
  40910. fn: function (aString){
  40911. var self=this,$self=this;
  40912. $self["@source"]=aString;
  40913. return self;
  40914. },
  40915. args: ["aString"],
  40916. source: "source: aString\x0a\x09source := aString",
  40917. referencedClasses: [],
  40918. messageSends: []
  40919. }),
  40920. $globals.IRVerbatim);
  40921. $core.addClass("IRVisitor", $globals.ParentFakingPathDagVisitor, [], "Compiler-IR");
  40922. $core.addMethod(
  40923. $core.method({
  40924. selector: "visitDagNode:",
  40925. protocol: "visiting",
  40926. fn: function (aNode){
  40927. var self=this,$self=this;
  40928. return $core.withContext(function($ctx1) {
  40929. return $self._visitDagNodeVariantSimple_(aNode);
  40930. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.IRVisitor)});
  40931. },
  40932. args: ["aNode"],
  40933. source: "visitDagNode: aNode\x0a\x09^ self visitDagNodeVariantSimple: aNode",
  40934. referencedClasses: [],
  40935. messageSends: ["visitDagNodeVariantSimple:"]
  40936. }),
  40937. $globals.IRVisitor);
  40938. $core.addMethod(
  40939. $core.method({
  40940. selector: "visitIRAssignment:",
  40941. protocol: "visiting",
  40942. fn: function (anIRAssignment){
  40943. var self=this,$self=this;
  40944. return $core.withContext(function($ctx1) {
  40945. return $self._visitDagNode_(anIRAssignment);
  40946. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRVisitor)});
  40947. },
  40948. args: ["anIRAssignment"],
  40949. source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitDagNode: anIRAssignment",
  40950. referencedClasses: [],
  40951. messageSends: ["visitDagNode:"]
  40952. }),
  40953. $globals.IRVisitor);
  40954. $core.addMethod(
  40955. $core.method({
  40956. selector: "visitIRBlockReturn:",
  40957. protocol: "visiting",
  40958. fn: function (anIRBlockReturn){
  40959. var self=this,$self=this;
  40960. return $core.withContext(function($ctx1) {
  40961. return $self._visitIRReturn_(anIRBlockReturn);
  40962. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockReturn:",{anIRBlockReturn:anIRBlockReturn},$globals.IRVisitor)});
  40963. },
  40964. args: ["anIRBlockReturn"],
  40965. source: "visitIRBlockReturn: anIRBlockReturn\x0a\x09^ self visitIRReturn: anIRBlockReturn",
  40966. referencedClasses: [],
  40967. messageSends: ["visitIRReturn:"]
  40968. }),
  40969. $globals.IRVisitor);
  40970. $core.addMethod(
  40971. $core.method({
  40972. selector: "visitIRBlockSequence:",
  40973. protocol: "visiting",
  40974. fn: function (anIRBlockSequence){
  40975. var self=this,$self=this;
  40976. return $core.withContext(function($ctx1) {
  40977. return $self._visitIRSequence_(anIRBlockSequence);
  40978. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockSequence:",{anIRBlockSequence:anIRBlockSequence},$globals.IRVisitor)});
  40979. },
  40980. args: ["anIRBlockSequence"],
  40981. source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence",
  40982. referencedClasses: [],
  40983. messageSends: ["visitIRSequence:"]
  40984. }),
  40985. $globals.IRVisitor);
  40986. $core.addMethod(
  40987. $core.method({
  40988. selector: "visitIRClosure:",
  40989. protocol: "visiting",
  40990. fn: function (anIRClosure){
  40991. var self=this,$self=this;
  40992. return $core.withContext(function($ctx1) {
  40993. return $self._visitDagNode_(anIRClosure);
  40994. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRVisitor)});
  40995. },
  40996. args: ["anIRClosure"],
  40997. source: "visitIRClosure: anIRClosure\x0a\x09^ self visitDagNode: anIRClosure",
  40998. referencedClasses: [],
  40999. messageSends: ["visitDagNode:"]
  41000. }),
  41001. $globals.IRVisitor);
  41002. $core.addMethod(
  41003. $core.method({
  41004. selector: "visitIRDynamicArray:",
  41005. protocol: "visiting",
  41006. fn: function (anIRDynamicArray){
  41007. var self=this,$self=this;
  41008. return $core.withContext(function($ctx1) {
  41009. return $self._visitDagNode_(anIRDynamicArray);
  41010. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRVisitor)});
  41011. },
  41012. args: ["anIRDynamicArray"],
  41013. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09^ self visitDagNode: anIRDynamicArray",
  41014. referencedClasses: [],
  41015. messageSends: ["visitDagNode:"]
  41016. }),
  41017. $globals.IRVisitor);
  41018. $core.addMethod(
  41019. $core.method({
  41020. selector: "visitIRDynamicDictionary:",
  41021. protocol: "visiting",
  41022. fn: function (anIRDynamicDictionary){
  41023. var self=this,$self=this;
  41024. return $core.withContext(function($ctx1) {
  41025. return $self._visitDagNode_(anIRDynamicDictionary);
  41026. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRVisitor)});
  41027. },
  41028. args: ["anIRDynamicDictionary"],
  41029. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09^ self visitDagNode: anIRDynamicDictionary",
  41030. referencedClasses: [],
  41031. messageSends: ["visitDagNode:"]
  41032. }),
  41033. $globals.IRVisitor);
  41034. $core.addMethod(
  41035. $core.method({
  41036. selector: "visitIRInlinedClosure:",
  41037. protocol: "visiting",
  41038. fn: function (anIRInlinedClosure){
  41039. var self=this,$self=this;
  41040. return $core.withContext(function($ctx1) {
  41041. return $self._visitIRClosure_(anIRInlinedClosure);
  41042. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRVisitor)});
  41043. },
  41044. args: ["anIRInlinedClosure"],
  41045. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09^ self visitIRClosure: anIRInlinedClosure",
  41046. referencedClasses: [],
  41047. messageSends: ["visitIRClosure:"]
  41048. }),
  41049. $globals.IRVisitor);
  41050. $core.addMethod(
  41051. $core.method({
  41052. selector: "visitIRInlinedSequence:",
  41053. protocol: "visiting",
  41054. fn: function (anIRInlinedSequence){
  41055. var self=this,$self=this;
  41056. return $core.withContext(function($ctx1) {
  41057. return $self._visitIRSequence_(anIRInlinedSequence);
  41058. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},$globals.IRVisitor)});
  41059. },
  41060. args: ["anIRInlinedSequence"],
  41061. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09^ self visitIRSequence: anIRInlinedSequence",
  41062. referencedClasses: [],
  41063. messageSends: ["visitIRSequence:"]
  41064. }),
  41065. $globals.IRVisitor);
  41066. $core.addMethod(
  41067. $core.method({
  41068. selector: "visitIRMethod:",
  41069. protocol: "visiting",
  41070. fn: function (anIRMethod){
  41071. var self=this,$self=this;
  41072. return $core.withContext(function($ctx1) {
  41073. return $self._visitDagNode_(anIRMethod);
  41074. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRVisitor)});
  41075. },
  41076. args: ["anIRMethod"],
  41077. source: "visitIRMethod: anIRMethod\x0a\x09^ self visitDagNode: anIRMethod",
  41078. referencedClasses: [],
  41079. messageSends: ["visitDagNode:"]
  41080. }),
  41081. $globals.IRVisitor);
  41082. $core.addMethod(
  41083. $core.method({
  41084. selector: "visitIRNonLocalReturn:",
  41085. protocol: "visiting",
  41086. fn: function (anIRNonLocalReturn){
  41087. var self=this,$self=this;
  41088. return $core.withContext(function($ctx1) {
  41089. return $self._visitDagNode_(anIRNonLocalReturn);
  41090. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRVisitor)});
  41091. },
  41092. args: ["anIRNonLocalReturn"],
  41093. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitDagNode: anIRNonLocalReturn",
  41094. referencedClasses: [],
  41095. messageSends: ["visitDagNode:"]
  41096. }),
  41097. $globals.IRVisitor);
  41098. $core.addMethod(
  41099. $core.method({
  41100. selector: "visitIRNonLocalReturnHandling:",
  41101. protocol: "visiting",
  41102. fn: function (anIRNonLocalReturnHandling){
  41103. var self=this,$self=this;
  41104. return $core.withContext(function($ctx1) {
  41105. return $self._visitDagNode_(anIRNonLocalReturnHandling);
  41106. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturnHandling:",{anIRNonLocalReturnHandling:anIRNonLocalReturnHandling},$globals.IRVisitor)});
  41107. },
  41108. args: ["anIRNonLocalReturnHandling"],
  41109. source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitDagNode: anIRNonLocalReturnHandling",
  41110. referencedClasses: [],
  41111. messageSends: ["visitDagNode:"]
  41112. }),
  41113. $globals.IRVisitor);
  41114. $core.addMethod(
  41115. $core.method({
  41116. selector: "visitIRReturn:",
  41117. protocol: "visiting",
  41118. fn: function (anIRReturn){
  41119. var self=this,$self=this;
  41120. return $core.withContext(function($ctx1) {
  41121. return $self._visitDagNode_(anIRReturn);
  41122. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRVisitor)});
  41123. },
  41124. args: ["anIRReturn"],
  41125. source: "visitIRReturn: anIRReturn\x0a\x09^ self visitDagNode: anIRReturn",
  41126. referencedClasses: [],
  41127. messageSends: ["visitDagNode:"]
  41128. }),
  41129. $globals.IRVisitor);
  41130. $core.addMethod(
  41131. $core.method({
  41132. selector: "visitIRSend:",
  41133. protocol: "visiting",
  41134. fn: function (anIRSend){
  41135. var self=this,$self=this;
  41136. return $core.withContext(function($ctx1) {
  41137. return $self._visitDagNode_(anIRSend);
  41138. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRVisitor)});
  41139. },
  41140. args: ["anIRSend"],
  41141. source: "visitIRSend: anIRSend\x0a\x09^ self visitDagNode: anIRSend",
  41142. referencedClasses: [],
  41143. messageSends: ["visitDagNode:"]
  41144. }),
  41145. $globals.IRVisitor);
  41146. $core.addMethod(
  41147. $core.method({
  41148. selector: "visitIRSequence:",
  41149. protocol: "visiting",
  41150. fn: function (anIRSequence){
  41151. var self=this,$self=this;
  41152. return $core.withContext(function($ctx1) {
  41153. return $self._visitDagNode_(anIRSequence);
  41154. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRVisitor)});
  41155. },
  41156. args: ["anIRSequence"],
  41157. source: "visitIRSequence: anIRSequence\x0a\x09^ self visitDagNode: anIRSequence",
  41158. referencedClasses: [],
  41159. messageSends: ["visitDagNode:"]
  41160. }),
  41161. $globals.IRVisitor);
  41162. $core.addMethod(
  41163. $core.method({
  41164. selector: "visitIRTempDeclaration:",
  41165. protocol: "visiting",
  41166. fn: function (anIRTempDeclaration){
  41167. var self=this,$self=this;
  41168. return $core.withContext(function($ctx1) {
  41169. return $self._visitDagNode_(anIRTempDeclaration);
  41170. }, function($ctx1) {$ctx1.fill(self,"visitIRTempDeclaration:",{anIRTempDeclaration:anIRTempDeclaration},$globals.IRVisitor)});
  41171. },
  41172. args: ["anIRTempDeclaration"],
  41173. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitDagNode: anIRTempDeclaration",
  41174. referencedClasses: [],
  41175. messageSends: ["visitDagNode:"]
  41176. }),
  41177. $globals.IRVisitor);
  41178. $core.addMethod(
  41179. $core.method({
  41180. selector: "visitIRValue:",
  41181. protocol: "visiting",
  41182. fn: function (anIRValue){
  41183. var self=this,$self=this;
  41184. return $core.withContext(function($ctx1) {
  41185. return $self._visitDagNode_(anIRValue);
  41186. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRVisitor)});
  41187. },
  41188. args: ["anIRValue"],
  41189. source: "visitIRValue: anIRValue\x0a\x09^ self visitDagNode: anIRValue",
  41190. referencedClasses: [],
  41191. messageSends: ["visitDagNode:"]
  41192. }),
  41193. $globals.IRVisitor);
  41194. $core.addMethod(
  41195. $core.method({
  41196. selector: "visitIRVariable:",
  41197. protocol: "visiting",
  41198. fn: function (anIRVariable){
  41199. var self=this,$self=this;
  41200. return $core.withContext(function($ctx1) {
  41201. return $self._visitDagNode_(anIRVariable);
  41202. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRVisitor)});
  41203. },
  41204. args: ["anIRVariable"],
  41205. source: "visitIRVariable: anIRVariable\x0a\x09^ self visitDagNode: anIRVariable",
  41206. referencedClasses: [],
  41207. messageSends: ["visitDagNode:"]
  41208. }),
  41209. $globals.IRVisitor);
  41210. $core.addMethod(
  41211. $core.method({
  41212. selector: "visitIRVerbatim:",
  41213. protocol: "visiting",
  41214. fn: function (anIRVerbatim){
  41215. var self=this,$self=this;
  41216. return $core.withContext(function($ctx1) {
  41217. return $self._visitDagNode_(anIRVerbatim);
  41218. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRVisitor)});
  41219. },
  41220. args: ["anIRVerbatim"],
  41221. source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitDagNode: anIRVerbatim",
  41222. referencedClasses: [],
  41223. messageSends: ["visitDagNode:"]
  41224. }),
  41225. $globals.IRVisitor);
  41226. $core.addClass("IRJSTranslator", $globals.IRVisitor, ["stream", "currentClass"], "Compiler-IR");
  41227. $core.addMethod(
  41228. $core.method({
  41229. selector: "contents",
  41230. protocol: "accessing",
  41231. fn: function (){
  41232. var self=this,$self=this;
  41233. return $core.withContext(function($ctx1) {
  41234. return $recv($self._stream())._contents();
  41235. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.IRJSTranslator)});
  41236. },
  41237. args: [],
  41238. source: "contents\x0a\x09^ self stream contents",
  41239. referencedClasses: [],
  41240. messageSends: ["contents", "stream"]
  41241. }),
  41242. $globals.IRJSTranslator);
  41243. $core.addMethod(
  41244. $core.method({
  41245. selector: "currentClass",
  41246. protocol: "accessing",
  41247. fn: function (){
  41248. var self=this,$self=this;
  41249. return $self["@currentClass"];
  41250. },
  41251. args: [],
  41252. source: "currentClass\x0a\x09^ currentClass",
  41253. referencedClasses: [],
  41254. messageSends: []
  41255. }),
  41256. $globals.IRJSTranslator);
  41257. $core.addMethod(
  41258. $core.method({
  41259. selector: "currentClass:",
  41260. protocol: "accessing",
  41261. fn: function (aClass){
  41262. var self=this,$self=this;
  41263. $self["@currentClass"]=aClass;
  41264. return self;
  41265. },
  41266. args: ["aClass"],
  41267. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  41268. referencedClasses: [],
  41269. messageSends: []
  41270. }),
  41271. $globals.IRJSTranslator);
  41272. $core.addMethod(
  41273. $core.method({
  41274. selector: "initialize",
  41275. protocol: "initialization",
  41276. fn: function (){
  41277. var self=this,$self=this;
  41278. return $core.withContext(function($ctx1) {
  41279. (
  41280. $ctx1.supercall = true,
  41281. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  41282. $ctx1.supercall = false;
  41283. $self["@stream"]=$recv($globals.JSStream)._new();
  41284. return self;
  41285. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.IRJSTranslator)});
  41286. },
  41287. args: [],
  41288. source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.",
  41289. referencedClasses: ["JSStream"],
  41290. messageSends: ["initialize", "new"]
  41291. }),
  41292. $globals.IRJSTranslator);
  41293. $core.addMethod(
  41294. $core.method({
  41295. selector: "stream",
  41296. protocol: "accessing",
  41297. fn: function (){
  41298. var self=this,$self=this;
  41299. return $self["@stream"];
  41300. },
  41301. args: [],
  41302. source: "stream\x0a\x09^ stream",
  41303. referencedClasses: [],
  41304. messageSends: []
  41305. }),
  41306. $globals.IRJSTranslator);
  41307. $core.addMethod(
  41308. $core.method({
  41309. selector: "stream:",
  41310. protocol: "accessing",
  41311. fn: function (aStream){
  41312. var self=this,$self=this;
  41313. $self["@stream"]=aStream;
  41314. return self;
  41315. },
  41316. args: ["aStream"],
  41317. source: "stream: aStream\x0a\x09stream := aStream",
  41318. referencedClasses: [],
  41319. messageSends: []
  41320. }),
  41321. $globals.IRJSTranslator);
  41322. $core.addMethod(
  41323. $core.method({
  41324. selector: "visitIRAssignment:",
  41325. protocol: "visiting",
  41326. fn: function (anIRAssignment){
  41327. var self=this,$self=this;
  41328. return $core.withContext(function($ctx1) {
  41329. $recv($self._stream())._nextPutAssignLhs_rhs_((function(){
  41330. return $core.withContext(function($ctx2) {
  41331. return $self._visit_($recv(anIRAssignment)._left());
  41332. $ctx2.sendIdx["visit:"]=1;
  41333. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41334. }),(function(){
  41335. return $core.withContext(function($ctx2) {
  41336. return $self._visit_($recv(anIRAssignment)._right());
  41337. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41338. }));
  41339. return self;
  41340. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRJSTranslator)});
  41341. },
  41342. args: ["anIRAssignment"],
  41343. source: "visitIRAssignment: anIRAssignment\x0a\x09self stream\x0a\x09\x09nextPutAssignLhs: [self visit: anIRAssignment left]\x0a\x09\x09rhs: [self visit: anIRAssignment right].",
  41344. referencedClasses: [],
  41345. messageSends: ["nextPutAssignLhs:rhs:", "stream", "visit:", "left", "right"]
  41346. }),
  41347. $globals.IRJSTranslator);
  41348. $core.addMethod(
  41349. $core.method({
  41350. selector: "visitIRClosure:",
  41351. protocol: "visiting",
  41352. fn: function (anIRClosure){
  41353. var self=this,$self=this;
  41354. return $core.withContext(function($ctx1) {
  41355. var $1,$2;
  41356. $1=$self._stream();
  41357. $ctx1.sendIdx["stream"]=1;
  41358. $recv($1)._nextPutClosureWith_arguments_((function(){
  41359. return $core.withContext(function($ctx2) {
  41360. $2=$self._stream();
  41361. $ctx2.sendIdx["stream"]=2;
  41362. $recv($2)._nextPutVars_($recv($recv(anIRClosure)._tempDeclarations())._collect_((function(each){
  41363. return $core.withContext(function($ctx3) {
  41364. return $recv($recv(each)._name())._asVariableName();
  41365. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  41366. })));
  41367. return $recv($self._stream())._nextPutBlockContextFor_during_(anIRClosure,(function(){
  41368. return $core.withContext(function($ctx3) {
  41369. return (
  41370. $ctx3.supercall = true,
  41371. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRClosure_.apply($self, [anIRClosure]));
  41372. $ctx3.supercall = false;
  41373. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  41374. }));
  41375. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41376. }),$recv(anIRClosure)._arguments());
  41377. return self;
  41378. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRJSTranslator)});
  41379. },
  41380. args: ["anIRClosure"],
  41381. 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",
  41382. referencedClasses: [],
  41383. messageSends: ["nextPutClosureWith:arguments:", "stream", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutBlockContextFor:during:", "visitIRClosure:", "arguments"]
  41384. }),
  41385. $globals.IRJSTranslator);
  41386. $core.addMethod(
  41387. $core.method({
  41388. selector: "visitIRDynamicArray:",
  41389. protocol: "visiting",
  41390. fn: function (anIRDynamicArray){
  41391. var self=this,$self=this;
  41392. return $core.withContext(function($ctx1) {
  41393. $self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicArray)._dagChildren(),"[","]");
  41394. return self;
  41395. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRJSTranslator)});
  41396. },
  41397. args: ["anIRDynamicArray"],
  41398. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicArray dagChildren\x0a\x09\x09enclosedBetween: '[' and: ']'",
  41399. referencedClasses: [],
  41400. messageSends: ["visitInstructionList:enclosedBetween:and:", "dagChildren"]
  41401. }),
  41402. $globals.IRJSTranslator);
  41403. $core.addMethod(
  41404. $core.method({
  41405. selector: "visitIRDynamicDictionary:",
  41406. protocol: "visiting",
  41407. fn: function (anIRDynamicDictionary){
  41408. var self=this,$self=this;
  41409. return $core.withContext(function($ctx1) {
  41410. $self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicDictionary)._dagChildren(),"$globals.HashedCollection._newFromPairs_([","])");
  41411. return self;
  41412. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRJSTranslator)});
  41413. },
  41414. args: ["anIRDynamicDictionary"],
  41415. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicDictionary dagChildren\x0a\x09\x09enclosedBetween: '$globals.HashedCollection._newFromPairs_([' and: '])'",
  41416. referencedClasses: [],
  41417. messageSends: ["visitInstructionList:enclosedBetween:and:", "dagChildren"]
  41418. }),
  41419. $globals.IRJSTranslator);
  41420. $core.addMethod(
  41421. $core.method({
  41422. selector: "visitIRMethod:",
  41423. protocol: "visiting",
  41424. fn: function (anIRMethod){
  41425. var self=this,$self=this;
  41426. return $core.withContext(function($ctx1) {
  41427. var $1,$2,$3,$4,$5,$6,$7;
  41428. $1=$self._stream();
  41429. $ctx1.sendIdx["stream"]=1;
  41430. $recv($1)._nextPutMethodDeclaration_with_(anIRMethod,(function(){
  41431. return $core.withContext(function($ctx2) {
  41432. $2=$self._stream();
  41433. $ctx2.sendIdx["stream"]=2;
  41434. return $recv($2)._nextPutFunctionWith_arguments_((function(){
  41435. return $core.withContext(function($ctx3) {
  41436. $3=$self._stream();
  41437. $ctx3.sendIdx["stream"]=3;
  41438. $4=$recv($recv(anIRMethod)._tempDeclarations())._collect_((function(each){
  41439. return $core.withContext(function($ctx4) {
  41440. return $recv($recv(each)._name())._asVariableName();
  41441. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  41442. }));
  41443. $ctx3.sendIdx["collect:"]=1;
  41444. $recv($3)._nextPutVars_($4);
  41445. $ctx3.sendIdx["nextPutVars:"]=1;
  41446. $5=$self._stream();
  41447. $ctx3.sendIdx["stream"]=4;
  41448. return $recv($5)._nextPutContextFor_during_(anIRMethod,(function(){
  41449. return $core.withContext(function($ctx4) {
  41450. $recv($recv(anIRMethod)._internalVariables())._ifNotEmpty_((function(internalVars){
  41451. return $core.withContext(function($ctx5) {
  41452. $6=$self._stream();
  41453. $ctx5.sendIdx["stream"]=5;
  41454. return $recv($6)._nextPutVars_($recv($recv(internalVars)._asSet())._collect_((function(each){
  41455. return $core.withContext(function($ctx6) {
  41456. return $recv($recv(each)._variable())._alias();
  41457. }, function($ctx6) {$ctx6.fillBlock({each:each},$ctx5,6)});
  41458. })));
  41459. }, function($ctx5) {$ctx5.fillBlock({internalVars:internalVars},$ctx4,5)});
  41460. }));
  41461. $7=$recv($recv(anIRMethod)._scope())._hasNonLocalReturn();
  41462. if($core.assert($7)){
  41463. return $recv($self._stream())._nextPutNonLocalReturnHandlingWith_((function(){
  41464. return $core.withContext(function($ctx5) {
  41465. return (
  41466. $ctx5.supercall = true,
  41467. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRMethod_.apply($self, [anIRMethod]));
  41468. $ctx5.supercall = false;
  41469. $ctx5.sendIdx["visitIRMethod:"]=1;
  41470. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,8)});
  41471. }));
  41472. } else {
  41473. return (
  41474. $ctx4.supercall = true,
  41475. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRMethod_.apply($self, [anIRMethod]));
  41476. $ctx4.supercall = false;
  41477. }
  41478. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  41479. }));
  41480. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  41481. }),$recv(anIRMethod)._arguments());
  41482. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41483. }));
  41484. return $self._contents();
  41485. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRJSTranslator)});
  41486. },
  41487. args: ["anIRMethod"],
  41488. source: "visitIRMethod: anIRMethod\x0a\x0a\x09self stream\x0a\x09\x09nextPutMethodDeclaration: anIRMethod\x0a\x09\x09with: [ self stream\x0a\x09\x09\x09nextPutFunctionWith: [\x0a\x09\x09\x09\x09self stream nextPutVars: (anIRMethod tempDeclarations collect: [ :each |\x0a\x09\x09\x09\x09\x09each name asVariableName ]).\x0a\x09\x09\x09\x09self stream nextPutContextFor: anIRMethod during: [\x0a\x09\x09\x09\x09\x09anIRMethod internalVariables ifNotEmpty: [ :internalVars |\x0a\x09\x09\x09\x09\x09\x09self stream nextPutVars: \x0a\x09\x09\x09\x09\x09\x09\x09(internalVars asSet collect: [ :each | each variable alias ]) ].\x0a\x09\x09\x09\x09anIRMethod scope hasNonLocalReturn\x0a\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09self stream nextPutNonLocalReturnHandlingWith: [\x0a\x09\x09\x09\x09\x09\x09\x09super visitIRMethod: anIRMethod ] ]\x0a\x09\x09\x09\x09\x09ifFalse: [ super visitIRMethod: anIRMethod ] ]]\x0a\x09\x09\x09arguments: anIRMethod arguments ].\x0a\x09^ self contents",
  41489. referencedClasses: [],
  41490. messageSends: ["nextPutMethodDeclaration:with:", "stream", "nextPutFunctionWith:arguments:", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutContextFor:during:", "ifNotEmpty:", "internalVariables", "asSet", "alias", "variable", "ifTrue:ifFalse:", "hasNonLocalReturn", "scope", "nextPutNonLocalReturnHandlingWith:", "visitIRMethod:", "arguments", "contents"]
  41491. }),
  41492. $globals.IRJSTranslator);
  41493. $core.addMethod(
  41494. $core.method({
  41495. selector: "visitIRNonLocalReturn:",
  41496. protocol: "visiting",
  41497. fn: function (anIRNonLocalReturn){
  41498. var self=this,$self=this;
  41499. return $core.withContext(function($ctx1) {
  41500. $recv($self._stream())._nextPutNonLocalReturnWith_((function(){
  41501. return $core.withContext(function($ctx2) {
  41502. return (
  41503. $ctx2.supercall = true,
  41504. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRNonLocalReturn_.apply($self, [anIRNonLocalReturn]));
  41505. $ctx2.supercall = false;
  41506. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41507. }));
  41508. return self;
  41509. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRJSTranslator)});
  41510. },
  41511. args: ["anIRNonLocalReturn"],
  41512. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]",
  41513. referencedClasses: [],
  41514. messageSends: ["nextPutNonLocalReturnWith:", "stream", "visitIRNonLocalReturn:"]
  41515. }),
  41516. $globals.IRJSTranslator);
  41517. $core.addMethod(
  41518. $core.method({
  41519. selector: "visitIRReturn:",
  41520. protocol: "visiting",
  41521. fn: function (anIRReturn){
  41522. var self=this,$self=this;
  41523. return $core.withContext(function($ctx1) {
  41524. $recv($self._stream())._nextPutReturnWith_((function(){
  41525. return $core.withContext(function($ctx2) {
  41526. return (
  41527. $ctx2.supercall = true,
  41528. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRReturn_.apply($self, [anIRReturn]));
  41529. $ctx2.supercall = false;
  41530. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41531. }));
  41532. return self;
  41533. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRJSTranslator)});
  41534. },
  41535. args: ["anIRReturn"],
  41536. source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]",
  41537. referencedClasses: [],
  41538. messageSends: ["nextPutReturnWith:", "stream", "visitIRReturn:"]
  41539. }),
  41540. $globals.IRJSTranslator);
  41541. $core.addMethod(
  41542. $core.method({
  41543. selector: "visitIRSend:",
  41544. protocol: "visiting",
  41545. fn: function (anIRSend){
  41546. var self=this,$self=this;
  41547. var sends,superclass;
  41548. return $core.withContext(function($ctx1) {
  41549. var $1,$2;
  41550. sends=$recv($recv($recv($recv(anIRSend)._method())._sendIndexes())._at_($recv(anIRSend)._selector()))._size();
  41551. $1=$recv($recv(anIRSend)._receiver())._isSuper();
  41552. if($core.assert($1)){
  41553. $self._visitSuperSend_(anIRSend);
  41554. } else {
  41555. $self._visitSend_(anIRSend);
  41556. }
  41557. $2=$recv($recv(anIRSend)._index()).__lt(sends);
  41558. if($core.assert($2)){
  41559. $recv($self._stream())._nextPutSendIndexFor_(anIRSend);
  41560. }
  41561. return self;
  41562. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend,sends:sends,superclass:superclass},$globals.IRJSTranslator)});
  41563. },
  41564. args: ["anIRSend"],
  41565. 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 ]",
  41566. referencedClasses: [],
  41567. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "ifTrue:ifFalse:", "isSuper", "receiver", "visitSuperSend:", "visitSend:", "ifTrue:", "<", "index", "nextPutSendIndexFor:", "stream"]
  41568. }),
  41569. $globals.IRJSTranslator);
  41570. $core.addMethod(
  41571. $core.method({
  41572. selector: "visitIRSequence:",
  41573. protocol: "visiting",
  41574. fn: function (anIRSequence){
  41575. var self=this,$self=this;
  41576. return $core.withContext(function($ctx1) {
  41577. $recv($recv(anIRSequence)._dagChildren())._do_((function(each){
  41578. return $core.withContext(function($ctx2) {
  41579. return $recv($self._stream())._nextPutStatementWith_((function(){
  41580. return $core.withContext(function($ctx3) {
  41581. return $self._visit_(each);
  41582. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  41583. }));
  41584. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41585. }));
  41586. return self;
  41587. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRJSTranslator)});
  41588. },
  41589. args: ["anIRSequence"],
  41590. source: "visitIRSequence: anIRSequence\x0a\x09anIRSequence dagChildren do: [ :each |\x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ] ]",
  41591. referencedClasses: [],
  41592. messageSends: ["do:", "dagChildren", "nextPutStatementWith:", "stream", "visit:"]
  41593. }),
  41594. $globals.IRJSTranslator);
  41595. $core.addMethod(
  41596. $core.method({
  41597. selector: "visitIRTempDeclaration:",
  41598. protocol: "visiting",
  41599. fn: function (anIRTempDeclaration){
  41600. var self=this,$self=this;
  41601. return self;
  41602. },
  41603. args: ["anIRTempDeclaration"],
  41604. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09\x22self stream\x0a\x09\x09nextPutAll: 'var ', anIRTempDeclaration name asVariableName, ';';\x0a\x09\x09lf\x22",
  41605. referencedClasses: [],
  41606. messageSends: []
  41607. }),
  41608. $globals.IRJSTranslator);
  41609. $core.addMethod(
  41610. $core.method({
  41611. selector: "visitIRValue:",
  41612. protocol: "visiting",
  41613. fn: function (anIRValue){
  41614. var self=this,$self=this;
  41615. return $core.withContext(function($ctx1) {
  41616. $recv($self._stream())._nextPutAll_($recv($recv(anIRValue)._value())._asJavaScriptSource());
  41617. return self;
  41618. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRJSTranslator)});
  41619. },
  41620. args: ["anIRValue"],
  41621. source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavaScriptSource",
  41622. referencedClasses: [],
  41623. messageSends: ["nextPutAll:", "stream", "asJavaScriptSource", "value"]
  41624. }),
  41625. $globals.IRJSTranslator);
  41626. $core.addMethod(
  41627. $core.method({
  41628. selector: "visitIRVariable:",
  41629. protocol: "visiting",
  41630. fn: function (anIRVariable){
  41631. var self=this,$self=this;
  41632. return $core.withContext(function($ctx1) {
  41633. var $3,$2,$1,$4;
  41634. $3=$recv(anIRVariable)._variable();
  41635. $ctx1.sendIdx["variable"]=1;
  41636. $2=$recv($3)._name();
  41637. $1=$recv($2).__eq("thisContext");
  41638. if($core.assert($1)){
  41639. $4=$self._stream();
  41640. $ctx1.sendIdx["stream"]=1;
  41641. $recv($4)._nextPutAll_("$core.getThisContext()");
  41642. $ctx1.sendIdx["nextPutAll:"]=1;
  41643. } else {
  41644. $recv($self._stream())._nextPutAll_($recv($recv(anIRVariable)._variable())._alias());
  41645. }
  41646. return self;
  41647. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRJSTranslator)});
  41648. },
  41649. args: ["anIRVariable"],
  41650. 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 ]",
  41651. referencedClasses: [],
  41652. messageSends: ["ifTrue:ifFalse:", "=", "name", "variable", "nextPutAll:", "stream", "alias"]
  41653. }),
  41654. $globals.IRJSTranslator);
  41655. $core.addMethod(
  41656. $core.method({
  41657. selector: "visitIRVerbatim:",
  41658. protocol: "visiting",
  41659. fn: function (anIRVerbatim){
  41660. var self=this,$self=this;
  41661. return $core.withContext(function($ctx1) {
  41662. $recv($self._stream())._nextPutAll_($recv(anIRVerbatim)._source());
  41663. return self;
  41664. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRJSTranslator)});
  41665. },
  41666. args: ["anIRVerbatim"],
  41667. source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutAll: anIRVerbatim source",
  41668. referencedClasses: [],
  41669. messageSends: ["nextPutAll:", "stream", "source"]
  41670. }),
  41671. $globals.IRJSTranslator);
  41672. $core.addMethod(
  41673. $core.method({
  41674. selector: "visitInstructionList:enclosedBetween:and:",
  41675. protocol: "visiting",
  41676. fn: function (anArray,aString,anotherString){
  41677. var self=this,$self=this;
  41678. return $core.withContext(function($ctx1) {
  41679. var $1;
  41680. $1=$self._stream();
  41681. $ctx1.sendIdx["stream"]=1;
  41682. $recv($1)._nextPutAll_(aString);
  41683. $ctx1.sendIdx["nextPutAll:"]=1;
  41684. $recv(anArray)._do_separatedBy_((function(each){
  41685. return $core.withContext(function($ctx2) {
  41686. return $self._visit_(each);
  41687. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41688. }),(function(){
  41689. return $core.withContext(function($ctx2) {
  41690. return $recv($self._stream())._nextPutAll_(",");
  41691. $ctx2.sendIdx["nextPutAll:"]=2;
  41692. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41693. }));
  41694. $recv($self["@stream"])._nextPutAll_(anotherString);
  41695. return self;
  41696. }, function($ctx1) {$ctx1.fill(self,"visitInstructionList:enclosedBetween:and:",{anArray:anArray,aString:aString,anotherString:anotherString},$globals.IRJSTranslator)});
  41697. },
  41698. args: ["anArray", "aString", "anotherString"],
  41699. 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",
  41700. referencedClasses: [],
  41701. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "visit:"]
  41702. }),
  41703. $globals.IRJSTranslator);
  41704. $core.addMethod(
  41705. $core.method({
  41706. selector: "visitReceiver:",
  41707. protocol: "visiting",
  41708. fn: function (anIRInstruction){
  41709. var self=this,$self=this;
  41710. var instr;
  41711. return $core.withContext(function($ctx1) {
  41712. var $1,$2,$4,$5,$3,$6,$7,$8;
  41713. $1=$recv(anIRInstruction)._isSelf();
  41714. if($core.assert($1)){
  41715. $2=$recv(anIRInstruction)._copy();
  41716. $ctx1.sendIdx["copy"]=1;
  41717. $4=$recv($recv(anIRInstruction)._variable())._copy();
  41718. $recv($4)._name_("$self");
  41719. $5=$recv($4)._yourself();
  41720. $ctx1.sendIdx["yourself"]=1;
  41721. $3=$5;
  41722. $recv($2)._variable_($3);
  41723. instr=$recv($2)._yourself();
  41724. instr;
  41725. } else {
  41726. instr=anIRInstruction;
  41727. instr;
  41728. }
  41729. $6=$recv(instr)._needsBoxingAsReceiver();
  41730. if(!$core.assert($6)){
  41731. $7=$self._visit_(instr);
  41732. $ctx1.sendIdx["visit:"]=1;
  41733. return $7;
  41734. }
  41735. $8=$self._stream();
  41736. $ctx1.sendIdx["stream"]=1;
  41737. $recv($8)._nextPutAll_("$recv(");
  41738. $ctx1.sendIdx["nextPutAll:"]=1;
  41739. $self._visit_(instr);
  41740. $recv($self._stream())._nextPutAll_(")");
  41741. return self;
  41742. }, function($ctx1) {$ctx1.fill(self,"visitReceiver:",{anIRInstruction:anIRInstruction,instr:instr},$globals.IRJSTranslator)});
  41743. },
  41744. args: ["anIRInstruction"],
  41745. 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: ')'",
  41746. referencedClasses: [],
  41747. messageSends: ["ifTrue:ifFalse:", "isSelf", "variable:", "copy", "name:", "variable", "yourself", "ifFalse:", "needsBoxingAsReceiver", "visit:", "nextPutAll:", "stream"]
  41748. }),
  41749. $globals.IRJSTranslator);
  41750. $core.addMethod(
  41751. $core.method({
  41752. selector: "visitSend:",
  41753. protocol: "visiting",
  41754. fn: function (anIRSend){
  41755. var self=this,$self=this;
  41756. return $core.withContext(function($ctx1) {
  41757. $self._visitReceiver_($recv(anIRSend)._receiver());
  41758. $recv($self._stream())._nextPutAll_(".".__comma($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()));
  41759. $self._visitInstructionList_enclosedBetween_and_($recv(anIRSend)._arguments(),"(",")");
  41760. return self;
  41761. }, function($ctx1) {$ctx1.fill(self,"visitSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  41762. },
  41763. args: ["anIRSend"],
  41764. source: "visitSend: anIRSend\x0a\x09self visitReceiver: anIRSend receiver.\x0a\x09self stream nextPutAll: '.', anIRSend selector asJavaScriptMethodName.\x0a\x09self\x0a\x09\x09visitInstructionList: anIRSend arguments\x0a\x09\x09enclosedBetween: '(' and: ')'",
  41765. referencedClasses: [],
  41766. messageSends: ["visitReceiver:", "receiver", "nextPutAll:", "stream", ",", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "arguments"]
  41767. }),
  41768. $globals.IRJSTranslator);
  41769. $core.addMethod(
  41770. $core.method({
  41771. selector: "visitSuperSend:",
  41772. protocol: "visiting",
  41773. fn: function (anIRSend){
  41774. var self=this,$self=this;
  41775. return $core.withContext(function($ctx1) {
  41776. var $1,$4,$3,$2,$5,$6,$7,$8;
  41777. $1=$self._stream();
  41778. $ctx1.sendIdx["stream"]=1;
  41779. $recv($1)._nextPutAll_("(");
  41780. $ctx1.sendIdx["nextPutAll:"]=1;
  41781. $recv($1)._lf();
  41782. $ctx1.sendIdx["lf"]=1;
  41783. $recv($1)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41784. $ctx1.sendIdx["nextPutAll:"]=2;
  41785. $recv($1)._lf();
  41786. $ctx1.sendIdx["lf"]=2;
  41787. $4=$recv(anIRSend)._scope();
  41788. $ctx1.sendIdx["scope"]=1;
  41789. $3=$recv($4)._alias();
  41790. $ctx1.sendIdx["alias"]=1;
  41791. $2=$recv($3).__comma(".supercall = true,");
  41792. $ctx1.sendIdx[","]=1;
  41793. $recv($1)._nextPutAll_($2);
  41794. $ctx1.sendIdx["nextPutAll:"]=3;
  41795. $recv($1)._lf();
  41796. $ctx1.sendIdx["lf"]=3;
  41797. $recv($1)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  41798. $ctx1.sendIdx["nextPutAll:"]=4;
  41799. $recv($1)._lf();
  41800. $ctx1.sendIdx["lf"]=4;
  41801. $5="(".__comma($recv($self._currentClass())._asJavaScriptSource());
  41802. $ctx1.sendIdx[","]=2;
  41803. $recv($1)._nextPutAll_($5);
  41804. $ctx1.sendIdx["nextPutAll:"]=5;
  41805. $recv($1)._nextPutAll_(".superclass||$boot.nilAsClass).fn.prototype.");
  41806. $ctx1.sendIdx["nextPutAll:"]=6;
  41807. $6=$recv($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()).__comma(".apply(");
  41808. $ctx1.sendIdx[","]=3;
  41809. $recv($1)._nextPutAll_($6);
  41810. $ctx1.sendIdx["nextPutAll:"]=7;
  41811. $7=$recv($1)._nextPutAll_("$self, ");
  41812. $ctx1.sendIdx["nextPutAll:"]=8;
  41813. $self._visitInstructionList_enclosedBetween_and_($recv(anIRSend)._arguments(),"[","]");
  41814. $8=$self._stream();
  41815. $recv($8)._nextPutAll_("));");
  41816. $ctx1.sendIdx["nextPutAll:"]=9;
  41817. $recv($8)._lf();
  41818. $ctx1.sendIdx["lf"]=5;
  41819. $recv($8)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41820. $ctx1.sendIdx["nextPutAll:"]=10;
  41821. $recv($8)._lf();
  41822. $ctx1.sendIdx["lf"]=6;
  41823. $recv($8)._nextPutAll_($recv($recv($recv(anIRSend)._scope())._alias()).__comma(".supercall = false;"));
  41824. $ctx1.sendIdx["nextPutAll:"]=11;
  41825. $recv($8)._lf();
  41826. $recv($8)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  41827. return self;
  41828. }, function($ctx1) {$ctx1.fill(self,"visitSuperSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  41829. },
  41830. args: ["anIRSend"],
  41831. source: "visitSuperSend: anIRSend\x0a\x09self stream\x0a\x09\x09nextPutAll: '('; lf;\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);'; lf;\x0a\x09\x09nextPutAll: anIRSend scope alias, '.supercall = true,'; lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'; lf;\x0a\x09\x09nextPutAll: '(', self currentClass asJavaScriptSource;\x0a\x09\x09nextPutAll: '.superclass||$boot.nilAsClass).fn.prototype.';\x0a\x09\x09nextPutAll: anIRSend selector asJavaScriptMethodName, '.apply(';\x0a\x09\x09nextPutAll: '$self, '.\x0a\x09self\x0a\x09\x09visitInstructionList: anIRSend arguments\x0a\x09\x09enclosedBetween: '[' and: ']'.\x0a\x09self stream \x0a\x09\x09nextPutAll: '));'; lf;\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);'; lf;\x0a\x09\x09nextPutAll: anIRSend scope alias, '.supercall = false;'; lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'",
  41832. referencedClasses: [],
  41833. messageSends: ["nextPutAll:", "stream", "lf", ",", "alias", "scope", "asJavaScriptSource", "currentClass", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "arguments"]
  41834. }),
  41835. $globals.IRJSTranslator);
  41836. $core.addClass("JSStream", $globals.Object, ["stream", "omitSemicolon"], "Compiler-IR");
  41837. $core.addMethod(
  41838. $core.method({
  41839. selector: "contents",
  41840. protocol: "accessing",
  41841. fn: function (){
  41842. var self=this,$self=this;
  41843. return $core.withContext(function($ctx1) {
  41844. return $recv($self["@stream"])._contents();
  41845. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.JSStream)});
  41846. },
  41847. args: [],
  41848. source: "contents\x0a\x09^ stream contents",
  41849. referencedClasses: [],
  41850. messageSends: ["contents"]
  41851. }),
  41852. $globals.JSStream);
  41853. $core.addMethod(
  41854. $core.method({
  41855. selector: "initialize",
  41856. protocol: "initialization",
  41857. fn: function (){
  41858. var self=this,$self=this;
  41859. return $core.withContext(function($ctx1) {
  41860. (
  41861. $ctx1.supercall = true,
  41862. ($globals.JSStream.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  41863. $ctx1.supercall = false;
  41864. $self["@stream"]=""._writeStream();
  41865. return self;
  41866. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.JSStream)});
  41867. },
  41868. args: [],
  41869. source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.",
  41870. referencedClasses: [],
  41871. messageSends: ["initialize", "writeStream"]
  41872. }),
  41873. $globals.JSStream);
  41874. $core.addMethod(
  41875. $core.method({
  41876. selector: "lf",
  41877. protocol: "streaming",
  41878. fn: function (){
  41879. var self=this,$self=this;
  41880. return $core.withContext(function($ctx1) {
  41881. $recv($self["@stream"])._lf();
  41882. return self;
  41883. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.JSStream)});
  41884. },
  41885. args: [],
  41886. source: "lf\x0a\x09stream lf",
  41887. referencedClasses: [],
  41888. messageSends: ["lf"]
  41889. }),
  41890. $globals.JSStream);
  41891. $core.addMethod(
  41892. $core.method({
  41893. selector: "nextPut:",
  41894. protocol: "streaming",
  41895. fn: function (aString){
  41896. var self=this,$self=this;
  41897. return $core.withContext(function($ctx1) {
  41898. $recv($self["@stream"])._nextPut_(aString);
  41899. return self;
  41900. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.JSStream)});
  41901. },
  41902. args: ["aString"],
  41903. source: "nextPut: aString\x0a\x09stream nextPut: aString",
  41904. referencedClasses: [],
  41905. messageSends: ["nextPut:"]
  41906. }),
  41907. $globals.JSStream);
  41908. $core.addMethod(
  41909. $core.method({
  41910. selector: "nextPutAll:",
  41911. protocol: "streaming",
  41912. fn: function (aString){
  41913. var self=this,$self=this;
  41914. return $core.withContext(function($ctx1) {
  41915. $recv($self["@stream"])._nextPutAll_(aString);
  41916. return self;
  41917. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString},$globals.JSStream)});
  41918. },
  41919. args: ["aString"],
  41920. source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString",
  41921. referencedClasses: [],
  41922. messageSends: ["nextPutAll:"]
  41923. }),
  41924. $globals.JSStream);
  41925. $core.addMethod(
  41926. $core.method({
  41927. selector: "nextPutAssignLhs:rhs:",
  41928. protocol: "streaming",
  41929. fn: function (aBlock,anotherBlock){
  41930. var self=this,$self=this;
  41931. return $core.withContext(function($ctx1) {
  41932. $recv(aBlock)._value();
  41933. $ctx1.sendIdx["value"]=1;
  41934. $recv($self["@stream"])._nextPutAll_("=");
  41935. $recv(anotherBlock)._value();
  41936. return self;
  41937. }, function($ctx1) {$ctx1.fill(self,"nextPutAssignLhs:rhs:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  41938. },
  41939. args: ["aBlock", "anotherBlock"],
  41940. source: "nextPutAssignLhs: aBlock rhs: anotherBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '='.\x0a\x09anotherBlock value",
  41941. referencedClasses: [],
  41942. messageSends: ["value", "nextPutAll:"]
  41943. }),
  41944. $globals.JSStream);
  41945. $core.addMethod(
  41946. $core.method({
  41947. selector: "nextPutBlockContextFor:during:",
  41948. protocol: "streaming",
  41949. fn: function (anIRClosure,aBlock){
  41950. var self=this,$self=this;
  41951. return $core.withContext(function($ctx1) {
  41952. var $1,$2,$6,$5,$4,$3,$7,$11,$10,$9,$8,$15,$14,$13,$12,$16,$17,$23,$22,$21,$20,$19,$18;
  41953. $1=$recv(anIRClosure)._requiresSmalltalkContext();
  41954. if(!$core.assert($1)){
  41955. $2=$recv(aBlock)._value();
  41956. $ctx1.sendIdx["value"]=1;
  41957. return $2;
  41958. }
  41959. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41960. $ctx1.sendIdx["nextPutAll:"]=1;
  41961. $self._lf();
  41962. $ctx1.sendIdx["lf"]=1;
  41963. $6=$recv(anIRClosure)._scope();
  41964. $ctx1.sendIdx["scope"]=1;
  41965. $5=$recv($6)._alias();
  41966. $ctx1.sendIdx["alias"]=1;
  41967. $4="return $core.withContext(function(".__comma($5);
  41968. $ctx1.sendIdx[","]=2;
  41969. $3=$recv($4).__comma(") {");
  41970. $ctx1.sendIdx[","]=1;
  41971. $self._nextPutAll_($3);
  41972. $ctx1.sendIdx["nextPutAll:"]=2;
  41973. $self._lf();
  41974. $ctx1.sendIdx["lf"]=2;
  41975. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  41976. $ctx1.sendIdx["nextPutAll:"]=3;
  41977. $7=$self._lf();
  41978. $ctx1.sendIdx["lf"]=3;
  41979. $recv(aBlock)._value();
  41980. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41981. $ctx1.sendIdx["nextPutAll:"]=4;
  41982. $self._lf();
  41983. $ctx1.sendIdx["lf"]=4;
  41984. $11=$recv(anIRClosure)._scope();
  41985. $ctx1.sendIdx["scope"]=2;
  41986. $10=$recv($11)._alias();
  41987. $ctx1.sendIdx["alias"]=2;
  41988. $9="}, function(".__comma($10);
  41989. $ctx1.sendIdx[","]=4;
  41990. $8=$recv($9).__comma(") {");
  41991. $ctx1.sendIdx[","]=3;
  41992. $self._nextPutAll_($8);
  41993. $ctx1.sendIdx["nextPutAll:"]=5;
  41994. $15=$recv(anIRClosure)._scope();
  41995. $ctx1.sendIdx["scope"]=3;
  41996. $14=$recv($15)._alias();
  41997. $ctx1.sendIdx["alias"]=3;
  41998. $13=$recv($14).__comma(".fillBlock({");
  41999. $ctx1.sendIdx[","]=5;
  42000. $12=$self._nextPutAll_($13);
  42001. $ctx1.sendIdx["nextPutAll:"]=6;
  42002. $recv($recv(anIRClosure)._locals())._do_separatedBy_((function(each){
  42003. return $core.withContext(function($ctx2) {
  42004. $16=$recv(each)._asVariableName();
  42005. $ctx2.sendIdx["asVariableName"]=1;
  42006. $self._nextPutAll_($16);
  42007. $ctx2.sendIdx["nextPutAll:"]=7;
  42008. $self._nextPutAll_(":");
  42009. $ctx2.sendIdx["nextPutAll:"]=8;
  42010. $17=$self._nextPutAll_($recv(each)._asVariableName());
  42011. $ctx2.sendIdx["nextPutAll:"]=9;
  42012. return $17;
  42013. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  42014. }),(function(){
  42015. return $core.withContext(function($ctx2) {
  42016. return $self._nextPutAll_(",");
  42017. $ctx2.sendIdx["nextPutAll:"]=10;
  42018. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  42019. }));
  42020. $self._nextPutAll_("},");
  42021. $ctx1.sendIdx["nextPutAll:"]=11;
  42022. $23=$recv(anIRClosure)._scope();
  42023. $ctx1.sendIdx["scope"]=4;
  42024. $22=$recv($23)._outerScope();
  42025. $21=$recv($22)._alias();
  42026. $20=$recv($21).__comma(",");
  42027. $19=$recv($20).__comma($recv($recv($recv(anIRClosure)._scope())._blockIndex())._asString());
  42028. $ctx1.sendIdx[","]=7;
  42029. $18=$recv($19).__comma(")});");
  42030. $ctx1.sendIdx[","]=6;
  42031. $self._nextPutAll_($18);
  42032. $ctx1.sendIdx["nextPutAll:"]=12;
  42033. $self._lf();
  42034. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  42035. return self;
  42036. }, function($ctx1) {$ctx1.fill(self,"nextPutBlockContextFor:during:",{anIRClosure:anIRClosure,aBlock:aBlock},$globals.JSStream)});
  42037. },
  42038. args: ["anIRClosure", "aBlock"],
  42039. 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);'",
  42040. referencedClasses: [],
  42041. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "do:separatedBy:", "locals", "asVariableName", "outerScope", "asString", "blockIndex"]
  42042. }),
  42043. $globals.JSStream);
  42044. $core.addMethod(
  42045. $core.method({
  42046. selector: "nextPutClosureWith:arguments:",
  42047. protocol: "streaming",
  42048. fn: function (aBlock,anArray){
  42049. var self=this,$self=this;
  42050. return $core.withContext(function($ctx1) {
  42051. var $1,$2,$3;
  42052. $recv($self["@stream"])._nextPutAll_("(function(");
  42053. $ctx1.sendIdx["nextPutAll:"]=1;
  42054. $recv(anArray)._do_separatedBy_((function(each){
  42055. return $core.withContext(function($ctx2) {
  42056. return $recv($self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  42057. $ctx2.sendIdx["nextPutAll:"]=2;
  42058. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42059. }),(function(){
  42060. return $core.withContext(function($ctx2) {
  42061. return $recv($self["@stream"])._nextPut_(",");
  42062. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42063. }));
  42064. $1=$self["@stream"];
  42065. $recv($1)._nextPutAll_("){");
  42066. $ctx1.sendIdx["nextPutAll:"]=3;
  42067. $2=$recv($1)._lf();
  42068. $ctx1.sendIdx["lf"]=1;
  42069. $recv(aBlock)._value();
  42070. $3=$self["@stream"];
  42071. $recv($3)._lf();
  42072. $recv($3)._nextPutAll_("})");
  42073. return self;
  42074. }, function($ctx1) {$ctx1.fill(self,"nextPutClosureWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  42075. },
  42076. args: ["aBlock", "anArray"],
  42077. 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: '})'",
  42078. referencedClasses: [],
  42079. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  42080. }),
  42081. $globals.JSStream);
  42082. $core.addMethod(
  42083. $core.method({
  42084. selector: "nextPutContextFor:during:",
  42085. protocol: "streaming",
  42086. fn: function (aMethod,aBlock){
  42087. var self=this,$self=this;
  42088. return $core.withContext(function($ctx1) {
  42089. var $1,$2,$6,$5,$4,$3,$7,$12,$11,$10,$9,$8,$16,$15,$14,$13,$17,$18;
  42090. $1=$recv(aMethod)._requiresSmalltalkContext();
  42091. if(!$core.assert($1)){
  42092. $2=$recv(aBlock)._value();
  42093. $ctx1.sendIdx["value"]=1;
  42094. return $2;
  42095. }
  42096. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  42097. $ctx1.sendIdx["nextPutAll:"]=1;
  42098. $self._lf();
  42099. $ctx1.sendIdx["lf"]=1;
  42100. $6=$recv(aMethod)._scope();
  42101. $ctx1.sendIdx["scope"]=1;
  42102. $5=$recv($6)._alias();
  42103. $ctx1.sendIdx["alias"]=1;
  42104. $4="return $core.withContext(function(".__comma($5);
  42105. $ctx1.sendIdx[","]=2;
  42106. $3=$recv($4).__comma(") {");
  42107. $ctx1.sendIdx[","]=1;
  42108. $self._nextPutAll_($3);
  42109. $ctx1.sendIdx["nextPutAll:"]=2;
  42110. $self._lf();
  42111. $ctx1.sendIdx["lf"]=2;
  42112. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  42113. $ctx1.sendIdx["nextPutAll:"]=3;
  42114. $7=$self._lf();
  42115. $ctx1.sendIdx["lf"]=3;
  42116. $recv(aBlock)._value();
  42117. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  42118. $ctx1.sendIdx["nextPutAll:"]=4;
  42119. $self._lf();
  42120. $ctx1.sendIdx["lf"]=4;
  42121. $12=$recv(aMethod)._scope();
  42122. $ctx1.sendIdx["scope"]=2;
  42123. $11=$recv($12)._alias();
  42124. $ctx1.sendIdx["alias"]=2;
  42125. $10="}, function(".__comma($11);
  42126. $ctx1.sendIdx[","]=5;
  42127. $9=$recv($10).__comma(") {");
  42128. $ctx1.sendIdx[","]=4;
  42129. $8=$recv($9).__comma($recv($recv(aMethod)._scope())._alias());
  42130. $ctx1.sendIdx[","]=3;
  42131. $self._nextPutAll_($8);
  42132. $ctx1.sendIdx["nextPutAll:"]=5;
  42133. $16=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  42134. $ctx1.sendIdx["asJavaScriptSource"]=1;
  42135. $15=".fill(self,".__comma($16);
  42136. $14=$recv($15).__comma(",{");
  42137. $ctx1.sendIdx[","]=6;
  42138. $13=$self._nextPutAll_($14);
  42139. $ctx1.sendIdx["nextPutAll:"]=6;
  42140. $recv($recv(aMethod)._locals())._do_separatedBy_((function(each){
  42141. return $core.withContext(function($ctx2) {
  42142. $17=$recv(each)._asVariableName();
  42143. $ctx2.sendIdx["asVariableName"]=1;
  42144. $self._nextPutAll_($17);
  42145. $ctx2.sendIdx["nextPutAll:"]=7;
  42146. $self._nextPutAll_(":");
  42147. $ctx2.sendIdx["nextPutAll:"]=8;
  42148. $18=$self._nextPutAll_($recv(each)._asVariableName());
  42149. $ctx2.sendIdx["nextPutAll:"]=9;
  42150. return $18;
  42151. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  42152. }),(function(){
  42153. return $core.withContext(function($ctx2) {
  42154. return $self._nextPutAll_(",");
  42155. $ctx2.sendIdx["nextPutAll:"]=10;
  42156. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  42157. }));
  42158. $self._nextPutAll_("},");
  42159. $ctx1.sendIdx["nextPutAll:"]=11;
  42160. $self._nextPutAll_($recv($recv(aMethod)._theClass())._asJavaScriptSource());
  42161. $ctx1.sendIdx["nextPutAll:"]=12;
  42162. $self._nextPutAll_(")});");
  42163. $ctx1.sendIdx["nextPutAll:"]=13;
  42164. $self._lf();
  42165. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  42166. return self;
  42167. }, function($ctx1) {$ctx1.fill(self,"nextPutContextFor:during:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  42168. },
  42169. args: ["aMethod", "aBlock"],
  42170. source: "nextPutContextFor: aMethod during: aBlock\x0a\x09aMethod requiresSmalltalkContext ifFalse: [ ^ aBlock value ].\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: 'return $core.withContext(function(', aMethod scope alias, ') {';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);';\x0a\x09\x09lf.\x0a\x0a\x09aBlock value.\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '}, function(', aMethod scope alias, ') {', aMethod scope alias;\x0a\x09\x09nextPutAll: '.fill(self,', aMethod selector asJavaScriptSource, ',{'.\x0a\x0a\x09aMethod locals\x0a\x09\x09do: [ :each |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09nextPutAll: each asVariableName;\x0a\x09\x09\x09\x09nextPutAll: ':';\x0a\x09\x09\x09\x09nextPutAll: each asVariableName ]\x0a\x09\x09separatedBy: [ self nextPutAll: ',' ].\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '},';\x0a\x09\x09nextPutAll: aMethod theClass asJavaScriptSource;\x0a\x09\x09nextPutAll: ')});';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'",
  42171. referencedClasses: [],
  42172. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "asJavaScriptSource", "selector", "do:separatedBy:", "locals", "asVariableName", "theClass"]
  42173. }),
  42174. $globals.JSStream);
  42175. $core.addMethod(
  42176. $core.method({
  42177. selector: "nextPutFunctionWith:arguments:",
  42178. protocol: "streaming",
  42179. fn: function (aBlock,anArray){
  42180. var self=this,$self=this;
  42181. return $core.withContext(function($ctx1) {
  42182. var $1,$2,$3,$4,$5;
  42183. $recv($self["@stream"])._nextPutAll_("fn: function (");
  42184. $ctx1.sendIdx["nextPutAll:"]=1;
  42185. $recv(anArray)._do_separatedBy_((function(each){
  42186. return $core.withContext(function($ctx2) {
  42187. return $recv($self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  42188. $ctx2.sendIdx["nextPutAll:"]=2;
  42189. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42190. }),(function(){
  42191. return $core.withContext(function($ctx2) {
  42192. return $recv($self["@stream"])._nextPut_(",");
  42193. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42194. }));
  42195. $1=$self["@stream"];
  42196. $recv($1)._nextPutAll_("){");
  42197. $ctx1.sendIdx["nextPutAll:"]=3;
  42198. $2=$recv($1)._lf();
  42199. $ctx1.sendIdx["lf"]=1;
  42200. $3=$self["@stream"];
  42201. $recv($3)._nextPutAll_("var self=this,$self=this;");
  42202. $ctx1.sendIdx["nextPutAll:"]=4;
  42203. $4=$recv($3)._lf();
  42204. $ctx1.sendIdx["lf"]=2;
  42205. $recv(aBlock)._value();
  42206. $5=$self["@stream"];
  42207. $recv($5)._lf();
  42208. $recv($5)._nextPutAll_("}");
  42209. return self;
  42210. }, function($ctx1) {$ctx1.fill(self,"nextPutFunctionWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  42211. },
  42212. args: ["aBlock", "anArray"],
  42213. source: "nextPutFunctionWith: aBlock arguments: anArray\x0a\x09stream nextPutAll: 'fn: function ('.\x0a\x09anArray\x0a\x09\x09do: [ :each | stream nextPutAll: each asVariableName ]\x0a\x09\x09separatedBy: [ stream nextPut: ',' ].\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09stream nextPutAll: 'var self=this,$self=this;'; lf.\x0a\x09aBlock value.\x0a\x09stream lf; nextPutAll: '}'",
  42214. referencedClasses: [],
  42215. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  42216. }),
  42217. $globals.JSStream);
  42218. $core.addMethod(
  42219. $core.method({
  42220. selector: "nextPutIf:then:",
  42221. protocol: "streaming",
  42222. fn: function (aBlock,anotherBlock){
  42223. var self=this,$self=this;
  42224. return $core.withContext(function($ctx1) {
  42225. var $1;
  42226. $recv($self["@stream"])._nextPutAll_("if(");
  42227. $ctx1.sendIdx["nextPutAll:"]=1;
  42228. $recv(aBlock)._value();
  42229. $ctx1.sendIdx["value"]=1;
  42230. $1=$self["@stream"];
  42231. $recv($1)._nextPutAll_("){");
  42232. $ctx1.sendIdx["nextPutAll:"]=2;
  42233. $recv($1)._lf();
  42234. $recv(anotherBlock)._value();
  42235. $recv($self["@stream"])._nextPutAll_("}");
  42236. $self._omitSemicolon_(true);
  42237. return self;
  42238. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  42239. },
  42240. args: ["aBlock", "anotherBlock"],
  42241. 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",
  42242. referencedClasses: [],
  42243. messageSends: ["nextPutAll:", "value", "lf", "omitSemicolon:"]
  42244. }),
  42245. $globals.JSStream);
  42246. $core.addMethod(
  42247. $core.method({
  42248. selector: "nextPutIf:then:else:",
  42249. protocol: "streaming",
  42250. fn: function (aBlock,ifBlock,elseBlock){
  42251. var self=this,$self=this;
  42252. return $core.withContext(function($ctx1) {
  42253. var $1,$2,$3;
  42254. $recv($self["@stream"])._nextPutAll_("if(");
  42255. $ctx1.sendIdx["nextPutAll:"]=1;
  42256. $recv(aBlock)._value();
  42257. $ctx1.sendIdx["value"]=1;
  42258. $1=$self["@stream"];
  42259. $recv($1)._nextPutAll_("){");
  42260. $ctx1.sendIdx["nextPutAll:"]=2;
  42261. $2=$recv($1)._lf();
  42262. $ctx1.sendIdx["lf"]=1;
  42263. $recv(ifBlock)._value();
  42264. $ctx1.sendIdx["value"]=2;
  42265. $3=$self["@stream"];
  42266. $recv($3)._nextPutAll_("} else {");
  42267. $ctx1.sendIdx["nextPutAll:"]=3;
  42268. $recv($3)._lf();
  42269. $recv(elseBlock)._value();
  42270. $recv($self["@stream"])._nextPutAll_("}");
  42271. $self._omitSemicolon_(true);
  42272. return self;
  42273. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:else:",{aBlock:aBlock,ifBlock:ifBlock,elseBlock:elseBlock},$globals.JSStream)});
  42274. },
  42275. args: ["aBlock", "ifBlock", "elseBlock"],
  42276. 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",
  42277. referencedClasses: [],
  42278. messageSends: ["nextPutAll:", "value", "lf", "omitSemicolon:"]
  42279. }),
  42280. $globals.JSStream);
  42281. $core.addMethod(
  42282. $core.method({
  42283. selector: "nextPutMethodDeclaration:with:",
  42284. protocol: "streaming",
  42285. fn: function (aMethod,aBlock){
  42286. var self=this,$self=this;
  42287. return $core.withContext(function($ctx1) {
  42288. var $1,$4,$3,$2,$7,$6,$5,$8,$9,$12,$11,$10,$15,$14,$13,$18,$17,$16,$19,$20;
  42289. $1=$self["@stream"];
  42290. $recv($1)._nextPutAll_("$core.method({");
  42291. $ctx1.sendIdx["nextPutAll:"]=1;
  42292. $recv($1)._lf();
  42293. $ctx1.sendIdx["lf"]=1;
  42294. $4=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  42295. $ctx1.sendIdx["asJavaScriptSource"]=1;
  42296. $3="selector: ".__comma($4);
  42297. $ctx1.sendIdx[","]=2;
  42298. $2=$recv($3).__comma(",");
  42299. $ctx1.sendIdx[","]=1;
  42300. $recv($1)._nextPutAll_($2);
  42301. $ctx1.sendIdx["nextPutAll:"]=2;
  42302. $recv($1)._lf();
  42303. $ctx1.sendIdx["lf"]=2;
  42304. $7=$recv($recv(aMethod)._source())._asJavaScriptSource();
  42305. $ctx1.sendIdx["asJavaScriptSource"]=2;
  42306. $6="source: ".__comma($7);
  42307. $ctx1.sendIdx[","]=4;
  42308. $5=$recv($6).__comma(",");
  42309. $ctx1.sendIdx[","]=3;
  42310. $recv($1)._nextPutAll_($5);
  42311. $ctx1.sendIdx["nextPutAll:"]=3;
  42312. $8=$recv($1)._lf();
  42313. $ctx1.sendIdx["lf"]=3;
  42314. $recv(aBlock)._value();
  42315. $ctx1.sendIdx["value"]=1;
  42316. $9=$self["@stream"];
  42317. $12=$recv($globals.String)._lf();
  42318. $ctx1.sendIdx["lf"]=4;
  42319. $11=",".__comma($12);
  42320. $ctx1.sendIdx[","]=6;
  42321. $10=$recv($11).__comma("messageSends: ");
  42322. $ctx1.sendIdx[","]=5;
  42323. $recv($9)._nextPutAll_($10);
  42324. $ctx1.sendIdx["nextPutAll:"]=4;
  42325. $15=$recv($recv(aMethod)._messageSends())._asArray();
  42326. $ctx1.sendIdx["asArray"]=1;
  42327. $14=$recv($15)._asJavaScriptSource();
  42328. $ctx1.sendIdx["asJavaScriptSource"]=3;
  42329. $13=$recv($14).__comma(",");
  42330. $ctx1.sendIdx[","]=7;
  42331. $recv($9)._nextPutAll_($13);
  42332. $ctx1.sendIdx["nextPutAll:"]=5;
  42333. $recv($9)._lf();
  42334. $ctx1.sendIdx["lf"]=5;
  42335. $18=$recv($recv($recv($recv(aMethod)._arguments())._collect_((function(each){
  42336. return $core.withContext(function($ctx2) {
  42337. return $recv(each)._value();
  42338. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42339. })))._asArray())._asJavaScriptSource();
  42340. $ctx1.sendIdx["asJavaScriptSource"]=4;
  42341. $17="args: ".__comma($18);
  42342. $16=$recv($17).__comma(",");
  42343. $ctx1.sendIdx[","]=8;
  42344. $recv($9)._nextPutAll_($16);
  42345. $ctx1.sendIdx["nextPutAll:"]=6;
  42346. $recv($9)._lf();
  42347. $19=$recv($9)._nextPutAll_("referencedClasses: [");
  42348. $ctx1.sendIdx["nextPutAll:"]=7;
  42349. $recv($recv(aMethod)._classReferences())._do_separatedBy_((function(each){
  42350. return $core.withContext(function($ctx2) {
  42351. return $recv($self["@stream"])._nextPutAll_($recv(each)._asJavaScriptSource());
  42352. $ctx2.sendIdx["nextPutAll:"]=8;
  42353. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  42354. }),(function(){
  42355. return $core.withContext(function($ctx2) {
  42356. return $recv($self["@stream"])._nextPutAll_(",");
  42357. $ctx2.sendIdx["nextPutAll:"]=9;
  42358. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  42359. }));
  42360. $20=$self["@stream"];
  42361. $recv($20)._nextPutAll_("]");
  42362. $ctx1.sendIdx["nextPutAll:"]=10;
  42363. $recv($20)._nextPutAll_("})");
  42364. return self;
  42365. }, function($ctx1) {$ctx1.fill(self,"nextPutMethodDeclaration:with:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  42366. },
  42367. args: ["aMethod", "aBlock"],
  42368. 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: '})'",
  42369. referencedClasses: ["String"],
  42370. messageSends: ["nextPutAll:", "lf", ",", "asJavaScriptSource", "selector", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"]
  42371. }),
  42372. $globals.JSStream);
  42373. $core.addMethod(
  42374. $core.method({
  42375. selector: "nextPutNonLocalReturnHandlingWith:",
  42376. protocol: "streaming",
  42377. fn: function (aBlock){
  42378. var self=this,$self=this;
  42379. return $core.withContext(function($ctx1) {
  42380. var $1,$2,$3;
  42381. $1=$self["@stream"];
  42382. $recv($1)._nextPutAll_("var $early={};");
  42383. $ctx1.sendIdx["nextPutAll:"]=1;
  42384. $recv($1)._lf();
  42385. $ctx1.sendIdx["lf"]=1;
  42386. $recv($1)._nextPutAll_("try {");
  42387. $ctx1.sendIdx["nextPutAll:"]=2;
  42388. $2=$recv($1)._lf();
  42389. $ctx1.sendIdx["lf"]=2;
  42390. $recv(aBlock)._value();
  42391. $3=$self["@stream"];
  42392. $recv($3)._nextPutAll_("}");
  42393. $ctx1.sendIdx["nextPutAll:"]=3;
  42394. $recv($3)._lf();
  42395. $ctx1.sendIdx["lf"]=3;
  42396. $recv($3)._nextPutAll_("catch(e) {if(e===$early)return e[0]; throw e}");
  42397. $recv($3)._lf();
  42398. return self;
  42399. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnHandlingWith:",{aBlock:aBlock},$globals.JSStream)});
  42400. },
  42401. args: ["aBlock"],
  42402. 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",
  42403. referencedClasses: [],
  42404. messageSends: ["nextPutAll:", "lf", "value"]
  42405. }),
  42406. $globals.JSStream);
  42407. $core.addMethod(
  42408. $core.method({
  42409. selector: "nextPutNonLocalReturnWith:",
  42410. protocol: "streaming",
  42411. fn: function (aBlock){
  42412. var self=this,$self=this;
  42413. return $core.withContext(function($ctx1) {
  42414. $recv($self["@stream"])._nextPutAll_("throw $early=[");
  42415. $ctx1.sendIdx["nextPutAll:"]=1;
  42416. $recv(aBlock)._value();
  42417. $recv($self["@stream"])._nextPutAll_("]");
  42418. return self;
  42419. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  42420. },
  42421. args: ["aBlock"],
  42422. source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'",
  42423. referencedClasses: [],
  42424. messageSends: ["nextPutAll:", "value"]
  42425. }),
  42426. $globals.JSStream);
  42427. $core.addMethod(
  42428. $core.method({
  42429. selector: "nextPutReturnWith:",
  42430. protocol: "streaming",
  42431. fn: function (aBlock){
  42432. var self=this,$self=this;
  42433. return $core.withContext(function($ctx1) {
  42434. $recv($self["@stream"])._nextPutAll_("return ");
  42435. $recv(aBlock)._value();
  42436. return self;
  42437. }, function($ctx1) {$ctx1.fill(self,"nextPutReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  42438. },
  42439. args: ["aBlock"],
  42440. source: "nextPutReturnWith: aBlock\x0a\x09stream nextPutAll: 'return '.\x0a\x09aBlock value",
  42441. referencedClasses: [],
  42442. messageSends: ["nextPutAll:", "value"]
  42443. }),
  42444. $globals.JSStream);
  42445. $core.addMethod(
  42446. $core.method({
  42447. selector: "nextPutSendIndexFor:",
  42448. protocol: "streaming",
  42449. fn: function (anIRSend){
  42450. var self=this,$self=this;
  42451. return $core.withContext(function($ctx1) {
  42452. $self._nextPutAll_(";");
  42453. $ctx1.sendIdx["nextPutAll:"]=1;
  42454. $self._lf();
  42455. $ctx1.sendIdx["lf"]=1;
  42456. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  42457. $ctx1.sendIdx["nextPutAll:"]=2;
  42458. $self._lf();
  42459. $ctx1.sendIdx["lf"]=2;
  42460. $self._nextPutAll_($recv($recv(anIRSend)._scope())._alias());
  42461. $ctx1.sendIdx["nextPutAll:"]=3;
  42462. $self._nextPutAll_(".sendIdx[");
  42463. $ctx1.sendIdx["nextPutAll:"]=4;
  42464. $self._nextPutAll_($recv($recv(anIRSend)._selector())._asJavaScriptSource());
  42465. $ctx1.sendIdx["nextPutAll:"]=5;
  42466. $self._nextPutAll_("]=");
  42467. $ctx1.sendIdx["nextPutAll:"]=6;
  42468. $self._nextPutAll_($recv($recv(anIRSend)._index())._asString());
  42469. $ctx1.sendIdx["nextPutAll:"]=7;
  42470. $self._nextPutAll_(";");
  42471. $ctx1.sendIdx["nextPutAll:"]=8;
  42472. $self._lf();
  42473. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22)");
  42474. return self;
  42475. }, function($ctx1) {$ctx1.fill(self,"nextPutSendIndexFor:",{anIRSend:anIRSend},$globals.JSStream)});
  42476. },
  42477. args: ["anIRSend"],
  42478. 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)'",
  42479. referencedClasses: [],
  42480. messageSends: ["nextPutAll:", "lf", "alias", "scope", "asJavaScriptSource", "selector", "asString", "index"]
  42481. }),
  42482. $globals.JSStream);
  42483. $core.addMethod(
  42484. $core.method({
  42485. selector: "nextPutStatementWith:",
  42486. protocol: "streaming",
  42487. fn: function (aBlock){
  42488. var self=this,$self=this;
  42489. return $core.withContext(function($ctx1) {
  42490. var $1;
  42491. $self._omitSemicolon_(false);
  42492. $ctx1.sendIdx["omitSemicolon:"]=1;
  42493. $recv(aBlock)._value();
  42494. $1=$self._omitSemicolon();
  42495. if(!$core.assert($1)){
  42496. $recv($self["@stream"])._nextPutAll_(";");
  42497. }
  42498. $self._omitSemicolon_(false);
  42499. $recv($self["@stream"])._lf();
  42500. return self;
  42501. }, function($ctx1) {$ctx1.fill(self,"nextPutStatementWith:",{aBlock:aBlock},$globals.JSStream)});
  42502. },
  42503. args: ["aBlock"],
  42504. source: "nextPutStatementWith: aBlock\x0a\x09self omitSemicolon: false.\x0a\x09aBlock value.\x0a\x09self omitSemicolon ifFalse: [ stream nextPutAll: ';' ].\x0a\x09self omitSemicolon: false.\x0a\x09stream lf",
  42505. referencedClasses: [],
  42506. messageSends: ["omitSemicolon:", "value", "ifFalse:", "omitSemicolon", "nextPutAll:", "lf"]
  42507. }),
  42508. $globals.JSStream);
  42509. $core.addMethod(
  42510. $core.method({
  42511. selector: "nextPutVars:",
  42512. protocol: "streaming",
  42513. fn: function (aCollection){
  42514. var self=this,$self=this;
  42515. return $core.withContext(function($ctx1) {
  42516. var $1;
  42517. $recv(aCollection)._ifNotEmpty_((function(){
  42518. return $core.withContext(function($ctx2) {
  42519. $recv($self["@stream"])._nextPutAll_("var ");
  42520. $ctx2.sendIdx["nextPutAll:"]=1;
  42521. $recv(aCollection)._do_separatedBy_((function(each){
  42522. return $core.withContext(function($ctx3) {
  42523. return $recv($self["@stream"])._nextPutAll_(each);
  42524. $ctx3.sendIdx["nextPutAll:"]=2;
  42525. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  42526. }),(function(){
  42527. return $core.withContext(function($ctx3) {
  42528. return $recv($self["@stream"])._nextPutAll_(",");
  42529. $ctx3.sendIdx["nextPutAll:"]=3;
  42530. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  42531. }));
  42532. $1=$self["@stream"];
  42533. $recv($1)._nextPutAll_(";");
  42534. return $recv($1)._lf();
  42535. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42536. }));
  42537. return self;
  42538. }, function($ctx1) {$ctx1.fill(self,"nextPutVars:",{aCollection:aCollection},$globals.JSStream)});
  42539. },
  42540. args: ["aCollection"],
  42541. 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 ]",
  42542. referencedClasses: [],
  42543. messageSends: ["ifNotEmpty:", "nextPutAll:", "do:separatedBy:", "lf"]
  42544. }),
  42545. $globals.JSStream);
  42546. $core.addMethod(
  42547. $core.method({
  42548. selector: "omitSemicolon",
  42549. protocol: "accessing",
  42550. fn: function (){
  42551. var self=this,$self=this;
  42552. return $self["@omitSemicolon"];
  42553. },
  42554. args: [],
  42555. source: "omitSemicolon\x0a\x09^ omitSemicolon",
  42556. referencedClasses: [],
  42557. messageSends: []
  42558. }),
  42559. $globals.JSStream);
  42560. $core.addMethod(
  42561. $core.method({
  42562. selector: "omitSemicolon:",
  42563. protocol: "accessing",
  42564. fn: function (aBoolean){
  42565. var self=this,$self=this;
  42566. $self["@omitSemicolon"]=aBoolean;
  42567. return self;
  42568. },
  42569. args: ["aBoolean"],
  42570. source: "omitSemicolon: aBoolean\x0a\x09omitSemicolon := aBoolean",
  42571. referencedClasses: [],
  42572. messageSends: []
  42573. }),
  42574. $globals.JSStream);
  42575. $core.addMethod(
  42576. $core.method({
  42577. selector: "isReferenced",
  42578. protocol: "*Compiler-IR",
  42579. fn: function (){
  42580. var self=this,$self=this;
  42581. return $core.withContext(function($ctx1) {
  42582. var $3,$2,$1;
  42583. $3=$self._parent();
  42584. $ctx1.sendIdx["parent"]=1;
  42585. $2=$recv($3)._isSequenceNode();
  42586. $1=$recv($2)._or_((function(){
  42587. return $core.withContext(function($ctx2) {
  42588. return $recv($self._parent())._isAssignmentNode();
  42589. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42590. }));
  42591. return $recv($1)._not();
  42592. }, function($ctx1) {$ctx1.fill(self,"isReferenced",{},$globals.ASTNode)});
  42593. },
  42594. args: [],
  42595. source: "isReferenced\x0a\x09\x22Answer true if the receiver is referenced by other nodes.\x0a\x09Do not take sequences or assignments into account\x22\x0a\x09\x0a\x09^ (self parent isSequenceNode or: [\x0a\x09\x09self parent isAssignmentNode ]) not",
  42596. referencedClasses: [],
  42597. messageSends: ["not", "or:", "isSequenceNode", "parent", "isAssignmentNode"]
  42598. }),
  42599. $globals.ASTNode);
  42600. $core.addMethod(
  42601. $core.method({
  42602. selector: "subtreeNeedsAliasing",
  42603. protocol: "*Compiler-IR",
  42604. fn: function (){
  42605. var self=this,$self=this;
  42606. return $core.withContext(function($ctx1) {
  42607. return $recv($self._shouldBeAliased())._or_((function(){
  42608. return $core.withContext(function($ctx2) {
  42609. return $recv($self._dagChildren())._anySatisfy_((function(each){
  42610. return $core.withContext(function($ctx3) {
  42611. return $recv(each)._subtreeNeedsAliasing();
  42612. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  42613. }));
  42614. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42615. }));
  42616. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.ASTNode)});
  42617. },
  42618. args: [],
  42619. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased or: [\x0a\x09\x09self dagChildren anySatisfy: [ :each | each subtreeNeedsAliasing ] ]",
  42620. referencedClasses: [],
  42621. messageSends: ["or:", "shouldBeAliased", "anySatisfy:", "dagChildren", "subtreeNeedsAliasing"]
  42622. }),
  42623. $globals.ASTNode);
  42624. $core.addMethod(
  42625. $core.method({
  42626. selector: "shouldBeAliased",
  42627. protocol: "*Compiler-IR",
  42628. fn: function (){
  42629. var self=this,$self=this;
  42630. return $core.withContext(function($ctx1) {
  42631. var $1;
  42632. $1=(
  42633. $ctx1.supercall = true,
  42634. ($globals.AssignmentNode.superclass||$boot.nilAsClass).fn.prototype._shouldBeAliased.apply($self, []));
  42635. $ctx1.supercall = false;
  42636. return $recv($1)._or_((function(){
  42637. return $core.withContext(function($ctx2) {
  42638. return $self._isReferenced();
  42639. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42640. }));
  42641. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.AssignmentNode)});
  42642. },
  42643. args: [],
  42644. source: "shouldBeAliased\x0a\x09^ super shouldBeAliased or: [ self isReferenced ]",
  42645. referencedClasses: [],
  42646. messageSends: ["or:", "shouldBeAliased", "isReferenced"]
  42647. }),
  42648. $globals.AssignmentNode);
  42649. $core.addMethod(
  42650. $core.method({
  42651. selector: "appendToInstruction:",
  42652. protocol: "*Compiler-IR",
  42653. fn: function (anIRInstruction){
  42654. var self=this,$self=this;
  42655. return $core.withContext(function($ctx1) {
  42656. $recv(anIRInstruction)._appendBlock_(self);
  42657. return self;
  42658. }, function($ctx1) {$ctx1.fill(self,"appendToInstruction:",{anIRInstruction:anIRInstruction},$globals.BlockClosure)});
  42659. },
  42660. args: ["anIRInstruction"],
  42661. source: "appendToInstruction: anIRInstruction\x0a\x09anIRInstruction appendBlock: self",
  42662. referencedClasses: [],
  42663. messageSends: ["appendBlock:"]
  42664. }),
  42665. $globals.BlockClosure);
  42666. $core.addMethod(
  42667. $core.method({
  42668. selector: "subtreeNeedsAliasing",
  42669. protocol: "*Compiler-IR",
  42670. fn: function (){
  42671. var self=this,$self=this;
  42672. return $core.withContext(function($ctx1) {
  42673. return $self._shouldBeAliased();
  42674. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.BlockNode)});
  42675. },
  42676. args: [],
  42677. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased",
  42678. referencedClasses: [],
  42679. messageSends: ["shouldBeAliased"]
  42680. }),
  42681. $globals.BlockNode);
  42682. $core.addMethod(
  42683. $core.method({
  42684. selector: "subtreeNeedsAliasing",
  42685. protocol: "*Compiler-IR",
  42686. fn: function (){
  42687. var self=this,$self=this;
  42688. return $core.withContext(function($ctx1) {
  42689. return $recv($recv($self._parent())._isSequenceNode())._not();
  42690. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.CascadeNode)});
  42691. },
  42692. args: [],
  42693. source: "subtreeNeedsAliasing\x0a\x09^ self parent isSequenceNode not",
  42694. referencedClasses: [],
  42695. messageSends: ["not", "isSequenceNode", "parent"]
  42696. }),
  42697. $globals.CascadeNode);
  42698. $core.addMethod(
  42699. $core.method({
  42700. selector: "shouldBeAliased",
  42701. protocol: "*Compiler-IR",
  42702. fn: function (){
  42703. var self=this,$self=this;
  42704. var sends;
  42705. return $core.withContext(function($ctx1) {
  42706. var $2,$1;
  42707. sends=$recv($recv($recv($self._method())._sendIndexes())._at_($self._selector()))._size();
  42708. $2=(
  42709. $ctx1.supercall = true,
  42710. ($globals.SendNode.superclass||$boot.nilAsClass).fn.prototype._shouldBeAliased.apply($self, []));
  42711. $ctx1.supercall = false;
  42712. $1=$recv($2)._or_((function(){
  42713. return $core.withContext(function($ctx2) {
  42714. return $recv($self._isReferenced())._and_((function(){
  42715. return $core.withContext(function($ctx3) {
  42716. return $recv($recv($self._index()).__lt(sends))._or_((function(){
  42717. return $core.withContext(function($ctx4) {
  42718. return $self._superSend();
  42719. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  42720. }));
  42721. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  42722. }));
  42723. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42724. }));
  42725. $ctx1.sendIdx["or:"]=1;
  42726. return $1;
  42727. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{sends:sends},$globals.SendNode)});
  42728. },
  42729. args: [],
  42730. 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 ] ] ])",
  42731. referencedClasses: [],
  42732. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "or:", "shouldBeAliased", "and:", "isReferenced", "<", "index", "superSend"]
  42733. }),
  42734. $globals.SendNode);
  42735. $core.addMethod(
  42736. $core.method({
  42737. selector: "subtreeNeedsAliasing",
  42738. protocol: "*Compiler-IR",
  42739. fn: function (){
  42740. var self=this,$self=this;
  42741. return $core.withContext(function($ctx1) {
  42742. return $recv($self._shouldBeInlined())._or_((function(){
  42743. return $core.withContext(function($ctx2) {
  42744. return (
  42745. $ctx2.supercall = true,
  42746. ($globals.SendNode.superclass||$boot.nilAsClass).fn.prototype._subtreeNeedsAliasing.apply($self, []));
  42747. $ctx2.supercall = false;
  42748. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42749. }));
  42750. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.SendNode)});
  42751. },
  42752. args: [],
  42753. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeInlined or: [ super subtreeNeedsAliasing ]",
  42754. referencedClasses: [],
  42755. messageSends: ["or:", "shouldBeInlined", "subtreeNeedsAliasing"]
  42756. }),
  42757. $globals.SendNode);
  42758. });
  42759. define('amber_core/Compiler-Inlining',["amber/boot", "amber_core/Compiler-AST", "amber_core/Compiler-Core", "amber_core/Compiler-IR", "amber_core/Compiler-Semantic", "amber_core/Kernel-Objects"], function($boot){"use strict";
  42760. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  42761. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  42762. var $pkg = $core.addPackage("Compiler-Inlining");
  42763. $pkg.innerEval = function (expr) { return eval(expr); };
  42764. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  42765. $core.addClass("ASTPreInliner", $globals.NodeVisitor, [], "Compiler-Inlining");
  42766. $core.addMethod(
  42767. $core.method({
  42768. selector: "visitSendNode:",
  42769. protocol: "visiting",
  42770. fn: function (aNode){
  42771. var self=this,$self=this;
  42772. return $core.withContext(function($ctx1) {
  42773. var $1,$2,$3,$4,$receiver;
  42774. $1=$recv(aNode)._superSend();
  42775. if(!$core.assert($1)){
  42776. $2=$recv($recv($globals.IRSendInliner)._inlinedSelectors())._includes_($recv(aNode)._selector());
  42777. if($core.assert($2)){
  42778. $recv(aNode)._shouldBeInlined_(true);
  42779. $3=$recv(aNode)._receiver();
  42780. if(($receiver = $3) == null || $receiver.a$nil){
  42781. $3;
  42782. } else {
  42783. var receiver;
  42784. receiver=$receiver;
  42785. $recv(receiver)._shouldBeAliased_(true);
  42786. }
  42787. }
  42788. }
  42789. $4=(
  42790. $ctx1.supercall = true,
  42791. ($globals.ASTPreInliner.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  42792. $ctx1.supercall = false;
  42793. return $4;
  42794. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.ASTPreInliner)});
  42795. },
  42796. args: ["aNode"],
  42797. 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",
  42798. referencedClasses: ["IRSendInliner"],
  42799. messageSends: ["ifFalse:", "superSend", "ifTrue:", "includes:", "inlinedSelectors", "selector", "shouldBeInlined:", "ifNotNil:", "receiver", "shouldBeAliased:", "visitSendNode:"]
  42800. }),
  42801. $globals.ASTPreInliner);
  42802. $core.addClass("IRInlinedClosure", $globals.IRClosure, [], "Compiler-Inlining");
  42803. $globals.IRInlinedClosure.comment="I represent an inlined closure instruction.";
  42804. $core.addMethod(
  42805. $core.method({
  42806. selector: "acceptDagVisitor:",
  42807. protocol: "visiting",
  42808. fn: function (aVisitor){
  42809. var self=this,$self=this;
  42810. return $core.withContext(function($ctx1) {
  42811. $recv(aVisitor)._visitIRInlinedClosure_(self);
  42812. return self;
  42813. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedClosure)});
  42814. },
  42815. args: ["aVisitor"],
  42816. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedClosure: self",
  42817. referencedClasses: [],
  42818. messageSends: ["visitIRInlinedClosure:"]
  42819. }),
  42820. $globals.IRInlinedClosure);
  42821. $core.addMethod(
  42822. $core.method({
  42823. selector: "isInlined",
  42824. protocol: "testing",
  42825. fn: function (){
  42826. var self=this,$self=this;
  42827. return true;
  42828. },
  42829. args: [],
  42830. source: "isInlined\x0a\x09^ true",
  42831. referencedClasses: [],
  42832. messageSends: []
  42833. }),
  42834. $globals.IRInlinedClosure);
  42835. $core.addClass("IRInlinedSend", $globals.IRSend, [], "Compiler-Inlining");
  42836. $globals.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions.";
  42837. $core.addMethod(
  42838. $core.method({
  42839. selector: "acceptDagVisitor:",
  42840. protocol: "visiting",
  42841. fn: function (aVisitor){
  42842. var self=this,$self=this;
  42843. return $core.withContext(function($ctx1) {
  42844. $recv(aVisitor)._visitInlinedSend_(self);
  42845. return self;
  42846. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedSend)});
  42847. },
  42848. args: ["aVisitor"],
  42849. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitInlinedSend: self",
  42850. referencedClasses: [],
  42851. messageSends: ["visitInlinedSend:"]
  42852. }),
  42853. $globals.IRInlinedSend);
  42854. $core.addMethod(
  42855. $core.method({
  42856. selector: "internalVariables",
  42857. protocol: "accessing",
  42858. fn: function (){
  42859. var self=this,$self=this;
  42860. return [];
  42861. },
  42862. args: [],
  42863. source: "internalVariables\x0a\x09\x22Answer a collection of internal variables required \x0a\x09to perform the inlining\x22\x0a\x09\x0a\x09^ #()",
  42864. referencedClasses: [],
  42865. messageSends: []
  42866. }),
  42867. $globals.IRInlinedSend);
  42868. $core.addMethod(
  42869. $core.method({
  42870. selector: "isInlined",
  42871. protocol: "testing",
  42872. fn: function (){
  42873. var self=this,$self=this;
  42874. return true;
  42875. },
  42876. args: [],
  42877. source: "isInlined\x0a\x09^ true",
  42878. referencedClasses: [],
  42879. messageSends: []
  42880. }),
  42881. $globals.IRInlinedSend);
  42882. $core.addClass("IRInlinedIfFalse", $globals.IRInlinedSend, [], "Compiler-Inlining");
  42883. $globals.IRInlinedIfFalse.comment="I represent an inlined `#ifFalse:` message send instruction.";
  42884. $core.addMethod(
  42885. $core.method({
  42886. selector: "acceptDagVisitor:",
  42887. protocol: "visiting",
  42888. fn: function (aVisitor){
  42889. var self=this,$self=this;
  42890. return $core.withContext(function($ctx1) {
  42891. $recv(aVisitor)._visitIRInlinedIfFalse_(self);
  42892. return self;
  42893. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfFalse)});
  42894. },
  42895. args: ["aVisitor"],
  42896. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfFalse: self",
  42897. referencedClasses: [],
  42898. messageSends: ["visitIRInlinedIfFalse:"]
  42899. }),
  42900. $globals.IRInlinedIfFalse);
  42901. $core.addClass("IRInlinedIfNilIfNotNil", $globals.IRInlinedSend, [], "Compiler-Inlining");
  42902. $globals.IRInlinedIfNilIfNotNil.comment="I represent an inlined `#ifNil:ifNotNil:` message send instruction.";
  42903. $core.addMethod(
  42904. $core.method({
  42905. selector: "acceptDagVisitor:",
  42906. protocol: "visiting",
  42907. fn: function (aVisitor){
  42908. var self=this,$self=this;
  42909. return $core.withContext(function($ctx1) {
  42910. $recv(aVisitor)._visitIRInlinedIfNilIfNotNil_(self);
  42911. return self;
  42912. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfNilIfNotNil)});
  42913. },
  42914. args: ["aVisitor"],
  42915. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfNilIfNotNil: self",
  42916. referencedClasses: [],
  42917. messageSends: ["visitIRInlinedIfNilIfNotNil:"]
  42918. }),
  42919. $globals.IRInlinedIfNilIfNotNil);
  42920. $core.addMethod(
  42921. $core.method({
  42922. selector: "internalVariables",
  42923. protocol: "accessing",
  42924. fn: function (){
  42925. var self=this,$self=this;
  42926. return $core.withContext(function($ctx1) {
  42927. return $recv($globals.Array)._with_($self._receiverInternalVariable());
  42928. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRInlinedIfNilIfNotNil)});
  42929. },
  42930. args: [],
  42931. source: "internalVariables\x0a\x09^ Array with: self receiverInternalVariable",
  42932. referencedClasses: ["Array"],
  42933. messageSends: ["with:", "receiverInternalVariable"]
  42934. }),
  42935. $globals.IRInlinedIfNilIfNotNil);
  42936. $core.addMethod(
  42937. $core.method({
  42938. selector: "receiverInternalVariable",
  42939. protocol: "accessing",
  42940. fn: function (){
  42941. var self=this,$self=this;
  42942. return $core.withContext(function($ctx1) {
  42943. var $1;
  42944. $1=$recv($globals.IRVariable)._new();
  42945. $ctx1.sendIdx["new"]=1;
  42946. $recv($1)._variable_($recv($recv($globals.AliasVar)._new())._name_($self._receiverInternalVariableName()));
  42947. return $recv($1)._yourself();
  42948. }, function($ctx1) {$ctx1.fill(self,"receiverInternalVariable",{},$globals.IRInlinedIfNilIfNotNil)});
  42949. },
  42950. args: [],
  42951. source: "receiverInternalVariable\x0a\x09^ IRVariable new\x0a\x09\x09variable: (AliasVar new name: self receiverInternalVariableName);\x0a\x09\x09yourself.",
  42952. referencedClasses: ["IRVariable", "AliasVar"],
  42953. messageSends: ["variable:", "new", "name:", "receiverInternalVariableName", "yourself"]
  42954. }),
  42955. $globals.IRInlinedIfNilIfNotNil);
  42956. $core.addMethod(
  42957. $core.method({
  42958. selector: "receiverInternalVariableName",
  42959. protocol: "accessing",
  42960. fn: function (){
  42961. var self=this,$self=this;
  42962. return "$receiver";
  42963. },
  42964. args: [],
  42965. source: "receiverInternalVariableName\x0a\x09^ '$receiver'",
  42966. referencedClasses: [],
  42967. messageSends: []
  42968. }),
  42969. $globals.IRInlinedIfNilIfNotNil);
  42970. $core.addClass("IRInlinedIfTrue", $globals.IRInlinedSend, [], "Compiler-Inlining");
  42971. $globals.IRInlinedIfTrue.comment="I represent an inlined `#ifTrue:` message send instruction.";
  42972. $core.addMethod(
  42973. $core.method({
  42974. selector: "acceptDagVisitor:",
  42975. protocol: "visiting",
  42976. fn: function (aVisitor){
  42977. var self=this,$self=this;
  42978. return $core.withContext(function($ctx1) {
  42979. $recv(aVisitor)._visitIRInlinedIfTrue_(self);
  42980. return self;
  42981. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfTrue)});
  42982. },
  42983. args: ["aVisitor"],
  42984. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrue: self",
  42985. referencedClasses: [],
  42986. messageSends: ["visitIRInlinedIfTrue:"]
  42987. }),
  42988. $globals.IRInlinedIfTrue);
  42989. $core.addClass("IRInlinedIfTrueIfFalse", $globals.IRInlinedSend, [], "Compiler-Inlining");
  42990. $globals.IRInlinedIfTrueIfFalse.comment="I represent an inlined `#ifTrue:ifFalse:` message send instruction.";
  42991. $core.addMethod(
  42992. $core.method({
  42993. selector: "acceptDagVisitor:",
  42994. protocol: "visiting",
  42995. fn: function (aVisitor){
  42996. var self=this,$self=this;
  42997. return $core.withContext(function($ctx1) {
  42998. $recv(aVisitor)._visitIRInlinedIfTrueIfFalse_(self);
  42999. return self;
  43000. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfTrueIfFalse)});
  43001. },
  43002. args: ["aVisitor"],
  43003. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrueIfFalse: self",
  43004. referencedClasses: [],
  43005. messageSends: ["visitIRInlinedIfTrueIfFalse:"]
  43006. }),
  43007. $globals.IRInlinedIfTrueIfFalse);
  43008. $core.addClass("IRInlinedSequence", $globals.IRBlockSequence, [], "Compiler-Inlining");
  43009. $globals.IRInlinedSequence.comment="I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`).";
  43010. $core.addMethod(
  43011. $core.method({
  43012. selector: "acceptDagVisitor:",
  43013. protocol: "visiting",
  43014. fn: function (aVisitor){
  43015. var self=this,$self=this;
  43016. return $core.withContext(function($ctx1) {
  43017. $recv(aVisitor)._visitIRInlinedSequence_(self);
  43018. return self;
  43019. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedSequence)});
  43020. },
  43021. args: ["aVisitor"],
  43022. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedSequence: self",
  43023. referencedClasses: [],
  43024. messageSends: ["visitIRInlinedSequence:"]
  43025. }),
  43026. $globals.IRInlinedSequence);
  43027. $core.addMethod(
  43028. $core.method({
  43029. selector: "isInlined",
  43030. protocol: "testing",
  43031. fn: function (){
  43032. var self=this,$self=this;
  43033. return true;
  43034. },
  43035. args: [],
  43036. source: "isInlined\x0a\x09^ true",
  43037. referencedClasses: [],
  43038. messageSends: []
  43039. }),
  43040. $globals.IRInlinedSequence);
  43041. $core.addClass("IRInliner", $globals.IRVisitor, [], "Compiler-Inlining");
  43042. $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`";
  43043. $core.addMethod(
  43044. $core.method({
  43045. selector: "assignmentInliner",
  43046. protocol: "factory",
  43047. fn: function (){
  43048. var self=this,$self=this;
  43049. return $core.withContext(function($ctx1) {
  43050. var $1;
  43051. $1=$recv($globals.IRAssignmentInliner)._new();
  43052. $recv($1)._translator_(self);
  43053. return $recv($1)._yourself();
  43054. }, function($ctx1) {$ctx1.fill(self,"assignmentInliner",{},$globals.IRInliner)});
  43055. },
  43056. args: [],
  43057. source: "assignmentInliner\x0a\x09^ IRAssignmentInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  43058. referencedClasses: ["IRAssignmentInliner"],
  43059. messageSends: ["translator:", "new", "yourself"]
  43060. }),
  43061. $globals.IRInliner);
  43062. $core.addMethod(
  43063. $core.method({
  43064. selector: "returnInliner",
  43065. protocol: "factory",
  43066. fn: function (){
  43067. var self=this,$self=this;
  43068. return $core.withContext(function($ctx1) {
  43069. var $1;
  43070. $1=$recv($globals.IRReturnInliner)._new();
  43071. $recv($1)._translator_(self);
  43072. return $recv($1)._yourself();
  43073. }, function($ctx1) {$ctx1.fill(self,"returnInliner",{},$globals.IRInliner)});
  43074. },
  43075. args: [],
  43076. source: "returnInliner\x0a\x09^ IRReturnInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  43077. referencedClasses: ["IRReturnInliner"],
  43078. messageSends: ["translator:", "new", "yourself"]
  43079. }),
  43080. $globals.IRInliner);
  43081. $core.addMethod(
  43082. $core.method({
  43083. selector: "sendInliner",
  43084. protocol: "factory",
  43085. fn: function (){
  43086. var self=this,$self=this;
  43087. return $core.withContext(function($ctx1) {
  43088. var $1;
  43089. $1=$recv($globals.IRSendInliner)._new();
  43090. $recv($1)._translator_(self);
  43091. return $recv($1)._yourself();
  43092. }, function($ctx1) {$ctx1.fill(self,"sendInliner",{},$globals.IRInliner)});
  43093. },
  43094. args: [],
  43095. source: "sendInliner\x0a\x09^ IRSendInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  43096. referencedClasses: ["IRSendInliner"],
  43097. messageSends: ["translator:", "new", "yourself"]
  43098. }),
  43099. $globals.IRInliner);
  43100. $core.addMethod(
  43101. $core.method({
  43102. selector: "shouldInlineAssignment:",
  43103. protocol: "testing",
  43104. fn: function (anIRAssignment){
  43105. var self=this,$self=this;
  43106. return $core.withContext(function($ctx1) {
  43107. var $3,$2,$1;
  43108. $1=$recv($recv($recv(anIRAssignment)._isInlined())._not())._and_((function(){
  43109. return $core.withContext(function($ctx2) {
  43110. $3=$recv(anIRAssignment)._right();
  43111. $ctx2.sendIdx["right"]=1;
  43112. $2=$recv($3)._isSend();
  43113. return $recv($2)._and_((function(){
  43114. return $core.withContext(function($ctx3) {
  43115. return $self._shouldInlineSend_($recv(anIRAssignment)._right());
  43116. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  43117. }));
  43118. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43119. }));
  43120. $ctx1.sendIdx["and:"]=1;
  43121. return $1;
  43122. }, function($ctx1) {$ctx1.fill(self,"shouldInlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  43123. },
  43124. args: ["anIRAssignment"],
  43125. source: "shouldInlineAssignment: anIRAssignment\x0a\x09^ anIRAssignment isInlined not and: [\x0a\x09\x09anIRAssignment right isSend and: [\x0a\x09\x09\x09self shouldInlineSend: anIRAssignment right ]]",
  43126. referencedClasses: [],
  43127. messageSends: ["and:", "not", "isInlined", "isSend", "right", "shouldInlineSend:"]
  43128. }),
  43129. $globals.IRInliner);
  43130. $core.addMethod(
  43131. $core.method({
  43132. selector: "shouldInlineReturn:",
  43133. protocol: "testing",
  43134. fn: function (anIRReturn){
  43135. var self=this,$self=this;
  43136. return $core.withContext(function($ctx1) {
  43137. var $3,$2,$1;
  43138. $1=$recv($recv($recv(anIRReturn)._isInlined())._not())._and_((function(){
  43139. return $core.withContext(function($ctx2) {
  43140. $3=$recv(anIRReturn)._expression();
  43141. $ctx2.sendIdx["expression"]=1;
  43142. $2=$recv($3)._isSend();
  43143. return $recv($2)._and_((function(){
  43144. return $core.withContext(function($ctx3) {
  43145. return $self._shouldInlineSend_($recv(anIRReturn)._expression());
  43146. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  43147. }));
  43148. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43149. }));
  43150. $ctx1.sendIdx["and:"]=1;
  43151. return $1;
  43152. }, function($ctx1) {$ctx1.fill(self,"shouldInlineReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  43153. },
  43154. args: ["anIRReturn"],
  43155. source: "shouldInlineReturn: anIRReturn\x0a\x09^ anIRReturn isInlined not and: [\x0a\x09\x09anIRReturn expression isSend and: [\x0a\x09\x09\x09self shouldInlineSend: anIRReturn expression ]]",
  43156. referencedClasses: [],
  43157. messageSends: ["and:", "not", "isInlined", "isSend", "expression", "shouldInlineSend:"]
  43158. }),
  43159. $globals.IRInliner);
  43160. $core.addMethod(
  43161. $core.method({
  43162. selector: "shouldInlineSend:",
  43163. protocol: "testing",
  43164. fn: function (anIRSend){
  43165. var self=this,$self=this;
  43166. return $core.withContext(function($ctx1) {
  43167. return $recv($recv($recv(anIRSend)._isInlined())._not())._and_((function(){
  43168. return $core.withContext(function($ctx2) {
  43169. return $recv($globals.IRSendInliner)._shouldInline_(anIRSend);
  43170. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43171. }));
  43172. }, function($ctx1) {$ctx1.fill(self,"shouldInlineSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  43173. },
  43174. args: ["anIRSend"],
  43175. source: "shouldInlineSend: anIRSend\x0a\x09^ anIRSend isInlined not and: [\x0a\x09\x09IRSendInliner shouldInline: anIRSend ]",
  43176. referencedClasses: ["IRSendInliner"],
  43177. messageSends: ["and:", "not", "isInlined", "shouldInline:"]
  43178. }),
  43179. $globals.IRInliner);
  43180. $core.addMethod(
  43181. $core.method({
  43182. selector: "visitIRAssignment:",
  43183. protocol: "visiting",
  43184. fn: function (anIRAssignment){
  43185. var self=this,$self=this;
  43186. return $core.withContext(function($ctx1) {
  43187. var $1;
  43188. $1=$self._shouldInlineAssignment_(anIRAssignment);
  43189. if($core.assert($1)){
  43190. return $recv($self._assignmentInliner())._inlineAssignment_(anIRAssignment);
  43191. } else {
  43192. return (
  43193. $ctx1.supercall = true,
  43194. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRAssignment_.apply($self, [anIRAssignment]));
  43195. $ctx1.supercall = false;
  43196. }
  43197. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  43198. },
  43199. args: ["anIRAssignment"],
  43200. source: "visitIRAssignment: anIRAssignment\x0a\x09^ (self shouldInlineAssignment: anIRAssignment)\x0a\x09\x09ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]\x0a\x09\x09ifFalse: [ super visitIRAssignment: anIRAssignment ]",
  43201. referencedClasses: [],
  43202. messageSends: ["ifTrue:ifFalse:", "shouldInlineAssignment:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:"]
  43203. }),
  43204. $globals.IRInliner);
  43205. $core.addMethod(
  43206. $core.method({
  43207. selector: "visitIRNonLocalReturn:",
  43208. protocol: "visiting",
  43209. fn: function (anIRNonLocalReturn){
  43210. var self=this,$self=this;
  43211. var localReturn;
  43212. return $core.withContext(function($ctx1) {
  43213. var $2,$1,$4,$3,$5,$6,$7;
  43214. $2=$recv(anIRNonLocalReturn)._scope();
  43215. $ctx1.sendIdx["scope"]=1;
  43216. $1=$recv($2)._canInlineNonLocalReturns();
  43217. if($core.assert($1)){
  43218. $4=$recv(anIRNonLocalReturn)._scope();
  43219. $ctx1.sendIdx["scope"]=2;
  43220. $3=$recv($4)._methodScope();
  43221. $5=$recv(anIRNonLocalReturn)._scope();
  43222. $ctx1.sendIdx["scope"]=3;
  43223. $recv($3)._removeNonLocalReturn_($5);
  43224. $6=$recv($globals.IRReturn)._new();
  43225. $recv($6)._scope_($recv(anIRNonLocalReturn)._scope());
  43226. localReturn=$recv($6)._yourself();
  43227. $recv($recv(anIRNonLocalReturn)._dagChildren())._do_((function(each){
  43228. return $core.withContext(function($ctx2) {
  43229. return $recv(localReturn)._add_(each);
  43230. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  43231. }));
  43232. $recv(anIRNonLocalReturn)._replaceWith_(localReturn);
  43233. return $self._visitIRReturn_(localReturn);
  43234. }
  43235. $7=(
  43236. $ctx1.supercall = true,
  43237. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRNonLocalReturn_.apply($self, [anIRNonLocalReturn]));
  43238. $ctx1.supercall = false;
  43239. return $7;
  43240. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn,localReturn:localReturn},$globals.IRInliner)});
  43241. },
  43242. args: ["anIRNonLocalReturn"],
  43243. 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",
  43244. referencedClasses: ["IRReturn"],
  43245. messageSends: ["ifTrue:", "canInlineNonLocalReturns", "scope", "removeNonLocalReturn:", "methodScope", "scope:", "new", "yourself", "do:", "dagChildren", "add:", "replaceWith:", "visitIRReturn:", "visitIRNonLocalReturn:"]
  43246. }),
  43247. $globals.IRInliner);
  43248. $core.addMethod(
  43249. $core.method({
  43250. selector: "visitIRReturn:",
  43251. protocol: "visiting",
  43252. fn: function (anIRReturn){
  43253. var self=this,$self=this;
  43254. return $core.withContext(function($ctx1) {
  43255. var $1;
  43256. $1=$self._shouldInlineReturn_(anIRReturn);
  43257. if($core.assert($1)){
  43258. return $recv($self._returnInliner())._inlineReturn_(anIRReturn);
  43259. } else {
  43260. return (
  43261. $ctx1.supercall = true,
  43262. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRReturn_.apply($self, [anIRReturn]));
  43263. $ctx1.supercall = false;
  43264. }
  43265. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  43266. },
  43267. args: ["anIRReturn"],
  43268. source: "visitIRReturn: anIRReturn\x0a\x09^ (self shouldInlineReturn: anIRReturn)\x0a\x09\x09ifTrue: [ self returnInliner inlineReturn: anIRReturn ]\x0a\x09\x09ifFalse: [ super visitIRReturn: anIRReturn ]",
  43269. referencedClasses: [],
  43270. messageSends: ["ifTrue:ifFalse:", "shouldInlineReturn:", "inlineReturn:", "returnInliner", "visitIRReturn:"]
  43271. }),
  43272. $globals.IRInliner);
  43273. $core.addMethod(
  43274. $core.method({
  43275. selector: "visitIRSend:",
  43276. protocol: "visiting",
  43277. fn: function (anIRSend){
  43278. var self=this,$self=this;
  43279. return $core.withContext(function($ctx1) {
  43280. var $1;
  43281. $1=$self._shouldInlineSend_(anIRSend);
  43282. if($core.assert($1)){
  43283. return $recv($self._sendInliner())._inlineSend_(anIRSend);
  43284. } else {
  43285. return (
  43286. $ctx1.supercall = true,
  43287. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRSend_.apply($self, [anIRSend]));
  43288. $ctx1.supercall = false;
  43289. }
  43290. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  43291. },
  43292. args: ["anIRSend"],
  43293. source: "visitIRSend: anIRSend\x0a\x09^ (self shouldInlineSend: anIRSend)\x0a\x09\x09ifTrue: [ self sendInliner inlineSend: anIRSend ]\x0a\x09\x09ifFalse: [ super visitIRSend: anIRSend ]",
  43294. referencedClasses: [],
  43295. messageSends: ["ifTrue:ifFalse:", "shouldInlineSend:", "inlineSend:", "sendInliner", "visitIRSend:"]
  43296. }),
  43297. $globals.IRInliner);
  43298. $core.addClass("IRInliningJSTranslator", $globals.IRJSTranslator, [], "Compiler-Inlining");
  43299. $globals.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance).";
  43300. $core.addMethod(
  43301. $core.method({
  43302. selector: "visitIRInlinedClosure:",
  43303. protocol: "visiting",
  43304. fn: function (anIRInlinedClosure){
  43305. var self=this,$self=this;
  43306. return $core.withContext(function($ctx1) {
  43307. $recv($self._stream())._nextPutVars_($recv($recv(anIRInlinedClosure)._tempDeclarations())._collect_((function(each){
  43308. return $core.withContext(function($ctx2) {
  43309. return $recv($recv(each)._name())._asVariableName();
  43310. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43311. })));
  43312. $self._visitAll_($recv(anIRInlinedClosure)._dagChildren());
  43313. return self;
  43314. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRInliningJSTranslator)});
  43315. },
  43316. args: ["anIRInlinedClosure"],
  43317. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09self stream nextPutVars: (anIRInlinedClosure tempDeclarations collect: [ :each |\x0a\x09\x09each name asVariableName ]).\x0a\x09self visitAll: anIRInlinedClosure dagChildren",
  43318. referencedClasses: [],
  43319. messageSends: ["nextPutVars:", "stream", "collect:", "tempDeclarations", "asVariableName", "name", "visitAll:", "dagChildren"]
  43320. }),
  43321. $globals.IRInliningJSTranslator);
  43322. $core.addMethod(
  43323. $core.method({
  43324. selector: "visitIRInlinedIfFalse:",
  43325. protocol: "visiting",
  43326. fn: function (anIRInlinedIfFalse){
  43327. var self=this,$self=this;
  43328. return $core.withContext(function($ctx1) {
  43329. var $1,$2,$4,$3;
  43330. $1=$self._stream();
  43331. $ctx1.sendIdx["stream"]=1;
  43332. $recv($1)._nextPutIf_then_((function(){
  43333. return $core.withContext(function($ctx2) {
  43334. $2=$self._stream();
  43335. $ctx2.sendIdx["stream"]=2;
  43336. $recv($2)._nextPutAll_("!$core.assert(");
  43337. $ctx2.sendIdx["nextPutAll:"]=1;
  43338. $4=$recv(anIRInlinedIfFalse)._dagChildren();
  43339. $ctx2.sendIdx["dagChildren"]=1;
  43340. $3=$recv($4)._first();
  43341. $self._visit_($3);
  43342. $ctx2.sendIdx["visit:"]=1;
  43343. return $recv($self._stream())._nextPutAll_(")");
  43344. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43345. }),(function(){
  43346. return $core.withContext(function($ctx2) {
  43347. return $self._visit_($recv($recv(anIRInlinedIfFalse)._dagChildren())._last());
  43348. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43349. }));
  43350. return self;
  43351. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfFalse:",{anIRInlinedIfFalse:anIRInlinedIfFalse},$globals.IRInliningJSTranslator)});
  43352. },
  43353. args: ["anIRInlinedIfFalse"],
  43354. 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 ]",
  43355. referencedClasses: [],
  43356. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "last"]
  43357. }),
  43358. $globals.IRInliningJSTranslator);
  43359. $core.addMethod(
  43360. $core.method({
  43361. selector: "visitIRInlinedIfNilIfNotNil:",
  43362. protocol: "visiting",
  43363. fn: function (anIRInlinedIfNilIfNotNil){
  43364. var self=this,$self=this;
  43365. return $core.withContext(function($ctx1) {
  43366. var $1,$2,$4,$3,$6,$5,$7,$8,$10,$9;
  43367. $1=$self._stream();
  43368. $ctx1.sendIdx["stream"]=1;
  43369. $recv($1)._nextPutIf_then_else_((function(){
  43370. var recvVarName;
  43371. return $core.withContext(function($ctx2) {
  43372. recvVarName=$recv(anIRInlinedIfNilIfNotNil)._receiverInternalVariableName();
  43373. $2=$self._stream();
  43374. $ctx2.sendIdx["stream"]=2;
  43375. $4="(".__comma(recvVarName);
  43376. $ctx2.sendIdx[","]=2;
  43377. $3=$recv($4).__comma(" = ");
  43378. $ctx2.sendIdx[","]=1;
  43379. $recv($2)._nextPutAll_($3);
  43380. $ctx2.sendIdx["nextPutAll:"]=1;
  43381. $6=$recv(anIRInlinedIfNilIfNotNil)._dagChildren();
  43382. $ctx2.sendIdx["dagChildren"]=1;
  43383. $5=$recv($6)._first();
  43384. $self._visit_($5);
  43385. $ctx2.sendIdx["visit:"]=1;
  43386. $7=$self._stream();
  43387. $8=$recv(") == null || ".__comma(recvVarName)).__comma(".a$nil");
  43388. $ctx2.sendIdx[","]=3;
  43389. return $recv($7)._nextPutAll_($8);
  43390. }, function($ctx2) {$ctx2.fillBlock({recvVarName:recvVarName},$ctx1,1)});
  43391. }),(function(){
  43392. return $core.withContext(function($ctx2) {
  43393. $10=$recv(anIRInlinedIfNilIfNotNil)._dagChildren();
  43394. $ctx2.sendIdx["dagChildren"]=2;
  43395. $9=$recv($10)._second();
  43396. return $self._visit_($9);
  43397. $ctx2.sendIdx["visit:"]=2;
  43398. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43399. }),(function(){
  43400. return $core.withContext(function($ctx2) {
  43401. return $self._visit_($recv($recv(anIRInlinedIfNilIfNotNil)._dagChildren())._third());
  43402. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  43403. }));
  43404. return self;
  43405. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNilIfNotNil:",{anIRInlinedIfNilIfNotNil:anIRInlinedIfNilIfNotNil},$globals.IRInliningJSTranslator)});
  43406. },
  43407. args: ["anIRInlinedIfNilIfNotNil"],
  43408. 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 ]",
  43409. referencedClasses: [],
  43410. messageSends: ["nextPutIf:then:else:", "stream", "receiverInternalVariableName", "nextPutAll:", ",", "visit:", "first", "dagChildren", "second", "third"]
  43411. }),
  43412. $globals.IRInliningJSTranslator);
  43413. $core.addMethod(
  43414. $core.method({
  43415. selector: "visitIRInlinedIfTrue:",
  43416. protocol: "visiting",
  43417. fn: function (anIRInlinedIfTrue){
  43418. var self=this,$self=this;
  43419. return $core.withContext(function($ctx1) {
  43420. var $1,$2,$4,$3;
  43421. $1=$self._stream();
  43422. $ctx1.sendIdx["stream"]=1;
  43423. $recv($1)._nextPutIf_then_((function(){
  43424. return $core.withContext(function($ctx2) {
  43425. $2=$self._stream();
  43426. $ctx2.sendIdx["stream"]=2;
  43427. $recv($2)._nextPutAll_("$core.assert(");
  43428. $ctx2.sendIdx["nextPutAll:"]=1;
  43429. $4=$recv(anIRInlinedIfTrue)._dagChildren();
  43430. $ctx2.sendIdx["dagChildren"]=1;
  43431. $3=$recv($4)._first();
  43432. $self._visit_($3);
  43433. $ctx2.sendIdx["visit:"]=1;
  43434. return $recv($self._stream())._nextPutAll_(")");
  43435. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43436. }),(function(){
  43437. return $core.withContext(function($ctx2) {
  43438. return $self._visit_($recv($recv(anIRInlinedIfTrue)._dagChildren())._last());
  43439. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43440. }));
  43441. return self;
  43442. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrue:",{anIRInlinedIfTrue:anIRInlinedIfTrue},$globals.IRInliningJSTranslator)});
  43443. },
  43444. args: ["anIRInlinedIfTrue"],
  43445. 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 ]",
  43446. referencedClasses: [],
  43447. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "last"]
  43448. }),
  43449. $globals.IRInliningJSTranslator);
  43450. $core.addMethod(
  43451. $core.method({
  43452. selector: "visitIRInlinedIfTrueIfFalse:",
  43453. protocol: "visiting",
  43454. fn: function (anIRInlinedIfTrueIfFalse){
  43455. var self=this,$self=this;
  43456. return $core.withContext(function($ctx1) {
  43457. var $1,$2,$4,$3,$6,$5;
  43458. $1=$self._stream();
  43459. $ctx1.sendIdx["stream"]=1;
  43460. $recv($1)._nextPutIf_then_else_((function(){
  43461. return $core.withContext(function($ctx2) {
  43462. $2=$self._stream();
  43463. $ctx2.sendIdx["stream"]=2;
  43464. $recv($2)._nextPutAll_("$core.assert(");
  43465. $ctx2.sendIdx["nextPutAll:"]=1;
  43466. $4=$recv(anIRInlinedIfTrueIfFalse)._dagChildren();
  43467. $ctx2.sendIdx["dagChildren"]=1;
  43468. $3=$recv($4)._first();
  43469. $self._visit_($3);
  43470. $ctx2.sendIdx["visit:"]=1;
  43471. return $recv($self._stream())._nextPutAll_(")");
  43472. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43473. }),(function(){
  43474. return $core.withContext(function($ctx2) {
  43475. $6=$recv(anIRInlinedIfTrueIfFalse)._dagChildren();
  43476. $ctx2.sendIdx["dagChildren"]=2;
  43477. $5=$recv($6)._second();
  43478. return $self._visit_($5);
  43479. $ctx2.sendIdx["visit:"]=2;
  43480. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43481. }),(function(){
  43482. return $core.withContext(function($ctx2) {
  43483. return $self._visit_($recv($recv(anIRInlinedIfTrueIfFalse)._dagChildren())._third());
  43484. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  43485. }));
  43486. return self;
  43487. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrueIfFalse:",{anIRInlinedIfTrueIfFalse:anIRInlinedIfTrueIfFalse},$globals.IRInliningJSTranslator)});
  43488. },
  43489. args: ["anIRInlinedIfTrueIfFalse"],
  43490. 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 ]",
  43491. referencedClasses: [],
  43492. messageSends: ["nextPutIf:then:else:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "second", "third"]
  43493. }),
  43494. $globals.IRInliningJSTranslator);
  43495. $core.addClass("IRSendInliner", $globals.Object, ["send", "translator"], "Compiler-Inlining");
  43496. $globals.IRSendInliner.comment="I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods.";
  43497. $core.addMethod(
  43498. $core.method({
  43499. selector: "ifFalse:",
  43500. protocol: "inlining",
  43501. fn: function (anIRInstruction){
  43502. var self=this,$self=this;
  43503. return $core.withContext(function($ctx1) {
  43504. return $self._inlinedSend_withBlock_($recv($globals.IRInlinedIfFalse)._new(),anIRInstruction);
  43505. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43506. },
  43507. args: ["anIRInstruction"],
  43508. source: "ifFalse: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfFalse new withBlock: anIRInstruction",
  43509. referencedClasses: ["IRInlinedIfFalse"],
  43510. messageSends: ["inlinedSend:withBlock:", "new"]
  43511. }),
  43512. $globals.IRSendInliner);
  43513. $core.addMethod(
  43514. $core.method({
  43515. selector: "ifFalse:ifTrue:",
  43516. protocol: "inlining",
  43517. fn: function (anIRInstruction,anotherIRInstruction){
  43518. var self=this,$self=this;
  43519. return $core.withContext(function($ctx1) {
  43520. return $self._perform_withArguments_("ifTrue:ifFalse:",[anotherIRInstruction,anIRInstruction]);
  43521. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43522. },
  43523. args: ["anIRInstruction", "anotherIRInstruction"],
  43524. source: "ifFalse: anIRInstruction ifTrue: anotherIRInstruction\x0a\x09^ self perform: #ifTrue:ifFalse: withArguments: { anotherIRInstruction. anIRInstruction }",
  43525. referencedClasses: [],
  43526. messageSends: ["perform:withArguments:"]
  43527. }),
  43528. $globals.IRSendInliner);
  43529. $core.addMethod(
  43530. $core.method({
  43531. selector: "ifNil:",
  43532. protocol: "inlining",
  43533. fn: function (anIRInstruction){
  43534. var self=this,$self=this;
  43535. return $core.withContext(function($ctx1) {
  43536. var $1,$3,$5,$6,$4,$2;
  43537. $1=$recv($globals.IRInlinedIfNilIfNotNil)._new();
  43538. $ctx1.sendIdx["new"]=1;
  43539. $3=$recv($globals.IRClosure)._new();
  43540. $ctx1.sendIdx["new"]=2;
  43541. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  43542. $5=$recv($globals.IRBlockSequence)._new();
  43543. $recv($5)._add_($recv($self._send())._receiver());
  43544. $6=$recv($5)._yourself();
  43545. $ctx1.sendIdx["yourself"]=1;
  43546. $4=$6;
  43547. $recv($3)._add_($4);
  43548. $ctx1.sendIdx["add:"]=1;
  43549. $2=$recv($3)._yourself();
  43550. return $self._inlinedSend_withBlock_withBlock_($1,anIRInstruction,$2);
  43551. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43552. },
  43553. args: ["anIRInstruction"],
  43554. 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)",
  43555. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  43556. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "receiver", "send", "yourself"]
  43557. }),
  43558. $globals.IRSendInliner);
  43559. $core.addMethod(
  43560. $core.method({
  43561. selector: "ifNil:ifNotNil:",
  43562. protocol: "inlining",
  43563. fn: function (anIRInstruction,anotherIRInstruction){
  43564. var self=this,$self=this;
  43565. return $core.withContext(function($ctx1) {
  43566. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anIRInstruction,anotherIRInstruction);
  43567. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43568. },
  43569. args: ["anIRInstruction", "anotherIRInstruction"],
  43570. source: "ifNil: anIRInstruction ifNotNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  43571. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  43572. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  43573. }),
  43574. $globals.IRSendInliner);
  43575. $core.addMethod(
  43576. $core.method({
  43577. selector: "ifNotNil:",
  43578. protocol: "inlining",
  43579. fn: function (anIRInstruction){
  43580. var self=this,$self=this;
  43581. return $core.withContext(function($ctx1) {
  43582. var $1,$3,$5,$6,$4,$2;
  43583. $1=$recv($globals.IRInlinedIfNilIfNotNil)._new();
  43584. $ctx1.sendIdx["new"]=1;
  43585. $3=$recv($globals.IRClosure)._new();
  43586. $ctx1.sendIdx["new"]=2;
  43587. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  43588. $5=$recv($globals.IRBlockSequence)._new();
  43589. $recv($5)._add_($recv($self._send())._receiver());
  43590. $6=$recv($5)._yourself();
  43591. $ctx1.sendIdx["yourself"]=1;
  43592. $4=$6;
  43593. $recv($3)._add_($4);
  43594. $ctx1.sendIdx["add:"]=1;
  43595. $2=$recv($3)._yourself();
  43596. return $self._inlinedSend_withBlock_withBlock_($1,$2,anIRInstruction);
  43597. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43598. },
  43599. args: ["anIRInstruction"],
  43600. 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",
  43601. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  43602. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "receiver", "send", "yourself"]
  43603. }),
  43604. $globals.IRSendInliner);
  43605. $core.addMethod(
  43606. $core.method({
  43607. selector: "ifNotNil:ifNil:",
  43608. protocol: "inlining",
  43609. fn: function (anIRInstruction,anotherIRInstruction){
  43610. var self=this,$self=this;
  43611. return $core.withContext(function($ctx1) {
  43612. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anotherIRInstruction,anIRInstruction);
  43613. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43614. },
  43615. args: ["anIRInstruction", "anotherIRInstruction"],
  43616. source: "ifNotNil: anIRInstruction ifNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anotherIRInstruction withBlock: anIRInstruction",
  43617. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  43618. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  43619. }),
  43620. $globals.IRSendInliner);
  43621. $core.addMethod(
  43622. $core.method({
  43623. selector: "ifTrue:",
  43624. protocol: "inlining",
  43625. fn: function (anIRInstruction){
  43626. var self=this,$self=this;
  43627. return $core.withContext(function($ctx1) {
  43628. return $self._inlinedSend_withBlock_($recv($globals.IRInlinedIfTrue)._new(),anIRInstruction);
  43629. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43630. },
  43631. args: ["anIRInstruction"],
  43632. source: "ifTrue: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrue new withBlock: anIRInstruction",
  43633. referencedClasses: ["IRInlinedIfTrue"],
  43634. messageSends: ["inlinedSend:withBlock:", "new"]
  43635. }),
  43636. $globals.IRSendInliner);
  43637. $core.addMethod(
  43638. $core.method({
  43639. selector: "ifTrue:ifFalse:",
  43640. protocol: "inlining",
  43641. fn: function (anIRInstruction,anotherIRInstruction){
  43642. var self=this,$self=this;
  43643. return $core.withContext(function($ctx1) {
  43644. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfTrueIfFalse)._new(),anIRInstruction,anotherIRInstruction);
  43645. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43646. },
  43647. args: ["anIRInstruction", "anotherIRInstruction"],
  43648. source: "ifTrue: anIRInstruction ifFalse: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrueIfFalse new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  43649. referencedClasses: ["IRInlinedIfTrueIfFalse"],
  43650. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  43651. }),
  43652. $globals.IRSendInliner);
  43653. $core.addMethod(
  43654. $core.method({
  43655. selector: "inlineClosure:",
  43656. protocol: "inlining",
  43657. fn: function (anIRClosure){
  43658. var self=this,$self=this;
  43659. var inlinedClosure,sequence,statements;
  43660. return $core.withContext(function($ctx1) {
  43661. var $1,$2,$3,$5,$6,$4,$7,$9,$11,$13,$14,$15,$12,$10,$17,$19,$20,$18,$16,$8;
  43662. inlinedClosure=$self._inlinedClosure();
  43663. $1=inlinedClosure;
  43664. $2=$recv(anIRClosure)._scope();
  43665. $ctx1.sendIdx["scope"]=1;
  43666. $recv($1)._scope_($2);
  43667. $ctx1.sendIdx["scope:"]=1;
  43668. $recv($1)._parent_($recv(anIRClosure)._parent());
  43669. $recv($recv(anIRClosure)._tempDeclarations())._do_((function(each){
  43670. return $core.withContext(function($ctx2) {
  43671. return $recv(inlinedClosure)._add_(each);
  43672. $ctx2.sendIdx["add:"]=1;
  43673. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43674. }));
  43675. $ctx1.sendIdx["do:"]=1;
  43676. sequence=$self._inlinedSequence();
  43677. $recv($recv(anIRClosure)._arguments())._do_((function(each){
  43678. return $core.withContext(function($ctx2) {
  43679. $3=inlinedClosure;
  43680. $5=$recv($globals.IRTempDeclaration)._new();
  43681. $ctx2.sendIdx["new"]=1;
  43682. $recv($5)._name_(each);
  43683. $ctx2.sendIdx["name:"]=1;
  43684. $6=$recv($5)._yourself();
  43685. $ctx2.sendIdx["yourself"]=1;
  43686. $4=$6;
  43687. $recv($3)._add_($4);
  43688. $ctx2.sendIdx["add:"]=2;
  43689. $7=sequence;
  43690. $9=$recv($globals.IRAssignment)._new();
  43691. $ctx2.sendIdx["new"]=2;
  43692. $11=$recv($globals.IRVariable)._new();
  43693. $ctx2.sendIdx["new"]=3;
  43694. $13=$recv($globals.AliasVar)._new();
  43695. $ctx2.sendIdx["new"]=4;
  43696. $14=$recv(inlinedClosure)._scope();
  43697. $ctx2.sendIdx["scope"]=2;
  43698. $recv($13)._scope_($14);
  43699. $ctx2.sendIdx["scope:"]=2;
  43700. $recv($13)._name_(each);
  43701. $ctx2.sendIdx["name:"]=2;
  43702. $15=$recv($13)._yourself();
  43703. $ctx2.sendIdx["yourself"]=2;
  43704. $12=$15;
  43705. $10=$recv($11)._variable_($12);
  43706. $ctx2.sendIdx["variable:"]=1;
  43707. $recv($9)._add_($10);
  43708. $ctx2.sendIdx["add:"]=4;
  43709. $17=$recv($globals.IRVariable)._new();
  43710. $ctx2.sendIdx["new"]=5;
  43711. $19=$recv($globals.AliasVar)._new();
  43712. $recv($19)._scope_($recv(inlinedClosure)._scope());
  43713. $recv($19)._name_("$receiver");
  43714. $20=$recv($19)._yourself();
  43715. $ctx2.sendIdx["yourself"]=3;
  43716. $18=$20;
  43717. $16=$recv($17)._variable_($18);
  43718. $recv($9)._add_($16);
  43719. $ctx2.sendIdx["add:"]=5;
  43720. $8=$recv($9)._yourself();
  43721. return $recv($7)._add_($8);
  43722. $ctx2.sendIdx["add:"]=3;
  43723. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  43724. }));
  43725. $ctx1.sendIdx["do:"]=2;
  43726. $recv(inlinedClosure)._add_(sequence);
  43727. $ctx1.sendIdx["add:"]=6;
  43728. statements=$recv($recv(anIRClosure)._sequence())._dagChildren();
  43729. $recv(statements)._ifNotEmpty_((function(){
  43730. return $core.withContext(function($ctx2) {
  43731. $recv($recv(statements)._allButLast())._do_((function(each){
  43732. return $core.withContext(function($ctx3) {
  43733. return $recv(sequence)._add_(each);
  43734. $ctx3.sendIdx["add:"]=7;
  43735. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,4)});
  43736. }));
  43737. return $recv(sequence)._add_($recv($recv(statements)._last())._asInlinedBlockResult());
  43738. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  43739. }));
  43740. return inlinedClosure;
  43741. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,sequence:sequence,statements:statements},$globals.IRSendInliner)});
  43742. },
  43743. args: ["anIRClosure"],
  43744. 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",
  43745. referencedClasses: ["IRTempDeclaration", "IRAssignment", "IRVariable", "AliasVar"],
  43746. messageSends: ["inlinedClosure", "scope:", "scope", "parent:", "parent", "do:", "tempDeclarations", "add:", "inlinedSequence", "arguments", "name:", "new", "yourself", "variable:", "dagChildren", "sequence", "ifNotEmpty:", "allButLast", "asInlinedBlockResult", "last"]
  43747. }),
  43748. $globals.IRSendInliner);
  43749. $core.addMethod(
  43750. $core.method({
  43751. selector: "inlineSend:",
  43752. protocol: "inlining",
  43753. fn: function (anIRSend){
  43754. var self=this,$self=this;
  43755. return $core.withContext(function($ctx1) {
  43756. var $2,$1;
  43757. $self._send_(anIRSend);
  43758. $2=$self._send();
  43759. $ctx1.sendIdx["send"]=1;
  43760. $1=$recv($2)._selector();
  43761. return $self._perform_withArguments_($1,$recv($self._send())._arguments());
  43762. }, function($ctx1) {$ctx1.fill(self,"inlineSend:",{anIRSend:anIRSend},$globals.IRSendInliner)});
  43763. },
  43764. args: ["anIRSend"],
  43765. source: "inlineSend: anIRSend\x0a\x09self send: anIRSend.\x0a\x09^ self\x0a\x09\x09perform: self send selector\x0a\x09\x09withArguments: self send arguments",
  43766. referencedClasses: [],
  43767. messageSends: ["send:", "perform:withArguments:", "selector", "send", "arguments"]
  43768. }),
  43769. $globals.IRSendInliner);
  43770. $core.addMethod(
  43771. $core.method({
  43772. selector: "inlineSend:andReplace:",
  43773. protocol: "private",
  43774. fn: function (anIRSend,anIRInstruction){
  43775. var self=this,$self=this;
  43776. return $core.withContext(function($ctx1) {
  43777. $recv(anIRInstruction)._replaceWith_(anIRSend);
  43778. return $self._inlineSend_(anIRSend);
  43779. }, function($ctx1) {$ctx1.fill(self,"inlineSend:andReplace:",{anIRSend:anIRSend,anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43780. },
  43781. args: ["anIRSend", "anIRInstruction"],
  43782. source: "inlineSend: anIRSend andReplace: anIRInstruction\x0a\x09anIRInstruction replaceWith: anIRSend.\x0a\x09^ self inlineSend: anIRSend",
  43783. referencedClasses: [],
  43784. messageSends: ["replaceWith:", "inlineSend:"]
  43785. }),
  43786. $globals.IRSendInliner);
  43787. $core.addMethod(
  43788. $core.method({
  43789. selector: "inlinedClosure",
  43790. protocol: "factory",
  43791. fn: function (){
  43792. var self=this,$self=this;
  43793. return $core.withContext(function($ctx1) {
  43794. return $recv($globals.IRInlinedClosure)._new();
  43795. }, function($ctx1) {$ctx1.fill(self,"inlinedClosure",{},$globals.IRSendInliner)});
  43796. },
  43797. args: [],
  43798. source: "inlinedClosure\x0a\x09^ IRInlinedClosure new",
  43799. referencedClasses: ["IRInlinedClosure"],
  43800. messageSends: ["new"]
  43801. }),
  43802. $globals.IRSendInliner);
  43803. $core.addMethod(
  43804. $core.method({
  43805. selector: "inlinedSend:withBlock:",
  43806. protocol: "private",
  43807. fn: function (inlinedSend,anIRInstruction){
  43808. var self=this,$self=this;
  43809. var inlinedClosure;
  43810. return $core.withContext(function($ctx1) {
  43811. var $1,$2,$4,$3,$5;
  43812. $1=$recv(anIRInstruction)._isClosure();
  43813. if(!$core.assert($1)){
  43814. $self._inliningError_("Message argument should be a block");
  43815. $ctx1.sendIdx["inliningError:"]=1;
  43816. }
  43817. $2=$recv($recv($recv(anIRInstruction)._arguments())._size()).__eq((0));
  43818. if(!$core.assert($2)){
  43819. $self._inliningError_("Inlined block should have zero argument");
  43820. }
  43821. inlinedClosure=$recv($self._translator())._visit_($self._inlineClosure_(anIRInstruction));
  43822. $4=$self._send();
  43823. $ctx1.sendIdx["send"]=1;
  43824. $3=$recv($4)._receiver();
  43825. $recv(inlinedSend)._add_($3);
  43826. $ctx1.sendIdx["add:"]=1;
  43827. $recv(inlinedSend)._add_(inlinedClosure);
  43828. $recv($self._send())._replaceWith_(inlinedSend);
  43829. $5=$recv($recv(inlinedSend)._method())._internalVariables();
  43830. $ctx1.sendIdx["internalVariables"]=1;
  43831. $recv($5)._addAll_($recv(inlinedSend)._internalVariables());
  43832. return inlinedSend;
  43833. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,inlinedClosure:inlinedClosure},$globals.IRSendInliner)});
  43834. },
  43835. args: ["inlinedSend", "anIRInstruction"],
  43836. 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",
  43837. referencedClasses: [],
  43838. messageSends: ["ifFalse:", "isClosure", "inliningError:", "=", "size", "arguments", "visit:", "translator", "inlineClosure:", "add:", "receiver", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  43839. }),
  43840. $globals.IRSendInliner);
  43841. $core.addMethod(
  43842. $core.method({
  43843. selector: "inlinedSend:withBlock:withBlock:",
  43844. protocol: "private",
  43845. fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){
  43846. var self=this,$self=this;
  43847. var inlinedClosure1,inlinedClosure2;
  43848. return $core.withContext(function($ctx1) {
  43849. var $1,$2,$3,$4,$6,$5,$7;
  43850. $1=$recv(anIRInstruction)._isClosure();
  43851. $ctx1.sendIdx["isClosure"]=1;
  43852. if(!$core.assert($1)){
  43853. $self._inliningError_("Message argument should be a block");
  43854. $ctx1.sendIdx["inliningError:"]=1;
  43855. }
  43856. $2=$recv(anotherIRInstruction)._isClosure();
  43857. if(!$core.assert($2)){
  43858. $self._inliningError_("Message argument should be a block");
  43859. }
  43860. $3=$self._translator();
  43861. $ctx1.sendIdx["translator"]=1;
  43862. $4=$self._inlineClosure_(anIRInstruction);
  43863. $ctx1.sendIdx["inlineClosure:"]=1;
  43864. inlinedClosure1=$recv($3)._visit_($4);
  43865. $ctx1.sendIdx["visit:"]=1;
  43866. inlinedClosure2=$recv($self._translator())._visit_($self._inlineClosure_(anotherIRInstruction));
  43867. $6=$self._send();
  43868. $ctx1.sendIdx["send"]=1;
  43869. $5=$recv($6)._receiver();
  43870. $recv(inlinedSend)._add_($5);
  43871. $ctx1.sendIdx["add:"]=1;
  43872. $recv(inlinedSend)._add_(inlinedClosure1);
  43873. $ctx1.sendIdx["add:"]=2;
  43874. $recv(inlinedSend)._add_(inlinedClosure2);
  43875. $recv($self._send())._replaceWith_(inlinedSend);
  43876. $7=$recv($recv(inlinedSend)._method())._internalVariables();
  43877. $ctx1.sendIdx["internalVariables"]=1;
  43878. $recv($7)._addAll_($recv(inlinedSend)._internalVariables());
  43879. return inlinedSend;
  43880. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction,inlinedClosure1:inlinedClosure1,inlinedClosure2:inlinedClosure2},$globals.IRSendInliner)});
  43881. },
  43882. args: ["inlinedSend", "anIRInstruction", "anotherIRInstruction"],
  43883. 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",
  43884. referencedClasses: [],
  43885. messageSends: ["ifFalse:", "isClosure", "inliningError:", "visit:", "translator", "inlineClosure:", "add:", "receiver", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  43886. }),
  43887. $globals.IRSendInliner);
  43888. $core.addMethod(
  43889. $core.method({
  43890. selector: "inlinedSequence",
  43891. protocol: "factory",
  43892. fn: function (){
  43893. var self=this,$self=this;
  43894. return $core.withContext(function($ctx1) {
  43895. return $recv($globals.IRInlinedSequence)._new();
  43896. }, function($ctx1) {$ctx1.fill(self,"inlinedSequence",{},$globals.IRSendInliner)});
  43897. },
  43898. args: [],
  43899. source: "inlinedSequence\x0a\x09^ IRInlinedSequence new",
  43900. referencedClasses: ["IRInlinedSequence"],
  43901. messageSends: ["new"]
  43902. }),
  43903. $globals.IRSendInliner);
  43904. $core.addMethod(
  43905. $core.method({
  43906. selector: "inliningError:",
  43907. protocol: "error handling",
  43908. fn: function (aString){
  43909. var self=this,$self=this;
  43910. return $core.withContext(function($ctx1) {
  43911. $recv($globals.InliningError)._signal_(aString);
  43912. return self;
  43913. }, function($ctx1) {$ctx1.fill(self,"inliningError:",{aString:aString},$globals.IRSendInliner)});
  43914. },
  43915. args: ["aString"],
  43916. source: "inliningError: aString\x0a\x09InliningError signal: aString",
  43917. referencedClasses: ["InliningError"],
  43918. messageSends: ["signal:"]
  43919. }),
  43920. $globals.IRSendInliner);
  43921. $core.addMethod(
  43922. $core.method({
  43923. selector: "send",
  43924. protocol: "accessing",
  43925. fn: function (){
  43926. var self=this,$self=this;
  43927. return $self["@send"];
  43928. },
  43929. args: [],
  43930. source: "send\x0a\x09^ send",
  43931. referencedClasses: [],
  43932. messageSends: []
  43933. }),
  43934. $globals.IRSendInliner);
  43935. $core.addMethod(
  43936. $core.method({
  43937. selector: "send:",
  43938. protocol: "accessing",
  43939. fn: function (anIRSend){
  43940. var self=this,$self=this;
  43941. $self["@send"]=anIRSend;
  43942. return self;
  43943. },
  43944. args: ["anIRSend"],
  43945. source: "send: anIRSend\x0a\x09send := anIRSend",
  43946. referencedClasses: [],
  43947. messageSends: []
  43948. }),
  43949. $globals.IRSendInliner);
  43950. $core.addMethod(
  43951. $core.method({
  43952. selector: "translator",
  43953. protocol: "accessing",
  43954. fn: function (){
  43955. var self=this,$self=this;
  43956. return $self["@translator"];
  43957. },
  43958. args: [],
  43959. source: "translator\x0a\x09^ translator",
  43960. referencedClasses: [],
  43961. messageSends: []
  43962. }),
  43963. $globals.IRSendInliner);
  43964. $core.addMethod(
  43965. $core.method({
  43966. selector: "translator:",
  43967. protocol: "accessing",
  43968. fn: function (anASTTranslator){
  43969. var self=this,$self=this;
  43970. $self["@translator"]=anASTTranslator;
  43971. return self;
  43972. },
  43973. args: ["anASTTranslator"],
  43974. source: "translator: anASTTranslator\x0a\x09translator := anASTTranslator",
  43975. referencedClasses: [],
  43976. messageSends: []
  43977. }),
  43978. $globals.IRSendInliner);
  43979. $core.addMethod(
  43980. $core.method({
  43981. selector: "inlinedSelectors",
  43982. protocol: "accessing",
  43983. fn: function (){
  43984. var self=this,$self=this;
  43985. return ["ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:", "ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"];
  43986. },
  43987. args: [],
  43988. source: "inlinedSelectors\x0a\x09^ #('ifTrue:' 'ifFalse:' 'ifTrue:ifFalse:' 'ifFalse:ifTrue:' 'ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil:')",
  43989. referencedClasses: [],
  43990. messageSends: []
  43991. }),
  43992. $globals.IRSendInliner.a$cls);
  43993. $core.addMethod(
  43994. $core.method({
  43995. selector: "shouldInline:",
  43996. protocol: "accessing",
  43997. fn: function (anIRSend){
  43998. var self=this,$self=this;
  43999. return $core.withContext(function($ctx1) {
  44000. var $1;
  44001. $1=$recv($self._inlinedSelectors())._includes_($recv(anIRSend)._selector());
  44002. if(!$core.assert($1)){
  44003. return false;
  44004. }
  44005. return $recv($recv(anIRSend)._arguments())._allSatisfy_((function(each){
  44006. return $core.withContext(function($ctx2) {
  44007. return $recv(each)._isClosure();
  44008. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  44009. }));
  44010. }, function($ctx1) {$ctx1.fill(self,"shouldInline:",{anIRSend:anIRSend},$globals.IRSendInliner.a$cls)});
  44011. },
  44012. args: ["anIRSend"],
  44013. source: "shouldInline: anIRSend\x0a\x09(self inlinedSelectors includes: anIRSend selector) ifFalse: [ ^ false ].\x0a\x09^ anIRSend arguments allSatisfy: [ :each | each isClosure ]",
  44014. referencedClasses: [],
  44015. messageSends: ["ifFalse:", "includes:", "inlinedSelectors", "selector", "allSatisfy:", "arguments", "isClosure"]
  44016. }),
  44017. $globals.IRSendInliner.a$cls);
  44018. $core.addClass("IRAssignmentInliner", $globals.IRSendInliner, ["target"], "Compiler-Inlining");
  44019. $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};";
  44020. $core.addMethod(
  44021. $core.method({
  44022. selector: "inlineAssignment:",
  44023. protocol: "inlining",
  44024. fn: function (anIRAssignment){
  44025. var self=this,$self=this;
  44026. return $core.withContext(function($ctx1) {
  44027. $self._target_($recv(anIRAssignment)._left());
  44028. return $self._inlineSend_andReplace_($recv(anIRAssignment)._right(),anIRAssignment);
  44029. }, function($ctx1) {$ctx1.fill(self,"inlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRAssignmentInliner)});
  44030. },
  44031. args: ["anIRAssignment"],
  44032. source: "inlineAssignment: anIRAssignment\x0a\x09self target: anIRAssignment left.\x0a\x09^ self inlineSend: anIRAssignment right andReplace: anIRAssignment",
  44033. referencedClasses: [],
  44034. messageSends: ["target:", "left", "inlineSend:andReplace:", "right"]
  44035. }),
  44036. $globals.IRAssignmentInliner);
  44037. $core.addMethod(
  44038. $core.method({
  44039. selector: "inlineClosure:",
  44040. protocol: "inlining",
  44041. fn: function (anIRClosure){
  44042. var self=this,$self=this;
  44043. var closure,sequence,statements;
  44044. return $core.withContext(function($ctx1) {
  44045. var $1,$2,$3,$5,$4;
  44046. closure=(
  44047. $ctx1.supercall = true,
  44048. ($globals.IRAssignmentInliner.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.apply($self, [anIRClosure]));
  44049. $ctx1.supercall = false;
  44050. sequence=$recv(closure)._sequence();
  44051. statements=$recv(sequence)._dagChildren();
  44052. $recv(statements)._ifNotEmpty_((function(){
  44053. var final;
  44054. return $core.withContext(function($ctx2) {
  44055. final=$recv(statements)._last();
  44056. $1=$recv(final)._yieldsValue();
  44057. if($core.assert($1)){
  44058. $2=sequence;
  44059. $3=final;
  44060. $5=$recv($globals.IRAssignment)._new();
  44061. $recv($5)._add_($self._target());
  44062. $ctx2.sendIdx["add:"]=1;
  44063. $recv($5)._add_($recv(final)._copy());
  44064. $4=$recv($5)._yourself();
  44065. return $recv($2)._replace_with_($3,$4);
  44066. }
  44067. }, function($ctx2) {$ctx2.fillBlock({final:final},$ctx1,1)});
  44068. }));
  44069. return closure;
  44070. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,sequence:sequence,statements:statements},$globals.IRAssignmentInliner)});
  44071. },
  44072. args: ["anIRClosure"],
  44073. 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",
  44074. referencedClasses: ["IRAssignment"],
  44075. messageSends: ["inlineClosure:", "sequence", "dagChildren", "ifNotEmpty:", "last", "ifTrue:", "yieldsValue", "replace:with:", "add:", "new", "target", "copy", "yourself"]
  44076. }),
  44077. $globals.IRAssignmentInliner);
  44078. $core.addMethod(
  44079. $core.method({
  44080. selector: "target",
  44081. protocol: "accessing",
  44082. fn: function (){
  44083. var self=this,$self=this;
  44084. return $self["@target"];
  44085. },
  44086. args: [],
  44087. source: "target\x0a\x09^ target",
  44088. referencedClasses: [],
  44089. messageSends: []
  44090. }),
  44091. $globals.IRAssignmentInliner);
  44092. $core.addMethod(
  44093. $core.method({
  44094. selector: "target:",
  44095. protocol: "accessing",
  44096. fn: function (anObject){
  44097. var self=this,$self=this;
  44098. $self["@target"]=anObject;
  44099. return self;
  44100. },
  44101. args: ["anObject"],
  44102. source: "target: anObject\x0a\x09target := anObject",
  44103. referencedClasses: [],
  44104. messageSends: []
  44105. }),
  44106. $globals.IRAssignmentInliner);
  44107. $core.addClass("IRReturnInliner", $globals.IRSendInliner, [], "Compiler-Inlining");
  44108. $globals.IRReturnInliner.comment="I inline message sends with inlined closure together with a return instruction.";
  44109. $core.addMethod(
  44110. $core.method({
  44111. selector: "inlineClosure:",
  44112. protocol: "inlining",
  44113. fn: function (anIRClosure){
  44114. var self=this,$self=this;
  44115. var closure,sequence,statements;
  44116. return $core.withContext(function($ctx1) {
  44117. var $1,$2,$3,$5,$4;
  44118. closure=(
  44119. $ctx1.supercall = true,
  44120. ($globals.IRReturnInliner.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.apply($self, [anIRClosure]));
  44121. $ctx1.supercall = false;
  44122. sequence=$recv(closure)._sequence();
  44123. statements=$recv(sequence)._dagChildren();
  44124. $recv(statements)._ifNotEmpty_((function(){
  44125. var final;
  44126. return $core.withContext(function($ctx2) {
  44127. final=$recv(statements)._last();
  44128. $1=$recv(final)._yieldsValue();
  44129. if($core.assert($1)){
  44130. $2=sequence;
  44131. $3=final;
  44132. $5=$recv($globals.IRReturn)._new();
  44133. $recv($5)._add_($recv(final)._copy());
  44134. $4=$recv($5)._yourself();
  44135. return $recv($2)._replace_with_($3,$4);
  44136. }
  44137. }, function($ctx2) {$ctx2.fillBlock({final:final},$ctx1,1)});
  44138. }));
  44139. return closure;
  44140. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,sequence:sequence,statements:statements},$globals.IRReturnInliner)});
  44141. },
  44142. args: ["anIRClosure"],
  44143. 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",
  44144. referencedClasses: ["IRReturn"],
  44145. messageSends: ["inlineClosure:", "sequence", "dagChildren", "ifNotEmpty:", "last", "ifTrue:", "yieldsValue", "replace:with:", "add:", "new", "copy", "yourself"]
  44146. }),
  44147. $globals.IRReturnInliner);
  44148. $core.addMethod(
  44149. $core.method({
  44150. selector: "inlineReturn:",
  44151. protocol: "inlining",
  44152. fn: function (anIRReturn){
  44153. var self=this,$self=this;
  44154. return $core.withContext(function($ctx1) {
  44155. return $self._inlineSend_andReplace_($recv(anIRReturn)._expression(),anIRReturn);
  44156. }, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn},$globals.IRReturnInliner)});
  44157. },
  44158. args: ["anIRReturn"],
  44159. source: "inlineReturn: anIRReturn\x0a\x09^ self inlineSend: anIRReturn expression andReplace: anIRReturn",
  44160. referencedClasses: [],
  44161. messageSends: ["inlineSend:andReplace:", "expression"]
  44162. }),
  44163. $globals.IRReturnInliner);
  44164. $core.addClass("InliningCodeGenerator", $globals.CodeGenerator, [], "Compiler-Inlining");
  44165. $globals.InliningCodeGenerator.comment="I am a specialized code generator that uses inlining to produce more optimized JavaScript output";
  44166. $core.addMethod(
  44167. $core.method({
  44168. selector: "inliner",
  44169. protocol: "compiling",
  44170. fn: function (){
  44171. var self=this,$self=this;
  44172. return $core.withContext(function($ctx1) {
  44173. return $recv($globals.IRInliner)._new();
  44174. }, function($ctx1) {$ctx1.fill(self,"inliner",{},$globals.InliningCodeGenerator)});
  44175. },
  44176. args: [],
  44177. source: "inliner\x0a\x09^ IRInliner new",
  44178. referencedClasses: ["IRInliner"],
  44179. messageSends: ["new"]
  44180. }),
  44181. $globals.InliningCodeGenerator);
  44182. $core.addMethod(
  44183. $core.method({
  44184. selector: "irTranslatorClass",
  44185. protocol: "compiling",
  44186. fn: function (){
  44187. var self=this,$self=this;
  44188. return $globals.IRInliningJSTranslator;
  44189. },
  44190. args: [],
  44191. source: "irTranslatorClass\x0a\x09^ IRInliningJSTranslator",
  44192. referencedClasses: ["IRInliningJSTranslator"],
  44193. messageSends: []
  44194. }),
  44195. $globals.InliningCodeGenerator);
  44196. $core.addMethod(
  44197. $core.method({
  44198. selector: "preInliner",
  44199. protocol: "compiling",
  44200. fn: function (){
  44201. var self=this,$self=this;
  44202. return $core.withContext(function($ctx1) {
  44203. return $recv($globals.ASTPreInliner)._new();
  44204. }, function($ctx1) {$ctx1.fill(self,"preInliner",{},$globals.InliningCodeGenerator)});
  44205. },
  44206. args: [],
  44207. source: "preInliner\x0a\x09^ ASTPreInliner new",
  44208. referencedClasses: ["ASTPreInliner"],
  44209. messageSends: ["new"]
  44210. }),
  44211. $globals.InliningCodeGenerator);
  44212. $core.addMethod(
  44213. $core.method({
  44214. selector: "transformersDictionary",
  44215. protocol: "compiling",
  44216. fn: function (){
  44217. var self=this,$self=this;
  44218. return $core.withContext(function($ctx1) {
  44219. var $1,$2,$receiver;
  44220. $1=$self["@transformersDictionary"];
  44221. if(($receiver = $1) == null || $receiver.a$nil){
  44222. $2=(
  44223. $ctx1.supercall = true,
  44224. ($globals.InliningCodeGenerator.superclass||$boot.nilAsClass).fn.prototype._transformersDictionary.apply($self, []));
  44225. $ctx1.supercall = false;
  44226. $recv($2)._at_put_("3000-inlinerTagging",$self._preInliner());
  44227. $ctx1.sendIdx["at:put:"]=1;
  44228. $recv($2)._at_put_("6000-inliner",$self._inliner());
  44229. $ctx1.sendIdx["at:put:"]=2;
  44230. $recv($2)._at_put_("8000-irToJs",$self._irTranslator());
  44231. $self["@transformersDictionary"]=$recv($2)._yourself();
  44232. return $self["@transformersDictionary"];
  44233. } else {
  44234. return $1;
  44235. }
  44236. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.InliningCodeGenerator)});
  44237. },
  44238. args: [],
  44239. 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 ]",
  44240. referencedClasses: [],
  44241. messageSends: ["ifNil:", "at:put:", "transformersDictionary", "preInliner", "inliner", "irTranslator", "yourself"]
  44242. }),
  44243. $globals.InliningCodeGenerator);
  44244. $core.addClass("InliningError", $globals.SemanticError, [], "Compiler-Inlining");
  44245. $globals.InliningError.comment="Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`.";
  44246. $core.addClass("InliningSemanticAnalyzer", $globals.SemanticAnalyzer, [], "Compiler-Inlining");
  44247. $core.addMethod(
  44248. $core.method({
  44249. selector: "visitSendNode:",
  44250. protocol: "visiting",
  44251. fn: function (aNode){
  44252. var self=this,$self=this;
  44253. return $core.withContext(function($ctx1) {
  44254. var $1,$2,$3,$receiver;
  44255. $1=$recv(aNode)._superSend();
  44256. if(!$core.assert($1)){
  44257. $2=$recv($recv($globals.IRSendInliner)._inlinedSelectors())._includes_($recv(aNode)._selector());
  44258. if($core.assert($2)){
  44259. $recv(aNode)._shouldBeInlined_(true);
  44260. $3=$recv(aNode)._receiver();
  44261. if(($receiver = $3) == null || $receiver.a$nil){
  44262. $3;
  44263. } else {
  44264. var receiver;
  44265. receiver=$receiver;
  44266. $recv(receiver)._shouldBeAliased_(true);
  44267. }
  44268. }
  44269. }
  44270. (
  44271. $ctx1.supercall = true,
  44272. ($globals.InliningSemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  44273. $ctx1.supercall = false;
  44274. return self;
  44275. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.InliningSemanticAnalyzer)});
  44276. },
  44277. args: ["aNode"],
  44278. source: "visitSendNode: aNode\x0a\x0a\x09aNode superSend ifFalse: [ \x0a\x09\x09(IRSendInliner inlinedSelectors includes: aNode selector) ifTrue: [\x0a\x09\x09\x09aNode shouldBeInlined: true.\x0a\x09\x09\x09aNode receiver ifNotNil: [ :receiver |\x0a\x09\x09\x09\x09receiver shouldBeAliased: true ] ] ].\x0a\x0a\x09super visitSendNode: aNode",
  44279. referencedClasses: ["IRSendInliner"],
  44280. messageSends: ["ifFalse:", "superSend", "ifTrue:", "includes:", "inlinedSelectors", "selector", "shouldBeInlined:", "ifNotNil:", "receiver", "shouldBeAliased:", "visitSendNode:"]
  44281. }),
  44282. $globals.InliningSemanticAnalyzer);
  44283. $core.addMethod(
  44284. $core.method({
  44285. selector: "asInlinedBlockResult",
  44286. protocol: "*Compiler-Inlining",
  44287. fn: function (){
  44288. var self=this,$self=this;
  44289. return $core.withContext(function($ctx1) {
  44290. return $self._expression();
  44291. }, function($ctx1) {$ctx1.fill(self,"asInlinedBlockResult",{},$globals.IRBlockReturn)});
  44292. },
  44293. args: [],
  44294. source: "asInlinedBlockResult\x0a\x09^ self expression",
  44295. referencedClasses: [],
  44296. messageSends: ["expression"]
  44297. }),
  44298. $globals.IRBlockReturn);
  44299. $core.addMethod(
  44300. $core.method({
  44301. selector: "asInlinedBlockResult",
  44302. protocol: "*Compiler-Inlining",
  44303. fn: function (){
  44304. var self=this,$self=this;
  44305. return self;
  44306. },
  44307. args: [],
  44308. source: "asInlinedBlockResult\x0a\x09^ self",
  44309. referencedClasses: [],
  44310. messageSends: []
  44311. }),
  44312. $globals.IRInstruction);
  44313. });
  44314. define('amber_core/Compiler-Interpreter',["amber/boot", "amber_core/Compiler-AST", "amber_core/Compiler-Semantic", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Methods", "amber_core/Kernel-Objects"], function($boot){"use strict";
  44315. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  44316. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  44317. var $pkg = $core.addPackage("Compiler-Interpreter");
  44318. $pkg.innerEval = function (expr) { return eval(expr); };
  44319. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  44320. $core.addClass("AIBlockClosure", $globals.BlockClosure, ["node", "outerContext"], "Compiler-Interpreter");
  44321. $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`).";
  44322. $core.addMethod(
  44323. $core.method({
  44324. selector: "applyTo:arguments:",
  44325. protocol: "evaluating",
  44326. fn: function (anObject,aCollection){
  44327. var self=this,$self=this;
  44328. return $core.withContext(function($ctx1) {
  44329. $self._interpreterError();
  44330. return self;
  44331. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.AIBlockClosure)});
  44332. },
  44333. args: ["anObject", "aCollection"],
  44334. source: "applyTo: anObject arguments: aCollection\x0a\x09self interpreterError",
  44335. referencedClasses: [],
  44336. messageSends: ["interpreterError"]
  44337. }),
  44338. $globals.AIBlockClosure);
  44339. $core.addMethod(
  44340. $core.method({
  44341. selector: "compiledSource",
  44342. protocol: "accessing",
  44343. fn: function (){
  44344. var self=this,$self=this;
  44345. return "[ AST Block closure ]";
  44346. },
  44347. args: [],
  44348. source: "compiledSource\x0a\x09\x22Unlike blocks, the receiver doesn't represent a JS function\x22\x0a\x09\x0a\x09^ '[ AST Block closure ]'",
  44349. referencedClasses: [],
  44350. messageSends: []
  44351. }),
  44352. $globals.AIBlockClosure);
  44353. $core.addMethod(
  44354. $core.method({
  44355. selector: "currySelf",
  44356. protocol: "converting",
  44357. fn: function (){
  44358. var self=this,$self=this;
  44359. return $core.withContext(function($ctx1) {
  44360. $self._interpreterError();
  44361. return self;
  44362. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.AIBlockClosure)});
  44363. },
  44364. args: [],
  44365. source: "currySelf\x0a\x09self interpreterError",
  44366. referencedClasses: [],
  44367. messageSends: ["interpreterError"]
  44368. }),
  44369. $globals.AIBlockClosure);
  44370. $core.addMethod(
  44371. $core.method({
  44372. selector: "initializeWithContext:node:",
  44373. protocol: "initialization",
  44374. fn: function (aContext,aNode){
  44375. var self=this,$self=this;
  44376. $self["@node"]=aNode;
  44377. $self["@outerContext"]=aContext;
  44378. return self;
  44379. },
  44380. args: ["aContext", "aNode"],
  44381. source: "initializeWithContext: aContext node: aNode\x0a\x09node := aNode.\x0a\x09outerContext := aContext",
  44382. referencedClasses: [],
  44383. messageSends: []
  44384. }),
  44385. $globals.AIBlockClosure);
  44386. $core.addMethod(
  44387. $core.method({
  44388. selector: "interpreterError",
  44389. protocol: "error handling",
  44390. fn: function (){
  44391. var self=this,$self=this;
  44392. return $core.withContext(function($ctx1) {
  44393. $recv($globals.ASTInterpreterError)._signal_("Method cannot be interpreted by the interpreter.");
  44394. return self;
  44395. }, function($ctx1) {$ctx1.fill(self,"interpreterError",{},$globals.AIBlockClosure)});
  44396. },
  44397. args: [],
  44398. source: "interpreterError\x0a\x09ASTInterpreterError signal: 'Method cannot be interpreted by the interpreter.'",
  44399. referencedClasses: ["ASTInterpreterError"],
  44400. messageSends: ["signal:"]
  44401. }),
  44402. $globals.AIBlockClosure);
  44403. $core.addMethod(
  44404. $core.method({
  44405. selector: "numArgs",
  44406. protocol: "accessing",
  44407. fn: function (){
  44408. var self=this,$self=this;
  44409. return $core.withContext(function($ctx1) {
  44410. return $recv($recv($self["@node"])._temps())._size();
  44411. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.AIBlockClosure)});
  44412. },
  44413. args: [],
  44414. source: "numArgs\x0a\x09^ node temps size",
  44415. referencedClasses: [],
  44416. messageSends: ["size", "temps"]
  44417. }),
  44418. $globals.AIBlockClosure);
  44419. $core.addMethod(
  44420. $core.method({
  44421. selector: "value",
  44422. protocol: "evaluating",
  44423. fn: function (){
  44424. var self=this,$self=this;
  44425. return $core.withContext(function($ctx1) {
  44426. return $self._valueWithPossibleArguments_([]);
  44427. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AIBlockClosure)});
  44428. },
  44429. args: [],
  44430. source: "value\x0a\x09^ self valueWithPossibleArguments: #()",
  44431. referencedClasses: [],
  44432. messageSends: ["valueWithPossibleArguments:"]
  44433. }),
  44434. $globals.AIBlockClosure);
  44435. $core.addMethod(
  44436. $core.method({
  44437. selector: "value:",
  44438. protocol: "evaluating",
  44439. fn: function (anArgument){
  44440. var self=this,$self=this;
  44441. return $core.withContext(function($ctx1) {
  44442. return $self._valueWithPossibleArguments_([anArgument]);
  44443. }, function($ctx1) {$ctx1.fill(self,"value:",{anArgument:anArgument},$globals.AIBlockClosure)});
  44444. },
  44445. args: ["anArgument"],
  44446. source: "value: anArgument\x0a\x09^ self valueWithPossibleArguments: {anArgument}",
  44447. referencedClasses: [],
  44448. messageSends: ["valueWithPossibleArguments:"]
  44449. }),
  44450. $globals.AIBlockClosure);
  44451. $core.addMethod(
  44452. $core.method({
  44453. selector: "value:value:",
  44454. protocol: "evaluating",
  44455. fn: function (firstArgument,secondArgument){
  44456. var self=this,$self=this;
  44457. return $core.withContext(function($ctx1) {
  44458. return $self._valueWithPossibleArguments_([firstArgument,secondArgument]);
  44459. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.AIBlockClosure)});
  44460. },
  44461. args: ["firstArgument", "secondArgument"],
  44462. source: "value: firstArgument value: secondArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument}",
  44463. referencedClasses: [],
  44464. messageSends: ["valueWithPossibleArguments:"]
  44465. }),
  44466. $globals.AIBlockClosure);
  44467. $core.addMethod(
  44468. $core.method({
  44469. selector: "value:value:value:",
  44470. protocol: "evaluating",
  44471. fn: function (firstArgument,secondArgument,thirdArgument){
  44472. var self=this,$self=this;
  44473. return $core.withContext(function($ctx1) {
  44474. return $self._valueWithPossibleArguments_([firstArgument,secondArgument,thirdArgument]);
  44475. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.AIBlockClosure)});
  44476. },
  44477. args: ["firstArgument", "secondArgument", "thirdArgument"],
  44478. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument . thirdArgument}",
  44479. referencedClasses: [],
  44480. messageSends: ["valueWithPossibleArguments:"]
  44481. }),
  44482. $globals.AIBlockClosure);
  44483. $core.addMethod(
  44484. $core.method({
  44485. selector: "valueWithPossibleArguments:",
  44486. protocol: "evaluating",
  44487. fn: function (aCollection){
  44488. var self=this,$self=this;
  44489. var context,sequenceNode;
  44490. return $core.withContext(function($ctx1) {
  44491. var $1,$2,$3;
  44492. context=$recv($self["@outerContext"])._newInnerContext();
  44493. $1=$recv($recv($recv($self["@node"])._dagChildren())._first())._copy();
  44494. $recv($1)._parent_(nil);
  44495. sequenceNode=$recv($1)._yourself();
  44496. $recv($recv(sequenceNode)._temps())._do_((function(each){
  44497. return $core.withContext(function($ctx2) {
  44498. return $recv(context)._defineLocal_(each);
  44499. $ctx2.sendIdx["defineLocal:"]=1;
  44500. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44501. }));
  44502. $recv($recv($self["@node"])._parameters())._withIndexDo_((function(each,index){
  44503. return $core.withContext(function($ctx2) {
  44504. $recv(context)._defineLocal_(each);
  44505. return $recv(context)._localAt_put_(each,$recv(aCollection)._at_ifAbsent_(index,(function(){
  44506. return nil;
  44507. })));
  44508. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,2)});
  44509. }));
  44510. $2=$recv(context)._interpreter();
  44511. $ctx1.sendIdx["interpreter"]=1;
  44512. $recv($2)._node_(sequenceNode);
  44513. $recv($2)._enterNode();
  44514. $recv($2)._proceed();
  44515. $3=$recv($self["@outerContext"])._interpreter();
  44516. $ctx1.sendIdx["interpreter"]=2;
  44517. $recv($3)._setNonLocalReturnFromContext_(context);
  44518. return $recv($recv(context)._interpreter())._pop();
  44519. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection,context:context,sequenceNode:sequenceNode},$globals.AIBlockClosure)});
  44520. },
  44521. args: ["aCollection"],
  44522. 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",
  44523. referencedClasses: [],
  44524. messageSends: ["newInnerContext", "parent:", "copy", "first", "dagChildren", "yourself", "do:", "temps", "defineLocal:", "withIndexDo:", "parameters", "localAt:put:", "at:ifAbsent:", "node:", "interpreter", "enterNode", "proceed", "setNonLocalReturnFromContext:", "pop"]
  44525. }),
  44526. $globals.AIBlockClosure);
  44527. $core.addMethod(
  44528. $core.method({
  44529. selector: "forContext:node:",
  44530. protocol: "instance creation",
  44531. fn: function (aContext,aNode){
  44532. var self=this,$self=this;
  44533. return $core.withContext(function($ctx1) {
  44534. var $1;
  44535. $1=$self._new();
  44536. $recv($1)._initializeWithContext_node_(aContext,aNode);
  44537. return $recv($1)._yourself();
  44538. }, function($ctx1) {$ctx1.fill(self,"forContext:node:",{aContext:aContext,aNode:aNode},$globals.AIBlockClosure.a$cls)});
  44539. },
  44540. args: ["aContext", "aNode"],
  44541. source: "forContext: aContext node: aNode\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext node: aNode;\x0a\x09\x09yourself",
  44542. referencedClasses: [],
  44543. messageSends: ["initializeWithContext:node:", "new", "yourself"]
  44544. }),
  44545. $globals.AIBlockClosure.a$cls);
  44546. $core.addClass("AIContext", $globals.MethodContext, ["outerContext", "innerContext", "pc", "locals", "selector", "index", "sendIndexes", "evaluatedSelector", "ast", "interpreter", "supercall"], "Compiler-Interpreter");
  44547. $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)";
  44548. $core.addMethod(
  44549. $core.method({
  44550. selector: "arguments",
  44551. protocol: "interpreting",
  44552. fn: function (){
  44553. var self=this,$self=this;
  44554. return $core.withContext(function($ctx1) {
  44555. return $recv($recv($self._ast())._arguments())._collect_((function(each){
  44556. return $core.withContext(function($ctx2) {
  44557. return $self._localAt_ifAbsent_(each,(function(){
  44558. return $core.withContext(function($ctx3) {
  44559. return $self._error_("Argument not in context");
  44560. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  44561. }));
  44562. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44563. }));
  44564. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.AIContext)});
  44565. },
  44566. args: [],
  44567. source: "arguments\x0a\x09^ self ast arguments collect: [ :each |\x0a\x09\x09self localAt: each ifAbsent: [ self error: 'Argument not in context' ] ]",
  44568. referencedClasses: [],
  44569. messageSends: ["collect:", "arguments", "ast", "localAt:ifAbsent:", "error:"]
  44570. }),
  44571. $globals.AIContext);
  44572. $core.addMethod(
  44573. $core.method({
  44574. selector: "ast",
  44575. protocol: "interpreting",
  44576. fn: function (){
  44577. var self=this,$self=this;
  44578. return $core.withContext(function($ctx1) {
  44579. var $1,$2,$3,$receiver;
  44580. $1=$self._isBlockContext();
  44581. if($core.assert($1)){
  44582. $2=$self._outerContext();
  44583. if(($receiver = $2) == null || $receiver.a$nil){
  44584. return $2;
  44585. } else {
  44586. var context;
  44587. context=$receiver;
  44588. return $recv(context)._ast();
  44589. }
  44590. }
  44591. $3=$self["@ast"];
  44592. if(($receiver = $3) == null || $receiver.a$nil){
  44593. $self._initializeAST();
  44594. } else {
  44595. $3;
  44596. }
  44597. return $self["@ast"];
  44598. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.AIContext)});
  44599. },
  44600. args: [],
  44601. source: "ast\x0a\x09self isBlockContext ifTrue: [ \x0a\x09\x09^ self outerContext ifNotNil: [ :context | context ast ] ].\x0a\x0a\x09ast ifNil: [ self initializeAST ].\x0a\x09^ ast",
  44602. referencedClasses: [],
  44603. messageSends: ["ifTrue:", "isBlockContext", "ifNotNil:", "outerContext", "ast", "ifNil:", "initializeAST"]
  44604. }),
  44605. $globals.AIContext);
  44606. $core.addMethod(
  44607. $core.method({
  44608. selector: "basicLocalAt:",
  44609. protocol: "private",
  44610. fn: function (aString){
  44611. var self=this,$self=this;
  44612. return $core.withContext(function($ctx1) {
  44613. return $recv($self._locals())._at_(aString);
  44614. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:",{aString:aString},$globals.AIContext)});
  44615. },
  44616. args: ["aString"],
  44617. source: "basicLocalAt: aString\x0a\x09^ self locals at: aString",
  44618. referencedClasses: [],
  44619. messageSends: ["at:", "locals"]
  44620. }),
  44621. $globals.AIContext);
  44622. $core.addMethod(
  44623. $core.method({
  44624. selector: "basicLocalAt:put:",
  44625. protocol: "private",
  44626. fn: function (aString,anObject){
  44627. var self=this,$self=this;
  44628. return $core.withContext(function($ctx1) {
  44629. $recv($self._locals())._at_put_(aString,anObject);
  44630. return self;
  44631. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:put:",{aString:aString,anObject:anObject},$globals.AIContext)});
  44632. },
  44633. args: ["aString", "anObject"],
  44634. source: "basicLocalAt: aString put: anObject\x0a\x09self locals at: aString put: anObject",
  44635. referencedClasses: [],
  44636. messageSends: ["at:put:", "locals"]
  44637. }),
  44638. $globals.AIContext);
  44639. $core.addMethod(
  44640. $core.method({
  44641. selector: "basicReceiver",
  44642. protocol: "interpreting",
  44643. fn: function (){
  44644. var self=this,$self=this;
  44645. return $core.withContext(function($ctx1) {
  44646. return $self._localAt_("self");
  44647. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.AIContext)});
  44648. },
  44649. args: [],
  44650. source: "basicReceiver\x0a\x09^ self localAt: 'self'",
  44651. referencedClasses: [],
  44652. messageSends: ["localAt:"]
  44653. }),
  44654. $globals.AIContext);
  44655. $core.addMethod(
  44656. $core.method({
  44657. selector: "defineLocal:",
  44658. protocol: "accessing",
  44659. fn: function (aString){
  44660. var self=this,$self=this;
  44661. return $core.withContext(function($ctx1) {
  44662. $recv($self._locals())._at_put_(aString,nil);
  44663. return self;
  44664. }, function($ctx1) {$ctx1.fill(self,"defineLocal:",{aString:aString},$globals.AIContext)});
  44665. },
  44666. args: ["aString"],
  44667. source: "defineLocal: aString\x0a\x09self locals at: aString put: nil",
  44668. referencedClasses: [],
  44669. messageSends: ["at:put:", "locals"]
  44670. }),
  44671. $globals.AIContext);
  44672. $core.addMethod(
  44673. $core.method({
  44674. selector: "evaluate:on:",
  44675. protocol: "evaluating",
  44676. fn: function (aString,anEvaluator){
  44677. var self=this,$self=this;
  44678. return $core.withContext(function($ctx1) {
  44679. return $recv(anEvaluator)._evaluate_context_(aString,self);
  44680. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.AIContext)});
  44681. },
  44682. args: ["aString", "anEvaluator"],
  44683. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString context: self",
  44684. referencedClasses: [],
  44685. messageSends: ["evaluate:context:"]
  44686. }),
  44687. $globals.AIContext);
  44688. $core.addMethod(
  44689. $core.method({
  44690. selector: "evaluateNode:",
  44691. protocol: "evaluating",
  44692. fn: function (aNode){
  44693. var self=this,$self=this;
  44694. return $core.withContext(function($ctx1) {
  44695. var $1;
  44696. $1=$recv($globals.ASTInterpreter)._new();
  44697. $recv($1)._context_(self);
  44698. $recv($1)._node_(aNode);
  44699. $recv($1)._enterNode();
  44700. $recv($1)._proceed();
  44701. return $recv($1)._result();
  44702. }, function($ctx1) {$ctx1.fill(self,"evaluateNode:",{aNode:aNode},$globals.AIContext)});
  44703. },
  44704. args: ["aNode"],
  44705. source: "evaluateNode: aNode\x0a\x09^ ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09node: aNode;\x0a\x09\x09enterNode;\x0a\x09\x09proceed;\x0a\x09\x09result",
  44706. referencedClasses: ["ASTInterpreter"],
  44707. messageSends: ["context:", "new", "node:", "enterNode", "proceed", "result"]
  44708. }),
  44709. $globals.AIContext);
  44710. $core.addMethod(
  44711. $core.method({
  44712. selector: "evaluatedSelector",
  44713. protocol: "accessing",
  44714. fn: function (){
  44715. var self=this,$self=this;
  44716. return $self["@evaluatedSelector"];
  44717. },
  44718. args: [],
  44719. source: "evaluatedSelector\x0a\x09^ evaluatedSelector",
  44720. referencedClasses: [],
  44721. messageSends: []
  44722. }),
  44723. $globals.AIContext);
  44724. $core.addMethod(
  44725. $core.method({
  44726. selector: "evaluatedSelector:",
  44727. protocol: "accessing",
  44728. fn: function (aString){
  44729. var self=this,$self=this;
  44730. $self["@evaluatedSelector"]=aString;
  44731. return self;
  44732. },
  44733. args: ["aString"],
  44734. source: "evaluatedSelector: aString\x0a\x09evaluatedSelector := aString",
  44735. referencedClasses: [],
  44736. messageSends: []
  44737. }),
  44738. $globals.AIContext);
  44739. $core.addMethod(
  44740. $core.method({
  44741. selector: "index",
  44742. protocol: "accessing",
  44743. fn: function (){
  44744. var self=this,$self=this;
  44745. return $core.withContext(function($ctx1) {
  44746. var $1,$receiver;
  44747. $1=$self["@index"];
  44748. if(($receiver = $1) == null || $receiver.a$nil){
  44749. return (0);
  44750. } else {
  44751. return $1;
  44752. }
  44753. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.AIContext)});
  44754. },
  44755. args: [],
  44756. source: "index\x0a\x09^ index ifNil: [ 0 ]",
  44757. referencedClasses: [],
  44758. messageSends: ["ifNil:"]
  44759. }),
  44760. $globals.AIContext);
  44761. $core.addMethod(
  44762. $core.method({
  44763. selector: "index:",
  44764. protocol: "accessing",
  44765. fn: function (anInteger){
  44766. var self=this,$self=this;
  44767. $self["@index"]=anInteger;
  44768. return self;
  44769. },
  44770. args: ["anInteger"],
  44771. source: "index: anInteger\x0a\x09index := anInteger",
  44772. referencedClasses: [],
  44773. messageSends: []
  44774. }),
  44775. $globals.AIContext);
  44776. $core.addMethod(
  44777. $core.method({
  44778. selector: "initializeAST",
  44779. protocol: "initialization",
  44780. fn: function (){
  44781. var self=this,$self=this;
  44782. return $core.withContext(function($ctx1) {
  44783. var $1;
  44784. $1=$self._method();
  44785. $ctx1.sendIdx["method"]=1;
  44786. $self["@ast"]=$recv($1)._ast();
  44787. $recv($recv($globals.SemanticAnalyzer)._on_($recv($self._method())._methodClass()))._visit_($self["@ast"]);
  44788. return self;
  44789. }, function($ctx1) {$ctx1.fill(self,"initializeAST",{},$globals.AIContext)});
  44790. },
  44791. args: [],
  44792. source: "initializeAST\x0a\x09ast := self method ast.\x0a\x09(SemanticAnalyzer on: self method methodClass)\x0a\x09\x09visit: ast",
  44793. referencedClasses: ["SemanticAnalyzer"],
  44794. messageSends: ["ast", "method", "visit:", "on:", "methodClass"]
  44795. }),
  44796. $globals.AIContext);
  44797. $core.addMethod(
  44798. $core.method({
  44799. selector: "initializeFromMethodContext:",
  44800. protocol: "initialization",
  44801. fn: function (aMethodContext){
  44802. var self=this,$self=this;
  44803. return $core.withContext(function($ctx1) {
  44804. var $1,$2,$3,$receiver;
  44805. $self._evaluatedSelector_($recv(aMethodContext)._evaluatedSelector());
  44806. $self._index_($recv(aMethodContext)._index());
  44807. $self._sendIndexes_($recv(aMethodContext)._sendIndexes());
  44808. $self._receiver_($recv(aMethodContext)._receiver());
  44809. $self._supercall_($recv(aMethodContext)._supercall());
  44810. $self._selector_($recv(aMethodContext)._selector());
  44811. $1=$recv(aMethodContext)._outerContext();
  44812. $ctx1.sendIdx["outerContext"]=1;
  44813. if(($receiver = $1) == null || $receiver.a$nil){
  44814. $1;
  44815. } else {
  44816. var outer;
  44817. outer=$receiver;
  44818. $2=$recv(outer)._methodContext();
  44819. if(($receiver = $2) == null || $receiver.a$nil){
  44820. $2;
  44821. } else {
  44822. $self._outerContext_($recv($self._class())._fromMethodContext_($recv(aMethodContext)._outerContext()));
  44823. }
  44824. $3=$recv(aMethodContext)._locals();
  44825. $ctx1.sendIdx["locals"]=1;
  44826. $recv($3)._keysAndValuesDo_((function(key,value){
  44827. return $core.withContext(function($ctx2) {
  44828. return $recv($self._locals())._at_put_(key,value);
  44829. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  44830. }));
  44831. }
  44832. return self;
  44833. }, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext)});
  44834. },
  44835. args: ["aMethodContext"],
  44836. 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 ] ]",
  44837. referencedClasses: [],
  44838. messageSends: ["evaluatedSelector:", "evaluatedSelector", "index:", "index", "sendIndexes:", "sendIndexes", "receiver:", "receiver", "supercall:", "supercall", "selector:", "selector", "ifNotNil:", "outerContext", "methodContext", "outerContext:", "fromMethodContext:", "class", "keysAndValuesDo:", "locals", "at:put:"]
  44839. }),
  44840. $globals.AIContext);
  44841. $core.addMethod(
  44842. $core.method({
  44843. selector: "initializeInterpreter",
  44844. protocol: "initialization",
  44845. fn: function (){
  44846. var self=this,$self=this;
  44847. return $core.withContext(function($ctx1) {
  44848. var $1,$2,$receiver;
  44849. $1=$recv($globals.ASTInterpreter)._new();
  44850. $recv($1)._context_(self);
  44851. $self["@interpreter"]=$recv($1)._yourself();
  44852. $2=$self._innerContext();
  44853. if(($receiver = $2) == null || $receiver.a$nil){
  44854. $2;
  44855. } else {
  44856. $self._setupInterpreter_($self["@interpreter"]);
  44857. }
  44858. return self;
  44859. }, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{},$globals.AIContext)});
  44860. },
  44861. args: [],
  44862. source: "initializeInterpreter\x0a\x09interpreter := ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09yourself.\x0a\x09\x0a\x09self innerContext ifNotNil: [\x0a\x09\x09self setupInterpreter: interpreter ]",
  44863. referencedClasses: ["ASTInterpreter"],
  44864. messageSends: ["context:", "new", "yourself", "ifNotNil:", "innerContext", "setupInterpreter:"]
  44865. }),
  44866. $globals.AIContext);
  44867. $core.addMethod(
  44868. $core.method({
  44869. selector: "initializeLocals",
  44870. protocol: "initialization",
  44871. fn: function (){
  44872. var self=this,$self=this;
  44873. return $core.withContext(function($ctx1) {
  44874. $self["@locals"]=$recv($globals.Dictionary)._new();
  44875. $recv($self["@locals"])._at_put_("thisContext",self);
  44876. return self;
  44877. }, function($ctx1) {$ctx1.fill(self,"initializeLocals",{},$globals.AIContext)});
  44878. },
  44879. args: [],
  44880. source: "initializeLocals\x0a\x09locals := Dictionary new.\x0a\x09locals at: 'thisContext' put: self.",
  44881. referencedClasses: ["Dictionary"],
  44882. messageSends: ["new", "at:put:"]
  44883. }),
  44884. $globals.AIContext);
  44885. $core.addMethod(
  44886. $core.method({
  44887. selector: "innerContext",
  44888. protocol: "accessing",
  44889. fn: function (){
  44890. var self=this,$self=this;
  44891. return $self["@innerContext"];
  44892. },
  44893. args: [],
  44894. source: "innerContext\x0a\x09^ innerContext",
  44895. referencedClasses: [],
  44896. messageSends: []
  44897. }),
  44898. $globals.AIContext);
  44899. $core.addMethod(
  44900. $core.method({
  44901. selector: "innerContext:",
  44902. protocol: "accessing",
  44903. fn: function (anAIContext){
  44904. var self=this,$self=this;
  44905. $self["@innerContext"]=anAIContext;
  44906. return self;
  44907. },
  44908. args: ["anAIContext"],
  44909. source: "innerContext: anAIContext\x0a\x09innerContext := anAIContext",
  44910. referencedClasses: [],
  44911. messageSends: []
  44912. }),
  44913. $globals.AIContext);
  44914. $core.addMethod(
  44915. $core.method({
  44916. selector: "interpreter",
  44917. protocol: "interpreting",
  44918. fn: function (){
  44919. var self=this,$self=this;
  44920. return $core.withContext(function($ctx1) {
  44921. var $1,$receiver;
  44922. $1=$self["@interpreter"];
  44923. if(($receiver = $1) == null || $receiver.a$nil){
  44924. $self._initializeInterpreter();
  44925. } else {
  44926. $1;
  44927. }
  44928. return $self["@interpreter"];
  44929. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.AIContext)});
  44930. },
  44931. args: [],
  44932. source: "interpreter\x0a\x09interpreter ifNil: [ self initializeInterpreter ].\x0a\x09^ interpreter",
  44933. referencedClasses: [],
  44934. messageSends: ["ifNil:", "initializeInterpreter"]
  44935. }),
  44936. $globals.AIContext);
  44937. $core.addMethod(
  44938. $core.method({
  44939. selector: "interpreter:",
  44940. protocol: "interpreting",
  44941. fn: function (anInterpreter){
  44942. var self=this,$self=this;
  44943. $self["@interpreter"]=anInterpreter;
  44944. return self;
  44945. },
  44946. args: ["anInterpreter"],
  44947. source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter",
  44948. referencedClasses: [],
  44949. messageSends: []
  44950. }),
  44951. $globals.AIContext);
  44952. $core.addMethod(
  44953. $core.method({
  44954. selector: "isTopContext",
  44955. protocol: "testing",
  44956. fn: function (){
  44957. var self=this,$self=this;
  44958. return $core.withContext(function($ctx1) {
  44959. return $recv($self._innerContext())._isNil();
  44960. }, function($ctx1) {$ctx1.fill(self,"isTopContext",{},$globals.AIContext)});
  44961. },
  44962. args: [],
  44963. source: "isTopContext\x0a\x09^ self innerContext isNil",
  44964. referencedClasses: [],
  44965. messageSends: ["isNil", "innerContext"]
  44966. }),
  44967. $globals.AIContext);
  44968. $core.addMethod(
  44969. $core.method({
  44970. selector: "localAt:",
  44971. protocol: "accessing",
  44972. fn: function (aString){
  44973. var self=this,$self=this;
  44974. var context;
  44975. return $core.withContext(function($ctx1) {
  44976. context=$self._lookupContextForLocal_(aString);
  44977. return $recv(context)._basicLocalAt_(aString);
  44978. }, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString,context:context},$globals.AIContext)});
  44979. },
  44980. args: ["aString"],
  44981. 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",
  44982. referencedClasses: [],
  44983. messageSends: ["lookupContextForLocal:", "basicLocalAt:"]
  44984. }),
  44985. $globals.AIContext);
  44986. $core.addMethod(
  44987. $core.method({
  44988. selector: "localAt:ifAbsent:",
  44989. protocol: "accessing",
  44990. fn: function (aString,aBlock){
  44991. var self=this,$self=this;
  44992. var context;
  44993. return $core.withContext(function($ctx1) {
  44994. var $early={};
  44995. try {
  44996. context=$self._lookupContextForLocal_ifNone_(aString,(function(){
  44997. return $core.withContext(function($ctx2) {
  44998. throw $early=[$recv(aBlock)._value()];
  44999. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45000. }));
  45001. return $recv(context)._basicLocalAt_(aString);
  45002. }
  45003. catch(e) {if(e===$early)return e[0]; throw e}
  45004. }, function($ctx1) {$ctx1.fill(self,"localAt:ifAbsent:",{aString:aString,aBlock:aBlock,context:context},$globals.AIContext)});
  45005. },
  45006. args: ["aString", "aBlock"],
  45007. 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",
  45008. referencedClasses: [],
  45009. messageSends: ["lookupContextForLocal:ifNone:", "value", "basicLocalAt:"]
  45010. }),
  45011. $globals.AIContext);
  45012. $core.addMethod(
  45013. $core.method({
  45014. selector: "localAt:put:",
  45015. protocol: "accessing",
  45016. fn: function (aString,anObject){
  45017. var self=this,$self=this;
  45018. var context;
  45019. return $core.withContext(function($ctx1) {
  45020. context=$self._lookupContextForLocal_(aString);
  45021. $recv(context)._basicLocalAt_put_(aString,anObject);
  45022. return self;
  45023. }, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject,context:context},$globals.AIContext)});
  45024. },
  45025. args: ["aString", "anObject"],
  45026. source: "localAt: aString put: anObject\x0a\x09| context |\x0a\x09\x0a\x09context := self lookupContextForLocal: aString.\x0a\x09context basicLocalAt: aString put: anObject",
  45027. referencedClasses: [],
  45028. messageSends: ["lookupContextForLocal:", "basicLocalAt:put:"]
  45029. }),
  45030. $globals.AIContext);
  45031. $core.addMethod(
  45032. $core.method({
  45033. selector: "locals",
  45034. protocol: "accessing",
  45035. fn: function (){
  45036. var self=this,$self=this;
  45037. return $core.withContext(function($ctx1) {
  45038. var $1,$receiver;
  45039. $1=$self["@locals"];
  45040. if(($receiver = $1) == null || $receiver.a$nil){
  45041. $self._initializeLocals();
  45042. } else {
  45043. $1;
  45044. }
  45045. return $self["@locals"];
  45046. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.AIContext)});
  45047. },
  45048. args: [],
  45049. source: "locals\x0a\x09locals ifNil: [ self initializeLocals ].\x0a\x09\x0a\x09^ locals",
  45050. referencedClasses: [],
  45051. messageSends: ["ifNil:", "initializeLocals"]
  45052. }),
  45053. $globals.AIContext);
  45054. $core.addMethod(
  45055. $core.method({
  45056. selector: "lookupContextForLocal:",
  45057. protocol: "private",
  45058. fn: function (aString){
  45059. var self=this,$self=this;
  45060. return $core.withContext(function($ctx1) {
  45061. return $self._lookupContextForLocal_ifNone_(aString,(function(){
  45062. return $core.withContext(function($ctx2) {
  45063. return $self._variableNotFound();
  45064. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45065. }));
  45066. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:",{aString:aString},$globals.AIContext)});
  45067. },
  45068. args: ["aString"],
  45069. 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 ]",
  45070. referencedClasses: [],
  45071. messageSends: ["lookupContextForLocal:ifNone:", "variableNotFound"]
  45072. }),
  45073. $globals.AIContext);
  45074. $core.addMethod(
  45075. $core.method({
  45076. selector: "lookupContextForLocal:ifNone:",
  45077. protocol: "private",
  45078. fn: function (aString,aBlock){
  45079. var self=this,$self=this;
  45080. return $core.withContext(function($ctx1) {
  45081. var $1;
  45082. return $recv($self._locals())._at_ifPresent_ifAbsent_(aString,(function(){
  45083. return self;
  45084. }),(function(){
  45085. return $core.withContext(function($ctx2) {
  45086. $1=$self._outerContext();
  45087. return $recv($1)._ifNil_ifNotNil_(aBlock,(function(context){
  45088. return $core.withContext(function($ctx3) {
  45089. return $recv(context)._lookupContextForLocal_(aString);
  45090. }, function($ctx3) {$ctx3.fillBlock({context:context},$ctx2,3)});
  45091. }));
  45092. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45093. }));
  45094. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:ifNone:",{aString:aString,aBlock:aBlock},$globals.AIContext)});
  45095. },
  45096. args: ["aString", "aBlock"],
  45097. 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 ] ]",
  45098. referencedClasses: [],
  45099. messageSends: ["at:ifPresent:ifAbsent:", "locals", "ifNil:ifNotNil:", "outerContext", "lookupContextForLocal:"]
  45100. }),
  45101. $globals.AIContext);
  45102. $core.addMethod(
  45103. $core.method({
  45104. selector: "newInnerContext",
  45105. protocol: "factory",
  45106. fn: function (){
  45107. var self=this,$self=this;
  45108. return $core.withContext(function($ctx1) {
  45109. var $1;
  45110. $1=$recv($self._class())._new();
  45111. $recv($1)._outerContext_(self);
  45112. return $recv($1)._yourself();
  45113. }, function($ctx1) {$ctx1.fill(self,"newInnerContext",{},$globals.AIContext)});
  45114. },
  45115. args: [],
  45116. source: "newInnerContext\x0a\x09^ self class new\x0a\x09\x09outerContext: self;\x0a\x09\x09yourself",
  45117. referencedClasses: [],
  45118. messageSends: ["outerContext:", "new", "class", "yourself"]
  45119. }),
  45120. $globals.AIContext);
  45121. $core.addMethod(
  45122. $core.method({
  45123. selector: "outerContext",
  45124. protocol: "accessing",
  45125. fn: function (){
  45126. var self=this,$self=this;
  45127. return $self["@outerContext"];
  45128. },
  45129. args: [],
  45130. source: "outerContext\x0a\x09^ outerContext",
  45131. referencedClasses: [],
  45132. messageSends: []
  45133. }),
  45134. $globals.AIContext);
  45135. $core.addMethod(
  45136. $core.method({
  45137. selector: "outerContext:",
  45138. protocol: "accessing",
  45139. fn: function (anAIContext){
  45140. var self=this,$self=this;
  45141. return $core.withContext(function($ctx1) {
  45142. var $1,$receiver;
  45143. $self["@outerContext"]=anAIContext;
  45144. $1=$self["@outerContext"];
  45145. if(($receiver = $1) == null || $receiver.a$nil){
  45146. $1;
  45147. } else {
  45148. var context;
  45149. context=$receiver;
  45150. $recv(context)._innerContext_(self);
  45151. }
  45152. return self;
  45153. }, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext},$globals.AIContext)});
  45154. },
  45155. args: ["anAIContext"],
  45156. source: "outerContext: anAIContext\x0a\x09outerContext := anAIContext.\x0a\x09outerContext ifNotNil: [ :context | \x0a\x09\x09context innerContext: self ]",
  45157. referencedClasses: [],
  45158. messageSends: ["ifNotNil:", "innerContext:"]
  45159. }),
  45160. $globals.AIContext);
  45161. $core.addMethod(
  45162. $core.method({
  45163. selector: "receiver:",
  45164. protocol: "interpreting",
  45165. fn: function (anObject){
  45166. var self=this,$self=this;
  45167. return $core.withContext(function($ctx1) {
  45168. $recv($self._locals())._at_put_("self",anObject);
  45169. return self;
  45170. }, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},$globals.AIContext)});
  45171. },
  45172. args: ["anObject"],
  45173. source: "receiver: anObject\x0a\x09self locals at: 'self' put: anObject",
  45174. referencedClasses: [],
  45175. messageSends: ["at:put:", "locals"]
  45176. }),
  45177. $globals.AIContext);
  45178. $core.addMethod(
  45179. $core.method({
  45180. selector: "selector",
  45181. protocol: "accessing",
  45182. fn: function (){
  45183. var self=this,$self=this;
  45184. return $self["@selector"];
  45185. },
  45186. args: [],
  45187. source: "selector\x0a\x09^ selector",
  45188. referencedClasses: [],
  45189. messageSends: []
  45190. }),
  45191. $globals.AIContext);
  45192. $core.addMethod(
  45193. $core.method({
  45194. selector: "selector:",
  45195. protocol: "accessing",
  45196. fn: function (aString){
  45197. var self=this,$self=this;
  45198. $self["@selector"]=aString;
  45199. return self;
  45200. },
  45201. args: ["aString"],
  45202. source: "selector: aString\x0a\x09selector := aString",
  45203. referencedClasses: [],
  45204. messageSends: []
  45205. }),
  45206. $globals.AIContext);
  45207. $core.addMethod(
  45208. $core.method({
  45209. selector: "sendIndexAt:",
  45210. protocol: "accessing",
  45211. fn: function (aString){
  45212. var self=this,$self=this;
  45213. return $core.withContext(function($ctx1) {
  45214. return $recv($self._sendIndexes())._at_ifAbsent_(aString,(function(){
  45215. return (0);
  45216. }));
  45217. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aString:aString},$globals.AIContext)});
  45218. },
  45219. args: ["aString"],
  45220. source: "sendIndexAt: aString\x0a\x09^ self sendIndexes at: aString ifAbsent: [ 0 ]",
  45221. referencedClasses: [],
  45222. messageSends: ["at:ifAbsent:", "sendIndexes"]
  45223. }),
  45224. $globals.AIContext);
  45225. $core.addMethod(
  45226. $core.method({
  45227. selector: "sendIndexes",
  45228. protocol: "accessing",
  45229. fn: function (){
  45230. var self=this,$self=this;
  45231. return $core.withContext(function($ctx1) {
  45232. var $1,$receiver;
  45233. $1=$self["@sendIndexes"];
  45234. if(($receiver = $1) == null || $receiver.a$nil){
  45235. return $recv($globals.Dictionary)._new();
  45236. } else {
  45237. return $1;
  45238. }
  45239. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.AIContext)});
  45240. },
  45241. args: [],
  45242. source: "sendIndexes\x0a\x09^ sendIndexes ifNil: [ Dictionary new ]",
  45243. referencedClasses: ["Dictionary"],
  45244. messageSends: ["ifNil:", "new"]
  45245. }),
  45246. $globals.AIContext);
  45247. $core.addMethod(
  45248. $core.method({
  45249. selector: "sendIndexes:",
  45250. protocol: "accessing",
  45251. fn: function (aDictionary){
  45252. var self=this,$self=this;
  45253. $self["@sendIndexes"]=aDictionary;
  45254. return self;
  45255. },
  45256. args: ["aDictionary"],
  45257. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  45258. referencedClasses: [],
  45259. messageSends: []
  45260. }),
  45261. $globals.AIContext);
  45262. $core.addMethod(
  45263. $core.method({
  45264. selector: "setupInterpreter:",
  45265. protocol: "interpreting",
  45266. fn: function (anInterpreter){
  45267. var self=this,$self=this;
  45268. var currentNode;
  45269. return $core.withContext(function($ctx1) {
  45270. var $1,$2,$3,$4,$7,$6,$5,$receiver;
  45271. $1=$recv($globals.ASTPCNodeVisitor)._new();
  45272. $2=$self._evaluatedSelector();
  45273. $ctx1.sendIdx["evaluatedSelector"]=1;
  45274. $recv($1)._selector_($2);
  45275. $recv($1)._index_($self._sendIndexAt_($self._evaluatedSelector()));
  45276. $3=$self._ast();
  45277. $ctx1.sendIdx["ast"]=1;
  45278. $recv($1)._visit_($3);
  45279. currentNode=$recv($1)._currentNode();
  45280. $4=$recv($self._ast())._sequenceNode();
  45281. if(($receiver = $4) == null || $receiver.a$nil){
  45282. $4;
  45283. } else {
  45284. var sequence;
  45285. sequence=$receiver;
  45286. $recv($recv(sequence)._temps())._do_((function(each){
  45287. return $core.withContext(function($ctx2) {
  45288. return $self._defineLocal_(each);
  45289. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  45290. }));
  45291. $ctx1.sendIdx["do:"]=1;
  45292. }
  45293. $recv(anInterpreter)._node_(currentNode);
  45294. $7=$self._innerContext();
  45295. $ctx1.sendIdx["innerContext"]=1;
  45296. $6=$recv($7)._arguments();
  45297. $5=$recv($6)._reversed();
  45298. $recv($5)._do_((function(each){
  45299. return $core.withContext(function($ctx2) {
  45300. return $recv(anInterpreter)._push_(each);
  45301. $ctx2.sendIdx["push:"]=1;
  45302. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  45303. }));
  45304. $recv(anInterpreter)._push_($recv($self._innerContext())._receiver());
  45305. return self;
  45306. }, function($ctx1) {$ctx1.fill(self,"setupInterpreter:",{anInterpreter:anInterpreter,currentNode:currentNode},$globals.AIContext)});
  45307. },
  45308. args: ["anInterpreter"],
  45309. 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)",
  45310. referencedClasses: ["ASTPCNodeVisitor"],
  45311. messageSends: ["selector:", "new", "evaluatedSelector", "index:", "sendIndexAt:", "visit:", "ast", "currentNode", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "node:", "reversed", "arguments", "innerContext", "push:", "receiver"]
  45312. }),
  45313. $globals.AIContext);
  45314. $core.addMethod(
  45315. $core.method({
  45316. selector: "supercall",
  45317. protocol: "interpreting",
  45318. fn: function (){
  45319. var self=this,$self=this;
  45320. return $core.withContext(function($ctx1) {
  45321. var $1,$receiver;
  45322. $1=$self["@supercall"];
  45323. if(($receiver = $1) == null || $receiver.a$nil){
  45324. return false;
  45325. } else {
  45326. return $1;
  45327. }
  45328. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.AIContext)});
  45329. },
  45330. args: [],
  45331. source: "supercall\x0a\x09^ supercall ifNil: [ false ]",
  45332. referencedClasses: [],
  45333. messageSends: ["ifNil:"]
  45334. }),
  45335. $globals.AIContext);
  45336. $core.addMethod(
  45337. $core.method({
  45338. selector: "supercall:",
  45339. protocol: "interpreting",
  45340. fn: function (aBoolean){
  45341. var self=this,$self=this;
  45342. $self["@supercall"]=aBoolean;
  45343. return self;
  45344. },
  45345. args: ["aBoolean"],
  45346. source: "supercall: aBoolean\x0a\x09supercall := aBoolean",
  45347. referencedClasses: [],
  45348. messageSends: []
  45349. }),
  45350. $globals.AIContext);
  45351. $core.addMethod(
  45352. $core.method({
  45353. selector: "variableNotFound",
  45354. protocol: "error handling",
  45355. fn: function (){
  45356. var self=this,$self=this;
  45357. return $core.withContext(function($ctx1) {
  45358. $self._error_("Variable missing");
  45359. return self;
  45360. }, function($ctx1) {$ctx1.fill(self,"variableNotFound",{},$globals.AIContext)});
  45361. },
  45362. args: [],
  45363. source: "variableNotFound\x0a\x09\x22Error thrown whenever a variable lookup fails\x22\x0a\x09\x0a\x09self error: 'Variable missing'",
  45364. referencedClasses: [],
  45365. messageSends: ["error:"]
  45366. }),
  45367. $globals.AIContext);
  45368. $core.addMethod(
  45369. $core.method({
  45370. selector: "fromMethodContext:",
  45371. protocol: "instance creation",
  45372. fn: function (aMethodContext){
  45373. var self=this,$self=this;
  45374. return $core.withContext(function($ctx1) {
  45375. var $1;
  45376. $1=$self._new();
  45377. $recv($1)._initializeFromMethodContext_(aMethodContext);
  45378. return $recv($1)._yourself();
  45379. }, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext.a$cls)});
  45380. },
  45381. args: ["aMethodContext"],
  45382. source: "fromMethodContext: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromMethodContext: aMethodContext;\x0a\x09\x09yourself",
  45383. referencedClasses: [],
  45384. messageSends: ["initializeFromMethodContext:", "new", "yourself"]
  45385. }),
  45386. $globals.AIContext.a$cls);
  45387. $core.addClass("AISemanticAnalyzer", $globals.SemanticAnalyzer, ["context"], "Compiler-Interpreter");
  45388. $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.";
  45389. $core.addMethod(
  45390. $core.method({
  45391. selector: "context",
  45392. protocol: "accessing",
  45393. fn: function (){
  45394. var self=this,$self=this;
  45395. return $self["@context"];
  45396. },
  45397. args: [],
  45398. source: "context\x0a\x09^ context",
  45399. referencedClasses: [],
  45400. messageSends: []
  45401. }),
  45402. $globals.AISemanticAnalyzer);
  45403. $core.addMethod(
  45404. $core.method({
  45405. selector: "context:",
  45406. protocol: "accessing",
  45407. fn: function (anAIContext){
  45408. var self=this,$self=this;
  45409. $self["@context"]=anAIContext;
  45410. return self;
  45411. },
  45412. args: ["anAIContext"],
  45413. source: "context: anAIContext\x0a\x09context := anAIContext",
  45414. referencedClasses: [],
  45415. messageSends: []
  45416. }),
  45417. $globals.AISemanticAnalyzer);
  45418. $core.addMethod(
  45419. $core.method({
  45420. selector: "visitVariableNode:",
  45421. protocol: "visiting",
  45422. fn: function (aNode){
  45423. var self=this,$self=this;
  45424. return $core.withContext(function($ctx1) {
  45425. var $1;
  45426. var $early={};
  45427. try {
  45428. $recv($self._context())._localAt_ifAbsent_($recv(aNode)._value(),(function(){
  45429. return $core.withContext(function($ctx2) {
  45430. $1=(
  45431. $ctx2.supercall = true,
  45432. ($globals.AISemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitVariableNode_.apply($self, [aNode]));
  45433. $ctx2.supercall = false;
  45434. throw $early=[$1];
  45435. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45436. }));
  45437. $recv(aNode)._binding_($recv($globals.ASTContextVar)._new());
  45438. return self;
  45439. }
  45440. catch(e) {if(e===$early)return e[0]; throw e}
  45441. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.AISemanticAnalyzer)});
  45442. },
  45443. args: ["aNode"],
  45444. source: "visitVariableNode: aNode\x0a\x09self context \x0a\x09\x09localAt: aNode value \x0a\x09\x09ifAbsent: [ ^ super visitVariableNode: aNode ].\x0a\x0a\x09aNode binding: ASTContextVar new",
  45445. referencedClasses: ["ASTContextVar"],
  45446. messageSends: ["localAt:ifAbsent:", "context", "value", "visitVariableNode:", "binding:", "new"]
  45447. }),
  45448. $globals.AISemanticAnalyzer);
  45449. $core.addClass("ASTContextVar", $globals.ScopeVar, ["context"], "Compiler-Interpreter");
  45450. $globals.ASTContextVar.comment="I am a variable defined in a `context`.";
  45451. $core.addMethod(
  45452. $core.method({
  45453. selector: "context",
  45454. protocol: "accessing",
  45455. fn: function (){
  45456. var self=this,$self=this;
  45457. return $self["@context"];
  45458. },
  45459. args: [],
  45460. source: "context\x0a\x09^ context",
  45461. referencedClasses: [],
  45462. messageSends: []
  45463. }),
  45464. $globals.ASTContextVar);
  45465. $core.addMethod(
  45466. $core.method({
  45467. selector: "context:",
  45468. protocol: "accessing",
  45469. fn: function (anObject){
  45470. var self=this,$self=this;
  45471. $self["@context"]=anObject;
  45472. return self;
  45473. },
  45474. args: ["anObject"],
  45475. source: "context: anObject\x0a\x09context := anObject",
  45476. referencedClasses: [],
  45477. messageSends: []
  45478. }),
  45479. $globals.ASTContextVar);
  45480. $core.addClass("ASTDebugger", $globals.Object, ["interpreter", "context", "result"], "Compiler-Interpreter");
  45481. $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.";
  45482. $core.addMethod(
  45483. $core.method({
  45484. selector: "atEnd",
  45485. protocol: "testing",
  45486. fn: function (){
  45487. var self=this,$self=this;
  45488. return $core.withContext(function($ctx1) {
  45489. var $1,$receiver;
  45490. $1=$self._context();
  45491. $ctx1.sendIdx["context"]=1;
  45492. if(($receiver = $1) == null || $receiver.a$nil){
  45493. return true;
  45494. } else {
  45495. $1;
  45496. }
  45497. return $recv($recv($self._interpreter())._atEnd())._and_((function(){
  45498. return $core.withContext(function($ctx2) {
  45499. return $recv($self._context())._isTopContext();
  45500. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45501. }));
  45502. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTDebugger)});
  45503. },
  45504. args: [],
  45505. source: "atEnd\x09\x0a\x09self context ifNil: [ ^ true ].\x0a\x09\x0a\x09^ self interpreter atEnd and: [ \x0a\x09\x09self context isTopContext ]",
  45506. referencedClasses: [],
  45507. messageSends: ["ifNil:", "context", "and:", "atEnd", "interpreter", "isTopContext"]
  45508. }),
  45509. $globals.ASTDebugger);
  45510. $core.addMethod(
  45511. $core.method({
  45512. selector: "context",
  45513. protocol: "accessing",
  45514. fn: function (){
  45515. var self=this,$self=this;
  45516. return $self["@context"];
  45517. },
  45518. args: [],
  45519. source: "context\x0a\x09^ context",
  45520. referencedClasses: [],
  45521. messageSends: []
  45522. }),
  45523. $globals.ASTDebugger);
  45524. $core.addMethod(
  45525. $core.method({
  45526. selector: "context:",
  45527. protocol: "accessing",
  45528. fn: function (aContext){
  45529. var self=this,$self=this;
  45530. $self["@context"]=aContext;
  45531. return self;
  45532. },
  45533. args: ["aContext"],
  45534. source: "context: aContext\x0a\x09context := aContext",
  45535. referencedClasses: [],
  45536. messageSends: []
  45537. }),
  45538. $globals.ASTDebugger);
  45539. $core.addMethod(
  45540. $core.method({
  45541. selector: "flushInnerContexts",
  45542. protocol: "actions",
  45543. fn: function (){
  45544. var self=this,$self=this;
  45545. return $core.withContext(function($ctx1) {
  45546. var $1,$receiver;
  45547. $1=$self._context();
  45548. if(($receiver = $1) == null || $receiver.a$nil){
  45549. $1;
  45550. } else {
  45551. var cxt;
  45552. cxt=$receiver;
  45553. $recv(cxt)._innerContext_(nil);
  45554. }
  45555. return self;
  45556. }, function($ctx1) {$ctx1.fill(self,"flushInnerContexts",{},$globals.ASTDebugger)});
  45557. },
  45558. args: [],
  45559. 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 ]",
  45560. referencedClasses: [],
  45561. messageSends: ["ifNotNil:", "context", "innerContext:"]
  45562. }),
  45563. $globals.ASTDebugger);
  45564. $core.addMethod(
  45565. $core.method({
  45566. selector: "interpreter",
  45567. protocol: "accessing",
  45568. fn: function (){
  45569. var self=this,$self=this;
  45570. return $core.withContext(function($ctx1) {
  45571. var $1,$receiver;
  45572. $1=$self._context();
  45573. if(($receiver = $1) == null || $receiver.a$nil){
  45574. return $1;
  45575. } else {
  45576. var ctx;
  45577. ctx=$receiver;
  45578. return $recv(ctx)._interpreter();
  45579. }
  45580. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.ASTDebugger)});
  45581. },
  45582. args: [],
  45583. source: "interpreter\x0a\x09^ self context ifNotNil: [ :ctx | \x0a\x09\x09ctx interpreter ]",
  45584. referencedClasses: [],
  45585. messageSends: ["ifNotNil:", "context", "interpreter"]
  45586. }),
  45587. $globals.ASTDebugger);
  45588. $core.addMethod(
  45589. $core.method({
  45590. selector: "method",
  45591. protocol: "accessing",
  45592. fn: function (){
  45593. var self=this,$self=this;
  45594. return $core.withContext(function($ctx1) {
  45595. return $recv($self._context())._method();
  45596. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTDebugger)});
  45597. },
  45598. args: [],
  45599. source: "method\x0a\x09^ self context method",
  45600. referencedClasses: [],
  45601. messageSends: ["method", "context"]
  45602. }),
  45603. $globals.ASTDebugger);
  45604. $core.addMethod(
  45605. $core.method({
  45606. selector: "node",
  45607. protocol: "accessing",
  45608. fn: function (){
  45609. var self=this,$self=this;
  45610. return $core.withContext(function($ctx1) {
  45611. var $1,$receiver;
  45612. $1=$self._interpreter();
  45613. $ctx1.sendIdx["interpreter"]=1;
  45614. if(($receiver = $1) == null || $receiver.a$nil){
  45615. return $1;
  45616. } else {
  45617. return $recv($self._interpreter())._node();
  45618. }
  45619. }, function($ctx1) {$ctx1.fill(self,"node",{},$globals.ASTDebugger)});
  45620. },
  45621. args: [],
  45622. source: "node\x0a\x09^ self interpreter ifNotNil: [\x0a\x09\x09self interpreter node ]",
  45623. referencedClasses: [],
  45624. messageSends: ["ifNotNil:", "interpreter", "node"]
  45625. }),
  45626. $globals.ASTDebugger);
  45627. $core.addMethod(
  45628. $core.method({
  45629. selector: "onStep",
  45630. protocol: "private",
  45631. fn: function (){
  45632. var self=this,$self=this;
  45633. return $core.withContext(function($ctx1) {
  45634. var $1,$3,$2,$4,$6,$5,$receiver;
  45635. $1=$self._interpreter();
  45636. $ctx1.sendIdx["interpreter"]=1;
  45637. $self["@result"]=$recv($1)._result();
  45638. $3=$self._interpreter();
  45639. $ctx1.sendIdx["interpreter"]=2;
  45640. $2=$recv($3)._atEnd();
  45641. $ctx1.sendIdx["atEnd"]=1;
  45642. if($core.assert($2)){
  45643. $4=$recv($self._context())._outerContext();
  45644. if(($receiver = $4) == null || $receiver.a$nil){
  45645. $4;
  45646. } else {
  45647. var outerContext;
  45648. outerContext=$receiver;
  45649. $self._context_(outerContext);
  45650. }
  45651. $6=$self._interpreter();
  45652. $ctx1.sendIdx["interpreter"]=3;
  45653. $5=$recv($6)._atEnd();
  45654. if(!$core.assert($5)){
  45655. $recv($self._interpreter())._skip();
  45656. }
  45657. }
  45658. $self._flushInnerContexts();
  45659. return self;
  45660. }, function($ctx1) {$ctx1.fill(self,"onStep",{},$globals.ASTDebugger)});
  45661. },
  45662. args: [],
  45663. 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",
  45664. referencedClasses: [],
  45665. messageSends: ["result", "interpreter", "ifTrue:", "atEnd", "ifNotNil:", "outerContext", "context", "context:", "ifFalse:", "skip", "flushInnerContexts"]
  45666. }),
  45667. $globals.ASTDebugger);
  45668. $core.addMethod(
  45669. $core.method({
  45670. selector: "proceed",
  45671. protocol: "stepping",
  45672. fn: function (){
  45673. var self=this,$self=this;
  45674. return $core.withContext(function($ctx1) {
  45675. $recv((function(){
  45676. return $core.withContext(function($ctx2) {
  45677. return $self._atEnd();
  45678. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45679. }))._whileFalse_((function(){
  45680. return $core.withContext(function($ctx2) {
  45681. return $self._stepOver();
  45682. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45683. }));
  45684. return self;
  45685. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTDebugger)});
  45686. },
  45687. args: [],
  45688. source: "proceed\x0a\x09[ self atEnd ] whileFalse: [ self stepOver ]",
  45689. referencedClasses: [],
  45690. messageSends: ["whileFalse:", "atEnd", "stepOver"]
  45691. }),
  45692. $globals.ASTDebugger);
  45693. $core.addMethod(
  45694. $core.method({
  45695. selector: "restart",
  45696. protocol: "stepping",
  45697. fn: function (){
  45698. var self=this,$self=this;
  45699. return $core.withContext(function($ctx1) {
  45700. $recv($self._interpreter())._restart();
  45701. $self._flushInnerContexts();
  45702. return self;
  45703. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTDebugger)});
  45704. },
  45705. args: [],
  45706. source: "restart\x0a\x09self interpreter restart.\x0a\x09self flushInnerContexts",
  45707. referencedClasses: [],
  45708. messageSends: ["restart", "interpreter", "flushInnerContexts"]
  45709. }),
  45710. $globals.ASTDebugger);
  45711. $core.addMethod(
  45712. $core.method({
  45713. selector: "result",
  45714. protocol: "accessing",
  45715. fn: function (){
  45716. var self=this,$self=this;
  45717. return $self["@result"];
  45718. },
  45719. args: [],
  45720. source: "result\x0a\x09^ result",
  45721. referencedClasses: [],
  45722. messageSends: []
  45723. }),
  45724. $globals.ASTDebugger);
  45725. $core.addMethod(
  45726. $core.method({
  45727. selector: "stepInto",
  45728. protocol: "stepping",
  45729. fn: function (){
  45730. var self=this,$self=this;
  45731. return $core.withContext(function($ctx1) {
  45732. $self._shouldBeImplemented();
  45733. return self;
  45734. }, function($ctx1) {$ctx1.fill(self,"stepInto",{},$globals.ASTDebugger)});
  45735. },
  45736. args: [],
  45737. source: "stepInto\x0a\x09self shouldBeImplemented",
  45738. referencedClasses: [],
  45739. messageSends: ["shouldBeImplemented"]
  45740. }),
  45741. $globals.ASTDebugger);
  45742. $core.addMethod(
  45743. $core.method({
  45744. selector: "stepOver",
  45745. protocol: "stepping",
  45746. fn: function (){
  45747. var self=this,$self=this;
  45748. return $core.withContext(function($ctx1) {
  45749. var $1,$2;
  45750. $1=$recv($self._context())._isTopContext();
  45751. if($core.assert($1)){
  45752. $recv($self._interpreter())._stepOver();
  45753. } else {
  45754. $2=$self._interpreter();
  45755. $ctx1.sendIdx["interpreter"]=1;
  45756. $recv($2)._skip();
  45757. }
  45758. $self._onStep();
  45759. return self;
  45760. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTDebugger)});
  45761. },
  45762. args: [],
  45763. source: "stepOver\x0a\x09self context isTopContext \x0a\x09\x09ifFalse: [ self interpreter skip ]\x0a\x09\x09ifTrue: [ self interpreter stepOver ].\x0a\x09self onStep",
  45764. referencedClasses: [],
  45765. messageSends: ["ifFalse:ifTrue:", "isTopContext", "context", "skip", "interpreter", "stepOver", "onStep"]
  45766. }),
  45767. $globals.ASTDebugger);
  45768. $core.addMethod(
  45769. $core.method({
  45770. selector: "context:",
  45771. protocol: "instance creation",
  45772. fn: function (aContext){
  45773. var self=this,$self=this;
  45774. return $core.withContext(function($ctx1) {
  45775. var $1;
  45776. $1=$self._new();
  45777. $recv($1)._context_(aContext);
  45778. return $recv($1)._yourself();
  45779. }, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},$globals.ASTDebugger.a$cls)});
  45780. },
  45781. args: ["aContext"],
  45782. source: "context: aContext\x0a\x09^ self new\x0a\x09\x09context: aContext;\x0a\x09\x09yourself",
  45783. referencedClasses: [],
  45784. messageSends: ["context:", "new", "yourself"]
  45785. }),
  45786. $globals.ASTDebugger.a$cls);
  45787. $core.addClass("ASTEnterNode", $globals.NodeVisitor, ["interpreter"], "Compiler-Interpreter");
  45788. $core.addMethod(
  45789. $core.method({
  45790. selector: "interpreter",
  45791. protocol: "accessing",
  45792. fn: function (){
  45793. var self=this,$self=this;
  45794. return $self["@interpreter"];
  45795. },
  45796. args: [],
  45797. source: "interpreter\x0a\x09^ interpreter",
  45798. referencedClasses: [],
  45799. messageSends: []
  45800. }),
  45801. $globals.ASTEnterNode);
  45802. $core.addMethod(
  45803. $core.method({
  45804. selector: "interpreter:",
  45805. protocol: "accessing",
  45806. fn: function (anObject){
  45807. var self=this,$self=this;
  45808. $self["@interpreter"]=anObject;
  45809. return self;
  45810. },
  45811. args: ["anObject"],
  45812. source: "interpreter: anObject\x0a\x09interpreter := anObject",
  45813. referencedClasses: [],
  45814. messageSends: []
  45815. }),
  45816. $globals.ASTEnterNode);
  45817. $core.addMethod(
  45818. $core.method({
  45819. selector: "visitBlockNode:",
  45820. protocol: "visiting",
  45821. fn: function (aNode){
  45822. var self=this,$self=this;
  45823. return aNode;
  45824. },
  45825. args: ["aNode"],
  45826. source: "visitBlockNode: aNode\x0a\x09\x22Answer the node as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ aNode",
  45827. referencedClasses: [],
  45828. messageSends: []
  45829. }),
  45830. $globals.ASTEnterNode);
  45831. $core.addMethod(
  45832. $core.method({
  45833. selector: "visitDagNode:",
  45834. protocol: "visiting",
  45835. fn: function (aNode){
  45836. var self=this,$self=this;
  45837. return $core.withContext(function($ctx1) {
  45838. var $early={};
  45839. try {
  45840. $recv($recv(aNode)._dagChildren())._ifEmpty_ifNotEmpty_((function(){
  45841. throw $early=[aNode];
  45842. }),(function(nodes){
  45843. return $core.withContext(function($ctx2) {
  45844. throw $early=[$self._visit_($recv(nodes)._first())];
  45845. }, function($ctx2) {$ctx2.fillBlock({nodes:nodes},$ctx1,2)});
  45846. }));
  45847. return self;
  45848. }
  45849. catch(e) {if(e===$early)return e[0]; throw e}
  45850. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.ASTEnterNode)});
  45851. },
  45852. args: ["aNode"],
  45853. source: "visitDagNode: aNode\x0a\x09aNode dagChildren\x0a\x09\x09ifEmpty: [ ^ aNode ]\x0a\x09\x09ifNotEmpty: [ :nodes | ^ self visit: nodes first ]",
  45854. referencedClasses: [],
  45855. messageSends: ["ifEmpty:ifNotEmpty:", "dagChildren", "visit:", "first"]
  45856. }),
  45857. $globals.ASTEnterNode);
  45858. $core.addMethod(
  45859. $core.method({
  45860. selector: "visitSequenceNode:",
  45861. protocol: "visiting",
  45862. fn: function (aNode){
  45863. var self=this,$self=this;
  45864. return $core.withContext(function($ctx1) {
  45865. var $1;
  45866. $recv($recv(aNode)._temps())._do_((function(each){
  45867. return $core.withContext(function($ctx2) {
  45868. return $recv($recv($self._interpreter())._context())._defineLocal_(each);
  45869. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  45870. }));
  45871. $1=(
  45872. $ctx1.supercall = true,
  45873. ($globals.ASTEnterNode.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($self, [aNode]));
  45874. $ctx1.supercall = false;
  45875. return $1;
  45876. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.ASTEnterNode)});
  45877. },
  45878. args: ["aNode"],
  45879. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self interpreter context defineLocal: each ].\x0a\x09^ super visitSequenceNode: aNode",
  45880. referencedClasses: [],
  45881. messageSends: ["do:", "temps", "defineLocal:", "context", "interpreter", "visitSequenceNode:"]
  45882. }),
  45883. $globals.ASTEnterNode);
  45884. $core.addMethod(
  45885. $core.method({
  45886. selector: "on:",
  45887. protocol: "instance creation",
  45888. fn: function (anInterpreter){
  45889. var self=this,$self=this;
  45890. return $core.withContext(function($ctx1) {
  45891. var $1;
  45892. $1=$self._new();
  45893. $recv($1)._interpreter_(anInterpreter);
  45894. return $recv($1)._yourself();
  45895. }, function($ctx1) {$ctx1.fill(self,"on:",{anInterpreter:anInterpreter},$globals.ASTEnterNode.a$cls)});
  45896. },
  45897. args: ["anInterpreter"],
  45898. source: "on: anInterpreter\x0a\x09^ self new\x0a\x09\x09interpreter: anInterpreter;\x0a\x09\x09yourself",
  45899. referencedClasses: [],
  45900. messageSends: ["interpreter:", "new", "yourself"]
  45901. }),
  45902. $globals.ASTEnterNode.a$cls);
  45903. $core.addClass("ASTInterpreter", $globals.NodeVisitor, ["node", "context", "stack", "returnValue", "returned", "forceAtEnd"], "Compiler-Interpreter");
  45904. $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";
  45905. $core.addMethod(
  45906. $core.method({
  45907. selector: "assign:to:",
  45908. protocol: "private",
  45909. fn: function (aNode,anObject){
  45910. var self=this,$self=this;
  45911. return $core.withContext(function($ctx1) {
  45912. var $1,$3,$2,$4;
  45913. $1=$recv($recv(aNode)._binding())._isInstanceVar();
  45914. if($core.assert($1)){
  45915. $3=$self._context();
  45916. $ctx1.sendIdx["context"]=1;
  45917. $2=$recv($3)._receiver();
  45918. $4=$recv(aNode)._value();
  45919. $ctx1.sendIdx["value"]=1;
  45920. $recv($2)._instVarAt_put_($4,anObject);
  45921. } else {
  45922. $recv($self._context())._localAt_put_($recv(aNode)._value(),anObject);
  45923. }
  45924. return self;
  45925. }, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject},$globals.ASTInterpreter)});
  45926. },
  45927. args: ["aNode", "anObject"],
  45928. 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 ]",
  45929. referencedClasses: [],
  45930. messageSends: ["ifTrue:ifFalse:", "isInstanceVar", "binding", "instVarAt:put:", "receiver", "context", "value", "localAt:put:"]
  45931. }),
  45932. $globals.ASTInterpreter);
  45933. $core.addMethod(
  45934. $core.method({
  45935. selector: "atEnd",
  45936. protocol: "testing",
  45937. fn: function (){
  45938. var self=this,$self=this;
  45939. return $core.withContext(function($ctx1) {
  45940. var $1;
  45941. $1=$self["@forceAtEnd"];
  45942. if($core.assert($1)){
  45943. return true;
  45944. }
  45945. return $recv($self._hasReturned())._or_((function(){
  45946. return $core.withContext(function($ctx2) {
  45947. return $recv($self._node())._isNil();
  45948. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45949. }));
  45950. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTInterpreter)});
  45951. },
  45952. args: [],
  45953. source: "atEnd\x0a\x09forceAtEnd ifTrue: [ ^ true ].\x0a\x09\x0a\x09^ self hasReturned or: [ self node isNil ]",
  45954. referencedClasses: [],
  45955. messageSends: ["ifTrue:", "or:", "hasReturned", "isNil", "node"]
  45956. }),
  45957. $globals.ASTInterpreter);
  45958. $core.addMethod(
  45959. $core.method({
  45960. selector: "context",
  45961. protocol: "accessing",
  45962. fn: function (){
  45963. var self=this,$self=this;
  45964. return $self["@context"];
  45965. },
  45966. args: [],
  45967. source: "context\x0a\x09^ context",
  45968. referencedClasses: [],
  45969. messageSends: []
  45970. }),
  45971. $globals.ASTInterpreter);
  45972. $core.addMethod(
  45973. $core.method({
  45974. selector: "context:",
  45975. protocol: "accessing",
  45976. fn: function (aContext){
  45977. var self=this,$self=this;
  45978. $self["@context"]=aContext;
  45979. return self;
  45980. },
  45981. args: ["aContext"],
  45982. source: "context: aContext\x0a\x09context := aContext",
  45983. referencedClasses: [],
  45984. messageSends: []
  45985. }),
  45986. $globals.ASTInterpreter);
  45987. $core.addMethod(
  45988. $core.method({
  45989. selector: "enterNode",
  45990. protocol: "interpreting",
  45991. fn: function (){
  45992. var self=this,$self=this;
  45993. return $core.withContext(function($ctx1) {
  45994. $self._node_($recv($recv($globals.ASTEnterNode)._on_(self))._visit_($self._node()));
  45995. return self;
  45996. }, function($ctx1) {$ctx1.fill(self,"enterNode",{},$globals.ASTInterpreter)});
  45997. },
  45998. args: [],
  45999. source: "enterNode\x0a\x09self node: ((ASTEnterNode on: self) visit: self node)",
  46000. referencedClasses: ["ASTEnterNode"],
  46001. messageSends: ["node:", "visit:", "on:", "node"]
  46002. }),
  46003. $globals.ASTInterpreter);
  46004. $core.addMethod(
  46005. $core.method({
  46006. selector: "eval:",
  46007. protocol: "private",
  46008. fn: function (aString){
  46009. var self=this,$self=this;
  46010. var source,function_;
  46011. return $core.withContext(function($ctx1) {
  46012. var $3,$2,$1;
  46013. source=$recv($globals.String)._streamContents_((function(str){
  46014. return $core.withContext(function($ctx2) {
  46015. $recv(str)._nextPutAll_("0,(function(");
  46016. $ctx2.sendIdx["nextPutAll:"]=1;
  46017. $3=$self._context();
  46018. $ctx2.sendIdx["context"]=1;
  46019. $2=$recv($3)._locals();
  46020. $ctx2.sendIdx["locals"]=1;
  46021. $1=$recv($2)._keys();
  46022. $recv($1)._do_separatedBy_((function(each){
  46023. return $core.withContext(function($ctx3) {
  46024. return $recv(str)._nextPutAll_(each);
  46025. $ctx3.sendIdx["nextPutAll:"]=2;
  46026. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  46027. }),(function(){
  46028. return $core.withContext(function($ctx3) {
  46029. return $recv(str)._nextPutAll_(",");
  46030. $ctx3.sendIdx["nextPutAll:"]=3;
  46031. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  46032. }));
  46033. $recv(str)._nextPutAll_("){ return (function() {");
  46034. $ctx2.sendIdx["nextPutAll:"]=4;
  46035. $recv(str)._nextPutAll_(aString);
  46036. $ctx2.sendIdx["nextPutAll:"]=5;
  46037. return $recv(str)._nextPutAll_("})()})");
  46038. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  46039. }));
  46040. function_=$recv($globals.Compiler)._eval_(source);
  46041. return $recv(function_)._valueWithPossibleArguments_($recv($recv($self._context())._locals())._values());
  46042. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_},$globals.ASTInterpreter)});
  46043. },
  46044. args: ["aString"],
  46045. 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",
  46046. referencedClasses: ["String", "Compiler"],
  46047. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "valueWithPossibleArguments:", "values"]
  46048. }),
  46049. $globals.ASTInterpreter);
  46050. $core.addMethod(
  46051. $core.method({
  46052. selector: "hasReturned",
  46053. protocol: "testing",
  46054. fn: function (){
  46055. var self=this,$self=this;
  46056. return $core.withContext(function($ctx1) {
  46057. var $1,$receiver;
  46058. $1=$self["@returned"];
  46059. if(($receiver = $1) == null || $receiver.a$nil){
  46060. return false;
  46061. } else {
  46062. return $1;
  46063. }
  46064. }, function($ctx1) {$ctx1.fill(self,"hasReturned",{},$globals.ASTInterpreter)});
  46065. },
  46066. args: [],
  46067. source: "hasReturned\x0a\x09^ returned ifNil: [ false ]",
  46068. referencedClasses: [],
  46069. messageSends: ["ifNil:"]
  46070. }),
  46071. $globals.ASTInterpreter);
  46072. $core.addMethod(
  46073. $core.method({
  46074. selector: "initialize",
  46075. protocol: "initialization",
  46076. fn: function (){
  46077. var self=this,$self=this;
  46078. return $core.withContext(function($ctx1) {
  46079. (
  46080. $ctx1.supercall = true,
  46081. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  46082. $ctx1.supercall = false;
  46083. $self["@forceAtEnd"]=false;
  46084. return self;
  46085. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ASTInterpreter)});
  46086. },
  46087. args: [],
  46088. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09forceAtEnd := false",
  46089. referencedClasses: [],
  46090. messageSends: ["initialize"]
  46091. }),
  46092. $globals.ASTInterpreter);
  46093. $core.addMethod(
  46094. $core.method({
  46095. selector: "interpret",
  46096. protocol: "interpreting",
  46097. fn: function (){
  46098. var self=this,$self=this;
  46099. return $core.withContext(function($ctx1) {
  46100. $self._visit_($self._node());
  46101. return self;
  46102. }, function($ctx1) {$ctx1.fill(self,"interpret",{},$globals.ASTInterpreter)});
  46103. },
  46104. args: [],
  46105. source: "interpret\x0a\x09\x22Interpret the next node to be evaluated\x22\x0a\x09\x0a\x09self visit: self node",
  46106. referencedClasses: [],
  46107. messageSends: ["visit:", "node"]
  46108. }),
  46109. $globals.ASTInterpreter);
  46110. $core.addMethod(
  46111. $core.method({
  46112. selector: "messageFromSendNode:arguments:",
  46113. protocol: "private",
  46114. fn: function (aSendNode,aCollection){
  46115. var self=this,$self=this;
  46116. return $core.withContext(function($ctx1) {
  46117. var $1;
  46118. $1=$recv($globals.Message)._new();
  46119. $recv($1)._selector_($recv(aSendNode)._selector());
  46120. $recv($1)._arguments_(aCollection);
  46121. return $recv($1)._yourself();
  46122. }, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:",{aSendNode:aSendNode,aCollection:aCollection},$globals.ASTInterpreter)});
  46123. },
  46124. args: ["aSendNode", "aCollection"],
  46125. source: "messageFromSendNode: aSendNode arguments: aCollection\x0a\x09^ Message new\x0a\x09\x09selector: aSendNode selector;\x0a\x09\x09arguments: aCollection;\x0a\x09\x09yourself",
  46126. referencedClasses: ["Message"],
  46127. messageSends: ["selector:", "new", "selector", "arguments:", "yourself"]
  46128. }),
  46129. $globals.ASTInterpreter);
  46130. $core.addMethod(
  46131. $core.method({
  46132. selector: "messageNotUnderstood:receiver:",
  46133. protocol: "private",
  46134. fn: function (aMessage,anObject){
  46135. var self=this,$self=this;
  46136. return $core.withContext(function($ctx1) {
  46137. var $1;
  46138. $1=$recv($globals.MessageNotUnderstood)._new();
  46139. $recv($1)._message_(aMessage);
  46140. $recv($1)._receiver_(anObject);
  46141. $recv($1)._signal();
  46142. return self;
  46143. }, function($ctx1) {$ctx1.fill(self,"messageNotUnderstood:receiver:",{aMessage:aMessage,anObject:anObject},$globals.ASTInterpreter)});
  46144. },
  46145. args: ["aMessage", "anObject"],
  46146. source: "messageNotUnderstood: aMessage receiver: anObject\x0a\x09MessageNotUnderstood new\x0a\x09\x09message: aMessage;\x0a\x09\x09receiver: anObject;\x0a\x09\x09signal",
  46147. referencedClasses: ["MessageNotUnderstood"],
  46148. messageSends: ["message:", "new", "receiver:", "signal"]
  46149. }),
  46150. $globals.ASTInterpreter);
  46151. $core.addMethod(
  46152. $core.method({
  46153. selector: "next",
  46154. protocol: "interpreting",
  46155. fn: function (){
  46156. var self=this,$self=this;
  46157. var nd,nextNode;
  46158. return $core.withContext(function($ctx1) {
  46159. var $1,$2,$receiver;
  46160. nd=$self._node();
  46161. $1=$recv(nd)._parent();
  46162. if(($receiver = $1) == null || $receiver.a$nil){
  46163. nextNode=$1;
  46164. } else {
  46165. var parent;
  46166. parent=$receiver;
  46167. $2=$recv(parent)._nextSiblingNode_(nd);
  46168. if(($receiver = $2) == null || $receiver.a$nil){
  46169. nextNode=parent;
  46170. } else {
  46171. var sibling;
  46172. sibling=$receiver;
  46173. nextNode=$recv($recv($globals.ASTEnterNode)._on_(self))._visit_(sibling);
  46174. }
  46175. }
  46176. $self._node_(nextNode);
  46177. return self;
  46178. }, function($ctx1) {$ctx1.fill(self,"next",{nd:nd,nextNode:nextNode},$globals.ASTInterpreter)});
  46179. },
  46180. args: [],
  46181. 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",
  46182. referencedClasses: ["ASTEnterNode"],
  46183. messageSends: ["node", "ifNotNil:", "parent", "ifNil:ifNotNil:", "nextSiblingNode:", "visit:", "on:", "node:"]
  46184. }),
  46185. $globals.ASTInterpreter);
  46186. $core.addMethod(
  46187. $core.method({
  46188. selector: "node",
  46189. protocol: "accessing",
  46190. fn: function (){
  46191. var self=this,$self=this;
  46192. return $self["@node"];
  46193. },
  46194. args: [],
  46195. source: "node\x0a\x09\x22Answer the next node, ie the node to be evaluated in the next step\x22\x0a\x09\x0a\x09^ node",
  46196. referencedClasses: [],
  46197. messageSends: []
  46198. }),
  46199. $globals.ASTInterpreter);
  46200. $core.addMethod(
  46201. $core.method({
  46202. selector: "node:",
  46203. protocol: "accessing",
  46204. fn: function (aNode){
  46205. var self=this,$self=this;
  46206. $self["@node"]=aNode;
  46207. return self;
  46208. },
  46209. args: ["aNode"],
  46210. source: "node: aNode\x0a\x09node := aNode",
  46211. referencedClasses: [],
  46212. messageSends: []
  46213. }),
  46214. $globals.ASTInterpreter);
  46215. $core.addMethod(
  46216. $core.method({
  46217. selector: "peek",
  46218. protocol: "stack",
  46219. fn: function (){
  46220. var self=this,$self=this;
  46221. return $core.withContext(function($ctx1) {
  46222. var $1;
  46223. var $early={};
  46224. try {
  46225. $1=$self._stack();
  46226. $ctx1.sendIdx["stack"]=1;
  46227. $recv($1)._ifEmpty_((function(){
  46228. throw $early=[nil];
  46229. }));
  46230. return $recv($self._stack())._last();
  46231. }
  46232. catch(e) {if(e===$early)return e[0]; throw e}
  46233. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ASTInterpreter)});
  46234. },
  46235. args: [],
  46236. 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",
  46237. referencedClasses: [],
  46238. messageSends: ["ifEmpty:", "stack", "last"]
  46239. }),
  46240. $globals.ASTInterpreter);
  46241. $core.addMethod(
  46242. $core.method({
  46243. selector: "pop",
  46244. protocol: "stack",
  46245. fn: function (){
  46246. var self=this,$self=this;
  46247. var peekedValue;
  46248. return $core.withContext(function($ctx1) {
  46249. peekedValue=$self._peek();
  46250. $recv($self._stack())._removeLast();
  46251. return peekedValue;
  46252. }, function($ctx1) {$ctx1.fill(self,"pop",{peekedValue:peekedValue},$globals.ASTInterpreter)});
  46253. },
  46254. args: [],
  46255. 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",
  46256. referencedClasses: [],
  46257. messageSends: ["peek", "removeLast", "stack"]
  46258. }),
  46259. $globals.ASTInterpreter);
  46260. $core.addMethod(
  46261. $core.method({
  46262. selector: "proceed",
  46263. protocol: "interpreting",
  46264. fn: function (){
  46265. var self=this,$self=this;
  46266. return $core.withContext(function($ctx1) {
  46267. $recv((function(){
  46268. return $core.withContext(function($ctx2) {
  46269. return $self._atEnd();
  46270. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46271. }))._whileFalse_((function(){
  46272. return $core.withContext(function($ctx2) {
  46273. return $self._step();
  46274. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46275. }));
  46276. return self;
  46277. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTInterpreter)});
  46278. },
  46279. args: [],
  46280. source: "proceed\x0a\x09\x22Eagerly evaluate the ast\x22\x0a\x09\x0a\x09[ self atEnd ] \x0a\x09\x09whileFalse: [ self step ]",
  46281. referencedClasses: [],
  46282. messageSends: ["whileFalse:", "atEnd", "step"]
  46283. }),
  46284. $globals.ASTInterpreter);
  46285. $core.addMethod(
  46286. $core.method({
  46287. selector: "push:",
  46288. protocol: "stack",
  46289. fn: function (anObject){
  46290. var self=this,$self=this;
  46291. return $core.withContext(function($ctx1) {
  46292. return $recv($self._stack())._add_(anObject);
  46293. }, function($ctx1) {$ctx1.fill(self,"push:",{anObject:anObject},$globals.ASTInterpreter)});
  46294. },
  46295. args: ["anObject"],
  46296. source: "push: anObject\x0a\x09\x22Push an object to the context stack\x22\x0a\x09\x0a\x09^ self stack add: anObject",
  46297. referencedClasses: [],
  46298. messageSends: ["add:", "stack"]
  46299. }),
  46300. $globals.ASTInterpreter);
  46301. $core.addMethod(
  46302. $core.method({
  46303. selector: "restart",
  46304. protocol: "interpreting",
  46305. fn: function (){
  46306. var self=this,$self=this;
  46307. return $core.withContext(function($ctx1) {
  46308. $self._node_($recv($self._context())._ast());
  46309. $self._enterNode();
  46310. return self;
  46311. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTInterpreter)});
  46312. },
  46313. args: [],
  46314. source: "restart\x0a\x09self node: self context ast; enterNode",
  46315. referencedClasses: [],
  46316. messageSends: ["node:", "ast", "context", "enterNode"]
  46317. }),
  46318. $globals.ASTInterpreter);
  46319. $core.addMethod(
  46320. $core.method({
  46321. selector: "result",
  46322. protocol: "accessing",
  46323. fn: function (){
  46324. var self=this,$self=this;
  46325. return $core.withContext(function($ctx1) {
  46326. var $1;
  46327. $1=$self._hasReturned();
  46328. if($core.assert($1)){
  46329. return $self._returnValue();
  46330. } else {
  46331. return $recv($self._context())._receiver();
  46332. }
  46333. }, function($ctx1) {$ctx1.fill(self,"result",{},$globals.ASTInterpreter)});
  46334. },
  46335. args: [],
  46336. source: "result\x0a\x09^ self hasReturned \x0a\x09\x09ifTrue: [ self returnValue ] \x0a\x09\x09ifFalse: [ self context receiver ]",
  46337. referencedClasses: [],
  46338. messageSends: ["ifTrue:ifFalse:", "hasReturned", "returnValue", "receiver", "context"]
  46339. }),
  46340. $globals.ASTInterpreter);
  46341. $core.addMethod(
  46342. $core.method({
  46343. selector: "returnValue",
  46344. protocol: "accessing",
  46345. fn: function (){
  46346. var self=this,$self=this;
  46347. return $self["@returnValue"];
  46348. },
  46349. args: [],
  46350. source: "returnValue\x0a\x09^ returnValue",
  46351. referencedClasses: [],
  46352. messageSends: []
  46353. }),
  46354. $globals.ASTInterpreter);
  46355. $core.addMethod(
  46356. $core.method({
  46357. selector: "returnValue:",
  46358. protocol: "accessing",
  46359. fn: function (anObject){
  46360. var self=this,$self=this;
  46361. $self["@returnValue"]=anObject;
  46362. return self;
  46363. },
  46364. args: ["anObject"],
  46365. source: "returnValue: anObject\x0a\x09returnValue := anObject",
  46366. referencedClasses: [],
  46367. messageSends: []
  46368. }),
  46369. $globals.ASTInterpreter);
  46370. $core.addMethod(
  46371. $core.method({
  46372. selector: "sendMessage:to:superSend:",
  46373. protocol: "private",
  46374. fn: function (aMessage,anObject,aBoolean){
  46375. var self=this,$self=this;
  46376. var method;
  46377. return $core.withContext(function($ctx1) {
  46378. var $2,$1,$3,$receiver;
  46379. var $early={};
  46380. try {
  46381. if(!$core.assert(aBoolean)){
  46382. return $recv(aMessage)._sendTo_(anObject);
  46383. }
  46384. $2=$recv(anObject)._class();
  46385. $ctx1.sendIdx["class"]=1;
  46386. $1=$recv($2)._superclass();
  46387. $ctx1.sendIdx["superclass"]=1;
  46388. if(($receiver = $1) == null || $receiver.a$nil){
  46389. $3=$self._messageNotUnderstood_receiver_(aMessage,anObject);
  46390. $ctx1.sendIdx["messageNotUnderstood:receiver:"]=1;
  46391. return $3;
  46392. } else {
  46393. $1;
  46394. }
  46395. method=$recv($recv($recv($recv(anObject)._class())._superclass())._methodDictionary())._at_ifAbsent_($recv(aMessage)._selector(),(function(){
  46396. return $core.withContext(function($ctx2) {
  46397. throw $early=[$self._messageNotUnderstood_receiver_(aMessage,anObject)];
  46398. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  46399. }));
  46400. return $recv(method)._sendTo_arguments_(anObject,$recv(aMessage)._arguments());
  46401. }
  46402. catch(e) {if(e===$early)return e[0]; throw e}
  46403. }, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method},$globals.ASTInterpreter)});
  46404. },
  46405. args: ["aMessage", "anObject", "aBoolean"],
  46406. source: "sendMessage: aMessage to: anObject superSend: aBoolean\x0a\x09| method |\x0a\x09\x0a\x09aBoolean ifFalse: [ ^ aMessage sendTo: anObject ].\x0a\x09anObject class superclass ifNil: [ ^ self messageNotUnderstood: aMessage receiver: anObject ].\x0a\x09\x0a\x09method := anObject class superclass methodDictionary\x0a\x09\x09at: aMessage selector\x0a\x09\x09ifAbsent: [ ^ self messageNotUnderstood: aMessage receiver: anObject ].\x0a\x09\x09\x0a\x09^ method sendTo: anObject arguments: aMessage arguments",
  46407. referencedClasses: [],
  46408. messageSends: ["ifFalse:", "sendTo:", "ifNil:", "superclass", "class", "messageNotUnderstood:receiver:", "at:ifAbsent:", "methodDictionary", "selector", "sendTo:arguments:", "arguments"]
  46409. }),
  46410. $globals.ASTInterpreter);
  46411. $core.addMethod(
  46412. $core.method({
  46413. selector: "setNonLocalReturnFromContext:",
  46414. protocol: "interpreting",
  46415. fn: function (aContext){
  46416. var self=this,$self=this;
  46417. return $core.withContext(function($ctx1) {
  46418. var $2,$1;
  46419. $2=$recv(aContext)._interpreter();
  46420. $ctx1.sendIdx["interpreter"]=1;
  46421. $1=$recv($2)._hasReturned();
  46422. if($core.assert($1)){
  46423. $self["@returned"]=true;
  46424. $self._returnValue_($recv($recv(aContext)._interpreter())._returnValue());
  46425. }
  46426. return self;
  46427. }, function($ctx1) {$ctx1.fill(self,"setNonLocalReturnFromContext:",{aContext:aContext},$globals.ASTInterpreter)});
  46428. },
  46429. args: ["aContext"],
  46430. source: "setNonLocalReturnFromContext: aContext\x0a\x09aContext interpreter hasReturned ifTrue: [\x0a\x09\x09returned := true.\x0a\x09\x09self returnValue: aContext interpreter returnValue ]",
  46431. referencedClasses: [],
  46432. messageSends: ["ifTrue:", "hasReturned", "interpreter", "returnValue:", "returnValue"]
  46433. }),
  46434. $globals.ASTInterpreter);
  46435. $core.addMethod(
  46436. $core.method({
  46437. selector: "skip",
  46438. protocol: "interpreting",
  46439. fn: function (){
  46440. var self=this,$self=this;
  46441. return $core.withContext(function($ctx1) {
  46442. $self._next();
  46443. return self;
  46444. }, function($ctx1) {$ctx1.fill(self,"skip",{},$globals.ASTInterpreter)});
  46445. },
  46446. args: [],
  46447. source: "skip\x0a\x09self next",
  46448. referencedClasses: [],
  46449. messageSends: ["next"]
  46450. }),
  46451. $globals.ASTInterpreter);
  46452. $core.addMethod(
  46453. $core.method({
  46454. selector: "stack",
  46455. protocol: "accessing",
  46456. fn: function (){
  46457. var self=this,$self=this;
  46458. return $core.withContext(function($ctx1) {
  46459. var $1,$receiver;
  46460. $1=$self["@stack"];
  46461. if(($receiver = $1) == null || $receiver.a$nil){
  46462. $self["@stack"]=$recv($globals.OrderedCollection)._new();
  46463. return $self["@stack"];
  46464. } else {
  46465. return $1;
  46466. }
  46467. }, function($ctx1) {$ctx1.fill(self,"stack",{},$globals.ASTInterpreter)});
  46468. },
  46469. args: [],
  46470. source: "stack\x0a\x09^ stack ifNil: [ stack := OrderedCollection new ]",
  46471. referencedClasses: ["OrderedCollection"],
  46472. messageSends: ["ifNil:", "new"]
  46473. }),
  46474. $globals.ASTInterpreter);
  46475. $core.addMethod(
  46476. $core.method({
  46477. selector: "step",
  46478. protocol: "interpreting",
  46479. fn: function (){
  46480. var self=this,$self=this;
  46481. return $core.withContext(function($ctx1) {
  46482. $self._interpret();
  46483. $self._next();
  46484. return self;
  46485. }, function($ctx1) {$ctx1.fill(self,"step",{},$globals.ASTInterpreter)});
  46486. },
  46487. args: [],
  46488. source: "step\x0a\x09self \x0a\x09\x09interpret; \x0a\x09\x09next",
  46489. referencedClasses: [],
  46490. messageSends: ["interpret", "next"]
  46491. }),
  46492. $globals.ASTInterpreter);
  46493. $core.addMethod(
  46494. $core.method({
  46495. selector: "stepOver",
  46496. protocol: "interpreting",
  46497. fn: function (){
  46498. var self=this,$self=this;
  46499. return $core.withContext(function($ctx1) {
  46500. var $2,$1;
  46501. $self._step();
  46502. $ctx1.sendIdx["step"]=1;
  46503. $recv((function(){
  46504. return $core.withContext(function($ctx2) {
  46505. $2=$self._node();
  46506. $ctx2.sendIdx["node"]=1;
  46507. $1=$recv($2)._isNil();
  46508. return $recv($1)._or_((function(){
  46509. return $core.withContext(function($ctx3) {
  46510. return $recv($self._node())._isSteppingNode();
  46511. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  46512. }));
  46513. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46514. }))._whileFalse_((function(){
  46515. return $core.withContext(function($ctx2) {
  46516. return $self._step();
  46517. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  46518. }));
  46519. return self;
  46520. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTInterpreter)});
  46521. },
  46522. args: [],
  46523. source: "stepOver\x0a\x09self step.\x0a\x09\x0a\x09[ self node isNil or: [ self node isSteppingNode ] ] whileFalse: [ \x0a\x09\x09self step ]",
  46524. referencedClasses: [],
  46525. messageSends: ["step", "whileFalse:", "or:", "isNil", "node", "isSteppingNode"]
  46526. }),
  46527. $globals.ASTInterpreter);
  46528. $core.addMethod(
  46529. $core.method({
  46530. selector: "visit:",
  46531. protocol: "visiting",
  46532. fn: function (aNode){
  46533. var self=this,$self=this;
  46534. return $core.withContext(function($ctx1) {
  46535. var $1;
  46536. $1=$self._hasReturned();
  46537. if(!$core.assert($1)){
  46538. (
  46539. $ctx1.supercall = true,
  46540. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
  46541. $ctx1.supercall = false;
  46542. }
  46543. return self;
  46544. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ASTInterpreter)});
  46545. },
  46546. args: ["aNode"],
  46547. source: "visit: aNode\x0a\x09self hasReturned ifFalse: [ super visit: aNode ]",
  46548. referencedClasses: [],
  46549. messageSends: ["ifFalse:", "hasReturned", "visit:"]
  46550. }),
  46551. $globals.ASTInterpreter);
  46552. $core.addMethod(
  46553. $core.method({
  46554. selector: "visitAssignmentNode:",
  46555. protocol: "visiting",
  46556. fn: function (aNode){
  46557. var self=this,$self=this;
  46558. var poppedValue;
  46559. return $core.withContext(function($ctx1) {
  46560. poppedValue=$self._pop();
  46561. $ctx1.sendIdx["pop"]=1;
  46562. $self._pop();
  46563. $self._push_(poppedValue);
  46564. $self._assign_to_($recv(aNode)._left(),poppedValue);
  46565. return self;
  46566. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,poppedValue:poppedValue},$globals.ASTInterpreter)});
  46567. },
  46568. args: ["aNode"],
  46569. 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",
  46570. referencedClasses: [],
  46571. messageSends: ["pop", "push:", "assign:to:", "left"]
  46572. }),
  46573. $globals.ASTInterpreter);
  46574. $core.addMethod(
  46575. $core.method({
  46576. selector: "visitBlockNode:",
  46577. protocol: "visiting",
  46578. fn: function (aNode){
  46579. var self=this,$self=this;
  46580. var block;
  46581. return $core.withContext(function($ctx1) {
  46582. block=$recv($globals.AIBlockClosure)._forContext_node_($self._context(),aNode);
  46583. $self._push_(block);
  46584. return self;
  46585. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,block:block},$globals.ASTInterpreter)});
  46586. },
  46587. args: ["aNode"],
  46588. 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",
  46589. referencedClasses: ["AIBlockClosure"],
  46590. messageSends: ["forContext:node:", "context", "push:"]
  46591. }),
  46592. $globals.ASTInterpreter);
  46593. $core.addMethod(
  46594. $core.method({
  46595. selector: "visitBlockSequenceNode:",
  46596. protocol: "visiting",
  46597. fn: function (aNode){
  46598. var self=this,$self=this;
  46599. return $core.withContext(function($ctx1) {
  46600. (
  46601. $ctx1.supercall = true,
  46602. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._visitBlockSequenceNode_.apply($self, [aNode]));
  46603. $ctx1.supercall = false;
  46604. $self["@forceAtEnd"]=true;
  46605. return self;
  46606. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46607. },
  46608. args: ["aNode"],
  46609. 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",
  46610. referencedClasses: [],
  46611. messageSends: ["visitBlockSequenceNode:"]
  46612. }),
  46613. $globals.ASTInterpreter);
  46614. $core.addMethod(
  46615. $core.method({
  46616. selector: "visitDagNode:",
  46617. protocol: "visiting",
  46618. fn: function (aNode){
  46619. var self=this,$self=this;
  46620. return self;
  46621. },
  46622. args: ["aNode"],
  46623. source: "visitDagNode: aNode\x0a\x09\x22Do nothing by default. Especially, do not visit children recursively.\x22",
  46624. referencedClasses: [],
  46625. messageSends: []
  46626. }),
  46627. $globals.ASTInterpreter);
  46628. $core.addMethod(
  46629. $core.method({
  46630. selector: "visitDynamicArrayNode:",
  46631. protocol: "visiting",
  46632. fn: function (aNode){
  46633. var self=this,$self=this;
  46634. var array;
  46635. return $core.withContext(function($ctx1) {
  46636. array=[];
  46637. $recv($recv(aNode)._dagChildren())._do_((function(each){
  46638. return $core.withContext(function($ctx2) {
  46639. return $recv(array)._addFirst_($self._pop());
  46640. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46641. }));
  46642. $self._push_(array);
  46643. return self;
  46644. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.ASTInterpreter)});
  46645. },
  46646. args: ["aNode"],
  46647. 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",
  46648. referencedClasses: [],
  46649. messageSends: ["do:", "dagChildren", "addFirst:", "pop", "push:"]
  46650. }),
  46651. $globals.ASTInterpreter);
  46652. $core.addMethod(
  46653. $core.method({
  46654. selector: "visitDynamicDictionaryNode:",
  46655. protocol: "visiting",
  46656. fn: function (aNode){
  46657. var self=this,$self=this;
  46658. var keyValueList;
  46659. return $core.withContext(function($ctx1) {
  46660. keyValueList=$recv($globals.OrderedCollection)._new();
  46661. $recv($recv(aNode)._dagChildren())._do_((function(each){
  46662. return $core.withContext(function($ctx2) {
  46663. return $recv(keyValueList)._add_($self._pop());
  46664. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46665. }));
  46666. $self._push_($recv($globals.HashedCollection)._newFromPairs_($recv(keyValueList)._reversed()));
  46667. return self;
  46668. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,keyValueList:keyValueList},$globals.ASTInterpreter)});
  46669. },
  46670. args: ["aNode"],
  46671. 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)",
  46672. referencedClasses: ["OrderedCollection", "HashedCollection"],
  46673. messageSends: ["new", "do:", "dagChildren", "add:", "pop", "push:", "newFromPairs:", "reversed"]
  46674. }),
  46675. $globals.ASTInterpreter);
  46676. $core.addMethod(
  46677. $core.method({
  46678. selector: "visitJSStatementNode:",
  46679. protocol: "visiting",
  46680. fn: function (aNode){
  46681. var self=this,$self=this;
  46682. return $core.withContext(function($ctx1) {
  46683. $self["@returned"]=true;
  46684. $self._returnValue_($self._eval_($recv(aNode)._source()));
  46685. return self;
  46686. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46687. },
  46688. args: ["aNode"],
  46689. source: "visitJSStatementNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: (self eval: aNode source)",
  46690. referencedClasses: [],
  46691. messageSends: ["returnValue:", "eval:", "source"]
  46692. }),
  46693. $globals.ASTInterpreter);
  46694. $core.addMethod(
  46695. $core.method({
  46696. selector: "visitReturnNode:",
  46697. protocol: "visiting",
  46698. fn: function (aNode){
  46699. var self=this,$self=this;
  46700. return $core.withContext(function($ctx1) {
  46701. $self["@returned"]=true;
  46702. $self._returnValue_($self._pop());
  46703. return self;
  46704. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46705. },
  46706. args: ["aNode"],
  46707. source: "visitReturnNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: self pop",
  46708. referencedClasses: [],
  46709. messageSends: ["returnValue:", "pop"]
  46710. }),
  46711. $globals.ASTInterpreter);
  46712. $core.addMethod(
  46713. $core.method({
  46714. selector: "visitSendNode:",
  46715. protocol: "visiting",
  46716. fn: function (aNode){
  46717. var self=this,$self=this;
  46718. var receiver,args,message,result;
  46719. return $core.withContext(function($ctx1) {
  46720. var $1;
  46721. args=$recv($recv(aNode)._arguments())._collect_((function(each){
  46722. return $core.withContext(function($ctx2) {
  46723. return $self._pop();
  46724. $ctx2.sendIdx["pop"]=1;
  46725. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46726. }));
  46727. receiver=$self._peek();
  46728. message=$self._messageFromSendNode_arguments_(aNode,$recv(args)._reversed());
  46729. result=$self._sendMessage_to_superSend_(message,receiver,$recv(aNode)._superSend());
  46730. $1=$recv($recv(aNode)._isCascadeSendNode())._and_((function(){
  46731. return $core.withContext(function($ctx2) {
  46732. return $recv($recv(aNode)._isLastChild())._not();
  46733. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46734. }));
  46735. if(!$core.assert($1)){
  46736. $self._pop();
  46737. $self._push_(result);
  46738. }
  46739. return self;
  46740. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,receiver:receiver,args:args,message:message,result:result},$globals.ASTInterpreter)});
  46741. },
  46742. args: ["aNode"],
  46743. 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 ]",
  46744. referencedClasses: [],
  46745. messageSends: ["collect:", "arguments", "pop", "peek", "messageFromSendNode:arguments:", "reversed", "sendMessage:to:superSend:", "superSend", "ifFalse:", "and:", "isCascadeSendNode", "not", "isLastChild", "push:"]
  46746. }),
  46747. $globals.ASTInterpreter);
  46748. $core.addMethod(
  46749. $core.method({
  46750. selector: "visitValueNode:",
  46751. protocol: "visiting",
  46752. fn: function (aNode){
  46753. var self=this,$self=this;
  46754. return $core.withContext(function($ctx1) {
  46755. $self._push_($recv(aNode)._value());
  46756. return self;
  46757. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46758. },
  46759. args: ["aNode"],
  46760. source: "visitValueNode: aNode\x0a\x09self push: aNode value",
  46761. referencedClasses: [],
  46762. messageSends: ["push:", "value"]
  46763. }),
  46764. $globals.ASTInterpreter);
  46765. $core.addMethod(
  46766. $core.method({
  46767. selector: "visitVariableNode:",
  46768. protocol: "visiting",
  46769. fn: function (aNode){
  46770. var self=this,$self=this;
  46771. return $core.withContext(function($ctx1) {
  46772. var $2,$1,$5,$6,$4,$3,$8,$10,$9,$11,$12,$13,$15,$14,$16,$17,$7;
  46773. $2=$recv(aNode)._binding();
  46774. $ctx1.sendIdx["binding"]=1;
  46775. $1=$recv($2)._isUnknownVar();
  46776. if($core.assert($1)){
  46777. $5=$recv($globals.Platform)._globals();
  46778. $ctx1.sendIdx["globals"]=1;
  46779. $6=$recv(aNode)._value();
  46780. $ctx1.sendIdx["value"]=1;
  46781. $4=$recv($5)._at_ifAbsent_($6,(function(){
  46782. return $core.withContext(function($ctx2) {
  46783. return $self._error_("Unknown variable");
  46784. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46785. }));
  46786. $ctx1.sendIdx["at:ifAbsent:"]=1;
  46787. $3=$self._push_($4);
  46788. $ctx1.sendIdx["push:"]=1;
  46789. return $3;
  46790. }
  46791. $8=$recv($recv(aNode)._binding())._isInstanceVar();
  46792. if($core.assert($8)){
  46793. $10=$self._context();
  46794. $ctx1.sendIdx["context"]=1;
  46795. $9=$recv($10)._receiver();
  46796. $11=$recv(aNode)._value();
  46797. $ctx1.sendIdx["value"]=2;
  46798. $7=$recv($9)._instVarAt_($11);
  46799. } else {
  46800. $12=$self._context();
  46801. $13=$recv(aNode)._value();
  46802. $ctx1.sendIdx["value"]=3;
  46803. $7=$recv($12)._localAt_ifAbsent_($13,(function(){
  46804. return $core.withContext(function($ctx2) {
  46805. $15=$recv(aNode)._value();
  46806. $ctx2.sendIdx["value"]=4;
  46807. $14=$recv($15)._isCapitalized();
  46808. if($core.assert($14)){
  46809. $16=$recv($globals.Smalltalk)._globals();
  46810. $ctx2.sendIdx["globals"]=2;
  46811. $17=$recv(aNode)._value();
  46812. $ctx2.sendIdx["value"]=5;
  46813. return $recv($16)._at_ifAbsent_($17,(function(){
  46814. return $core.withContext(function($ctx3) {
  46815. return $recv($recv($globals.Platform)._globals())._at_($recv(aNode)._value());
  46816. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  46817. }));
  46818. }
  46819. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  46820. }));
  46821. }
  46822. $self._push_($7);
  46823. return self;
  46824. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46825. },
  46826. args: ["aNode"],
  46827. source: "visitVariableNode: aNode\x0a\x09aNode binding isUnknownVar ifTrue: [\x0a\x09\x09^ self push: (Platform globals at: aNode value ifAbsent: [ self error: 'Unknown variable' ]) ].\x0a\x09\x09\x0a\x09self push: (aNode binding isInstanceVar\x0a\x09\x09ifTrue: [ self context receiver instVarAt: aNode value ]\x0a\x09\x09ifFalse: [ self context \x0a\x09\x09\x09localAt: aNode value\x0a\x09\x09\x09ifAbsent: [\x0a\x09\x09\x09\x09aNode value isCapitalized\x0a\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09Smalltalk globals \x0a\x09\x09\x09\x09\x09\x09\x09at: aNode value \x0a\x09\x09\x09\x09\x09\x09\x09ifAbsent: [ Platform globals at: aNode value ] ] ] ])",
  46828. referencedClasses: ["Platform", "Smalltalk"],
  46829. messageSends: ["ifTrue:", "isUnknownVar", "binding", "push:", "at:ifAbsent:", "globals", "value", "error:", "ifTrue:ifFalse:", "isInstanceVar", "instVarAt:", "receiver", "context", "localAt:ifAbsent:", "isCapitalized", "at:"]
  46830. }),
  46831. $globals.ASTInterpreter);
  46832. $core.addClass("ASTInterpreterError", $globals.Error, [], "Compiler-Interpreter");
  46833. $globals.ASTInterpreterError.comment="I get signaled when an AST interpreter is unable to interpret a node.";
  46834. $core.addClass("ASTPCNodeVisitor", $globals.NodeVisitor, ["index", "trackedIndex", "selector", "currentNode"], "Compiler-Interpreter");
  46835. $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`";
  46836. $core.addMethod(
  46837. $core.method({
  46838. selector: "currentNode",
  46839. protocol: "accessing",
  46840. fn: function (){
  46841. var self=this,$self=this;
  46842. return $self["@currentNode"];
  46843. },
  46844. args: [],
  46845. source: "currentNode\x0a\x09^ currentNode",
  46846. referencedClasses: [],
  46847. messageSends: []
  46848. }),
  46849. $globals.ASTPCNodeVisitor);
  46850. $core.addMethod(
  46851. $core.method({
  46852. selector: "increaseTrackedIndex",
  46853. protocol: "accessing",
  46854. fn: function (){
  46855. var self=this,$self=this;
  46856. return $core.withContext(function($ctx1) {
  46857. $self["@trackedIndex"]=$recv($self._trackedIndex()).__plus((1));
  46858. return self;
  46859. }, function($ctx1) {$ctx1.fill(self,"increaseTrackedIndex",{},$globals.ASTPCNodeVisitor)});
  46860. },
  46861. args: [],
  46862. source: "increaseTrackedIndex\x0a\x09trackedIndex := self trackedIndex + 1",
  46863. referencedClasses: [],
  46864. messageSends: ["+", "trackedIndex"]
  46865. }),
  46866. $globals.ASTPCNodeVisitor);
  46867. $core.addMethod(
  46868. $core.method({
  46869. selector: "index",
  46870. protocol: "accessing",
  46871. fn: function (){
  46872. var self=this,$self=this;
  46873. return $self["@index"];
  46874. },
  46875. args: [],
  46876. source: "index\x0a\x09^ index",
  46877. referencedClasses: [],
  46878. messageSends: []
  46879. }),
  46880. $globals.ASTPCNodeVisitor);
  46881. $core.addMethod(
  46882. $core.method({
  46883. selector: "index:",
  46884. protocol: "accessing",
  46885. fn: function (aNumber){
  46886. var self=this,$self=this;
  46887. $self["@index"]=aNumber;
  46888. return self;
  46889. },
  46890. args: ["aNumber"],
  46891. source: "index: aNumber\x0a\x09index := aNumber",
  46892. referencedClasses: [],
  46893. messageSends: []
  46894. }),
  46895. $globals.ASTPCNodeVisitor);
  46896. $core.addMethod(
  46897. $core.method({
  46898. selector: "selector",
  46899. protocol: "accessing",
  46900. fn: function (){
  46901. var self=this,$self=this;
  46902. return $self["@selector"];
  46903. },
  46904. args: [],
  46905. source: "selector\x0a\x09^ selector",
  46906. referencedClasses: [],
  46907. messageSends: []
  46908. }),
  46909. $globals.ASTPCNodeVisitor);
  46910. $core.addMethod(
  46911. $core.method({
  46912. selector: "selector:",
  46913. protocol: "accessing",
  46914. fn: function (aString){
  46915. var self=this,$self=this;
  46916. $self["@selector"]=aString;
  46917. return self;
  46918. },
  46919. args: ["aString"],
  46920. source: "selector: aString\x0a\x09selector := aString",
  46921. referencedClasses: [],
  46922. messageSends: []
  46923. }),
  46924. $globals.ASTPCNodeVisitor);
  46925. $core.addMethod(
  46926. $core.method({
  46927. selector: "trackedIndex",
  46928. protocol: "accessing",
  46929. fn: function (){
  46930. var self=this,$self=this;
  46931. return $core.withContext(function($ctx1) {
  46932. var $1,$receiver;
  46933. $1=$self["@trackedIndex"];
  46934. if(($receiver = $1) == null || $receiver.a$nil){
  46935. $self["@trackedIndex"]=(0);
  46936. return $self["@trackedIndex"];
  46937. } else {
  46938. return $1;
  46939. }
  46940. }, function($ctx1) {$ctx1.fill(self,"trackedIndex",{},$globals.ASTPCNodeVisitor)});
  46941. },
  46942. args: [],
  46943. source: "trackedIndex\x0a\x09^ trackedIndex ifNil: [ trackedIndex := 0 ]",
  46944. referencedClasses: [],
  46945. messageSends: ["ifNil:"]
  46946. }),
  46947. $globals.ASTPCNodeVisitor);
  46948. $core.addMethod(
  46949. $core.method({
  46950. selector: "visitJSStatementNode:",
  46951. protocol: "visiting",
  46952. fn: function (aNode){
  46953. var self=this,$self=this;
  46954. $self["@currentNode"]=aNode;
  46955. return self;
  46956. },
  46957. args: ["aNode"],
  46958. 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",
  46959. referencedClasses: [],
  46960. messageSends: []
  46961. }),
  46962. $globals.ASTPCNodeVisitor);
  46963. $core.addMethod(
  46964. $core.method({
  46965. selector: "visitSendNode:",
  46966. protocol: "visiting",
  46967. fn: function (aNode){
  46968. var self=this,$self=this;
  46969. return $core.withContext(function($ctx1) {
  46970. var $2,$1,$3;
  46971. (
  46972. $ctx1.supercall = true,
  46973. ($globals.ASTPCNodeVisitor.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  46974. $ctx1.supercall = false;
  46975. $2=$self._selector();
  46976. $ctx1.sendIdx["selector"]=1;
  46977. $1=$recv($2).__eq($recv(aNode)._selector());
  46978. $ctx1.sendIdx["="]=1;
  46979. if($core.assert($1)){
  46980. $3=$recv($self._trackedIndex()).__eq($self._index());
  46981. if($core.assert($3)){
  46982. $self["@currentNode"]=aNode;
  46983. $self["@currentNode"];
  46984. }
  46985. $self._increaseTrackedIndex();
  46986. }
  46987. return self;
  46988. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.ASTPCNodeVisitor)});
  46989. },
  46990. args: ["aNode"],
  46991. 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 ]",
  46992. referencedClasses: [],
  46993. messageSends: ["visitSendNode:", "ifTrue:", "=", "selector", "trackedIndex", "index", "increaseTrackedIndex"]
  46994. }),
  46995. $globals.ASTPCNodeVisitor);
  46996. $core.addMethod(
  46997. $core.method({
  46998. selector: "isLastChild",
  46999. protocol: "*Compiler-Interpreter",
  47000. fn: function (){
  47001. var self=this,$self=this;
  47002. return $core.withContext(function($ctx1) {
  47003. return $recv($recv($recv($self._parent())._dagChildren())._last()).__eq(self);
  47004. }, function($ctx1) {$ctx1.fill(self,"isLastChild",{},$globals.ASTNode)});
  47005. },
  47006. args: [],
  47007. source: "isLastChild\x0a\x09^ self parent dagChildren last = self",
  47008. referencedClasses: [],
  47009. messageSends: ["=", "last", "dagChildren", "parent"]
  47010. }),
  47011. $globals.ASTNode);
  47012. $core.addMethod(
  47013. $core.method({
  47014. selector: "isSteppingNode",
  47015. protocol: "*Compiler-Interpreter",
  47016. fn: function (){
  47017. var self=this,$self=this;
  47018. return false;
  47019. },
  47020. args: [],
  47021. source: "isSteppingNode\x0a\x09^ false",
  47022. referencedClasses: [],
  47023. messageSends: []
  47024. }),
  47025. $globals.ASTNode);
  47026. $core.addMethod(
  47027. $core.method({
  47028. selector: "nextSiblingNode:",
  47029. protocol: "*Compiler-Interpreter",
  47030. fn: function (aNode){
  47031. var self=this,$self=this;
  47032. return $core.withContext(function($ctx1) {
  47033. var $1;
  47034. var $early={};
  47035. try {
  47036. $1=$self._dagChildren();
  47037. $ctx1.sendIdx["dagChildren"]=1;
  47038. return $recv($1)._at_ifAbsent_($recv($recv($self._dagChildren())._indexOf_(aNode)).__plus((1)),(function(){
  47039. throw $early=[nil];
  47040. }));
  47041. }
  47042. catch(e) {if(e===$early)return e[0]; throw e}
  47043. }, function($ctx1) {$ctx1.fill(self,"nextSiblingNode:",{aNode:aNode},$globals.ASTNode)});
  47044. },
  47045. args: ["aNode"],
  47046. 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 ]",
  47047. referencedClasses: [],
  47048. messageSends: ["at:ifAbsent:", "dagChildren", "+", "indexOf:"]
  47049. }),
  47050. $globals.ASTNode);
  47051. $core.addMethod(
  47052. $core.method({
  47053. selector: "isSteppingNode",
  47054. protocol: "*Compiler-Interpreter",
  47055. fn: function (){
  47056. var self=this,$self=this;
  47057. return true;
  47058. },
  47059. args: [],
  47060. source: "isSteppingNode\x0a\x09^ true",
  47061. referencedClasses: [],
  47062. messageSends: []
  47063. }),
  47064. $globals.AssignmentNode);
  47065. $core.addMethod(
  47066. $core.method({
  47067. selector: "isSteppingNode",
  47068. protocol: "*Compiler-Interpreter",
  47069. fn: function (){
  47070. var self=this,$self=this;
  47071. return true;
  47072. },
  47073. args: [],
  47074. source: "isSteppingNode\x0a\x09^ true",
  47075. referencedClasses: [],
  47076. messageSends: []
  47077. }),
  47078. $globals.BlockNode);
  47079. $core.addMethod(
  47080. $core.method({
  47081. selector: "nextSiblingNode:",
  47082. protocol: "*Compiler-Interpreter",
  47083. fn: function (aNode){
  47084. var self=this,$self=this;
  47085. return nil;
  47086. },
  47087. args: ["aNode"],
  47088. 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",
  47089. referencedClasses: [],
  47090. messageSends: []
  47091. }),
  47092. $globals.BlockNode);
  47093. $core.addMethod(
  47094. $core.method({
  47095. selector: "isSteppingNode",
  47096. protocol: "*Compiler-Interpreter",
  47097. fn: function (){
  47098. var self=this,$self=this;
  47099. return true;
  47100. },
  47101. args: [],
  47102. source: "isSteppingNode\x0a\x09^ true",
  47103. referencedClasses: [],
  47104. messageSends: []
  47105. }),
  47106. $globals.DynamicArrayNode);
  47107. $core.addMethod(
  47108. $core.method({
  47109. selector: "isSteppingNode",
  47110. protocol: "*Compiler-Interpreter",
  47111. fn: function (){
  47112. var self=this,$self=this;
  47113. return true;
  47114. },
  47115. args: [],
  47116. source: "isSteppingNode\x0a\x09^ true",
  47117. referencedClasses: [],
  47118. messageSends: []
  47119. }),
  47120. $globals.DynamicDictionaryNode);
  47121. $core.addMethod(
  47122. $core.method({
  47123. selector: "isSteppingNode",
  47124. protocol: "*Compiler-Interpreter",
  47125. fn: function (){
  47126. var self=this,$self=this;
  47127. return true;
  47128. },
  47129. args: [],
  47130. source: "isSteppingNode\x0a\x09^ true",
  47131. referencedClasses: [],
  47132. messageSends: []
  47133. }),
  47134. $globals.JSStatementNode);
  47135. $core.addMethod(
  47136. $core.method({
  47137. selector: "isCascadeSendNode",
  47138. protocol: "*Compiler-Interpreter",
  47139. fn: function (){
  47140. var self=this,$self=this;
  47141. return $core.withContext(function($ctx1) {
  47142. return $recv($self._parent())._isCascadeNode();
  47143. }, function($ctx1) {$ctx1.fill(self,"isCascadeSendNode",{},$globals.SendNode)});
  47144. },
  47145. args: [],
  47146. source: "isCascadeSendNode\x0a\x09^ self parent isCascadeNode",
  47147. referencedClasses: [],
  47148. messageSends: ["isCascadeNode", "parent"]
  47149. }),
  47150. $globals.SendNode);
  47151. $core.addMethod(
  47152. $core.method({
  47153. selector: "isSteppingNode",
  47154. protocol: "*Compiler-Interpreter",
  47155. fn: function (){
  47156. var self=this,$self=this;
  47157. return true;
  47158. },
  47159. args: [],
  47160. source: "isSteppingNode\x0a\x09^ true",
  47161. referencedClasses: [],
  47162. messageSends: []
  47163. }),
  47164. $globals.SendNode);
  47165. });
  47166. define('amber/lang',[
  47167. './deploy',
  47168. './boot', // pre-fetch, dep of ./helpers
  47169. './helpers', // pre-fetch, dep of ./deploy
  47170. './parser',
  47171. // --- packages for the Amber reflection begin here ---
  47172. 'amber_core/Platform-ImportExport',
  47173. 'amber_core/Compiler-Core',
  47174. 'amber_core/Compiler-AST',
  47175. 'amber_core/Compiler-Semantic',
  47176. 'amber_core/Compiler-IR',
  47177. 'amber_core/Compiler-Inlining',
  47178. 'amber_core/Compiler-Interpreter'
  47179. // --- packages for the Amber reflection end here ---
  47180. ], function (amber) {
  47181. return amber;
  47182. });
  47183. define('amber_core/Platform-DOM',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Objects"], function($boot){"use strict";
  47184. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  47185. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  47186. var $pkg = $core.addPackage("Platform-DOM");
  47187. $pkg.innerEval = function (expr) { return eval(expr); };
  47188. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  47189. $core.addClass("PlatformDom", $globals.Object, [], "Platform-DOM");
  47190. $core.addMethod(
  47191. $core.method({
  47192. selector: "isDomNode:",
  47193. protocol: "testing",
  47194. fn: function (anObject){
  47195. var self=this,$self=this;
  47196. return $core.withContext(function($ctx1) {
  47197. return anObject.nodeType > 0 &&
  47198. Object.prototype.toString.call(anObject) !== "[object Object]";
  47199. return self;
  47200. }, function($ctx1) {$ctx1.fill(self,"isDomNode:",{anObject:anObject},$globals.PlatformDom.a$cls)});
  47201. },
  47202. args: ["anObject"],
  47203. source: "isDomNode: anObject\x0a<inlineJS: '\x0a\x09return anObject.nodeType > 0 &&\x0a\x09\x09Object.prototype.toString.call(anObject) !== \x22[object Object]\x22\x0a'>",
  47204. referencedClasses: [],
  47205. messageSends: []
  47206. }),
  47207. $globals.PlatformDom.a$cls);
  47208. $core.addMethod(
  47209. $core.method({
  47210. selector: "isFeasible",
  47211. protocol: "testing",
  47212. fn: function (){
  47213. var self=this,$self=this;
  47214. return $core.withContext(function($ctx1) {
  47215. if (typeof document === "undefined") return false;
  47216. try {
  47217. var d = document.createElement("div"),
  47218. f = document.createDocumentFragment(),
  47219. t = document.createTextNode("Hello, Amber!");
  47220. f.appendChild(t);
  47221. d.insertBefore(f, null);
  47222. return d.innerHTML === "Hello, Amber!";
  47223. } catch (e) {
  47224. return false;
  47225. };
  47226. return self;
  47227. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{},$globals.PlatformDom.a$cls)});
  47228. },
  47229. args: [],
  47230. 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'>",
  47231. referencedClasses: [],
  47232. messageSends: []
  47233. }),
  47234. $globals.PlatformDom.a$cls);
  47235. $core.addMethod(
  47236. $core.method({
  47237. selector: "newCustomEvent:detail:",
  47238. protocol: "creation",
  47239. fn: function (aString,anObject){
  47240. var self=this,$self=this;
  47241. return $core.withContext(function($ctx1) {
  47242. return new CustomEvent(aString, {detail: anObject});
  47243. return self;
  47244. }, function($ctx1) {$ctx1.fill(self,"newCustomEvent:detail:",{aString:aString,anObject:anObject},$globals.PlatformDom.a$cls)});
  47245. },
  47246. args: ["aString", "anObject"],
  47247. source: "newCustomEvent: aString detail: anObject\x0a<inlineJS: 'return new CustomEvent(aString, {detail: anObject})'>",
  47248. referencedClasses: [],
  47249. messageSends: []
  47250. }),
  47251. $globals.PlatformDom.a$cls);
  47252. $core.addMethod(
  47253. $core.method({
  47254. selector: "toArray:",
  47255. protocol: "converting",
  47256. fn: function (aDomList){
  47257. var self=this,$self=this;
  47258. return $core.withContext(function($ctx1) {
  47259. return Array.prototype.slice.call(aDomList);
  47260. return self;
  47261. }, function($ctx1) {$ctx1.fill(self,"toArray:",{aDomList:aDomList},$globals.PlatformDom.a$cls)});
  47262. },
  47263. args: ["aDomList"],
  47264. source: "toArray: aDomList\x0a<inlineJS: 'return Array.prototype.slice.call(aDomList)'>",
  47265. referencedClasses: [],
  47266. messageSends: []
  47267. }),
  47268. $globals.PlatformDom.a$cls);
  47269. $core.addMethod(
  47270. $core.method({
  47271. selector: "asDomNode",
  47272. protocol: "*Platform-DOM",
  47273. fn: function (){
  47274. var self=this,$self=this;
  47275. var fragment;
  47276. return $core.withContext(function($ctx1) {
  47277. fragment=$recv(document)._createDocumentFragment();
  47278. $self._do_((function(each){
  47279. return $core.withContext(function($ctx2) {
  47280. return $recv(fragment)._appendChild_($recv(each)._asDomNode());
  47281. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  47282. }));
  47283. return fragment;
  47284. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{fragment:fragment},$globals.Collection)});
  47285. },
  47286. args: [],
  47287. source: "asDomNode\x0a\x09| fragment |\x0a\x09fragment := document createDocumentFragment.\x0a\x09self do: [ :each | fragment appendChild: each asDomNode ].\x0a\x09^ fragment",
  47288. referencedClasses: [],
  47289. messageSends: ["createDocumentFragment", "do:", "appendChild:", "asDomNode"]
  47290. }),
  47291. $globals.Collection);
  47292. $core.addMethod(
  47293. $core.method({
  47294. selector: "asDomNode",
  47295. protocol: "*Platform-DOM",
  47296. fn: function (){
  47297. var self=this,$self=this;
  47298. return $core.withContext(function($ctx1) {
  47299. var $1,$2;
  47300. $1=$recv($globals.PlatformDom)._isDomNode_($self["@jsObject"]);
  47301. if($core.assert($1)){
  47302. return $self["@jsObject"];
  47303. } else {
  47304. $2=(
  47305. $ctx1.supercall = true,
  47306. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._asDomNode.apply($self, []));
  47307. $ctx1.supercall = false;
  47308. return $2;
  47309. }
  47310. return self;
  47311. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{},$globals.JSObjectProxy)});
  47312. },
  47313. args: [],
  47314. source: "asDomNode\x0a\x09(PlatformDom isDomNode: jsObject)\x0a\x09\x09ifTrue: [ ^ jsObject ]\x0a\x09\x09ifFalse: [ ^ super asDomNode ]",
  47315. referencedClasses: ["PlatformDom"],
  47316. messageSends: ["ifTrue:ifFalse:", "isDomNode:", "asDomNode"]
  47317. }),
  47318. $globals.JSObjectProxy);
  47319. $core.addMethod(
  47320. $core.method({
  47321. selector: "asDomNode",
  47322. protocol: "*Platform-DOM",
  47323. fn: function (){
  47324. var self=this,$self=this;
  47325. return $core.withContext(function($ctx1) {
  47326. return $recv(document)._createTextNode_($self._asString());
  47327. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{},$globals.String)});
  47328. },
  47329. args: [],
  47330. source: "asDomNode\x0a\x09^ document createTextNode: self asString",
  47331. referencedClasses: [],
  47332. messageSends: ["createTextNode:", "asString"]
  47333. }),
  47334. $globals.String);
  47335. $core.addMethod(
  47336. $core.method({
  47337. selector: "htmlTextContent",
  47338. protocol: "*Platform-DOM",
  47339. fn: function (){
  47340. var self=this,$self=this;
  47341. return $core.withContext(function($ctx1) {
  47342. var d=document.createElement("div");d.innerHTML=self;return d.textContent||d.innerText;;
  47343. return self;
  47344. }, function($ctx1) {$ctx1.fill(self,"htmlTextContent",{},$globals.String)});
  47345. },
  47346. args: [],
  47347. source: "htmlTextContent\x0a<inlineJS: 'var d=document.createElement(\x22div\x22);d.innerHTML=self;return d.textContent||d.innerText;'>",
  47348. referencedClasses: [],
  47349. messageSends: []
  47350. }),
  47351. $globals.String);
  47352. });
  47353. define('amber_core/SUnit',["amber/boot", "amber_core/Kernel-Classes", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Objects"], function($boot){"use strict";
  47354. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  47355. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  47356. var $pkg = $core.addPackage("SUnit");
  47357. $pkg.innerEval = function (expr) { return eval(expr); };
  47358. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  47359. $core.addClass("ResultAnnouncement", $globals.Object, ["result"], "SUnit");
  47360. $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.";
  47361. $core.addMethod(
  47362. $core.method({
  47363. selector: "result",
  47364. protocol: "accessing",
  47365. fn: function (){
  47366. var self=this,$self=this;
  47367. return $self["@result"];
  47368. },
  47369. args: [],
  47370. source: "result\x0a\x09^ result",
  47371. referencedClasses: [],
  47372. messageSends: []
  47373. }),
  47374. $globals.ResultAnnouncement);
  47375. $core.addMethod(
  47376. $core.method({
  47377. selector: "result:",
  47378. protocol: "accessing",
  47379. fn: function (aTestResult){
  47380. var self=this,$self=this;
  47381. $self["@result"]=aTestResult;
  47382. return self;
  47383. },
  47384. args: ["aTestResult"],
  47385. source: "result: aTestResult\x0a\x09result := aTestResult",
  47386. referencedClasses: [],
  47387. messageSends: []
  47388. }),
  47389. $globals.ResultAnnouncement);
  47390. $core.addClass("TestCase", $globals.Object, ["testSelector", "asyncTimeout", "context"], "SUnit");
  47391. $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.";
  47392. $core.addMethod(
  47393. $core.method({
  47394. selector: "assert:",
  47395. protocol: "testing",
  47396. fn: function (aBoolean){
  47397. var self=this,$self=this;
  47398. return $core.withContext(function($ctx1) {
  47399. $self._assert_description_(aBoolean,"Assertion failed");
  47400. return self;
  47401. }, function($ctx1) {$ctx1.fill(self,"assert:",{aBoolean:aBoolean},$globals.TestCase)});
  47402. },
  47403. args: ["aBoolean"],
  47404. source: "assert: aBoolean\x0a\x09self assert: aBoolean description: 'Assertion failed'",
  47405. referencedClasses: [],
  47406. messageSends: ["assert:description:"]
  47407. }),
  47408. $globals.TestCase);
  47409. $core.addMethod(
  47410. $core.method({
  47411. selector: "assert:description:",
  47412. protocol: "testing",
  47413. fn: function (aBoolean,aString){
  47414. var self=this,$self=this;
  47415. return $core.withContext(function($ctx1) {
  47416. if(!$core.assert(aBoolean)){
  47417. $self._signalFailure_(aString);
  47418. }
  47419. return self;
  47420. }, function($ctx1) {$ctx1.fill(self,"assert:description:",{aBoolean:aBoolean,aString:aString},$globals.TestCase)});
  47421. },
  47422. args: ["aBoolean", "aString"],
  47423. source: "assert: aBoolean description: aString\x0a\x09aBoolean ifFalse: [ self signalFailure: aString ]",
  47424. referencedClasses: [],
  47425. messageSends: ["ifFalse:", "signalFailure:"]
  47426. }),
  47427. $globals.TestCase);
  47428. $core.addMethod(
  47429. $core.method({
  47430. selector: "assert:equals:",
  47431. protocol: "testing",
  47432. fn: function (actual,expected){
  47433. var self=this,$self=this;
  47434. return $core.withContext(function($ctx1) {
  47435. var $1,$5,$4,$3,$2;
  47436. $1=$recv(actual).__eq(expected);
  47437. $5=$recv(expected)._printString();
  47438. $ctx1.sendIdx["printString"]=1;
  47439. $4="Expected: ".__comma($5);
  47440. $3=$recv($4).__comma(" but was: ");
  47441. $ctx1.sendIdx[","]=2;
  47442. $2=$recv($3).__comma($recv(actual)._printString());
  47443. $ctx1.sendIdx[","]=1;
  47444. return $self._assert_description_($1,$2);
  47445. }, function($ctx1) {$ctx1.fill(self,"assert:equals:",{actual:actual,expected:expected},$globals.TestCase)});
  47446. },
  47447. args: ["actual", "expected"],
  47448. source: "assert: actual equals: expected\x0a\x09^ self assert: (actual = expected) description: 'Expected: ', expected printString, ' but was: ', actual printString",
  47449. referencedClasses: [],
  47450. messageSends: ["assert:description:", "=", ",", "printString"]
  47451. }),
  47452. $globals.TestCase);
  47453. $core.addMethod(
  47454. $core.method({
  47455. selector: "async:",
  47456. protocol: "async",
  47457. fn: function (aBlock){
  47458. var self=this,$self=this;
  47459. var c;
  47460. return $core.withContext(function($ctx1) {
  47461. var $1;
  47462. $self._errorIfNotAsync_("#async");
  47463. c=$self["@context"];
  47464. return (function(){
  47465. return $core.withContext(function($ctx2) {
  47466. $1=$self._isAsync();
  47467. if($core.assert($1)){
  47468. return $recv(c)._execute_(aBlock);
  47469. }
  47470. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47471. });
  47472. }, function($ctx1) {$ctx1.fill(self,"async:",{aBlock:aBlock,c:c},$globals.TestCase)});
  47473. },
  47474. args: ["aBlock"],
  47475. source: "async: aBlock\x0a\x09| c |\x0a\x09self errorIfNotAsync: '#async'.\x0a\x09c := context.\x0a\x09^ [ self isAsync ifTrue: [ c execute: aBlock ] ]",
  47476. referencedClasses: [],
  47477. messageSends: ["errorIfNotAsync:", "ifTrue:", "isAsync", "execute:"]
  47478. }),
  47479. $globals.TestCase);
  47480. $core.addMethod(
  47481. $core.method({
  47482. selector: "context:",
  47483. protocol: "accessing",
  47484. fn: function (aRunningTestContext){
  47485. var self=this,$self=this;
  47486. $self["@context"]=aRunningTestContext;
  47487. return self;
  47488. },
  47489. args: ["aRunningTestContext"],
  47490. source: "context: aRunningTestContext\x0a\x09context := aRunningTestContext",
  47491. referencedClasses: [],
  47492. messageSends: []
  47493. }),
  47494. $globals.TestCase);
  47495. $core.addMethod(
  47496. $core.method({
  47497. selector: "deny:",
  47498. protocol: "testing",
  47499. fn: function (aBoolean){
  47500. var self=this,$self=this;
  47501. return $core.withContext(function($ctx1) {
  47502. $self._assert_($recv(aBoolean)._not());
  47503. return self;
  47504. }, function($ctx1) {$ctx1.fill(self,"deny:",{aBoolean:aBoolean},$globals.TestCase)});
  47505. },
  47506. args: ["aBoolean"],
  47507. source: "deny: aBoolean\x0a\x09self assert: aBoolean not",
  47508. referencedClasses: [],
  47509. messageSends: ["assert:", "not"]
  47510. }),
  47511. $globals.TestCase);
  47512. $core.addMethod(
  47513. $core.method({
  47514. selector: "errorIfNotAsync:",
  47515. protocol: "error handling",
  47516. fn: function (aString){
  47517. var self=this,$self=this;
  47518. return $core.withContext(function($ctx1) {
  47519. var $1;
  47520. $1=$self._isAsync();
  47521. if(!$core.assert($1)){
  47522. $self._error_($recv(aString).__comma(" used without prior #timeout:"));
  47523. }
  47524. return self;
  47525. }, function($ctx1) {$ctx1.fill(self,"errorIfNotAsync:",{aString:aString},$globals.TestCase)});
  47526. },
  47527. args: ["aString"],
  47528. source: "errorIfNotAsync: aString\x0a\x09self isAsync ifFalse: [\x0a\x09\x09self error: aString, ' used without prior #timeout:' ]",
  47529. referencedClasses: [],
  47530. messageSends: ["ifFalse:", "isAsync", "error:", ","]
  47531. }),
  47532. $globals.TestCase);
  47533. $core.addMethod(
  47534. $core.method({
  47535. selector: "finished",
  47536. protocol: "async",
  47537. fn: function (){
  47538. var self=this,$self=this;
  47539. return $core.withContext(function($ctx1) {
  47540. $self._errorIfNotAsync_("#finished");
  47541. $self["@asyncTimeout"]=nil;
  47542. return self;
  47543. }, function($ctx1) {$ctx1.fill(self,"finished",{},$globals.TestCase)});
  47544. },
  47545. args: [],
  47546. source: "finished\x0a\x09self errorIfNotAsync: '#finished'.\x0a\x09asyncTimeout := nil",
  47547. referencedClasses: [],
  47548. messageSends: ["errorIfNotAsync:"]
  47549. }),
  47550. $globals.TestCase);
  47551. $core.addMethod(
  47552. $core.method({
  47553. selector: "isAsync",
  47554. protocol: "testing",
  47555. fn: function (){
  47556. var self=this,$self=this;
  47557. return $core.withContext(function($ctx1) {
  47558. return $recv($self["@asyncTimeout"])._notNil();
  47559. }, function($ctx1) {$ctx1.fill(self,"isAsync",{},$globals.TestCase)});
  47560. },
  47561. args: [],
  47562. source: "isAsync\x0a\x09^ asyncTimeout notNil",
  47563. referencedClasses: [],
  47564. messageSends: ["notNil"]
  47565. }),
  47566. $globals.TestCase);
  47567. $core.addMethod(
  47568. $core.method({
  47569. selector: "performTest",
  47570. protocol: "running",
  47571. fn: function (){
  47572. var self=this,$self=this;
  47573. return $core.withContext(function($ctx1) {
  47574. $self["@asyncTimeout"]=nil;
  47575. $self._perform_($self._selector());
  47576. return self;
  47577. }, function($ctx1) {$ctx1.fill(self,"performTest",{},$globals.TestCase)});
  47578. },
  47579. args: [],
  47580. source: "performTest\x0a\x09asyncTimeout := nil.\x0a\x09self perform: self selector",
  47581. referencedClasses: [],
  47582. messageSends: ["perform:", "selector"]
  47583. }),
  47584. $globals.TestCase);
  47585. $core.addMethod(
  47586. $core.method({
  47587. selector: "runCase",
  47588. protocol: "running",
  47589. fn: function (){
  47590. var self=this,$self=this;
  47591. return $core.withContext(function($ctx1) {
  47592. $recv($recv($globals.TestContext)._testCase_(self))._start();
  47593. return self;
  47594. }, function($ctx1) {$ctx1.fill(self,"runCase",{},$globals.TestCase)});
  47595. },
  47596. args: [],
  47597. source: "runCase\x0a\x09\x22Runs a test case in isolated context, leaking all errors.\x22\x0a\x0a\x09(TestContext testCase: self) start",
  47598. referencedClasses: ["TestContext"],
  47599. messageSends: ["start", "testCase:"]
  47600. }),
  47601. $globals.TestCase);
  47602. $core.addMethod(
  47603. $core.method({
  47604. selector: "selector",
  47605. protocol: "accessing",
  47606. fn: function (){
  47607. var self=this,$self=this;
  47608. return $self["@testSelector"];
  47609. },
  47610. args: [],
  47611. source: "selector\x0a\x09^ testSelector",
  47612. referencedClasses: [],
  47613. messageSends: []
  47614. }),
  47615. $globals.TestCase);
  47616. $core.addMethod(
  47617. $core.method({
  47618. selector: "setTestSelector:",
  47619. protocol: "accessing",
  47620. fn: function (aSelector){
  47621. var self=this,$self=this;
  47622. $self["@testSelector"]=aSelector;
  47623. return self;
  47624. },
  47625. args: ["aSelector"],
  47626. source: "setTestSelector: aSelector\x0a\x09testSelector := aSelector",
  47627. referencedClasses: [],
  47628. messageSends: []
  47629. }),
  47630. $globals.TestCase);
  47631. $core.addMethod(
  47632. $core.method({
  47633. selector: "setUp",
  47634. protocol: "running",
  47635. fn: function (){
  47636. var self=this,$self=this;
  47637. return self;
  47638. },
  47639. args: [],
  47640. source: "setUp",
  47641. referencedClasses: [],
  47642. messageSends: []
  47643. }),
  47644. $globals.TestCase);
  47645. $core.addMethod(
  47646. $core.method({
  47647. selector: "should:",
  47648. protocol: "testing",
  47649. fn: function (aBlock){
  47650. var self=this,$self=this;
  47651. return $core.withContext(function($ctx1) {
  47652. $self._assert_($recv(aBlock)._value());
  47653. return self;
  47654. }, function($ctx1) {$ctx1.fill(self,"should:",{aBlock:aBlock},$globals.TestCase)});
  47655. },
  47656. args: ["aBlock"],
  47657. source: "should: aBlock\x0a\x09self assert: aBlock value",
  47658. referencedClasses: [],
  47659. messageSends: ["assert:", "value"]
  47660. }),
  47661. $globals.TestCase);
  47662. $core.addMethod(
  47663. $core.method({
  47664. selector: "should:raise:",
  47665. protocol: "testing",
  47666. fn: function (aBlock,anExceptionClass){
  47667. var self=this,$self=this;
  47668. return $core.withContext(function($ctx1) {
  47669. $self._assert_($recv((function(){
  47670. return $core.withContext(function($ctx2) {
  47671. $recv(aBlock)._value();
  47672. return false;
  47673. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47674. }))._on_do_(anExceptionClass,(function(ex){
  47675. return true;
  47676. })));
  47677. return self;
  47678. }, function($ctx1) {$ctx1.fill(self,"should:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  47679. },
  47680. args: ["aBlock", "anExceptionClass"],
  47681. source: "should: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. false ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | true ])",
  47682. referencedClasses: [],
  47683. messageSends: ["assert:", "on:do:", "value"]
  47684. }),
  47685. $globals.TestCase);
  47686. $core.addMethod(
  47687. $core.method({
  47688. selector: "shouldnt:raise:",
  47689. protocol: "testing",
  47690. fn: function (aBlock,anExceptionClass){
  47691. var self=this,$self=this;
  47692. return $core.withContext(function($ctx1) {
  47693. $self._assert_($recv((function(){
  47694. return $core.withContext(function($ctx2) {
  47695. $recv(aBlock)._value();
  47696. return true;
  47697. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47698. }))._on_do_(anExceptionClass,(function(ex){
  47699. return false;
  47700. })));
  47701. return self;
  47702. }, function($ctx1) {$ctx1.fill(self,"shouldnt:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  47703. },
  47704. args: ["aBlock", "anExceptionClass"],
  47705. source: "shouldnt: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. true ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | false ])",
  47706. referencedClasses: [],
  47707. messageSends: ["assert:", "on:do:", "value"]
  47708. }),
  47709. $globals.TestCase);
  47710. $core.addMethod(
  47711. $core.method({
  47712. selector: "signalFailure:",
  47713. protocol: "private",
  47714. fn: function (aString){
  47715. var self=this,$self=this;
  47716. return $core.withContext(function($ctx1) {
  47717. var $1;
  47718. $1=$recv($globals.TestFailure)._new();
  47719. $recv($1)._messageText_(aString);
  47720. $recv($1)._signal();
  47721. return self;
  47722. }, function($ctx1) {$ctx1.fill(self,"signalFailure:",{aString:aString},$globals.TestCase)});
  47723. },
  47724. args: ["aString"],
  47725. source: "signalFailure: aString\x0a\x09TestFailure new\x0a\x09\x09messageText: aString;\x0a\x09\x09signal",
  47726. referencedClasses: ["TestFailure"],
  47727. messageSends: ["messageText:", "new", "signal"]
  47728. }),
  47729. $globals.TestCase);
  47730. $core.addMethod(
  47731. $core.method({
  47732. selector: "tearDown",
  47733. protocol: "running",
  47734. fn: function (){
  47735. var self=this,$self=this;
  47736. return self;
  47737. },
  47738. args: [],
  47739. source: "tearDown",
  47740. referencedClasses: [],
  47741. messageSends: []
  47742. }),
  47743. $globals.TestCase);
  47744. $core.addMethod(
  47745. $core.method({
  47746. selector: "timeout:",
  47747. protocol: "async",
  47748. fn: function (aNumber){
  47749. var self=this,$self=this;
  47750. return $core.withContext(function($ctx1) {
  47751. var $1,$receiver;
  47752. $1=$self["@asyncTimeout"];
  47753. if(($receiver = $1) == null || $receiver.a$nil){
  47754. $1;
  47755. } else {
  47756. $recv($self["@asyncTimeout"])._clearTimeout();
  47757. }
  47758. $self["@asyncTimeout"]=(0);
  47759. $self["@asyncTimeout"]=$recv($self._async_((function(){
  47760. return $core.withContext(function($ctx2) {
  47761. return $self._assert_description_(false,"SUnit grace time exhausted");
  47762. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47763. })))._valueWithTimeout_(aNumber);
  47764. return self;
  47765. }, function($ctx1) {$ctx1.fill(self,"timeout:",{aNumber:aNumber},$globals.TestCase)});
  47766. },
  47767. args: ["aNumber"],
  47768. 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",
  47769. referencedClasses: [],
  47770. messageSends: ["ifNotNil:", "clearTimeout", "valueWithTimeout:", "async:", "assert:description:"]
  47771. }),
  47772. $globals.TestCase);
  47773. $core.addMethod(
  47774. $core.method({
  47775. selector: "allTestSelectors",
  47776. protocol: "accessing",
  47777. fn: function (){
  47778. var self=this,$self=this;
  47779. var selectors;
  47780. return $core.withContext(function($ctx1) {
  47781. var $1;
  47782. selectors=$self._testSelectors();
  47783. $1=$self._shouldInheritSelectors();
  47784. if($core.assert($1)){
  47785. $recv(selectors)._addAll_($recv($self._superclass())._allTestSelectors());
  47786. }
  47787. return selectors;
  47788. }, function($ctx1) {$ctx1.fill(self,"allTestSelectors",{selectors:selectors},$globals.TestCase.a$cls)});
  47789. },
  47790. args: [],
  47791. source: "allTestSelectors\x0a\x09| selectors |\x0a\x09selectors := self testSelectors.\x0a\x09self shouldInheritSelectors ifTrue: [\x0a\x09\x09selectors addAll: self superclass allTestSelectors ].\x0a\x09^ selectors",
  47792. referencedClasses: [],
  47793. messageSends: ["testSelectors", "ifTrue:", "shouldInheritSelectors", "addAll:", "allTestSelectors", "superclass"]
  47794. }),
  47795. $globals.TestCase.a$cls);
  47796. $core.addMethod(
  47797. $core.method({
  47798. selector: "buildSuite",
  47799. protocol: "accessing",
  47800. fn: function (){
  47801. var self=this,$self=this;
  47802. return $core.withContext(function($ctx1) {
  47803. return $recv($self._allTestSelectors())._collect_((function(each){
  47804. return $core.withContext(function($ctx2) {
  47805. return $self._selector_(each);
  47806. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  47807. }));
  47808. }, function($ctx1) {$ctx1.fill(self,"buildSuite",{},$globals.TestCase.a$cls)});
  47809. },
  47810. args: [],
  47811. source: "buildSuite\x0a\x09^ self allTestSelectors collect: [ :each | self selector: each ]",
  47812. referencedClasses: [],
  47813. messageSends: ["collect:", "allTestSelectors", "selector:"]
  47814. }),
  47815. $globals.TestCase.a$cls);
  47816. $core.addMethod(
  47817. $core.method({
  47818. selector: "classTag",
  47819. protocol: "accessing",
  47820. fn: function (){
  47821. var self=this,$self=this;
  47822. return "test";
  47823. },
  47824. args: [],
  47825. 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'",
  47826. referencedClasses: [],
  47827. messageSends: []
  47828. }),
  47829. $globals.TestCase.a$cls);
  47830. $core.addMethod(
  47831. $core.method({
  47832. selector: "isAbstract",
  47833. protocol: "testing",
  47834. fn: function (){
  47835. var self=this,$self=this;
  47836. return $core.withContext(function($ctx1) {
  47837. return $recv($self._name()).__eq("TestCase");
  47838. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.TestCase.a$cls)});
  47839. },
  47840. args: [],
  47841. source: "isAbstract\x0a\x09^ self name = 'TestCase'",
  47842. referencedClasses: [],
  47843. messageSends: ["=", "name"]
  47844. }),
  47845. $globals.TestCase.a$cls);
  47846. $core.addMethod(
  47847. $core.method({
  47848. selector: "isTestClass",
  47849. protocol: "testing",
  47850. fn: function (){
  47851. var self=this,$self=this;
  47852. return $core.withContext(function($ctx1) {
  47853. return $recv($self._isAbstract())._not();
  47854. }, function($ctx1) {$ctx1.fill(self,"isTestClass",{},$globals.TestCase.a$cls)});
  47855. },
  47856. args: [],
  47857. source: "isTestClass\x0a\x09^ self isAbstract not",
  47858. referencedClasses: [],
  47859. messageSends: ["not", "isAbstract"]
  47860. }),
  47861. $globals.TestCase.a$cls);
  47862. $core.addMethod(
  47863. $core.method({
  47864. selector: "lookupHierarchyRoot",
  47865. protocol: "accessing",
  47866. fn: function (){
  47867. var self=this,$self=this;
  47868. return $globals.TestCase;
  47869. },
  47870. args: [],
  47871. source: "lookupHierarchyRoot\x0a\x09^ TestCase",
  47872. referencedClasses: ["TestCase"],
  47873. messageSends: []
  47874. }),
  47875. $globals.TestCase.a$cls);
  47876. $core.addMethod(
  47877. $core.method({
  47878. selector: "selector:",
  47879. protocol: "accessing",
  47880. fn: function (aSelector){
  47881. var self=this,$self=this;
  47882. return $core.withContext(function($ctx1) {
  47883. var $1;
  47884. $1=$self._new();
  47885. $recv($1)._setTestSelector_(aSelector);
  47886. return $recv($1)._yourself();
  47887. }, function($ctx1) {$ctx1.fill(self,"selector:",{aSelector:aSelector},$globals.TestCase.a$cls)});
  47888. },
  47889. args: ["aSelector"],
  47890. source: "selector: aSelector\x0a\x09^ self new\x0a\x09\x09setTestSelector: aSelector;\x0a\x09\x09yourself",
  47891. referencedClasses: [],
  47892. messageSends: ["setTestSelector:", "new", "yourself"]
  47893. }),
  47894. $globals.TestCase.a$cls);
  47895. $core.addMethod(
  47896. $core.method({
  47897. selector: "shouldInheritSelectors",
  47898. protocol: "testing",
  47899. fn: function (){
  47900. var self=this,$self=this;
  47901. return $core.withContext(function($ctx1) {
  47902. return $self.__tild_eq($self._lookupHierarchyRoot());
  47903. }, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{},$globals.TestCase.a$cls)});
  47904. },
  47905. args: [],
  47906. source: "shouldInheritSelectors\x0a\x09^ self ~= self lookupHierarchyRoot",
  47907. referencedClasses: [],
  47908. messageSends: ["~=", "lookupHierarchyRoot"]
  47909. }),
  47910. $globals.TestCase.a$cls);
  47911. $core.addMethod(
  47912. $core.method({
  47913. selector: "testSelectors",
  47914. protocol: "accessing",
  47915. fn: function (){
  47916. var self=this,$self=this;
  47917. return $core.withContext(function($ctx1) {
  47918. return $recv($recv($self._methodDictionary())._keys())._select_((function(each){
  47919. return $core.withContext(function($ctx2) {
  47920. return $recv(each)._match_("^test");
  47921. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  47922. }));
  47923. }, function($ctx1) {$ctx1.fill(self,"testSelectors",{},$globals.TestCase.a$cls)});
  47924. },
  47925. args: [],
  47926. source: "testSelectors\x0a\x09^ self methodDictionary keys select: [ :each | each match: '^test' ]",
  47927. referencedClasses: [],
  47928. messageSends: ["select:", "keys", "methodDictionary", "match:"]
  47929. }),
  47930. $globals.TestCase.a$cls);
  47931. $core.addClass("TestContext", $globals.Object, ["testCase"], "SUnit");
  47932. $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).";
  47933. $core.addMethod(
  47934. $core.method({
  47935. selector: "execute:",
  47936. protocol: "running",
  47937. fn: function (aBlock){
  47938. var self=this,$self=this;
  47939. var failed;
  47940. return $core.withContext(function($ctx1) {
  47941. var $1,$2;
  47942. $recv($self["@testCase"])._context_(self);
  47943. $ctx1.sendIdx["context:"]=1;
  47944. $recv((function(){
  47945. return $core.withContext(function($ctx2) {
  47946. failed=true;
  47947. $recv(aBlock)._value();
  47948. failed=false;
  47949. return failed;
  47950. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47951. }))._ensure_((function(){
  47952. return $core.withContext(function($ctx2) {
  47953. $recv($self["@testCase"])._context_(nil);
  47954. $1=$recv(failed)._and_((function(){
  47955. return $core.withContext(function($ctx3) {
  47956. return $recv($self["@testCase"])._isAsync();
  47957. $ctx3.sendIdx["isAsync"]=1;
  47958. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  47959. }));
  47960. if($core.assert($1)){
  47961. $recv($self["@testCase"])._finished();
  47962. }
  47963. $2=$recv($self["@testCase"])._isAsync();
  47964. if(!$core.assert($2)){
  47965. return $recv($self["@testCase"])._tearDown();
  47966. }
  47967. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47968. }));
  47969. return self;
  47970. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock,failed:failed},$globals.TestContext)});
  47971. },
  47972. args: ["aBlock"],
  47973. 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 ] ]",
  47974. referencedClasses: [],
  47975. messageSends: ["context:", "ensure:", "value", "ifTrue:", "and:", "isAsync", "finished", "ifFalse:", "tearDown"]
  47976. }),
  47977. $globals.TestContext);
  47978. $core.addMethod(
  47979. $core.method({
  47980. selector: "start",
  47981. protocol: "running",
  47982. fn: function (){
  47983. var self=this,$self=this;
  47984. return $core.withContext(function($ctx1) {
  47985. $self._execute_((function(){
  47986. return $core.withContext(function($ctx2) {
  47987. $recv($self["@testCase"])._setUp();
  47988. return $recv($self["@testCase"])._performTest();
  47989. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47990. }));
  47991. return self;
  47992. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.TestContext)});
  47993. },
  47994. args: [],
  47995. source: "start\x0a\x09self execute: [\x0a\x09\x09testCase setUp.\x0a\x09\x09testCase performTest ]",
  47996. referencedClasses: [],
  47997. messageSends: ["execute:", "setUp", "performTest"]
  47998. }),
  47999. $globals.TestContext);
  48000. $core.addMethod(
  48001. $core.method({
  48002. selector: "testCase:",
  48003. protocol: "accessing",
  48004. fn: function (aTestCase){
  48005. var self=this,$self=this;
  48006. $self["@testCase"]=aTestCase;
  48007. return self;
  48008. },
  48009. args: ["aTestCase"],
  48010. source: "testCase: aTestCase\x0a\x09testCase := aTestCase",
  48011. referencedClasses: [],
  48012. messageSends: []
  48013. }),
  48014. $globals.TestContext);
  48015. $core.addMethod(
  48016. $core.method({
  48017. selector: "testCase:",
  48018. protocol: "instance creation",
  48019. fn: function (aTestCase){
  48020. var self=this,$self=this;
  48021. return $core.withContext(function($ctx1) {
  48022. var $1;
  48023. $1=$self._new();
  48024. $recv($1)._testCase_(aTestCase);
  48025. return $recv($1)._yourself();
  48026. }, function($ctx1) {$ctx1.fill(self,"testCase:",{aTestCase:aTestCase},$globals.TestContext.a$cls)});
  48027. },
  48028. args: ["aTestCase"],
  48029. source: "testCase: aTestCase\x0a\x09^ self new\x0a\x09\x09testCase: aTestCase;\x0a\x09\x09yourself",
  48030. referencedClasses: [],
  48031. messageSends: ["testCase:", "new", "yourself"]
  48032. }),
  48033. $globals.TestContext.a$cls);
  48034. $core.addClass("ReportingTestContext", $globals.TestContext, ["finished", "result"], "SUnit");
  48035. $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`.";
  48036. $core.addMethod(
  48037. $core.method({
  48038. selector: "execute:",
  48039. protocol: "running",
  48040. fn: function (aBlock){
  48041. var self=this,$self=this;
  48042. return $core.withContext(function($ctx1) {
  48043. var $1;
  48044. $recv((function(){
  48045. return $core.withContext(function($ctx2) {
  48046. return $self._withErrorReporting_((function(){
  48047. return $core.withContext(function($ctx3) {
  48048. return (
  48049. $ctx3.supercall = true,
  48050. ($globals.ReportingTestContext.superclass||$boot.nilAsClass).fn.prototype._execute_.apply($self, [aBlock]));
  48051. $ctx3.supercall = false;
  48052. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48053. }));
  48054. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48055. }))._ensure_((function(){
  48056. return $core.withContext(function($ctx2) {
  48057. $1=$recv($self["@testCase"])._isAsync();
  48058. if(!$core.assert($1)){
  48059. $recv($self["@result"])._increaseRuns();
  48060. return $recv($self["@finished"])._value();
  48061. }
  48062. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  48063. }));
  48064. return self;
  48065. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock},$globals.ReportingTestContext)});
  48066. },
  48067. args: ["aBlock"],
  48068. 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 ] ]",
  48069. referencedClasses: [],
  48070. messageSends: ["ensure:", "withErrorReporting:", "execute:", "ifFalse:", "isAsync", "increaseRuns", "value"]
  48071. }),
  48072. $globals.ReportingTestContext);
  48073. $core.addMethod(
  48074. $core.method({
  48075. selector: "finished:",
  48076. protocol: "accessing",
  48077. fn: function (aBlock){
  48078. var self=this,$self=this;
  48079. $self["@finished"]=aBlock;
  48080. return self;
  48081. },
  48082. args: ["aBlock"],
  48083. source: "finished: aBlock\x0a\x09finished := aBlock",
  48084. referencedClasses: [],
  48085. messageSends: []
  48086. }),
  48087. $globals.ReportingTestContext);
  48088. $core.addMethod(
  48089. $core.method({
  48090. selector: "result:",
  48091. protocol: "accessing",
  48092. fn: function (aTestResult){
  48093. var self=this,$self=this;
  48094. $self["@result"]=aTestResult;
  48095. return self;
  48096. },
  48097. args: ["aTestResult"],
  48098. source: "result: aTestResult\x0a\x09result := aTestResult",
  48099. referencedClasses: [],
  48100. messageSends: []
  48101. }),
  48102. $globals.ReportingTestContext);
  48103. $core.addMethod(
  48104. $core.method({
  48105. selector: "withErrorReporting:",
  48106. protocol: "private",
  48107. fn: function (aBlock){
  48108. var self=this,$self=this;
  48109. return $core.withContext(function($ctx1) {
  48110. $recv((function(){
  48111. return $core.withContext(function($ctx2) {
  48112. return $recv(aBlock)._on_do_($globals.TestFailure,(function(ex){
  48113. return $core.withContext(function($ctx3) {
  48114. return $recv($self["@result"])._addFailure_($self["@testCase"]);
  48115. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,2)});
  48116. }));
  48117. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48118. }))._on_do_($globals.Error,(function(ex){
  48119. return $core.withContext(function($ctx2) {
  48120. return $recv($self["@result"])._addError_($self["@testCase"]);
  48121. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,3)});
  48122. }));
  48123. $ctx1.sendIdx["on:do:"]=1;
  48124. return self;
  48125. }, function($ctx1) {$ctx1.fill(self,"withErrorReporting:",{aBlock:aBlock},$globals.ReportingTestContext)});
  48126. },
  48127. args: ["aBlock"],
  48128. 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 ]",
  48129. referencedClasses: ["TestFailure", "Error"],
  48130. messageSends: ["on:do:", "addFailure:", "addError:"]
  48131. }),
  48132. $globals.ReportingTestContext);
  48133. $core.addMethod(
  48134. $core.method({
  48135. selector: "testCase:result:finished:",
  48136. protocol: "instance creation",
  48137. fn: function (aTestCase,aTestResult,aBlock){
  48138. var self=this,$self=this;
  48139. return $core.withContext(function($ctx1) {
  48140. var $1;
  48141. $1=(
  48142. $ctx1.supercall = true,
  48143. ($globals.ReportingTestContext.a$cls.superclass||$boot.nilAsClass).fn.prototype._testCase_.apply($self, [aTestCase]));
  48144. $ctx1.supercall = false;
  48145. $recv($1)._result_(aTestResult);
  48146. $recv($1)._finished_(aBlock);
  48147. return $recv($1)._yourself();
  48148. }, function($ctx1) {$ctx1.fill(self,"testCase:result:finished:",{aTestCase:aTestCase,aTestResult:aTestResult,aBlock:aBlock},$globals.ReportingTestContext.a$cls)});
  48149. },
  48150. args: ["aTestCase", "aTestResult", "aBlock"],
  48151. source: "testCase: aTestCase result: aTestResult finished: aBlock\x0a\x09^ (super testCase: aTestCase)\x0a\x09\x09result: aTestResult;\x0a\x09\x09finished: aBlock;\x0a\x09\x09yourself",
  48152. referencedClasses: [],
  48153. messageSends: ["result:", "testCase:", "finished:", "yourself"]
  48154. }),
  48155. $globals.ReportingTestContext.a$cls);
  48156. $core.addClass("TestFailure", $globals.Error, [], "SUnit");
  48157. $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.";
  48158. $core.addClass("TestResult", $globals.Object, ["timestamp", "runs", "errors", "failures", "total"], "SUnit");
  48159. $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";
  48160. $core.addMethod(
  48161. $core.method({
  48162. selector: "addError:",
  48163. protocol: "accessing",
  48164. fn: function (anError){
  48165. var self=this,$self=this;
  48166. return $core.withContext(function($ctx1) {
  48167. $recv($self._errors())._add_(anError);
  48168. return self;
  48169. }, function($ctx1) {$ctx1.fill(self,"addError:",{anError:anError},$globals.TestResult)});
  48170. },
  48171. args: ["anError"],
  48172. source: "addError: anError\x0a\x09self errors add: anError",
  48173. referencedClasses: [],
  48174. messageSends: ["add:", "errors"]
  48175. }),
  48176. $globals.TestResult);
  48177. $core.addMethod(
  48178. $core.method({
  48179. selector: "addFailure:",
  48180. protocol: "accessing",
  48181. fn: function (aFailure){
  48182. var self=this,$self=this;
  48183. return $core.withContext(function($ctx1) {
  48184. $recv($self._failures())._add_(aFailure);
  48185. return self;
  48186. }, function($ctx1) {$ctx1.fill(self,"addFailure:",{aFailure:aFailure},$globals.TestResult)});
  48187. },
  48188. args: ["aFailure"],
  48189. source: "addFailure: aFailure\x0a\x09self failures add: aFailure",
  48190. referencedClasses: [],
  48191. messageSends: ["add:", "failures"]
  48192. }),
  48193. $globals.TestResult);
  48194. $core.addMethod(
  48195. $core.method({
  48196. selector: "errors",
  48197. protocol: "accessing",
  48198. fn: function (){
  48199. var self=this,$self=this;
  48200. return $self["@errors"];
  48201. },
  48202. args: [],
  48203. source: "errors\x0a\x09^ errors",
  48204. referencedClasses: [],
  48205. messageSends: []
  48206. }),
  48207. $globals.TestResult);
  48208. $core.addMethod(
  48209. $core.method({
  48210. selector: "failures",
  48211. protocol: "accessing",
  48212. fn: function (){
  48213. var self=this,$self=this;
  48214. return $self["@failures"];
  48215. },
  48216. args: [],
  48217. source: "failures\x0a\x09^ failures",
  48218. referencedClasses: [],
  48219. messageSends: []
  48220. }),
  48221. $globals.TestResult);
  48222. $core.addMethod(
  48223. $core.method({
  48224. selector: "increaseRuns",
  48225. protocol: "accessing",
  48226. fn: function (){
  48227. var self=this,$self=this;
  48228. return $core.withContext(function($ctx1) {
  48229. $self["@runs"]=$recv($self["@runs"]).__plus((1));
  48230. return self;
  48231. }, function($ctx1) {$ctx1.fill(self,"increaseRuns",{},$globals.TestResult)});
  48232. },
  48233. args: [],
  48234. source: "increaseRuns\x0a\x09runs := runs + 1",
  48235. referencedClasses: [],
  48236. messageSends: ["+"]
  48237. }),
  48238. $globals.TestResult);
  48239. $core.addMethod(
  48240. $core.method({
  48241. selector: "initialize",
  48242. protocol: "initialization",
  48243. fn: function (){
  48244. var self=this,$self=this;
  48245. return $core.withContext(function($ctx1) {
  48246. (
  48247. $ctx1.supercall = true,
  48248. ($globals.TestResult.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  48249. $ctx1.supercall = false;
  48250. $self["@timestamp"]=$recv($globals.Date)._now();
  48251. $self["@runs"]=(0);
  48252. $self["@errors"]=$recv($globals.Array)._new();
  48253. $ctx1.sendIdx["new"]=1;
  48254. $self["@failures"]=$recv($globals.Array)._new();
  48255. $self["@total"]=(0);
  48256. return self;
  48257. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestResult)});
  48258. },
  48259. args: [],
  48260. source: "initialize\x0a\x09super initialize.\x0a\x09timestamp := Date now.\x0a\x09runs := 0.\x0a\x09errors := Array new.\x0a\x09failures := Array new.\x0a\x09total := 0",
  48261. referencedClasses: ["Date", "Array"],
  48262. messageSends: ["initialize", "now", "new"]
  48263. }),
  48264. $globals.TestResult);
  48265. $core.addMethod(
  48266. $core.method({
  48267. selector: "nextRunDo:",
  48268. protocol: "running",
  48269. fn: function (aBlock){
  48270. var self=this,$self=this;
  48271. return $core.withContext(function($ctx1) {
  48272. var $2,$1;
  48273. $2=$self._runs();
  48274. $ctx1.sendIdx["runs"]=1;
  48275. $1=$recv($2).__eq_eq($self._total());
  48276. if(!$core.assert($1)){
  48277. return $recv(aBlock)._value_($recv($self._runs()).__plus((1)));
  48278. }
  48279. }, function($ctx1) {$ctx1.fill(self,"nextRunDo:",{aBlock:aBlock},$globals.TestResult)});
  48280. },
  48281. args: ["aBlock"],
  48282. 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 ]",
  48283. referencedClasses: [],
  48284. messageSends: ["ifFalse:", "==", "runs", "total", "value:", "+"]
  48285. }),
  48286. $globals.TestResult);
  48287. $core.addMethod(
  48288. $core.method({
  48289. selector: "runCase:",
  48290. protocol: "running",
  48291. fn: function (aTestCase){
  48292. var self=this,$self=this;
  48293. return $core.withContext(function($ctx1) {
  48294. $recv((function(){
  48295. return $core.withContext(function($ctx2) {
  48296. return $recv((function(){
  48297. return $core.withContext(function($ctx3) {
  48298. $self._increaseRuns();
  48299. return $recv(aTestCase)._runCase();
  48300. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48301. }))._on_do_($globals.TestFailure,(function(ex){
  48302. return $core.withContext(function($ctx3) {
  48303. return $self._addFailure_(aTestCase);
  48304. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  48305. }));
  48306. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48307. }))._on_do_($globals.Error,(function(ex){
  48308. return $core.withContext(function($ctx2) {
  48309. return $self._addError_(aTestCase);
  48310. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,4)});
  48311. }));
  48312. $ctx1.sendIdx["on:do:"]=1;
  48313. return self;
  48314. }, function($ctx1) {$ctx1.fill(self,"runCase:",{aTestCase:aTestCase},$globals.TestResult)});
  48315. },
  48316. args: ["aTestCase"],
  48317. 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 ]",
  48318. referencedClasses: ["TestFailure", "Error"],
  48319. messageSends: ["on:do:", "increaseRuns", "runCase", "addFailure:", "addError:"]
  48320. }),
  48321. $globals.TestResult);
  48322. $core.addMethod(
  48323. $core.method({
  48324. selector: "runs",
  48325. protocol: "accessing",
  48326. fn: function (){
  48327. var self=this,$self=this;
  48328. return $self["@runs"];
  48329. },
  48330. args: [],
  48331. source: "runs\x0a\x09^ runs",
  48332. referencedClasses: [],
  48333. messageSends: []
  48334. }),
  48335. $globals.TestResult);
  48336. $core.addMethod(
  48337. $core.method({
  48338. selector: "status",
  48339. protocol: "accessing",
  48340. fn: function (){
  48341. var self=this,$self=this;
  48342. return $core.withContext(function($ctx1) {
  48343. var $1;
  48344. $1=$recv($self._errors())._ifNotEmpty_ifEmpty_((function(){
  48345. return "error";
  48346. }),(function(){
  48347. return $core.withContext(function($ctx2) {
  48348. return $recv($self._failures())._ifNotEmpty_ifEmpty_((function(){
  48349. return "failure";
  48350. }),(function(){
  48351. return "success";
  48352. }));
  48353. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  48354. }));
  48355. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  48356. return $1;
  48357. }, function($ctx1) {$ctx1.fill(self,"status",{},$globals.TestResult)});
  48358. },
  48359. args: [],
  48360. source: "status\x0a\x09^ self errors ifNotEmpty: [ 'error' ] ifEmpty: [\x0a\x09\x09self failures ifNotEmpty: [ 'failure' ] ifEmpty: [\x0a\x09\x09\x09'success' ]]",
  48361. referencedClasses: [],
  48362. messageSends: ["ifNotEmpty:ifEmpty:", "errors", "failures"]
  48363. }),
  48364. $globals.TestResult);
  48365. $core.addMethod(
  48366. $core.method({
  48367. selector: "timestamp",
  48368. protocol: "accessing",
  48369. fn: function (){
  48370. var self=this,$self=this;
  48371. return $self["@timestamp"];
  48372. },
  48373. args: [],
  48374. source: "timestamp\x0a\x09^ timestamp",
  48375. referencedClasses: [],
  48376. messageSends: []
  48377. }),
  48378. $globals.TestResult);
  48379. $core.addMethod(
  48380. $core.method({
  48381. selector: "total",
  48382. protocol: "accessing",
  48383. fn: function (){
  48384. var self=this,$self=this;
  48385. return $self["@total"];
  48386. },
  48387. args: [],
  48388. source: "total\x0a\x09^ total",
  48389. referencedClasses: [],
  48390. messageSends: []
  48391. }),
  48392. $globals.TestResult);
  48393. $core.addMethod(
  48394. $core.method({
  48395. selector: "total:",
  48396. protocol: "accessing",
  48397. fn: function (aNumber){
  48398. var self=this,$self=this;
  48399. $self["@total"]=aNumber;
  48400. return self;
  48401. },
  48402. args: ["aNumber"],
  48403. source: "total: aNumber\x0a\x09total := aNumber",
  48404. referencedClasses: [],
  48405. messageSends: []
  48406. }),
  48407. $globals.TestResult);
  48408. $core.addClass("TestSuiteRunner", $globals.Object, ["suite", "result", "announcer", "runNextTest"], "SUnit");
  48409. $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`.";
  48410. $core.addMethod(
  48411. $core.method({
  48412. selector: "announcer",
  48413. protocol: "accessing",
  48414. fn: function (){
  48415. var self=this,$self=this;
  48416. return $self["@announcer"];
  48417. },
  48418. args: [],
  48419. source: "announcer\x0a\x09^ announcer",
  48420. referencedClasses: [],
  48421. messageSends: []
  48422. }),
  48423. $globals.TestSuiteRunner);
  48424. $core.addMethod(
  48425. $core.method({
  48426. selector: "contextOf:",
  48427. protocol: "private",
  48428. fn: function (anInteger){
  48429. var self=this,$self=this;
  48430. return $core.withContext(function($ctx1) {
  48431. return $recv($globals.ReportingTestContext)._testCase_result_finished_($recv($self["@suite"])._at_(anInteger),$self["@result"],(function(){
  48432. return $core.withContext(function($ctx2) {
  48433. return $self._resume();
  48434. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48435. }));
  48436. }, function($ctx1) {$ctx1.fill(self,"contextOf:",{anInteger:anInteger},$globals.TestSuiteRunner)});
  48437. },
  48438. args: ["anInteger"],
  48439. source: "contextOf: anInteger\x0a\x09^ ReportingTestContext testCase: (suite at: anInteger) result: result finished: [ self resume ]",
  48440. referencedClasses: ["ReportingTestContext"],
  48441. messageSends: ["testCase:result:finished:", "at:", "resume"]
  48442. }),
  48443. $globals.TestSuiteRunner);
  48444. $core.addMethod(
  48445. $core.method({
  48446. selector: "initialize",
  48447. protocol: "initialization",
  48448. fn: function (){
  48449. var self=this,$self=this;
  48450. return $core.withContext(function($ctx1) {
  48451. var $1;
  48452. (
  48453. $ctx1.supercall = true,
  48454. ($globals.TestSuiteRunner.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  48455. $ctx1.supercall = false;
  48456. $self["@announcer"]=$recv($globals.Announcer)._new();
  48457. $ctx1.sendIdx["new"]=1;
  48458. $self["@result"]=$recv($globals.TestResult)._new();
  48459. $self["@runNextTest"]=(function(){
  48460. var runs;
  48461. return $core.withContext(function($ctx2) {
  48462. runs=$recv($self["@result"])._runs();
  48463. $1=$recv(runs).__lt($recv($self["@result"])._total());
  48464. if($core.assert($1)){
  48465. return $recv($self._contextOf_($recv(runs).__plus((1))))._start();
  48466. }
  48467. }, function($ctx2) {$ctx2.fillBlock({runs:runs},$ctx1,1)});
  48468. });
  48469. return self;
  48470. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestSuiteRunner)});
  48471. },
  48472. args: [],
  48473. 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 ] ].",
  48474. referencedClasses: ["Announcer", "TestResult"],
  48475. messageSends: ["initialize", "new", "runs", "ifTrue:", "<", "total", "start", "contextOf:", "+"]
  48476. }),
  48477. $globals.TestSuiteRunner);
  48478. $core.addMethod(
  48479. $core.method({
  48480. selector: "result",
  48481. protocol: "accessing",
  48482. fn: function (){
  48483. var self=this,$self=this;
  48484. return $self["@result"];
  48485. },
  48486. args: [],
  48487. source: "result\x0a\x09^ result",
  48488. referencedClasses: [],
  48489. messageSends: []
  48490. }),
  48491. $globals.TestSuiteRunner);
  48492. $core.addMethod(
  48493. $core.method({
  48494. selector: "resume",
  48495. protocol: "actions",
  48496. fn: function (){
  48497. var self=this,$self=this;
  48498. return $core.withContext(function($ctx1) {
  48499. $recv($self["@runNextTest"])._fork();
  48500. $recv($self["@announcer"])._announce_($recv($recv($globals.ResultAnnouncement)._new())._result_($self["@result"]));
  48501. return self;
  48502. }, function($ctx1) {$ctx1.fill(self,"resume",{},$globals.TestSuiteRunner)});
  48503. },
  48504. args: [],
  48505. source: "resume\x0a\x09runNextTest fork.\x0a\x09announcer announce: (ResultAnnouncement new result: result)",
  48506. referencedClasses: ["ResultAnnouncement"],
  48507. messageSends: ["fork", "announce:", "result:", "new"]
  48508. }),
  48509. $globals.TestSuiteRunner);
  48510. $core.addMethod(
  48511. $core.method({
  48512. selector: "run",
  48513. protocol: "actions",
  48514. fn: function (){
  48515. var self=this,$self=this;
  48516. return $core.withContext(function($ctx1) {
  48517. $recv($self["@result"])._total_($recv($self["@suite"])._size());
  48518. $self._resume();
  48519. return self;
  48520. }, function($ctx1) {$ctx1.fill(self,"run",{},$globals.TestSuiteRunner)});
  48521. },
  48522. args: [],
  48523. source: "run\x0a\x09result total: suite size.\x0a\x09self resume",
  48524. referencedClasses: [],
  48525. messageSends: ["total:", "size", "resume"]
  48526. }),
  48527. $globals.TestSuiteRunner);
  48528. $core.addMethod(
  48529. $core.method({
  48530. selector: "suite:",
  48531. protocol: "accessing",
  48532. fn: function (aCollection){
  48533. var self=this,$self=this;
  48534. $self["@suite"]=aCollection;
  48535. return self;
  48536. },
  48537. args: ["aCollection"],
  48538. source: "suite: aCollection\x0a\x09suite := aCollection",
  48539. referencedClasses: [],
  48540. messageSends: []
  48541. }),
  48542. $globals.TestSuiteRunner);
  48543. $core.addMethod(
  48544. $core.method({
  48545. selector: "new",
  48546. protocol: "instance creation",
  48547. fn: function (){
  48548. var self=this,$self=this;
  48549. return $core.withContext(function($ctx1) {
  48550. $self._shouldNotImplement();
  48551. return self;
  48552. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.TestSuiteRunner.a$cls)});
  48553. },
  48554. args: [],
  48555. source: "new\x0a\x09self shouldNotImplement",
  48556. referencedClasses: [],
  48557. messageSends: ["shouldNotImplement"]
  48558. }),
  48559. $globals.TestSuiteRunner.a$cls);
  48560. $core.addMethod(
  48561. $core.method({
  48562. selector: "on:",
  48563. protocol: "instance creation",
  48564. fn: function (aCollection){
  48565. var self=this,$self=this;
  48566. return $core.withContext(function($ctx1) {
  48567. var $1;
  48568. $1=(
  48569. $ctx1.supercall = true,
  48570. ($globals.TestSuiteRunner.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  48571. $ctx1.supercall = false;
  48572. return $recv($1)._suite_(aCollection);
  48573. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.TestSuiteRunner.a$cls)});
  48574. },
  48575. args: ["aCollection"],
  48576. source: "on: aCollection\x0a\x09^ super new suite: aCollection",
  48577. referencedClasses: [],
  48578. messageSends: ["suite:", "new"]
  48579. }),
  48580. $globals.TestSuiteRunner.a$cls);
  48581. $core.addMethod(
  48582. $core.method({
  48583. selector: "isTestPackage",
  48584. protocol: "*SUnit",
  48585. fn: function (){
  48586. var self=this,$self=this;
  48587. return $core.withContext(function($ctx1) {
  48588. return $recv($self._classes())._anySatisfy_((function(each){
  48589. return $core.withContext(function($ctx2) {
  48590. return $recv(each)._isTestClass();
  48591. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48592. }));
  48593. }, function($ctx1) {$ctx1.fill(self,"isTestPackage",{},$globals.Package)});
  48594. },
  48595. args: [],
  48596. source: "isTestPackage\x0a\x09^ self classes anySatisfy: [ :each | each isTestClass ]",
  48597. referencedClasses: [],
  48598. messageSends: ["anySatisfy:", "classes", "isTestClass"]
  48599. }),
  48600. $globals.Package);
  48601. $core.addMethod(
  48602. $core.method({
  48603. selector: "isTestClass",
  48604. protocol: "*SUnit",
  48605. fn: function (){
  48606. var self=this,$self=this;
  48607. return false;
  48608. },
  48609. args: [],
  48610. source: "isTestClass\x0a\x09^ false",
  48611. referencedClasses: [],
  48612. messageSends: []
  48613. }),
  48614. $globals.TBehaviorDefaults);
  48615. });
  48616. define('amber_core/Compiler-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  48617. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  48618. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  48619. var $pkg = $core.addPackage("Compiler-Tests");
  48620. $pkg.innerEval = function (expr) { return eval(expr); };
  48621. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  48622. $core.addClass("ASTParsingTest", $globals.TestCase, [], "Compiler-Tests");
  48623. $core.addMethod(
  48624. $core.method({
  48625. selector: "parse:forClass:",
  48626. protocol: "parsing",
  48627. fn: function (aString,aClass){
  48628. var self=this,$self=this;
  48629. return $core.withContext(function($ctx1) {
  48630. return $recv($recv($globals.Compiler)._new())._ast_forClass_protocol_(aString,aClass,"test");
  48631. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTParsingTest)});
  48632. },
  48633. args: ["aString", "aClass"],
  48634. source: "parse: aString forClass: aClass\x0a\x09^ Compiler new\x0a\x09\x09ast: aString\x0a\x09\x09forClass: aClass\x0a\x09\x09protocol: 'test'",
  48635. referencedClasses: ["Compiler"],
  48636. messageSends: ["ast:forClass:protocol:", "new"]
  48637. }),
  48638. $globals.ASTParsingTest);
  48639. $core.addClass("ASTPCNodeVisitorTest", $globals.ASTParsingTest, [], "Compiler-Tests");
  48640. $core.addMethod(
  48641. $core.method({
  48642. selector: "astPCNodeVisitor",
  48643. protocol: "factory",
  48644. fn: function (){
  48645. var self=this,$self=this;
  48646. return $core.withContext(function($ctx1) {
  48647. var $1;
  48648. $1=$recv($globals.ASTPCNodeVisitor)._new();
  48649. $recv($1)._index_((0));
  48650. return $recv($1)._yourself();
  48651. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitor",{},$globals.ASTPCNodeVisitorTest)});
  48652. },
  48653. args: [],
  48654. source: "astPCNodeVisitor\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09index: 0;\x0a\x09\x09yourself",
  48655. referencedClasses: ["ASTPCNodeVisitor"],
  48656. messageSends: ["index:", "new", "yourself"]
  48657. }),
  48658. $globals.ASTPCNodeVisitorTest);
  48659. $core.addMethod(
  48660. $core.method({
  48661. selector: "astPCNodeVisitorForSelector:",
  48662. protocol: "factory",
  48663. fn: function (aString){
  48664. var self=this,$self=this;
  48665. return $core.withContext(function($ctx1) {
  48666. var $1;
  48667. $1=$recv($globals.ASTPCNodeVisitor)._new();
  48668. $recv($1)._selector_(aString);
  48669. $recv($1)._index_((0));
  48670. return $recv($1)._yourself();
  48671. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitorForSelector:",{aString:aString},$globals.ASTPCNodeVisitorTest)});
  48672. },
  48673. args: ["aString"],
  48674. source: "astPCNodeVisitorForSelector: aString\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09selector: aString;\x0a\x09\x09index: 0;\x0a\x09\x09yourself",
  48675. referencedClasses: ["ASTPCNodeVisitor"],
  48676. messageSends: ["selector:", "new", "index:", "yourself"]
  48677. }),
  48678. $globals.ASTPCNodeVisitorTest);
  48679. $core.addMethod(
  48680. $core.method({
  48681. selector: "testJSStatementNode",
  48682. protocol: "tests",
  48683. fn: function (){
  48684. var self=this,$self=this;
  48685. var ast,visitor;
  48686. return $core.withContext(function($ctx1) {
  48687. var $3,$2,$1;
  48688. ast=$self._parse_forClass_("foo <inlineJS: 'consolee.log(1)'>",$globals.Object);
  48689. $3=$self._astPCNodeVisitor();
  48690. $recv($3)._visit_(ast);
  48691. $2=$recv($3)._currentNode();
  48692. $1=$recv($2)._isJSStatementNode();
  48693. $self._assert_($1);
  48694. return self;
  48695. }, function($ctx1) {$ctx1.fill(self,"testJSStatementNode",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)});
  48696. },
  48697. args: [],
  48698. 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",
  48699. referencedClasses: ["Object"],
  48700. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  48701. }),
  48702. $globals.ASTPCNodeVisitorTest);
  48703. $core.addMethod(
  48704. $core.method({
  48705. selector: "testMessageSend",
  48706. protocol: "tests",
  48707. fn: function (){
  48708. var self=this,$self=this;
  48709. var ast;
  48710. return $core.withContext(function($ctx1) {
  48711. var $3,$2,$1;
  48712. ast=$self._parse_forClass_("foo self asString yourself. ^ self asBoolean",$globals.Object);
  48713. $3=$self._astPCNodeVisitorForSelector_("yourself");
  48714. $recv($3)._visit_(ast);
  48715. $2=$recv($3)._currentNode();
  48716. $1=$recv($2)._selector();
  48717. $self._assert_equals_($1,"yourself");
  48718. return self;
  48719. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  48720. },
  48721. args: [],
  48722. 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'",
  48723. referencedClasses: ["Object"],
  48724. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  48725. }),
  48726. $globals.ASTPCNodeVisitorTest);
  48727. $core.addMethod(
  48728. $core.method({
  48729. selector: "testMessageSendWithBlocks",
  48730. protocol: "tests",
  48731. fn: function (){
  48732. var self=this,$self=this;
  48733. var ast;
  48734. return $core.withContext(function($ctx1) {
  48735. var $3,$2,$1;
  48736. ast=$self._parse_forClass_("foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean",$globals.Object);
  48737. $3=$self._astPCNodeVisitorForSelector_("yourself");
  48738. $recv($3)._visit_(ast);
  48739. $2=$recv($3)._currentNode();
  48740. $1=$recv($2)._selector();
  48741. $self._assert_equals_($1,"yourself");
  48742. return self;
  48743. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithBlocks",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  48744. },
  48745. args: [],
  48746. 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'",
  48747. referencedClasses: ["Object"],
  48748. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  48749. }),
  48750. $globals.ASTPCNodeVisitorTest);
  48751. $core.addMethod(
  48752. $core.method({
  48753. selector: "testMessageSendWithInlining",
  48754. protocol: "tests",
  48755. fn: function (){
  48756. var self=this,$self=this;
  48757. var ast;
  48758. return $core.withContext(function($ctx1) {
  48759. var $3,$4,$2,$1,$7,$6,$5;
  48760. ast=$self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  48761. $ctx1.sendIdx["parse:forClass:"]=1;
  48762. $3=$self._astPCNodeVisitorForSelector_("yourself");
  48763. $ctx1.sendIdx["astPCNodeVisitorForSelector:"]=1;
  48764. $recv($3)._visit_(ast);
  48765. $ctx1.sendIdx["visit:"]=1;
  48766. $4=$recv($3)._currentNode();
  48767. $ctx1.sendIdx["currentNode"]=1;
  48768. $2=$4;
  48769. $1=$recv($2)._selector();
  48770. $ctx1.sendIdx["selector"]=1;
  48771. $self._assert_equals_($1,"yourself");
  48772. $ctx1.sendIdx["assert:equals:"]=1;
  48773. ast=$self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  48774. $7=$self._astPCNodeVisitorForSelector_("asBoolean");
  48775. $recv($7)._visit_(ast);
  48776. $6=$recv($7)._currentNode();
  48777. $5=$recv($6)._selector();
  48778. $self._assert_equals_($5,"asBoolean");
  48779. return self;
  48780. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithInlining",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  48781. },
  48782. args: [],
  48783. 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'",
  48784. referencedClasses: ["Object"],
  48785. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  48786. }),
  48787. $globals.ASTPCNodeVisitorTest);
  48788. $core.addMethod(
  48789. $core.method({
  48790. selector: "testNoMessageSend",
  48791. protocol: "tests",
  48792. fn: function (){
  48793. var self=this,$self=this;
  48794. var ast;
  48795. return $core.withContext(function($ctx1) {
  48796. var $3,$2,$1;
  48797. ast=$self._parse_forClass_("foo ^ self",$globals.Object);
  48798. $3=$self._astPCNodeVisitor();
  48799. $recv($3)._visit_(ast);
  48800. $2=$recv($3)._currentNode();
  48801. $1=$recv($2)._isNil();
  48802. $self._assert_($1);
  48803. return self;
  48804. }, function($ctx1) {$ctx1.fill(self,"testNoMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  48805. },
  48806. args: [],
  48807. 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",
  48808. referencedClasses: ["Object"],
  48809. messageSends: ["parse:forClass:", "assert:", "isNil", "visit:", "astPCNodeVisitor", "currentNode"]
  48810. }),
  48811. $globals.ASTPCNodeVisitorTest);
  48812. $core.addClass("ASTPositionTest", $globals.ASTParsingTest, [], "Compiler-Tests");
  48813. $core.addMethod(
  48814. $core.method({
  48815. selector: "testNodeAtPosition",
  48816. protocol: "tests",
  48817. fn: function (){
  48818. var self=this,$self=this;
  48819. var node;
  48820. return $core.withContext(function($ctx1) {
  48821. var $3,$4,$2,$1,$7,$8,$6,$5;
  48822. node=$self._parse_forClass_("yourself\x0a\x09^ self",$globals.Object);
  48823. $ctx1.sendIdx["parse:forClass:"]=1;
  48824. $3=node;
  48825. $4=(2).__at((4));
  48826. $ctx1.sendIdx["@"]=1;
  48827. $2=$recv($3)._navigationNodeAt_ifAbsent_($4,(function(){
  48828. return nil;
  48829. }));
  48830. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=1;
  48831. $1=$recv($2)._source();
  48832. $self._assert_equals_($1,"self");
  48833. $ctx1.sendIdx["assert:equals:"]=1;
  48834. node=$self._parse_forClass_("foo\x0a\x09true ifTrue: [ 1 ]",$globals.Object);
  48835. $ctx1.sendIdx["parse:forClass:"]=2;
  48836. $7=node;
  48837. $8=(2).__at((7));
  48838. $ctx1.sendIdx["@"]=2;
  48839. $6=$recv($7)._navigationNodeAt_ifAbsent_($8,(function(){
  48840. return nil;
  48841. }));
  48842. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=2;
  48843. $5=$recv($6)._selector();
  48844. $ctx1.sendIdx["selector"]=1;
  48845. $self._assert_equals_($5,"ifTrue:");
  48846. $ctx1.sendIdx["assert:equals:"]=2;
  48847. node=$self._parse_forClass_("foo\x0a\x09self foo; bar; baz",$globals.Object);
  48848. $self._assert_equals_($recv($recv(node)._navigationNodeAt_ifAbsent_((2).__at((8)),(function(){
  48849. return nil;
  48850. })))._selector(),"foo");
  48851. return self;
  48852. }, function($ctx1) {$ctx1.fill(self,"testNodeAtPosition",{node:node},$globals.ASTPositionTest)});
  48853. },
  48854. args: [],
  48855. 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'",
  48856. referencedClasses: ["Object"],
  48857. messageSends: ["parse:forClass:", "assert:equals:", "source", "navigationNodeAt:ifAbsent:", "@", "selector"]
  48858. }),
  48859. $globals.ASTPositionTest);
  48860. $core.addClass("CodeGeneratorTest", $globals.ASTParsingTest, ["receiver"], "Compiler-Tests");
  48861. $core.addMethod(
  48862. $core.method({
  48863. selector: "codeGeneratorClass",
  48864. protocol: "accessing",
  48865. fn: function (){
  48866. var self=this,$self=this;
  48867. return $globals.CodeGenerator;
  48868. },
  48869. args: [],
  48870. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  48871. referencedClasses: ["CodeGenerator"],
  48872. messageSends: []
  48873. }),
  48874. $globals.CodeGeneratorTest);
  48875. $core.addMethod(
  48876. $core.method({
  48877. selector: "compiler",
  48878. protocol: "factory",
  48879. fn: function (){
  48880. var self=this,$self=this;
  48881. return $core.withContext(function($ctx1) {
  48882. var $1;
  48883. $1=$recv($globals.Compiler)._new();
  48884. $recv($1)._codeGeneratorClass_($self._codeGeneratorClass());
  48885. return $recv($1)._yourself();
  48886. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.CodeGeneratorTest)});
  48887. },
  48888. args: [],
  48889. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  48890. referencedClasses: ["Compiler"],
  48891. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  48892. }),
  48893. $globals.CodeGeneratorTest);
  48894. $core.addMethod(
  48895. $core.method({
  48896. selector: "setUp",
  48897. protocol: "initialization",
  48898. fn: function (){
  48899. var self=this,$self=this;
  48900. return $core.withContext(function($ctx1) {
  48901. $self["@receiver"]=$recv($globals.DoIt)._new();
  48902. return self;
  48903. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.CodeGeneratorTest)});
  48904. },
  48905. args: [],
  48906. source: "setUp\x0a\x09receiver := DoIt new",
  48907. referencedClasses: ["DoIt"],
  48908. messageSends: ["new"]
  48909. }),
  48910. $globals.CodeGeneratorTest);
  48911. $core.addMethod(
  48912. $core.method({
  48913. selector: "should:receiver:raise:",
  48914. protocol: "testing",
  48915. fn: function (aString,anObject,anErrorClass){
  48916. var self=this,$self=this;
  48917. var method,result;
  48918. return $core.withContext(function($ctx1) {
  48919. var $1,$2,$3,$receiver;
  48920. $self["@receiver"]=anObject;
  48921. $recv((function(){
  48922. return $core.withContext(function($ctx2) {
  48923. return $self._should_raise_((function(){
  48924. return $core.withContext(function($ctx3) {
  48925. $1=$self._compiler();
  48926. $2=$recv(anObject)._class();
  48927. $ctx3.sendIdx["class"]=1;
  48928. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  48929. return $recv($self["@receiver"])._perform_($recv(method)._selector());
  48930. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48931. }),anErrorClass);
  48932. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48933. }))._ensure_((function(){
  48934. return $core.withContext(function($ctx2) {
  48935. $3=method;
  48936. if(($receiver = $3) == null || $receiver.a$nil){
  48937. return $3;
  48938. } else {
  48939. return $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  48940. }
  48941. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  48942. }));
  48943. return self;
  48944. }, function($ctx1) {$ctx1.fill(self,"should:receiver:raise:",{aString:aString,anObject:anObject,anErrorClass:anErrorClass,method:method,result:result},$globals.CodeGeneratorTest)});
  48945. },
  48946. args: ["aString", "anObject", "anErrorClass"],
  48947. 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 ] ]",
  48948. referencedClasses: [],
  48949. messageSends: ["ensure:", "should:raise:", "install:forClass:protocol:", "compiler", "class", "perform:", "selector", "ifNotNil:", "removeCompiledMethod:"]
  48950. }),
  48951. $globals.CodeGeneratorTest);
  48952. $core.addMethod(
  48953. $core.method({
  48954. selector: "should:receiver:return:",
  48955. protocol: "testing",
  48956. fn: function (aString,anObject,aResult){
  48957. var self=this,$self=this;
  48958. var method,result;
  48959. return $core.withContext(function($ctx1) {
  48960. var $1,$2;
  48961. $self["@receiver"]=anObject;
  48962. $1=$self._compiler();
  48963. $2=$recv(anObject)._class();
  48964. $ctx1.sendIdx["class"]=1;
  48965. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  48966. result=$recv($self["@receiver"])._perform_($recv(method)._selector());
  48967. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  48968. $self._assert_equals_(aResult,result);
  48969. return self;
  48970. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult,method:method,result:result},$globals.CodeGeneratorTest)});
  48971. },
  48972. args: ["aString", "anObject", "aResult"],
  48973. source: "should: aString receiver: anObject return: aResult\x0a\x09| method result |\x0a\x0a\x09receiver := anObject.\x0a\x09method := self compiler install: aString forClass: anObject class protocol: 'tests'.\x0a\x09result := receiver perform: method selector.\x0a\x09anObject class removeCompiledMethod: method.\x0a\x09self assert: aResult equals: result",
  48974. referencedClasses: [],
  48975. messageSends: ["install:forClass:protocol:", "compiler", "class", "perform:", "selector", "removeCompiledMethod:", "assert:equals:"]
  48976. }),
  48977. $globals.CodeGeneratorTest);
  48978. $core.addMethod(
  48979. $core.method({
  48980. selector: "should:return:",
  48981. protocol: "testing",
  48982. fn: function (aString,anObject){
  48983. var self=this,$self=this;
  48984. return $core.withContext(function($ctx1) {
  48985. return $self._should_receiver_return_(aString,$self["@receiver"],anObject);
  48986. }, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject},$globals.CodeGeneratorTest)});
  48987. },
  48988. args: ["aString", "anObject"],
  48989. source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString \x0a\x09\x09receiver: receiver \x0a\x09\x09return: anObject",
  48990. referencedClasses: [],
  48991. messageSends: ["should:receiver:return:"]
  48992. }),
  48993. $globals.CodeGeneratorTest);
  48994. $core.addMethod(
  48995. $core.method({
  48996. selector: "tearDown",
  48997. protocol: "initialization",
  48998. fn: function (){
  48999. var self=this,$self=this;
  49000. return self;
  49001. },
  49002. args: [],
  49003. source: "tearDown\x0a\x09\x22receiver := nil\x22",
  49004. referencedClasses: [],
  49005. messageSends: []
  49006. }),
  49007. $globals.CodeGeneratorTest);
  49008. $core.addMethod(
  49009. $core.method({
  49010. selector: "testAssignment",
  49011. protocol: "tests",
  49012. fn: function (){
  49013. var self=this,$self=this;
  49014. return $core.withContext(function($ctx1) {
  49015. $self._should_return_("foo | a | a := true ifTrue: [ 1 ]. ^ a",(1));
  49016. $ctx1.sendIdx["should:return:"]=1;
  49017. $self._should_return_("foo | a | a := false ifTrue: [ 1 ]. ^ a",nil);
  49018. $ctx1.sendIdx["should:return:"]=2;
  49019. $self._should_return_("foo | a | ^ a := true ifTrue: [ 1 ]",(1));
  49020. return self;
  49021. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{},$globals.CodeGeneratorTest)});
  49022. },
  49023. args: [],
  49024. 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",
  49025. referencedClasses: [],
  49026. messageSends: ["should:return:"]
  49027. }),
  49028. $globals.CodeGeneratorTest);
  49029. $core.addMethod(
  49030. $core.method({
  49031. selector: "testBackslashSelectors",
  49032. protocol: "tests",
  49033. fn: function (){
  49034. var self=this,$self=this;
  49035. return $core.withContext(function($ctx1) {
  49036. $self._should_return_("\x5c arg ^ 4",(4));
  49037. $ctx1.sendIdx["should:return:"]=1;
  49038. $self._should_return_("\x5c\x5c arg ^ 42",(42));
  49039. return self;
  49040. }, function($ctx1) {$ctx1.fill(self,"testBackslashSelectors",{},$globals.CodeGeneratorTest)});
  49041. },
  49042. args: [],
  49043. source: "testBackslashSelectors\x0a\x09\x0a\x09self should: '\x5c arg ^ 4' return: 4.\x0a\x09self should: '\x5c\x5c arg ^ 42' return: 42",
  49044. referencedClasses: [],
  49045. messageSends: ["should:return:"]
  49046. }),
  49047. $globals.CodeGeneratorTest);
  49048. $core.addMethod(
  49049. $core.method({
  49050. selector: "testBlockReturn",
  49051. protocol: "tests",
  49052. fn: function (){
  49053. var self=this,$self=this;
  49054. return $core.withContext(function($ctx1) {
  49055. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]",[(2), (3), (4)]);
  49056. $ctx1.sendIdx["should:return:"]=1;
  49057. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]",[(2), (3), (4)]);
  49058. $ctx1.sendIdx["should:return:"]=2;
  49059. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]",[(2), (1), (4)]);
  49060. return self;
  49061. }, function($ctx1) {$ctx1.fill(self,"testBlockReturn",{},$globals.CodeGeneratorTest)});
  49062. },
  49063. args: [],
  49064. 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).",
  49065. referencedClasses: [],
  49066. messageSends: ["should:return:"]
  49067. }),
  49068. $globals.CodeGeneratorTest);
  49069. $core.addMethod(
  49070. $core.method({
  49071. selector: "testCascades",
  49072. protocol: "tests",
  49073. fn: function (){
  49074. var self=this,$self=this;
  49075. return $core.withContext(function($ctx1) {
  49076. $self._should_return_("foo ^ Array new add: 3; add: 4; yourself",[(3), (4)]);
  49077. return self;
  49078. }, function($ctx1) {$ctx1.fill(self,"testCascades",{},$globals.CodeGeneratorTest)});
  49079. },
  49080. args: [],
  49081. source: "testCascades\x0a\x09\x0a\x09self should: 'foo ^ Array new add: 3; add: 4; yourself' return: #(3 4)",
  49082. referencedClasses: [],
  49083. messageSends: ["should:return:"]
  49084. }),
  49085. $globals.CodeGeneratorTest);
  49086. $core.addMethod(
  49087. $core.method({
  49088. selector: "testCascadesInDynamicArray",
  49089. protocol: "tests",
  49090. fn: function (){
  49091. var self=this,$self=this;
  49092. return $core.withContext(function($ctx1) {
  49093. $self._should_return_("foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}",[(1), (2)]);
  49094. return self;
  49095. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicArray",{},$globals.CodeGeneratorTest)});
  49096. },
  49097. args: [],
  49098. source: "testCascadesInDynamicArray\x0a\x09self should: 'foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}' return: #(1 2)",
  49099. referencedClasses: [],
  49100. messageSends: ["should:return:"]
  49101. }),
  49102. $globals.CodeGeneratorTest);
  49103. $core.addMethod(
  49104. $core.method({
  49105. selector: "testCascadesInDynamicDictioary",
  49106. protocol: "tests",
  49107. fn: function (){
  49108. var self=this,$self=this;
  49109. return $core.withContext(function($ctx1) {
  49110. $self._should_return_("foo | x | x := 1. ^ #{'one' -> x. 'two' -> ([x:=2] value; in: [x])}",$globals.HashedCollection._newFromPairs_(["one",(1),"two",(2)]));
  49111. return self;
  49112. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicDictioary",{},$globals.CodeGeneratorTest)});
  49113. },
  49114. args: [],
  49115. source: "testCascadesInDynamicDictioary\x0a\x09self should: 'foo | x | x := 1. ^ #{''one'' -> x. ''two'' -> ([x:=2] value; in: [x])}' return: #{'one' -> 1. 'two' -> 2}",
  49116. referencedClasses: [],
  49117. messageSends: ["should:return:"]
  49118. }),
  49119. $globals.CodeGeneratorTest);
  49120. $core.addMethod(
  49121. $core.method({
  49122. selector: "testCascadesInSend",
  49123. protocol: "tests",
  49124. fn: function (){
  49125. var self=this,$self=this;
  49126. return $core.withContext(function($ctx1) {
  49127. $self._should_return_("foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])",[(1), (2)]);
  49128. return self;
  49129. }, function($ctx1) {$ctx1.fill(self,"testCascadesInSend",{},$globals.CodeGeneratorTest)});
  49130. },
  49131. args: [],
  49132. source: "testCascadesInSend\x0a\x09self should: 'foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])' return: #(1 2)",
  49133. referencedClasses: [],
  49134. messageSends: ["should:return:"]
  49135. }),
  49136. $globals.CodeGeneratorTest);
  49137. $core.addMethod(
  49138. $core.method({
  49139. selector: "testCascadesWithInlining",
  49140. protocol: "tests",
  49141. fn: function (){
  49142. var self=this,$self=this;
  49143. return $core.withContext(function($ctx1) {
  49144. $self._should_return_("foo ^ true class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(1));
  49145. $ctx1.sendIdx["should:return:"]=1;
  49146. $self._should_return_("foo ^ false class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(2));
  49147. return self;
  49148. }, function($ctx1) {$ctx1.fill(self,"testCascadesWithInlining",{},$globals.CodeGeneratorTest)});
  49149. },
  49150. args: [],
  49151. 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",
  49152. referencedClasses: [],
  49153. messageSends: ["should:return:"]
  49154. }),
  49155. $globals.CodeGeneratorTest);
  49156. $core.addMethod(
  49157. $core.method({
  49158. selector: "testDynamicArrayElementsOrdered",
  49159. protocol: "tests",
  49160. fn: function (){
  49161. var self=this,$self=this;
  49162. return $core.withContext(function($ctx1) {
  49163. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. x := 2 }\x0a",[(1), (2)]);
  49164. $ctx1.sendIdx["should:return:"]=1;
  49165. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a",[(1), (2)]);
  49166. return self;
  49167. }, function($ctx1) {$ctx1.fill(self,"testDynamicArrayElementsOrdered",{},$globals.CodeGeneratorTest)});
  49168. },
  49169. args: [],
  49170. 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).",
  49171. referencedClasses: [],
  49172. messageSends: ["should:return:"]
  49173. }),
  49174. $globals.CodeGeneratorTest);
  49175. $core.addMethod(
  49176. $core.method({
  49177. selector: "testDynamicDictionaryElementsOrdered",
  49178. protocol: "tests",
  49179. fn: function (){
  49180. var self=this,$self=this;
  49181. return $core.withContext(function($ctx1) {
  49182. $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)]));
  49183. return self;
  49184. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryElementsOrdered",{},$globals.CodeGeneratorTest)});
  49185. },
  49186. args: [],
  49187. 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}.",
  49188. referencedClasses: [],
  49189. messageSends: ["should:return:"]
  49190. }),
  49191. $globals.CodeGeneratorTest);
  49192. $core.addMethod(
  49193. $core.method({
  49194. selector: "testDynamicDictionaryWithMoreArrows",
  49195. protocol: "tests",
  49196. fn: function (){
  49197. var self=this,$self=this;
  49198. return $core.withContext(function($ctx1) {
  49199. var $2,$1;
  49200. $2=$recv((1).__minus_gt((2))).__minus_gt((3));
  49201. $ctx1.sendIdx["->"]=1;
  49202. $1=$recv($globals.HashedCollection)._with_($2);
  49203. $self._should_return_("foo ^ #{1->2->3}",$1);
  49204. return self;
  49205. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryWithMoreArrows",{},$globals.CodeGeneratorTest)});
  49206. },
  49207. args: [],
  49208. source: "testDynamicDictionaryWithMoreArrows\x0a\x09self should: 'foo ^ #{1->2->3}' return: (HashedCollection with: 1->2->3)",
  49209. referencedClasses: ["HashedCollection"],
  49210. messageSends: ["should:return:", "with:", "->"]
  49211. }),
  49212. $globals.CodeGeneratorTest);
  49213. $core.addMethod(
  49214. $core.method({
  49215. selector: "testGlobalVar",
  49216. protocol: "tests",
  49217. fn: function (){
  49218. var self=this,$self=this;
  49219. return $core.withContext(function($ctx1) {
  49220. $self._should_return_("foo ^ eval class",$globals.BlockClosure);
  49221. $ctx1.sendIdx["should:return:"]=1;
  49222. $self._should_return_("foo ^ Math cos: 0",(1));
  49223. $ctx1.sendIdx["should:return:"]=2;
  49224. $self._should_return_("foo ^ NonExistingVar",nil);
  49225. return self;
  49226. }, function($ctx1) {$ctx1.fill(self,"testGlobalVar",{},$globals.CodeGeneratorTest)});
  49227. },
  49228. args: [],
  49229. 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",
  49230. referencedClasses: ["BlockClosure"],
  49231. messageSends: ["should:return:"]
  49232. }),
  49233. $globals.CodeGeneratorTest);
  49234. $core.addMethod(
  49235. $core.method({
  49236. selector: "testInnerTemporalDependentElementsOrdered",
  49237. protocol: "tests",
  49238. fn: function (){
  49239. var self=this,$self=this;
  49240. return $core.withContext(function($ctx1) {
  49241. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$10;
  49242. $2="foo".__minus_gt($globals.Array);
  49243. $ctx1.sendIdx["->"]=1;
  49244. $3="bar".__minus_gt((2));
  49245. $ctx1.sendIdx["->"]=2;
  49246. $1=[$2,$3];
  49247. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(x := 2)\x0a",$1);
  49248. $ctx1.sendIdx["should:return:"]=1;
  49249. $5="foo".__minus_gt($globals.Array);
  49250. $ctx1.sendIdx["->"]=3;
  49251. $6="bar".__minus_gt((2));
  49252. $ctx1.sendIdx["->"]=4;
  49253. $4=[$5,$6];
  49254. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$4);
  49255. $ctx1.sendIdx["should:return:"]=2;
  49256. $8="foo".__minus_gt((1));
  49257. $ctx1.sendIdx["->"]=5;
  49258. $9="bar".__minus_gt((2));
  49259. $ctx1.sendIdx["->"]=6;
  49260. $7=[$8,$9];
  49261. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$7);
  49262. $ctx1.sendIdx["should:return:"]=3;
  49263. $11="foo".__minus_gt((1));
  49264. $ctx1.sendIdx["->"]=7;
  49265. $10=[$11,"bar".__minus_gt((2))];
  49266. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",$10);
  49267. $ctx1.sendIdx["should:return:"]=4;
  49268. $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)]));
  49269. return self;
  49270. }, function($ctx1) {$ctx1.fill(self,"testInnerTemporalDependentElementsOrdered",{},$globals.CodeGeneratorTest)});
  49271. },
  49272. args: [],
  49273. 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}.",
  49274. referencedClasses: ["Array"],
  49275. messageSends: ["should:return:", "->"]
  49276. }),
  49277. $globals.CodeGeneratorTest);
  49278. $core.addMethod(
  49279. $core.method({
  49280. selector: "testLexicalScope",
  49281. protocol: "tests",
  49282. fn: function (){
  49283. var self=this,$self=this;
  49284. return $core.withContext(function($ctx1) {
  49285. $self._should_return_("foo | a | a := 1. [ a := 2 ] value. ^ a",(2));
  49286. return self;
  49287. }, function($ctx1) {$ctx1.fill(self,"testLexicalScope",{},$globals.CodeGeneratorTest)});
  49288. },
  49289. args: [],
  49290. source: "testLexicalScope\x0a\x09self should: 'foo | a | a := 1. [ a := 2 ] value. ^ a' return: 2",
  49291. referencedClasses: [],
  49292. messageSends: ["should:return:"]
  49293. }),
  49294. $globals.CodeGeneratorTest);
  49295. $core.addMethod(
  49296. $core.method({
  49297. selector: "testLiterals",
  49298. protocol: "tests",
  49299. fn: function (){
  49300. var self=this,$self=this;
  49301. return $core.withContext(function($ctx1) {
  49302. $self._should_return_("foo ^ 1",(1));
  49303. $ctx1.sendIdx["should:return:"]=1;
  49304. $self._should_return_("foo ^ 'hello'","hello");
  49305. $ctx1.sendIdx["should:return:"]=2;
  49306. $self._should_return_("foo ^ #(1 2 3 4)",[(1), (2), (3), (4)]);
  49307. $ctx1.sendIdx["should:return:"]=3;
  49308. $self._should_return_("foo ^ {1. [:x | x ] value: 2. 3. [4] value}",[(1), (2), (3), (4)]);
  49309. $ctx1.sendIdx["should:return:"]=4;
  49310. $self._should_return_("foo ^ true",true);
  49311. $ctx1.sendIdx["should:return:"]=5;
  49312. $self._should_return_("foo ^ false",false);
  49313. $ctx1.sendIdx["should:return:"]=6;
  49314. $self._should_return_("foo ^ #{1->2. 3->4}",$globals.HashedCollection._newFromPairs_([(1),(2),(3),(4)]));
  49315. $ctx1.sendIdx["should:return:"]=7;
  49316. $self._should_return_("foo ^ #hello","hello");
  49317. $ctx1.sendIdx["should:return:"]=8;
  49318. $self._should_return_("foo ^ $h","h");
  49319. $ctx1.sendIdx["should:return:"]=9;
  49320. $self._should_return_("foo ^ -123.456",(-123.456));
  49321. $ctx1.sendIdx["should:return:"]=10;
  49322. $self._should_return_("foo ^ -2.5e4",(-25000));
  49323. return self;
  49324. }, function($ctx1) {$ctx1.fill(self,"testLiterals",{},$globals.CodeGeneratorTest)});
  49325. },
  49326. args: [],
  49327. 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.",
  49328. referencedClasses: [],
  49329. messageSends: ["should:return:"]
  49330. }),
  49331. $globals.CodeGeneratorTest);
  49332. $core.addMethod(
  49333. $core.method({
  49334. selector: "testLocalReturn",
  49335. protocol: "tests",
  49336. fn: function (){
  49337. var self=this,$self=this;
  49338. return $core.withContext(function($ctx1) {
  49339. $self._should_return_("foo ^ 1",(1));
  49340. $ctx1.sendIdx["should:return:"]=1;
  49341. $self._should_return_("foo ^ 1 + 1",(2));
  49342. $ctx1.sendIdx["should:return:"]=2;
  49343. $self._should_return_("foo ",$self["@receiver"]);
  49344. $ctx1.sendIdx["should:return:"]=3;
  49345. $self._should_return_("foo self asString",$self["@receiver"]);
  49346. $ctx1.sendIdx["should:return:"]=4;
  49347. $self._should_return_("foo | a b | a := 1. b := 2. ^ a + b",(3));
  49348. return self;
  49349. }, function($ctx1) {$ctx1.fill(self,"testLocalReturn",{},$globals.CodeGeneratorTest)});
  49350. },
  49351. args: [],
  49352. 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",
  49353. referencedClasses: [],
  49354. messageSends: ["should:return:"]
  49355. }),
  49356. $globals.CodeGeneratorTest);
  49357. $core.addMethod(
  49358. $core.method({
  49359. selector: "testMessageSends",
  49360. protocol: "tests",
  49361. fn: function (){
  49362. var self=this,$self=this;
  49363. return $core.withContext(function($ctx1) {
  49364. $self._should_return_("foo ^ 1 asString","1");
  49365. $ctx1.sendIdx["should:return:"]=1;
  49366. $self._should_return_("foo ^ 1 + 1",(2));
  49367. $ctx1.sendIdx["should:return:"]=2;
  49368. $self._should_return_("foo ^ 1 + 2 * 3",(9));
  49369. $ctx1.sendIdx["should:return:"]=3;
  49370. $self._should_return_("foo ^ 1 to: 3",[(1), (2), (3)]);
  49371. $ctx1.sendIdx["should:return:"]=4;
  49372. $self._should_return_("foo ^ 1 to: 5 by: 2",[(1), (3), (5)]);
  49373. return self;
  49374. }, function($ctx1) {$ctx1.fill(self,"testMessageSends",{},$globals.CodeGeneratorTest)});
  49375. },
  49376. args: [],
  49377. 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)",
  49378. referencedClasses: [],
  49379. messageSends: ["should:return:"]
  49380. }),
  49381. $globals.CodeGeneratorTest);
  49382. $core.addMethod(
  49383. $core.method({
  49384. selector: "testMistypedPragmaJSStatement",
  49385. protocol: "tests",
  49386. fn: function (){
  49387. var self=this,$self=this;
  49388. return $core.withContext(function($ctx1) {
  49389. $self._should_receiver_raise_("foo < inlineJS: 'return 'foo'' >",$self["@receiver"],$globals.ParseError);
  49390. return self;
  49391. }, function($ctx1) {$ctx1.fill(self,"testMistypedPragmaJSStatement",{},$globals.CodeGeneratorTest)});
  49392. },
  49393. args: [],
  49394. source: "testMistypedPragmaJSStatement\x0a\x09self should: 'foo < inlineJS: ''return ''foo'''' >' receiver: receiver raise: ParseError",
  49395. referencedClasses: ["ParseError"],
  49396. messageSends: ["should:receiver:raise:"]
  49397. }),
  49398. $globals.CodeGeneratorTest);
  49399. $core.addMethod(
  49400. $core.method({
  49401. selector: "testMultipleSequences",
  49402. protocol: "tests",
  49403. fn: function (){
  49404. var self=this,$self=this;
  49405. return $core.withContext(function($ctx1) {
  49406. $self._should_return_("foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6",(30));
  49407. return self;
  49408. }, function($ctx1) {$ctx1.fill(self,"testMultipleSequences",{},$globals.CodeGeneratorTest)});
  49409. },
  49410. args: [],
  49411. source: "testMultipleSequences\x0a\x09self should: 'foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6' return: 30",
  49412. referencedClasses: [],
  49413. messageSends: ["should:return:"]
  49414. }),
  49415. $globals.CodeGeneratorTest);
  49416. $core.addMethod(
  49417. $core.method({
  49418. selector: "testMutableLiterals",
  49419. protocol: "tests",
  49420. fn: function (){
  49421. var self=this,$self=this;
  49422. return $core.withContext(function($ctx1) {
  49423. $self._should_return_("foo ^ #( 1 2 ) at: 1 put: 3; yourself",[(3), (2)]);
  49424. return self;
  49425. }, function($ctx1) {$ctx1.fill(self,"testMutableLiterals",{},$globals.CodeGeneratorTest)});
  49426. },
  49427. args: [],
  49428. 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)",
  49429. referencedClasses: [],
  49430. messageSends: ["should:return:"]
  49431. }),
  49432. $globals.CodeGeneratorTest);
  49433. $core.addMethod(
  49434. $core.method({
  49435. selector: "testNestedIfTrue",
  49436. protocol: "tests",
  49437. fn: function (){
  49438. var self=this,$self=this;
  49439. return $core.withContext(function($ctx1) {
  49440. $self._should_return_("foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]",(1));
  49441. $ctx1.sendIdx["should:return:"]=1;
  49442. $self._should_return_("foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]",nil);
  49443. $ctx1.sendIdx["should:return:"]=2;
  49444. $self._should_return_("foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]",(1));
  49445. $ctx1.sendIdx["should:return:"]=3;
  49446. $self._should_return_("foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]",$self["@receiver"]);
  49447. return self;
  49448. }, function($ctx1) {$ctx1.fill(self,"testNestedIfTrue",{},$globals.CodeGeneratorTest)});
  49449. },
  49450. args: [],
  49451. 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.",
  49452. referencedClasses: [],
  49453. messageSends: ["should:return:"]
  49454. }),
  49455. $globals.CodeGeneratorTest);
  49456. $core.addMethod(
  49457. $core.method({
  49458. selector: "testNestedSends",
  49459. protocol: "tests",
  49460. fn: function (){
  49461. var self=this,$self=this;
  49462. return $core.withContext(function($ctx1) {
  49463. $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());
  49464. return self;
  49465. }, function($ctx1) {$ctx1.fill(self,"testNestedSends",{},$globals.CodeGeneratorTest)});
  49466. },
  49467. args: [],
  49468. source: "testNestedSends\x0a\x09self should: 'foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString' return: (Point x: (2@3) y: 4) asString",
  49469. referencedClasses: ["Point"],
  49470. messageSends: ["should:return:", "asString", "x:y:", "@"]
  49471. }),
  49472. $globals.CodeGeneratorTest);
  49473. $core.addMethod(
  49474. $core.method({
  49475. selector: "testNonLocalReturn",
  49476. protocol: "tests",
  49477. fn: function (){
  49478. var self=this,$self=this;
  49479. return $core.withContext(function($ctx1) {
  49480. $self._should_return_("foo [ ^ 1 ] value",(1));
  49481. $ctx1.sendIdx["should:return:"]=1;
  49482. $self._should_return_("foo [ ^ 1 + 1 ] value",(2));
  49483. $ctx1.sendIdx["should:return:"]=2;
  49484. $self._should_return_("foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt",(3));
  49485. $ctx1.sendIdx["should:return:"]=3;
  49486. $self._should_return_("foo [ :x | ^ x + x ] value: 4. ^ 2",(8));
  49487. return self;
  49488. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{},$globals.CodeGeneratorTest)});
  49489. },
  49490. args: [],
  49491. 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",
  49492. referencedClasses: [],
  49493. messageSends: ["should:return:"]
  49494. }),
  49495. $globals.CodeGeneratorTest);
  49496. $core.addMethod(
  49497. $core.method({
  49498. selector: "testPascalCaseGlobal",
  49499. protocol: "tests",
  49500. fn: function (){
  49501. var self=this,$self=this;
  49502. return $core.withContext(function($ctx1) {
  49503. $self._should_return_("foo ^Object",$recv($recv($globals.Smalltalk)._globals())._at_("Object"));
  49504. $ctx1.sendIdx["should:return:"]=1;
  49505. $self._should_return_("foo ^NonExistent",nil);
  49506. return self;
  49507. }, function($ctx1) {$ctx1.fill(self,"testPascalCaseGlobal",{},$globals.CodeGeneratorTest)});
  49508. },
  49509. args: [],
  49510. source: "testPascalCaseGlobal\x0a\x09self should: 'foo ^Object' return: (Smalltalk globals at: 'Object').\x0a\x09self should: 'foo ^NonExistent' return: nil",
  49511. referencedClasses: ["Smalltalk"],
  49512. messageSends: ["should:return:", "at:", "globals"]
  49513. }),
  49514. $globals.CodeGeneratorTest);
  49515. $core.addMethod(
  49516. $core.method({
  49517. selector: "testPragmaInBlock",
  49518. protocol: "tests",
  49519. fn: function (){
  49520. var self=this,$self=this;
  49521. return $core.withContext(function($ctx1) {
  49522. $self._should_receiver_raise_("foo ^ [ < fooBar > 4 ] value",$self["@receiver"],$globals.CompilerError);
  49523. return self;
  49524. }, function($ctx1) {$ctx1.fill(self,"testPragmaInBlock",{},$globals.CodeGeneratorTest)});
  49525. },
  49526. args: [],
  49527. source: "testPragmaInBlock\x0a\x09self should: 'foo ^ [ < fooBar > 4 ] value' receiver: receiver raise: CompilerError",
  49528. referencedClasses: ["CompilerError"],
  49529. messageSends: ["should:receiver:raise:"]
  49530. }),
  49531. $globals.CodeGeneratorTest);
  49532. $core.addMethod(
  49533. $core.method({
  49534. selector: "testPragmaJSStatement",
  49535. protocol: "tests",
  49536. fn: function (){
  49537. var self=this,$self=this;
  49538. return $core.withContext(function($ctx1) {
  49539. $self._should_return_("foo < inlineJS: 'return 2+3' >",(5));
  49540. return self;
  49541. }, function($ctx1) {$ctx1.fill(self,"testPragmaJSStatement",{},$globals.CodeGeneratorTest)});
  49542. },
  49543. args: [],
  49544. source: "testPragmaJSStatement\x0a\x09self should: 'foo < inlineJS: ''return 2+3'' >' return: 5",
  49545. referencedClasses: [],
  49546. messageSends: ["should:return:"]
  49547. }),
  49548. $globals.CodeGeneratorTest);
  49549. $core.addMethod(
  49550. $core.method({
  49551. selector: "testRootSuperSend",
  49552. protocol: "tests",
  49553. fn: function (){
  49554. var self=this,$self=this;
  49555. return $core.withContext(function($ctx1) {
  49556. $self._should_receiver_raise_("foo ^ super class",$recv($globals.ProtoObject)._new(),$globals.MessageNotUnderstood);
  49557. return self;
  49558. }, function($ctx1) {$ctx1.fill(self,"testRootSuperSend",{},$globals.CodeGeneratorTest)});
  49559. },
  49560. args: [],
  49561. source: "testRootSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super class' \x0a\x09\x09receiver: ProtoObject new\x0a\x09\x09raise: MessageNotUnderstood",
  49562. referencedClasses: ["ProtoObject", "MessageNotUnderstood"],
  49563. messageSends: ["should:receiver:raise:", "new"]
  49564. }),
  49565. $globals.CodeGeneratorTest);
  49566. $core.addMethod(
  49567. $core.method({
  49568. selector: "testSendReceiverAndArgumentsOrdered",
  49569. protocol: "tests",
  49570. fn: function (){
  49571. var self=this,$self=this;
  49572. return $core.withContext(function($ctx1) {
  49573. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a",[(1), (2)]);
  49574. $ctx1.sendIdx["should:return:"]=1;
  49575. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a",[$globals.Array,(2)]);
  49576. return self;
  49577. }, function($ctx1) {$ctx1.fill(self,"testSendReceiverAndArgumentsOrdered",{},$globals.CodeGeneratorTest)});
  49578. },
  49579. args: [],
  49580. 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}.",
  49581. referencedClasses: ["Array"],
  49582. messageSends: ["should:return:"]
  49583. }),
  49584. $globals.CodeGeneratorTest);
  49585. $core.addMethod(
  49586. $core.method({
  49587. selector: "testSuperSend",
  49588. protocol: "tests",
  49589. fn: function (){
  49590. var self=this,$self=this;
  49591. return $core.withContext(function($ctx1) {
  49592. $self._should_receiver_return_("foo ^ super isBoolean",true,false);
  49593. return self;
  49594. }, function($ctx1) {$ctx1.fill(self,"testSuperSend",{},$globals.CodeGeneratorTest)});
  49595. },
  49596. args: [],
  49597. source: "testSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super isBoolean' \x0a\x09\x09receiver: true\x0a\x09\x09return: false",
  49598. referencedClasses: [],
  49599. messageSends: ["should:receiver:return:"]
  49600. }),
  49601. $globals.CodeGeneratorTest);
  49602. $core.addMethod(
  49603. $core.method({
  49604. selector: "testTempVariables",
  49605. protocol: "tests",
  49606. fn: function (){
  49607. var self=this,$self=this;
  49608. return $core.withContext(function($ctx1) {
  49609. $self._should_return_("foo | a | ^ a",nil);
  49610. $ctx1.sendIdx["should:return:"]=1;
  49611. $self._should_return_("foo | AVariable | ^ AVariable",nil);
  49612. $ctx1.sendIdx["should:return:"]=2;
  49613. $self._should_return_("foo | a b c | ^ c",nil);
  49614. $ctx1.sendIdx["should:return:"]=3;
  49615. $self._should_return_("foo | a | [ | d | ^ d ] value",nil);
  49616. $ctx1.sendIdx["should:return:"]=4;
  49617. $self._should_return_("foo | a | a:= 1. ^ a",(1));
  49618. $ctx1.sendIdx["should:return:"]=5;
  49619. $self._should_return_("foo | AVariable | AVariable := 1. ^ AVariable",(1));
  49620. return self;
  49621. }, function($ctx1) {$ctx1.fill(self,"testTempVariables",{},$globals.CodeGeneratorTest)});
  49622. },
  49623. args: [],
  49624. 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.",
  49625. referencedClasses: [],
  49626. messageSends: ["should:return:"]
  49627. }),
  49628. $globals.CodeGeneratorTest);
  49629. $core.addMethod(
  49630. $core.method({
  49631. selector: "testThisContext",
  49632. protocol: "tests",
  49633. fn: function (){
  49634. var self=this,$self=this;
  49635. return $core.withContext(function($ctx1) {
  49636. $self._should_return_("foo ^ [ thisContext ] value outerContext == thisContext",true);
  49637. return self;
  49638. }, function($ctx1) {$ctx1.fill(self,"testThisContext",{},$globals.CodeGeneratorTest)});
  49639. },
  49640. args: [],
  49641. source: "testThisContext\x0a\x09self should: 'foo ^ [ thisContext ] value outerContext == thisContext' return: true",
  49642. referencedClasses: [],
  49643. messageSends: ["should:return:"]
  49644. }),
  49645. $globals.CodeGeneratorTest);
  49646. $core.addMethod(
  49647. $core.method({
  49648. selector: "testUnknownPragma",
  49649. protocol: "tests",
  49650. fn: function (){
  49651. var self=this,$self=this;
  49652. return $core.withContext(function($ctx1) {
  49653. $self._should_return_("foo < fooBar: 'return 2+3' > | x | ^ x := 6",(6));
  49654. $ctx1.sendIdx["should:return:"]=1;
  49655. $self._should_return_("foo | x | < fooBar: 'return 2+3' > ^ x := 6",(6));
  49656. return self;
  49657. }, function($ctx1) {$ctx1.fill(self,"testUnknownPragma",{},$globals.CodeGeneratorTest)});
  49658. },
  49659. args: [],
  49660. 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",
  49661. referencedClasses: [],
  49662. messageSends: ["should:return:"]
  49663. }),
  49664. $globals.CodeGeneratorTest);
  49665. $core.addMethod(
  49666. $core.method({
  49667. selector: "testifFalse",
  49668. protocol: "tests",
  49669. fn: function (){
  49670. var self=this,$self=this;
  49671. return $core.withContext(function($ctx1) {
  49672. $self._should_return_("foo true ifFalse: [ ^ 1 ]",$self["@receiver"]);
  49673. $ctx1.sendIdx["should:return:"]=1;
  49674. $self._should_return_("foo false ifFalse: [ ^ 2 ]",(2));
  49675. $ctx1.sendIdx["should:return:"]=2;
  49676. $self._should_return_("foo ^ true ifFalse: [ 1 ]",nil);
  49677. $ctx1.sendIdx["should:return:"]=3;
  49678. $self._should_return_("foo ^ false ifFalse: [ 2 ]",(2));
  49679. return self;
  49680. }, function($ctx1) {$ctx1.fill(self,"testifFalse",{},$globals.CodeGeneratorTest)});
  49681. },
  49682. args: [],
  49683. 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.",
  49684. referencedClasses: [],
  49685. messageSends: ["should:return:"]
  49686. }),
  49687. $globals.CodeGeneratorTest);
  49688. $core.addMethod(
  49689. $core.method({
  49690. selector: "testifFalseIfTrue",
  49691. protocol: "tests",
  49692. fn: function (){
  49693. var self=this,$self=this;
  49694. return $core.withContext(function($ctx1) {
  49695. $self._should_return_("foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]",(2));
  49696. $ctx1.sendIdx["should:return:"]=1;
  49697. $self._should_return_("foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]",(2));
  49698. $ctx1.sendIdx["should:return:"]=2;
  49699. $self._should_return_("foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]",(2));
  49700. $ctx1.sendIdx["should:return:"]=3;
  49701. $self._should_return_("foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]",(2));
  49702. return self;
  49703. }, function($ctx1) {$ctx1.fill(self,"testifFalseIfTrue",{},$globals.CodeGeneratorTest)});
  49704. },
  49705. args: [],
  49706. 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.",
  49707. referencedClasses: [],
  49708. messageSends: ["should:return:"]
  49709. }),
  49710. $globals.CodeGeneratorTest);
  49711. $core.addMethod(
  49712. $core.method({
  49713. selector: "testifNil",
  49714. protocol: "tests",
  49715. fn: function (){
  49716. var self=this,$self=this;
  49717. return $core.withContext(function($ctx1) {
  49718. $self._should_return_("foo ^ 1 ifNil: [ 2 ]",(1));
  49719. $ctx1.sendIdx["should:return:"]=1;
  49720. $self._should_return_("foo ^ nil ifNil: [ 2 ]",(2));
  49721. $ctx1.sendIdx["should:return:"]=2;
  49722. $self._should_return_("foo 1 ifNil: [ ^ 2 ]",$self["@receiver"]);
  49723. $ctx1.sendIdx["should:return:"]=3;
  49724. $self._should_return_("foo nil ifNil: [ ^ 2 ]",(2));
  49725. return self;
  49726. }, function($ctx1) {$ctx1.fill(self,"testifNil",{},$globals.CodeGeneratorTest)});
  49727. },
  49728. args: [],
  49729. 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.",
  49730. referencedClasses: [],
  49731. messageSends: ["should:return:"]
  49732. }),
  49733. $globals.CodeGeneratorTest);
  49734. $core.addMethod(
  49735. $core.method({
  49736. selector: "testifNilIfNotNil",
  49737. protocol: "tests",
  49738. fn: function (){
  49739. var self=this,$self=this;
  49740. return $core.withContext(function($ctx1) {
  49741. $self._should_return_("foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]",(3));
  49742. $ctx1.sendIdx["should:return:"]=1;
  49743. $self._should_return_("foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]",(2));
  49744. $ctx1.sendIdx["should:return:"]=2;
  49745. $self._should_return_("foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(3));
  49746. $ctx1.sendIdx["should:return:"]=3;
  49747. $self._should_return_("foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(2));
  49748. return self;
  49749. }, function($ctx1) {$ctx1.fill(self,"testifNilIfNotNil",{},$globals.CodeGeneratorTest)});
  49750. },
  49751. args: [],
  49752. 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.",
  49753. referencedClasses: [],
  49754. messageSends: ["should:return:"]
  49755. }),
  49756. $globals.CodeGeneratorTest);
  49757. $core.addMethod(
  49758. $core.method({
  49759. selector: "testifNotNil",
  49760. protocol: "tests",
  49761. fn: function (){
  49762. var self=this,$self=this;
  49763. return $core.withContext(function($ctx1) {
  49764. $self._should_return_("foo ^ 1 ifNotNil: [ 2 ]",(2));
  49765. $ctx1.sendIdx["should:return:"]=1;
  49766. $self._should_return_("foo ^ nil ifNotNil: [ 2 ]",nil);
  49767. $ctx1.sendIdx["should:return:"]=2;
  49768. $self._should_return_("foo 1 ifNotNil: [ ^ 2 ]",(2));
  49769. $ctx1.sendIdx["should:return:"]=3;
  49770. $self._should_return_("foo nil ifNotNil: [ ^ 2 ]",$self["@receiver"]);
  49771. return self;
  49772. }, function($ctx1) {$ctx1.fill(self,"testifNotNil",{},$globals.CodeGeneratorTest)});
  49773. },
  49774. args: [],
  49775. 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.",
  49776. referencedClasses: [],
  49777. messageSends: ["should:return:"]
  49778. }),
  49779. $globals.CodeGeneratorTest);
  49780. $core.addMethod(
  49781. $core.method({
  49782. selector: "testifNotNilWithArgument",
  49783. protocol: "tests",
  49784. fn: function (){
  49785. var self=this,$self=this;
  49786. return $core.withContext(function($ctx1) {
  49787. $self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ]",(3));
  49788. $ctx1.sendIdx["should:return:"]=1;
  49789. $self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ]",nil);
  49790. $ctx1.sendIdx["should:return:"]=2;
  49791. $self._should_return_("foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(3));
  49792. $ctx1.sendIdx["should:return:"]=3;
  49793. $self._should_return_("foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(5));
  49794. $ctx1.sendIdx["should:return:"]=4;
  49795. $self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(3));
  49796. $ctx1.sendIdx["should:return:"]=5;
  49797. $self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(5));
  49798. return self;
  49799. }, function($ctx1) {$ctx1.fill(self,"testifNotNilWithArgument",{},$globals.CodeGeneratorTest)});
  49800. },
  49801. args: [],
  49802. 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",
  49803. referencedClasses: [],
  49804. messageSends: ["should:return:"]
  49805. }),
  49806. $globals.CodeGeneratorTest);
  49807. $core.addMethod(
  49808. $core.method({
  49809. selector: "testifTrue",
  49810. protocol: "tests",
  49811. fn: function (){
  49812. var self=this,$self=this;
  49813. return $core.withContext(function($ctx1) {
  49814. $self._should_return_("foo false ifTrue: [ ^ 1 ]",$self["@receiver"]);
  49815. $ctx1.sendIdx["should:return:"]=1;
  49816. $self._should_return_("foo true ifTrue: [ ^ 2 ]",(2));
  49817. $ctx1.sendIdx["should:return:"]=2;
  49818. $self._should_return_("foo ^ false ifTrue: [ 1 ]",nil);
  49819. $ctx1.sendIdx["should:return:"]=3;
  49820. $self._should_return_("foo ^ true ifTrue: [ 2 ]",(2));
  49821. return self;
  49822. }, function($ctx1) {$ctx1.fill(self,"testifTrue",{},$globals.CodeGeneratorTest)});
  49823. },
  49824. args: [],
  49825. 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.",
  49826. referencedClasses: [],
  49827. messageSends: ["should:return:"]
  49828. }),
  49829. $globals.CodeGeneratorTest);
  49830. $core.addMethod(
  49831. $core.method({
  49832. selector: "testifTrueIfFalse",
  49833. protocol: "tests",
  49834. fn: function (){
  49835. var self=this,$self=this;
  49836. return $core.withContext(function($ctx1) {
  49837. $self._should_return_("foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]",(2));
  49838. $ctx1.sendIdx["should:return:"]=1;
  49839. $self._should_return_("foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]",(1));
  49840. $ctx1.sendIdx["should:return:"]=2;
  49841. $self._should_return_("foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]",(1));
  49842. $ctx1.sendIdx["should:return:"]=3;
  49843. $self._should_return_("foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]",(2));
  49844. return self;
  49845. }, function($ctx1) {$ctx1.fill(self,"testifTrueIfFalse",{},$globals.CodeGeneratorTest)});
  49846. },
  49847. args: [],
  49848. 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.",
  49849. referencedClasses: [],
  49850. messageSends: ["should:return:"]
  49851. }),
  49852. $globals.CodeGeneratorTest);
  49853. $core.addClass("ASTInterpreterTest", $globals.CodeGeneratorTest, [], "Compiler-Tests");
  49854. $core.addMethod(
  49855. $core.method({
  49856. selector: "interpret:receiver:withArguments:",
  49857. protocol: "private",
  49858. fn: function (aString,anObject,aDictionary){
  49859. var self=this,$self=this;
  49860. var ctx,ast,interpreter;
  49861. return $core.withContext(function($ctx1) {
  49862. var $1,$2,$3,$receiver;
  49863. interpreter=$recv($globals.ASTInterpreter)._new();
  49864. $ctx1.sendIdx["new"]=1;
  49865. ast=$self._parse_forClass_(aString,$recv(anObject)._class());
  49866. $1=$recv($globals.AIContext)._new();
  49867. $recv($1)._receiver_(anObject);
  49868. $recv($1)._interpreter_(interpreter);
  49869. ctx=$recv($1)._yourself();
  49870. $2=$recv(ast)._sequenceNode();
  49871. if(($receiver = $2) == null || $receiver.a$nil){
  49872. $2;
  49873. } else {
  49874. var sequence;
  49875. sequence=$receiver;
  49876. $recv($recv(sequence)._temps())._do_((function(each){
  49877. return $core.withContext(function($ctx2) {
  49878. return $recv(ctx)._defineLocal_(each);
  49879. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  49880. }));
  49881. }
  49882. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  49883. return $core.withContext(function($ctx2) {
  49884. return $recv(ctx)._localAt_put_(key,value);
  49885. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  49886. }));
  49887. $3=interpreter;
  49888. $recv($3)._context_(ctx);
  49889. $recv($3)._node_(ast);
  49890. $recv($3)._enterNode();
  49891. $recv($3)._proceed();
  49892. return $recv($3)._result();
  49893. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,interpreter:interpreter},$globals.ASTInterpreterTest)});
  49894. },
  49895. args: ["aString", "anObject", "aDictionary"],
  49896. source: "interpret: aString receiver: anObject withArguments: aDictionary\x0a\x09\x22The food is a methodNode. Interpret the sequenceNode only\x22\x0a\x09\x0a\x09| ctx ast interpreter |\x0a\x09\x0a\x09interpreter := ASTInterpreter new.\x0a\x09ast := self parse: aString forClass: anObject class.\x0a\x09\x0a\x09ctx := AIContext new\x0a\x09\x09receiver: anObject;\x0a\x09\x09interpreter: interpreter;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09\x22Define locals for the context\x22\x0a\x09ast sequenceNode ifNotNil: [ :sequence |\x0a\x09\x09sequence temps do: [ :each |\x0a\x09\x09\x09ctx defineLocal: each ] ].\x0a\x09\x09\x0a\x09aDictionary keysAndValuesDo: [ :key :value |\x0a\x09\x09ctx localAt: key put: value ].\x0a\x09\x0a\x09^ interpreter\x0a\x09\x09context: ctx;\x0a\x09\x09node: ast;\x0a\x09\x09enterNode;\x0a\x09\x09proceed;\x0a\x09\x09result",
  49897. referencedClasses: ["ASTInterpreter", "AIContext"],
  49898. messageSends: ["new", "parse:forClass:", "class", "receiver:", "interpreter:", "yourself", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "node:", "enterNode", "proceed", "result"]
  49899. }),
  49900. $globals.ASTInterpreterTest);
  49901. $core.addMethod(
  49902. $core.method({
  49903. selector: "should:receiver:return:",
  49904. protocol: "testing",
  49905. fn: function (aString,anObject,aResult){
  49906. var self=this,$self=this;
  49907. return $core.withContext(function($ctx1) {
  49908. $self["@receiver"]=anObject;
  49909. return $self._assert_equals_($self._interpret_receiver_withArguments_(aString,$self["@receiver"],$globals.HashedCollection._newFromPairs_([])),aResult);
  49910. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult},$globals.ASTInterpreterTest)});
  49911. },
  49912. args: ["aString", "anObject", "aResult"],
  49913. source: "should: aString receiver: anObject return: aResult\x0a\x09receiver := anObject.\x0a\x09\x0a\x09^ self \x0a\x09\x09assert: (self interpret: aString receiver: receiver withArguments: #{})\x0a\x09\x09equals: aResult",
  49914. referencedClasses: [],
  49915. messageSends: ["assert:equals:", "interpret:receiver:withArguments:"]
  49916. }),
  49917. $globals.ASTInterpreterTest);
  49918. $core.addClass("ASTDebuggerTest", $globals.ASTInterpreterTest, [], "Compiler-Tests");
  49919. $core.addMethod(
  49920. $core.method({
  49921. selector: "interpret:receiver:withArguments:",
  49922. protocol: "private",
  49923. fn: function (aString,anObject,aDictionary){
  49924. var self=this,$self=this;
  49925. var ctx,ast,debugger_;
  49926. return $core.withContext(function($ctx1) {
  49927. var $1,$2,$3,$4,$5,$receiver;
  49928. $1=$recv($globals.AIContext)._new();
  49929. $ctx1.sendIdx["new"]=1;
  49930. $recv($1)._receiver_(anObject);
  49931. $recv($1)._interpreter_($recv($globals.ASTInterpreter)._new());
  49932. ctx=$recv($1)._yourself();
  49933. ast=$self._parse_forClass_(aString,$recv(anObject)._class());
  49934. $2=$recv(ast)._sequenceNode();
  49935. if(($receiver = $2) == null || $receiver.a$nil){
  49936. $2;
  49937. } else {
  49938. var sequence;
  49939. sequence=$receiver;
  49940. $recv($recv(sequence)._temps())._do_((function(each){
  49941. return $core.withContext(function($ctx2) {
  49942. return $recv(ctx)._defineLocal_(each);
  49943. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  49944. }));
  49945. }
  49946. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  49947. return $core.withContext(function($ctx2) {
  49948. return $recv(ctx)._localAt_put_(key,value);
  49949. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  49950. }));
  49951. $3=$recv(ctx)._interpreter();
  49952. $ctx1.sendIdx["interpreter"]=1;
  49953. $recv($3)._context_(ctx);
  49954. $ctx1.sendIdx["context:"]=1;
  49955. $4=$recv(ctx)._interpreter();
  49956. $recv($4)._node_(ast);
  49957. $recv($4)._enterNode();
  49958. debugger_=$recv($globals.ASTDebugger)._context_(ctx);
  49959. $5=debugger_;
  49960. $recv($5)._proceed();
  49961. return $recv($5)._result();
  49962. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,debugger_:debugger_},$globals.ASTDebuggerTest)});
  49963. },
  49964. args: ["aString", "anObject", "aDictionary"],
  49965. source: "interpret: aString receiver: anObject withArguments: aDictionary\x0a\x09| ctx ast debugger |\x0a\x09\x0a\x09ctx := AIContext new\x0a\x09\x09receiver: anObject;\x0a\x09\x09interpreter: ASTInterpreter new;\x0a\x09\x09yourself.\x0a\x09ast := self parse: aString forClass: anObject class.\x0a\x09\x09\x0a\x09\x22Define locals for the context\x22\x0a\x09ast sequenceNode ifNotNil: [ :sequence |\x0a\x09\x09sequence temps do: [ :each |\x0a\x09\x09\x09ctx defineLocal: each ] ].\x0a\x09\x0a\x09aDictionary keysAndValuesDo: [ :key :value |\x0a\x09\x09ctx localAt: key put: value ].\x0a\x09ctx interpreter context: ctx.\x0a\x09\x0a\x09ctx interpreter node: ast; enterNode.\x0a\x09\x0a\x09debugger := ASTDebugger context: ctx.\x0a\x09\x0a\x09^ debugger \x0a\x09\x09proceed; \x0a\x09\x09result",
  49966. referencedClasses: ["AIContext", "ASTInterpreter", "ASTDebugger"],
  49967. messageSends: ["receiver:", "new", "interpreter:", "yourself", "parse:forClass:", "class", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpreter", "node:", "enterNode", "proceed", "result"]
  49968. }),
  49969. $globals.ASTDebuggerTest);
  49970. $core.addClass("InliningCodeGeneratorTest", $globals.CodeGeneratorTest, [], "Compiler-Tests");
  49971. $core.addMethod(
  49972. $core.method({
  49973. selector: "codeGeneratorClass",
  49974. protocol: "accessing",
  49975. fn: function (){
  49976. var self=this,$self=this;
  49977. return $globals.InliningCodeGenerator;
  49978. },
  49979. args: [],
  49980. source: "codeGeneratorClass\x0a\x09^ InliningCodeGenerator",
  49981. referencedClasses: ["InliningCodeGenerator"],
  49982. messageSends: []
  49983. }),
  49984. $globals.InliningCodeGeneratorTest);
  49985. $core.addClass("ScopeVarTest", $globals.TestCase, [], "Compiler-Tests");
  49986. $core.addMethod(
  49987. $core.method({
  49988. selector: "testClassRefVar",
  49989. protocol: "tests",
  49990. fn: function (){
  49991. var self=this,$self=this;
  49992. var node;
  49993. return $core.withContext(function($ctx1) {
  49994. var $1,$2;
  49995. $1=$recv($globals.VariableNode)._new();
  49996. $ctx1.sendIdx["new"]=1;
  49997. $recv($1)._value_("Object");
  49998. node=$recv($1)._yourself();
  49999. $2=$recv($globals.SemanticAnalyzer)._new();
  50000. $ctx1.sendIdx["new"]=2;
  50001. $recv($2)._pushScope_($recv($globals.MethodLexicalScope)._new());
  50002. $recv($2)._visit_(node);
  50003. $self._assert_($recv($recv(node)._binding())._isClassRefVar());
  50004. return self;
  50005. }, function($ctx1) {$ctx1.fill(self,"testClassRefVar",{node:node},$globals.ScopeVarTest)});
  50006. },
  50007. args: [],
  50008. 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",
  50009. referencedClasses: ["VariableNode", "SemanticAnalyzer", "MethodLexicalScope"],
  50010. messageSends: ["value:", "new", "yourself", "pushScope:", "visit:", "assert:", "isClassRefVar", "binding"]
  50011. }),
  50012. $globals.ScopeVarTest);
  50013. $core.addMethod(
  50014. $core.method({
  50015. selector: "testInstanceVar",
  50016. protocol: "tests",
  50017. fn: function (){
  50018. var self=this,$self=this;
  50019. var node,scope;
  50020. return $core.withContext(function($ctx1) {
  50021. var $1;
  50022. $1=$recv($globals.VariableNode)._new();
  50023. $ctx1.sendIdx["new"]=1;
  50024. $recv($1)._value_("bzzz");
  50025. node=$recv($1)._yourself();
  50026. scope=$recv($globals.MethodLexicalScope)._new();
  50027. $recv(scope)._addIVar_("bzzz");
  50028. $self._assert_($recv($recv(scope)._bindingFor_(node))._isInstanceVar());
  50029. return self;
  50030. }, function($ctx1) {$ctx1.fill(self,"testInstanceVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  50031. },
  50032. args: [],
  50033. 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",
  50034. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  50035. messageSends: ["value:", "new", "yourself", "addIVar:", "assert:", "isInstanceVar", "bindingFor:"]
  50036. }),
  50037. $globals.ScopeVarTest);
  50038. $core.addMethod(
  50039. $core.method({
  50040. selector: "testPseudoVar",
  50041. protocol: "tests",
  50042. fn: function (){
  50043. var self=this,$self=this;
  50044. var node,pseudoVars;
  50045. return $core.withContext(function($ctx1) {
  50046. var $1;
  50047. pseudoVars=["self", "super", "true", "false", "nil"];
  50048. $recv(pseudoVars)._do_((function(each){
  50049. return $core.withContext(function($ctx2) {
  50050. $1=$recv($globals.VariableNode)._new();
  50051. $ctx2.sendIdx["new"]=1;
  50052. $recv($1)._value_(each);
  50053. node=$recv($1)._yourself();
  50054. return $self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isPseudoVar());
  50055. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50056. }));
  50057. return self;
  50058. }, function($ctx1) {$ctx1.fill(self,"testPseudoVar",{node:node,pseudoVars:pseudoVars},$globals.ScopeVarTest)});
  50059. },
  50060. args: [],
  50061. 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]",
  50062. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  50063. messageSends: ["do:", "value:", "new", "yourself", "assert:", "isPseudoVar", "bindingFor:"]
  50064. }),
  50065. $globals.ScopeVarTest);
  50066. $core.addMethod(
  50067. $core.method({
  50068. selector: "testTempVar",
  50069. protocol: "tests",
  50070. fn: function (){
  50071. var self=this,$self=this;
  50072. var node,scope;
  50073. return $core.withContext(function($ctx1) {
  50074. var $1;
  50075. $1=$recv($globals.VariableNode)._new();
  50076. $ctx1.sendIdx["new"]=1;
  50077. $recv($1)._value_("bzzz");
  50078. node=$recv($1)._yourself();
  50079. scope=$recv($globals.MethodLexicalScope)._new();
  50080. $recv(scope)._addTemp_("bzzz");
  50081. $self._assert_($recv($recv(scope)._bindingFor_(node))._isTempVar());
  50082. return self;
  50083. }, function($ctx1) {$ctx1.fill(self,"testTempVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  50084. },
  50085. args: [],
  50086. 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",
  50087. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  50088. messageSends: ["value:", "new", "yourself", "addTemp:", "assert:", "isTempVar", "bindingFor:"]
  50089. }),
  50090. $globals.ScopeVarTest);
  50091. $core.addMethod(
  50092. $core.method({
  50093. selector: "testUnknownVar",
  50094. protocol: "tests",
  50095. fn: function (){
  50096. var self=this,$self=this;
  50097. var node;
  50098. return $core.withContext(function($ctx1) {
  50099. var $1;
  50100. $1=$recv($globals.VariableNode)._new();
  50101. $ctx1.sendIdx["new"]=1;
  50102. $recv($1)._value_("bzzz");
  50103. node=$recv($1)._yourself();
  50104. $self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isNil());
  50105. return self;
  50106. }, function($ctx1) {$ctx1.fill(self,"testUnknownVar",{node:node},$globals.ScopeVarTest)});
  50107. },
  50108. args: [],
  50109. source: "testUnknownVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09self assert: (MethodLexicalScope new bindingFor: node) isNil",
  50110. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  50111. messageSends: ["value:", "new", "yourself", "assert:", "isNil", "bindingFor:"]
  50112. }),
  50113. $globals.ScopeVarTest);
  50114. $core.addClass("SemanticAnalyzerTest", $globals.TestCase, ["analyzer"], "Compiler-Tests");
  50115. $core.addMethod(
  50116. $core.method({
  50117. selector: "setUp",
  50118. protocol: "running",
  50119. fn: function (){
  50120. var self=this,$self=this;
  50121. return $core.withContext(function($ctx1) {
  50122. $self["@analyzer"]=$recv($globals.SemanticAnalyzer)._on_($globals.Object);
  50123. return self;
  50124. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.SemanticAnalyzerTest)});
  50125. },
  50126. args: [],
  50127. source: "setUp\x0a\x09analyzer := SemanticAnalyzer on: Object",
  50128. referencedClasses: ["SemanticAnalyzer", "Object"],
  50129. messageSends: ["on:"]
  50130. }),
  50131. $globals.SemanticAnalyzerTest);
  50132. $core.addMethod(
  50133. $core.method({
  50134. selector: "testAssignment",
  50135. protocol: "tests",
  50136. fn: function (){
  50137. var self=this,$self=this;
  50138. var src,ast;
  50139. return $core.withContext(function($ctx1) {
  50140. src="foo self := 1";
  50141. ast=$recv($globals.Smalltalk)._parse_(src);
  50142. $self._should_raise_((function(){
  50143. return $core.withContext(function($ctx2) {
  50144. return $recv($self["@analyzer"])._visit_(ast);
  50145. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50146. }),$globals.InvalidAssignmentError);
  50147. return self;
  50148. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50149. },
  50150. args: [],
  50151. 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",
  50152. referencedClasses: ["Smalltalk", "InvalidAssignmentError"],
  50153. messageSends: ["parse:", "should:raise:", "visit:"]
  50154. }),
  50155. $globals.SemanticAnalyzerTest);
  50156. $core.addMethod(
  50157. $core.method({
  50158. selector: "testNonLocalReturn",
  50159. protocol: "tests",
  50160. fn: function (){
  50161. var self=this,$self=this;
  50162. var src,ast;
  50163. return $core.withContext(function($ctx1) {
  50164. src="foo | a | a + 1. ^ a";
  50165. ast=$recv($globals.Smalltalk)._parse_(src);
  50166. $recv($self["@analyzer"])._visit_(ast);
  50167. $self._deny_($recv($recv(ast)._scope())._hasNonLocalReturn());
  50168. return self;
  50169. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50170. },
  50171. args: [],
  50172. 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",
  50173. referencedClasses: ["Smalltalk"],
  50174. messageSends: ["parse:", "visit:", "deny:", "hasNonLocalReturn", "scope"]
  50175. }),
  50176. $globals.SemanticAnalyzerTest);
  50177. $core.addMethod(
  50178. $core.method({
  50179. selector: "testNonLocalReturn2",
  50180. protocol: "tests",
  50181. fn: function (){
  50182. var self=this,$self=this;
  50183. var src,ast;
  50184. return $core.withContext(function($ctx1) {
  50185. src="foo | a | a + 1. [ [ ^ a] ]";
  50186. ast=$recv($globals.Smalltalk)._parse_(src);
  50187. $recv($self["@analyzer"])._visit_(ast);
  50188. $self._assert_($recv($recv(ast)._scope())._hasNonLocalReturn());
  50189. return self;
  50190. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50191. },
  50192. args: [],
  50193. 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",
  50194. referencedClasses: ["Smalltalk"],
  50195. messageSends: ["parse:", "visit:", "assert:", "hasNonLocalReturn", "scope"]
  50196. }),
  50197. $globals.SemanticAnalyzerTest);
  50198. $core.addMethod(
  50199. $core.method({
  50200. selector: "testScope",
  50201. protocol: "tests",
  50202. fn: function (){
  50203. var self=this,$self=this;
  50204. var src,ast;
  50205. return $core.withContext(function($ctx1) {
  50206. var $4,$3,$2,$1;
  50207. src="foo | a | a + 1. [ | b | b := a ]";
  50208. ast=$recv($globals.Smalltalk)._parse_(src);
  50209. $recv($self["@analyzer"])._visit_(ast);
  50210. $4=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  50211. $ctx1.sendIdx["dagChildren"]=1;
  50212. $3=$recv($4)._last();
  50213. $2=$recv($3)._scope();
  50214. $ctx1.sendIdx["scope"]=1;
  50215. $1=$recv($2).__eq_eq($recv(ast)._scope());
  50216. $self._deny_($1);
  50217. return self;
  50218. }, function($ctx1) {$ctx1.fill(self,"testScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50219. },
  50220. args: [],
  50221. 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.",
  50222. referencedClasses: ["Smalltalk"],
  50223. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "last", "dagChildren", "first"]
  50224. }),
  50225. $globals.SemanticAnalyzerTest);
  50226. $core.addMethod(
  50227. $core.method({
  50228. selector: "testScope2",
  50229. protocol: "tests",
  50230. fn: function (){
  50231. var self=this,$self=this;
  50232. var src,ast;
  50233. return $core.withContext(function($ctx1) {
  50234. var $8,$7,$6,$5,$4,$3,$2,$1;
  50235. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  50236. ast=$recv($globals.Smalltalk)._parse_(src);
  50237. $recv($self["@analyzer"])._visit_(ast);
  50238. $8=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  50239. $ctx1.sendIdx["dagChildren"]=3;
  50240. $7=$recv($8)._last();
  50241. $6=$recv($7)._dagChildren();
  50242. $ctx1.sendIdx["dagChildren"]=2;
  50243. $5=$recv($6)._first();
  50244. $ctx1.sendIdx["first"]=2;
  50245. $4=$recv($5)._dagChildren();
  50246. $ctx1.sendIdx["dagChildren"]=1;
  50247. $3=$recv($4)._first();
  50248. $ctx1.sendIdx["first"]=1;
  50249. $2=$recv($3)._scope();
  50250. $ctx1.sendIdx["scope"]=1;
  50251. $1=$recv($2).__eq_eq($recv(ast)._scope());
  50252. $self._deny_($1);
  50253. return self;
  50254. }, function($ctx1) {$ctx1.fill(self,"testScope2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50255. },
  50256. args: [],
  50257. 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.",
  50258. referencedClasses: ["Smalltalk"],
  50259. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "first", "dagChildren", "last"]
  50260. }),
  50261. $globals.SemanticAnalyzerTest);
  50262. $core.addMethod(
  50263. $core.method({
  50264. selector: "testScopeLevel",
  50265. protocol: "tests",
  50266. fn: function (){
  50267. var self=this,$self=this;
  50268. var src,ast;
  50269. return $core.withContext(function($ctx1) {
  50270. var $2,$1,$10,$9,$8,$7,$6,$5,$4,$3;
  50271. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  50272. ast=$recv($globals.Smalltalk)._parse_(src);
  50273. $recv($self["@analyzer"])._visit_(ast);
  50274. $2=$recv(ast)._scope();
  50275. $ctx1.sendIdx["scope"]=1;
  50276. $1=$recv($2)._scopeLevel();
  50277. $ctx1.sendIdx["scopeLevel"]=1;
  50278. $self._assert_equals_($1,(1));
  50279. $ctx1.sendIdx["assert:equals:"]=1;
  50280. $10=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  50281. $ctx1.sendIdx["dagChildren"]=3;
  50282. $9=$recv($10)._last();
  50283. $8=$recv($9)._dagChildren();
  50284. $ctx1.sendIdx["dagChildren"]=2;
  50285. $7=$recv($8)._first();
  50286. $ctx1.sendIdx["first"]=2;
  50287. $6=$recv($7)._dagChildren();
  50288. $ctx1.sendIdx["dagChildren"]=1;
  50289. $5=$recv($6)._first();
  50290. $ctx1.sendIdx["first"]=1;
  50291. $4=$recv($5)._scope();
  50292. $3=$recv($4)._scopeLevel();
  50293. $self._assert_equals_($3,(3));
  50294. return self;
  50295. }, function($ctx1) {$ctx1.fill(self,"testScopeLevel",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50296. },
  50297. args: [],
  50298. 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",
  50299. referencedClasses: ["Smalltalk"],
  50300. messageSends: ["parse:", "visit:", "assert:equals:", "scopeLevel", "scope", "first", "dagChildren", "last"]
  50301. }),
  50302. $globals.SemanticAnalyzerTest);
  50303. $core.addMethod(
  50304. $core.method({
  50305. selector: "testUnknownVariables",
  50306. protocol: "tests",
  50307. fn: function (){
  50308. var self=this,$self=this;
  50309. var src,ast;
  50310. return $core.withContext(function($ctx1) {
  50311. src="foo | a | b + a";
  50312. ast=$recv($globals.Smalltalk)._parse_(src);
  50313. $self._should_raise_((function(){
  50314. return $core.withContext(function($ctx2) {
  50315. return $recv($self["@analyzer"])._visit_(ast);
  50316. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50317. }),$globals.UnknownVariableError);
  50318. return self;
  50319. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariables",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50320. },
  50321. args: [],
  50322. 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",
  50323. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  50324. messageSends: ["parse:", "should:raise:", "visit:"]
  50325. }),
  50326. $globals.SemanticAnalyzerTest);
  50327. $core.addMethod(
  50328. $core.method({
  50329. selector: "testUnknownVariablesWithScope",
  50330. protocol: "tests",
  50331. fn: function (){
  50332. var self=this,$self=this;
  50333. var src,ast;
  50334. return $core.withContext(function($ctx1) {
  50335. src="foo | a b | [ c + 1. [ a + 1. d + 1 ]]";
  50336. ast=$recv($globals.Smalltalk)._parse_(src);
  50337. $self._should_raise_((function(){
  50338. return $core.withContext(function($ctx2) {
  50339. return $recv($self["@analyzer"])._visit_(ast);
  50340. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50341. }),$globals.UnknownVariableError);
  50342. return self;
  50343. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariablesWithScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50344. },
  50345. args: [],
  50346. 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",
  50347. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  50348. messageSends: ["parse:", "should:raise:", "visit:"]
  50349. }),
  50350. $globals.SemanticAnalyzerTest);
  50351. $core.addMethod(
  50352. $core.method({
  50353. selector: "testVariableShadowing",
  50354. protocol: "tests",
  50355. fn: function (){
  50356. var self=this,$self=this;
  50357. var src,ast;
  50358. return $core.withContext(function($ctx1) {
  50359. src="foo | a | a + 1";
  50360. ast=$recv($globals.Smalltalk)._parse_(src);
  50361. $recv($self["@analyzer"])._visit_(ast);
  50362. return self;
  50363. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50364. },
  50365. args: [],
  50366. source: "testVariableShadowing\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  50367. referencedClasses: ["Smalltalk"],
  50368. messageSends: ["parse:", "visit:"]
  50369. }),
  50370. $globals.SemanticAnalyzerTest);
  50371. $core.addMethod(
  50372. $core.method({
  50373. selector: "testVariableShadowing2",
  50374. protocol: "tests",
  50375. fn: function (){
  50376. var self=this,$self=this;
  50377. var src,ast;
  50378. return $core.withContext(function($ctx1) {
  50379. src="foo | a | a + 1. [ | a | a := 2 ]";
  50380. ast=$recv($globals.Smalltalk)._parse_(src);
  50381. $self._should_raise_((function(){
  50382. return $core.withContext(function($ctx2) {
  50383. return $recv($self["@analyzer"])._visit_(ast);
  50384. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50385. }),$globals.ShadowingVariableError);
  50386. return self;
  50387. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50388. },
  50389. args: [],
  50390. 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",
  50391. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  50392. messageSends: ["parse:", "should:raise:", "visit:"]
  50393. }),
  50394. $globals.SemanticAnalyzerTest);
  50395. $core.addMethod(
  50396. $core.method({
  50397. selector: "testVariableShadowing3",
  50398. protocol: "tests",
  50399. fn: function (){
  50400. var self=this,$self=this;
  50401. var src,ast;
  50402. return $core.withContext(function($ctx1) {
  50403. src="foo | a | a + 1. [ | b | b := 2 ]";
  50404. ast=$recv($globals.Smalltalk)._parse_(src);
  50405. $recv($self["@analyzer"])._visit_(ast);
  50406. return self;
  50407. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing3",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50408. },
  50409. args: [],
  50410. source: "testVariableShadowing3\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | b | b := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  50411. referencedClasses: ["Smalltalk"],
  50412. messageSends: ["parse:", "visit:"]
  50413. }),
  50414. $globals.SemanticAnalyzerTest);
  50415. $core.addMethod(
  50416. $core.method({
  50417. selector: "testVariableShadowing4",
  50418. protocol: "tests",
  50419. fn: function (){
  50420. var self=this,$self=this;
  50421. var src,ast;
  50422. return $core.withContext(function($ctx1) {
  50423. src="foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]";
  50424. ast=$recv($globals.Smalltalk)._parse_(src);
  50425. $recv($self["@analyzer"])._visit_(ast);
  50426. return self;
  50427. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing4",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50428. },
  50429. args: [],
  50430. source: "testVariableShadowing4\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  50431. referencedClasses: ["Smalltalk"],
  50432. messageSends: ["parse:", "visit:"]
  50433. }),
  50434. $globals.SemanticAnalyzerTest);
  50435. $core.addMethod(
  50436. $core.method({
  50437. selector: "testVariableShadowing5",
  50438. protocol: "tests",
  50439. fn: function (){
  50440. var self=this,$self=this;
  50441. var src,ast;
  50442. return $core.withContext(function($ctx1) {
  50443. src="foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]";
  50444. ast=$recv($globals.Smalltalk)._parse_(src);
  50445. $self._should_raise_((function(){
  50446. return $core.withContext(function($ctx2) {
  50447. return $recv($self["@analyzer"])._visit_(ast);
  50448. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50449. }),$globals.ShadowingVariableError);
  50450. return self;
  50451. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing5",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50452. },
  50453. args: [],
  50454. 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",
  50455. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  50456. messageSends: ["parse:", "should:raise:", "visit:"]
  50457. }),
  50458. $globals.SemanticAnalyzerTest);
  50459. $core.addMethod(
  50460. $core.method({
  50461. selector: "testVariablesLookup",
  50462. protocol: "tests",
  50463. fn: function (){
  50464. var self=this,$self=this;
  50465. var src,ast;
  50466. return $core.withContext(function($ctx1) {
  50467. 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;
  50468. src="foo | a | a + 1. [ | b | b := a ]";
  50469. ast=$recv($globals.Smalltalk)._parse_(src);
  50470. $recv($self["@analyzer"])._visit_(ast);
  50471. $7=$recv(ast)._dagChildren();
  50472. $ctx1.sendIdx["dagChildren"]=2;
  50473. $6=$recv($7)._first();
  50474. $ctx1.sendIdx["first"]=2;
  50475. $5=$recv($6)._dagChildren();
  50476. $ctx1.sendIdx["dagChildren"]=1;
  50477. $4=$recv($5)._first();
  50478. $ctx1.sendIdx["first"]=1;
  50479. $3=$recv($4)._receiver();
  50480. $ctx1.sendIdx["receiver"]=1;
  50481. $2=$recv($3)._binding();
  50482. $ctx1.sendIdx["binding"]=1;
  50483. $1=$recv($2)._isTempVar();
  50484. $ctx1.sendIdx["isTempVar"]=1;
  50485. $self._assert_($1);
  50486. $ctx1.sendIdx["assert:"]=1;
  50487. $15=$recv(ast)._dagChildren();
  50488. $ctx1.sendIdx["dagChildren"]=4;
  50489. $14=$recv($15)._first();
  50490. $ctx1.sendIdx["first"]=4;
  50491. $13=$recv($14)._dagChildren();
  50492. $ctx1.sendIdx["dagChildren"]=3;
  50493. $12=$recv($13)._first();
  50494. $ctx1.sendIdx["first"]=3;
  50495. $11=$recv($12)._receiver();
  50496. $10=$recv($11)._binding();
  50497. $ctx1.sendIdx["binding"]=2;
  50498. $9=$recv($10)._scope();
  50499. $ctx1.sendIdx["scope"]=1;
  50500. $16=$recv(ast)._scope();
  50501. $ctx1.sendIdx["scope"]=2;
  50502. $8=$recv($9).__eq_eq($16);
  50503. $ctx1.sendIdx["=="]=1;
  50504. $self._assert_($8);
  50505. $ctx1.sendIdx["assert:"]=2;
  50506. $27=$recv(ast)._dagChildren();
  50507. $ctx1.sendIdx["dagChildren"]=8;
  50508. $26=$recv($27)._first();
  50509. $ctx1.sendIdx["first"]=7;
  50510. $25=$recv($26)._dagChildren();
  50511. $ctx1.sendIdx["dagChildren"]=7;
  50512. $24=$recv($25)._last();
  50513. $ctx1.sendIdx["last"]=1;
  50514. $23=$recv($24)._dagChildren();
  50515. $ctx1.sendIdx["dagChildren"]=6;
  50516. $22=$recv($23)._first();
  50517. $ctx1.sendIdx["first"]=6;
  50518. $21=$recv($22)._dagChildren();
  50519. $ctx1.sendIdx["dagChildren"]=5;
  50520. $20=$recv($21)._first();
  50521. $ctx1.sendIdx["first"]=5;
  50522. $19=$recv($20)._left();
  50523. $ctx1.sendIdx["left"]=1;
  50524. $18=$recv($19)._binding();
  50525. $ctx1.sendIdx["binding"]=3;
  50526. $17=$recv($18)._isTempVar();
  50527. $self._assert_($17);
  50528. $ctx1.sendIdx["assert:"]=3;
  50529. $39=$recv(ast)._dagChildren();
  50530. $ctx1.sendIdx["dagChildren"]=12;
  50531. $38=$recv($39)._first();
  50532. $ctx1.sendIdx["first"]=10;
  50533. $37=$recv($38)._dagChildren();
  50534. $ctx1.sendIdx["dagChildren"]=11;
  50535. $36=$recv($37)._last();
  50536. $ctx1.sendIdx["last"]=2;
  50537. $35=$recv($36)._dagChildren();
  50538. $ctx1.sendIdx["dagChildren"]=10;
  50539. $34=$recv($35)._first();
  50540. $ctx1.sendIdx["first"]=9;
  50541. $33=$recv($34)._dagChildren();
  50542. $ctx1.sendIdx["dagChildren"]=9;
  50543. $32=$recv($33)._first();
  50544. $ctx1.sendIdx["first"]=8;
  50545. $31=$recv($32)._left();
  50546. $30=$recv($31)._binding();
  50547. $29=$recv($30)._scope();
  50548. $ctx1.sendIdx["scope"]=3;
  50549. $42=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  50550. $ctx1.sendIdx["dagChildren"]=13;
  50551. $41=$recv($42)._last();
  50552. $40=$recv($41)._scope();
  50553. $28=$recv($29).__eq_eq($40);
  50554. $self._assert_($28);
  50555. return self;
  50556. }, function($ctx1) {$ctx1.fill(self,"testVariablesLookup",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50557. },
  50558. args: [],
  50559. 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.",
  50560. referencedClasses: ["Smalltalk"],
  50561. messageSends: ["parse:", "visit:", "assert:", "isTempVar", "binding", "receiver", "first", "dagChildren", "==", "scope", "left", "last"]
  50562. }),
  50563. $globals.SemanticAnalyzerTest);
  50564. $core.addClass("AISemanticAnalyzerTest", $globals.SemanticAnalyzerTest, [], "Compiler-Tests");
  50565. $core.addMethod(
  50566. $core.method({
  50567. selector: "setUp",
  50568. protocol: "running",
  50569. fn: function (){
  50570. var self=this,$self=this;
  50571. return $core.withContext(function($ctx1) {
  50572. var $1,$3,$4,$2;
  50573. $1=$recv($globals.AISemanticAnalyzer)._on_($globals.Object);
  50574. $3=$recv($globals.AIContext)._new();
  50575. $recv($3)._defineLocal_("local");
  50576. $recv($3)._localAt_put_("local",(3));
  50577. $4=$recv($3)._yourself();
  50578. $ctx1.sendIdx["yourself"]=1;
  50579. $2=$4;
  50580. $recv($1)._context_($2);
  50581. $self["@analyzer"]=$recv($1)._yourself();
  50582. return self;
  50583. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.AISemanticAnalyzerTest)});
  50584. },
  50585. args: [],
  50586. 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",
  50587. referencedClasses: ["AISemanticAnalyzer", "Object", "AIContext"],
  50588. messageSends: ["context:", "on:", "defineLocal:", "new", "localAt:put:", "yourself"]
  50589. }),
  50590. $globals.AISemanticAnalyzerTest);
  50591. $core.addMethod(
  50592. $core.method({
  50593. selector: "testContextVariables",
  50594. protocol: "tests",
  50595. fn: function (){
  50596. var self=this,$self=this;
  50597. var src,ast;
  50598. return $core.withContext(function($ctx1) {
  50599. src="foo | a | local + a";
  50600. ast=$recv($globals.Smalltalk)._parse_(src);
  50601. $self._shouldnt_raise_((function(){
  50602. return $core.withContext(function($ctx2) {
  50603. return $recv($self["@analyzer"])._visit_(ast);
  50604. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50605. }),$globals.UnknownVariableError);
  50606. return self;
  50607. }, function($ctx1) {$ctx1.fill(self,"testContextVariables",{src:src,ast:ast},$globals.AISemanticAnalyzerTest)});
  50608. },
  50609. args: [],
  50610. 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",
  50611. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  50612. messageSends: ["parse:", "shouldnt:raise:", "visit:"]
  50613. }),
  50614. $globals.AISemanticAnalyzerTest);
  50615. });
  50616. define('amber_core/Kernel-Tests',["amber/boot", "amber_core/Kernel-Objects", "amber_core/SUnit"], function($boot){"use strict";
  50617. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  50618. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  50619. var $pkg = $core.addPackage("Kernel-Tests");
  50620. $pkg.innerEval = function (expr) { return eval(expr); };
  50621. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  50622. $core.addClass("AnnouncementSubscriptionTest", $globals.TestCase, [], "Kernel-Tests");
  50623. $core.addMethod(
  50624. $core.method({
  50625. selector: "testAddExtensionMethod",
  50626. protocol: "tests",
  50627. fn: function (){
  50628. var self=this,$self=this;
  50629. var method,dirty;
  50630. return $core.withContext(function($ctx1) {
  50631. var $2,$1,$4,$3,$5,$8,$7,$6,$9,$10;
  50632. $2=$self._class();
  50633. $ctx1.sendIdx["class"]=1;
  50634. $1=$recv($2)._package();
  50635. $ctx1.sendIdx["package"]=1;
  50636. dirty=$recv($1)._isDirty();
  50637. $ctx1.sendIdx["isDirty"]=1;
  50638. $4=$self._class();
  50639. $ctx1.sendIdx["class"]=2;
  50640. $3=$recv($4)._package();
  50641. $ctx1.sendIdx["package"]=2;
  50642. $recv($3)._beClean();
  50643. $5=$self._class();
  50644. $ctx1.sendIdx["class"]=3;
  50645. method=$recv($5)._compile_protocol_("doNothing","**not-a-package");
  50646. $8=$self._class();
  50647. $ctx1.sendIdx["class"]=4;
  50648. $7=$recv($8)._package();
  50649. $ctx1.sendIdx["package"]=3;
  50650. $6=$recv($7)._isDirty();
  50651. $self._deny_($6);
  50652. $9=$self._class();
  50653. $ctx1.sendIdx["class"]=5;
  50654. $recv($9)._removeCompiledMethod_(method);
  50655. $10=dirty;
  50656. if($core.assert($10)){
  50657. $recv($recv($self._class())._package())._beDirty();
  50658. }
  50659. return self;
  50660. }, function($ctx1) {$ctx1.fill(self,"testAddExtensionMethod",{method:method,dirty:dirty},$globals.AnnouncementSubscriptionTest)});
  50661. },
  50662. args: [],
  50663. 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 ]",
  50664. referencedClasses: [],
  50665. messageSends: ["isDirty", "package", "class", "beClean", "compile:protocol:", "deny:", "removeCompiledMethod:", "ifTrue:", "beDirty"]
  50666. }),
  50667. $globals.AnnouncementSubscriptionTest);
  50668. $core.addMethod(
  50669. $core.method({
  50670. selector: "testHandlesAnnouncement",
  50671. protocol: "tests",
  50672. fn: function (){
  50673. var self=this,$self=this;
  50674. var subscription,announcementClass1,announcementClass2,classBuilder;
  50675. return $core.withContext(function($ctx1) {
  50676. var $1,$3,$4,$2,$6,$7,$5;
  50677. classBuilder=$recv($globals.ClassBuilder)._new();
  50678. $ctx1.sendIdx["new"]=1;
  50679. announcementClass1=$recv(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($globals.SystemAnnouncement,"TestAnnouncement1",[],"Kernel-Tests");
  50680. $1=$recv($globals.AnnouncementSubscription)._new();
  50681. $ctx1.sendIdx["new"]=2;
  50682. subscription=$recv($1)._announcementClass_($globals.SystemAnnouncement);
  50683. $3=subscription;
  50684. $4=$recv($globals.SystemAnnouncement)._new();
  50685. $ctx1.sendIdx["new"]=3;
  50686. $2=$recv($3)._handlesAnnouncement_($4);
  50687. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  50688. $self._assert_equals_($2,true);
  50689. $ctx1.sendIdx["assert:equals:"]=1;
  50690. $6=subscription;
  50691. $7=$recv(announcementClass1)._new();
  50692. $ctx1.sendIdx["new"]=4;
  50693. $5=$recv($6)._handlesAnnouncement_($7);
  50694. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  50695. $self._assert_equals_($5,true);
  50696. $ctx1.sendIdx["assert:equals:"]=2;
  50697. $self._assert_equals_($recv(subscription)._handlesAnnouncement_($recv($globals.Object)._new()),false);
  50698. $recv(classBuilder)._basicRemoveClass_(announcementClass1);
  50699. return self;
  50700. }, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},$globals.AnnouncementSubscriptionTest)});
  50701. },
  50702. args: [],
  50703. 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.",
  50704. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"],
  50705. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"]
  50706. }),
  50707. $globals.AnnouncementSubscriptionTest);
  50708. $core.addClass("AnnouncerTest", $globals.TestCase, [], "Kernel-Tests");
  50709. $core.addMethod(
  50710. $core.method({
  50711. selector: "testOnDo",
  50712. protocol: "tests",
  50713. fn: function (){
  50714. var self=this,$self=this;
  50715. var counter,announcer;
  50716. return $core.withContext(function($ctx1) {
  50717. var $1,$2;
  50718. counter=(0);
  50719. announcer=$recv($globals.Announcer)._new();
  50720. $ctx1.sendIdx["new"]=1;
  50721. $recv(announcer)._on_do_($globals.SystemAnnouncement,(function(){
  50722. return $core.withContext(function($ctx2) {
  50723. counter=$recv(counter).__plus((1));
  50724. return counter;
  50725. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50726. }));
  50727. $1=announcer;
  50728. $2=$recv($globals.SystemAnnouncement)._new();
  50729. $ctx1.sendIdx["new"]=2;
  50730. $recv($1)._announce_($2);
  50731. $ctx1.sendIdx["announce:"]=1;
  50732. $self._assert_equals_(counter,(1));
  50733. $ctx1.sendIdx["assert:equals:"]=1;
  50734. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  50735. $self._assert_equals_(counter,(2));
  50736. return self;
  50737. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  50738. },
  50739. args: [],
  50740. 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.",
  50741. referencedClasses: ["Announcer", "SystemAnnouncement"],
  50742. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"]
  50743. }),
  50744. $globals.AnnouncerTest);
  50745. $core.addMethod(
  50746. $core.method({
  50747. selector: "testOnDoFor",
  50748. protocol: "tests",
  50749. fn: function (){
  50750. var self=this,$self=this;
  50751. var counter,announcer;
  50752. return $core.withContext(function($ctx1) {
  50753. var $1,$2,$3,$4;
  50754. counter=(0);
  50755. announcer=$recv($globals.Announcer)._new();
  50756. $ctx1.sendIdx["new"]=1;
  50757. $recv(announcer)._on_do_for_($globals.SystemAnnouncement,(function(){
  50758. return $core.withContext(function($ctx2) {
  50759. counter=$recv(counter).__plus((1));
  50760. return counter;
  50761. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50762. }),self);
  50763. $1=announcer;
  50764. $2=$recv($globals.SystemAnnouncement)._new();
  50765. $ctx1.sendIdx["new"]=2;
  50766. $recv($1)._announce_($2);
  50767. $ctx1.sendIdx["announce:"]=1;
  50768. $self._assert_equals_(counter,(1));
  50769. $ctx1.sendIdx["assert:equals:"]=1;
  50770. $3=announcer;
  50771. $4=$recv($globals.SystemAnnouncement)._new();
  50772. $ctx1.sendIdx["new"]=3;
  50773. $recv($3)._announce_($4);
  50774. $ctx1.sendIdx["announce:"]=2;
  50775. $self._assert_equals_(counter,(2));
  50776. $ctx1.sendIdx["assert:equals:"]=2;
  50777. $recv(announcer)._unsubscribe_(self);
  50778. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  50779. $self._assert_equals_(counter,(2));
  50780. return self;
  50781. }, function($ctx1) {$ctx1.fill(self,"testOnDoFor",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  50782. },
  50783. args: [],
  50784. 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.",
  50785. referencedClasses: ["Announcer", "SystemAnnouncement"],
  50786. messageSends: ["new", "on:do:for:", "+", "announce:", "assert:equals:", "unsubscribe:"]
  50787. }),
  50788. $globals.AnnouncerTest);
  50789. $core.addMethod(
  50790. $core.method({
  50791. selector: "testOnDoOnce",
  50792. protocol: "tests",
  50793. fn: function (){
  50794. var self=this,$self=this;
  50795. var counter,announcer;
  50796. return $core.withContext(function($ctx1) {
  50797. var $1,$2;
  50798. counter=(0);
  50799. announcer=$recv($globals.Announcer)._new();
  50800. $ctx1.sendIdx["new"]=1;
  50801. $recv(announcer)._on_doOnce_($globals.SystemAnnouncement,(function(){
  50802. return $core.withContext(function($ctx2) {
  50803. counter=$recv(counter).__plus((1));
  50804. return counter;
  50805. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50806. }));
  50807. $1=announcer;
  50808. $2=$recv($globals.SystemAnnouncement)._new();
  50809. $ctx1.sendIdx["new"]=2;
  50810. $recv($1)._announce_($2);
  50811. $ctx1.sendIdx["announce:"]=1;
  50812. $self._assert_equals_(counter,(1));
  50813. $ctx1.sendIdx["assert:equals:"]=1;
  50814. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  50815. $self._assert_equals_(counter,(1));
  50816. return self;
  50817. }, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  50818. },
  50819. args: [],
  50820. 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.",
  50821. referencedClasses: ["Announcer", "SystemAnnouncement"],
  50822. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"]
  50823. }),
  50824. $globals.AnnouncerTest);
  50825. $core.addClass("BlockClosureTest", $globals.TestCase, [], "Kernel-Tests");
  50826. $core.addMethod(
  50827. $core.method({
  50828. selector: "localReturnOnDoCatch",
  50829. protocol: "fixture",
  50830. fn: function (){
  50831. var self=this,$self=this;
  50832. return $core.withContext(function($ctx1) {
  50833. var $early={};
  50834. try {
  50835. $recv((function(){
  50836. throw $early=[(2)];
  50837. }))._on_do_($globals.Error,(function(){
  50838. }));
  50839. return (3);
  50840. }
  50841. catch(e) {if(e===$early)return e[0]; throw e}
  50842. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoCatch",{},$globals.BlockClosureTest)});
  50843. },
  50844. args: [],
  50845. source: "localReturnOnDoCatch\x0a [ ^ 2 ] on: Error do: [].\x0a ^ 3",
  50846. referencedClasses: ["Error"],
  50847. messageSends: ["on:do:"]
  50848. }),
  50849. $globals.BlockClosureTest);
  50850. $core.addMethod(
  50851. $core.method({
  50852. selector: "localReturnOnDoMiss",
  50853. protocol: "fixture",
  50854. fn: function (){
  50855. var self=this,$self=this;
  50856. return $core.withContext(function($ctx1) {
  50857. var $early={};
  50858. try {
  50859. $recv((function(){
  50860. throw $early=[(2)];
  50861. }))._on_do_($globals.Class,(function(){
  50862. }));
  50863. return (3);
  50864. }
  50865. catch(e) {if(e===$early)return e[0]; throw e}
  50866. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoMiss",{},$globals.BlockClosureTest)});
  50867. },
  50868. args: [],
  50869. source: "localReturnOnDoMiss\x0a [ ^ 2 ] on: Class do: [].\x0a ^ 3",
  50870. referencedClasses: ["Class"],
  50871. messageSends: ["on:do:"]
  50872. }),
  50873. $globals.BlockClosureTest);
  50874. $core.addMethod(
  50875. $core.method({
  50876. selector: "testCanClearInterval",
  50877. protocol: "tests",
  50878. fn: function (){
  50879. var self=this,$self=this;
  50880. return $core.withContext(function($ctx1) {
  50881. $self._shouldnt_raise_((function(){
  50882. return $core.withContext(function($ctx2) {
  50883. return $recv($recv((function(){
  50884. return $core.withContext(function($ctx3) {
  50885. return $recv($recv($globals.Error)._new())._signal();
  50886. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50887. }))._valueWithInterval_((0)))._clearInterval();
  50888. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50889. }),$globals.Error);
  50890. return self;
  50891. }, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},$globals.BlockClosureTest)});
  50892. },
  50893. args: [],
  50894. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  50895. referencedClasses: ["Error"],
  50896. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"]
  50897. }),
  50898. $globals.BlockClosureTest);
  50899. $core.addMethod(
  50900. $core.method({
  50901. selector: "testCanClearTimeout",
  50902. protocol: "tests",
  50903. fn: function (){
  50904. var self=this,$self=this;
  50905. return $core.withContext(function($ctx1) {
  50906. $self._shouldnt_raise_((function(){
  50907. return $core.withContext(function($ctx2) {
  50908. return $recv($recv((function(){
  50909. return $core.withContext(function($ctx3) {
  50910. return $recv($recv($globals.Error)._new())._signal();
  50911. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50912. }))._valueWithTimeout_((0)))._clearTimeout();
  50913. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50914. }),$globals.Error);
  50915. return self;
  50916. }, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},$globals.BlockClosureTest)});
  50917. },
  50918. args: [],
  50919. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  50920. referencedClasses: ["Error"],
  50921. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"]
  50922. }),
  50923. $globals.BlockClosureTest);
  50924. $core.addMethod(
  50925. $core.method({
  50926. selector: "testCompiledSource",
  50927. protocol: "tests",
  50928. fn: function (){
  50929. var self=this,$self=this;
  50930. return $core.withContext(function($ctx1) {
  50931. $self._assert_($recv($recv((function(){
  50932. return $core.withContext(function($ctx2) {
  50933. return (1).__plus((1));
  50934. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50935. }))._compiledSource())._includesSubString_("function"));
  50936. return self;
  50937. }, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},$globals.BlockClosureTest)});
  50938. },
  50939. args: [],
  50940. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  50941. referencedClasses: [],
  50942. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"]
  50943. }),
  50944. $globals.BlockClosureTest);
  50945. $core.addMethod(
  50946. $core.method({
  50947. selector: "testCurrySelf",
  50948. protocol: "tests",
  50949. fn: function (){
  50950. var self=this,$self=this;
  50951. var curriedMethod,array;
  50952. return $core.withContext(function($ctx1) {
  50953. curriedMethod=$recv($recv((function(selfarg,x){
  50954. return $core.withContext(function($ctx2) {
  50955. return $recv(selfarg)._at_(x);
  50956. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)});
  50957. }))._currySelf())._asCompiledMethod_("foo:");
  50958. array=[(3), (1), (4)];
  50959. $recv($recv($globals.ClassBuilder)._new())._installMethod_forClass_protocol_(curriedMethod,$globals.Array,"**test helper");
  50960. $recv((function(){
  50961. return $core.withContext(function($ctx2) {
  50962. return $self._assert_equals_($recv(array)._foo_((2)),(1));
  50963. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  50964. }))._ensure_((function(){
  50965. return $core.withContext(function($ctx2) {
  50966. return $recv($globals.Array)._removeCompiledMethod_(curriedMethod);
  50967. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  50968. }));
  50969. return self;
  50970. }, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},$globals.BlockClosureTest)});
  50971. },
  50972. args: [],
  50973. source: "testCurrySelf\x0a\x09| curriedMethod array |\x0a\x09curriedMethod := [ :selfarg :x | selfarg at: x ] currySelf asCompiledMethod: 'foo:'.\x0a\x09array := #(3 1 4).\x0a\x09ClassBuilder new installMethod: curriedMethod forClass: Array protocol: '**test helper'.\x0a\x09[ self assert: (array foo: 2) equals: 1 ]\x0a\x09ensure: [ Array removeCompiledMethod: curriedMethod ]",
  50974. referencedClasses: ["ClassBuilder", "Array"],
  50975. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"]
  50976. }),
  50977. $globals.BlockClosureTest);
  50978. $core.addMethod(
  50979. $core.method({
  50980. selector: "testEnsure",
  50981. protocol: "tests",
  50982. fn: function (){
  50983. var self=this,$self=this;
  50984. return $core.withContext(function($ctx1) {
  50985. $self._assert_equals_($recv((function(){
  50986. return (3);
  50987. }))._ensure_((function(){
  50988. return (4);
  50989. })),(3));
  50990. return self;
  50991. }, function($ctx1) {$ctx1.fill(self,"testEnsure",{},$globals.BlockClosureTest)});
  50992. },
  50993. args: [],
  50994. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  50995. referencedClasses: [],
  50996. messageSends: ["assert:equals:", "ensure:"]
  50997. }),
  50998. $globals.BlockClosureTest);
  50999. $core.addMethod(
  51000. $core.method({
  51001. selector: "testEnsureRaises",
  51002. protocol: "tests",
  51003. fn: function (){
  51004. var self=this,$self=this;
  51005. return $core.withContext(function($ctx1) {
  51006. $self._should_raise_((function(){
  51007. return $core.withContext(function($ctx2) {
  51008. return $recv((function(){
  51009. return $core.withContext(function($ctx3) {
  51010. return $recv($recv($globals.Error)._new())._signal();
  51011. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  51012. }))._ensure_((function(){
  51013. return true;
  51014. }));
  51015. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51016. }),$globals.Error);
  51017. return self;
  51018. }, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},$globals.BlockClosureTest)});
  51019. },
  51020. args: [],
  51021. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  51022. referencedClasses: ["Error"],
  51023. messageSends: ["should:raise:", "ensure:", "signal", "new"]
  51024. }),
  51025. $globals.BlockClosureTest);
  51026. $core.addMethod(
  51027. $core.method({
  51028. selector: "testExceptionSemantics",
  51029. protocol: "tests",
  51030. fn: function (){
  51031. var self=this,$self=this;
  51032. return $core.withContext(function($ctx1) {
  51033. $self._timeout_((100));
  51034. $recv($self._async_((function(){
  51035. return $core.withContext(function($ctx2) {
  51036. return $recv((function(){
  51037. return $core.withContext(function($ctx3) {
  51038. $self._assert_(true);
  51039. $recv($globals.Error)._signal();
  51040. $self._deny_(true);
  51041. return $self._finished();
  51042. $ctx3.sendIdx["finished"]=1;
  51043. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  51044. }))._on_do_($globals.Error,(function(ex){
  51045. return $core.withContext(function($ctx3) {
  51046. return $self._finished();
  51047. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  51048. }));
  51049. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51050. })))._valueWithTimeout_((0));
  51051. return self;
  51052. }, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},$globals.BlockClosureTest)});
  51053. },
  51054. args: [],
  51055. 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",
  51056. referencedClasses: ["Error"],
  51057. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"]
  51058. }),
  51059. $globals.BlockClosureTest);
  51060. $core.addMethod(
  51061. $core.method({
  51062. selector: "testLocalReturnOnDoCatch",
  51063. protocol: "tests",
  51064. fn: function (){
  51065. var self=this,$self=this;
  51066. return $core.withContext(function($ctx1) {
  51067. $self._assert_equals_($self._localReturnOnDoCatch(),(2));
  51068. return self;
  51069. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoCatch",{},$globals.BlockClosureTest)});
  51070. },
  51071. args: [],
  51072. source: "testLocalReturnOnDoCatch\x0a\x09self assert: self localReturnOnDoCatch equals: 2",
  51073. referencedClasses: [],
  51074. messageSends: ["assert:equals:", "localReturnOnDoCatch"]
  51075. }),
  51076. $globals.BlockClosureTest);
  51077. $core.addMethod(
  51078. $core.method({
  51079. selector: "testLocalReturnOnDoMiss",
  51080. protocol: "tests",
  51081. fn: function (){
  51082. var self=this,$self=this;
  51083. return $core.withContext(function($ctx1) {
  51084. $self._assert_equals_($self._localReturnOnDoMiss(),(2));
  51085. return self;
  51086. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoMiss",{},$globals.BlockClosureTest)});
  51087. },
  51088. args: [],
  51089. source: "testLocalReturnOnDoMiss\x0a\x09self assert: self localReturnOnDoMiss equals: 2",
  51090. referencedClasses: [],
  51091. messageSends: ["assert:equals:", "localReturnOnDoMiss"]
  51092. }),
  51093. $globals.BlockClosureTest);
  51094. $core.addMethod(
  51095. $core.method({
  51096. selector: "testNewWithValues",
  51097. protocol: "tests",
  51098. fn: function (){
  51099. var self=this,$self=this;
  51100. return $core.withContext(function($ctx1) {
  51101. function TestConstructor(arg1, arg2, arg3) {}
  51102. TestConstructor.prototype.name = "theTestPrototype";
  51103. var wrappedConstructor = $recv(TestConstructor);
  51104. var result = wrappedConstructor._newWithValues_([1, 2, 3]);
  51105. $self._assert_(result instanceof TestConstructor);
  51106. $self._assert_equals_(result.name, "theTestPrototype");
  51107. /* newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made. */
  51108. $self._should_raise_(function () {wrappedConstructor._newWithValues_("single argument");}, $globals.Error);;
  51109. return self;
  51110. }, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},$globals.BlockClosureTest)});
  51111. },
  51112. args: [],
  51113. 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'>",
  51114. referencedClasses: [],
  51115. messageSends: []
  51116. }),
  51117. $globals.BlockClosureTest);
  51118. $core.addMethod(
  51119. $core.method({
  51120. selector: "testNumArgs",
  51121. protocol: "tests",
  51122. fn: function (){
  51123. var self=this,$self=this;
  51124. return $core.withContext(function($ctx1) {
  51125. var $1;
  51126. $1=$recv((function(){
  51127. }))._numArgs();
  51128. $ctx1.sendIdx["numArgs"]=1;
  51129. $self._assert_equals_($1,(0));
  51130. $ctx1.sendIdx["assert:equals:"]=1;
  51131. $self._assert_equals_($recv((function(a,b){
  51132. }))._numArgs(),(2));
  51133. return self;
  51134. }, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},$globals.BlockClosureTest)});
  51135. },
  51136. args: [],
  51137. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  51138. referencedClasses: [],
  51139. messageSends: ["assert:equals:", "numArgs"]
  51140. }),
  51141. $globals.BlockClosureTest);
  51142. $core.addMethod(
  51143. $core.method({
  51144. selector: "testOnDo",
  51145. protocol: "tests",
  51146. fn: function (){
  51147. var self=this,$self=this;
  51148. return $core.withContext(function($ctx1) {
  51149. $self._assert_($recv((function(){
  51150. return $core.withContext(function($ctx2) {
  51151. return $recv($recv($globals.Error)._new())._signal();
  51152. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51153. }))._on_do_($globals.Error,(function(ex){
  51154. return true;
  51155. })));
  51156. return self;
  51157. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{},$globals.BlockClosureTest)});
  51158. },
  51159. args: [],
  51160. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  51161. referencedClasses: ["Error"],
  51162. messageSends: ["assert:", "on:do:", "signal", "new"]
  51163. }),
  51164. $globals.BlockClosureTest);
  51165. $core.addMethod(
  51166. $core.method({
  51167. selector: "testValue",
  51168. protocol: "tests",
  51169. fn: function (){
  51170. var self=this,$self=this;
  51171. return $core.withContext(function($ctx1) {
  51172. var $1;
  51173. $1=$recv((function(){
  51174. return $core.withContext(function($ctx2) {
  51175. return (1).__plus((1));
  51176. $ctx2.sendIdx["+"]=1;
  51177. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51178. }))._value();
  51179. $ctx1.sendIdx["value"]=1;
  51180. $self._assert_equals_($1,(2));
  51181. $ctx1.sendIdx["assert:equals:"]=1;
  51182. $self._assert_equals_($recv((function(x){
  51183. return $core.withContext(function($ctx2) {
  51184. return $recv(x).__plus((1));
  51185. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  51186. }))._value_((2)),(3));
  51187. $ctx1.sendIdx["assert:equals:"]=2;
  51188. $self._assert_equals_($recv((function(x,y){
  51189. return $core.withContext(function($ctx2) {
  51190. return $recv(x).__star(y);
  51191. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)});
  51192. }))._value_value_((2),(4)),(8));
  51193. $ctx1.sendIdx["assert:equals:"]=3;
  51194. $self._assert_equals_($recv((function(a,b,c){
  51195. return (1);
  51196. }))._value(),(1));
  51197. return self;
  51198. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.BlockClosureTest)});
  51199. },
  51200. args: [],
  51201. 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",
  51202. referencedClasses: [],
  51203. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"]
  51204. }),
  51205. $globals.BlockClosureTest);
  51206. $core.addMethod(
  51207. $core.method({
  51208. selector: "testValueWithPossibleArguments",
  51209. protocol: "tests",
  51210. fn: function (){
  51211. var self=this,$self=this;
  51212. return $core.withContext(function($ctx1) {
  51213. var $1,$2;
  51214. $1=$recv((function(){
  51215. return (1);
  51216. }))._valueWithPossibleArguments_([(3), (4)]);
  51217. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  51218. $self._assert_equals_($1,(1));
  51219. $ctx1.sendIdx["assert:equals:"]=1;
  51220. $2=$recv((function(a){
  51221. return $core.withContext(function($ctx2) {
  51222. return $recv(a).__plus((4));
  51223. $ctx2.sendIdx["+"]=1;
  51224. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  51225. }))._valueWithPossibleArguments_([(3), (4)]);
  51226. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  51227. $self._assert_equals_($2,(7));
  51228. $ctx1.sendIdx["assert:equals:"]=2;
  51229. $self._assert_equals_($recv((function(a,b){
  51230. return $core.withContext(function($ctx2) {
  51231. return $recv(a).__plus(b);
  51232. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  51233. }))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  51234. return self;
  51235. }, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},$globals.BlockClosureTest)});
  51236. },
  51237. args: [],
  51238. 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.",
  51239. referencedClasses: [],
  51240. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"]
  51241. }),
  51242. $globals.BlockClosureTest);
  51243. $core.addMethod(
  51244. $core.method({
  51245. selector: "testWhileFalse",
  51246. protocol: "tests",
  51247. fn: function (){
  51248. var self=this,$self=this;
  51249. var i;
  51250. return $core.withContext(function($ctx1) {
  51251. i=(0);
  51252. $recv((function(){
  51253. return $core.withContext(function($ctx2) {
  51254. return $recv(i).__gt((5));
  51255. $ctx2.sendIdx[">"]=1;
  51256. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51257. }))._whileFalse_((function(){
  51258. return $core.withContext(function($ctx2) {
  51259. i=$recv(i).__plus((1));
  51260. $ctx2.sendIdx["+"]=1;
  51261. return i;
  51262. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  51263. }));
  51264. $self._assert_equals_(i,(6));
  51265. $ctx1.sendIdx["assert:equals:"]=1;
  51266. i=(0);
  51267. $recv((function(){
  51268. return $core.withContext(function($ctx2) {
  51269. i=$recv(i).__plus((1));
  51270. return $recv(i).__gt((5));
  51271. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  51272. }))._whileFalse();
  51273. $self._assert_equals_(i,(6));
  51274. return self;
  51275. }, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},$globals.BlockClosureTest)});
  51276. },
  51277. args: [],
  51278. 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",
  51279. referencedClasses: [],
  51280. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"]
  51281. }),
  51282. $globals.BlockClosureTest);
  51283. $core.addMethod(
  51284. $core.method({
  51285. selector: "testWhileTrue",
  51286. protocol: "tests",
  51287. fn: function (){
  51288. var self=this,$self=this;
  51289. var i;
  51290. return $core.withContext(function($ctx1) {
  51291. i=(0);
  51292. $recv((function(){
  51293. return $core.withContext(function($ctx2) {
  51294. return $recv(i).__lt((5));
  51295. $ctx2.sendIdx["<"]=1;
  51296. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51297. }))._whileTrue_((function(){
  51298. return $core.withContext(function($ctx2) {
  51299. i=$recv(i).__plus((1));
  51300. $ctx2.sendIdx["+"]=1;
  51301. return i;
  51302. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  51303. }));
  51304. $self._assert_equals_(i,(5));
  51305. $ctx1.sendIdx["assert:equals:"]=1;
  51306. i=(0);
  51307. $recv((function(){
  51308. return $core.withContext(function($ctx2) {
  51309. i=$recv(i).__plus((1));
  51310. return $recv(i).__lt((5));
  51311. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  51312. }))._whileTrue();
  51313. $self._assert_equals_(i,(5));
  51314. return self;
  51315. }, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},$globals.BlockClosureTest)});
  51316. },
  51317. args: [],
  51318. 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",
  51319. referencedClasses: [],
  51320. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"]
  51321. }),
  51322. $globals.BlockClosureTest);
  51323. $core.addClass("BooleanTest", $globals.TestCase, [], "Kernel-Tests");
  51324. $core.addMethod(
  51325. $core.method({
  51326. selector: "testEquality",
  51327. protocol: "tests",
  51328. fn: function (){
  51329. var self=this,$self=this;
  51330. return $core.withContext(function($ctx1) {
  51331. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  51332. $1=(0).__eq(false);
  51333. $ctx1.sendIdx["="]=1;
  51334. $self._deny_($1);
  51335. $ctx1.sendIdx["deny:"]=1;
  51336. $2=false.__eq((0));
  51337. $ctx1.sendIdx["="]=2;
  51338. $self._deny_($2);
  51339. $ctx1.sendIdx["deny:"]=2;
  51340. $3="".__eq(false);
  51341. $ctx1.sendIdx["="]=3;
  51342. $self._deny_($3);
  51343. $ctx1.sendIdx["deny:"]=3;
  51344. $4=false.__eq("");
  51345. $ctx1.sendIdx["="]=4;
  51346. $self._deny_($4);
  51347. $ctx1.sendIdx["deny:"]=4;
  51348. $5=true.__eq(true);
  51349. $ctx1.sendIdx["="]=5;
  51350. $self._assert_($5);
  51351. $ctx1.sendIdx["assert:"]=1;
  51352. $6=false.__eq(true);
  51353. $ctx1.sendIdx["="]=6;
  51354. $self._deny_($6);
  51355. $ctx1.sendIdx["deny:"]=5;
  51356. $7=true.__eq(false);
  51357. $ctx1.sendIdx["="]=7;
  51358. $self._deny_($7);
  51359. $8=false.__eq(false);
  51360. $ctx1.sendIdx["="]=8;
  51361. $self._assert_($8);
  51362. $ctx1.sendIdx["assert:"]=2;
  51363. $10=true._yourself();
  51364. $ctx1.sendIdx["yourself"]=1;
  51365. $9=$recv($10).__eq(true);
  51366. $ctx1.sendIdx["="]=9;
  51367. $self._assert_($9);
  51368. $ctx1.sendIdx["assert:"]=3;
  51369. $12=true._yourself();
  51370. $ctx1.sendIdx["yourself"]=2;
  51371. $11=$recv($12).__eq(true._yourself());
  51372. $self._assert_($11);
  51373. return self;
  51374. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.BooleanTest)});
  51375. },
  51376. args: [],
  51377. 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)",
  51378. referencedClasses: [],
  51379. messageSends: ["deny:", "=", "assert:", "yourself"]
  51380. }),
  51381. $globals.BooleanTest);
  51382. $core.addMethod(
  51383. $core.method({
  51384. selector: "testIdentity",
  51385. protocol: "tests",
  51386. fn: function (){
  51387. var self=this,$self=this;
  51388. return $core.withContext(function($ctx1) {
  51389. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  51390. $1=(0).__eq_eq(false);
  51391. $ctx1.sendIdx["=="]=1;
  51392. $self._deny_($1);
  51393. $ctx1.sendIdx["deny:"]=1;
  51394. $2=false.__eq_eq((0));
  51395. $ctx1.sendIdx["=="]=2;
  51396. $self._deny_($2);
  51397. $ctx1.sendIdx["deny:"]=2;
  51398. $3="".__eq_eq(false);
  51399. $ctx1.sendIdx["=="]=3;
  51400. $self._deny_($3);
  51401. $ctx1.sendIdx["deny:"]=3;
  51402. $4=false.__eq_eq("");
  51403. $ctx1.sendIdx["=="]=4;
  51404. $self._deny_($4);
  51405. $ctx1.sendIdx["deny:"]=4;
  51406. $5=true.__eq_eq(true);
  51407. $ctx1.sendIdx["=="]=5;
  51408. $self._assert_($5);
  51409. $ctx1.sendIdx["assert:"]=1;
  51410. $6=false.__eq_eq(true);
  51411. $ctx1.sendIdx["=="]=6;
  51412. $self._deny_($6);
  51413. $ctx1.sendIdx["deny:"]=5;
  51414. $7=true.__eq_eq(false);
  51415. $ctx1.sendIdx["=="]=7;
  51416. $self._deny_($7);
  51417. $8=false.__eq_eq(false);
  51418. $ctx1.sendIdx["=="]=8;
  51419. $self._assert_($8);
  51420. $ctx1.sendIdx["assert:"]=2;
  51421. $10=true._yourself();
  51422. $ctx1.sendIdx["yourself"]=1;
  51423. $9=$recv($10).__eq_eq(true);
  51424. $ctx1.sendIdx["=="]=9;
  51425. $self._assert_($9);
  51426. $ctx1.sendIdx["assert:"]=3;
  51427. $12=true._yourself();
  51428. $ctx1.sendIdx["yourself"]=2;
  51429. $11=$recv($12).__eq_eq(true._yourself());
  51430. $self._assert_($11);
  51431. return self;
  51432. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.BooleanTest)});
  51433. },
  51434. args: [],
  51435. 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",
  51436. referencedClasses: [],
  51437. messageSends: ["deny:", "==", "assert:", "yourself"]
  51438. }),
  51439. $globals.BooleanTest);
  51440. $core.addMethod(
  51441. $core.method({
  51442. selector: "testIfTrueIfFalse",
  51443. protocol: "tests",
  51444. fn: function (){
  51445. var self=this,$self=this;
  51446. return $core.withContext(function($ctx1) {
  51447. var $1,$2,$3,$4,$5,$6,$7,$8;
  51448. if($core.assert(true)){
  51449. $1="alternative block";
  51450. }
  51451. $self._assert_equals_($1,"alternative block");
  51452. $ctx1.sendIdx["assert:equals:"]=1;
  51453. if(!$core.assert(true)){
  51454. $2="alternative block";
  51455. }
  51456. $self._assert_equals_($2,nil);
  51457. $ctx1.sendIdx["assert:equals:"]=2;
  51458. if($core.assert(false)){
  51459. $3="alternative block";
  51460. }
  51461. $self._assert_equals_($3,nil);
  51462. $ctx1.sendIdx["assert:equals:"]=3;
  51463. if(!$core.assert(false)){
  51464. $4="alternative block";
  51465. }
  51466. $self._assert_equals_($4,"alternative block");
  51467. $ctx1.sendIdx["assert:equals:"]=4;
  51468. if($core.assert(false)){
  51469. $5="alternative block";
  51470. } else {
  51471. $5="alternative block2";
  51472. }
  51473. $self._assert_equals_($5,"alternative block2");
  51474. $ctx1.sendIdx["assert:equals:"]=5;
  51475. if($core.assert(false)){
  51476. $6="alternative block2";
  51477. } else {
  51478. $6="alternative block";
  51479. }
  51480. $self._assert_equals_($6,"alternative block");
  51481. $ctx1.sendIdx["assert:equals:"]=6;
  51482. if($core.assert(true)){
  51483. $7="alternative block";
  51484. } else {
  51485. $7="alternative block2";
  51486. }
  51487. $self._assert_equals_($7,"alternative block");
  51488. $ctx1.sendIdx["assert:equals:"]=7;
  51489. if($core.assert(true)){
  51490. $8="alternative block2";
  51491. } else {
  51492. $8="alternative block";
  51493. }
  51494. $self._assert_equals_($8,"alternative block2");
  51495. return self;
  51496. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},$globals.BooleanTest)});
  51497. },
  51498. args: [],
  51499. 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'.",
  51500. referencedClasses: [],
  51501. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  51502. }),
  51503. $globals.BooleanTest);
  51504. $core.addMethod(
  51505. $core.method({
  51506. selector: "testIfTrueIfFalseWithBoxing",
  51507. protocol: "tests",
  51508. fn: function (){
  51509. var self=this,$self=this;
  51510. return $core.withContext(function($ctx1) {
  51511. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  51512. $2=true._yourself();
  51513. $ctx1.sendIdx["yourself"]=1;
  51514. if($core.assert($2)){
  51515. $1="alternative block";
  51516. }
  51517. $self._assert_equals_($1,"alternative block");
  51518. $ctx1.sendIdx["assert:equals:"]=1;
  51519. $4=true._yourself();
  51520. $ctx1.sendIdx["yourself"]=2;
  51521. if(!$core.assert($4)){
  51522. $3="alternative block";
  51523. }
  51524. $self._assert_equals_($3,nil);
  51525. $ctx1.sendIdx["assert:equals:"]=2;
  51526. $6=false._yourself();
  51527. $ctx1.sendIdx["yourself"]=3;
  51528. if($core.assert($6)){
  51529. $5="alternative block";
  51530. }
  51531. $self._assert_equals_($5,nil);
  51532. $ctx1.sendIdx["assert:equals:"]=3;
  51533. $8=false._yourself();
  51534. $ctx1.sendIdx["yourself"]=4;
  51535. if(!$core.assert($8)){
  51536. $7="alternative block";
  51537. }
  51538. $self._assert_equals_($7,"alternative block");
  51539. $ctx1.sendIdx["assert:equals:"]=4;
  51540. $10=false._yourself();
  51541. $ctx1.sendIdx["yourself"]=5;
  51542. if($core.assert($10)){
  51543. $9="alternative block";
  51544. } else {
  51545. $9="alternative block2";
  51546. }
  51547. $self._assert_equals_($9,"alternative block2");
  51548. $ctx1.sendIdx["assert:equals:"]=5;
  51549. $12=false._yourself();
  51550. $ctx1.sendIdx["yourself"]=6;
  51551. if($core.assert($12)){
  51552. $11="alternative block2";
  51553. } else {
  51554. $11="alternative block";
  51555. }
  51556. $self._assert_equals_($11,"alternative block");
  51557. $ctx1.sendIdx["assert:equals:"]=6;
  51558. $14=true._yourself();
  51559. $ctx1.sendIdx["yourself"]=7;
  51560. if($core.assert($14)){
  51561. $13="alternative block";
  51562. } else {
  51563. $13="alternative block2";
  51564. }
  51565. $self._assert_equals_($13,"alternative block");
  51566. $ctx1.sendIdx["assert:equals:"]=7;
  51567. $16=true._yourself();
  51568. if($core.assert($16)){
  51569. $15="alternative block2";
  51570. } else {
  51571. $15="alternative block";
  51572. }
  51573. $self._assert_equals_($15,"alternative block2");
  51574. return self;
  51575. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},$globals.BooleanTest)});
  51576. },
  51577. args: [],
  51578. 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'.",
  51579. referencedClasses: [],
  51580. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  51581. }),
  51582. $globals.BooleanTest);
  51583. $core.addMethod(
  51584. $core.method({
  51585. selector: "testLogic",
  51586. protocol: "tests",
  51587. fn: function (){
  51588. var self=this,$self=this;
  51589. return $core.withContext(function($ctx1) {
  51590. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$12,$11,$14,$13,$16,$17,$15,$19,$18,$21,$20,$23,$22;
  51591. $1=true.__and(true);
  51592. $ctx1.sendIdx["&"]=1;
  51593. $self._assert_($1);
  51594. $ctx1.sendIdx["assert:"]=1;
  51595. $2=true.__and(false);
  51596. $ctx1.sendIdx["&"]=2;
  51597. $self._deny_($2);
  51598. $ctx1.sendIdx["deny:"]=1;
  51599. $3=false.__and(true);
  51600. $ctx1.sendIdx["&"]=3;
  51601. $self._deny_($3);
  51602. $ctx1.sendIdx["deny:"]=2;
  51603. $5=false.__and(false);
  51604. $ctx1.sendIdx["&"]=4;
  51605. $4=$self._deny_($5);
  51606. $ctx1.sendIdx["deny:"]=3;
  51607. $6=true.__or(true);
  51608. $ctx1.sendIdx["|"]=1;
  51609. $self._assert_($6);
  51610. $ctx1.sendIdx["assert:"]=2;
  51611. $7=true.__or(false);
  51612. $ctx1.sendIdx["|"]=2;
  51613. $self._assert_($7);
  51614. $ctx1.sendIdx["assert:"]=3;
  51615. $8=false.__or(true);
  51616. $ctx1.sendIdx["|"]=3;
  51617. $self._assert_($8);
  51618. $ctx1.sendIdx["assert:"]=4;
  51619. $10=false.__or(false);
  51620. $ctx1.sendIdx["|"]=4;
  51621. $9=$self._deny_($10);
  51622. $ctx1.sendIdx["deny:"]=4;
  51623. $12=(1).__gt((0));
  51624. $ctx1.sendIdx[">"]=1;
  51625. $11=true.__and($12);
  51626. $ctx1.sendIdx["&"]=5;
  51627. $self._assert_($11);
  51628. $ctx1.sendIdx["assert:"]=5;
  51629. $14=(1).__gt((0));
  51630. $ctx1.sendIdx[">"]=2;
  51631. $13=$recv($14).__and(false);
  51632. $ctx1.sendIdx["&"]=6;
  51633. $self._deny_($13);
  51634. $ctx1.sendIdx["deny:"]=5;
  51635. $16=(1).__gt((0));
  51636. $ctx1.sendIdx[">"]=3;
  51637. $17=(1).__gt((2));
  51638. $ctx1.sendIdx[">"]=4;
  51639. $15=$recv($16).__and($17);
  51640. $self._deny_($15);
  51641. $19=(1).__gt((0));
  51642. $ctx1.sendIdx[">"]=5;
  51643. $18=false.__or($19);
  51644. $ctx1.sendIdx["|"]=5;
  51645. $self._assert_($18);
  51646. $ctx1.sendIdx["assert:"]=6;
  51647. $21=(1).__gt((0));
  51648. $ctx1.sendIdx[">"]=6;
  51649. $20=$recv($21).__or(false);
  51650. $ctx1.sendIdx["|"]=6;
  51651. $self._assert_($20);
  51652. $ctx1.sendIdx["assert:"]=7;
  51653. $23=(1).__gt((0));
  51654. $ctx1.sendIdx[">"]=7;
  51655. $22=$recv($23).__or((1).__gt((2)));
  51656. $self._assert_($22);
  51657. return self;
  51658. }, function($ctx1) {$ctx1.fill(self,"testLogic",{},$globals.BooleanTest)});
  51659. },
  51660. args: [],
  51661. 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))",
  51662. referencedClasses: [],
  51663. messageSends: ["assert:", "&", "deny:", "|", ">"]
  51664. }),
  51665. $globals.BooleanTest);
  51666. $core.addMethod(
  51667. $core.method({
  51668. selector: "testLogicKeywords",
  51669. protocol: "tests",
  51670. fn: function (){
  51671. var self=this,$self=this;
  51672. return $core.withContext(function($ctx1) {
  51673. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$15,$14,$16,$18,$17,$20,$19;
  51674. $1=true._and_((function(){
  51675. return true;
  51676. }));
  51677. $ctx1.sendIdx["and:"]=1;
  51678. $self._assert_($1);
  51679. $ctx1.sendIdx["assert:"]=1;
  51680. $2=true._and_((function(){
  51681. return false;
  51682. }));
  51683. $ctx1.sendIdx["and:"]=2;
  51684. $self._deny_($2);
  51685. $ctx1.sendIdx["deny:"]=1;
  51686. $3=false._and_((function(){
  51687. return true;
  51688. }));
  51689. $ctx1.sendIdx["and:"]=3;
  51690. $self._deny_($3);
  51691. $ctx1.sendIdx["deny:"]=2;
  51692. $5=false._and_((function(){
  51693. return false;
  51694. }));
  51695. $ctx1.sendIdx["and:"]=4;
  51696. $4=$self._deny_($5);
  51697. $ctx1.sendIdx["deny:"]=3;
  51698. $6=true._or_((function(){
  51699. return true;
  51700. }));
  51701. $ctx1.sendIdx["or:"]=1;
  51702. $self._assert_($6);
  51703. $ctx1.sendIdx["assert:"]=2;
  51704. $7=true._or_((function(){
  51705. return false;
  51706. }));
  51707. $ctx1.sendIdx["or:"]=2;
  51708. $self._assert_($7);
  51709. $ctx1.sendIdx["assert:"]=3;
  51710. $8=false._or_((function(){
  51711. return true;
  51712. }));
  51713. $ctx1.sendIdx["or:"]=3;
  51714. $self._assert_($8);
  51715. $ctx1.sendIdx["assert:"]=4;
  51716. $10=false._or_((function(){
  51717. return false;
  51718. }));
  51719. $ctx1.sendIdx["or:"]=4;
  51720. $9=$self._deny_($10);
  51721. $ctx1.sendIdx["deny:"]=4;
  51722. $11=true._and_((function(){
  51723. return $core.withContext(function($ctx2) {
  51724. return (1).__gt((0));
  51725. $ctx2.sendIdx[">"]=1;
  51726. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  51727. }));
  51728. $ctx1.sendIdx["and:"]=5;
  51729. $self._assert_($11);
  51730. $ctx1.sendIdx["assert:"]=5;
  51731. $13=(1).__gt((0));
  51732. $ctx1.sendIdx[">"]=2;
  51733. $12=$recv($13)._and_((function(){
  51734. return false;
  51735. }));
  51736. $ctx1.sendIdx["and:"]=6;
  51737. $self._deny_($12);
  51738. $ctx1.sendIdx["deny:"]=5;
  51739. $15=(1).__gt((0));
  51740. $ctx1.sendIdx[">"]=3;
  51741. $14=$recv($15)._and_((function(){
  51742. return $core.withContext(function($ctx2) {
  51743. return (1).__gt((2));
  51744. $ctx2.sendIdx[">"]=4;
  51745. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  51746. }));
  51747. $self._deny_($14);
  51748. $16=false._or_((function(){
  51749. return $core.withContext(function($ctx2) {
  51750. return (1).__gt((0));
  51751. $ctx2.sendIdx[">"]=5;
  51752. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  51753. }));
  51754. $ctx1.sendIdx["or:"]=5;
  51755. $self._assert_($16);
  51756. $ctx1.sendIdx["assert:"]=6;
  51757. $18=(1).__gt((0));
  51758. $ctx1.sendIdx[">"]=6;
  51759. $17=$recv($18)._or_((function(){
  51760. return false;
  51761. }));
  51762. $ctx1.sendIdx["or:"]=6;
  51763. $self._assert_($17);
  51764. $ctx1.sendIdx["assert:"]=7;
  51765. $20=(1).__gt((0));
  51766. $ctx1.sendIdx[">"]=7;
  51767. $19=$recv($20)._or_((function(){
  51768. return $core.withContext(function($ctx2) {
  51769. return (1).__gt((2));
  51770. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  51771. }));
  51772. $self._assert_($19);
  51773. return self;
  51774. }, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},$globals.BooleanTest)});
  51775. },
  51776. args: [],
  51777. 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 ])",
  51778. referencedClasses: [],
  51779. messageSends: ["assert:", "and:", "deny:", "or:", ">"]
  51780. }),
  51781. $globals.BooleanTest);
  51782. $core.addMethod(
  51783. $core.method({
  51784. selector: "testNonBooleanError",
  51785. protocol: "tests",
  51786. fn: function (){
  51787. var self=this,$self=this;
  51788. return $core.withContext(function($ctx1) {
  51789. $self._should_raise_((function(){
  51790. return $core.withContext(function($ctx2) {
  51791. if($core.assert("")){
  51792. } else {
  51793. }
  51794. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51795. }),$globals.NonBooleanReceiver);
  51796. return self;
  51797. }, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},$globals.BooleanTest)});
  51798. },
  51799. args: [],
  51800. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  51801. referencedClasses: ["NonBooleanReceiver"],
  51802. messageSends: ["should:raise:", "ifTrue:ifFalse:"]
  51803. }),
  51804. $globals.BooleanTest);
  51805. $core.addClass("ClassBuilderTest", $globals.TestCase, ["builder", "theClass"], "Kernel-Tests");
  51806. $core.addMethod(
  51807. $core.method({
  51808. selector: "setUp",
  51809. protocol: "running",
  51810. fn: function (){
  51811. var self=this,$self=this;
  51812. return $core.withContext(function($ctx1) {
  51813. $self["@builder"]=$recv($globals.ClassBuilder)._new();
  51814. return self;
  51815. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassBuilderTest)});
  51816. },
  51817. args: [],
  51818. source: "setUp\x0a\x09builder := ClassBuilder new",
  51819. referencedClasses: ["ClassBuilder"],
  51820. messageSends: ["new"]
  51821. }),
  51822. $globals.ClassBuilderTest);
  51823. $core.addMethod(
  51824. $core.method({
  51825. selector: "tearDown",
  51826. protocol: "running",
  51827. fn: function (){
  51828. var self=this,$self=this;
  51829. return $core.withContext(function($ctx1) {
  51830. var $1,$receiver;
  51831. $1=$self["@theClass"];
  51832. if(($receiver = $1) == null || $receiver.a$nil){
  51833. $1;
  51834. } else {
  51835. $recv($globals.Smalltalk)._removeClass_($self["@theClass"]);
  51836. $self._deny_($recv($recv($recv($self["@theClass"])._package())._classes())._includes_($self["@theClass"]));
  51837. $self["@theClass"]=nil;
  51838. $self["@theClass"];
  51839. }
  51840. return self;
  51841. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassBuilderTest)});
  51842. },
  51843. args: [],
  51844. source: "tearDown\x0a\x09theClass ifNotNil: [\x0a\x09\x09Smalltalk removeClass: theClass.\x0a\x09\x09self deny: (theClass package classes includes: theClass).\x0a\x09\x09theClass := nil ]",
  51845. referencedClasses: ["Smalltalk"],
  51846. messageSends: ["ifNotNil:", "removeClass:", "deny:", "includes:", "classes", "package"]
  51847. }),
  51848. $globals.ClassBuilderTest);
  51849. $core.addMethod(
  51850. $core.method({
  51851. selector: "testAddTrait",
  51852. protocol: "tests",
  51853. fn: function (){
  51854. var self=this,$self=this;
  51855. return $core.withContext(function($ctx1) {
  51856. var $3,$2,$1,$4;
  51857. $self["@theClass"]=$recv($self["@builder"])._addTraitNamed_package_("ObjectMock2","Kernel-Tests");
  51858. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  51859. $ctx1.sendIdx["assert:equals:"]=1;
  51860. $3=$recv($self["@theClass"])._package();
  51861. $ctx1.sendIdx["package"]=1;
  51862. $2=$recv($3)._classes();
  51863. $1=$recv($2)._occurrencesOf_($self["@theClass"]);
  51864. $self._assert_equals_($1,(1));
  51865. $ctx1.sendIdx["assert:equals:"]=2;
  51866. $4=$recv($self["@theClass"])._package();
  51867. $ctx1.sendIdx["package"]=2;
  51868. $self._assert_equals_($4,$recv($globals.ObjectMock)._package());
  51869. return self;
  51870. }, function($ctx1) {$ctx1.fill(self,"testAddTrait",{},$globals.ClassBuilderTest)});
  51871. },
  51872. args: [],
  51873. 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",
  51874. referencedClasses: ["ObjectMock"],
  51875. messageSends: ["addTraitNamed:package:", "assert:equals:", "name", "occurrencesOf:", "classes", "package"]
  51876. }),
  51877. $globals.ClassBuilderTest);
  51878. $core.addMethod(
  51879. $core.method({
  51880. selector: "testClassCopy",
  51881. protocol: "tests",
  51882. fn: function (){
  51883. var self=this,$self=this;
  51884. return $core.withContext(function($ctx1) {
  51885. var $2,$1,$4,$3,$6,$7,$5,$9,$8;
  51886. $self["@theClass"]=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51887. $2=$recv($self["@theClass"])._superclass();
  51888. $ctx1.sendIdx["superclass"]=1;
  51889. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  51890. $ctx1.sendIdx["=="]=1;
  51891. $self._assert_($1);
  51892. $ctx1.sendIdx["assert:"]=1;
  51893. $4=$recv($self["@theClass"])._instanceVariableNames();
  51894. $ctx1.sendIdx["instanceVariableNames"]=1;
  51895. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  51896. $ctx1.sendIdx["=="]=2;
  51897. $self._assert_($3);
  51898. $ctx1.sendIdx["assert:"]=2;
  51899. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  51900. $ctx1.sendIdx["assert:equals:"]=1;
  51901. $6=$recv($self["@theClass"])._package();
  51902. $ctx1.sendIdx["package"]=1;
  51903. $7=$recv($globals.ObjectMock)._package();
  51904. $ctx1.sendIdx["package"]=2;
  51905. $5=$recv($6).__eq_eq($7);
  51906. $self._assert_($5);
  51907. $ctx1.sendIdx["assert:"]=3;
  51908. $self._assert_($recv($recv($recv($self["@theClass"])._package())._classes())._includes_($self["@theClass"]));
  51909. $9=$recv($self["@theClass"])._methodDictionary();
  51910. $ctx1.sendIdx["methodDictionary"]=1;
  51911. $8=$recv($9)._keys();
  51912. $ctx1.sendIdx["keys"]=1;
  51913. $self._assert_equals_($8,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  51914. return self;
  51915. }, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},$globals.ClassBuilderTest)});
  51916. },
  51917. args: [],
  51918. 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",
  51919. referencedClasses: ["ObjectMock"],
  51920. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "includes:", "classes", "keys", "methodDictionary"]
  51921. }),
  51922. $globals.ClassBuilderTest);
  51923. $core.addMethod(
  51924. $core.method({
  51925. selector: "testClassMigration",
  51926. protocol: "tests",
  51927. fn: function (){
  51928. var self=this,$self=this;
  51929. var instance,oldClass;
  51930. return $core.withContext(function($ctx1) {
  51931. var $2,$1,$4,$3,$5,$6,$7,$8,$10,$9,$12,$11;
  51932. oldClass=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51933. $2=$recv($globals.Smalltalk)._globals();
  51934. $ctx1.sendIdx["globals"]=1;
  51935. $1=$recv($2)._at_("ObjectMock2");
  51936. $ctx1.sendIdx["at:"]=1;
  51937. instance=$recv($1)._new();
  51938. $4=$recv($globals.Smalltalk)._globals();
  51939. $ctx1.sendIdx["globals"]=2;
  51940. $3=$recv($4)._at_("ObjectMock2");
  51941. $ctx1.sendIdx["at:"]=2;
  51942. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  51943. $5=$recv(oldClass).__eq_eq($globals.ObjectMock2);
  51944. $ctx1.sendIdx["=="]=1;
  51945. $self._deny_($5);
  51946. $ctx1.sendIdx["deny:"]=1;
  51947. $6=$recv($recv($globals.ObjectMock2)._superclass()).__eq_eq($globals.ObjectMock);
  51948. $ctx1.sendIdx["=="]=2;
  51949. $self._assert_($6);
  51950. $ctx1.sendIdx["assert:"]=1;
  51951. $self._assert_($recv($recv($globals.ObjectMock2)._instanceVariableNames())._isEmpty());
  51952. $ctx1.sendIdx["assert:"]=2;
  51953. $7=$recv($globals.ObjectMock2)._selectors();
  51954. $ctx1.sendIdx["selectors"]=1;
  51955. $self._assert_equals_($7,$recv(oldClass)._selectors());
  51956. $ctx1.sendIdx["assert:equals:"]=1;
  51957. $8=$recv($globals.ObjectMock2)._comment();
  51958. $ctx1.sendIdx["comment"]=1;
  51959. $self._assert_equals_($8,$recv(oldClass)._comment());
  51960. $ctx1.sendIdx["assert:equals:"]=2;
  51961. $10=$recv($globals.ObjectMock2)._package();
  51962. $ctx1.sendIdx["package"]=1;
  51963. $9=$recv($10)._name();
  51964. $ctx1.sendIdx["name"]=1;
  51965. $self._assert_equals_($9,"Kernel-Tests");
  51966. $self._assert_($recv($recv($recv($globals.ObjectMock2)._package())._classes())._includes_($globals.ObjectMock2));
  51967. $ctx1.sendIdx["assert:"]=3;
  51968. $12=$recv(instance)._class();
  51969. $ctx1.sendIdx["class"]=1;
  51970. $11=$recv($12).__eq_eq($globals.ObjectMock2);
  51971. $self._deny_($11);
  51972. $self._assert_($recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv(instance)._class())._name()))._isNil());
  51973. $recv($globals.Smalltalk)._removeClass_($globals.ObjectMock2);
  51974. return self;
  51975. }, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},$globals.ClassBuilderTest)});
  51976. },
  51977. args: [],
  51978. source: "testClassMigration\x0a\x09| instance oldClass |\x0a\x09\x0a\x09oldClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09instance := (Smalltalk globals at: 'ObjectMock2') new.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: oldClass == ObjectMock2.\x0a\x09\x0a\x09self assert: ObjectMock2 superclass == ObjectMock.\x0a\x09self assert: ObjectMock2 instanceVariableNames isEmpty.\x0a\x09self assert: ObjectMock2 selectors equals: oldClass selectors.\x0a\x09self assert: ObjectMock2 comment equals: oldClass comment.\x0a\x09self assert: ObjectMock2 package name equals: 'Kernel-Tests'.\x0a\x09self assert: (ObjectMock2 package classes includes: ObjectMock2).\x0a\x09\x0a\x09self deny: instance class == ObjectMock2.\x0a\x09\x22Commeting this out. Tests implementation detail.\x22\x0a\x09\x22self assert: instance class name equals: 'OldObjectMock2'.\x22\x0a\x09\x0a\x09self assert: (Smalltalk globals at: instance class name) isNil.\x0a\x09\x0a\x09Smalltalk removeClass: ObjectMock2",
  51979. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"],
  51980. 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:"]
  51981. }),
  51982. $globals.ClassBuilderTest);
  51983. $core.addMethod(
  51984. $core.method({
  51985. selector: "testClassMigrationWithClassInstanceVariables",
  51986. protocol: "tests",
  51987. fn: function (){
  51988. var self=this,$self=this;
  51989. return $core.withContext(function($ctx1) {
  51990. var $1;
  51991. $recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51992. $1=$recv($globals.ObjectMock2)._class();
  51993. $ctx1.sendIdx["class"]=1;
  51994. $recv($1)._instanceVariableNames_("foo bar");
  51995. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($recv($recv($globals.Smalltalk)._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  51996. $self._assert_equals_($recv($recv($globals.ObjectMock2)._class())._instanceVariableNames(),["foo", "bar"]);
  51997. $recv($globals.Smalltalk)._removeClass_($globals.ObjectMock2);
  51998. return self;
  51999. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},$globals.ClassBuilderTest)});
  52000. },
  52001. args: [],
  52002. source: "testClassMigrationWithClassInstanceVariables\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 class instanceVariableNames: 'foo bar'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: ObjectMock2 class instanceVariableNames equals: #('foo' 'bar').\x0a\x09\x0a\x09Smalltalk removeClass: ObjectMock2",
  52003. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"],
  52004. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"]
  52005. }),
  52006. $globals.ClassBuilderTest);
  52007. $core.addMethod(
  52008. $core.method({
  52009. selector: "testClassMigrationWithSubclasses",
  52010. protocol: "tests",
  52011. fn: function (){
  52012. var self=this,$self=this;
  52013. return $core.withContext(function($ctx1) {
  52014. var $2,$1,$4,$3;
  52015. $recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  52016. $recv($globals.ObjectMock2)._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  52017. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  52018. $recv($globals.ObjectMock3)._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  52019. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  52020. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($recv($recv($globals.Smalltalk)._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  52021. $2=$recv($globals.ObjectMock)._subclasses();
  52022. $ctx1.sendIdx["subclasses"]=1;
  52023. $1=$recv($2)._includes_($globals.ObjectMock2);
  52024. $ctx1.sendIdx["includes:"]=1;
  52025. $self._assert_($1);
  52026. $ctx1.sendIdx["assert:"]=1;
  52027. $4=$recv($globals.ObjectMock2)._subclasses();
  52028. $ctx1.sendIdx["subclasses"]=2;
  52029. $3=$recv($4)._includes_($globals.ObjectMock3);
  52030. $ctx1.sendIdx["includes:"]=2;
  52031. $self._assert_($3);
  52032. $ctx1.sendIdx["assert:"]=2;
  52033. $self._assert_($recv($recv($globals.ObjectMock3)._subclasses())._includes_($globals.ObjectMock4));
  52034. $recv($recv($globals.ObjectMock)._allSubclasses())._reverseDo_((function(each){
  52035. return $core.withContext(function($ctx2) {
  52036. return $recv($globals.Smalltalk)._removeClass_(each);
  52037. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52038. }));
  52039. return self;
  52040. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},$globals.ClassBuilderTest)});
  52041. },
  52042. args: [],
  52043. source: "testClassMigrationWithSubclasses\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 subclass: 'ObjectMock3' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09ObjectMock3 subclass: 'ObjectMock4' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: (ObjectMock subclasses includes: ObjectMock2).\x0a\x09self assert: (ObjectMock2 subclasses includes: ObjectMock3).\x0a\x09self assert: (ObjectMock3 subclasses includes: ObjectMock4).\x0a\x09\x0a\x09ObjectMock allSubclasses reverseDo: [ :each | Smalltalk removeClass: each ]",
  52044. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"],
  52045. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:", "includes:", "subclasses", "reverseDo:", "allSubclasses", "removeClass:"]
  52046. }),
  52047. $globals.ClassBuilderTest);
  52048. $core.addMethod(
  52049. $core.method({
  52050. selector: "testInstanceVariableNames",
  52051. protocol: "tests",
  52052. fn: function (){
  52053. var self=this,$self=this;
  52054. return $core.withContext(function($ctx1) {
  52055. $self._assert_equals_($recv($self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  52056. return self;
  52057. }, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},$globals.ClassBuilderTest)});
  52058. },
  52059. args: [],
  52060. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  52061. referencedClasses: [],
  52062. messageSends: ["assert:equals:", "instanceVariableNamesFor:"]
  52063. }),
  52064. $globals.ClassBuilderTest);
  52065. $core.addMethod(
  52066. $core.method({
  52067. selector: "testSubclass",
  52068. protocol: "tests",
  52069. fn: function (){
  52070. var self=this,$self=this;
  52071. return $core.withContext(function($ctx1) {
  52072. var $3,$2,$1,$4;
  52073. $self["@theClass"]=$recv($self["@builder"])._addSubclassOf_named_instanceVariableNames_package_($globals.ObjectMock,"ObjectMock2","foo bar","Kernel-Tests");
  52074. $self._assert_equals_($recv($self["@theClass"])._superclass(),$globals.ObjectMock);
  52075. $ctx1.sendIdx["assert:equals:"]=1;
  52076. $self._assert_equals_($recv($self["@theClass"])._instanceVariableNames(),"foo bar");
  52077. $ctx1.sendIdx["assert:equals:"]=2;
  52078. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  52079. $ctx1.sendIdx["assert:equals:"]=3;
  52080. $3=$recv($self["@theClass"])._package();
  52081. $ctx1.sendIdx["package"]=1;
  52082. $2=$recv($3)._classes();
  52083. $1=$recv($2)._occurrencesOf_($self["@theClass"]);
  52084. $self._assert_equals_($1,(1));
  52085. $ctx1.sendIdx["assert:equals:"]=4;
  52086. $4=$recv($self["@theClass"])._package();
  52087. $ctx1.sendIdx["package"]=2;
  52088. $self._assert_equals_($4,$recv($globals.ObjectMock)._package());
  52089. $ctx1.sendIdx["assert:equals:"]=5;
  52090. $self._assert_equals_($recv($recv($recv($self["@theClass"])._methodDictionary())._keys())._size(),(0));
  52091. return self;
  52092. }, function($ctx1) {$ctx1.fill(self,"testSubclass",{},$globals.ClassBuilderTest)});
  52093. },
  52094. args: [],
  52095. 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",
  52096. referencedClasses: ["ObjectMock"],
  52097. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "assert:equals:", "superclass", "instanceVariableNames", "name", "occurrencesOf:", "classes", "package", "size", "keys", "methodDictionary"]
  52098. }),
  52099. $globals.ClassBuilderTest);
  52100. $core.addClass("ClassTest", $globals.TestCase, ["builder", "theClass"], "Kernel-Tests");
  52101. $core.addMethod(
  52102. $core.method({
  52103. selector: "jsConstructor",
  52104. protocol: "running",
  52105. fn: function (){
  52106. var self=this,$self=this;
  52107. return $core.withContext(function($ctx1) {
  52108. function Foo(){}
  52109. Foo.prototype.valueOf = function () {return 4;};
  52110. return Foo;
  52111. ;
  52112. return self;
  52113. }, function($ctx1) {$ctx1.fill(self,"jsConstructor",{},$globals.ClassTest)});
  52114. },
  52115. args: [],
  52116. source: "jsConstructor\x0a\x09<inlineJS: '\x0a\x09\x09function Foo(){}\x0a\x09\x09Foo.prototype.valueOf = function () {return 4;};\x0a\x09\x09return Foo;\x0a\x09'>",
  52117. referencedClasses: [],
  52118. messageSends: []
  52119. }),
  52120. $globals.ClassTest);
  52121. $core.addMethod(
  52122. $core.method({
  52123. selector: "setUp",
  52124. protocol: "running",
  52125. fn: function (){
  52126. var self=this,$self=this;
  52127. return $core.withContext(function($ctx1) {
  52128. $self["@builder"]=$recv($globals.ClassBuilder)._new();
  52129. return self;
  52130. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassTest)});
  52131. },
  52132. args: [],
  52133. source: "setUp\x0a\x09builder := ClassBuilder new",
  52134. referencedClasses: ["ClassBuilder"],
  52135. messageSends: ["new"]
  52136. }),
  52137. $globals.ClassTest);
  52138. $core.addMethod(
  52139. $core.method({
  52140. selector: "tearDown",
  52141. protocol: "running",
  52142. fn: function (){
  52143. var self=this,$self=this;
  52144. return $core.withContext(function($ctx1) {
  52145. var $1,$receiver;
  52146. $1=$self["@theClass"];
  52147. if(($receiver = $1) == null || $receiver.a$nil){
  52148. $1;
  52149. } else {
  52150. $recv($recv($self["@theClass"])._allSubclasses())._reverseDo_((function(each){
  52151. return $core.withContext(function($ctx2) {
  52152. return $recv($globals.Smalltalk)._removeClass_(each);
  52153. $ctx2.sendIdx["removeClass:"]=1;
  52154. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52155. }));
  52156. $recv($globals.Smalltalk)._removeClass_($self["@theClass"]);
  52157. $self["@theClass"]=nil;
  52158. $self["@theClass"];
  52159. }
  52160. return self;
  52161. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassTest)});
  52162. },
  52163. args: [],
  52164. source: "tearDown\x0a\x09theClass ifNotNil: [\x0a\x09\x09theClass allSubclasses reverseDo: [ :each | Smalltalk removeClass: each ].\x0a\x09\x09Smalltalk removeClass: theClass.\x0a\x09\x09theClass := nil ]",
  52165. referencedClasses: ["Smalltalk"],
  52166. messageSends: ["ifNotNil:", "reverseDo:", "allSubclasses", "removeClass:"]
  52167. }),
  52168. $globals.ClassTest);
  52169. $core.addMethod(
  52170. $core.method({
  52171. selector: "testAllSubclasses",
  52172. protocol: "tests",
  52173. fn: function (){
  52174. var self=this,$self=this;
  52175. var subclasses,index;
  52176. return $core.withContext(function($ctx1) {
  52177. subclasses=$recv($globals.Object)._subclasses();
  52178. $ctx1.sendIdx["subclasses"]=1;
  52179. index=(1);
  52180. $recv((function(){
  52181. return $core.withContext(function($ctx2) {
  52182. return $recv(index).__gt($recv(subclasses)._size());
  52183. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52184. }))._whileFalse_((function(){
  52185. return $core.withContext(function($ctx2) {
  52186. $recv(subclasses)._addAll_($recv($recv(subclasses)._at_(index))._subclasses());
  52187. index=$recv(index).__plus((1));
  52188. return index;
  52189. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  52190. }));
  52191. $self._assert_equals_($recv($globals.Object)._allSubclasses(),subclasses);
  52192. return self;
  52193. }, function($ctx1) {$ctx1.fill(self,"testAllSubclasses",{subclasses:subclasses,index:index},$globals.ClassTest)});
  52194. },
  52195. args: [],
  52196. 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",
  52197. referencedClasses: ["Object"],
  52198. messageSends: ["subclasses", "whileFalse:", ">", "size", "addAll:", "at:", "+", "assert:equals:", "allSubclasses"]
  52199. }),
  52200. $globals.ClassTest);
  52201. $core.addMethod(
  52202. $core.method({
  52203. selector: "testMetaclassSubclasses",
  52204. protocol: "tests",
  52205. fn: function (){
  52206. var self=this,$self=this;
  52207. var subclasses;
  52208. return $core.withContext(function($ctx1) {
  52209. var $4,$3,$2,$1;
  52210. $4=$recv($globals.Object)._class();
  52211. $ctx1.sendIdx["class"]=1;
  52212. $3=$recv($4)._instanceClass();
  52213. $2=$recv($3)._subclasses();
  52214. $ctx1.sendIdx["subclasses"]=1;
  52215. $1=$recv($2)._select_((function(each){
  52216. return $core.withContext(function($ctx2) {
  52217. return $recv($recv(each)._isMetaclass())._not();
  52218. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52219. }));
  52220. subclasses=$recv($1)._collect_((function(each){
  52221. return $core.withContext(function($ctx2) {
  52222. return $recv(each)._theMetaClass();
  52223. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52224. }));
  52225. $self._assert_equals_($recv($recv($globals.Object)._class())._subclasses(),subclasses);
  52226. return self;
  52227. }, function($ctx1) {$ctx1.fill(self,"testMetaclassSubclasses",{subclasses:subclasses},$globals.ClassTest)});
  52228. },
  52229. args: [],
  52230. 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",
  52231. referencedClasses: ["Object"],
  52232. messageSends: ["collect:", "select:", "subclasses", "instanceClass", "class", "not", "isMetaclass", "theMetaClass", "assert:equals:"]
  52233. }),
  52234. $globals.ClassTest);
  52235. $core.addMethod(
  52236. $core.method({
  52237. selector: "testSetJavaScriptConstructor",
  52238. protocol: "tests",
  52239. fn: function (){
  52240. var self=this,$self=this;
  52241. var instance;
  52242. return $core.withContext(function($ctx1) {
  52243. var $2,$1,$4,$3,$6,$5,$8,$7;
  52244. $self["@theClass"]=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  52245. $recv($self["@theClass"])._javascriptConstructor_($self._jsConstructor());
  52246. $2=$recv($self["@theClass"])._superclass();
  52247. $ctx1.sendIdx["superclass"]=1;
  52248. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  52249. $ctx1.sendIdx["=="]=1;
  52250. $self._assert_($1);
  52251. $ctx1.sendIdx["assert:"]=1;
  52252. $4=$recv($self["@theClass"])._instanceVariableNames();
  52253. $ctx1.sendIdx["instanceVariableNames"]=1;
  52254. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  52255. $ctx1.sendIdx["=="]=2;
  52256. $self._assert_($3);
  52257. $ctx1.sendIdx["assert:"]=2;
  52258. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  52259. $ctx1.sendIdx["assert:equals:"]=1;
  52260. $6=$recv($self["@theClass"])._package();
  52261. $ctx1.sendIdx["package"]=1;
  52262. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  52263. $ctx1.sendIdx["=="]=3;
  52264. $self._assert_($5);
  52265. $ctx1.sendIdx["assert:"]=3;
  52266. $8=$recv($self["@theClass"])._methodDictionary();
  52267. $ctx1.sendIdx["methodDictionary"]=1;
  52268. $7=$recv($8)._keys();
  52269. $ctx1.sendIdx["keys"]=1;
  52270. $self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  52271. $ctx1.sendIdx["assert:equals:"]=2;
  52272. instance=$recv($self["@theClass"])._new();
  52273. $self._assert_($recv($recv(instance)._class()).__eq_eq($self["@theClass"]));
  52274. $self._assert_equals_($recv(instance)._value(),(4));
  52275. $ctx1.sendIdx["assert:equals:"]=3;
  52276. $self._shouldnt_raise_((function(){
  52277. return $core.withContext(function($ctx2) {
  52278. return $recv(instance)._foo_((9));
  52279. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52280. }),$globals.Error);
  52281. $self._assert_equals_($recv(instance)._foo(),(9));
  52282. return self;
  52283. }, function($ctx1) {$ctx1.fill(self,"testSetJavaScriptConstructor",{instance:instance},$globals.ClassTest)});
  52284. },
  52285. args: [],
  52286. 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",
  52287. referencedClasses: ["ObjectMock", "Error"],
  52288. messageSends: ["copyClass:named:", "javascriptConstructor:", "jsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  52289. }),
  52290. $globals.ClassTest);
  52291. $core.addMethod(
  52292. $core.method({
  52293. selector: "testTrickySetJavaScriptConstructor",
  52294. protocol: "tests",
  52295. fn: function (){
  52296. var self=this,$self=this;
  52297. var instance;
  52298. return $core.withContext(function($ctx1) {
  52299. var $2,$1,$4,$3,$6,$5,$8,$7;
  52300. $self["@theClass"]=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  52301. $recv($self["@theClass"])._javascriptConstructor_($self._trickyJsConstructor());
  52302. $2=$recv($self["@theClass"])._superclass();
  52303. $ctx1.sendIdx["superclass"]=1;
  52304. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  52305. $ctx1.sendIdx["=="]=1;
  52306. $self._assert_($1);
  52307. $ctx1.sendIdx["assert:"]=1;
  52308. $4=$recv($self["@theClass"])._instanceVariableNames();
  52309. $ctx1.sendIdx["instanceVariableNames"]=1;
  52310. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  52311. $ctx1.sendIdx["=="]=2;
  52312. $self._assert_($3);
  52313. $ctx1.sendIdx["assert:"]=2;
  52314. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  52315. $ctx1.sendIdx["assert:equals:"]=1;
  52316. $6=$recv($self["@theClass"])._package();
  52317. $ctx1.sendIdx["package"]=1;
  52318. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  52319. $ctx1.sendIdx["=="]=3;
  52320. $self._assert_($5);
  52321. $ctx1.sendIdx["assert:"]=3;
  52322. $8=$recv($self["@theClass"])._methodDictionary();
  52323. $ctx1.sendIdx["methodDictionary"]=1;
  52324. $7=$recv($8)._keys();
  52325. $ctx1.sendIdx["keys"]=1;
  52326. $self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  52327. $ctx1.sendIdx["assert:equals:"]=2;
  52328. instance=$recv($self["@theClass"])._new();
  52329. $self._assert_($recv($recv(instance)._class()).__eq_eq($self["@theClass"]));
  52330. $self._assert_equals_($recv(instance)._value(),(4));
  52331. $ctx1.sendIdx["assert:equals:"]=3;
  52332. $self._shouldnt_raise_((function(){
  52333. return $core.withContext(function($ctx2) {
  52334. return $recv(instance)._foo_((9));
  52335. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52336. }),$globals.Error);
  52337. $self._assert_equals_($recv(instance)._foo(),(9));
  52338. return self;
  52339. }, function($ctx1) {$ctx1.fill(self,"testTrickySetJavaScriptConstructor",{instance:instance},$globals.ClassTest)});
  52340. },
  52341. args: [],
  52342. 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",
  52343. referencedClasses: ["ObjectMock", "Error"],
  52344. messageSends: ["copyClass:named:", "javascriptConstructor:", "trickyJsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  52345. }),
  52346. $globals.ClassTest);
  52347. $core.addMethod(
  52348. $core.method({
  52349. selector: "trickyJsConstructor",
  52350. protocol: "running",
  52351. fn: function (){
  52352. var self=this,$self=this;
  52353. return $core.withContext(function($ctx1) {
  52354. function Foo(){}
  52355. Foo.prototype.valueOf = function () {return 4;};
  52356. Foo.prototype._foo = function () {return "bar";};
  52357. return Foo;
  52358. ;
  52359. return self;
  52360. }, function($ctx1) {$ctx1.fill(self,"trickyJsConstructor",{},$globals.ClassTest)});
  52361. },
  52362. args: [],
  52363. 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'>",
  52364. referencedClasses: [],
  52365. messageSends: []
  52366. }),
  52367. $globals.ClassTest);
  52368. $core.addClass("CollectionTest", $globals.TestCase, ["sampleBlock"], "Kernel-Tests");
  52369. $core.addMethod(
  52370. $core.method({
  52371. selector: "assertSameContents:as:",
  52372. protocol: "convenience",
  52373. fn: function (aCollection,anotherCollection){
  52374. var self=this,$self=this;
  52375. return $core.withContext(function($ctx1) {
  52376. var $2,$1,$4,$3;
  52377. $2=$recv(aCollection)._size();
  52378. $ctx1.sendIdx["size"]=1;
  52379. $1=$recv($2).__eq($recv(anotherCollection)._size());
  52380. $ctx1.sendIdx["="]=1;
  52381. $self._assert_($1);
  52382. $ctx1.sendIdx["assert:"]=1;
  52383. $recv(aCollection)._do_((function(each){
  52384. return $core.withContext(function($ctx2) {
  52385. $4=$recv(aCollection)._occurrencesOf_(each);
  52386. $ctx2.sendIdx["occurrencesOf:"]=1;
  52387. $3=$recv($4).__eq($recv(anotherCollection)._occurrencesOf_(each));
  52388. return $self._assert_($3);
  52389. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52390. }));
  52391. return self;
  52392. }, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},$globals.CollectionTest)});
  52393. },
  52394. args: ["aCollection", "anotherCollection"],
  52395. 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)) ]",
  52396. referencedClasses: [],
  52397. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"]
  52398. }),
  52399. $globals.CollectionTest);
  52400. $core.addMethod(
  52401. $core.method({
  52402. selector: "collection",
  52403. protocol: "fixture",
  52404. fn: function (){
  52405. var self=this,$self=this;
  52406. return $core.withContext(function($ctx1) {
  52407. $self._subclassResponsibility();
  52408. return self;
  52409. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.CollectionTest)});
  52410. },
  52411. args: [],
  52412. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  52413. referencedClasses: [],
  52414. messageSends: ["subclassResponsibility"]
  52415. }),
  52416. $globals.CollectionTest);
  52417. $core.addMethod(
  52418. $core.method({
  52419. selector: "collectionClass",
  52420. protocol: "fixture",
  52421. fn: function (){
  52422. var self=this,$self=this;
  52423. return $core.withContext(function($ctx1) {
  52424. return $recv($self._class())._collectionClass();
  52425. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.CollectionTest)});
  52426. },
  52427. args: [],
  52428. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  52429. referencedClasses: [],
  52430. messageSends: ["collectionClass", "class"]
  52431. }),
  52432. $globals.CollectionTest);
  52433. $core.addMethod(
  52434. $core.method({
  52435. selector: "collectionOfPrintStrings",
  52436. protocol: "fixture",
  52437. fn: function (){
  52438. var self=this,$self=this;
  52439. return $core.withContext(function($ctx1) {
  52440. $self._subclassResponsibility();
  52441. return self;
  52442. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.CollectionTest)});
  52443. },
  52444. args: [],
  52445. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  52446. referencedClasses: [],
  52447. messageSends: ["subclassResponsibility"]
  52448. }),
  52449. $globals.CollectionTest);
  52450. $core.addMethod(
  52451. $core.method({
  52452. selector: "collectionSize",
  52453. protocol: "fixture",
  52454. fn: function (){
  52455. var self=this,$self=this;
  52456. return $core.withContext(function($ctx1) {
  52457. $self._subclassResponsibility();
  52458. return self;
  52459. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},$globals.CollectionTest)});
  52460. },
  52461. args: [],
  52462. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  52463. referencedClasses: [],
  52464. messageSends: ["subclassResponsibility"]
  52465. }),
  52466. $globals.CollectionTest);
  52467. $core.addMethod(
  52468. $core.method({
  52469. selector: "collectionWithDuplicates",
  52470. protocol: "fixture",
  52471. fn: function (){
  52472. var self=this,$self=this;
  52473. return $core.withContext(function($ctx1) {
  52474. $self._subclassResponsibility();
  52475. return self;
  52476. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.CollectionTest)});
  52477. },
  52478. args: [],
  52479. 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",
  52480. referencedClasses: [],
  52481. messageSends: ["subclassResponsibility"]
  52482. }),
  52483. $globals.CollectionTest);
  52484. $core.addMethod(
  52485. $core.method({
  52486. selector: "collectionWithNewValue",
  52487. protocol: "fixture",
  52488. fn: function (){
  52489. var self=this,$self=this;
  52490. return $core.withContext(function($ctx1) {
  52491. $self._subclassResponsibility();
  52492. return self;
  52493. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.CollectionTest)});
  52494. },
  52495. args: [],
  52496. 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",
  52497. referencedClasses: [],
  52498. messageSends: ["subclassResponsibility"]
  52499. }),
  52500. $globals.CollectionTest);
  52501. $core.addMethod(
  52502. $core.method({
  52503. selector: "initialize",
  52504. protocol: "initialization",
  52505. fn: function (){
  52506. var self=this,$self=this;
  52507. return $core.withContext(function($ctx1) {
  52508. (
  52509. $ctx1.supercall = true,
  52510. ($globals.CollectionTest.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  52511. $ctx1.supercall = false;
  52512. $self["@sampleBlock"]=(function(){
  52513. });
  52514. return self;
  52515. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.CollectionTest)});
  52516. },
  52517. args: [],
  52518. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09sampleBlock := []",
  52519. referencedClasses: [],
  52520. messageSends: ["initialize"]
  52521. }),
  52522. $globals.CollectionTest);
  52523. $core.addMethod(
  52524. $core.method({
  52525. selector: "sampleNewValue",
  52526. protocol: "fixture",
  52527. fn: function (){
  52528. var self=this,$self=this;
  52529. return "N";
  52530. },
  52531. args: [],
  52532. 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'",
  52533. referencedClasses: [],
  52534. messageSends: []
  52535. }),
  52536. $globals.CollectionTest);
  52537. $core.addMethod(
  52538. $core.method({
  52539. selector: "sampleNewValueAsCollection",
  52540. protocol: "fixture",
  52541. fn: function (){
  52542. var self=this,$self=this;
  52543. return $core.withContext(function($ctx1) {
  52544. return $recv($self._collectionClass())._with_($self._sampleNewValue());
  52545. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.CollectionTest)});
  52546. },
  52547. args: [],
  52548. 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",
  52549. referencedClasses: [],
  52550. messageSends: ["with:", "collectionClass", "sampleNewValue"]
  52551. }),
  52552. $globals.CollectionTest);
  52553. $core.addMethod(
  52554. $core.method({
  52555. selector: "testAddAll",
  52556. protocol: "tests",
  52557. fn: function (){
  52558. var self=this,$self=this;
  52559. return $core.withContext(function($ctx1) {
  52560. 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;
  52561. $2=$self._collection();
  52562. $ctx1.sendIdx["collection"]=1;
  52563. $4=$self._collectionClass();
  52564. $ctx1.sendIdx["collectionClass"]=1;
  52565. $3=$recv($4)._new();
  52566. $ctx1.sendIdx["new"]=1;
  52567. $recv($2)._addAll_($3);
  52568. $ctx1.sendIdx["addAll:"]=1;
  52569. $5=$recv($2)._yourself();
  52570. $ctx1.sendIdx["yourself"]=1;
  52571. $1=$5;
  52572. $6=$self._collection();
  52573. $ctx1.sendIdx["collection"]=2;
  52574. $self._assert_equals_($1,$6);
  52575. $ctx1.sendIdx["assert:equals:"]=1;
  52576. $9=$self._collectionClass();
  52577. $ctx1.sendIdx["collectionClass"]=2;
  52578. $8=$recv($9)._new();
  52579. $ctx1.sendIdx["new"]=2;
  52580. $10=$self._collection();
  52581. $ctx1.sendIdx["collection"]=3;
  52582. $recv($8)._addAll_($10);
  52583. $ctx1.sendIdx["addAll:"]=2;
  52584. $11=$recv($8)._yourself();
  52585. $ctx1.sendIdx["yourself"]=2;
  52586. $7=$11;
  52587. $12=$self._collection();
  52588. $ctx1.sendIdx["collection"]=4;
  52589. $self._assert_equals_($7,$12);
  52590. $ctx1.sendIdx["assert:equals:"]=2;
  52591. $15=$self._collectionClass();
  52592. $ctx1.sendIdx["collectionClass"]=3;
  52593. $14=$recv($15)._new();
  52594. $ctx1.sendIdx["new"]=3;
  52595. $17=$self._collectionClass();
  52596. $ctx1.sendIdx["collectionClass"]=4;
  52597. $16=$recv($17)._new();
  52598. $ctx1.sendIdx["new"]=4;
  52599. $recv($14)._addAll_($16);
  52600. $ctx1.sendIdx["addAll:"]=3;
  52601. $18=$recv($14)._yourself();
  52602. $ctx1.sendIdx["yourself"]=3;
  52603. $13=$18;
  52604. $self._assert_equals_($13,$recv($self._collectionClass())._new());
  52605. $ctx1.sendIdx["assert:equals:"]=3;
  52606. $20=$self._collection();
  52607. $ctx1.sendIdx["collection"]=5;
  52608. $21=$self._sampleNewValueAsCollection();
  52609. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  52610. $recv($20)._addAll_($21);
  52611. $ctx1.sendIdx["addAll:"]=4;
  52612. $22=$recv($20)._yourself();
  52613. $ctx1.sendIdx["yourself"]=4;
  52614. $19=$22;
  52615. $23=$self._collectionWithNewValue();
  52616. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52617. $self._assert_equals_($19,$23);
  52618. $25=$self._sampleNewValueAsCollection();
  52619. $recv($25)._addAll_($self._collection());
  52620. $24=$recv($25)._yourself();
  52621. $self._assertSameContents_as_($24,$self._collectionWithNewValue());
  52622. return self;
  52623. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.CollectionTest)});
  52624. },
  52625. args: [],
  52626. 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",
  52627. referencedClasses: [],
  52628. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  52629. }),
  52630. $globals.CollectionTest);
  52631. $core.addMethod(
  52632. $core.method({
  52633. selector: "testAllSatisfy",
  52634. protocol: "tests",
  52635. fn: function (){
  52636. var self=this,$self=this;
  52637. var collection,anyOne;
  52638. return $core.withContext(function($ctx1) {
  52639. var $1;
  52640. collection=$self._collection();
  52641. anyOne=$recv(collection)._anyOne();
  52642. $1=$recv(collection)._allSatisfy_((function(each){
  52643. return $core.withContext(function($ctx2) {
  52644. return $recv(collection)._includes_(each);
  52645. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52646. }));
  52647. $ctx1.sendIdx["allSatisfy:"]=1;
  52648. $self._assert_($1);
  52649. $self._deny_($recv(collection)._allSatisfy_((function(each){
  52650. return $core.withContext(function($ctx2) {
  52651. return $recv(each).__tild_eq(anyOne);
  52652. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52653. })));
  52654. return self;
  52655. }, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},$globals.CollectionTest)});
  52656. },
  52657. args: [],
  52658. 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 ])",
  52659. referencedClasses: [],
  52660. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="]
  52661. }),
  52662. $globals.CollectionTest);
  52663. $core.addMethod(
  52664. $core.method({
  52665. selector: "testAnyOne",
  52666. protocol: "tests",
  52667. fn: function (){
  52668. var self=this,$self=this;
  52669. return $core.withContext(function($ctx1) {
  52670. var $2,$1;
  52671. $self._should_raise_((function(){
  52672. return $core.withContext(function($ctx2) {
  52673. return $recv($recv($self._collectionClass())._new())._anyOne();
  52674. $ctx2.sendIdx["anyOne"]=1;
  52675. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52676. }),$globals.Error);
  52677. $2=$self._collection();
  52678. $ctx1.sendIdx["collection"]=1;
  52679. $1=$recv($2)._includes_($recv($self._collection())._anyOne());
  52680. $self._assert_($1);
  52681. return self;
  52682. }, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},$globals.CollectionTest)});
  52683. },
  52684. args: [],
  52685. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  52686. referencedClasses: ["Error"],
  52687. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"]
  52688. }),
  52689. $globals.CollectionTest);
  52690. $core.addMethod(
  52691. $core.method({
  52692. selector: "testAnySatisfy",
  52693. protocol: "tests",
  52694. fn: function (){
  52695. var self=this,$self=this;
  52696. var anyOne;
  52697. return $core.withContext(function($ctx1) {
  52698. var $1,$3,$2;
  52699. $1=$self._collection();
  52700. $ctx1.sendIdx["collection"]=1;
  52701. anyOne=$recv($1)._anyOne();
  52702. $3=$self._collection();
  52703. $ctx1.sendIdx["collection"]=2;
  52704. $2=$recv($3)._anySatisfy_((function(each){
  52705. return $core.withContext(function($ctx2) {
  52706. return $recv(each).__eq(anyOne);
  52707. $ctx2.sendIdx["="]=1;
  52708. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52709. }));
  52710. $ctx1.sendIdx["anySatisfy:"]=1;
  52711. $self._assert_($2);
  52712. $self._deny_($recv($self._collection())._anySatisfy_((function(each){
  52713. return $core.withContext(function($ctx2) {
  52714. return $recv(each).__eq($recv($globals.Object)._new());
  52715. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52716. })));
  52717. return self;
  52718. }, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  52719. },
  52720. args: [],
  52721. 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 ])",
  52722. referencedClasses: ["Object"],
  52723. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"]
  52724. }),
  52725. $globals.CollectionTest);
  52726. $core.addMethod(
  52727. $core.method({
  52728. selector: "testAsArray",
  52729. protocol: "tests",
  52730. fn: function (){
  52731. var self=this,$self=this;
  52732. return $core.withContext(function($ctx1) {
  52733. var $1;
  52734. $1=$self._collection();
  52735. $ctx1.sendIdx["collection"]=1;
  52736. $self._assertSameContents_as_($1,$recv($self._collection())._asArray());
  52737. return self;
  52738. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.CollectionTest)});
  52739. },
  52740. args: [],
  52741. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  52742. referencedClasses: [],
  52743. messageSends: ["assertSameContents:as:", "collection", "asArray"]
  52744. }),
  52745. $globals.CollectionTest);
  52746. $core.addMethod(
  52747. $core.method({
  52748. selector: "testAsOrderedCollection",
  52749. protocol: "tests",
  52750. fn: function (){
  52751. var self=this,$self=this;
  52752. return $core.withContext(function($ctx1) {
  52753. var $1;
  52754. $1=$self._collection();
  52755. $ctx1.sendIdx["collection"]=1;
  52756. $self._assertSameContents_as_($1,$recv($self._collection())._asOrderedCollection());
  52757. return self;
  52758. }, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},$globals.CollectionTest)});
  52759. },
  52760. args: [],
  52761. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  52762. referencedClasses: [],
  52763. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"]
  52764. }),
  52765. $globals.CollectionTest);
  52766. $core.addMethod(
  52767. $core.method({
  52768. selector: "testAsSet",
  52769. protocol: "tests",
  52770. fn: function (){
  52771. var self=this,$self=this;
  52772. var c,set;
  52773. return $core.withContext(function($ctx1) {
  52774. c=$self._collectionWithDuplicates();
  52775. set=$recv(c)._asSet();
  52776. $self._assert_equals_($recv(set)._size(),(6));
  52777. $recv(c)._do_((function(each){
  52778. return $core.withContext(function($ctx2) {
  52779. return $self._assert_($recv(set)._includes_(each));
  52780. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52781. }));
  52782. return self;
  52783. }, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},$globals.CollectionTest)});
  52784. },
  52785. args: [],
  52786. 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) ]",
  52787. referencedClasses: [],
  52788. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"]
  52789. }),
  52790. $globals.CollectionTest);
  52791. $core.addMethod(
  52792. $core.method({
  52793. selector: "testCollect",
  52794. protocol: "tests",
  52795. fn: function (){
  52796. var self=this,$self=this;
  52797. return $core.withContext(function($ctx1) {
  52798. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  52799. $2=$self._collection();
  52800. $ctx1.sendIdx["collection"]=1;
  52801. $1=$recv($2)._collect_((function(each){
  52802. return each;
  52803. }));
  52804. $ctx1.sendIdx["collect:"]=1;
  52805. $3=$self._collection();
  52806. $ctx1.sendIdx["collection"]=2;
  52807. $self._assert_equals_($1,$3);
  52808. $ctx1.sendIdx["assert:equals:"]=1;
  52809. $5=$self._collectionWithNewValue();
  52810. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52811. $4=$recv($5)._collect_((function(each){
  52812. return each;
  52813. }));
  52814. $ctx1.sendIdx["collect:"]=2;
  52815. $self._assert_equals_($4,$self._collectionWithNewValue());
  52816. $ctx1.sendIdx["assert:equals:"]=2;
  52817. $8=$self._collectionClass();
  52818. $ctx1.sendIdx["collectionClass"]=1;
  52819. $7=$recv($8)._new();
  52820. $ctx1.sendIdx["new"]=1;
  52821. $6=$recv($7)._collect_((function(each){
  52822. return $core.withContext(function($ctx2) {
  52823. return $recv(each)._printString();
  52824. $ctx2.sendIdx["printString"]=1;
  52825. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  52826. }));
  52827. $ctx1.sendIdx["collect:"]=3;
  52828. $self._assert_equals_($6,$recv($self._collectionClass())._new());
  52829. $ctx1.sendIdx["assert:equals:"]=3;
  52830. $11=$self._collection();
  52831. $ctx1.sendIdx["collection"]=3;
  52832. $10=$recv($11)._collect_((function(){
  52833. return $core.withContext(function($ctx2) {
  52834. return $self._sampleNewValue();
  52835. $ctx2.sendIdx["sampleNewValue"]=1;
  52836. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  52837. }));
  52838. $ctx1.sendIdx["collect:"]=4;
  52839. $9=$recv($10)._detect_((function(){
  52840. return true;
  52841. }));
  52842. $self._assert_equals_($9,$self._sampleNewValue());
  52843. $ctx1.sendIdx["assert:equals:"]=4;
  52844. $self._assert_equals_($recv($self._collection())._collect_((function(each){
  52845. return $core.withContext(function($ctx2) {
  52846. return $recv(each)._printString();
  52847. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  52848. })),$self._collectionOfPrintStrings());
  52849. return self;
  52850. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.CollectionTest)});
  52851. },
  52852. args: [],
  52853. 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",
  52854. referencedClasses: [],
  52855. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"]
  52856. }),
  52857. $globals.CollectionTest);
  52858. $core.addMethod(
  52859. $core.method({
  52860. selector: "testComma",
  52861. protocol: "tests",
  52862. fn: function (){
  52863. var self=this,$self=this;
  52864. return $core.withContext(function($ctx1) {
  52865. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  52866. $2=$self._collection();
  52867. $ctx1.sendIdx["collection"]=1;
  52868. $4=$self._collectionClass();
  52869. $ctx1.sendIdx["collectionClass"]=1;
  52870. $3=$recv($4)._new();
  52871. $ctx1.sendIdx["new"]=1;
  52872. $1=$recv($2).__comma($3);
  52873. $ctx1.sendIdx[","]=1;
  52874. $5=$self._collection();
  52875. $ctx1.sendIdx["collection"]=2;
  52876. $self._assert_equals_($1,$5);
  52877. $ctx1.sendIdx["assert:equals:"]=1;
  52878. $8=$self._collectionClass();
  52879. $ctx1.sendIdx["collectionClass"]=2;
  52880. $7=$recv($8)._new();
  52881. $ctx1.sendIdx["new"]=2;
  52882. $9=$self._collection();
  52883. $ctx1.sendIdx["collection"]=3;
  52884. $6=$recv($7).__comma($9);
  52885. $ctx1.sendIdx[","]=2;
  52886. $10=$self._collection();
  52887. $ctx1.sendIdx["collection"]=4;
  52888. $self._assert_equals_($6,$10);
  52889. $ctx1.sendIdx["assert:equals:"]=2;
  52890. $13=$self._collectionClass();
  52891. $ctx1.sendIdx["collectionClass"]=3;
  52892. $12=$recv($13)._new();
  52893. $ctx1.sendIdx["new"]=3;
  52894. $15=$self._collectionClass();
  52895. $ctx1.sendIdx["collectionClass"]=4;
  52896. $14=$recv($15)._new();
  52897. $ctx1.sendIdx["new"]=4;
  52898. $11=$recv($12).__comma($14);
  52899. $ctx1.sendIdx[","]=3;
  52900. $self._assert_equals_($11,$recv($self._collectionClass())._new());
  52901. $ctx1.sendIdx["assert:equals:"]=3;
  52902. $17=$self._collection();
  52903. $ctx1.sendIdx["collection"]=5;
  52904. $18=$self._sampleNewValueAsCollection();
  52905. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  52906. $16=$recv($17).__comma($18);
  52907. $ctx1.sendIdx[","]=4;
  52908. $19=$self._collectionWithNewValue();
  52909. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52910. $self._assert_equals_($16,$19);
  52911. $self._assertSameContents_as_($recv($self._sampleNewValueAsCollection()).__comma($self._collection()),$self._collectionWithNewValue());
  52912. return self;
  52913. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.CollectionTest)});
  52914. },
  52915. args: [],
  52916. 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",
  52917. referencedClasses: [],
  52918. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  52919. }),
  52920. $globals.CollectionTest);
  52921. $core.addMethod(
  52922. $core.method({
  52923. selector: "testCopy",
  52924. protocol: "tests",
  52925. fn: function (){
  52926. var self=this,$self=this;
  52927. return $core.withContext(function($ctx1) {
  52928. var $3,$2,$1,$5,$4,$7,$6,$8,$10,$9,$11,$15,$14,$13,$16,$12,$19,$18,$17;
  52929. $3=$self._collectionClass();
  52930. $ctx1.sendIdx["collectionClass"]=1;
  52931. $2=$recv($3)._new();
  52932. $ctx1.sendIdx["new"]=1;
  52933. $1=$recv($2)._copy();
  52934. $ctx1.sendIdx["copy"]=1;
  52935. $5=$self._collectionClass();
  52936. $ctx1.sendIdx["collectionClass"]=2;
  52937. $4=$recv($5)._new();
  52938. $ctx1.sendIdx["new"]=2;
  52939. $self._assert_equals_($1,$4);
  52940. $ctx1.sendIdx["assert:equals:"]=1;
  52941. $7=$self._collection();
  52942. $ctx1.sendIdx["collection"]=1;
  52943. $6=$recv($7)._copy();
  52944. $ctx1.sendIdx["copy"]=2;
  52945. $8=$self._collection();
  52946. $ctx1.sendIdx["collection"]=2;
  52947. $self._assert_equals_($6,$8);
  52948. $ctx1.sendIdx["assert:equals:"]=2;
  52949. $10=$self._collectionWithNewValue();
  52950. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52951. $9=$recv($10)._copy();
  52952. $ctx1.sendIdx["copy"]=3;
  52953. $11=$self._collectionWithNewValue();
  52954. $ctx1.sendIdx["collectionWithNewValue"]=2;
  52955. $self._assert_equals_($9,$11);
  52956. $15=$self._collectionClass();
  52957. $ctx1.sendIdx["collectionClass"]=3;
  52958. $14=$recv($15)._new();
  52959. $ctx1.sendIdx["new"]=3;
  52960. $13=$recv($14)._copy();
  52961. $ctx1.sendIdx["copy"]=4;
  52962. $16=$self._collection();
  52963. $ctx1.sendIdx["collection"]=3;
  52964. $12=$recv($13).__eq($16);
  52965. $ctx1.sendIdx["="]=1;
  52966. $self._deny_($12);
  52967. $ctx1.sendIdx["deny:"]=1;
  52968. $19=$self._collection();
  52969. $ctx1.sendIdx["collection"]=4;
  52970. $18=$recv($19)._copy();
  52971. $ctx1.sendIdx["copy"]=5;
  52972. $17=$recv($18).__eq($recv($self._collectionClass())._new());
  52973. $ctx1.sendIdx["="]=2;
  52974. $self._deny_($17);
  52975. $ctx1.sendIdx["deny:"]=2;
  52976. $self._deny_($recv($recv($self._collection())._copy()).__eq($self._collectionWithNewValue()));
  52977. return self;
  52978. }, function($ctx1) {$ctx1.fill(self,"testCopy",{},$globals.CollectionTest)});
  52979. },
  52980. args: [],
  52981. 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",
  52982. referencedClasses: [],
  52983. messageSends: ["assert:equals:", "copy", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  52984. }),
  52985. $globals.CollectionTest);
  52986. $core.addMethod(
  52987. $core.method({
  52988. selector: "testCopySeparates",
  52989. protocol: "tests",
  52990. fn: function (){
  52991. var self=this,$self=this;
  52992. var original,copy;
  52993. return $core.withContext(function($ctx1) {
  52994. original=$self._collection();
  52995. $ctx1.sendIdx["collection"]=1;
  52996. copy=$recv(original)._copy();
  52997. $recv(copy)._addAll_($self._sampleNewValueAsCollection());
  52998. $self._assert_($recv(original).__eq($self._collection()));
  52999. return self;
  53000. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{original:original,copy:copy},$globals.CollectionTest)});
  53001. },
  53002. args: [],
  53003. 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",
  53004. referencedClasses: [],
  53005. messageSends: ["collection", "copy", "addAll:", "sampleNewValueAsCollection", "assert:", "="]
  53006. }),
  53007. $globals.CollectionTest);
  53008. $core.addMethod(
  53009. $core.method({
  53010. selector: "testDetect",
  53011. protocol: "tests",
  53012. fn: function (){
  53013. var self=this,$self=this;
  53014. return $core.withContext(function($ctx1) {
  53015. var $1,$2,$3,$4,$6,$5,$7;
  53016. $self._shouldnt_raise_((function(){
  53017. return $core.withContext(function($ctx2) {
  53018. $1=$self._collection();
  53019. $ctx2.sendIdx["collection"]=1;
  53020. return $recv($1)._detect_((function(){
  53021. return true;
  53022. }));
  53023. $ctx2.sendIdx["detect:"]=1;
  53024. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53025. }),$globals.Error);
  53026. $self._should_raise_((function(){
  53027. return $core.withContext(function($ctx2) {
  53028. $2=$self._collection();
  53029. $ctx2.sendIdx["collection"]=2;
  53030. return $recv($2)._detect_((function(){
  53031. return false;
  53032. }));
  53033. $ctx2.sendIdx["detect:"]=2;
  53034. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  53035. }),$globals.Error);
  53036. $ctx1.sendIdx["should:raise:"]=1;
  53037. $3=$recv($self._sampleNewValueAsCollection())._detect_((function(){
  53038. return true;
  53039. }));
  53040. $ctx1.sendIdx["detect:"]=3;
  53041. $4=$self._sampleNewValue();
  53042. $ctx1.sendIdx["sampleNewValue"]=1;
  53043. $self._assert_equals_($3,$4);
  53044. $ctx1.sendIdx["assert:equals:"]=1;
  53045. $5=$recv($self._collectionWithNewValue())._detect_((function(each){
  53046. return $core.withContext(function($ctx2) {
  53047. $6=$self._sampleNewValue();
  53048. $ctx2.sendIdx["sampleNewValue"]=2;
  53049. return $recv(each).__eq($6);
  53050. $ctx2.sendIdx["="]=1;
  53051. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  53052. }));
  53053. $ctx1.sendIdx["detect:"]=4;
  53054. $7=$self._sampleNewValue();
  53055. $ctx1.sendIdx["sampleNewValue"]=3;
  53056. $self._assert_equals_($5,$7);
  53057. $self._should_raise_((function(){
  53058. return $core.withContext(function($ctx2) {
  53059. return $recv($self._collection())._detect_((function(each){
  53060. return $core.withContext(function($ctx3) {
  53061. return $recv(each).__eq($self._sampleNewValue());
  53062. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)});
  53063. }));
  53064. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  53065. }),$globals.Error);
  53066. return self;
  53067. }, function($ctx1) {$ctx1.fill(self,"testDetect",{},$globals.CollectionTest)});
  53068. },
  53069. args: [],
  53070. 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",
  53071. referencedClasses: ["Error"],
  53072. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  53073. }),
  53074. $globals.CollectionTest);
  53075. $core.addMethod(
  53076. $core.method({
  53077. selector: "testDetectIfNone",
  53078. protocol: "tests",
  53079. fn: function (){
  53080. var self=this,$self=this;
  53081. var sentinel;
  53082. return $core.withContext(function($ctx1) {
  53083. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  53084. sentinel=$recv($globals.Object)._new();
  53085. $3=$self._collection();
  53086. $ctx1.sendIdx["collection"]=1;
  53087. $2=$recv($3)._detect_ifNone_((function(){
  53088. return true;
  53089. }),(function(){
  53090. return sentinel;
  53091. }));
  53092. $ctx1.sendIdx["detect:ifNone:"]=1;
  53093. $1=$recv($2).__tild_eq(sentinel);
  53094. $self._assert_($1);
  53095. $5=$self._collection();
  53096. $ctx1.sendIdx["collection"]=2;
  53097. $4=$recv($5)._detect_ifNone_((function(){
  53098. return false;
  53099. }),(function(){
  53100. return sentinel;
  53101. }));
  53102. $ctx1.sendIdx["detect:ifNone:"]=2;
  53103. $self._assert_equals_($4,sentinel);
  53104. $ctx1.sendIdx["assert:equals:"]=1;
  53105. $6=$recv($self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  53106. return true;
  53107. }),(function(){
  53108. return sentinel;
  53109. }));
  53110. $ctx1.sendIdx["detect:ifNone:"]=3;
  53111. $7=$self._sampleNewValue();
  53112. $ctx1.sendIdx["sampleNewValue"]=1;
  53113. $self._assert_equals_($6,$7);
  53114. $ctx1.sendIdx["assert:equals:"]=2;
  53115. $8=$recv($self._collectionWithNewValue())._detect_ifNone_((function(each){
  53116. return $core.withContext(function($ctx2) {
  53117. $9=$self._sampleNewValue();
  53118. $ctx2.sendIdx["sampleNewValue"]=2;
  53119. return $recv(each).__eq($9);
  53120. $ctx2.sendIdx["="]=1;
  53121. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)});
  53122. }),(function(){
  53123. return sentinel;
  53124. }));
  53125. $ctx1.sendIdx["detect:ifNone:"]=4;
  53126. $10=$self._sampleNewValue();
  53127. $ctx1.sendIdx["sampleNewValue"]=3;
  53128. $self._assert_equals_($8,$10);
  53129. $ctx1.sendIdx["assert:equals:"]=3;
  53130. $self._assert_equals_($recv($self._collection())._detect_ifNone_((function(each){
  53131. return $core.withContext(function($ctx2) {
  53132. return $recv(each).__eq($self._sampleNewValue());
  53133. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)});
  53134. }),(function(){
  53135. return sentinel;
  53136. })),sentinel);
  53137. return self;
  53138. }, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},$globals.CollectionTest)});
  53139. },
  53140. args: [],
  53141. 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",
  53142. referencedClasses: ["Object"],
  53143. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  53144. }),
  53145. $globals.CollectionTest);
  53146. $core.addMethod(
  53147. $core.method({
  53148. selector: "testDo",
  53149. protocol: "tests",
  53150. fn: function (){
  53151. var self=this,$self=this;
  53152. var newCollection;
  53153. return $core.withContext(function($ctx1) {
  53154. var $1,$2;
  53155. newCollection=$recv($globals.OrderedCollection)._new();
  53156. $ctx1.sendIdx["new"]=1;
  53157. $1=$self._collection();
  53158. $ctx1.sendIdx["collection"]=1;
  53159. $recv($1)._do_((function(each){
  53160. return $core.withContext(function($ctx2) {
  53161. return $recv(newCollection)._add_(each);
  53162. $ctx2.sendIdx["add:"]=1;
  53163. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53164. }));
  53165. $ctx1.sendIdx["do:"]=1;
  53166. $self._assertSameContents_as_($self._collection(),newCollection);
  53167. $ctx1.sendIdx["assertSameContents:as:"]=1;
  53168. newCollection=$recv($globals.OrderedCollection)._new();
  53169. $2=$self._collectionWithDuplicates();
  53170. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  53171. $recv($2)._do_((function(each){
  53172. return $core.withContext(function($ctx2) {
  53173. return $recv(newCollection)._add_(each);
  53174. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  53175. }));
  53176. $self._assertSameContents_as_($self._collectionWithDuplicates(),newCollection);
  53177. return self;
  53178. }, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},$globals.CollectionTest)});
  53179. },
  53180. args: [],
  53181. 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",
  53182. referencedClasses: ["OrderedCollection"],
  53183. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"]
  53184. }),
  53185. $globals.CollectionTest);
  53186. $core.addMethod(
  53187. $core.method({
  53188. selector: "testEquality",
  53189. protocol: "tests",
  53190. fn: function (){
  53191. var self=this,$self=this;
  53192. return $core.withContext(function($ctx1) {
  53193. var $2,$1,$4,$3,$5,$6,$7,$8,$11,$10,$12,$9,$14,$13;
  53194. $2=$self._collectionClass();
  53195. $ctx1.sendIdx["collectionClass"]=1;
  53196. $1=$recv($2)._new();
  53197. $ctx1.sendIdx["new"]=1;
  53198. $4=$self._collectionClass();
  53199. $ctx1.sendIdx["collectionClass"]=2;
  53200. $3=$recv($4)._new();
  53201. $ctx1.sendIdx["new"]=2;
  53202. $self._assert_equals_($1,$3);
  53203. $ctx1.sendIdx["assert:equals:"]=1;
  53204. $5=$self._collection();
  53205. $ctx1.sendIdx["collection"]=1;
  53206. $6=$self._collection();
  53207. $ctx1.sendIdx["collection"]=2;
  53208. $self._assert_equals_($5,$6);
  53209. $ctx1.sendIdx["assert:equals:"]=2;
  53210. $7=$self._collectionWithNewValue();
  53211. $ctx1.sendIdx["collectionWithNewValue"]=1;
  53212. $8=$self._collectionWithNewValue();
  53213. $ctx1.sendIdx["collectionWithNewValue"]=2;
  53214. $self._assert_equals_($7,$8);
  53215. $11=$self._collectionClass();
  53216. $ctx1.sendIdx["collectionClass"]=3;
  53217. $10=$recv($11)._new();
  53218. $ctx1.sendIdx["new"]=3;
  53219. $12=$self._collection();
  53220. $ctx1.sendIdx["collection"]=3;
  53221. $9=$recv($10).__eq($12);
  53222. $ctx1.sendIdx["="]=1;
  53223. $self._deny_($9);
  53224. $ctx1.sendIdx["deny:"]=1;
  53225. $14=$self._collection();
  53226. $ctx1.sendIdx["collection"]=4;
  53227. $13=$recv($14).__eq($recv($self._collectionClass())._new());
  53228. $ctx1.sendIdx["="]=2;
  53229. $self._deny_($13);
  53230. $ctx1.sendIdx["deny:"]=2;
  53231. $self._deny_($recv($self._collection()).__eq($self._collectionWithNewValue()));
  53232. return self;
  53233. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.CollectionTest)});
  53234. },
  53235. args: [],
  53236. 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",
  53237. referencedClasses: [],
  53238. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  53239. }),
  53240. $globals.CollectionTest);
  53241. $core.addMethod(
  53242. $core.method({
  53243. selector: "testIfEmptyFamily",
  53244. protocol: "tests",
  53245. fn: function (){
  53246. var self=this,$self=this;
  53247. return $core.withContext(function($ctx1) {
  53248. 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;
  53249. $3=$self._collectionClass();
  53250. $ctx1.sendIdx["collectionClass"]=1;
  53251. $2=$recv($3)._new();
  53252. $ctx1.sendIdx["new"]=1;
  53253. $1=$recv($2)._ifEmpty_((function(){
  53254. return (42);
  53255. }));
  53256. $ctx1.sendIdx["ifEmpty:"]=1;
  53257. $self._assert_equals_($1,(42));
  53258. $ctx1.sendIdx["assert:equals:"]=1;
  53259. $5=$self._collection();
  53260. $ctx1.sendIdx["collection"]=1;
  53261. $4=$recv($5)._ifEmpty_((function(){
  53262. return (42);
  53263. }));
  53264. $6=$self._collection();
  53265. $ctx1.sendIdx["collection"]=2;
  53266. $self._assert_equals_($4,$6);
  53267. $ctx1.sendIdx["assert:equals:"]=2;
  53268. $9=$self._collectionClass();
  53269. $ctx1.sendIdx["collectionClass"]=2;
  53270. $8=$recv($9)._new();
  53271. $ctx1.sendIdx["new"]=2;
  53272. $7=$recv($8)._ifNotEmpty_((function(){
  53273. return (42);
  53274. }));
  53275. $ctx1.sendIdx["ifNotEmpty:"]=1;
  53276. $11=$self._collectionClass();
  53277. $ctx1.sendIdx["collectionClass"]=3;
  53278. $10=$recv($11)._new();
  53279. $ctx1.sendIdx["new"]=3;
  53280. $self._assert_equals_($7,$10);
  53281. $ctx1.sendIdx["assert:equals:"]=3;
  53282. $13=$self._collection();
  53283. $ctx1.sendIdx["collection"]=3;
  53284. $12=$recv($13)._ifNotEmpty_((function(){
  53285. return (42);
  53286. }));
  53287. $ctx1.sendIdx["ifNotEmpty:"]=2;
  53288. $self._assert_equals_($12,(42));
  53289. $ctx1.sendIdx["assert:equals:"]=4;
  53290. $15=$self._collection();
  53291. $ctx1.sendIdx["collection"]=4;
  53292. $14=$recv($15)._ifNotEmpty_((function(col){
  53293. return col;
  53294. }));
  53295. $16=$self._collection();
  53296. $ctx1.sendIdx["collection"]=5;
  53297. $self._assert_equals_($14,$16);
  53298. $ctx1.sendIdx["assert:equals:"]=5;
  53299. $19=$self._collectionClass();
  53300. $ctx1.sendIdx["collectionClass"]=4;
  53301. $18=$recv($19)._new();
  53302. $ctx1.sendIdx["new"]=4;
  53303. $17=$recv($18)._ifEmpty_ifNotEmpty_((function(){
  53304. return (42);
  53305. }),(function(){
  53306. return (999);
  53307. }));
  53308. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  53309. $self._assert_equals_($17,(42));
  53310. $ctx1.sendIdx["assert:equals:"]=6;
  53311. $21=$self._collection();
  53312. $ctx1.sendIdx["collection"]=6;
  53313. $20=$recv($21)._ifEmpty_ifNotEmpty_((function(){
  53314. return (42);
  53315. }),(function(){
  53316. return (999);
  53317. }));
  53318. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=2;
  53319. $self._assert_equals_($20,(999));
  53320. $ctx1.sendIdx["assert:equals:"]=7;
  53321. $23=$self._collection();
  53322. $ctx1.sendIdx["collection"]=7;
  53323. $22=$recv($23)._ifEmpty_ifNotEmpty_((function(){
  53324. return (42);
  53325. }),(function(col){
  53326. return col;
  53327. }));
  53328. $24=$self._collection();
  53329. $ctx1.sendIdx["collection"]=8;
  53330. $self._assert_equals_($22,$24);
  53331. $ctx1.sendIdx["assert:equals:"]=8;
  53332. $25=$recv($recv($self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  53333. return (42);
  53334. }),(function(){
  53335. return (999);
  53336. }));
  53337. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  53338. $self._assert_equals_($25,(999));
  53339. $ctx1.sendIdx["assert:equals:"]=9;
  53340. $27=$self._collection();
  53341. $ctx1.sendIdx["collection"]=9;
  53342. $26=$recv($27)._ifNotEmpty_ifEmpty_((function(){
  53343. return (42);
  53344. }),(function(){
  53345. return (999);
  53346. }));
  53347. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=2;
  53348. $self._assert_equals_($26,(42));
  53349. $ctx1.sendIdx["assert:equals:"]=10;
  53350. $29=$self._collection();
  53351. $ctx1.sendIdx["collection"]=10;
  53352. $28=$recv($29)._ifNotEmpty_ifEmpty_((function(col){
  53353. return col;
  53354. }),(function(){
  53355. return (999);
  53356. }));
  53357. $self._assert_equals_($28,$self._collection());
  53358. return self;
  53359. }, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},$globals.CollectionTest)});
  53360. },
  53361. args: [],
  53362. 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.",
  53363. referencedClasses: [],
  53364. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"]
  53365. }),
  53366. $globals.CollectionTest);
  53367. $core.addMethod(
  53368. $core.method({
  53369. selector: "testIsEmpty",
  53370. protocol: "tests",
  53371. fn: function (){
  53372. var self=this,$self=this;
  53373. return $core.withContext(function($ctx1) {
  53374. var $1;
  53375. $1=$recv($recv($self._collectionClass())._new())._isEmpty();
  53376. $ctx1.sendIdx["isEmpty"]=1;
  53377. $self._assert_($1);
  53378. $self._deny_($recv($self._collection())._isEmpty());
  53379. return self;
  53380. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},$globals.CollectionTest)});
  53381. },
  53382. args: [],
  53383. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  53384. referencedClasses: [],
  53385. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"]
  53386. }),
  53387. $globals.CollectionTest);
  53388. $core.addMethod(
  53389. $core.method({
  53390. selector: "testNoneSatisfy",
  53391. protocol: "tests",
  53392. fn: function (){
  53393. var self=this,$self=this;
  53394. var anyOne;
  53395. return $core.withContext(function($ctx1) {
  53396. var $1,$3,$2;
  53397. $1=$self._collection();
  53398. $ctx1.sendIdx["collection"]=1;
  53399. anyOne=$recv($1)._anyOne();
  53400. $3=$self._collection();
  53401. $ctx1.sendIdx["collection"]=2;
  53402. $2=$recv($3)._noneSatisfy_((function(each){
  53403. return $core.withContext(function($ctx2) {
  53404. return $recv(each).__eq(anyOne);
  53405. $ctx2.sendIdx["="]=1;
  53406. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53407. }));
  53408. $ctx1.sendIdx["noneSatisfy:"]=1;
  53409. $self._deny_($2);
  53410. $self._assert_($recv($self._collection())._noneSatisfy_((function(each){
  53411. return $core.withContext(function($ctx2) {
  53412. return $recv(each).__eq($recv($globals.Object)._new());
  53413. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  53414. })));
  53415. return self;
  53416. }, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  53417. },
  53418. args: [],
  53419. 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 ])",
  53420. referencedClasses: ["Object"],
  53421. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"]
  53422. }),
  53423. $globals.CollectionTest);
  53424. $core.addMethod(
  53425. $core.method({
  53426. selector: "testRegression1224",
  53427. protocol: "tests",
  53428. fn: function (){
  53429. var self=this,$self=this;
  53430. return $core.withContext(function($ctx1) {
  53431. var $3,$2,$1;
  53432. $3=$recv($self._collectionClass())._new();
  53433. $recv($3)._remove_ifAbsent_($self._sampleNewValue(),(function(){
  53434. }));
  53435. $2=$recv($3)._yourself();
  53436. $1=$recv($2)._size();
  53437. $self._assert_equals_($1,(0));
  53438. return self;
  53439. }, function($ctx1) {$ctx1.fill(self,"testRegression1224",{},$globals.CollectionTest)});
  53440. },
  53441. args: [],
  53442. source: "testRegression1224\x0a\x09self assert: (self collectionClass new\x0a\x09\x09remove: self sampleNewValue ifAbsent: [];\x0a\x09\x09yourself) size equals: 0",
  53443. referencedClasses: [],
  53444. messageSends: ["assert:equals:", "size", "remove:ifAbsent:", "new", "collectionClass", "sampleNewValue", "yourself"]
  53445. }),
  53446. $globals.CollectionTest);
  53447. $core.addMethod(
  53448. $core.method({
  53449. selector: "testRemoveAll",
  53450. protocol: "tests",
  53451. fn: function (){
  53452. var self=this,$self=this;
  53453. return $core.withContext(function($ctx1) {
  53454. var $2,$1;
  53455. $2=$self._collection();
  53456. $recv($2)._removeAll();
  53457. $1=$recv($2)._yourself();
  53458. $self._assert_equals_($1,$recv($self._collectionClass())._new());
  53459. return self;
  53460. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.CollectionTest)});
  53461. },
  53462. args: [],
  53463. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  53464. referencedClasses: [],
  53465. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"]
  53466. }),
  53467. $globals.CollectionTest);
  53468. $core.addMethod(
  53469. $core.method({
  53470. selector: "testSelect",
  53471. protocol: "tests",
  53472. fn: function (){
  53473. var self=this,$self=this;
  53474. return $core.withContext(function($ctx1) {
  53475. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  53476. $2=$self._collection();
  53477. $ctx1.sendIdx["collection"]=1;
  53478. $1=$recv($2)._select_((function(){
  53479. return false;
  53480. }));
  53481. $ctx1.sendIdx["select:"]=1;
  53482. $4=$self._collectionClass();
  53483. $ctx1.sendIdx["collectionClass"]=1;
  53484. $3=$recv($4)._new();
  53485. $ctx1.sendIdx["new"]=1;
  53486. $self._assert_equals_($1,$3);
  53487. $ctx1.sendIdx["assert:equals:"]=1;
  53488. $6=$self._collection();
  53489. $ctx1.sendIdx["collection"]=2;
  53490. $5=$recv($6)._select_((function(){
  53491. return true;
  53492. }));
  53493. $ctx1.sendIdx["select:"]=2;
  53494. $7=$self._collection();
  53495. $ctx1.sendIdx["collection"]=3;
  53496. $self._assert_equals_($5,$7);
  53497. $ctx1.sendIdx["assert:equals:"]=2;
  53498. $9=$self._collectionWithNewValue();
  53499. $ctx1.sendIdx["collectionWithNewValue"]=1;
  53500. $8=$recv($9)._select_((function(each){
  53501. return $core.withContext(function($ctx2) {
  53502. $10=$self._sampleNewValue();
  53503. $ctx2.sendIdx["sampleNewValue"]=1;
  53504. return $recv(each).__eq($10);
  53505. $ctx2.sendIdx["="]=1;
  53506. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  53507. }));
  53508. $ctx1.sendIdx["select:"]=3;
  53509. $self._assert_equals_($8,$self._sampleNewValueAsCollection());
  53510. $ctx1.sendIdx["assert:equals:"]=3;
  53511. $12=$self._collectionWithNewValue();
  53512. $ctx1.sendIdx["collectionWithNewValue"]=2;
  53513. $11=$recv($12)._select_((function(each){
  53514. return $core.withContext(function($ctx2) {
  53515. $13=$self._sampleNewValue();
  53516. $ctx2.sendIdx["sampleNewValue"]=2;
  53517. return $recv(each).__tild_eq($13);
  53518. $ctx2.sendIdx["~="]=1;
  53519. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  53520. }));
  53521. $ctx1.sendIdx["select:"]=4;
  53522. $14=$self._collection();
  53523. $ctx1.sendIdx["collection"]=4;
  53524. $self._assert_equals_($11,$14);
  53525. $ctx1.sendIdx["assert:equals:"]=4;
  53526. $16=$self._collection();
  53527. $ctx1.sendIdx["collection"]=5;
  53528. $15=$recv($16)._select_((function(each){
  53529. return $core.withContext(function($ctx2) {
  53530. $17=$self._sampleNewValue();
  53531. $ctx2.sendIdx["sampleNewValue"]=3;
  53532. return $recv(each).__eq($17);
  53533. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)});
  53534. }));
  53535. $ctx1.sendIdx["select:"]=5;
  53536. $self._assert_equals_($15,$recv($self._collectionClass())._new());
  53537. $ctx1.sendIdx["assert:equals:"]=5;
  53538. $self._assert_equals_($recv($self._collectionWithNewValue())._select_((function(each){
  53539. return $core.withContext(function($ctx2) {
  53540. return $recv(each).__tild_eq($self._sampleNewValue());
  53541. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  53542. })),$self._collection());
  53543. return self;
  53544. }, function($ctx1) {$ctx1.fill(self,"testSelect",{},$globals.CollectionTest)});
  53545. },
  53546. args: [],
  53547. 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",
  53548. referencedClasses: [],
  53549. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="]
  53550. }),
  53551. $globals.CollectionTest);
  53552. $core.addMethod(
  53553. $core.method({
  53554. selector: "testSelectThenCollect",
  53555. protocol: "tests",
  53556. fn: function (){
  53557. var self=this,$self=this;
  53558. return $core.withContext(function($ctx1) {
  53559. var $2,$1,$4,$3,$6,$5,$7,$9,$8;
  53560. $2=$self._collection();
  53561. $ctx1.sendIdx["collection"]=1;
  53562. $1=$recv($2)._select_thenCollect_((function(){
  53563. return false;
  53564. }),"isString");
  53565. $ctx1.sendIdx["select:thenCollect:"]=1;
  53566. $4=$self._collectionClass();
  53567. $ctx1.sendIdx["collectionClass"]=1;
  53568. $3=$recv($4)._new();
  53569. $ctx1.sendIdx["new"]=1;
  53570. $self._assert_equals_($1,$3);
  53571. $ctx1.sendIdx["assert:equals:"]=1;
  53572. $6=$self._collection();
  53573. $ctx1.sendIdx["collection"]=2;
  53574. $5=$recv($6)._select_thenCollect_((function(){
  53575. return true;
  53576. }),(function(x){
  53577. return x;
  53578. }));
  53579. $ctx1.sendIdx["select:thenCollect:"]=2;
  53580. $7=$self._collection();
  53581. $ctx1.sendIdx["collection"]=3;
  53582. $self._assert_equals_($5,$7);
  53583. $ctx1.sendIdx["assert:equals:"]=2;
  53584. $8=$recv($self._collection())._select_thenCollect_((function(each){
  53585. return $core.withContext(function($ctx2) {
  53586. $9=$self._sampleNewValue();
  53587. $ctx2.sendIdx["sampleNewValue"]=1;
  53588. return $recv(each).__eq($9);
  53589. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  53590. }),(function(x){
  53591. return x;
  53592. }));
  53593. $ctx1.sendIdx["select:thenCollect:"]=3;
  53594. $self._assert_equals_($8,$recv($self._collectionClass())._new());
  53595. $ctx1.sendIdx["assert:equals:"]=3;
  53596. $self._assert_equals_($recv($self._collectionWithNewValue())._select_thenCollect_((function(each){
  53597. return $core.withContext(function($ctx2) {
  53598. return $recv(each).__tild_eq($self._sampleNewValue());
  53599. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  53600. }),"printString"),$self._collectionOfPrintStrings());
  53601. return self;
  53602. }, function($ctx1) {$ctx1.fill(self,"testSelectThenCollect",{},$globals.CollectionTest)});
  53603. },
  53604. args: [],
  53605. 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",
  53606. referencedClasses: [],
  53607. messageSends: ["assert:equals:", "select:thenCollect:", "collection", "new", "collectionClass", "=", "sampleNewValue", "collectionWithNewValue", "~=", "collectionOfPrintStrings"]
  53608. }),
  53609. $globals.CollectionTest);
  53610. $core.addMethod(
  53611. $core.method({
  53612. selector: "testSingle",
  53613. protocol: "tests",
  53614. fn: function (){
  53615. var self=this,$self=this;
  53616. return $core.withContext(function($ctx1) {
  53617. $self._should_raise_((function(){
  53618. return $core.withContext(function($ctx2) {
  53619. return $recv($recv($self._collectionClass())._new())._single();
  53620. $ctx2.sendIdx["single"]=1;
  53621. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53622. }),$globals.Error);
  53623. $ctx1.sendIdx["should:raise:"]=1;
  53624. $self._should_raise_((function(){
  53625. return $core.withContext(function($ctx2) {
  53626. return $recv($self._collection())._single();
  53627. $ctx2.sendIdx["single"]=2;
  53628. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53629. }),$globals.Error);
  53630. $self._assert_equals_($recv($self._sampleNewValueAsCollection())._single(),$self._sampleNewValue());
  53631. return self;
  53632. }, function($ctx1) {$ctx1.fill(self,"testSingle",{},$globals.CollectionTest)});
  53633. },
  53634. args: [],
  53635. 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",
  53636. referencedClasses: ["Error"],
  53637. messageSends: ["should:raise:", "single", "new", "collectionClass", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue"]
  53638. }),
  53639. $globals.CollectionTest);
  53640. $core.addMethod(
  53641. $core.method({
  53642. selector: "testSize",
  53643. protocol: "tests",
  53644. fn: function (){
  53645. var self=this,$self=this;
  53646. return $core.withContext(function($ctx1) {
  53647. var $1,$2;
  53648. $1=$recv($recv($self._collectionClass())._new())._size();
  53649. $ctx1.sendIdx["size"]=1;
  53650. $self._assert_equals_($1,(0));
  53651. $ctx1.sendIdx["assert:equals:"]=1;
  53652. $2=$recv($self._sampleNewValueAsCollection())._size();
  53653. $ctx1.sendIdx["size"]=2;
  53654. $self._assert_equals_($2,(1));
  53655. $ctx1.sendIdx["assert:equals:"]=2;
  53656. $self._assert_equals_($recv($self._collection())._size(),$self._collectionSize());
  53657. return self;
  53658. }, function($ctx1) {$ctx1.fill(self,"testSize",{},$globals.CollectionTest)});
  53659. },
  53660. args: [],
  53661. 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",
  53662. referencedClasses: [],
  53663. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"]
  53664. }),
  53665. $globals.CollectionTest);
  53666. $core.addMethod(
  53667. $core.method({
  53668. selector: "collectionClass",
  53669. protocol: "fixture",
  53670. fn: function (){
  53671. var self=this,$self=this;
  53672. return nil;
  53673. },
  53674. args: [],
  53675. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  53676. referencedClasses: [],
  53677. messageSends: []
  53678. }),
  53679. $globals.CollectionTest.a$cls);
  53680. $core.addMethod(
  53681. $core.method({
  53682. selector: "isAbstract",
  53683. protocol: "testing",
  53684. fn: function (){
  53685. var self=this,$self=this;
  53686. return $core.withContext(function($ctx1) {
  53687. return $recv($self._collectionClass())._isNil();
  53688. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.CollectionTest.a$cls)});
  53689. },
  53690. args: [],
  53691. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  53692. referencedClasses: [],
  53693. messageSends: ["isNil", "collectionClass"]
  53694. }),
  53695. $globals.CollectionTest.a$cls);
  53696. $core.addClass("IndexableCollectionTest", $globals.CollectionTest, [], "Kernel-Tests");
  53697. $core.addMethod(
  53698. $core.method({
  53699. selector: "collectionWithNewValue",
  53700. protocol: "fixture",
  53701. fn: function (){
  53702. var self=this,$self=this;
  53703. return $core.withContext(function($ctx1) {
  53704. $self._subclassResponsibility();
  53705. return self;
  53706. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.IndexableCollectionTest)});
  53707. },
  53708. args: [],
  53709. 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",
  53710. referencedClasses: [],
  53711. messageSends: ["subclassResponsibility"]
  53712. }),
  53713. $globals.IndexableCollectionTest);
  53714. $core.addMethod(
  53715. $core.method({
  53716. selector: "nonIndexesDo:",
  53717. protocol: "fixture",
  53718. fn: function (aBlock){
  53719. var self=this,$self=this;
  53720. return $core.withContext(function($ctx1) {
  53721. $self._subclassResponsibility();
  53722. return self;
  53723. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  53724. },
  53725. args: ["aBlock"],
  53726. 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",
  53727. referencedClasses: [],
  53728. messageSends: ["subclassResponsibility"]
  53729. }),
  53730. $globals.IndexableCollectionTest);
  53731. $core.addMethod(
  53732. $core.method({
  53733. selector: "sampleNewIndex",
  53734. protocol: "fixture",
  53735. fn: function (){
  53736. var self=this,$self=this;
  53737. return $core.withContext(function($ctx1) {
  53738. $self._subclassResponsibility();
  53739. return self;
  53740. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},$globals.IndexableCollectionTest)});
  53741. },
  53742. args: [],
  53743. 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",
  53744. referencedClasses: [],
  53745. messageSends: ["subclassResponsibility"]
  53746. }),
  53747. $globals.IndexableCollectionTest);
  53748. $core.addMethod(
  53749. $core.method({
  53750. selector: "samplesDo:",
  53751. protocol: "fixture",
  53752. fn: function (aBlock){
  53753. var self=this,$self=this;
  53754. return $core.withContext(function($ctx1) {
  53755. $self._subclassResponsibility();
  53756. return self;
  53757. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  53758. },
  53759. args: ["aBlock"],
  53760. 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",
  53761. referencedClasses: [],
  53762. messageSends: ["subclassResponsibility"]
  53763. }),
  53764. $globals.IndexableCollectionTest);
  53765. $core.addMethod(
  53766. $core.method({
  53767. selector: "testAt",
  53768. protocol: "tests",
  53769. fn: function (){
  53770. var self=this,$self=this;
  53771. return $core.withContext(function($ctx1) {
  53772. var $1;
  53773. $self._nonIndexesDo_((function(each){
  53774. return $core.withContext(function($ctx2) {
  53775. return $self._should_raise_((function(){
  53776. return $core.withContext(function($ctx3) {
  53777. $1=$self._collection();
  53778. $ctx3.sendIdx["collection"]=1;
  53779. return $recv($1)._at_(each);
  53780. $ctx3.sendIdx["at:"]=1;
  53781. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  53782. }),$globals.Error);
  53783. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53784. }));
  53785. $self._samplesDo_((function(index,value){
  53786. return $core.withContext(function($ctx2) {
  53787. return $self._assert_equals_($recv($self._collection())._at_(index),value);
  53788. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  53789. }));
  53790. return self;
  53791. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.IndexableCollectionTest)});
  53792. },
  53793. args: [],
  53794. 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 ]",
  53795. referencedClasses: ["Error"],
  53796. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"]
  53797. }),
  53798. $globals.IndexableCollectionTest);
  53799. $core.addMethod(
  53800. $core.method({
  53801. selector: "testAtIfAbsent",
  53802. protocol: "tests",
  53803. fn: function (){
  53804. var self=this,$self=this;
  53805. return $core.withContext(function($ctx1) {
  53806. var $2,$1,$3;
  53807. $self._nonIndexesDo_((function(each){
  53808. return $core.withContext(function($ctx2) {
  53809. $2=$self._collection();
  53810. $ctx2.sendIdx["collection"]=1;
  53811. $1=$recv($2)._at_ifAbsent_(each,(function(){
  53812. return $core.withContext(function($ctx3) {
  53813. return $self._sampleNewValue();
  53814. $ctx3.sendIdx["sampleNewValue"]=1;
  53815. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  53816. }));
  53817. $ctx2.sendIdx["at:ifAbsent:"]=1;
  53818. $3=$self._sampleNewValue();
  53819. $ctx2.sendIdx["sampleNewValue"]=2;
  53820. return $self._assert_equals_($1,$3);
  53821. $ctx2.sendIdx["assert:equals:"]=1;
  53822. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53823. }));
  53824. $self._samplesDo_((function(index,value){
  53825. return $core.withContext(function($ctx2) {
  53826. return $self._assert_equals_($recv($self._collection())._at_ifAbsent_(index,(function(){
  53827. return $core.withContext(function($ctx3) {
  53828. return $self._sampleNewValue();
  53829. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  53830. })),value);
  53831. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  53832. }));
  53833. return self;
  53834. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},$globals.IndexableCollectionTest)});
  53835. },
  53836. args: [],
  53837. 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 ].",
  53838. referencedClasses: [],
  53839. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"]
  53840. }),
  53841. $globals.IndexableCollectionTest);
  53842. $core.addMethod(
  53843. $core.method({
  53844. selector: "testAtIfAbsentPut",
  53845. protocol: "tests",
  53846. fn: function (){
  53847. var self=this,$self=this;
  53848. var newCollection;
  53849. return $core.withContext(function($ctx1) {
  53850. var $1;
  53851. newCollection=$self._collection();
  53852. $ctx1.sendIdx["collection"]=1;
  53853. $self._samplesDo_((function(index,value){
  53854. return $core.withContext(function($ctx2) {
  53855. $1=$recv(newCollection)._at_ifAbsentPut_(index,(function(){
  53856. return $core.withContext(function($ctx3) {
  53857. return $self._sampleNewValue();
  53858. $ctx3.sendIdx["sampleNewValue"]=1;
  53859. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  53860. }));
  53861. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  53862. return $self._assert_equals_($1,value);
  53863. $ctx2.sendIdx["assert:equals:"]=1;
  53864. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  53865. }));
  53866. $self._assert_equals_(newCollection,$self._collection());
  53867. $ctx1.sendIdx["assert:equals:"]=2;
  53868. $self._assert_equals_($recv(newCollection)._at_ifAbsentPut_($self._sampleNewIndex(),(function(){
  53869. return $core.withContext(function($ctx2) {
  53870. return $self._sampleNewValue();
  53871. $ctx2.sendIdx["sampleNewValue"]=2;
  53872. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  53873. })),$self._sampleNewValue());
  53874. $ctx1.sendIdx["assert:equals:"]=3;
  53875. $self._assert_equals_(newCollection,$self._collectionWithNewValue());
  53876. return self;
  53877. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  53878. },
  53879. args: [],
  53880. 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",
  53881. referencedClasses: [],
  53882. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"]
  53883. }),
  53884. $globals.IndexableCollectionTest);
  53885. $core.addMethod(
  53886. $core.method({
  53887. selector: "testAtIfPresent",
  53888. protocol: "tests",
  53889. fn: function (){
  53890. var self=this,$self=this;
  53891. var visited,sentinel;
  53892. return $core.withContext(function($ctx1) {
  53893. var $2,$1,$4,$3;
  53894. sentinel=$recv($globals.Object)._new();
  53895. $self._nonIndexesDo_((function(each){
  53896. return $core.withContext(function($ctx2) {
  53897. visited=nil;
  53898. $2=$self._collection();
  53899. $ctx2.sendIdx["collection"]=1;
  53900. $1=$recv($2)._at_ifPresent_(each,(function(value1){
  53901. visited=value1;
  53902. return sentinel;
  53903. }));
  53904. $ctx2.sendIdx["at:ifPresent:"]=1;
  53905. $self._assert_equals_($1,nil);
  53906. $ctx2.sendIdx["assert:equals:"]=1;
  53907. return $self._assert_($recv(visited)._isNil());
  53908. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53909. }));
  53910. $self._samplesDo_((function(index,value){
  53911. return $core.withContext(function($ctx2) {
  53912. visited=nil;
  53913. $4=$self._collection();
  53914. $ctx2.sendIdx["collection"]=2;
  53915. $3=$recv($4)._at_ifPresent_(index,(function(value2){
  53916. visited=value2;
  53917. return sentinel;
  53918. }));
  53919. $self._assert_equals_($3,sentinel);
  53920. $ctx2.sendIdx["assert:equals:"]=2;
  53921. return $self._assert_equals_(visited,$recv($self._collection())._at_(index));
  53922. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  53923. }));
  53924. return self;
  53925. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  53926. },
  53927. args: [],
  53928. 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) ]",
  53929. referencedClasses: ["Object"],
  53930. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"]
  53931. }),
  53932. $globals.IndexableCollectionTest);
  53933. $core.addMethod(
  53934. $core.method({
  53935. selector: "testAtIfPresentIfAbsent",
  53936. protocol: "tests",
  53937. fn: function (){
  53938. var self=this,$self=this;
  53939. var visited,sentinel;
  53940. return $core.withContext(function($ctx1) {
  53941. var $2,$1,$3,$5,$4;
  53942. sentinel=$recv($globals.Object)._new();
  53943. $self._nonIndexesDo_((function(each){
  53944. return $core.withContext(function($ctx2) {
  53945. visited=nil;
  53946. $2=$self._collection();
  53947. $ctx2.sendIdx["collection"]=1;
  53948. $1=$recv($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  53949. visited=value1;
  53950. return sentinel;
  53951. }),(function(){
  53952. return $core.withContext(function($ctx3) {
  53953. return $self._sampleNewValue();
  53954. $ctx3.sendIdx["sampleNewValue"]=1;
  53955. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  53956. }));
  53957. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  53958. $3=$self._sampleNewValue();
  53959. $ctx2.sendIdx["sampleNewValue"]=2;
  53960. $self._assert_equals_($1,$3);
  53961. $ctx2.sendIdx["assert:equals:"]=1;
  53962. return $self._assert_($recv(visited)._isNil());
  53963. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53964. }));
  53965. $self._samplesDo_((function(index,value){
  53966. return $core.withContext(function($ctx2) {
  53967. visited=nil;
  53968. $5=$self._collection();
  53969. $ctx2.sendIdx["collection"]=2;
  53970. $4=$recv($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  53971. visited=value2;
  53972. return sentinel;
  53973. }),(function(){
  53974. return $core.withContext(function($ctx3) {
  53975. return $self._sampleNewValue();
  53976. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)});
  53977. }));
  53978. $self._assert_equals_($4,sentinel);
  53979. $ctx2.sendIdx["assert:equals:"]=2;
  53980. return $self._assert_equals_(visited,$recv($self._collection())._at_(index));
  53981. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)});
  53982. }));
  53983. return self;
  53984. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  53985. },
  53986. args: [],
  53987. 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) ]",
  53988. referencedClasses: ["Object"],
  53989. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"]
  53990. }),
  53991. $globals.IndexableCollectionTest);
  53992. $core.addMethod(
  53993. $core.method({
  53994. selector: "testAtPut",
  53995. protocol: "tests",
  53996. fn: function (){
  53997. var self=this,$self=this;
  53998. var newCollection;
  53999. return $core.withContext(function($ctx1) {
  54000. newCollection=$self._collection();
  54001. $ctx1.sendIdx["collection"]=1;
  54002. $self._samplesDo_((function(index,value){
  54003. return $core.withContext(function($ctx2) {
  54004. return $recv(newCollection)._at_put_(index,value);
  54005. $ctx2.sendIdx["at:put:"]=1;
  54006. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  54007. }));
  54008. $self._assert_equals_(newCollection,$self._collection());
  54009. $ctx1.sendIdx["assert:equals:"]=1;
  54010. $recv(newCollection)._at_put_($self._sampleNewIndex(),$self._sampleNewValue());
  54011. $self._assert_equals_(newCollection,$self._collectionWithNewValue());
  54012. return self;
  54013. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  54014. },
  54015. args: [],
  54016. 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",
  54017. referencedClasses: [],
  54018. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"]
  54019. }),
  54020. $globals.IndexableCollectionTest);
  54021. $core.addMethod(
  54022. $core.method({
  54023. selector: "testIndexOf",
  54024. protocol: "tests",
  54025. fn: function (){
  54026. var self=this,$self=this;
  54027. return $core.withContext(function($ctx1) {
  54028. var $1;
  54029. $self._should_raise_((function(){
  54030. return $core.withContext(function($ctx2) {
  54031. $1=$self._collection();
  54032. $ctx2.sendIdx["collection"]=1;
  54033. return $recv($1)._indexOf_($self._sampleNewValue());
  54034. $ctx2.sendIdx["indexOf:"]=1;
  54035. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54036. }),$globals.Error);
  54037. $self._samplesDo_((function(index,value){
  54038. return $core.withContext(function($ctx2) {
  54039. return $self._assert_equals_($recv($self._collection())._indexOf_(value),index);
  54040. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)});
  54041. }));
  54042. return self;
  54043. }, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},$globals.IndexableCollectionTest)});
  54044. },
  54045. args: [],
  54046. 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 ]",
  54047. referencedClasses: ["Error"],
  54048. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"]
  54049. }),
  54050. $globals.IndexableCollectionTest);
  54051. $core.addMethod(
  54052. $core.method({
  54053. selector: "testIndexOfWithNull",
  54054. protocol: "tests",
  54055. fn: function (){
  54056. var self=this,$self=this;
  54057. var jsNull;
  54058. return $core.withContext(function($ctx1) {
  54059. var $2,$1;
  54060. jsNull=$recv($globals.JSON)._parse_("null");
  54061. $self._samplesDo_((function(index,value){
  54062. return $core.withContext(function($ctx2) {
  54063. $2=$self._collection();
  54064. $recv($2)._at_put_(index,jsNull);
  54065. $1=$recv($2)._indexOf_(jsNull);
  54066. return $self._assert_equals_($1,index);
  54067. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  54068. }));
  54069. return self;
  54070. }, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},$globals.IndexableCollectionTest)});
  54071. },
  54072. args: [],
  54073. 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 ]",
  54074. referencedClasses: ["JSON"],
  54075. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"]
  54076. }),
  54077. $globals.IndexableCollectionTest);
  54078. $core.addMethod(
  54079. $core.method({
  54080. selector: "testWithIndexDo",
  54081. protocol: "tests",
  54082. fn: function (){
  54083. var self=this,$self=this;
  54084. var collection;
  54085. return $core.withContext(function($ctx1) {
  54086. collection=$self._collection();
  54087. $ctx1.sendIdx["collection"]=1;
  54088. $recv($self._collection())._withIndexDo_((function(each,index){
  54089. return $core.withContext(function($ctx2) {
  54090. return $self._assert_equals_($recv(collection)._at_(index),each);
  54091. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  54092. }));
  54093. return self;
  54094. }, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},$globals.IndexableCollectionTest)});
  54095. },
  54096. args: [],
  54097. 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 ]",
  54098. referencedClasses: [],
  54099. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"]
  54100. }),
  54101. $globals.IndexableCollectionTest);
  54102. $core.addClass("AssociativeCollectionTest", $globals.IndexableCollectionTest, [], "Kernel-Tests");
  54103. $core.addMethod(
  54104. $core.method({
  54105. selector: "collectionKeys",
  54106. protocol: "fixture",
  54107. fn: function (){
  54108. var self=this,$self=this;
  54109. return $core.withContext(function($ctx1) {
  54110. $self._subclassResponsibility();
  54111. return self;
  54112. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.AssociativeCollectionTest)});
  54113. },
  54114. args: [],
  54115. source: "collectionKeys\x0a\x09self subclassResponsibility",
  54116. referencedClasses: [],
  54117. messageSends: ["subclassResponsibility"]
  54118. }),
  54119. $globals.AssociativeCollectionTest);
  54120. $core.addMethod(
  54121. $core.method({
  54122. selector: "collectionValues",
  54123. protocol: "fixture",
  54124. fn: function (){
  54125. var self=this,$self=this;
  54126. return $core.withContext(function($ctx1) {
  54127. $self._subclassResponsibility();
  54128. return self;
  54129. }, function($ctx1) {$ctx1.fill(self,"collectionValues",{},$globals.AssociativeCollectionTest)});
  54130. },
  54131. args: [],
  54132. source: "collectionValues\x0a\x09self subclassResponsibility",
  54133. referencedClasses: [],
  54134. messageSends: ["subclassResponsibility"]
  54135. }),
  54136. $globals.AssociativeCollectionTest);
  54137. $core.addMethod(
  54138. $core.method({
  54139. selector: "nonIndexesDo:",
  54140. protocol: "fixture",
  54141. fn: function (aBlock){
  54142. var self=this,$self=this;
  54143. return $core.withContext(function($ctx1) {
  54144. $recv(aBlock)._value_((5));
  54145. $ctx1.sendIdx["value:"]=1;
  54146. $recv(aBlock)._value_((function(){
  54147. }));
  54148. $ctx1.sendIdx["value:"]=2;
  54149. $recv(aBlock)._value_($recv($globals.Object)._new());
  54150. $ctx1.sendIdx["value:"]=3;
  54151. $recv(aBlock)._value_("z");
  54152. return self;
  54153. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  54154. },
  54155. args: ["aBlock"],
  54156. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: [].\x0a\x09aBlock value: Object new.\x0a\x09aBlock value: 'z'",
  54157. referencedClasses: ["Object"],
  54158. messageSends: ["value:", "new"]
  54159. }),
  54160. $globals.AssociativeCollectionTest);
  54161. $core.addMethod(
  54162. $core.method({
  54163. selector: "sampleNewIndex",
  54164. protocol: "fixture",
  54165. fn: function (){
  54166. var self=this,$self=this;
  54167. return "new";
  54168. },
  54169. args: [],
  54170. source: "sampleNewIndex\x0a\x09^ 'new'",
  54171. referencedClasses: [],
  54172. messageSends: []
  54173. }),
  54174. $globals.AssociativeCollectionTest);
  54175. $core.addMethod(
  54176. $core.method({
  54177. selector: "samplesDo:",
  54178. protocol: "fixture",
  54179. fn: function (aBlock){
  54180. var self=this,$self=this;
  54181. return $core.withContext(function($ctx1) {
  54182. $recv(aBlock)._value_value_("a",(2));
  54183. return self;
  54184. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  54185. },
  54186. args: ["aBlock"],
  54187. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  54188. referencedClasses: [],
  54189. messageSends: ["value:value:"]
  54190. }),
  54191. $globals.AssociativeCollectionTest);
  54192. $core.addMethod(
  54193. $core.method({
  54194. selector: "testAddAll",
  54195. protocol: "tests",
  54196. fn: function (){
  54197. var self=this,$self=this;
  54198. return $core.withContext(function($ctx1) {
  54199. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  54200. (
  54201. $ctx1.supercall = true,
  54202. ($globals.AssociativeCollectionTest.superclass||$boot.nilAsClass).fn.prototype._testAddAll.apply($self, []));
  54203. $ctx1.supercall = false;
  54204. $2=$self._collection();
  54205. $ctx1.sendIdx["collection"]=1;
  54206. $3=$self._collection();
  54207. $ctx1.sendIdx["collection"]=2;
  54208. $recv($2)._addAll_($3);
  54209. $ctx1.sendIdx["addAll:"]=1;
  54210. $4=$recv($2)._yourself();
  54211. $ctx1.sendIdx["yourself"]=1;
  54212. $1=$4;
  54213. $5=$self._collection();
  54214. $ctx1.sendIdx["collection"]=3;
  54215. $self._assert_equals_($1,$5);
  54216. $ctx1.sendIdx["assert:equals:"]=1;
  54217. $7=$self._collection();
  54218. $ctx1.sendIdx["collection"]=4;
  54219. $8=$self._collectionWithNewValue();
  54220. $ctx1.sendIdx["collectionWithNewValue"]=1;
  54221. $recv($7)._addAll_($8);
  54222. $ctx1.sendIdx["addAll:"]=2;
  54223. $9=$recv($7)._yourself();
  54224. $ctx1.sendIdx["yourself"]=2;
  54225. $6=$9;
  54226. $10=$self._collectionWithNewValue();
  54227. $ctx1.sendIdx["collectionWithNewValue"]=2;
  54228. $self._assert_equals_($6,$10);
  54229. $ctx1.sendIdx["assert:equals:"]=2;
  54230. $12=$self._collectionWithNewValue();
  54231. $ctx1.sendIdx["collectionWithNewValue"]=3;
  54232. $recv($12)._addAll_($self._collection());
  54233. $11=$recv($12)._yourself();
  54234. $self._assert_equals_($11,$self._collectionWithNewValue());
  54235. return self;
  54236. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.AssociativeCollectionTest)});
  54237. },
  54238. args: [],
  54239. 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",
  54240. referencedClasses: [],
  54241. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  54242. }),
  54243. $globals.AssociativeCollectionTest);
  54244. $core.addMethod(
  54245. $core.method({
  54246. selector: "testAsDictionary",
  54247. protocol: "tests",
  54248. fn: function (){
  54249. var self=this,$self=this;
  54250. return $core.withContext(function($ctx1) {
  54251. $self._assert_($recv($recv($recv($self._collectionClass())._new())._asDictionary())._isMemberOf_($globals.Dictionary));
  54252. return self;
  54253. }, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},$globals.AssociativeCollectionTest)});
  54254. },
  54255. args: [],
  54256. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  54257. referencedClasses: ["Dictionary"],
  54258. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"]
  54259. }),
  54260. $globals.AssociativeCollectionTest);
  54261. $core.addMethod(
  54262. $core.method({
  54263. selector: "testAsHashedCollection",
  54264. protocol: "tests",
  54265. fn: function (){
  54266. var self=this,$self=this;
  54267. return $core.withContext(function($ctx1) {
  54268. $self._assert_($recv($recv($recv($self._collectionClass())._new())._asHashedCollection())._isMemberOf_($globals.HashedCollection));
  54269. return self;
  54270. }, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},$globals.AssociativeCollectionTest)});
  54271. },
  54272. args: [],
  54273. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  54274. referencedClasses: ["HashedCollection"],
  54275. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"]
  54276. }),
  54277. $globals.AssociativeCollectionTest);
  54278. $core.addMethod(
  54279. $core.method({
  54280. selector: "testComma",
  54281. protocol: "tests",
  54282. fn: function (){
  54283. var self=this,$self=this;
  54284. return $core.withContext(function($ctx1) {
  54285. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  54286. (
  54287. $ctx1.supercall = true,
  54288. ($globals.AssociativeCollectionTest.superclass||$boot.nilAsClass).fn.prototype._testComma.apply($self, []));
  54289. $ctx1.supercall = false;
  54290. $2=$self._collection();
  54291. $ctx1.sendIdx["collection"]=1;
  54292. $3=$self._collection();
  54293. $ctx1.sendIdx["collection"]=2;
  54294. $1=$recv($2).__comma($3);
  54295. $ctx1.sendIdx[","]=1;
  54296. $4=$self._collection();
  54297. $ctx1.sendIdx["collection"]=3;
  54298. $self._assert_equals_($1,$4);
  54299. $ctx1.sendIdx["assert:equals:"]=1;
  54300. $6=$self._collection();
  54301. $ctx1.sendIdx["collection"]=4;
  54302. $7=$self._collectionWithNewValue();
  54303. $ctx1.sendIdx["collectionWithNewValue"]=1;
  54304. $5=$recv($6).__comma($7);
  54305. $ctx1.sendIdx[","]=2;
  54306. $8=$self._collectionWithNewValue();
  54307. $ctx1.sendIdx["collectionWithNewValue"]=2;
  54308. $self._assert_equals_($5,$8);
  54309. $ctx1.sendIdx["assert:equals:"]=2;
  54310. $10=$self._collectionWithNewValue();
  54311. $ctx1.sendIdx["collectionWithNewValue"]=3;
  54312. $9=$recv($10).__comma($self._collection());
  54313. $self._assert_equals_($9,$self._collectionWithNewValue());
  54314. return self;
  54315. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.AssociativeCollectionTest)});
  54316. },
  54317. args: [],
  54318. 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",
  54319. referencedClasses: [],
  54320. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  54321. }),
  54322. $globals.AssociativeCollectionTest);
  54323. $core.addMethod(
  54324. $core.method({
  54325. selector: "testFrom",
  54326. protocol: "tests",
  54327. fn: function (){
  54328. var self=this,$self=this;
  54329. var associations;
  54330. return $core.withContext(function($ctx1) {
  54331. var $1;
  54332. $1="a".__minus_gt((1));
  54333. $ctx1.sendIdx["->"]=1;
  54334. associations=[$1,"b".__minus_gt((2))];
  54335. $self._assertSameContents_as_($recv($recv($self._class())._collectionClass())._from_(associations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  54336. return self;
  54337. }, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},$globals.AssociativeCollectionTest)});
  54338. },
  54339. args: [],
  54340. 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 }.",
  54341. referencedClasses: [],
  54342. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"]
  54343. }),
  54344. $globals.AssociativeCollectionTest);
  54345. $core.addMethod(
  54346. $core.method({
  54347. selector: "testKeys",
  54348. protocol: "tests",
  54349. fn: function (){
  54350. var self=this,$self=this;
  54351. return $core.withContext(function($ctx1) {
  54352. var $2,$1,$3,$4;
  54353. $2=$recv($recv($self._collectionClass())._new())._keys();
  54354. $ctx1.sendIdx["keys"]=1;
  54355. $1=$recv($2)._isEmpty();
  54356. $self._assert_($1);
  54357. $3=$recv($self._collection())._keys();
  54358. $ctx1.sendIdx["keys"]=2;
  54359. $4=$self._collectionKeys();
  54360. $ctx1.sendIdx["collectionKeys"]=1;
  54361. $self._assertSameContents_as_($3,$4);
  54362. $ctx1.sendIdx["assertSameContents:as:"]=1;
  54363. $self._assertSameContents_as_($recv($self._collectionWithNewValue())._keys(),$recv($self._collectionKeys()).__comma([$self._sampleNewIndex()]));
  54364. return self;
  54365. }, function($ctx1) {$ctx1.fill(self,"testKeys",{},$globals.AssociativeCollectionTest)});
  54366. },
  54367. args: [],
  54368. 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 }",
  54369. referencedClasses: [],
  54370. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"]
  54371. }),
  54372. $globals.AssociativeCollectionTest);
  54373. $core.addMethod(
  54374. $core.method({
  54375. selector: "testNewFromPairs",
  54376. protocol: "tests",
  54377. fn: function (){
  54378. var self=this,$self=this;
  54379. var flattenedAssociations;
  54380. return $core.withContext(function($ctx1) {
  54381. flattenedAssociations=["a",(1),"b",(2)];
  54382. $self._assertSameContents_as_($recv($recv($self._class())._collectionClass())._newFromPairs_(flattenedAssociations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  54383. return self;
  54384. }, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},$globals.AssociativeCollectionTest)});
  54385. },
  54386. args: [],
  54387. 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 }.",
  54388. referencedClasses: [],
  54389. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class"]
  54390. }),
  54391. $globals.AssociativeCollectionTest);
  54392. $core.addMethod(
  54393. $core.method({
  54394. selector: "testPrintString",
  54395. protocol: "tests",
  54396. fn: function (){
  54397. var self=this,$self=this;
  54398. return $core.withContext(function($ctx1) {
  54399. var $3,$2,$1,$4;
  54400. $3=$self._collectionClass();
  54401. $ctx1.sendIdx["collectionClass"]=1;
  54402. $2=$recv($3)._new();
  54403. $recv($2)._at_put_("firstname","James");
  54404. $ctx1.sendIdx["at:put:"]=1;
  54405. $recv($2)._at_put_("lastname","Bond");
  54406. $1=$recv($2)._printString();
  54407. $4=$recv("a ".__comma($recv($self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  54408. $ctx1.sendIdx[","]=1;
  54409. $self._assert_equals_($1,$4);
  54410. return self;
  54411. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{},$globals.AssociativeCollectionTest)});
  54412. },
  54413. args: [],
  54414. 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'')'",
  54415. referencedClasses: [],
  54416. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"]
  54417. }),
  54418. $globals.AssociativeCollectionTest);
  54419. $core.addMethod(
  54420. $core.method({
  54421. selector: "testRemoveKey",
  54422. protocol: "tests",
  54423. fn: function (){
  54424. var self=this,$self=this;
  54425. return $core.withContext(function($ctx1) {
  54426. var $1,$2,$3,$5,$6,$4,$8,$7;
  54427. $self._nonIndexesDo_((function(each){
  54428. var collection;
  54429. return $core.withContext(function($ctx2) {
  54430. collection=$self._collection();
  54431. $ctx2.sendIdx["collection"]=1;
  54432. $self._should_raise_((function(){
  54433. return $core.withContext(function($ctx3) {
  54434. return $recv(collection)._removeKey_(each);
  54435. $ctx3.sendIdx["removeKey:"]=1;
  54436. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  54437. }),$globals.Error);
  54438. $1=collection;
  54439. $2=$self._collection();
  54440. $ctx2.sendIdx["collection"]=2;
  54441. return $self._assert_equals_($1,$2);
  54442. $ctx2.sendIdx["assert:equals:"]=1;
  54443. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  54444. }));
  54445. $self._samplesDo_((function(index,value){
  54446. var collection;
  54447. return $core.withContext(function($ctx2) {
  54448. collection=$self._collection();
  54449. $ctx2.sendIdx["collection"]=3;
  54450. $3=$recv(collection)._removeKey_(index);
  54451. $ctx2.sendIdx["removeKey:"]=2;
  54452. $self._assert_equals_($3,value);
  54453. $ctx2.sendIdx["assert:equals:"]=2;
  54454. $5=collection;
  54455. $6=$self._collection();
  54456. $ctx2.sendIdx["collection"]=4;
  54457. $4=$recv($5).__eq($6);
  54458. return $self._deny_($4);
  54459. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  54460. }));
  54461. $8=$self._collectionWithNewValue();
  54462. $recv($8)._removeKey_($self._sampleNewIndex());
  54463. $7=$recv($8)._yourself();
  54464. $self._assert_equals_($7,$self._collection());
  54465. return self;
  54466. }, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},$globals.AssociativeCollectionTest)});
  54467. },
  54468. args: [],
  54469. 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",
  54470. referencedClasses: ["Error"],
  54471. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"]
  54472. }),
  54473. $globals.AssociativeCollectionTest);
  54474. $core.addMethod(
  54475. $core.method({
  54476. selector: "testRemoveKeyIfAbsent",
  54477. protocol: "tests",
  54478. fn: function (){
  54479. var self=this,$self=this;
  54480. return $core.withContext(function($ctx1) {
  54481. var $1,$2,$3,$4,$5,$7,$8,$6,$10,$9;
  54482. $self._nonIndexesDo_((function(each){
  54483. var collection;
  54484. return $core.withContext(function($ctx2) {
  54485. collection=$self._collection();
  54486. $ctx2.sendIdx["collection"]=1;
  54487. $1=$recv(collection)._removeKey_ifAbsent_(each,(function(){
  54488. return $core.withContext(function($ctx3) {
  54489. return $self._sampleNewValue();
  54490. $ctx3.sendIdx["sampleNewValue"]=1;
  54491. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  54492. }));
  54493. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  54494. $2=$self._sampleNewValue();
  54495. $ctx2.sendIdx["sampleNewValue"]=2;
  54496. $self._assert_equals_($1,$2);
  54497. $ctx2.sendIdx["assert:equals:"]=1;
  54498. $3=collection;
  54499. $4=$self._collection();
  54500. $ctx2.sendIdx["collection"]=2;
  54501. return $self._assert_equals_($3,$4);
  54502. $ctx2.sendIdx["assert:equals:"]=2;
  54503. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  54504. }));
  54505. $self._samplesDo_((function(index,value){
  54506. var collection;
  54507. return $core.withContext(function($ctx2) {
  54508. collection=$self._collection();
  54509. $ctx2.sendIdx["collection"]=3;
  54510. $5=$recv(collection)._removeKey_ifAbsent_(index,(function(){
  54511. return $core.withContext(function($ctx3) {
  54512. return $self._sampleNewValue();
  54513. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  54514. }));
  54515. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  54516. $self._assert_equals_($5,value);
  54517. $ctx2.sendIdx["assert:equals:"]=3;
  54518. $7=collection;
  54519. $8=$self._collection();
  54520. $ctx2.sendIdx["collection"]=4;
  54521. $6=$recv($7).__eq($8);
  54522. return $self._deny_($6);
  54523. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  54524. }));
  54525. $10=$self._collectionWithNewValue();
  54526. $recv($10)._removeKey_ifAbsent_($self._sampleNewIndex(),(function(){
  54527. return $core.withContext(function($ctx2) {
  54528. return $self._assert_(false);
  54529. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  54530. }));
  54531. $9=$recv($10)._yourself();
  54532. $self._assert_equals_($9,$self._collection());
  54533. return self;
  54534. }, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},$globals.AssociativeCollectionTest)});
  54535. },
  54536. args: [],
  54537. 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",
  54538. referencedClasses: [],
  54539. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"]
  54540. }),
  54541. $globals.AssociativeCollectionTest);
  54542. $core.addMethod(
  54543. $core.method({
  54544. selector: "testValues",
  54545. protocol: "tests",
  54546. fn: function (){
  54547. var self=this,$self=this;
  54548. return $core.withContext(function($ctx1) {
  54549. var $2,$1,$3,$4;
  54550. $2=$recv($recv($self._collectionClass())._new())._values();
  54551. $ctx1.sendIdx["values"]=1;
  54552. $1=$recv($2)._isEmpty();
  54553. $self._assert_($1);
  54554. $3=$recv($self._collection())._values();
  54555. $ctx1.sendIdx["values"]=2;
  54556. $4=$self._collectionValues();
  54557. $ctx1.sendIdx["collectionValues"]=1;
  54558. $self._assertSameContents_as_($3,$4);
  54559. $ctx1.sendIdx["assertSameContents:as:"]=1;
  54560. $self._assertSameContents_as_($recv($self._collectionWithNewValue())._values(),$recv($self._collectionValues()).__comma([$self._sampleNewValue()]));
  54561. return self;
  54562. }, function($ctx1) {$ctx1.fill(self,"testValues",{},$globals.AssociativeCollectionTest)});
  54563. },
  54564. args: [],
  54565. 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 }",
  54566. referencedClasses: [],
  54567. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"]
  54568. }),
  54569. $globals.AssociativeCollectionTest);
  54570. $core.addClass("DictionaryTest", $globals.AssociativeCollectionTest, [], "Kernel-Tests");
  54571. $core.addMethod(
  54572. $core.method({
  54573. selector: "collection",
  54574. protocol: "fixture",
  54575. fn: function (){
  54576. var self=this,$self=this;
  54577. return $core.withContext(function($ctx1) {
  54578. var $1;
  54579. $1=$recv($globals.Dictionary)._new();
  54580. $recv($1)._at_put_((1),(1));
  54581. $ctx1.sendIdx["at:put:"]=1;
  54582. $recv($1)._at_put_("a",(2));
  54583. $ctx1.sendIdx["at:put:"]=2;
  54584. $recv($1)._at_put_(true,(3));
  54585. $ctx1.sendIdx["at:put:"]=3;
  54586. $recv($1)._at_put_((1).__at((3)),(-4));
  54587. $ctx1.sendIdx["at:put:"]=4;
  54588. $recv($1)._at_put_($self["@sampleBlock"],(9));
  54589. return $recv($1)._yourself();
  54590. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.DictionaryTest)});
  54591. },
  54592. args: [],
  54593. 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",
  54594. referencedClasses: ["Dictionary"],
  54595. messageSends: ["at:put:", "new", "@", "yourself"]
  54596. }),
  54597. $globals.DictionaryTest);
  54598. $core.addMethod(
  54599. $core.method({
  54600. selector: "collectionKeys",
  54601. protocol: "fixture",
  54602. fn: function (){
  54603. var self=this,$self=this;
  54604. return $core.withContext(function($ctx1) {
  54605. return [(1),"a",true,(1).__at((3)),$self["@sampleBlock"]];
  54606. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.DictionaryTest)});
  54607. },
  54608. args: [],
  54609. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3. sampleBlock}",
  54610. referencedClasses: [],
  54611. messageSends: ["@"]
  54612. }),
  54613. $globals.DictionaryTest);
  54614. $core.addMethod(
  54615. $core.method({
  54616. selector: "collectionOfPrintStrings",
  54617. protocol: "fixture",
  54618. fn: function (){
  54619. var self=this,$self=this;
  54620. return $core.withContext(function($ctx1) {
  54621. var $1;
  54622. $1=$recv($globals.Dictionary)._new();
  54623. $recv($1)._at_put_((1),"1");
  54624. $ctx1.sendIdx["at:put:"]=1;
  54625. $recv($1)._at_put_("a","2");
  54626. $ctx1.sendIdx["at:put:"]=2;
  54627. $recv($1)._at_put_(true,"3");
  54628. $ctx1.sendIdx["at:put:"]=3;
  54629. $recv($1)._at_put_((1).__at((3)),"-4");
  54630. $ctx1.sendIdx["at:put:"]=4;
  54631. $recv($1)._at_put_($self["@sampleBlock"],"9");
  54632. return $recv($1)._yourself();
  54633. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.DictionaryTest)});
  54634. },
  54635. args: [],
  54636. 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",
  54637. referencedClasses: ["Dictionary"],
  54638. messageSends: ["at:put:", "new", "@", "yourself"]
  54639. }),
  54640. $globals.DictionaryTest);
  54641. $core.addMethod(
  54642. $core.method({
  54643. selector: "collectionSize",
  54644. protocol: "fixture",
  54645. fn: function (){
  54646. var self=this,$self=this;
  54647. return (5);
  54648. },
  54649. args: [],
  54650. source: "collectionSize\x0a\x09^ 5",
  54651. referencedClasses: [],
  54652. messageSends: []
  54653. }),
  54654. $globals.DictionaryTest);
  54655. $core.addMethod(
  54656. $core.method({
  54657. selector: "collectionValues",
  54658. protocol: "fixture",
  54659. fn: function (){
  54660. var self=this,$self=this;
  54661. return [(1),(2),(3),(-4),(9)];
  54662. },
  54663. args: [],
  54664. source: "collectionValues\x0a\x09^ {1. 2. 3. -4. 9}",
  54665. referencedClasses: [],
  54666. messageSends: []
  54667. }),
  54668. $globals.DictionaryTest);
  54669. $core.addMethod(
  54670. $core.method({
  54671. selector: "collectionWithDuplicates",
  54672. protocol: "fixture",
  54673. fn: function (){
  54674. var self=this,$self=this;
  54675. return $core.withContext(function($ctx1) {
  54676. var $1;
  54677. $1=$recv($globals.Dictionary)._new();
  54678. $recv($1)._at_put_((1),(1));
  54679. $ctx1.sendIdx["at:put:"]=1;
  54680. $recv($1)._at_put_("a",(2));
  54681. $ctx1.sendIdx["at:put:"]=2;
  54682. $recv($1)._at_put_(true,(3));
  54683. $ctx1.sendIdx["at:put:"]=3;
  54684. $recv($1)._at_put_((4),(-4));
  54685. $ctx1.sendIdx["at:put:"]=4;
  54686. $recv($1)._at_put_($self["@sampleBlock"],(9));
  54687. $ctx1.sendIdx["at:put:"]=5;
  54688. $recv($1)._at_put_("b",(1));
  54689. $ctx1.sendIdx["at:put:"]=6;
  54690. $recv($1)._at_put_((3),(3));
  54691. $ctx1.sendIdx["at:put:"]=7;
  54692. $recv($1)._at_put_(false,(12));
  54693. return $recv($1)._yourself();
  54694. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.DictionaryTest)});
  54695. },
  54696. args: [],
  54697. 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",
  54698. referencedClasses: ["Dictionary"],
  54699. messageSends: ["at:put:", "new", "yourself"]
  54700. }),
  54701. $globals.DictionaryTest);
  54702. $core.addMethod(
  54703. $core.method({
  54704. selector: "collectionWithNewValue",
  54705. protocol: "fixture",
  54706. fn: function (){
  54707. var self=this,$self=this;
  54708. return $core.withContext(function($ctx1) {
  54709. var $1;
  54710. $1=$recv($globals.Dictionary)._new();
  54711. $recv($1)._at_put_((1),(1));
  54712. $ctx1.sendIdx["at:put:"]=1;
  54713. $recv($1)._at_put_("a",(2));
  54714. $ctx1.sendIdx["at:put:"]=2;
  54715. $recv($1)._at_put_(true,(3));
  54716. $ctx1.sendIdx["at:put:"]=3;
  54717. $recv($1)._at_put_((1).__at((3)),(-4));
  54718. $ctx1.sendIdx["at:put:"]=4;
  54719. $recv($1)._at_put_($self["@sampleBlock"],(9));
  54720. $ctx1.sendIdx["at:put:"]=5;
  54721. $recv($1)._at_put_("new","N");
  54722. return $recv($1)._yourself();
  54723. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.DictionaryTest)});
  54724. },
  54725. args: [],
  54726. 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",
  54727. referencedClasses: ["Dictionary"],
  54728. messageSends: ["at:put:", "new", "@", "yourself"]
  54729. }),
  54730. $globals.DictionaryTest);
  54731. $core.addMethod(
  54732. $core.method({
  54733. selector: "sampleNewValueAsCollection",
  54734. protocol: "fixture",
  54735. fn: function (){
  54736. var self=this,$self=this;
  54737. return $core.withContext(function($ctx1) {
  54738. var $1;
  54739. $1=$recv($globals.Dictionary)._new();
  54740. $recv($1)._at_put_("new","N");
  54741. return $recv($1)._yourself();
  54742. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.DictionaryTest)});
  54743. },
  54744. args: [],
  54745. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  54746. referencedClasses: ["Dictionary"],
  54747. messageSends: ["at:put:", "new", "yourself"]
  54748. }),
  54749. $globals.DictionaryTest);
  54750. $core.addMethod(
  54751. $core.method({
  54752. selector: "samplesDo:",
  54753. protocol: "fixture",
  54754. fn: function (aBlock){
  54755. var self=this,$self=this;
  54756. return $core.withContext(function($ctx1) {
  54757. (
  54758. $ctx1.supercall = true,
  54759. ($globals.DictionaryTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($self, [aBlock]));
  54760. $ctx1.supercall = false;
  54761. $recv(aBlock)._value_value_(true,(3));
  54762. $ctx1.sendIdx["value:value:"]=1;
  54763. $recv(aBlock)._value_value_((1).__at((3)),(-4));
  54764. $ctx1.sendIdx["value:value:"]=2;
  54765. $recv(aBlock)._value_value_($self["@sampleBlock"],(9));
  54766. return self;
  54767. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.DictionaryTest)});
  54768. },
  54769. args: ["aBlock"],
  54770. 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",
  54771. referencedClasses: [],
  54772. messageSends: ["samplesDo:", "value:value:", "@"]
  54773. }),
  54774. $globals.DictionaryTest);
  54775. $core.addMethod(
  54776. $core.method({
  54777. selector: "testAccessing",
  54778. protocol: "tests",
  54779. fn: function (){
  54780. var self=this,$self=this;
  54781. var d;
  54782. return $core.withContext(function($ctx1) {
  54783. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  54784. d=$recv($globals.Dictionary)._new();
  54785. $recv(d)._at_put_("hello","world");
  54786. $ctx1.sendIdx["at:put:"]=1;
  54787. $1=$recv(d)._at_("hello");
  54788. $ctx1.sendIdx["at:"]=1;
  54789. $self._assert_equals_($1,"world");
  54790. $ctx1.sendIdx["assert:equals:"]=1;
  54791. $2=$recv(d)._at_ifAbsent_("hello",(function(){
  54792. return nil;
  54793. }));
  54794. $ctx1.sendIdx["at:ifAbsent:"]=1;
  54795. $self._assert_equals_($2,"world");
  54796. $ctx1.sendIdx["assert:equals:"]=2;
  54797. $self._deny_($recv($recv(d)._at_ifAbsent_("foo",(function(){
  54798. return nil;
  54799. }))).__eq("world"));
  54800. $ctx1.sendIdx["deny:"]=1;
  54801. $3=$recv(d)._includesKey_("hello");
  54802. $ctx1.sendIdx["includesKey:"]=1;
  54803. $self._assert_($3);
  54804. $ctx1.sendIdx["assert:"]=1;
  54805. $4=$recv(d)._includesKey_("foo");
  54806. $ctx1.sendIdx["includesKey:"]=2;
  54807. $self._deny_($4);
  54808. $ctx1.sendIdx["deny:"]=2;
  54809. $recv(d)._at_put_((1),(2));
  54810. $ctx1.sendIdx["at:put:"]=2;
  54811. $5=$recv(d)._at_((1));
  54812. $ctx1.sendIdx["at:"]=2;
  54813. $self._assert_equals_($5,(2));
  54814. $ctx1.sendIdx["assert:equals:"]=3;
  54815. $6=d;
  54816. $7=(1).__at((3));
  54817. $ctx1.sendIdx["@"]=1;
  54818. $recv($6)._at_put_($7,(3));
  54819. $9=d;
  54820. $10=(1).__at((3));
  54821. $ctx1.sendIdx["@"]=2;
  54822. $8=$recv($9)._at_($10);
  54823. $self._assert_equals_($8,(3));
  54824. $12=d;
  54825. $13=(1).__at((3));
  54826. $ctx1.sendIdx["@"]=3;
  54827. $11=$recv($12)._includesKey_($13);
  54828. $ctx1.sendIdx["includesKey:"]=3;
  54829. $self._assert_($11);
  54830. $self._deny_($recv(d)._includesKey_((3).__at((1))));
  54831. return self;
  54832. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},$globals.DictionaryTest)});
  54833. },
  54834. args: [],
  54835. 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)",
  54836. referencedClasses: ["Dictionary"],
  54837. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"]
  54838. }),
  54839. $globals.DictionaryTest);
  54840. $core.addMethod(
  54841. $core.method({
  54842. selector: "testDynamicDictionaries",
  54843. protocol: "tests",
  54844. fn: function (){
  54845. var self=this,$self=this;
  54846. return $core.withContext(function($ctx1) {
  54847. $self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asDictionary(),$recv($globals.Dictionary)._with_("hello".__minus_gt((1))));
  54848. return self;
  54849. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.DictionaryTest)});
  54850. },
  54851. args: [],
  54852. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  54853. referencedClasses: ["Dictionary"],
  54854. messageSends: ["assert:equals:", "asDictionary", "with:", "->"]
  54855. }),
  54856. $globals.DictionaryTest);
  54857. $core.addMethod(
  54858. $core.method({
  54859. selector: "collectionClass",
  54860. protocol: "fixture",
  54861. fn: function (){
  54862. var self=this,$self=this;
  54863. return $globals.Dictionary;
  54864. },
  54865. args: [],
  54866. source: "collectionClass\x0a\x09^ Dictionary",
  54867. referencedClasses: ["Dictionary"],
  54868. messageSends: []
  54869. }),
  54870. $globals.DictionaryTest.a$cls);
  54871. $core.addClass("HashedCollectionTest", $globals.AssociativeCollectionTest, [], "Kernel-Tests");
  54872. $core.addMethod(
  54873. $core.method({
  54874. selector: "collection",
  54875. protocol: "fixture",
  54876. fn: function (){
  54877. var self=this,$self=this;
  54878. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4)]);
  54879. },
  54880. args: [],
  54881. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  54882. referencedClasses: [],
  54883. messageSends: []
  54884. }),
  54885. $globals.HashedCollectionTest);
  54886. $core.addMethod(
  54887. $core.method({
  54888. selector: "collectionKeys",
  54889. protocol: "fixture",
  54890. fn: function (){
  54891. var self=this,$self=this;
  54892. return ["b","a","c","d"];
  54893. },
  54894. args: [],
  54895. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  54896. referencedClasses: [],
  54897. messageSends: []
  54898. }),
  54899. $globals.HashedCollectionTest);
  54900. $core.addMethod(
  54901. $core.method({
  54902. selector: "collectionOfPrintStrings",
  54903. protocol: "fixture",
  54904. fn: function (){
  54905. var self=this,$self=this;
  54906. return $globals.HashedCollection._newFromPairs_(["b","1","a","2","c","3","d","-4"]);
  54907. },
  54908. args: [],
  54909. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  54910. referencedClasses: [],
  54911. messageSends: []
  54912. }),
  54913. $globals.HashedCollectionTest);
  54914. $core.addMethod(
  54915. $core.method({
  54916. selector: "collectionSize",
  54917. protocol: "fixture",
  54918. fn: function (){
  54919. var self=this,$self=this;
  54920. return (4);
  54921. },
  54922. args: [],
  54923. source: "collectionSize\x0a\x09^ 4",
  54924. referencedClasses: [],
  54925. messageSends: []
  54926. }),
  54927. $globals.HashedCollectionTest);
  54928. $core.addMethod(
  54929. $core.method({
  54930. selector: "collectionValues",
  54931. protocol: "fixture",
  54932. fn: function (){
  54933. var self=this,$self=this;
  54934. return [(1),(2),(3),(-4)];
  54935. },
  54936. args: [],
  54937. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  54938. referencedClasses: [],
  54939. messageSends: []
  54940. }),
  54941. $globals.HashedCollectionTest);
  54942. $core.addMethod(
  54943. $core.method({
  54944. selector: "collectionWithDuplicates",
  54945. protocol: "fixture",
  54946. fn: function (){
  54947. var self=this,$self=this;
  54948. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"e",(1),"f",(2),"g",(10),"h",(0)]);
  54949. },
  54950. args: [],
  54951. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10. 'h' -> 0 }",
  54952. referencedClasses: [],
  54953. messageSends: []
  54954. }),
  54955. $globals.HashedCollectionTest);
  54956. $core.addMethod(
  54957. $core.method({
  54958. selector: "collectionWithNewValue",
  54959. protocol: "fixture",
  54960. fn: function (){
  54961. var self=this,$self=this;
  54962. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"new","N"]);
  54963. },
  54964. args: [],
  54965. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  54966. referencedClasses: [],
  54967. messageSends: []
  54968. }),
  54969. $globals.HashedCollectionTest);
  54970. $core.addMethod(
  54971. $core.method({
  54972. selector: "sampleNewValueAsCollection",
  54973. protocol: "fixture",
  54974. fn: function (){
  54975. var self=this,$self=this;
  54976. return $globals.HashedCollection._newFromPairs_(["new","N"]);
  54977. },
  54978. args: [],
  54979. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  54980. referencedClasses: [],
  54981. messageSends: []
  54982. }),
  54983. $globals.HashedCollectionTest);
  54984. $core.addMethod(
  54985. $core.method({
  54986. selector: "testDynamicDictionaries",
  54987. protocol: "tests",
  54988. fn: function (){
  54989. var self=this,$self=this;
  54990. return $core.withContext(function($ctx1) {
  54991. $self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asHashedCollection(),$recv($globals.HashedCollection)._with_("hello".__minus_gt((1))));
  54992. return self;
  54993. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.HashedCollectionTest)});
  54994. },
  54995. args: [],
  54996. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  54997. referencedClasses: ["HashedCollection"],
  54998. messageSends: ["assert:equals:", "asHashedCollection", "with:", "->"]
  54999. }),
  55000. $globals.HashedCollectionTest);
  55001. $core.addMethod(
  55002. $core.method({
  55003. selector: "collectionClass",
  55004. protocol: "fixture",
  55005. fn: function (){
  55006. var self=this,$self=this;
  55007. return $globals.HashedCollection;
  55008. },
  55009. args: [],
  55010. source: "collectionClass\x0a\x09^ HashedCollection",
  55011. referencedClasses: ["HashedCollection"],
  55012. messageSends: []
  55013. }),
  55014. $globals.HashedCollectionTest.a$cls);
  55015. $core.addClass("SequenceableCollectionTest", $globals.IndexableCollectionTest, [], "Kernel-Tests");
  55016. $core.addMethod(
  55017. $core.method({
  55018. selector: "collectionFirst",
  55019. protocol: "fixture",
  55020. fn: function (){
  55021. var self=this,$self=this;
  55022. return $core.withContext(function($ctx1) {
  55023. $self._subclassResponsibility();
  55024. return self;
  55025. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},$globals.SequenceableCollectionTest)});
  55026. },
  55027. args: [],
  55028. source: "collectionFirst\x0a\x09self subclassResponsibility",
  55029. referencedClasses: [],
  55030. messageSends: ["subclassResponsibility"]
  55031. }),
  55032. $globals.SequenceableCollectionTest);
  55033. $core.addMethod(
  55034. $core.method({
  55035. selector: "collectionFirstTwo",
  55036. protocol: "fixture",
  55037. fn: function (){
  55038. var self=this,$self=this;
  55039. return $core.withContext(function($ctx1) {
  55040. $self._subclassResponsibility();
  55041. return self;
  55042. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},$globals.SequenceableCollectionTest)});
  55043. },
  55044. args: [],
  55045. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  55046. referencedClasses: [],
  55047. messageSends: ["subclassResponsibility"]
  55048. }),
  55049. $globals.SequenceableCollectionTest);
  55050. $core.addMethod(
  55051. $core.method({
  55052. selector: "collectionLast",
  55053. protocol: "fixture",
  55054. fn: function (){
  55055. var self=this,$self=this;
  55056. return $core.withContext(function($ctx1) {
  55057. $self._subclassResponsibility();
  55058. return self;
  55059. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},$globals.SequenceableCollectionTest)});
  55060. },
  55061. args: [],
  55062. source: "collectionLast\x0a\x09self subclassResponsibility",
  55063. referencedClasses: [],
  55064. messageSends: ["subclassResponsibility"]
  55065. }),
  55066. $globals.SequenceableCollectionTest);
  55067. $core.addMethod(
  55068. $core.method({
  55069. selector: "collectionLastTwo",
  55070. protocol: "fixture",
  55071. fn: function (){
  55072. var self=this,$self=this;
  55073. return $core.withContext(function($ctx1) {
  55074. $self._subclassResponsibility();
  55075. return self;
  55076. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},$globals.SequenceableCollectionTest)});
  55077. },
  55078. args: [],
  55079. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  55080. referencedClasses: [],
  55081. messageSends: ["subclassResponsibility"]
  55082. }),
  55083. $globals.SequenceableCollectionTest);
  55084. $core.addMethod(
  55085. $core.method({
  55086. selector: "nonIndexesDo:",
  55087. protocol: "fixture",
  55088. fn: function (aBlock){
  55089. var self=this,$self=this;
  55090. return $core.withContext(function($ctx1) {
  55091. $recv(aBlock)._value_((0));
  55092. $ctx1.sendIdx["value:"]=1;
  55093. $recv(aBlock)._value_($recv($self._collectionSize()).__plus((1)));
  55094. $ctx1.sendIdx["value:"]=2;
  55095. $recv(aBlock)._value_("z");
  55096. return self;
  55097. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  55098. },
  55099. args: ["aBlock"],
  55100. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  55101. referencedClasses: [],
  55102. messageSends: ["value:", "+", "collectionSize"]
  55103. }),
  55104. $globals.SequenceableCollectionTest);
  55105. $core.addMethod(
  55106. $core.method({
  55107. selector: "samplesDo:",
  55108. protocol: "fixture",
  55109. fn: function (aBlock){
  55110. var self=this,$self=this;
  55111. return $core.withContext(function($ctx1) {
  55112. $recv(aBlock)._value_value_((1),$self._collectionFirst());
  55113. $ctx1.sendIdx["value:value:"]=1;
  55114. $recv(aBlock)._value_value_($self._collectionSize(),$self._collectionLast());
  55115. return self;
  55116. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  55117. },
  55118. args: ["aBlock"],
  55119. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  55120. referencedClasses: [],
  55121. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"]
  55122. }),
  55123. $globals.SequenceableCollectionTest);
  55124. $core.addMethod(
  55125. $core.method({
  55126. selector: "testBeginsWith",
  55127. protocol: "tests",
  55128. fn: function (){
  55129. var self=this,$self=this;
  55130. return $core.withContext(function($ctx1) {
  55131. var $2,$1,$4,$5,$3,$7,$6;
  55132. $2=$self._collection();
  55133. $ctx1.sendIdx["collection"]=1;
  55134. $1=$recv($2)._beginsWith_($recv($self._collectionClass())._new());
  55135. $ctx1.sendIdx["beginsWith:"]=1;
  55136. $self._assert_($1);
  55137. $ctx1.sendIdx["assert:"]=1;
  55138. $4=$self._collection();
  55139. $ctx1.sendIdx["collection"]=2;
  55140. $5=$self._collection();
  55141. $ctx1.sendIdx["collection"]=3;
  55142. $3=$recv($4)._beginsWith_($5);
  55143. $ctx1.sendIdx["beginsWith:"]=2;
  55144. $self._assert_($3);
  55145. $ctx1.sendIdx["assert:"]=2;
  55146. $7=$self._collection();
  55147. $ctx1.sendIdx["collection"]=4;
  55148. $6=$recv($7)._beginsWith_($self._collectionFirstTwo());
  55149. $ctx1.sendIdx["beginsWith:"]=3;
  55150. $self._assert_($6);
  55151. $self._deny_($recv($self._collection())._beginsWith_($self._collectionLastTwo()));
  55152. return self;
  55153. }, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},$globals.SequenceableCollectionTest)});
  55154. },
  55155. args: [],
  55156. 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)",
  55157. referencedClasses: [],
  55158. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"]
  55159. }),
  55160. $globals.SequenceableCollectionTest);
  55161. $core.addMethod(
  55162. $core.method({
  55163. selector: "testEndsWith",
  55164. protocol: "tests",
  55165. fn: function (){
  55166. var self=this,$self=this;
  55167. return $core.withContext(function($ctx1) {
  55168. var $2,$1,$4,$5,$3,$7,$6;
  55169. $2=$self._collection();
  55170. $ctx1.sendIdx["collection"]=1;
  55171. $1=$recv($2)._endsWith_($recv($self._collectionClass())._new());
  55172. $ctx1.sendIdx["endsWith:"]=1;
  55173. $self._assert_($1);
  55174. $ctx1.sendIdx["assert:"]=1;
  55175. $4=$self._collection();
  55176. $ctx1.sendIdx["collection"]=2;
  55177. $5=$self._collection();
  55178. $ctx1.sendIdx["collection"]=3;
  55179. $3=$recv($4)._endsWith_($5);
  55180. $ctx1.sendIdx["endsWith:"]=2;
  55181. $self._assert_($3);
  55182. $ctx1.sendIdx["assert:"]=2;
  55183. $7=$self._collection();
  55184. $ctx1.sendIdx["collection"]=4;
  55185. $6=$recv($7)._endsWith_($self._collectionLastTwo());
  55186. $ctx1.sendIdx["endsWith:"]=3;
  55187. $self._assert_($6);
  55188. $self._deny_($recv($self._collection())._endsWith_($self._collectionFirstTwo()));
  55189. return self;
  55190. }, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},$globals.SequenceableCollectionTest)});
  55191. },
  55192. args: [],
  55193. 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)",
  55194. referencedClasses: [],
  55195. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"]
  55196. }),
  55197. $globals.SequenceableCollectionTest);
  55198. $core.addMethod(
  55199. $core.method({
  55200. selector: "testFirst",
  55201. protocol: "tests",
  55202. fn: function (){
  55203. var self=this,$self=this;
  55204. return $core.withContext(function($ctx1) {
  55205. $self._assert_equals_($recv($self._collection())._first(),$self._collectionFirst());
  55206. return self;
  55207. }, function($ctx1) {$ctx1.fill(self,"testFirst",{},$globals.SequenceableCollectionTest)});
  55208. },
  55209. args: [],
  55210. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  55211. referencedClasses: [],
  55212. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"]
  55213. }),
  55214. $globals.SequenceableCollectionTest);
  55215. $core.addMethod(
  55216. $core.method({
  55217. selector: "testFirstN",
  55218. protocol: "tests",
  55219. fn: function (){
  55220. var self=this,$self=this;
  55221. return $core.withContext(function($ctx1) {
  55222. var $2,$1,$4,$3,$6,$5,$7;
  55223. $2=$self._collection();
  55224. $ctx1.sendIdx["collection"]=1;
  55225. $1=$recv($2)._first_((2));
  55226. $ctx1.sendIdx["first:"]=1;
  55227. $self._assert_equals_($1,$self._collectionFirstTwo());
  55228. $ctx1.sendIdx["assert:equals:"]=1;
  55229. $4=$self._collection();
  55230. $ctx1.sendIdx["collection"]=2;
  55231. $3=$recv($4)._first_((0));
  55232. $ctx1.sendIdx["first:"]=2;
  55233. $self._assert_equals_($3,$recv($self._collectionClass())._new());
  55234. $ctx1.sendIdx["assert:equals:"]=2;
  55235. $6=$self._collection();
  55236. $ctx1.sendIdx["collection"]=3;
  55237. $5=$recv($6)._first_($self._collectionSize());
  55238. $ctx1.sendIdx["first:"]=3;
  55239. $7=$self._collection();
  55240. $ctx1.sendIdx["collection"]=4;
  55241. $self._assert_equals_($5,$7);
  55242. $self._should_raise_((function(){
  55243. return $core.withContext(function($ctx2) {
  55244. return $recv($self._collection())._first_((33));
  55245. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55246. }),$globals.Error);
  55247. return self;
  55248. }, function($ctx1) {$ctx1.fill(self,"testFirstN",{},$globals.SequenceableCollectionTest)});
  55249. },
  55250. args: [],
  55251. 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",
  55252. referencedClasses: ["Error"],
  55253. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  55254. }),
  55255. $globals.SequenceableCollectionTest);
  55256. $core.addMethod(
  55257. $core.method({
  55258. selector: "testFourth",
  55259. protocol: "tests",
  55260. fn: function (){
  55261. var self=this,$self=this;
  55262. return $core.withContext(function($ctx1) {
  55263. var $2,$1;
  55264. $2=$self._collection();
  55265. $ctx1.sendIdx["collection"]=1;
  55266. $1=$recv($2)._fourth();
  55267. $self._assert_equals_($1,$recv($self._collection())._at_((4)));
  55268. return self;
  55269. }, function($ctx1) {$ctx1.fill(self,"testFourth",{},$globals.SequenceableCollectionTest)});
  55270. },
  55271. args: [],
  55272. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  55273. referencedClasses: [],
  55274. messageSends: ["assert:equals:", "fourth", "collection", "at:"]
  55275. }),
  55276. $globals.SequenceableCollectionTest);
  55277. $core.addMethod(
  55278. $core.method({
  55279. selector: "testIndexOfStartingAt",
  55280. protocol: "tests",
  55281. fn: function (){
  55282. var self=this,$self=this;
  55283. var jsNull;
  55284. return $core.withContext(function($ctx1) {
  55285. var $2,$1,$4,$3;
  55286. jsNull=$recv($globals.JSON)._parse_("null");
  55287. $self._samplesDo_((function(index,value){
  55288. return $core.withContext(function($ctx2) {
  55289. $2=$self._collection();
  55290. $ctx2.sendIdx["collection"]=1;
  55291. $1=$recv($2)._indexOf_startingAt_(value,(1));
  55292. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  55293. $self._assert_equals_($1,index);
  55294. $ctx2.sendIdx["assert:equals:"]=1;
  55295. $4=$self._collection();
  55296. $ctx2.sendIdx["collection"]=2;
  55297. $3=$recv($4)._indexOf_startingAt_(value,index);
  55298. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  55299. $self._assert_equals_($3,index);
  55300. $ctx2.sendIdx["assert:equals:"]=2;
  55301. return $self._assert_equals_($recv($self._collection())._indexOf_startingAt_(value,$recv(index).__plus((1))),(0));
  55302. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  55303. }));
  55304. return self;
  55305. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  55306. },
  55307. args: [],
  55308. 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 ]",
  55309. referencedClasses: ["JSON"],
  55310. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"]
  55311. }),
  55312. $globals.SequenceableCollectionTest);
  55313. $core.addMethod(
  55314. $core.method({
  55315. selector: "testIndexOfStartingAtWithNull",
  55316. protocol: "tests",
  55317. fn: function (){
  55318. var self=this,$self=this;
  55319. var jsNull;
  55320. return $core.withContext(function($ctx1) {
  55321. var $1,$2;
  55322. jsNull=$recv($globals.JSON)._parse_("null");
  55323. $self._samplesDo_((function(index,value){
  55324. var collection;
  55325. return $core.withContext(function($ctx2) {
  55326. collection=$self._collection();
  55327. $recv(collection)._at_put_(index,jsNull);
  55328. $1=$recv(collection)._indexOf_startingAt_(jsNull,(1));
  55329. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  55330. $self._assert_equals_($1,index);
  55331. $ctx2.sendIdx["assert:equals:"]=1;
  55332. $2=$recv(collection)._indexOf_startingAt_(jsNull,index);
  55333. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  55334. $self._assert_equals_($2,index);
  55335. $ctx2.sendIdx["assert:equals:"]=2;
  55336. return $self._assert_equals_($recv(collection)._indexOf_startingAt_(jsNull,$recv(index).__plus((1))),(0));
  55337. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)});
  55338. }));
  55339. return self;
  55340. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  55341. },
  55342. args: [],
  55343. 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 ]",
  55344. referencedClasses: ["JSON"],
  55345. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"]
  55346. }),
  55347. $globals.SequenceableCollectionTest);
  55348. $core.addMethod(
  55349. $core.method({
  55350. selector: "testLast",
  55351. protocol: "tests",
  55352. fn: function (){
  55353. var self=this,$self=this;
  55354. return $core.withContext(function($ctx1) {
  55355. $self._assert_equals_($recv($self._collection())._last(),$self._collectionLast());
  55356. return self;
  55357. }, function($ctx1) {$ctx1.fill(self,"testLast",{},$globals.SequenceableCollectionTest)});
  55358. },
  55359. args: [],
  55360. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  55361. referencedClasses: [],
  55362. messageSends: ["assert:equals:", "last", "collection", "collectionLast"]
  55363. }),
  55364. $globals.SequenceableCollectionTest);
  55365. $core.addMethod(
  55366. $core.method({
  55367. selector: "testLastN",
  55368. protocol: "tests",
  55369. fn: function (){
  55370. var self=this,$self=this;
  55371. return $core.withContext(function($ctx1) {
  55372. var $2,$1,$4,$3,$6,$5,$7;
  55373. $2=$self._collection();
  55374. $ctx1.sendIdx["collection"]=1;
  55375. $1=$recv($2)._last_((2));
  55376. $ctx1.sendIdx["last:"]=1;
  55377. $self._assert_equals_($1,$self._collectionLastTwo());
  55378. $ctx1.sendIdx["assert:equals:"]=1;
  55379. $4=$self._collection();
  55380. $ctx1.sendIdx["collection"]=2;
  55381. $3=$recv($4)._last_((0));
  55382. $ctx1.sendIdx["last:"]=2;
  55383. $self._assert_equals_($3,$recv($self._collectionClass())._new());
  55384. $ctx1.sendIdx["assert:equals:"]=2;
  55385. $6=$self._collection();
  55386. $ctx1.sendIdx["collection"]=3;
  55387. $5=$recv($6)._last_($self._collectionSize());
  55388. $ctx1.sendIdx["last:"]=3;
  55389. $7=$self._collection();
  55390. $ctx1.sendIdx["collection"]=4;
  55391. $self._assert_equals_($5,$7);
  55392. $self._should_raise_((function(){
  55393. return $core.withContext(function($ctx2) {
  55394. return $recv($self._collection())._last_((33));
  55395. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55396. }),$globals.Error);
  55397. return self;
  55398. }, function($ctx1) {$ctx1.fill(self,"testLastN",{},$globals.SequenceableCollectionTest)});
  55399. },
  55400. args: [],
  55401. 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",
  55402. referencedClasses: ["Error"],
  55403. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  55404. }),
  55405. $globals.SequenceableCollectionTest);
  55406. $core.addMethod(
  55407. $core.method({
  55408. selector: "testSecond",
  55409. protocol: "tests",
  55410. fn: function (){
  55411. var self=this,$self=this;
  55412. return $core.withContext(function($ctx1) {
  55413. var $2,$1;
  55414. $2=$self._collection();
  55415. $ctx1.sendIdx["collection"]=1;
  55416. $1=$recv($2)._second();
  55417. $self._assert_equals_($1,$recv($self._collection())._at_((2)));
  55418. return self;
  55419. }, function($ctx1) {$ctx1.fill(self,"testSecond",{},$globals.SequenceableCollectionTest)});
  55420. },
  55421. args: [],
  55422. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  55423. referencedClasses: [],
  55424. messageSends: ["assert:equals:", "second", "collection", "at:"]
  55425. }),
  55426. $globals.SequenceableCollectionTest);
  55427. $core.addMethod(
  55428. $core.method({
  55429. selector: "testThird",
  55430. protocol: "tests",
  55431. fn: function (){
  55432. var self=this,$self=this;
  55433. return $core.withContext(function($ctx1) {
  55434. var $2,$1;
  55435. $2=$self._collection();
  55436. $ctx1.sendIdx["collection"]=1;
  55437. $1=$recv($2)._third();
  55438. $self._assert_equals_($1,$recv($self._collection())._at_((3)));
  55439. return self;
  55440. }, function($ctx1) {$ctx1.fill(self,"testThird",{},$globals.SequenceableCollectionTest)});
  55441. },
  55442. args: [],
  55443. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  55444. referencedClasses: [],
  55445. messageSends: ["assert:equals:", "third", "collection", "at:"]
  55446. }),
  55447. $globals.SequenceableCollectionTest);
  55448. $core.addClass("ArrayTest", $globals.SequenceableCollectionTest, [], "Kernel-Tests");
  55449. $core.addMethod(
  55450. $core.method({
  55451. selector: "collection",
  55452. protocol: "fixture",
  55453. fn: function (){
  55454. var self=this,$self=this;
  55455. return [(1), (2), (3), (-4)];
  55456. },
  55457. args: [],
  55458. source: "collection\x0a\x09^ #(1 2 3 -4)",
  55459. referencedClasses: [],
  55460. messageSends: []
  55461. }),
  55462. $globals.ArrayTest);
  55463. $core.addMethod(
  55464. $core.method({
  55465. selector: "collectionFirst",
  55466. protocol: "fixture",
  55467. fn: function (){
  55468. var self=this,$self=this;
  55469. return (1);
  55470. },
  55471. args: [],
  55472. source: "collectionFirst\x0a\x09^ 1",
  55473. referencedClasses: [],
  55474. messageSends: []
  55475. }),
  55476. $globals.ArrayTest);
  55477. $core.addMethod(
  55478. $core.method({
  55479. selector: "collectionFirstTwo",
  55480. protocol: "fixture",
  55481. fn: function (){
  55482. var self=this,$self=this;
  55483. return [(1), (2)];
  55484. },
  55485. args: [],
  55486. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  55487. referencedClasses: [],
  55488. messageSends: []
  55489. }),
  55490. $globals.ArrayTest);
  55491. $core.addMethod(
  55492. $core.method({
  55493. selector: "collectionLast",
  55494. protocol: "fixture",
  55495. fn: function (){
  55496. var self=this,$self=this;
  55497. return (-4);
  55498. },
  55499. args: [],
  55500. source: "collectionLast\x0a\x09^ -4",
  55501. referencedClasses: [],
  55502. messageSends: []
  55503. }),
  55504. $globals.ArrayTest);
  55505. $core.addMethod(
  55506. $core.method({
  55507. selector: "collectionLastTwo",
  55508. protocol: "fixture",
  55509. fn: function (){
  55510. var self=this,$self=this;
  55511. return [(3), (-4)];
  55512. },
  55513. args: [],
  55514. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  55515. referencedClasses: [],
  55516. messageSends: []
  55517. }),
  55518. $globals.ArrayTest);
  55519. $core.addMethod(
  55520. $core.method({
  55521. selector: "collectionOfPrintStrings",
  55522. protocol: "fixture",
  55523. fn: function (){
  55524. var self=this,$self=this;
  55525. return ["1", "2", "3", "-4"];
  55526. },
  55527. args: [],
  55528. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  55529. referencedClasses: [],
  55530. messageSends: []
  55531. }),
  55532. $globals.ArrayTest);
  55533. $core.addMethod(
  55534. $core.method({
  55535. selector: "collectionSize",
  55536. protocol: "fixture",
  55537. fn: function (){
  55538. var self=this,$self=this;
  55539. return (4);
  55540. },
  55541. args: [],
  55542. source: "collectionSize\x0a\x09^ 4",
  55543. referencedClasses: [],
  55544. messageSends: []
  55545. }),
  55546. $globals.ArrayTest);
  55547. $core.addMethod(
  55548. $core.method({
  55549. selector: "collectionWithDuplicates",
  55550. protocol: "fixture",
  55551. fn: function (){
  55552. var self=this,$self=this;
  55553. return ["a", "b", "c", (1), (2), (1), "a", []];
  55554. },
  55555. args: [],
  55556. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a' ())",
  55557. referencedClasses: [],
  55558. messageSends: []
  55559. }),
  55560. $globals.ArrayTest);
  55561. $core.addMethod(
  55562. $core.method({
  55563. selector: "collectionWithNewValue",
  55564. protocol: "fixture",
  55565. fn: function (){
  55566. var self=this,$self=this;
  55567. return [(1), (2), (3), (-4), "N"];
  55568. },
  55569. args: [],
  55570. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  55571. referencedClasses: [],
  55572. messageSends: []
  55573. }),
  55574. $globals.ArrayTest);
  55575. $core.addMethod(
  55576. $core.method({
  55577. selector: "sampleNewIndex",
  55578. protocol: "fixture",
  55579. fn: function (){
  55580. var self=this,$self=this;
  55581. return (5);
  55582. },
  55583. args: [],
  55584. source: "sampleNewIndex\x0a\x09^ 5",
  55585. referencedClasses: [],
  55586. messageSends: []
  55587. }),
  55588. $globals.ArrayTest);
  55589. $core.addMethod(
  55590. $core.method({
  55591. selector: "samplesDo:",
  55592. protocol: "fixture",
  55593. fn: function (aBlock){
  55594. var self=this,$self=this;
  55595. return $core.withContext(function($ctx1) {
  55596. (
  55597. $ctx1.supercall = true,
  55598. ($globals.ArrayTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($self, [aBlock]));
  55599. $ctx1.supercall = false;
  55600. $recv(aBlock)._value_value_((3),(3));
  55601. return self;
  55602. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.ArrayTest)});
  55603. },
  55604. args: ["aBlock"],
  55605. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  55606. referencedClasses: [],
  55607. messageSends: ["samplesDo:", "value:value:"]
  55608. }),
  55609. $globals.ArrayTest);
  55610. $core.addMethod(
  55611. $core.method({
  55612. selector: "testAdd",
  55613. protocol: "tests",
  55614. fn: function (){
  55615. var self=this,$self=this;
  55616. var array;
  55617. return $core.withContext(function($ctx1) {
  55618. array=$self._collection();
  55619. $recv(array)._add_((6));
  55620. $self._assert_equals_($recv(array)._last(),(6));
  55621. return self;
  55622. }, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},$globals.ArrayTest)});
  55623. },
  55624. args: [],
  55625. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  55626. referencedClasses: [],
  55627. messageSends: ["collection", "add:", "assert:equals:", "last"]
  55628. }),
  55629. $globals.ArrayTest);
  55630. $core.addMethod(
  55631. $core.method({
  55632. selector: "testAddFirst",
  55633. protocol: "tests",
  55634. fn: function (){
  55635. var self=this,$self=this;
  55636. return $core.withContext(function($ctx1) {
  55637. var $3,$2,$1;
  55638. $3=$self._collection();
  55639. $recv($3)._addFirst_((0));
  55640. $2=$recv($3)._yourself();
  55641. $1=$recv($2)._first();
  55642. $self._assert_equals_($1,(0));
  55643. return self;
  55644. }, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},$globals.ArrayTest)});
  55645. },
  55646. args: [],
  55647. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  55648. referencedClasses: [],
  55649. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"]
  55650. }),
  55651. $globals.ArrayTest);
  55652. $core.addMethod(
  55653. $core.method({
  55654. selector: "testPrintString",
  55655. protocol: "tests",
  55656. fn: function (){
  55657. var self=this,$self=this;
  55658. var array;
  55659. return $core.withContext(function($ctx1) {
  55660. var $1,$2,$3,$4,$5,$6,$7,$8;
  55661. array=$recv($globals.Array)._new();
  55662. $1=$recv(array)._printString();
  55663. $ctx1.sendIdx["printString"]=1;
  55664. $self._assert_equals_($1,"an Array ()");
  55665. $ctx1.sendIdx["assert:equals:"]=1;
  55666. $2=array;
  55667. $recv($2)._add_((1));
  55668. $ctx1.sendIdx["add:"]=1;
  55669. $3=$recv($2)._add_((3));
  55670. $ctx1.sendIdx["add:"]=2;
  55671. $4=$recv(array)._printString();
  55672. $ctx1.sendIdx["printString"]=2;
  55673. $self._assert_equals_($4,"an Array (1 3)");
  55674. $ctx1.sendIdx["assert:equals:"]=2;
  55675. $recv(array)._add_("foo");
  55676. $5=$recv(array)._printString();
  55677. $ctx1.sendIdx["printString"]=3;
  55678. $self._assert_equals_($5,"an Array (1 3 'foo')");
  55679. $ctx1.sendIdx["assert:equals:"]=3;
  55680. $6=array;
  55681. $recv($6)._remove_((1));
  55682. $ctx1.sendIdx["remove:"]=1;
  55683. $recv($6)._remove_((3));
  55684. $7=$recv(array)._printString();
  55685. $ctx1.sendIdx["printString"]=4;
  55686. $self._assert_equals_($7,"an Array ('foo')");
  55687. $ctx1.sendIdx["assert:equals:"]=4;
  55688. $recv(array)._addLast_((3));
  55689. $ctx1.sendIdx["addLast:"]=1;
  55690. $8=$recv(array)._printString();
  55691. $ctx1.sendIdx["printString"]=5;
  55692. $self._assert_equals_($8,"an Array ('foo' 3)");
  55693. $ctx1.sendIdx["assert:equals:"]=5;
  55694. $recv(array)._addLast_((3));
  55695. $self._assert_equals_($recv(array)._printString(),"an Array ('foo' 3 3)");
  55696. return self;
  55697. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},$globals.ArrayTest)});
  55698. },
  55699. args: [],
  55700. 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)'.",
  55701. referencedClasses: ["Array"],
  55702. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"]
  55703. }),
  55704. $globals.ArrayTest);
  55705. $core.addMethod(
  55706. $core.method({
  55707. selector: "testRemove",
  55708. protocol: "tests",
  55709. fn: function (){
  55710. var self=this,$self=this;
  55711. var array;
  55712. return $core.withContext(function($ctx1) {
  55713. array=[(1), (2), (3), (4), (5)];
  55714. $recv(array)._remove_((3));
  55715. $ctx1.sendIdx["remove:"]=1;
  55716. $self._assert_equals_(array,[(1), (2), (4), (5)]);
  55717. $self._should_raise_((function(){
  55718. return $core.withContext(function($ctx2) {
  55719. return $recv(array)._remove_((3));
  55720. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55721. }),$globals.Error);
  55722. return self;
  55723. }, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},$globals.ArrayTest)});
  55724. },
  55725. args: [],
  55726. 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",
  55727. referencedClasses: ["Error"],
  55728. messageSends: ["remove:", "assert:equals:", "should:raise:"]
  55729. }),
  55730. $globals.ArrayTest);
  55731. $core.addMethod(
  55732. $core.method({
  55733. selector: "testRemoveFromTo",
  55734. protocol: "tests",
  55735. fn: function (){
  55736. var self=this,$self=this;
  55737. return $core.withContext(function($ctx1) {
  55738. var $1,$2;
  55739. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  55740. $ctx1.sendIdx["removeFrom:to:"]=1;
  55741. $self._assert_equals_($1,[(4)]);
  55742. $ctx1.sendIdx["assert:equals:"]=1;
  55743. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  55744. $ctx1.sendIdx["removeFrom:to:"]=2;
  55745. $self._assert_equals_($2,[(1), (4)]);
  55746. $ctx1.sendIdx["assert:equals:"]=2;
  55747. $self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  55748. return self;
  55749. }, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},$globals.ArrayTest)});
  55750. },
  55751. args: [],
  55752. 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)",
  55753. referencedClasses: [],
  55754. messageSends: ["assert:equals:", "removeFrom:to:"]
  55755. }),
  55756. $globals.ArrayTest);
  55757. $core.addMethod(
  55758. $core.method({
  55759. selector: "testRemoveIndex",
  55760. protocol: "tests",
  55761. fn: function (){
  55762. var self=this,$self=this;
  55763. return $core.withContext(function($ctx1) {
  55764. var $1,$2;
  55765. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  55766. $ctx1.sendIdx["removeIndex:"]=1;
  55767. $self._assert_equals_($1,[(1), (3), (4)]);
  55768. $ctx1.sendIdx["assert:equals:"]=1;
  55769. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  55770. $ctx1.sendIdx["removeIndex:"]=2;
  55771. $self._assert_equals_($2,[(2), (3), (4)]);
  55772. $ctx1.sendIdx["assert:equals:"]=2;
  55773. $self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  55774. return self;
  55775. }, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},$globals.ArrayTest)});
  55776. },
  55777. args: [],
  55778. 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: #()",
  55779. referencedClasses: [],
  55780. messageSends: ["assert:equals:", "removeIndex:"]
  55781. }),
  55782. $globals.ArrayTest);
  55783. $core.addMethod(
  55784. $core.method({
  55785. selector: "testRemoveLast",
  55786. protocol: "tests",
  55787. fn: function (){
  55788. var self=this,$self=this;
  55789. var array;
  55790. return $core.withContext(function($ctx1) {
  55791. array=[(1), (2)];
  55792. $recv(array)._removeLast();
  55793. $self._assert_equals_($recv(array)._last(),(1));
  55794. return self;
  55795. }, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},$globals.ArrayTest)});
  55796. },
  55797. args: [],
  55798. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  55799. referencedClasses: [],
  55800. messageSends: ["removeLast", "assert:equals:", "last"]
  55801. }),
  55802. $globals.ArrayTest);
  55803. $core.addMethod(
  55804. $core.method({
  55805. selector: "testReversed",
  55806. protocol: "tests",
  55807. fn: function (){
  55808. var self=this,$self=this;
  55809. var array;
  55810. return $core.withContext(function($ctx1) {
  55811. array=[(5), (4), (3), (2), (1)];
  55812. $self._assert_equals_($recv(array)._reversed(),[(1), (2), (3), (4), (5)]);
  55813. return self;
  55814. }, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},$globals.ArrayTest)});
  55815. },
  55816. args: [],
  55817. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  55818. referencedClasses: [],
  55819. messageSends: ["assert:equals:", "reversed"]
  55820. }),
  55821. $globals.ArrayTest);
  55822. $core.addMethod(
  55823. $core.method({
  55824. selector: "testSort",
  55825. protocol: "tests",
  55826. fn: function (){
  55827. var self=this,$self=this;
  55828. var array;
  55829. return $core.withContext(function($ctx1) {
  55830. array=[(10), (1), (5)];
  55831. $recv(array)._sort();
  55832. $self._assert_equals_(array,[(1), (5), (10)]);
  55833. return self;
  55834. }, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},$globals.ArrayTest)});
  55835. },
  55836. args: [],
  55837. source: "testSort\x0a\x09| array |\x0a\x09array := #(10 1 5). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 5 10)",
  55838. referencedClasses: [],
  55839. messageSends: ["sort", "assert:equals:"]
  55840. }),
  55841. $globals.ArrayTest);
  55842. $core.addMethod(
  55843. $core.method({
  55844. selector: "collectionClass",
  55845. protocol: "fixture",
  55846. fn: function (){
  55847. var self=this,$self=this;
  55848. return $globals.Array;
  55849. },
  55850. args: [],
  55851. source: "collectionClass\x0a\x09^ Array",
  55852. referencedClasses: ["Array"],
  55853. messageSends: []
  55854. }),
  55855. $globals.ArrayTest.a$cls);
  55856. $core.addClass("StringTest", $globals.SequenceableCollectionTest, [], "Kernel-Tests");
  55857. $core.addMethod(
  55858. $core.method({
  55859. selector: "collection",
  55860. protocol: "fixture",
  55861. fn: function (){
  55862. var self=this,$self=this;
  55863. return "helLo";
  55864. },
  55865. args: [],
  55866. source: "collection\x0a\x09^ 'helLo'",
  55867. referencedClasses: [],
  55868. messageSends: []
  55869. }),
  55870. $globals.StringTest);
  55871. $core.addMethod(
  55872. $core.method({
  55873. selector: "collectionFirst",
  55874. protocol: "fixture",
  55875. fn: function (){
  55876. var self=this,$self=this;
  55877. return "h";
  55878. },
  55879. args: [],
  55880. source: "collectionFirst\x0a\x09^ 'h'",
  55881. referencedClasses: [],
  55882. messageSends: []
  55883. }),
  55884. $globals.StringTest);
  55885. $core.addMethod(
  55886. $core.method({
  55887. selector: "collectionFirstTwo",
  55888. protocol: "fixture",
  55889. fn: function (){
  55890. var self=this,$self=this;
  55891. return "he";
  55892. },
  55893. args: [],
  55894. source: "collectionFirstTwo\x0a\x09^ 'he'",
  55895. referencedClasses: [],
  55896. messageSends: []
  55897. }),
  55898. $globals.StringTest);
  55899. $core.addMethod(
  55900. $core.method({
  55901. selector: "collectionLast",
  55902. protocol: "fixture",
  55903. fn: function (){
  55904. var self=this,$self=this;
  55905. return "o";
  55906. },
  55907. args: [],
  55908. source: "collectionLast\x0a\x09^ 'o'",
  55909. referencedClasses: [],
  55910. messageSends: []
  55911. }),
  55912. $globals.StringTest);
  55913. $core.addMethod(
  55914. $core.method({
  55915. selector: "collectionLastTwo",
  55916. protocol: "fixture",
  55917. fn: function (){
  55918. var self=this,$self=this;
  55919. return "Lo";
  55920. },
  55921. args: [],
  55922. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  55923. referencedClasses: [],
  55924. messageSends: []
  55925. }),
  55926. $globals.StringTest);
  55927. $core.addMethod(
  55928. $core.method({
  55929. selector: "collectionOfPrintStrings",
  55930. protocol: "fixture",
  55931. fn: function (){
  55932. var self=this,$self=this;
  55933. return "'h''e''l''L''o'";
  55934. },
  55935. args: [],
  55936. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  55937. referencedClasses: [],
  55938. messageSends: []
  55939. }),
  55940. $globals.StringTest);
  55941. $core.addMethod(
  55942. $core.method({
  55943. selector: "collectionSize",
  55944. protocol: "fixture",
  55945. fn: function (){
  55946. var self=this,$self=this;
  55947. return (5);
  55948. },
  55949. args: [],
  55950. source: "collectionSize\x0a\x09^ 5",
  55951. referencedClasses: [],
  55952. messageSends: []
  55953. }),
  55954. $globals.StringTest);
  55955. $core.addMethod(
  55956. $core.method({
  55957. selector: "collectionWithDuplicates",
  55958. protocol: "fixture",
  55959. fn: function (){
  55960. var self=this,$self=this;
  55961. return "abbaerten";
  55962. },
  55963. args: [],
  55964. source: "collectionWithDuplicates\x0a\x09^ 'abbaerten'",
  55965. referencedClasses: [],
  55966. messageSends: []
  55967. }),
  55968. $globals.StringTest);
  55969. $core.addMethod(
  55970. $core.method({
  55971. selector: "collectionWithNewValue",
  55972. protocol: "fixture",
  55973. fn: function (){
  55974. var self=this,$self=this;
  55975. return "helLoN";
  55976. },
  55977. args: [],
  55978. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  55979. referencedClasses: [],
  55980. messageSends: []
  55981. }),
  55982. $globals.StringTest);
  55983. $core.addMethod(
  55984. $core.method({
  55985. selector: "sampleNewValueAsCollection",
  55986. protocol: "fixture",
  55987. fn: function (){
  55988. var self=this,$self=this;
  55989. return "N";
  55990. },
  55991. args: [],
  55992. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  55993. referencedClasses: [],
  55994. messageSends: []
  55995. }),
  55996. $globals.StringTest);
  55997. $core.addMethod(
  55998. $core.method({
  55999. selector: "samplesDo:",
  56000. protocol: "fixture",
  56001. fn: function (aBlock){
  56002. var self=this,$self=this;
  56003. return $core.withContext(function($ctx1) {
  56004. (
  56005. $ctx1.supercall = true,
  56006. ($globals.StringTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($self, [aBlock]));
  56007. $ctx1.supercall = false;
  56008. $recv(aBlock)._value_value_((3),"l");
  56009. return self;
  56010. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.StringTest)});
  56011. },
  56012. args: ["aBlock"],
  56013. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  56014. referencedClasses: [],
  56015. messageSends: ["samplesDo:", "value:value:"]
  56016. }),
  56017. $globals.StringTest);
  56018. $core.addMethod(
  56019. $core.method({
  56020. selector: "testAddAll",
  56021. protocol: "tests",
  56022. fn: function (){
  56023. var self=this,$self=this;
  56024. return $core.withContext(function($ctx1) {
  56025. var $1;
  56026. $self._should_raise_((function(){
  56027. return $core.withContext(function($ctx2) {
  56028. $1=$self._collection();
  56029. $ctx2.sendIdx["collection"]=1;
  56030. return $recv($1)._addAll_($self._collection());
  56031. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56032. }),$globals.Error);
  56033. return self;
  56034. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.StringTest)});
  56035. },
  56036. args: [],
  56037. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  56038. referencedClasses: ["Error"],
  56039. messageSends: ["should:raise:", "addAll:", "collection"]
  56040. }),
  56041. $globals.StringTest);
  56042. $core.addMethod(
  56043. $core.method({
  56044. selector: "testAddRemove",
  56045. protocol: "tests",
  56046. fn: function (){
  56047. var self=this,$self=this;
  56048. return $core.withContext(function($ctx1) {
  56049. $self._should_raise_((function(){
  56050. return $core.withContext(function($ctx2) {
  56051. return "hello"._add_("a");
  56052. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56053. }),$globals.Error);
  56054. $ctx1.sendIdx["should:raise:"]=1;
  56055. $self._should_raise_((function(){
  56056. return $core.withContext(function($ctx2) {
  56057. return "hello"._remove_("h");
  56058. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  56059. }),$globals.Error);
  56060. return self;
  56061. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},$globals.StringTest)});
  56062. },
  56063. args: [],
  56064. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  56065. referencedClasses: ["Error"],
  56066. messageSends: ["should:raise:", "add:", "remove:"]
  56067. }),
  56068. $globals.StringTest);
  56069. $core.addMethod(
  56070. $core.method({
  56071. selector: "testAsArray",
  56072. protocol: "tests",
  56073. fn: function (){
  56074. var self=this,$self=this;
  56075. return $core.withContext(function($ctx1) {
  56076. $self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  56077. return self;
  56078. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.StringTest)});
  56079. },
  56080. args: [],
  56081. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  56082. referencedClasses: [],
  56083. messageSends: ["assert:equals:", "asArray"]
  56084. }),
  56085. $globals.StringTest);
  56086. $core.addMethod(
  56087. $core.method({
  56088. selector: "testAsLowerCase",
  56089. protocol: "tests",
  56090. fn: function (){
  56091. var self=this,$self=this;
  56092. return $core.withContext(function($ctx1) {
  56093. $self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  56094. return self;
  56095. }, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},$globals.StringTest)});
  56096. },
  56097. args: [],
  56098. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  56099. referencedClasses: [],
  56100. messageSends: ["assert:equals:", "asLowercase"]
  56101. }),
  56102. $globals.StringTest);
  56103. $core.addMethod(
  56104. $core.method({
  56105. selector: "testAsNumber",
  56106. protocol: "tests",
  56107. fn: function (){
  56108. var self=this,$self=this;
  56109. return $core.withContext(function($ctx1) {
  56110. var $1,$2;
  56111. $1="3"._asNumber();
  56112. $ctx1.sendIdx["asNumber"]=1;
  56113. $self._assert_equals_($1,(3));
  56114. $ctx1.sendIdx["assert:equals:"]=1;
  56115. $2="-3"._asNumber();
  56116. $ctx1.sendIdx["asNumber"]=2;
  56117. $self._assert_equals_($2,(-3));
  56118. $ctx1.sendIdx["assert:equals:"]=2;
  56119. $self._assert_equals_("-1.5"._asNumber(),(-1.5));
  56120. return self;
  56121. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.StringTest)});
  56122. },
  56123. args: [],
  56124. 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.",
  56125. referencedClasses: [],
  56126. messageSends: ["assert:equals:", "asNumber"]
  56127. }),
  56128. $globals.StringTest);
  56129. $core.addMethod(
  56130. $core.method({
  56131. selector: "testAsUpperCase",
  56132. protocol: "tests",
  56133. fn: function (){
  56134. var self=this,$self=this;
  56135. return $core.withContext(function($ctx1) {
  56136. $self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  56137. return self;
  56138. }, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},$globals.StringTest)});
  56139. },
  56140. args: [],
  56141. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  56142. referencedClasses: [],
  56143. messageSends: ["assert:equals:", "asUppercase"]
  56144. }),
  56145. $globals.StringTest);
  56146. $core.addMethod(
  56147. $core.method({
  56148. selector: "testAsciiValue",
  56149. protocol: "tests",
  56150. fn: function (){
  56151. var self=this,$self=this;
  56152. var characterA,characterU;
  56153. return $core.withContext(function($ctx1) {
  56154. var $1;
  56155. characterA="A";
  56156. characterU="U";
  56157. $1=$recv(characterA)._asciiValue();
  56158. $ctx1.sendIdx["asciiValue"]=1;
  56159. $self._assert_equals_($1,(65));
  56160. $ctx1.sendIdx["assert:equals:"]=1;
  56161. $self._assert_equals_($recv(characterU)._asciiValue(),(85));
  56162. return self;
  56163. }, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},$globals.StringTest)});
  56164. },
  56165. args: [],
  56166. 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",
  56167. referencedClasses: [],
  56168. messageSends: ["assert:equals:", "asciiValue"]
  56169. }),
  56170. $globals.StringTest);
  56171. $core.addMethod(
  56172. $core.method({
  56173. selector: "testAtIfAbsentPut",
  56174. protocol: "tests",
  56175. fn: function (){
  56176. var self=this,$self=this;
  56177. return $core.withContext(function($ctx1) {
  56178. $self._should_raise_((function(){
  56179. return $core.withContext(function($ctx2) {
  56180. return "hello"._at_ifAbsentPut_((6),(function(){
  56181. return "a";
  56182. }));
  56183. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56184. }),$globals.Error);
  56185. return self;
  56186. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},$globals.StringTest)});
  56187. },
  56188. args: [],
  56189. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  56190. referencedClasses: ["Error"],
  56191. messageSends: ["should:raise:", "at:ifAbsentPut:"]
  56192. }),
  56193. $globals.StringTest);
  56194. $core.addMethod(
  56195. $core.method({
  56196. selector: "testAtPut",
  56197. protocol: "tests",
  56198. fn: function (){
  56199. var self=this,$self=this;
  56200. return $core.withContext(function($ctx1) {
  56201. $self._should_raise_((function(){
  56202. return $core.withContext(function($ctx2) {
  56203. return "hello"._at_put_((1),"a");
  56204. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56205. }),$globals.Error);
  56206. return self;
  56207. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{},$globals.StringTest)});
  56208. },
  56209. args: [],
  56210. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  56211. referencedClasses: ["Error"],
  56212. messageSends: ["should:raise:", "at:put:"]
  56213. }),
  56214. $globals.StringTest);
  56215. $core.addMethod(
  56216. $core.method({
  56217. selector: "testCapitalized",
  56218. protocol: "tests",
  56219. fn: function (){
  56220. var self=this,$self=this;
  56221. return $core.withContext(function($ctx1) {
  56222. var $1,$2,$3;
  56223. $1="test"._capitalized();
  56224. $ctx1.sendIdx["capitalized"]=1;
  56225. $self._assert_equals_($1,"Test");
  56226. $ctx1.sendIdx["assert:equals:"]=1;
  56227. $2="Test"._capitalized();
  56228. $ctx1.sendIdx["capitalized"]=2;
  56229. $self._assert_equals_($2,"Test");
  56230. $ctx1.sendIdx["assert:equals:"]=2;
  56231. $self._assert_equals_(""._capitalized(),"");
  56232. $ctx1.sendIdx["assert:equals:"]=3;
  56233. $3="Test"._isCapitalized();
  56234. $ctx1.sendIdx["isCapitalized"]=1;
  56235. $self._assert_equals_($3,true);
  56236. $ctx1.sendIdx["assert:equals:"]=4;
  56237. $self._assert_equals_("test"._isCapitalized(),false);
  56238. return self;
  56239. }, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},$globals.StringTest)});
  56240. },
  56241. args: [],
  56242. 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.",
  56243. referencedClasses: [],
  56244. messageSends: ["assert:equals:", "capitalized", "isCapitalized"]
  56245. }),
  56246. $globals.StringTest);
  56247. $core.addMethod(
  56248. $core.method({
  56249. selector: "testCharCodeAt",
  56250. protocol: "tests",
  56251. fn: function (){
  56252. var self=this,$self=this;
  56253. return $core.withContext(function($ctx1) {
  56254. var $1,$2,$3,$4,$5;
  56255. $1="jackie"._charCodeAt_((1));
  56256. $ctx1.sendIdx["charCodeAt:"]=1;
  56257. $self._assert_equals_($1,(106));
  56258. $ctx1.sendIdx["assert:equals:"]=1;
  56259. $2="jackie"._charCodeAt_((2));
  56260. $ctx1.sendIdx["charCodeAt:"]=2;
  56261. $self._assert_equals_($2,(97));
  56262. $ctx1.sendIdx["assert:equals:"]=2;
  56263. $3="jackie"._charCodeAt_((3));
  56264. $ctx1.sendIdx["charCodeAt:"]=3;
  56265. $self._assert_equals_($3,(99));
  56266. $ctx1.sendIdx["assert:equals:"]=3;
  56267. $4="jackie"._charCodeAt_((4));
  56268. $ctx1.sendIdx["charCodeAt:"]=4;
  56269. $self._assert_equals_($4,(107));
  56270. $ctx1.sendIdx["assert:equals:"]=4;
  56271. $5="jackie"._charCodeAt_((5));
  56272. $ctx1.sendIdx["charCodeAt:"]=5;
  56273. $self._assert_equals_($5,(105));
  56274. $ctx1.sendIdx["assert:equals:"]=5;
  56275. $self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  56276. return self;
  56277. }, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},$globals.StringTest)});
  56278. },
  56279. args: [],
  56280. 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",
  56281. referencedClasses: [],
  56282. messageSends: ["assert:equals:", "charCodeAt:"]
  56283. }),
  56284. $globals.StringTest);
  56285. $core.addMethod(
  56286. $core.method({
  56287. selector: "testCopyFromTo",
  56288. protocol: "tests",
  56289. fn: function (){
  56290. var self=this,$self=this;
  56291. return $core.withContext(function($ctx1) {
  56292. var $1;
  56293. $1="jackie"._copyFrom_to_((1),(3));
  56294. $ctx1.sendIdx["copyFrom:to:"]=1;
  56295. $self._assert_equals_($1,"jac");
  56296. $ctx1.sendIdx["assert:equals:"]=1;
  56297. $self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  56298. return self;
  56299. }, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},$globals.StringTest)});
  56300. },
  56301. args: [],
  56302. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  56303. referencedClasses: [],
  56304. messageSends: ["assert:equals:", "copyFrom:to:"]
  56305. }),
  56306. $globals.StringTest);
  56307. $core.addMethod(
  56308. $core.method({
  56309. selector: "testCopySeparates",
  56310. protocol: "tests",
  56311. fn: function (){
  56312. var self=this,$self=this;
  56313. return $core.withContext(function($ctx1) {
  56314. var $3,$2,$1;
  56315. $3=$self._collection();
  56316. $ctx1.sendIdx["collection"]=1;
  56317. $2=$recv($3)._copy();
  56318. $1=$recv($2).__eq_eq($self._collection());
  56319. $self._assert_($1);
  56320. return self;
  56321. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{},$globals.StringTest)});
  56322. },
  56323. args: [],
  56324. source: "testCopySeparates\x0a\x09\x22String instances are immutable\x22\x0a\x09self assert: self collection copy == self collection",
  56325. referencedClasses: [],
  56326. messageSends: ["assert:", "==", "copy", "collection"]
  56327. }),
  56328. $globals.StringTest);
  56329. $core.addMethod(
  56330. $core.method({
  56331. selector: "testCopyWithoutAll",
  56332. protocol: "tests",
  56333. fn: function (){
  56334. var self=this,$self=this;
  56335. return $core.withContext(function($ctx1) {
  56336. $self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  56337. return self;
  56338. }, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},$globals.StringTest)});
  56339. },
  56340. args: [],
  56341. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  56342. referencedClasses: [],
  56343. messageSends: ["assert:equals:", "copyWithoutAll:"]
  56344. }),
  56345. $globals.StringTest);
  56346. $core.addMethod(
  56347. $core.method({
  56348. selector: "testEquality",
  56349. protocol: "tests",
  56350. fn: function (){
  56351. var self=this,$self=this;
  56352. return $core.withContext(function($ctx1) {
  56353. var $1,$2,$3;
  56354. $self._assert_equals_("hello","hello");
  56355. $ctx1.sendIdx["assert:equals:"]=1;
  56356. $1="hello".__eq("world");
  56357. $ctx1.sendIdx["="]=1;
  56358. $self._deny_($1);
  56359. $ctx1.sendIdx["deny:"]=1;
  56360. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  56361. })));
  56362. $ctx1.sendIdx["="]=2;
  56363. $self._deny_($2);
  56364. $ctx1.sendIdx["deny:"]=2;
  56365. $3="hello"._yourself();
  56366. $ctx1.sendIdx["yourself"]=1;
  56367. $self._assert_equals_("hello",$3);
  56368. $ctx1.sendIdx["assert:equals:"]=2;
  56369. $self._assert_equals_("hello"._yourself(),"hello");
  56370. $self._deny_("".__eq((0)));
  56371. return self;
  56372. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.StringTest)});
  56373. },
  56374. args: [],
  56375. 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",
  56376. referencedClasses: [],
  56377. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"]
  56378. }),
  56379. $globals.StringTest);
  56380. $core.addMethod(
  56381. $core.method({
  56382. selector: "testIdentity",
  56383. protocol: "tests",
  56384. fn: function (){
  56385. var self=this,$self=this;
  56386. return $core.withContext(function($ctx1) {
  56387. var $1,$2,$4,$3,$5;
  56388. $1="hello".__eq_eq("hello");
  56389. $ctx1.sendIdx["=="]=1;
  56390. $self._assert_($1);
  56391. $ctx1.sendIdx["assert:"]=1;
  56392. $2="hello".__eq_eq("world");
  56393. $ctx1.sendIdx["=="]=2;
  56394. $self._deny_($2);
  56395. $ctx1.sendIdx["deny:"]=1;
  56396. $4="hello"._yourself();
  56397. $ctx1.sendIdx["yourself"]=1;
  56398. $3="hello".__eq_eq($4);
  56399. $ctx1.sendIdx["=="]=3;
  56400. $self._assert_($3);
  56401. $ctx1.sendIdx["assert:"]=2;
  56402. $5=$recv("hello"._yourself()).__eq_eq("hello");
  56403. $ctx1.sendIdx["=="]=4;
  56404. $self._assert_($5);
  56405. $self._deny_("".__eq_eq((0)));
  56406. return self;
  56407. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.StringTest)});
  56408. },
  56409. args: [],
  56410. 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",
  56411. referencedClasses: [],
  56412. messageSends: ["assert:", "==", "deny:", "yourself"]
  56413. }),
  56414. $globals.StringTest);
  56415. $core.addMethod(
  56416. $core.method({
  56417. selector: "testIncludesSubString",
  56418. protocol: "tests",
  56419. fn: function (){
  56420. var self=this,$self=this;
  56421. return $core.withContext(function($ctx1) {
  56422. var $1;
  56423. $1="amber"._includesSubString_("ber");
  56424. $ctx1.sendIdx["includesSubString:"]=1;
  56425. $self._assert_($1);
  56426. $self._deny_("amber"._includesSubString_("zork"));
  56427. return self;
  56428. }, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},$globals.StringTest)});
  56429. },
  56430. args: [],
  56431. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  56432. referencedClasses: [],
  56433. messageSends: ["assert:", "includesSubString:", "deny:"]
  56434. }),
  56435. $globals.StringTest);
  56436. $core.addMethod(
  56437. $core.method({
  56438. selector: "testIndexOfStartingAtWithNull",
  56439. protocol: "tests",
  56440. fn: function (){
  56441. var self=this,$self=this;
  56442. return self;
  56443. },
  56444. args: [],
  56445. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  56446. referencedClasses: [],
  56447. messageSends: []
  56448. }),
  56449. $globals.StringTest);
  56450. $core.addMethod(
  56451. $core.method({
  56452. selector: "testIndexOfWithNull",
  56453. protocol: "tests",
  56454. fn: function (){
  56455. var self=this,$self=this;
  56456. return self;
  56457. },
  56458. args: [],
  56459. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  56460. referencedClasses: [],
  56461. messageSends: []
  56462. }),
  56463. $globals.StringTest);
  56464. $core.addMethod(
  56465. $core.method({
  56466. selector: "testIsVowel",
  56467. protocol: "tests",
  56468. fn: function (){
  56469. var self=this,$self=this;
  56470. var vowel,consonant;
  56471. return $core.withContext(function($ctx1) {
  56472. var $1;
  56473. vowel="u";
  56474. consonant="z";
  56475. $1=$recv(vowel)._isVowel();
  56476. $ctx1.sendIdx["isVowel"]=1;
  56477. $self._assert_equals_($1,true);
  56478. $ctx1.sendIdx["assert:equals:"]=1;
  56479. $self._assert_equals_($recv(consonant)._isVowel(),false);
  56480. return self;
  56481. }, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},$globals.StringTest)});
  56482. },
  56483. args: [],
  56484. 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",
  56485. referencedClasses: [],
  56486. messageSends: ["assert:equals:", "isVowel"]
  56487. }),
  56488. $globals.StringTest);
  56489. $core.addMethod(
  56490. $core.method({
  56491. selector: "testJoin",
  56492. protocol: "tests",
  56493. fn: function (){
  56494. var self=this,$self=this;
  56495. return $core.withContext(function($ctx1) {
  56496. $self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  56497. return self;
  56498. }, function($ctx1) {$ctx1.fill(self,"testJoin",{},$globals.StringTest)});
  56499. },
  56500. args: [],
  56501. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  56502. referencedClasses: [],
  56503. messageSends: ["assert:equals:", "join:"]
  56504. }),
  56505. $globals.StringTest);
  56506. $core.addMethod(
  56507. $core.method({
  56508. selector: "testRegression1224",
  56509. protocol: "tests",
  56510. fn: function (){
  56511. var self=this,$self=this;
  56512. return $core.withContext(function($ctx1) {
  56513. var $2,$1;
  56514. $self._should_raise_((function(){
  56515. return $core.withContext(function($ctx2) {
  56516. $2=$recv($self._collectionClass())._new();
  56517. $recv($2)._remove_ifAbsent_($self._sampleNewValue(),(function(){
  56518. }));
  56519. $1=$recv($2)._yourself();
  56520. return $recv($1)._size();
  56521. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56522. }),$globals.Error);
  56523. return self;
  56524. }, function($ctx1) {$ctx1.fill(self,"testRegression1224",{},$globals.StringTest)});
  56525. },
  56526. args: [],
  56527. 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",
  56528. referencedClasses: ["Error"],
  56529. messageSends: ["should:raise:", "size", "remove:ifAbsent:", "new", "collectionClass", "sampleNewValue", "yourself"]
  56530. }),
  56531. $globals.StringTest);
  56532. $core.addMethod(
  56533. $core.method({
  56534. selector: "testRemoveAll",
  56535. protocol: "tests",
  56536. fn: function (){
  56537. var self=this,$self=this;
  56538. return $core.withContext(function($ctx1) {
  56539. $self._should_raise_((function(){
  56540. return $core.withContext(function($ctx2) {
  56541. return $recv($self._collection())._removeAll();
  56542. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56543. }),$globals.Error);
  56544. return self;
  56545. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.StringTest)});
  56546. },
  56547. args: [],
  56548. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  56549. referencedClasses: ["Error"],
  56550. messageSends: ["should:raise:", "removeAll", "collection"]
  56551. }),
  56552. $globals.StringTest);
  56553. $core.addMethod(
  56554. $core.method({
  56555. selector: "testReversed",
  56556. protocol: "tests",
  56557. fn: function (){
  56558. var self=this,$self=this;
  56559. return $core.withContext(function($ctx1) {
  56560. $self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  56561. return self;
  56562. }, function($ctx1) {$ctx1.fill(self,"testReversed",{},$globals.StringTest)});
  56563. },
  56564. args: [],
  56565. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  56566. referencedClasses: [],
  56567. messageSends: ["assert:equals:", "reversed"]
  56568. }),
  56569. $globals.StringTest);
  56570. $core.addMethod(
  56571. $core.method({
  56572. selector: "testStreamContents",
  56573. protocol: "tests",
  56574. fn: function (){
  56575. var self=this,$self=this;
  56576. return $core.withContext(function($ctx1) {
  56577. $self._assert_equals_($recv($globals.String)._streamContents_((function(aStream){
  56578. return $core.withContext(function($ctx2) {
  56579. $recv(aStream)._nextPutAll_("hello");
  56580. $ctx2.sendIdx["nextPutAll:"]=1;
  56581. $recv(aStream)._space();
  56582. return $recv(aStream)._nextPutAll_("world");
  56583. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)});
  56584. })),"hello world");
  56585. return self;
  56586. }, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},$globals.StringTest)});
  56587. },
  56588. args: [],
  56589. 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'",
  56590. referencedClasses: ["String"],
  56591. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"]
  56592. }),
  56593. $globals.StringTest);
  56594. $core.addMethod(
  56595. $core.method({
  56596. selector: "testSubStrings",
  56597. protocol: "tests",
  56598. fn: function (){
  56599. var self=this,$self=this;
  56600. return $core.withContext(function($ctx1) {
  56601. $self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  56602. return self;
  56603. }, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},$globals.StringTest)});
  56604. },
  56605. args: [],
  56606. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  56607. referencedClasses: [],
  56608. messageSends: ["assert:equals:", "subStrings:"]
  56609. }),
  56610. $globals.StringTest);
  56611. $core.addMethod(
  56612. $core.method({
  56613. selector: "testTrim",
  56614. protocol: "tests",
  56615. fn: function (){
  56616. var self=this,$self=this;
  56617. return $core.withContext(function($ctx1) {
  56618. $self._assert_equals_(" jackie"._trimLeft(),"jackie");
  56619. $ctx1.sendIdx["assert:equals:"]=1;
  56620. $self._assert_equals_("jackie "._trimRight(),"jackie");
  56621. return self;
  56622. }, function($ctx1) {$ctx1.fill(self,"testTrim",{},$globals.StringTest)});
  56623. },
  56624. args: [],
  56625. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  56626. referencedClasses: [],
  56627. messageSends: ["assert:equals:", "trimLeft", "trimRight"]
  56628. }),
  56629. $globals.StringTest);
  56630. $core.addMethod(
  56631. $core.method({
  56632. selector: "testValue",
  56633. protocol: "tests",
  56634. fn: function (){
  56635. var self=this,$self=this;
  56636. return $core.withContext(function($ctx1) {
  56637. $self._assert_equals_("asString"._value_((1)),"1");
  56638. $ctx1.sendIdx["assert:equals:"]=1;
  56639. $self._assert_equals_([(1), (2), (3)]._collect_("asString"),["1", "2", "3"]);
  56640. return self;
  56641. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.StringTest)});
  56642. },
  56643. args: [],
  56644. 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')",
  56645. referencedClasses: [],
  56646. messageSends: ["assert:equals:", "value:", "collect:"]
  56647. }),
  56648. $globals.StringTest);
  56649. $core.addMethod(
  56650. $core.method({
  56651. selector: "collectionClass",
  56652. protocol: "fixture",
  56653. fn: function (){
  56654. var self=this,$self=this;
  56655. return $globals.String;
  56656. },
  56657. args: [],
  56658. source: "collectionClass\x0a\x09^ String",
  56659. referencedClasses: ["String"],
  56660. messageSends: []
  56661. }),
  56662. $globals.StringTest.a$cls);
  56663. $core.addClass("SetTest", $globals.CollectionTest, [], "Kernel-Tests");
  56664. $core.addMethod(
  56665. $core.method({
  56666. selector: "collection",
  56667. protocol: "fixture",
  56668. fn: function (){
  56669. var self=this,$self=this;
  56670. return $core.withContext(function($ctx1) {
  56671. var $1;
  56672. $1=$recv($globals.Set)._new();
  56673. $recv($1)._add_($globals.Smalltalk);
  56674. $ctx1.sendIdx["add:"]=1;
  56675. $recv($1)._add_(nil);
  56676. $ctx1.sendIdx["add:"]=2;
  56677. $recv($1)._add_((3).__at((3)));
  56678. $ctx1.sendIdx["add:"]=3;
  56679. $recv($1)._add_(false);
  56680. $ctx1.sendIdx["add:"]=4;
  56681. $recv($1)._add_($self["@sampleBlock"]);
  56682. return $recv($1)._yourself();
  56683. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.SetTest)});
  56684. },
  56685. args: [],
  56686. 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",
  56687. referencedClasses: ["Set", "Smalltalk"],
  56688. messageSends: ["add:", "new", "@", "yourself"]
  56689. }),
  56690. $globals.SetTest);
  56691. $core.addMethod(
  56692. $core.method({
  56693. selector: "collectionOfPrintStrings",
  56694. protocol: "fixture",
  56695. fn: function (){
  56696. var self=this,$self=this;
  56697. return $core.withContext(function($ctx1) {
  56698. var $1;
  56699. $1=$recv($globals.Set)._new();
  56700. $recv($1)._add_("a SmalltalkImage");
  56701. $ctx1.sendIdx["add:"]=1;
  56702. $recv($1)._add_("nil");
  56703. $ctx1.sendIdx["add:"]=2;
  56704. $recv($1)._add_("3@3");
  56705. $ctx1.sendIdx["add:"]=3;
  56706. $recv($1)._add_("false");
  56707. $ctx1.sendIdx["add:"]=4;
  56708. $recv($1)._add_("a BlockClosure");
  56709. return $recv($1)._yourself();
  56710. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.SetTest)});
  56711. },
  56712. args: [],
  56713. 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",
  56714. referencedClasses: ["Set"],
  56715. messageSends: ["add:", "new", "yourself"]
  56716. }),
  56717. $globals.SetTest);
  56718. $core.addMethod(
  56719. $core.method({
  56720. selector: "collectionSize",
  56721. protocol: "fixture",
  56722. fn: function (){
  56723. var self=this,$self=this;
  56724. return (5);
  56725. },
  56726. args: [],
  56727. source: "collectionSize\x0a\x09^ 5",
  56728. referencedClasses: [],
  56729. messageSends: []
  56730. }),
  56731. $globals.SetTest);
  56732. $core.addMethod(
  56733. $core.method({
  56734. selector: "collectionWithDuplicates",
  56735. protocol: "fixture",
  56736. fn: function (){
  56737. var self=this,$self=this;
  56738. return $core.withContext(function($ctx1) {
  56739. var $1;
  56740. $1=$self._collection();
  56741. $recv($1)._add_((0));
  56742. return $recv($1)._yourself();
  56743. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.SetTest)});
  56744. },
  56745. args: [],
  56746. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  56747. referencedClasses: [],
  56748. messageSends: ["add:", "collection", "yourself"]
  56749. }),
  56750. $globals.SetTest);
  56751. $core.addMethod(
  56752. $core.method({
  56753. selector: "collectionWithNewValue",
  56754. protocol: "fixture",
  56755. fn: function (){
  56756. var self=this,$self=this;
  56757. return $core.withContext(function($ctx1) {
  56758. var $1;
  56759. $1=$recv($globals.Set)._new();
  56760. $recv($1)._add_($globals.Smalltalk);
  56761. $ctx1.sendIdx["add:"]=1;
  56762. $recv($1)._add_(nil);
  56763. $ctx1.sendIdx["add:"]=2;
  56764. $recv($1)._add_((3).__at((3)));
  56765. $ctx1.sendIdx["add:"]=3;
  56766. $recv($1)._add_("N");
  56767. $ctx1.sendIdx["add:"]=4;
  56768. $recv($1)._add_(false);
  56769. $ctx1.sendIdx["add:"]=5;
  56770. $recv($1)._add_($self["@sampleBlock"]);
  56771. return $recv($1)._yourself();
  56772. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.SetTest)});
  56773. },
  56774. args: [],
  56775. 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",
  56776. referencedClasses: ["Set", "Smalltalk"],
  56777. messageSends: ["add:", "new", "@", "yourself"]
  56778. }),
  56779. $globals.SetTest);
  56780. $core.addMethod(
  56781. $core.method({
  56782. selector: "testAddAll",
  56783. protocol: "tests",
  56784. fn: function (){
  56785. var self=this,$self=this;
  56786. return $core.withContext(function($ctx1) {
  56787. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  56788. (
  56789. $ctx1.supercall = true,
  56790. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testAddAll.apply($self, []));
  56791. $ctx1.supercall = false;
  56792. $2=$self._collection();
  56793. $ctx1.sendIdx["collection"]=1;
  56794. $3=$self._collection();
  56795. $ctx1.sendIdx["collection"]=2;
  56796. $recv($2)._addAll_($3);
  56797. $ctx1.sendIdx["addAll:"]=1;
  56798. $4=$recv($2)._yourself();
  56799. $ctx1.sendIdx["yourself"]=1;
  56800. $1=$4;
  56801. $5=$self._collection();
  56802. $ctx1.sendIdx["collection"]=3;
  56803. $self._assert_equals_($1,$5);
  56804. $ctx1.sendIdx["assert:equals:"]=1;
  56805. $7=$self._collection();
  56806. $ctx1.sendIdx["collection"]=4;
  56807. $8=$self._collectionWithNewValue();
  56808. $ctx1.sendIdx["collectionWithNewValue"]=1;
  56809. $recv($7)._addAll_($8);
  56810. $ctx1.sendIdx["addAll:"]=2;
  56811. $9=$recv($7)._yourself();
  56812. $ctx1.sendIdx["yourself"]=2;
  56813. $6=$9;
  56814. $10=$self._collectionWithNewValue();
  56815. $ctx1.sendIdx["collectionWithNewValue"]=2;
  56816. $self._assert_equals_($6,$10);
  56817. $ctx1.sendIdx["assert:equals:"]=2;
  56818. $12=$self._collectionWithNewValue();
  56819. $ctx1.sendIdx["collectionWithNewValue"]=3;
  56820. $recv($12)._addAll_($self._collection());
  56821. $11=$recv($12)._yourself();
  56822. $self._assert_equals_($11,$self._collectionWithNewValue());
  56823. return self;
  56824. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.SetTest)});
  56825. },
  56826. args: [],
  56827. 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",
  56828. referencedClasses: [],
  56829. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  56830. }),
  56831. $globals.SetTest);
  56832. $core.addMethod(
  56833. $core.method({
  56834. selector: "testAddRemove",
  56835. protocol: "tests",
  56836. fn: function (){
  56837. var self=this,$self=this;
  56838. var set;
  56839. return $core.withContext(function($ctx1) {
  56840. var $1,$2;
  56841. set=$recv($globals.Set)._new();
  56842. $self._assert_($recv(set)._isEmpty());
  56843. $ctx1.sendIdx["assert:"]=1;
  56844. $recv(set)._add_((3));
  56845. $ctx1.sendIdx["add:"]=1;
  56846. $1=$recv(set)._includes_((3));
  56847. $ctx1.sendIdx["includes:"]=1;
  56848. $self._assert_($1);
  56849. $ctx1.sendIdx["assert:"]=2;
  56850. $recv(set)._add_((5));
  56851. $2=$recv(set)._includes_((5));
  56852. $ctx1.sendIdx["includes:"]=2;
  56853. $self._assert_($2);
  56854. $recv(set)._remove_((3));
  56855. $self._deny_($recv(set)._includes_((3)));
  56856. return self;
  56857. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},$globals.SetTest)});
  56858. },
  56859. args: [],
  56860. 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)",
  56861. referencedClasses: ["Set"],
  56862. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"]
  56863. }),
  56864. $globals.SetTest);
  56865. $core.addMethod(
  56866. $core.method({
  56867. selector: "testAt",
  56868. protocol: "tests",
  56869. fn: function (){
  56870. var self=this,$self=this;
  56871. return $core.withContext(function($ctx1) {
  56872. $self._should_raise_((function(){
  56873. return $core.withContext(function($ctx2) {
  56874. return $recv($recv($globals.Set)._new())._at_put_((1),(2));
  56875. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56876. }),$globals.Error);
  56877. return self;
  56878. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.SetTest)});
  56879. },
  56880. args: [],
  56881. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  56882. referencedClasses: ["Set", "Error"],
  56883. messageSends: ["should:raise:", "at:put:", "new"]
  56884. }),
  56885. $globals.SetTest);
  56886. $core.addMethod(
  56887. $core.method({
  56888. selector: "testCollect",
  56889. protocol: "tests",
  56890. fn: function (){
  56891. var self=this,$self=this;
  56892. return $core.withContext(function($ctx1) {
  56893. var $2,$1;
  56894. (
  56895. $ctx1.supercall = true,
  56896. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testCollect.apply($self, []));
  56897. $ctx1.supercall = false;
  56898. $2=[(5), (6), (8)]._asSet();
  56899. $ctx1.sendIdx["asSet"]=1;
  56900. $1=$recv($2)._collect_((function(x){
  56901. return $core.withContext(function($ctx2) {
  56902. return $recv(x).__backslash_backslash((3));
  56903. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  56904. }));
  56905. $self._assert_equals_($1,[(0), (2)]._asSet());
  56906. return self;
  56907. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.SetTest)});
  56908. },
  56909. args: [],
  56910. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  56911. referencedClasses: [],
  56912. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"]
  56913. }),
  56914. $globals.SetTest);
  56915. $core.addMethod(
  56916. $core.method({
  56917. selector: "testComma",
  56918. protocol: "tests",
  56919. fn: function (){
  56920. var self=this,$self=this;
  56921. return $core.withContext(function($ctx1) {
  56922. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  56923. (
  56924. $ctx1.supercall = true,
  56925. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testComma.apply($self, []));
  56926. $ctx1.supercall = false;
  56927. $2=$self._collection();
  56928. $ctx1.sendIdx["collection"]=1;
  56929. $3=$self._collection();
  56930. $ctx1.sendIdx["collection"]=2;
  56931. $1=$recv($2).__comma($3);
  56932. $ctx1.sendIdx[","]=1;
  56933. $4=$self._collection();
  56934. $ctx1.sendIdx["collection"]=3;
  56935. $self._assert_equals_($1,$4);
  56936. $ctx1.sendIdx["assert:equals:"]=1;
  56937. $6=$self._collection();
  56938. $ctx1.sendIdx["collection"]=4;
  56939. $7=$self._collectionWithNewValue();
  56940. $ctx1.sendIdx["collectionWithNewValue"]=1;
  56941. $5=$recv($6).__comma($7);
  56942. $ctx1.sendIdx[","]=2;
  56943. $8=$self._collectionWithNewValue();
  56944. $ctx1.sendIdx["collectionWithNewValue"]=2;
  56945. $self._assert_equals_($5,$8);
  56946. $ctx1.sendIdx["assert:equals:"]=2;
  56947. $10=$self._collectionWithNewValue();
  56948. $ctx1.sendIdx["collectionWithNewValue"]=3;
  56949. $9=$recv($10).__comma($self._collection());
  56950. $self._assert_equals_($9,$self._collectionWithNewValue());
  56951. return self;
  56952. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.SetTest)});
  56953. },
  56954. args: [],
  56955. 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",
  56956. referencedClasses: [],
  56957. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  56958. }),
  56959. $globals.SetTest);
  56960. $core.addMethod(
  56961. $core.method({
  56962. selector: "testComparing",
  56963. protocol: "tests",
  56964. fn: function (){
  56965. var self=this,$self=this;
  56966. return $core.withContext(function($ctx1) {
  56967. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  56968. $1=[(0), (2)]._asSet();
  56969. $ctx1.sendIdx["asSet"]=1;
  56970. $2=[(0), (2)]._asSet();
  56971. $ctx1.sendIdx["asSet"]=2;
  56972. $self._assert_equals_($1,$2);
  56973. $ctx1.sendIdx["assert:equals:"]=1;
  56974. $3=[(2), (0)]._asSet();
  56975. $ctx1.sendIdx["asSet"]=3;
  56976. $4=[(0), (2)]._asSet();
  56977. $ctx1.sendIdx["asSet"]=4;
  56978. $self._assert_equals_($3,$4);
  56979. $6=[(0), (2), (3)]._asSet();
  56980. $ctx1.sendIdx["asSet"]=5;
  56981. $7=[(0), (2)]._asSet();
  56982. $ctx1.sendIdx["asSet"]=6;
  56983. $5=$recv($6).__eq($7);
  56984. $ctx1.sendIdx["="]=1;
  56985. $self._deny_($5);
  56986. $ctx1.sendIdx["deny:"]=1;
  56987. $9=[(1), (2)]._asSet();
  56988. $ctx1.sendIdx["asSet"]=7;
  56989. $8=$recv($9).__eq([(0), (2)]._asSet());
  56990. $self._deny_($8);
  56991. return self;
  56992. }, function($ctx1) {$ctx1.fill(self,"testComparing",{},$globals.SetTest)});
  56993. },
  56994. args: [],
  56995. 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",
  56996. referencedClasses: [],
  56997. messageSends: ["assert:equals:", "asSet", "deny:", "="]
  56998. }),
  56999. $globals.SetTest);
  57000. $core.addMethod(
  57001. $core.method({
  57002. selector: "testPrintString",
  57003. protocol: "tests",
  57004. fn: function (){
  57005. var self=this,$self=this;
  57006. var set;
  57007. return $core.withContext(function($ctx1) {
  57008. var $1,$2,$3,$4,$5,$6,$7,$8;
  57009. set=$recv($globals.Set)._new();
  57010. $1=$recv(set)._printString();
  57011. $ctx1.sendIdx["printString"]=1;
  57012. $self._assert_equals_($1,"a Set ()");
  57013. $ctx1.sendIdx["assert:equals:"]=1;
  57014. $2=set;
  57015. $recv($2)._add_((1));
  57016. $ctx1.sendIdx["add:"]=1;
  57017. $3=$recv($2)._add_((3));
  57018. $ctx1.sendIdx["add:"]=2;
  57019. $4=$recv(set)._printString();
  57020. $ctx1.sendIdx["printString"]=2;
  57021. $self._assert_equals_($4,"a Set (1 3)");
  57022. $ctx1.sendIdx["assert:equals:"]=2;
  57023. $recv(set)._add_("foo");
  57024. $ctx1.sendIdx["add:"]=3;
  57025. $5=$recv(set)._printString();
  57026. $ctx1.sendIdx["printString"]=3;
  57027. $self._assert_equals_($5,"a Set (1 3 'foo')");
  57028. $ctx1.sendIdx["assert:equals:"]=3;
  57029. $6=set;
  57030. $recv($6)._remove_((1));
  57031. $ctx1.sendIdx["remove:"]=1;
  57032. $recv($6)._remove_((3));
  57033. $7=$recv(set)._printString();
  57034. $ctx1.sendIdx["printString"]=4;
  57035. $self._assert_equals_($7,"a Set ('foo')");
  57036. $ctx1.sendIdx["assert:equals:"]=4;
  57037. $recv(set)._add_((3));
  57038. $ctx1.sendIdx["add:"]=4;
  57039. $8=$recv(set)._printString();
  57040. $ctx1.sendIdx["printString"]=5;
  57041. $self._assert_equals_($8,"a Set (3 'foo')");
  57042. $ctx1.sendIdx["assert:equals:"]=5;
  57043. $recv(set)._add_((3));
  57044. $self._assert_equals_($recv(set)._printString(),"a Set (3 'foo')");
  57045. return self;
  57046. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},$globals.SetTest)});
  57047. },
  57048. args: [],
  57049. 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'')'",
  57050. referencedClasses: ["Set"],
  57051. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"]
  57052. }),
  57053. $globals.SetTest);
  57054. $core.addMethod(
  57055. $core.method({
  57056. selector: "testRegression1225",
  57057. protocol: "tests",
  57058. fn: function (){
  57059. var self=this,$self=this;
  57060. return $core.withContext(function($ctx1) {
  57061. $self._assert_equals_($recv([(1), (2), (3)]._asSet())._add_((3)),(3));
  57062. return self;
  57063. }, function($ctx1) {$ctx1.fill(self,"testRegression1225",{},$globals.SetTest)});
  57064. },
  57065. args: [],
  57066. source: "testRegression1225\x0a\x09self assert: (#(1 2 3) asSet add: 3) equals: 3",
  57067. referencedClasses: [],
  57068. messageSends: ["assert:equals:", "add:", "asSet"]
  57069. }),
  57070. $globals.SetTest);
  57071. $core.addMethod(
  57072. $core.method({
  57073. selector: "testRegression1226",
  57074. protocol: "tests",
  57075. fn: function (){
  57076. var self=this,$self=this;
  57077. return $core.withContext(function($ctx1) {
  57078. $self._assert_equals_($recv([(1), (2), (3)]._asSet())._remove_((3)),(3));
  57079. return self;
  57080. }, function($ctx1) {$ctx1.fill(self,"testRegression1226",{},$globals.SetTest)});
  57081. },
  57082. args: [],
  57083. source: "testRegression1226\x0a\x09self assert: (#(1 2 3) asSet remove: 3) equals: 3",
  57084. referencedClasses: [],
  57085. messageSends: ["assert:equals:", "remove:", "asSet"]
  57086. }),
  57087. $globals.SetTest);
  57088. $core.addMethod(
  57089. $core.method({
  57090. selector: "testRegression1227",
  57091. protocol: "tests",
  57092. fn: function (){
  57093. var self=this,$self=this;
  57094. return $core.withContext(function($ctx1) {
  57095. $self._assert_equals_($recv([(1), (2), (3)]._asSet())._remove_ifAbsent_((4),(function(){
  57096. return (5);
  57097. })),(5));
  57098. return self;
  57099. }, function($ctx1) {$ctx1.fill(self,"testRegression1227",{},$globals.SetTest)});
  57100. },
  57101. args: [],
  57102. source: "testRegression1227\x0a\x09self assert: (#(1 2 3) asSet remove: 4 ifAbsent: [5]) equals: 5",
  57103. referencedClasses: [],
  57104. messageSends: ["assert:equals:", "remove:ifAbsent:", "asSet"]
  57105. }),
  57106. $globals.SetTest);
  57107. $core.addMethod(
  57108. $core.method({
  57109. selector: "testRegression1228",
  57110. protocol: "tests",
  57111. fn: function (){
  57112. var self=this,$self=this;
  57113. return $core.withContext(function($ctx1) {
  57114. $self._should_raise_((function(){
  57115. return $core.withContext(function($ctx2) {
  57116. return $recv([(1), (2), (3)]._asSet())._remove_((4));
  57117. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57118. }),$globals.Error);
  57119. return self;
  57120. }, function($ctx1) {$ctx1.fill(self,"testRegression1228",{},$globals.SetTest)});
  57121. },
  57122. args: [],
  57123. source: "testRegression1228\x0a\x09self should: [#(1 2 3) asSet remove: 4] raise: Error",
  57124. referencedClasses: ["Error"],
  57125. messageSends: ["should:raise:", "remove:", "asSet"]
  57126. }),
  57127. $globals.SetTest);
  57128. $core.addMethod(
  57129. $core.method({
  57130. selector: "testUnboxedObjects",
  57131. protocol: "tests",
  57132. fn: function (){
  57133. var self=this,$self=this;
  57134. return $core.withContext(function($ctx1) {
  57135. var $4,$3,$2,$1;
  57136. $4="foo"._yourself();
  57137. $ctx1.sendIdx["yourself"]=1;
  57138. $3=[$4,"foo"._yourself()];
  57139. $2=$recv($3)._asSet();
  57140. $1=$recv($2)._asArray();
  57141. $self._assert_equals_($1,["foo"]);
  57142. return self;
  57143. }, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},$globals.SetTest)});
  57144. },
  57145. args: [],
  57146. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  57147. referencedClasses: [],
  57148. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"]
  57149. }),
  57150. $globals.SetTest);
  57151. $core.addMethod(
  57152. $core.method({
  57153. selector: "testUnicity",
  57154. protocol: "tests",
  57155. fn: function (){
  57156. var self=this,$self=this;
  57157. var set;
  57158. return $core.withContext(function($ctx1) {
  57159. var $1;
  57160. set=$recv($globals.Set)._new();
  57161. $recv(set)._add_((21));
  57162. $ctx1.sendIdx["add:"]=1;
  57163. $recv(set)._add_("hello");
  57164. $ctx1.sendIdx["add:"]=2;
  57165. $recv(set)._add_((21));
  57166. $ctx1.sendIdx["add:"]=3;
  57167. $1=$recv(set)._size();
  57168. $ctx1.sendIdx["size"]=1;
  57169. $self._assert_equals_($1,(2));
  57170. $ctx1.sendIdx["assert:equals:"]=1;
  57171. $recv(set)._add_("hello");
  57172. $self._assert_equals_($recv(set)._size(),(2));
  57173. $ctx1.sendIdx["assert:equals:"]=2;
  57174. $self._assert_equals_($recv(set)._asArray(),[(21), "hello"]);
  57175. return self;
  57176. }, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},$globals.SetTest)});
  57177. },
  57178. args: [],
  57179. 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')",
  57180. referencedClasses: ["Set"],
  57181. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"]
  57182. }),
  57183. $globals.SetTest);
  57184. $core.addMethod(
  57185. $core.method({
  57186. selector: "collectionClass",
  57187. protocol: "fixture",
  57188. fn: function (){
  57189. var self=this,$self=this;
  57190. return $globals.Set;
  57191. },
  57192. args: [],
  57193. source: "collectionClass\x0a\x09^ Set",
  57194. referencedClasses: ["Set"],
  57195. messageSends: []
  57196. }),
  57197. $globals.SetTest.a$cls);
  57198. $core.addClass("ConsoleTranscriptTest", $globals.TestCase, [], "Kernel-Tests");
  57199. $core.addMethod(
  57200. $core.method({
  57201. selector: "testShow",
  57202. protocol: "tests",
  57203. fn: function (){
  57204. var self=this,$self=this;
  57205. var originalTranscript;
  57206. return $core.withContext(function($ctx1) {
  57207. originalTranscript=$recv($globals.Transcript)._current();
  57208. $recv($globals.Transcript)._register_($recv($globals.ConsoleTranscript)._new());
  57209. $ctx1.sendIdx["register:"]=1;
  57210. $self._shouldnt_raise_((function(){
  57211. return $core.withContext(function($ctx2) {
  57212. return $recv($globals.Transcript)._show_("Hello console!");
  57213. $ctx2.sendIdx["show:"]=1;
  57214. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57215. }),$globals.Error);
  57216. $ctx1.sendIdx["shouldnt:raise:"]=1;
  57217. $self._shouldnt_raise_((function(){
  57218. return $core.withContext(function($ctx2) {
  57219. return $recv($globals.Transcript)._show_(console);
  57220. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  57221. }),$globals.Error);
  57222. $recv($globals.Transcript)._register_(originalTranscript);
  57223. return self;
  57224. }, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},$globals.ConsoleTranscriptTest)});
  57225. },
  57226. args: [],
  57227. 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.",
  57228. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"],
  57229. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"]
  57230. }),
  57231. $globals.ConsoleTranscriptTest);
  57232. $core.addClass("DateTest", $globals.TestCase, [], "Kernel-Tests");
  57233. $core.addMethod(
  57234. $core.method({
  57235. selector: "testEquality",
  57236. protocol: "tests",
  57237. fn: function (){
  57238. var self=this,$self=this;
  57239. var now;
  57240. return $core.withContext(function($ctx1) {
  57241. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  57242. now=$recv($globals.Date)._new();
  57243. $1=$recv(now).__eq(now);
  57244. $ctx1.sendIdx["="]=1;
  57245. $self._assert_($1);
  57246. $ctx1.sendIdx["assert:"]=1;
  57247. $3=now;
  57248. $4=$recv($globals.Date)._fromMilliseconds_((0));
  57249. $ctx1.sendIdx["fromMilliseconds:"]=1;
  57250. $2=$recv($3).__eq($4);
  57251. $ctx1.sendIdx["="]=2;
  57252. $self._deny_($2);
  57253. $6=$recv($globals.Date)._fromMilliseconds_((12345678));
  57254. $ctx1.sendIdx["fromMilliseconds:"]=2;
  57255. $7=$recv($globals.Date)._fromMilliseconds_((12345678));
  57256. $ctx1.sendIdx["fromMilliseconds:"]=3;
  57257. $5=$recv($6).__eq($7);
  57258. $ctx1.sendIdx["="]=3;
  57259. $self._assert_($5);
  57260. $ctx1.sendIdx["assert:"]=2;
  57261. $9=now;
  57262. $11=$recv(now)._asMilliseconds();
  57263. $ctx1.sendIdx["asMilliseconds"]=1;
  57264. $10=$recv($globals.Date)._fromMilliseconds_($11);
  57265. $ctx1.sendIdx["fromMilliseconds:"]=4;
  57266. $8=$recv($9).__eq($10);
  57267. $ctx1.sendIdx["="]=4;
  57268. $self._assert_($8);
  57269. $ctx1.sendIdx["assert:"]=3;
  57270. $self._assert_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq(now));
  57271. return self;
  57272. }, function($ctx1) {$ctx1.fill(self,"testEquality",{now:now},$globals.DateTest)});
  57273. },
  57274. args: [],
  57275. 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",
  57276. referencedClasses: ["Date"],
  57277. messageSends: ["new", "assert:", "=", "deny:", "fromMilliseconds:", "asMilliseconds"]
  57278. }),
  57279. $globals.DateTest);
  57280. $core.addMethod(
  57281. $core.method({
  57282. selector: "testIdentity",
  57283. protocol: "tests",
  57284. fn: function (){
  57285. var self=this,$self=this;
  57286. var now;
  57287. return $core.withContext(function($ctx1) {
  57288. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  57289. now=$recv($globals.Date)._new();
  57290. $1=$recv(now).__eq_eq(now);
  57291. $ctx1.sendIdx["=="]=1;
  57292. $self._assert_($1);
  57293. $3=now;
  57294. $4=$recv($globals.Date)._fromMilliseconds_((0));
  57295. $ctx1.sendIdx["fromMilliseconds:"]=1;
  57296. $2=$recv($3).__eq_eq($4);
  57297. $ctx1.sendIdx["=="]=2;
  57298. $self._deny_($2);
  57299. $ctx1.sendIdx["deny:"]=1;
  57300. $6=$recv($globals.Date)._fromMilliseconds_((12345678));
  57301. $ctx1.sendIdx["fromMilliseconds:"]=2;
  57302. $7=$recv($globals.Date)._fromMilliseconds_((12345678));
  57303. $ctx1.sendIdx["fromMilliseconds:"]=3;
  57304. $5=$recv($6).__eq_eq($7);
  57305. $ctx1.sendIdx["=="]=3;
  57306. $self._deny_($5);
  57307. $ctx1.sendIdx["deny:"]=2;
  57308. $9=now;
  57309. $11=$recv(now)._asMilliseconds();
  57310. $ctx1.sendIdx["asMilliseconds"]=1;
  57311. $10=$recv($globals.Date)._fromMilliseconds_($11);
  57312. $ctx1.sendIdx["fromMilliseconds:"]=4;
  57313. $8=$recv($9).__eq_eq($10);
  57314. $ctx1.sendIdx["=="]=4;
  57315. $self._deny_($8);
  57316. $ctx1.sendIdx["deny:"]=3;
  57317. $self._deny_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq_eq(now));
  57318. return self;
  57319. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{now:now},$globals.DateTest)});
  57320. },
  57321. args: [],
  57322. 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",
  57323. referencedClasses: ["Date"],
  57324. messageSends: ["new", "assert:", "==", "deny:", "fromMilliseconds:", "asMilliseconds"]
  57325. }),
  57326. $globals.DateTest);
  57327. $core.addClass("JSObjectProxyTest", $globals.TestCase, [], "Kernel-Tests");
  57328. $core.addMethod(
  57329. $core.method({
  57330. selector: "jsObject",
  57331. protocol: "accessing",
  57332. fn: function (){
  57333. var self=this,$self=this;
  57334. return $core.withContext(function($ctx1) {
  57335. return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: "", "e": null, "f": void 0};
  57336. return self;
  57337. }, function($ctx1) {$ctx1.fill(self,"jsObject",{},$globals.JSObjectProxyTest)});
  57338. },
  57339. args: [],
  57340. 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}'>",
  57341. referencedClasses: [],
  57342. messageSends: []
  57343. }),
  57344. $globals.JSObjectProxyTest);
  57345. $core.addMethod(
  57346. $core.method({
  57347. selector: "jsUndefined",
  57348. protocol: "accessing",
  57349. fn: function (){
  57350. var self=this,$self=this;
  57351. return $core.withContext(function($ctx1) {
  57352. return;
  57353. return self;
  57354. }, function($ctx1) {$ctx1.fill(self,"jsUndefined",{},$globals.JSObjectProxyTest)});
  57355. },
  57356. args: [],
  57357. source: "jsUndefined\x0a\x09<inlineJS: 'return'>",
  57358. referencedClasses: [],
  57359. messageSends: []
  57360. }),
  57361. $globals.JSObjectProxyTest);
  57362. $core.addMethod(
  57363. $core.method({
  57364. selector: "testAtIfAbsent",
  57365. protocol: "tests",
  57366. fn: function (){
  57367. var self=this,$self=this;
  57368. var testObject;
  57369. return $core.withContext(function($ctx1) {
  57370. var $1,$2,$3;
  57371. testObject=$self._jsObject();
  57372. $1=$recv(testObject)._at_ifAbsent_("abc",(function(){
  57373. return "Property does not exist";
  57374. }));
  57375. $ctx1.sendIdx["at:ifAbsent:"]=1;
  57376. $self._assert_equals_($1,"Property does not exist");
  57377. $ctx1.sendIdx["assert:equals:"]=1;
  57378. $2=$recv(testObject)._at_ifAbsent_("e",(function(){
  57379. return "Property does not exist";
  57380. }));
  57381. $ctx1.sendIdx["at:ifAbsent:"]=2;
  57382. $self._assert_equals_($2,nil);
  57383. $ctx1.sendIdx["assert:equals:"]=2;
  57384. $3=$recv(testObject)._at_ifAbsent_("a",(function(){
  57385. return "Property does not exist";
  57386. }));
  57387. $ctx1.sendIdx["at:ifAbsent:"]=3;
  57388. $self._assert_equals_($3,(1));
  57389. $ctx1.sendIdx["assert:equals:"]=3;
  57390. $self._assert_equals_($recv(testObject)._at_ifAbsent_("f",(function(){
  57391. return "Property does not exist";
  57392. })),nil);
  57393. return self;
  57394. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  57395. },
  57396. args: [],
  57397. 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.",
  57398. referencedClasses: [],
  57399. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"]
  57400. }),
  57401. $globals.JSObjectProxyTest);
  57402. $core.addMethod(
  57403. $core.method({
  57404. selector: "testAtIfPresent",
  57405. protocol: "tests",
  57406. fn: function (){
  57407. var self=this,$self=this;
  57408. var testObject;
  57409. return $core.withContext(function($ctx1) {
  57410. var $2,$1,$4,$3,$6,$5;
  57411. testObject=$self._jsObject();
  57412. $1=$recv(testObject)._at_ifPresent_("abc",(function(x){
  57413. return $core.withContext(function($ctx2) {
  57414. $2=$recv(x)._asString();
  57415. $ctx2.sendIdx["asString"]=1;
  57416. return "hello ".__comma($2);
  57417. $ctx2.sendIdx[","]=1;
  57418. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  57419. }));
  57420. $ctx1.sendIdx["at:ifPresent:"]=1;
  57421. $self._assert_equals_($1,nil);
  57422. $ctx1.sendIdx["assert:equals:"]=1;
  57423. $3=$recv(testObject)._at_ifPresent_("e",(function(x){
  57424. return $core.withContext(function($ctx2) {
  57425. $4=$recv(x)._asString();
  57426. $ctx2.sendIdx["asString"]=2;
  57427. return "hello ".__comma($4);
  57428. $ctx2.sendIdx[","]=2;
  57429. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  57430. }));
  57431. $ctx1.sendIdx["at:ifPresent:"]=2;
  57432. $self._assert_equals_($3,"hello nil");
  57433. $ctx1.sendIdx["assert:equals:"]=2;
  57434. $5=$recv(testObject)._at_ifPresent_("a",(function(x){
  57435. return $core.withContext(function($ctx2) {
  57436. $6=$recv(x)._asString();
  57437. $ctx2.sendIdx["asString"]=3;
  57438. return "hello ".__comma($6);
  57439. $ctx2.sendIdx[","]=3;
  57440. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  57441. }));
  57442. $ctx1.sendIdx["at:ifPresent:"]=3;
  57443. $self._assert_equals_($5,"hello 1");
  57444. $ctx1.sendIdx["assert:equals:"]=3;
  57445. $self._assert_equals_($recv(testObject)._at_ifPresent_("f",(function(x){
  57446. return $core.withContext(function($ctx2) {
  57447. return "hello ".__comma($recv(x)._asString());
  57448. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)});
  57449. })),"hello nil");
  57450. return self;
  57451. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},$globals.JSObjectProxyTest)});
  57452. },
  57453. args: [],
  57454. 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'.",
  57455. referencedClasses: [],
  57456. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"]
  57457. }),
  57458. $globals.JSObjectProxyTest);
  57459. $core.addMethod(
  57460. $core.method({
  57461. selector: "testAtIfPresentIfAbsent",
  57462. protocol: "tests",
  57463. fn: function (){
  57464. var self=this,$self=this;
  57465. var testObject;
  57466. return $core.withContext(function($ctx1) {
  57467. var $2,$1,$4,$3,$6,$5;
  57468. testObject=$self._jsObject();
  57469. $1=$recv(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  57470. return $core.withContext(function($ctx2) {
  57471. $2=$recv(x)._asString();
  57472. $ctx2.sendIdx["asString"]=1;
  57473. return "hello ".__comma($2);
  57474. $ctx2.sendIdx[","]=1;
  57475. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  57476. }),(function(){
  57477. return "not present";
  57478. }));
  57479. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  57480. $self._assert_equals_($1,"not present");
  57481. $ctx1.sendIdx["assert:equals:"]=1;
  57482. $3=$recv(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  57483. return $core.withContext(function($ctx2) {
  57484. $4=$recv(x)._asString();
  57485. $ctx2.sendIdx["asString"]=2;
  57486. return "hello ".__comma($4);
  57487. $ctx2.sendIdx[","]=2;
  57488. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  57489. }),(function(){
  57490. return "not present";
  57491. }));
  57492. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  57493. $self._assert_equals_($3,"hello nil");
  57494. $ctx1.sendIdx["assert:equals:"]=2;
  57495. $5=$recv(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  57496. return $core.withContext(function($ctx2) {
  57497. $6=$recv(x)._asString();
  57498. $ctx2.sendIdx["asString"]=3;
  57499. return "hello ".__comma($6);
  57500. $ctx2.sendIdx[","]=3;
  57501. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)});
  57502. }),(function(){
  57503. return "not present";
  57504. }));
  57505. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  57506. $self._assert_equals_($5,"hello 1");
  57507. $ctx1.sendIdx["assert:equals:"]=3;
  57508. $self._assert_equals_($recv(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  57509. return $core.withContext(function($ctx2) {
  57510. return "hello ".__comma($recv(x)._asString());
  57511. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)});
  57512. }),(function(){
  57513. return "not present";
  57514. })),"hello nil");
  57515. return self;
  57516. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  57517. },
  57518. args: [],
  57519. 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'.",
  57520. referencedClasses: [],
  57521. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"]
  57522. }),
  57523. $globals.JSObjectProxyTest);
  57524. $core.addMethod(
  57525. $core.method({
  57526. selector: "testAtPut",
  57527. protocol: "tests",
  57528. fn: function (){
  57529. var self=this,$self=this;
  57530. var testObject;
  57531. return $core.withContext(function($ctx1) {
  57532. var $2,$1;
  57533. testObject=$self._jsObject();
  57534. $2=$recv(testObject)._at_("abc");
  57535. $ctx1.sendIdx["at:"]=1;
  57536. $1=$recv($2).__tild_eq("xyz");
  57537. $self._assert_($1);
  57538. $self._assert_equals_($recv(testObject)._at_put_("abc","xyz"),"xyz");
  57539. $ctx1.sendIdx["assert:equals:"]=1;
  57540. $self._assert_equals_($recv(testObject)._at_("abc"),"xyz");
  57541. return self;
  57542. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},$globals.JSObjectProxyTest)});
  57543. },
  57544. args: [],
  57545. 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'",
  57546. referencedClasses: [],
  57547. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"]
  57548. }),
  57549. $globals.JSObjectProxyTest);
  57550. $core.addMethod(
  57551. $core.method({
  57552. selector: "testComparison",
  57553. protocol: "tests",
  57554. fn: function (){
  57555. var self=this,$self=this;
  57556. return $core.withContext(function($ctx1) {
  57557. var $1,$2;
  57558. $self._assert_equals_($recv([console,(2)])._indexOf_(console),(1));
  57559. $1=$recv(console).__eq(console);
  57560. $ctx1.sendIdx["="]=1;
  57561. $self._assert_($1);
  57562. $2=$recv(console).__eq($recv($globals.Object)._new());
  57563. $ctx1.sendIdx["="]=2;
  57564. $self._deny_($2);
  57565. $ctx1.sendIdx["deny:"]=1;
  57566. $self._deny_($recv(console).__eq($self._jsObject()));
  57567. return self;
  57568. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.JSObjectProxyTest)});
  57569. },
  57570. args: [],
  57571. 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",
  57572. referencedClasses: ["Object"],
  57573. messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"]
  57574. }),
  57575. $globals.JSObjectProxyTest);
  57576. $core.addMethod(
  57577. $core.method({
  57578. selector: "testDNU",
  57579. protocol: "tests",
  57580. fn: function (){
  57581. var self=this,$self=this;
  57582. return $core.withContext(function($ctx1) {
  57583. $self._should_raise_((function(){
  57584. return $core.withContext(function($ctx2) {
  57585. return $recv($self._jsObject())._foo();
  57586. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57587. }),$globals.MessageNotUnderstood);
  57588. return self;
  57589. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.JSObjectProxyTest)});
  57590. },
  57591. args: [],
  57592. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  57593. referencedClasses: ["MessageNotUnderstood"],
  57594. messageSends: ["should:raise:", "foo", "jsObject"]
  57595. }),
  57596. $globals.JSObjectProxyTest);
  57597. $core.addMethod(
  57598. $core.method({
  57599. selector: "testDNUWithAllowJavaScriptCalls",
  57600. protocol: "tests",
  57601. fn: function (){
  57602. var self=this,$self=this;
  57603. var jsObject;
  57604. return $core.withContext(function($ctx1) {
  57605. jsObject=[];
  57606. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  57607. $self._should_raise_((function(){
  57608. return $core.withContext(function($ctx2) {
  57609. return $recv(jsObject)._foo();
  57610. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57611. }),$globals.MessageNotUnderstood);
  57612. return self;
  57613. }, function($ctx1) {$ctx1.fill(self,"testDNUWithAllowJavaScriptCalls",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  57614. },
  57615. args: [],
  57616. source: "testDNUWithAllowJavaScriptCalls\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09self should: [ jsObject foo ] raise: MessageNotUnderstood",
  57617. referencedClasses: ["MessageNotUnderstood"],
  57618. messageSends: ["basicAt:put:", "should:raise:", "foo"]
  57619. }),
  57620. $globals.JSObjectProxyTest);
  57621. $core.addMethod(
  57622. $core.method({
  57623. selector: "testMessageSend",
  57624. protocol: "tests",
  57625. fn: function (){
  57626. var self=this,$self=this;
  57627. return $core.withContext(function($ctx1) {
  57628. var $2,$1,$4,$3;
  57629. $2=$self._jsObject();
  57630. $ctx1.sendIdx["jsObject"]=1;
  57631. $1=$recv($2)._a();
  57632. $self._assert_equals_($1,(1));
  57633. $ctx1.sendIdx["assert:equals:"]=1;
  57634. $4=$self._jsObject();
  57635. $ctx1.sendIdx["jsObject"]=2;
  57636. $3=$recv($4)._b();
  57637. $self._assert_equals_($3,(2));
  57638. $ctx1.sendIdx["assert:equals:"]=2;
  57639. $self._assert_equals_($recv($self._jsObject())._c_((3)),(3));
  57640. return self;
  57641. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},$globals.JSObjectProxyTest)});
  57642. },
  57643. args: [],
  57644. 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",
  57645. referencedClasses: [],
  57646. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"]
  57647. }),
  57648. $globals.JSObjectProxyTest);
  57649. $core.addMethod(
  57650. $core.method({
  57651. selector: "testMethodWithArguments",
  57652. protocol: "tests",
  57653. fn: function (){
  57654. var self=this,$self=this;
  57655. return $core.withContext(function($ctx1) {
  57656. $self._assert_equals_($recv($self._jsObject())._c_((1)),(1));
  57657. return self;
  57658. }, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},$globals.JSObjectProxyTest)});
  57659. },
  57660. args: [],
  57661. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  57662. referencedClasses: [],
  57663. messageSends: ["assert:equals:", "c:", "jsObject"]
  57664. }),
  57665. $globals.JSObjectProxyTest);
  57666. $core.addMethod(
  57667. $core.method({
  57668. selector: "testNull",
  57669. protocol: "tests",
  57670. fn: function (){
  57671. var self=this,$self=this;
  57672. return $core.withContext(function($ctx1) {
  57673. var $2,$1;
  57674. $2=$recv($globals.JSObjectProxy)._null();
  57675. $ctx1.sendIdx["null"]=1;
  57676. $1=$recv($2)._isNil();
  57677. $self._assert_($1);
  57678. $self._assert_equals_($recv($globals.JSON)._stringify_($globals.HashedCollection._newFromPairs_(["foo",$recv($globals.JSObjectProxy)._null()])),"{\x22foo\x22:null}");
  57679. return self;
  57680. }, function($ctx1) {$ctx1.fill(self,"testNull",{},$globals.JSObjectProxyTest)});
  57681. },
  57682. args: [],
  57683. source: "testNull\x0a\x09self assert: JSObjectProxy null isNil.\x0a\x09self\x0a\x09\x09assert: (JSON stringify: #{#foo -> JSObjectProxy null})\x0a\x09\x09equals: '{\x22foo\x22:null}'",
  57684. referencedClasses: ["JSObjectProxy", "JSON"],
  57685. messageSends: ["assert:", "isNil", "null", "assert:equals:", "stringify:"]
  57686. }),
  57687. $globals.JSObjectProxyTest);
  57688. $core.addMethod(
  57689. $core.method({
  57690. selector: "testPrinting",
  57691. protocol: "tests",
  57692. fn: function (){
  57693. var self=this,$self=this;
  57694. return $core.withContext(function($ctx1) {
  57695. $self._assert_equals_($recv($self._jsObject())._printString(),"[object Object]");
  57696. return self;
  57697. }, function($ctx1) {$ctx1.fill(self,"testPrinting",{},$globals.JSObjectProxyTest)});
  57698. },
  57699. args: [],
  57700. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  57701. referencedClasses: [],
  57702. messageSends: ["assert:equals:", "printString", "jsObject"]
  57703. }),
  57704. $globals.JSObjectProxyTest);
  57705. $core.addMethod(
  57706. $core.method({
  57707. selector: "testPropertyThatReturnsEmptyString",
  57708. protocol: "tests",
  57709. fn: function (){
  57710. var self=this,$self=this;
  57711. var object;
  57712. return $core.withContext(function($ctx1) {
  57713. var $1;
  57714. object=$self._jsObject();
  57715. $1=$recv(object)._d();
  57716. $ctx1.sendIdx["d"]=1;
  57717. $self._assert_equals_($1,"");
  57718. $ctx1.sendIdx["assert:equals:"]=1;
  57719. $recv(object)._d_("hello");
  57720. $self._assert_equals_($recv(object)._d(),"hello");
  57721. return self;
  57722. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},$globals.JSObjectProxyTest)});
  57723. },
  57724. args: [],
  57725. 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'",
  57726. referencedClasses: [],
  57727. messageSends: ["jsObject", "assert:equals:", "d", "d:"]
  57728. }),
  57729. $globals.JSObjectProxyTest);
  57730. $core.addMethod(
  57731. $core.method({
  57732. selector: "testPropertyThatReturnsUndefined",
  57733. protocol: "tests",
  57734. fn: function (){
  57735. var self=this,$self=this;
  57736. var object;
  57737. return $core.withContext(function($ctx1) {
  57738. object=$self._jsObject();
  57739. $self._shouldnt_raise_((function(){
  57740. return $core.withContext(function($ctx2) {
  57741. return $recv(object)._e();
  57742. $ctx2.sendIdx["e"]=1;
  57743. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57744. }),$globals.MessageNotUnderstood);
  57745. $self._assert_($recv($recv(object)._e())._isNil());
  57746. return self;
  57747. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},$globals.JSObjectProxyTest)});
  57748. },
  57749. args: [],
  57750. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  57751. referencedClasses: ["MessageNotUnderstood"],
  57752. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"]
  57753. }),
  57754. $globals.JSObjectProxyTest);
  57755. $core.addMethod(
  57756. $core.method({
  57757. selector: "testSetPropertyWithFalsyValue",
  57758. protocol: "tests",
  57759. fn: function (){
  57760. var self=this,$self=this;
  57761. var jsObject;
  57762. return $core.withContext(function($ctx1) {
  57763. var $1,$2,$3,$4,$5;
  57764. jsObject=$self._jsObject();
  57765. $1=$recv(jsObject)._a();
  57766. $ctx1.sendIdx["a"]=1;
  57767. $self._assert_equals_($1,(1));
  57768. $ctx1.sendIdx["assert:equals:"]=1;
  57769. $recv(jsObject)._a_($recv($globals.JSObjectProxy)._null());
  57770. $ctx1.sendIdx["a:"]=1;
  57771. $2=$recv(jsObject)._a();
  57772. $ctx1.sendIdx["a"]=2;
  57773. $self._assert_equals_($2,nil);
  57774. $ctx1.sendIdx["assert:equals:"]=2;
  57775. $recv(jsObject)._a_((0));
  57776. $ctx1.sendIdx["a:"]=2;
  57777. $3=$recv(jsObject)._a();
  57778. $ctx1.sendIdx["a"]=3;
  57779. $self._assert_equals_($3,(0));
  57780. $ctx1.sendIdx["assert:equals:"]=3;
  57781. $recv(jsObject)._a_($self._jsUndefined());
  57782. $ctx1.sendIdx["a:"]=3;
  57783. $4=$recv(jsObject)._a();
  57784. $ctx1.sendIdx["a"]=4;
  57785. $self._assert_equals_($4,nil);
  57786. $ctx1.sendIdx["assert:equals:"]=4;
  57787. $recv(jsObject)._a_("");
  57788. $ctx1.sendIdx["a:"]=4;
  57789. $5=$recv(jsObject)._a();
  57790. $ctx1.sendIdx["a"]=5;
  57791. $self._assert_equals_($5,"");
  57792. $ctx1.sendIdx["assert:equals:"]=5;
  57793. $recv(jsObject)._a_(false);
  57794. $self._assert_equals_($recv(jsObject)._a(),false);
  57795. return self;
  57796. }, function($ctx1) {$ctx1.fill(self,"testSetPropertyWithFalsyValue",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  57797. },
  57798. args: [],
  57799. 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",
  57800. referencedClasses: ["JSObjectProxy"],
  57801. messageSends: ["jsObject", "assert:equals:", "a", "a:", "null", "jsUndefined"]
  57802. }),
  57803. $globals.JSObjectProxyTest);
  57804. $core.addMethod(
  57805. $core.method({
  57806. selector: "testUndefined",
  57807. protocol: "tests",
  57808. fn: function (){
  57809. var self=this,$self=this;
  57810. return $core.withContext(function($ctx1) {
  57811. var $2,$1;
  57812. $2=$recv($globals.JSObjectProxy)._undefined();
  57813. $ctx1.sendIdx["undefined"]=1;
  57814. $1=$recv($2)._isNil();
  57815. $self._assert_($1);
  57816. $self._assert_equals_($recv($globals.JSON)._stringify_($globals.HashedCollection._newFromPairs_(["foo",$recv($globals.JSObjectProxy)._undefined()])),"{}");
  57817. return self;
  57818. }, function($ctx1) {$ctx1.fill(self,"testUndefined",{},$globals.JSObjectProxyTest)});
  57819. },
  57820. args: [],
  57821. source: "testUndefined\x0a\x09self assert: JSObjectProxy undefined isNil.\x0a\x09self\x0a\x09\x09assert: (JSON stringify: #{#foo -> JSObjectProxy undefined})\x0a\x09\x09equals: '{}'",
  57822. referencedClasses: ["JSObjectProxy", "JSON"],
  57823. messageSends: ["assert:", "isNil", "undefined", "assert:equals:", "stringify:"]
  57824. }),
  57825. $globals.JSObjectProxyTest);
  57826. $core.addMethod(
  57827. $core.method({
  57828. selector: "testValue",
  57829. protocol: "tests",
  57830. fn: function (){
  57831. var self=this,$self=this;
  57832. var testObject;
  57833. return $core.withContext(function($ctx1) {
  57834. testObject=$self._jsObject();
  57835. $recv(testObject)._at_put_("value","aValue");
  57836. $self._assert_equals_($recv(testObject)._value(),"aValue");
  57837. return self;
  57838. }, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},$globals.JSObjectProxyTest)});
  57839. },
  57840. args: [],
  57841. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  57842. referencedClasses: [],
  57843. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"]
  57844. }),
  57845. $globals.JSObjectProxyTest);
  57846. $core.addMethod(
  57847. $core.method({
  57848. selector: "testYourself",
  57849. protocol: "tests",
  57850. fn: function (){
  57851. var self=this,$self=this;
  57852. var object;
  57853. return $core.withContext(function($ctx1) {
  57854. var $1;
  57855. $1=$self._jsObject();
  57856. $recv($1)._d_("test");
  57857. object=$recv($1)._yourself();
  57858. $self._assert_equals_($recv(object)._d(),"test");
  57859. return self;
  57860. }, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},$globals.JSObjectProxyTest)});
  57861. },
  57862. args: [],
  57863. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  57864. referencedClasses: [],
  57865. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"]
  57866. }),
  57867. $globals.JSObjectProxyTest);
  57868. $core.addClass("JavaScriptExceptionTest", $globals.TestCase, [], "Kernel-Tests");
  57869. $core.addMethod(
  57870. $core.method({
  57871. selector: "testCatchingException",
  57872. protocol: "tests",
  57873. fn: function (){
  57874. var self=this,$self=this;
  57875. return $core.withContext(function($ctx1) {
  57876. $recv((function(){
  57877. return $core.withContext(function($ctx2) {
  57878. return $self._throwException();
  57879. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57880. }))._on_do_($globals.Error,(function(error){
  57881. return $core.withContext(function($ctx2) {
  57882. return $self._assert_($recv($recv(error)._exception()).__eq("test"));
  57883. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  57884. }));
  57885. return self;
  57886. }, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},$globals.JavaScriptExceptionTest)});
  57887. },
  57888. args: [],
  57889. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  57890. referencedClasses: ["Error"],
  57891. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"]
  57892. }),
  57893. $globals.JavaScriptExceptionTest);
  57894. $core.addMethod(
  57895. $core.method({
  57896. selector: "testRaisingException",
  57897. protocol: "tests",
  57898. fn: function (){
  57899. var self=this,$self=this;
  57900. return $core.withContext(function($ctx1) {
  57901. $self._should_raise_((function(){
  57902. return $core.withContext(function($ctx2) {
  57903. return $self._throwException();
  57904. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57905. }),$globals.JavaScriptException);
  57906. return self;
  57907. }, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},$globals.JavaScriptExceptionTest)});
  57908. },
  57909. args: [],
  57910. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  57911. referencedClasses: ["JavaScriptException"],
  57912. messageSends: ["should:raise:", "throwException"]
  57913. }),
  57914. $globals.JavaScriptExceptionTest);
  57915. $core.addMethod(
  57916. $core.method({
  57917. selector: "throwException",
  57918. protocol: "helpers",
  57919. fn: function (){
  57920. var self=this,$self=this;
  57921. return $core.withContext(function($ctx1) {
  57922. throw "test";
  57923. return self;
  57924. }, function($ctx1) {$ctx1.fill(self,"throwException",{},$globals.JavaScriptExceptionTest)});
  57925. },
  57926. args: [],
  57927. source: "throwException\x0a\x09<inlineJS: 'throw \x22test\x22'>",
  57928. referencedClasses: [],
  57929. messageSends: []
  57930. }),
  57931. $globals.JavaScriptExceptionTest);
  57932. $core.addClass("MessageSendTest", $globals.TestCase, [], "Kernel-Tests");
  57933. $core.addMethod(
  57934. $core.method({
  57935. selector: "testValue",
  57936. protocol: "tests",
  57937. fn: function (){
  57938. var self=this,$self=this;
  57939. var messageSend;
  57940. return $core.withContext(function($ctx1) {
  57941. var $1;
  57942. $1=$recv($globals.MessageSend)._new();
  57943. $ctx1.sendIdx["new"]=1;
  57944. $recv($1)._receiver_($recv($globals.Object)._new());
  57945. $recv($1)._selector_("asString");
  57946. messageSend=$recv($1)._yourself();
  57947. $self._assert_equals_($recv(messageSend)._value(),"an Object");
  57948. return self;
  57949. }, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},$globals.MessageSendTest)});
  57950. },
  57951. args: [],
  57952. 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'",
  57953. referencedClasses: ["MessageSend", "Object"],
  57954. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"]
  57955. }),
  57956. $globals.MessageSendTest);
  57957. $core.addMethod(
  57958. $core.method({
  57959. selector: "testValueWithArguments",
  57960. protocol: "tests",
  57961. fn: function (){
  57962. var self=this,$self=this;
  57963. var messageSend;
  57964. return $core.withContext(function($ctx1) {
  57965. var $1;
  57966. $1=$recv($globals.MessageSend)._new();
  57967. $recv($1)._receiver_((2));
  57968. $recv($1)._selector_("+");
  57969. messageSend=$recv($1)._yourself();
  57970. $self._assert_equals_($recv(messageSend)._value_((3)),(5));
  57971. $ctx1.sendIdx["assert:equals:"]=1;
  57972. $self._assert_equals_($recv(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  57973. return self;
  57974. }, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},$globals.MessageSendTest)});
  57975. },
  57976. args: [],
  57977. 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",
  57978. referencedClasses: ["MessageSend"],
  57979. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"]
  57980. }),
  57981. $globals.MessageSendTest);
  57982. $core.addClass("MethodInheritanceTest", $globals.TestCase, ["receiverTop", "receiverMiddle", "receiverBottom", "method", "performBlock"], "Kernel-Tests");
  57983. $core.addMethod(
  57984. $core.method({
  57985. selector: "codeGeneratorClass",
  57986. protocol: "accessing",
  57987. fn: function (){
  57988. var self=this,$self=this;
  57989. return $globals.CodeGenerator;
  57990. },
  57991. args: [],
  57992. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  57993. referencedClasses: ["CodeGenerator"],
  57994. messageSends: []
  57995. }),
  57996. $globals.MethodInheritanceTest);
  57997. $core.addMethod(
  57998. $core.method({
  57999. selector: "compiler",
  58000. protocol: "factory",
  58001. fn: function (){
  58002. var self=this,$self=this;
  58003. return $core.withContext(function($ctx1) {
  58004. var $1;
  58005. $1=$recv($globals.Compiler)._new();
  58006. $recv($1)._codeGeneratorClass_($self._codeGeneratorClass());
  58007. return $recv($1)._yourself();
  58008. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.MethodInheritanceTest)});
  58009. },
  58010. args: [],
  58011. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  58012. referencedClasses: ["Compiler"],
  58013. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  58014. }),
  58015. $globals.MethodInheritanceTest);
  58016. $core.addMethod(
  58017. $core.method({
  58018. selector: "deinstallBottom",
  58019. protocol: "testing",
  58020. fn: function (){
  58021. var self=this,$self=this;
  58022. return $core.withContext(function($ctx1) {
  58023. $recv($self._targetClassBottom())._removeCompiledMethod_($self["@method"]);
  58024. return self;
  58025. }, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},$globals.MethodInheritanceTest)});
  58026. },
  58027. args: [],
  58028. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  58029. referencedClasses: [],
  58030. messageSends: ["removeCompiledMethod:", "targetClassBottom"]
  58031. }),
  58032. $globals.MethodInheritanceTest);
  58033. $core.addMethod(
  58034. $core.method({
  58035. selector: "deinstallMiddle",
  58036. protocol: "testing",
  58037. fn: function (){
  58038. var self=this,$self=this;
  58039. return $core.withContext(function($ctx1) {
  58040. $recv($self._targetClassMiddle())._removeCompiledMethod_($self["@method"]);
  58041. return self;
  58042. }, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},$globals.MethodInheritanceTest)});
  58043. },
  58044. args: [],
  58045. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  58046. referencedClasses: [],
  58047. messageSends: ["removeCompiledMethod:", "targetClassMiddle"]
  58048. }),
  58049. $globals.MethodInheritanceTest);
  58050. $core.addMethod(
  58051. $core.method({
  58052. selector: "deinstallTop",
  58053. protocol: "testing",
  58054. fn: function (){
  58055. var self=this,$self=this;
  58056. return $core.withContext(function($ctx1) {
  58057. $recv($self._targetClassTop())._removeCompiledMethod_($self["@method"]);
  58058. return self;
  58059. }, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},$globals.MethodInheritanceTest)});
  58060. },
  58061. args: [],
  58062. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  58063. referencedClasses: [],
  58064. messageSends: ["removeCompiledMethod:", "targetClassTop"]
  58065. }),
  58066. $globals.MethodInheritanceTest);
  58067. $core.addMethod(
  58068. $core.method({
  58069. selector: "installBottom:",
  58070. protocol: "testing",
  58071. fn: function (aString){
  58072. var self=this,$self=this;
  58073. return $core.withContext(function($ctx1) {
  58074. $self["@method"]=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassBottom(),"tests");
  58075. return self;
  58076. }, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},$globals.MethodInheritanceTest)});
  58077. },
  58078. args: ["aString"],
  58079. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  58080. referencedClasses: [],
  58081. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"]
  58082. }),
  58083. $globals.MethodInheritanceTest);
  58084. $core.addMethod(
  58085. $core.method({
  58086. selector: "installMiddle:",
  58087. protocol: "testing",
  58088. fn: function (aString){
  58089. var self=this,$self=this;
  58090. return $core.withContext(function($ctx1) {
  58091. $self["@method"]=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassMiddle(),"tests");
  58092. return self;
  58093. }, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},$globals.MethodInheritanceTest)});
  58094. },
  58095. args: ["aString"],
  58096. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  58097. referencedClasses: [],
  58098. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"]
  58099. }),
  58100. $globals.MethodInheritanceTest);
  58101. $core.addMethod(
  58102. $core.method({
  58103. selector: "installTop:",
  58104. protocol: "testing",
  58105. fn: function (aString){
  58106. var self=this,$self=this;
  58107. return $core.withContext(function($ctx1) {
  58108. $self["@method"]=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassTop(),"tests");
  58109. return self;
  58110. }, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},$globals.MethodInheritanceTest)});
  58111. },
  58112. args: ["aString"],
  58113. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  58114. referencedClasses: [],
  58115. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"]
  58116. }),
  58117. $globals.MethodInheritanceTest);
  58118. $core.addMethod(
  58119. $core.method({
  58120. selector: "setUp",
  58121. protocol: "initialization",
  58122. fn: function (){
  58123. var self=this,$self=this;
  58124. return $core.withContext(function($ctx1) {
  58125. $self["@receiverTop"]=$recv($self._targetClassTop())._new();
  58126. $ctx1.sendIdx["new"]=1;
  58127. $self["@receiverMiddle"]=$recv($self._targetClassMiddle())._new();
  58128. $ctx1.sendIdx["new"]=2;
  58129. $self["@receiverBottom"]=$recv($self._targetClassBottom())._new();
  58130. $self["@method"]=nil;
  58131. $self["@performBlock"]=(function(){
  58132. return $core.withContext(function($ctx2) {
  58133. return $self._error_("performBlock not initialized");
  58134. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58135. });
  58136. return self;
  58137. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.MethodInheritanceTest)});
  58138. },
  58139. args: [],
  58140. 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' ]",
  58141. referencedClasses: [],
  58142. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"]
  58143. }),
  58144. $globals.MethodInheritanceTest);
  58145. $core.addMethod(
  58146. $core.method({
  58147. selector: "shouldMNU",
  58148. protocol: "testing",
  58149. fn: function (){
  58150. var self=this,$self=this;
  58151. return $core.withContext(function($ctx1) {
  58152. $self._shouldMNUTop();
  58153. $self._shouldMNUMiddle();
  58154. $self._shouldMNUBottom();
  58155. return self;
  58156. }, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},$globals.MethodInheritanceTest)});
  58157. },
  58158. args: [],
  58159. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  58160. referencedClasses: [],
  58161. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"]
  58162. }),
  58163. $globals.MethodInheritanceTest);
  58164. $core.addMethod(
  58165. $core.method({
  58166. selector: "shouldMNUBottom",
  58167. protocol: "testing",
  58168. fn: function (){
  58169. var self=this,$self=this;
  58170. return $core.withContext(function($ctx1) {
  58171. $self._should_raise_((function(){
  58172. return $core.withContext(function($ctx2) {
  58173. return $recv($self["@performBlock"])._value_($self["@receiverBottom"]);
  58174. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58175. }),$globals.MessageNotUnderstood);
  58176. return self;
  58177. }, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},$globals.MethodInheritanceTest)});
  58178. },
  58179. args: [],
  58180. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  58181. referencedClasses: ["MessageNotUnderstood"],
  58182. messageSends: ["should:raise:", "value:"]
  58183. }),
  58184. $globals.MethodInheritanceTest);
  58185. $core.addMethod(
  58186. $core.method({
  58187. selector: "shouldMNUMiddle",
  58188. protocol: "testing",
  58189. fn: function (){
  58190. var self=this,$self=this;
  58191. return $core.withContext(function($ctx1) {
  58192. $self._should_raise_((function(){
  58193. return $core.withContext(function($ctx2) {
  58194. return $recv($self["@performBlock"])._value_($self["@receiverMiddle"]);
  58195. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58196. }),$globals.MessageNotUnderstood);
  58197. return self;
  58198. }, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},$globals.MethodInheritanceTest)});
  58199. },
  58200. args: [],
  58201. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  58202. referencedClasses: ["MessageNotUnderstood"],
  58203. messageSends: ["should:raise:", "value:"]
  58204. }),
  58205. $globals.MethodInheritanceTest);
  58206. $core.addMethod(
  58207. $core.method({
  58208. selector: "shouldMNUTop",
  58209. protocol: "testing",
  58210. fn: function (){
  58211. var self=this,$self=this;
  58212. return $core.withContext(function($ctx1) {
  58213. $self._should_raise_((function(){
  58214. return $core.withContext(function($ctx2) {
  58215. return $recv($self["@performBlock"])._value_($self["@receiverTop"]);
  58216. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58217. }),$globals.MessageNotUnderstood);
  58218. return self;
  58219. }, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},$globals.MethodInheritanceTest)});
  58220. },
  58221. args: [],
  58222. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  58223. referencedClasses: ["MessageNotUnderstood"],
  58224. messageSends: ["should:raise:", "value:"]
  58225. }),
  58226. $globals.MethodInheritanceTest);
  58227. $core.addMethod(
  58228. $core.method({
  58229. selector: "shouldReturn:",
  58230. protocol: "testing",
  58231. fn: function (anObject){
  58232. var self=this,$self=this;
  58233. var result;
  58234. return $core.withContext(function($ctx1) {
  58235. result=$recv($self["@performBlock"])._value_($self["@receiverTop"]);
  58236. $ctx1.sendIdx["value:"]=1;
  58237. $self._assert_equals_(["top",anObject],["top",result]);
  58238. $ctx1.sendIdx["assert:equals:"]=1;
  58239. result=$recv($self["@performBlock"])._value_($self["@receiverMiddle"]);
  58240. $ctx1.sendIdx["value:"]=2;
  58241. $self._assert_equals_(["middle",anObject],["middle",result]);
  58242. $ctx1.sendIdx["assert:equals:"]=2;
  58243. result=$recv($self["@performBlock"])._value_($self["@receiverBottom"]);
  58244. $self._assert_equals_(["bottom",anObject],["bottom",result]);
  58245. return self;
  58246. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},$globals.MethodInheritanceTest)});
  58247. },
  58248. args: ["anObject"],
  58249. 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 }",
  58250. referencedClasses: [],
  58251. messageSends: ["value:", "assert:equals:"]
  58252. }),
  58253. $globals.MethodInheritanceTest);
  58254. $core.addMethod(
  58255. $core.method({
  58256. selector: "shouldReturn:and:and:",
  58257. protocol: "testing",
  58258. fn: function (anObject,anObject2,anObject3){
  58259. var self=this,$self=this;
  58260. var result;
  58261. return $core.withContext(function($ctx1) {
  58262. result=$recv($self["@performBlock"])._value_($self["@receiverTop"]);
  58263. $ctx1.sendIdx["value:"]=1;
  58264. $self._assert_equals_(["top",anObject],["top",result]);
  58265. $ctx1.sendIdx["assert:equals:"]=1;
  58266. result=$recv($self["@performBlock"])._value_($self["@receiverMiddle"]);
  58267. $ctx1.sendIdx["value:"]=2;
  58268. $self._assert_equals_(["middle",anObject2],["middle",result]);
  58269. $ctx1.sendIdx["assert:equals:"]=2;
  58270. result=$recv($self["@performBlock"])._value_($self["@receiverBottom"]);
  58271. $self._assert_equals_(["bottom",anObject3],["bottom",result]);
  58272. return self;
  58273. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},$globals.MethodInheritanceTest)});
  58274. },
  58275. args: ["anObject", "anObject2", "anObject3"],
  58276. 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 }",
  58277. referencedClasses: [],
  58278. messageSends: ["value:", "assert:equals:"]
  58279. }),
  58280. $globals.MethodInheritanceTest);
  58281. $core.addMethod(
  58282. $core.method({
  58283. selector: "targetClassBottom",
  58284. protocol: "accessing",
  58285. fn: function (){
  58286. var self=this,$self=this;
  58287. return $globals.JavaScriptException;
  58288. },
  58289. args: [],
  58290. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  58291. referencedClasses: ["JavaScriptException"],
  58292. messageSends: []
  58293. }),
  58294. $globals.MethodInheritanceTest);
  58295. $core.addMethod(
  58296. $core.method({
  58297. selector: "targetClassMiddle",
  58298. protocol: "accessing",
  58299. fn: function (){
  58300. var self=this,$self=this;
  58301. return $globals.Error;
  58302. },
  58303. args: [],
  58304. source: "targetClassMiddle\x0a\x09^ Error",
  58305. referencedClasses: ["Error"],
  58306. messageSends: []
  58307. }),
  58308. $globals.MethodInheritanceTest);
  58309. $core.addMethod(
  58310. $core.method({
  58311. selector: "targetClassTop",
  58312. protocol: "accessing",
  58313. fn: function (){
  58314. var self=this,$self=this;
  58315. return $globals.Object;
  58316. },
  58317. args: [],
  58318. source: "targetClassTop\x0a\x09^ Object",
  58319. referencedClasses: ["Object"],
  58320. messageSends: []
  58321. }),
  58322. $globals.MethodInheritanceTest);
  58323. $core.addMethod(
  58324. $core.method({
  58325. selector: "tearDown",
  58326. protocol: "initialization",
  58327. fn: function (){
  58328. var self=this,$self=this;
  58329. return $core.withContext(function($ctx1) {
  58330. $recv((function(){
  58331. return $core.withContext(function($ctx2) {
  58332. return $self._deinstallTop();
  58333. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58334. }))._on_do_($globals.Error,(function(){
  58335. }));
  58336. $ctx1.sendIdx["on:do:"]=1;
  58337. $recv((function(){
  58338. return $core.withContext(function($ctx2) {
  58339. return $self._deinstallMiddle();
  58340. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  58341. }))._on_do_($globals.Error,(function(){
  58342. }));
  58343. $ctx1.sendIdx["on:do:"]=2;
  58344. $recv((function(){
  58345. return $core.withContext(function($ctx2) {
  58346. return $self._deinstallBottom();
  58347. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  58348. }))._on_do_($globals.Error,(function(){
  58349. }));
  58350. return self;
  58351. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.MethodInheritanceTest)});
  58352. },
  58353. args: [],
  58354. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  58355. referencedClasses: ["Error"],
  58356. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"]
  58357. }),
  58358. $globals.MethodInheritanceTest);
  58359. $core.addMethod(
  58360. $core.method({
  58361. selector: "testMNU11",
  58362. protocol: "tests",
  58363. fn: function (){
  58364. var self=this,$self=this;
  58365. return $core.withContext(function($ctx1) {
  58366. $self["@performBlock"]=(function(x){
  58367. return $core.withContext(function($ctx2) {
  58368. return $recv(x)._foo();
  58369. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  58370. });
  58371. $self._shouldMNU();
  58372. $ctx1.sendIdx["shouldMNU"]=1;
  58373. $self._installTop_("foo ^ false");
  58374. $ctx1.sendIdx["installTop:"]=1;
  58375. $self._installTop_("foo ^ true");
  58376. $self._deinstallTop();
  58377. $self._shouldMNU();
  58378. return self;
  58379. }, function($ctx1) {$ctx1.fill(self,"testMNU11",{},$globals.MethodInheritanceTest)});
  58380. },
  58381. args: [],
  58382. 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",
  58383. referencedClasses: [],
  58384. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"]
  58385. }),
  58386. $globals.MethodInheritanceTest);
  58387. $core.addMethod(
  58388. $core.method({
  58389. selector: "testMNU22",
  58390. protocol: "tests",
  58391. fn: function (){
  58392. var self=this,$self=this;
  58393. return $core.withContext(function($ctx1) {
  58394. $self["@performBlock"]=(function(x){
  58395. return $core.withContext(function($ctx2) {
  58396. return $recv(x)._foo();
  58397. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  58398. });
  58399. $self._shouldMNU();
  58400. $ctx1.sendIdx["shouldMNU"]=1;
  58401. $self._installMiddle_("foo ^ false");
  58402. $ctx1.sendIdx["installMiddle:"]=1;
  58403. $self._installMiddle_("foo ^ true");
  58404. $self._deinstallMiddle();
  58405. $self._shouldMNU();
  58406. return self;
  58407. }, function($ctx1) {$ctx1.fill(self,"testMNU22",{},$globals.MethodInheritanceTest)});
  58408. },
  58409. args: [],
  58410. 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",
  58411. referencedClasses: [],
  58412. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"]
  58413. }),
  58414. $globals.MethodInheritanceTest);
  58415. $core.addMethod(
  58416. $core.method({
  58417. selector: "testReturns1",
  58418. protocol: "tests",
  58419. fn: function (){
  58420. var self=this,$self=this;
  58421. return $core.withContext(function($ctx1) {
  58422. $self["@performBlock"]=(function(x){
  58423. return $core.withContext(function($ctx2) {
  58424. return $recv(x)._foo();
  58425. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  58426. });
  58427. $self._installTop_("foo ^ false");
  58428. $ctx1.sendIdx["installTop:"]=1;
  58429. $self._shouldReturn_(false);
  58430. $ctx1.sendIdx["shouldReturn:"]=1;
  58431. $self._installTop_("foo ^ true");
  58432. $self._shouldReturn_(true);
  58433. return self;
  58434. }, function($ctx1) {$ctx1.fill(self,"testReturns1",{},$globals.MethodInheritanceTest)});
  58435. },
  58436. args: [],
  58437. 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",
  58438. referencedClasses: [],
  58439. messageSends: ["foo", "installTop:", "shouldReturn:"]
  58440. }),
  58441. $globals.MethodInheritanceTest);
  58442. $core.addClass("NumberTest", $globals.TestCase, [], "Kernel-Tests");
  58443. $core.addMethod(
  58444. $core.method({
  58445. selector: "testAbs",
  58446. protocol: "tests",
  58447. fn: function (){
  58448. var self=this,$self=this;
  58449. return $core.withContext(function($ctx1) {
  58450. var $1;
  58451. $1=(4)._abs();
  58452. $ctx1.sendIdx["abs"]=1;
  58453. $self._assert_equals_($1,(4));
  58454. $ctx1.sendIdx["assert:equals:"]=1;
  58455. $self._assert_equals_((-4)._abs(),(4));
  58456. return self;
  58457. }, function($ctx1) {$ctx1.fill(self,"testAbs",{},$globals.NumberTest)});
  58458. },
  58459. args: [],
  58460. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  58461. referencedClasses: [],
  58462. messageSends: ["assert:equals:", "abs"]
  58463. }),
  58464. $globals.NumberTest);
  58465. $core.addMethod(
  58466. $core.method({
  58467. selector: "testArithmetic",
  58468. protocol: "tests",
  58469. fn: function (){
  58470. var self=this,$self=this;
  58471. return $core.withContext(function($ctx1) {
  58472. var $1,$2,$3,$5,$4;
  58473. $1=(1.5).__plus((1));
  58474. $ctx1.sendIdx["+"]=1;
  58475. $self._assert_equals_($1,(2.5));
  58476. $ctx1.sendIdx["assert:equals:"]=1;
  58477. $2=(2).__minus((1));
  58478. $ctx1.sendIdx["-"]=1;
  58479. $self._assert_equals_($2,(1));
  58480. $ctx1.sendIdx["assert:equals:"]=2;
  58481. $self._assert_equals_((-2).__minus((1)),(-3));
  58482. $ctx1.sendIdx["assert:equals:"]=3;
  58483. $self._assert_equals_((12).__slash((2)),(6));
  58484. $ctx1.sendIdx["assert:equals:"]=4;
  58485. $3=(3).__star((4));
  58486. $ctx1.sendIdx["*"]=1;
  58487. $self._assert_equals_($3,(12));
  58488. $ctx1.sendIdx["assert:equals:"]=5;
  58489. $self._assert_equals_((7).__slash_slash((2)),(3));
  58490. $ctx1.sendIdx["assert:equals:"]=6;
  58491. $self._assert_equals_((7).__backslash_backslash((2)),(1));
  58492. $ctx1.sendIdx["assert:equals:"]=7;
  58493. $5=(1).__plus((2));
  58494. $ctx1.sendIdx["+"]=2;
  58495. $4=$recv($5).__star((3));
  58496. $ctx1.sendIdx["*"]=2;
  58497. $self._assert_equals_($4,(9));
  58498. $ctx1.sendIdx["assert:equals:"]=8;
  58499. $self._assert_equals_((1).__plus((2).__star((3))),(7));
  58500. return self;
  58501. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.NumberTest)});
  58502. },
  58503. args: [],
  58504. 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",
  58505. referencedClasses: [],
  58506. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"]
  58507. }),
  58508. $globals.NumberTest);
  58509. $core.addMethod(
  58510. $core.method({
  58511. selector: "testAsNumber",
  58512. protocol: "tests",
  58513. fn: function (){
  58514. var self=this,$self=this;
  58515. return $core.withContext(function($ctx1) {
  58516. $self._assert_equals_((3)._asNumber(),(3));
  58517. return self;
  58518. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.NumberTest)});
  58519. },
  58520. args: [],
  58521. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  58522. referencedClasses: [],
  58523. messageSends: ["assert:equals:", "asNumber"]
  58524. }),
  58525. $globals.NumberTest);
  58526. $core.addMethod(
  58527. $core.method({
  58528. selector: "testBetweenAnd",
  58529. protocol: "tests",
  58530. fn: function (){
  58531. var self=this,$self=this;
  58532. return $core.withContext(function($ctx1) {
  58533. var $1,$3,$2,$5,$4;
  58534. $1=(4)._between_and_((3),(5));
  58535. $ctx1.sendIdx["between:and:"]=1;
  58536. $self._assert_($1);
  58537. $ctx1.sendIdx["assert:"]=1;
  58538. $3=(1)._between_and_((5),(6));
  58539. $ctx1.sendIdx["between:and:"]=2;
  58540. $2=$recv($3)._not();
  58541. $ctx1.sendIdx["not"]=1;
  58542. $self._assert_($2);
  58543. $ctx1.sendIdx["assert:"]=2;
  58544. $5=(90)._between_and_((67),(87));
  58545. $ctx1.sendIdx["between:and:"]=3;
  58546. $4=$recv($5)._not();
  58547. $self._assert_($4);
  58548. $ctx1.sendIdx["assert:"]=3;
  58549. $self._assert_((1)._between_and_((1),(1)));
  58550. return self;
  58551. }, function($ctx1) {$ctx1.fill(self,"testBetweenAnd",{},$globals.NumberTest)});
  58552. },
  58553. args: [],
  58554. 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).",
  58555. referencedClasses: [],
  58556. messageSends: ["assert:", "between:and:", "not"]
  58557. }),
  58558. $globals.NumberTest);
  58559. $core.addMethod(
  58560. $core.method({
  58561. selector: "testBitAnd",
  58562. protocol: "tests",
  58563. fn: function (){
  58564. var self=this,$self=this;
  58565. return $core.withContext(function($ctx1) {
  58566. var $1,$2;
  58567. $1=(15)._bitAnd_((2));
  58568. $ctx1.sendIdx["bitAnd:"]=1;
  58569. $self._assert_equals_($1,(2));
  58570. $ctx1.sendIdx["assert:equals:"]=1;
  58571. $2=(15)._bitAnd_((15));
  58572. $ctx1.sendIdx["bitAnd:"]=2;
  58573. $self._assert_equals_($2,(15));
  58574. $ctx1.sendIdx["assert:equals:"]=2;
  58575. $self._assert_equals_((-1)._bitAnd_((1021)),(1021));
  58576. return self;
  58577. }, function($ctx1) {$ctx1.fill(self,"testBitAnd",{},$globals.NumberTest)});
  58578. },
  58579. args: [],
  58580. 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",
  58581. referencedClasses: [],
  58582. messageSends: ["assert:equals:", "bitAnd:"]
  58583. }),
  58584. $globals.NumberTest);
  58585. $core.addMethod(
  58586. $core.method({
  58587. selector: "testBitNot",
  58588. protocol: "tests",
  58589. fn: function (){
  58590. var self=this,$self=this;
  58591. return $core.withContext(function($ctx1) {
  58592. var $1,$2;
  58593. $1=(2)._bitNot();
  58594. $ctx1.sendIdx["bitNot"]=1;
  58595. $self._assert_equals_($1,(-3));
  58596. $ctx1.sendIdx["assert:equals:"]=1;
  58597. $2=(-1)._bitNot();
  58598. $ctx1.sendIdx["bitNot"]=2;
  58599. $self._assert_equals_($2,(0));
  58600. $ctx1.sendIdx["assert:equals:"]=2;
  58601. $self._assert_equals_((-1022)._bitNot(),(1021));
  58602. return self;
  58603. }, function($ctx1) {$ctx1.fill(self,"testBitNot",{},$globals.NumberTest)});
  58604. },
  58605. args: [],
  58606. source: "testBitNot\x0a\x09self assert: 2 bitNot equals: -3.\x0a\x09self assert: -1 bitNot equals: 0.\x0a\x09self assert: -1022 bitNot equals: 1021",
  58607. referencedClasses: [],
  58608. messageSends: ["assert:equals:", "bitNot"]
  58609. }),
  58610. $globals.NumberTest);
  58611. $core.addMethod(
  58612. $core.method({
  58613. selector: "testBitOr",
  58614. protocol: "tests",
  58615. fn: function (){
  58616. var self=this,$self=this;
  58617. return $core.withContext(function($ctx1) {
  58618. var $1,$2;
  58619. $1=(2)._bitOr_((4));
  58620. $ctx1.sendIdx["bitOr:"]=1;
  58621. $self._assert_equals_($1,(6));
  58622. $ctx1.sendIdx["assert:equals:"]=1;
  58623. $2=(7)._bitOr_((2));
  58624. $ctx1.sendIdx["bitOr:"]=2;
  58625. $self._assert_equals_($2,(7));
  58626. $ctx1.sendIdx["assert:equals:"]=2;
  58627. $self._assert_equals_((-1)._bitOr_((1021)),(-1));
  58628. return self;
  58629. }, function($ctx1) {$ctx1.fill(self,"testBitOr",{},$globals.NumberTest)});
  58630. },
  58631. args: [],
  58632. 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",
  58633. referencedClasses: [],
  58634. messageSends: ["assert:equals:", "bitOr:"]
  58635. }),
  58636. $globals.NumberTest);
  58637. $core.addMethod(
  58638. $core.method({
  58639. selector: "testBitXor",
  58640. protocol: "tests",
  58641. fn: function (){
  58642. var self=this,$self=this;
  58643. return $core.withContext(function($ctx1) {
  58644. var $1,$2,$3;
  58645. $1=(2)._bitXor_((4));
  58646. $ctx1.sendIdx["bitXor:"]=1;
  58647. $self._assert_equals_($1,(6));
  58648. $ctx1.sendIdx["assert:equals:"]=1;
  58649. $2=(7)._bitXor_((2));
  58650. $ctx1.sendIdx["bitXor:"]=2;
  58651. $self._assert_equals_($2,(5));
  58652. $ctx1.sendIdx["assert:equals:"]=2;
  58653. $3=(-1)._bitXor_((1021));
  58654. $ctx1.sendIdx["bitXor:"]=3;
  58655. $self._assert_equals_($3,(-1022));
  58656. $ctx1.sendIdx["assert:equals:"]=3;
  58657. $self._assert_equals_((91)._bitXor_((91)),(0));
  58658. return self;
  58659. }, function($ctx1) {$ctx1.fill(self,"testBitXor",{},$globals.NumberTest)});
  58660. },
  58661. args: [],
  58662. 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",
  58663. referencedClasses: [],
  58664. messageSends: ["assert:equals:", "bitXor:"]
  58665. }),
  58666. $globals.NumberTest);
  58667. $core.addMethod(
  58668. $core.method({
  58669. selector: "testCeiling",
  58670. protocol: "tests",
  58671. fn: function (){
  58672. var self=this,$self=this;
  58673. return $core.withContext(function($ctx1) {
  58674. var $1,$2;
  58675. $1=(1.2)._ceiling();
  58676. $ctx1.sendIdx["ceiling"]=1;
  58677. $self._assert_equals_($1,(2));
  58678. $ctx1.sendIdx["assert:equals:"]=1;
  58679. $2=(-1.2)._ceiling();
  58680. $ctx1.sendIdx["ceiling"]=2;
  58681. $self._assert_equals_($2,(-1));
  58682. $ctx1.sendIdx["assert:equals:"]=2;
  58683. $self._assert_equals_((1)._ceiling(),(1));
  58684. return self;
  58685. }, function($ctx1) {$ctx1.fill(self,"testCeiling",{},$globals.NumberTest)});
  58686. },
  58687. args: [],
  58688. 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.",
  58689. referencedClasses: [],
  58690. messageSends: ["assert:equals:", "ceiling"]
  58691. }),
  58692. $globals.NumberTest);
  58693. $core.addMethod(
  58694. $core.method({
  58695. selector: "testComparison",
  58696. protocol: "tests",
  58697. fn: function (){
  58698. var self=this,$self=this;
  58699. return $core.withContext(function($ctx1) {
  58700. var $1,$2,$3,$4;
  58701. $1=(3).__gt((2));
  58702. $ctx1.sendIdx[">"]=1;
  58703. $self._assert_($1);
  58704. $ctx1.sendIdx["assert:"]=1;
  58705. $2=(2).__lt((3));
  58706. $ctx1.sendIdx["<"]=1;
  58707. $self._assert_($2);
  58708. $ctx1.sendIdx["assert:"]=2;
  58709. $self._deny_((3).__lt((2)));
  58710. $ctx1.sendIdx["deny:"]=1;
  58711. $self._deny_((2).__gt((3)));
  58712. $3=(3).__gt_eq((3));
  58713. $ctx1.sendIdx[">="]=1;
  58714. $self._assert_($3);
  58715. $ctx1.sendIdx["assert:"]=3;
  58716. $self._assert_((3.1).__gt_eq((3)));
  58717. $ctx1.sendIdx["assert:"]=4;
  58718. $4=(3).__lt_eq((3));
  58719. $ctx1.sendIdx["<="]=1;
  58720. $self._assert_($4);
  58721. $ctx1.sendIdx["assert:"]=5;
  58722. $self._assert_((3).__lt_eq((3.1)));
  58723. return self;
  58724. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.NumberTest)});
  58725. },
  58726. args: [],
  58727. 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",
  58728. referencedClasses: [],
  58729. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="]
  58730. }),
  58731. $globals.NumberTest);
  58732. $core.addMethod(
  58733. $core.method({
  58734. selector: "testCopying",
  58735. protocol: "tests",
  58736. fn: function (){
  58737. var self=this,$self=this;
  58738. return $core.withContext(function($ctx1) {
  58739. var $1;
  58740. $1=$recv((1)._copy()).__eq_eq((1));
  58741. $ctx1.sendIdx["=="]=1;
  58742. $self._assert_($1);
  58743. $ctx1.sendIdx["assert:"]=1;
  58744. $self._assert_($recv((1)._deepCopy()).__eq_eq((1)));
  58745. return self;
  58746. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.NumberTest)});
  58747. },
  58748. args: [],
  58749. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  58750. referencedClasses: [],
  58751. messageSends: ["assert:", "==", "copy", "deepCopy"]
  58752. }),
  58753. $globals.NumberTest);
  58754. $core.addMethod(
  58755. $core.method({
  58756. selector: "testDegreesToRadians",
  58757. protocol: "tests",
  58758. fn: function (){
  58759. var self=this,$self=this;
  58760. return $core.withContext(function($ctx1) {
  58761. $self._assert_($recv($recv($recv((180)._degreesToRadians()).__minus($recv($globals.Number)._pi()))._abs()).__lt_eq((0.01)));
  58762. return self;
  58763. }, function($ctx1) {$ctx1.fill(self,"testDegreesToRadians",{},$globals.NumberTest)});
  58764. },
  58765. args: [],
  58766. source: "testDegreesToRadians\x0a\x09self assert: (180 degreesToRadians - Number pi) abs <= 0.01.",
  58767. referencedClasses: ["Number"],
  58768. messageSends: ["assert:", "<=", "abs", "-", "degreesToRadians", "pi"]
  58769. }),
  58770. $globals.NumberTest);
  58771. $core.addMethod(
  58772. $core.method({
  58773. selector: "testEquality",
  58774. protocol: "tests",
  58775. fn: function (){
  58776. var self=this,$self=this;
  58777. return $core.withContext(function($ctx1) {
  58778. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  58779. $1=(1).__eq((1));
  58780. $ctx1.sendIdx["="]=1;
  58781. $self._assert_($1);
  58782. $ctx1.sendIdx["assert:"]=1;
  58783. $2=(0).__eq((0));
  58784. $ctx1.sendIdx["="]=2;
  58785. $self._assert_($2);
  58786. $ctx1.sendIdx["assert:"]=2;
  58787. $3=(1).__eq((0));
  58788. $ctx1.sendIdx["="]=3;
  58789. $self._deny_($3);
  58790. $ctx1.sendIdx["deny:"]=1;
  58791. $5=(1)._yourself();
  58792. $ctx1.sendIdx["yourself"]=1;
  58793. $4=$recv($5).__eq((1));
  58794. $ctx1.sendIdx["="]=4;
  58795. $self._assert_($4);
  58796. $ctx1.sendIdx["assert:"]=3;
  58797. $7=(1)._yourself();
  58798. $ctx1.sendIdx["yourself"]=2;
  58799. $6=(1).__eq($7);
  58800. $ctx1.sendIdx["="]=5;
  58801. $self._assert_($6);
  58802. $ctx1.sendIdx["assert:"]=4;
  58803. $9=(1)._yourself();
  58804. $ctx1.sendIdx["yourself"]=3;
  58805. $8=$recv($9).__eq((1)._yourself());
  58806. $ctx1.sendIdx["="]=6;
  58807. $self._assert_($8);
  58808. $10=(0).__eq(false);
  58809. $ctx1.sendIdx["="]=7;
  58810. $self._deny_($10);
  58811. $ctx1.sendIdx["deny:"]=2;
  58812. $11=false.__eq((0));
  58813. $ctx1.sendIdx["="]=8;
  58814. $self._deny_($11);
  58815. $ctx1.sendIdx["deny:"]=3;
  58816. $12="".__eq((0));
  58817. $ctx1.sendIdx["="]=9;
  58818. $self._deny_($12);
  58819. $ctx1.sendIdx["deny:"]=4;
  58820. $self._deny_((0).__eq(""));
  58821. return self;
  58822. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.NumberTest)});
  58823. },
  58824. args: [],
  58825. 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 = ''",
  58826. referencedClasses: [],
  58827. messageSends: ["assert:", "=", "deny:", "yourself"]
  58828. }),
  58829. $globals.NumberTest);
  58830. $core.addMethod(
  58831. $core.method({
  58832. selector: "testFloor",
  58833. protocol: "tests",
  58834. fn: function (){
  58835. var self=this,$self=this;
  58836. return $core.withContext(function($ctx1) {
  58837. var $1,$2;
  58838. $1=(1.2)._floor();
  58839. $ctx1.sendIdx["floor"]=1;
  58840. $self._assert_equals_($1,(1));
  58841. $ctx1.sendIdx["assert:equals:"]=1;
  58842. $2=(-1.2)._floor();
  58843. $ctx1.sendIdx["floor"]=2;
  58844. $self._assert_equals_($2,(-2));
  58845. $ctx1.sendIdx["assert:equals:"]=2;
  58846. $self._assert_equals_((1)._floor(),(1));
  58847. return self;
  58848. }, function($ctx1) {$ctx1.fill(self,"testFloor",{},$globals.NumberTest)});
  58849. },
  58850. args: [],
  58851. 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.",
  58852. referencedClasses: [],
  58853. messageSends: ["assert:equals:", "floor"]
  58854. }),
  58855. $globals.NumberTest);
  58856. $core.addMethod(
  58857. $core.method({
  58858. selector: "testHexNumbers",
  58859. protocol: "tests",
  58860. fn: function (){
  58861. var self=this,$self=this;
  58862. return $core.withContext(function($ctx1) {
  58863. var $1,$2,$3,$4,$5;
  58864. $self._assert_equals_((9),(9));
  58865. $ctx1.sendIdx["assert:equals:"]=1;
  58866. $1=(10)._truncated();
  58867. $ctx1.sendIdx["truncated"]=1;
  58868. $self._assert_equals_($1,(10));
  58869. $ctx1.sendIdx["assert:equals:"]=2;
  58870. $2=(11)._truncated();
  58871. $ctx1.sendIdx["truncated"]=2;
  58872. $self._assert_equals_($2,(11));
  58873. $ctx1.sendIdx["assert:equals:"]=3;
  58874. $3=(12)._truncated();
  58875. $ctx1.sendIdx["truncated"]=3;
  58876. $self._assert_equals_($3,(12));
  58877. $ctx1.sendIdx["assert:equals:"]=4;
  58878. $4=(13)._truncated();
  58879. $ctx1.sendIdx["truncated"]=4;
  58880. $self._assert_equals_($4,(13));
  58881. $ctx1.sendIdx["assert:equals:"]=5;
  58882. $5=(14)._truncated();
  58883. $ctx1.sendIdx["truncated"]=5;
  58884. $self._assert_equals_($5,(14));
  58885. $ctx1.sendIdx["assert:equals:"]=6;
  58886. $self._assert_equals_((15)._truncated(),(15));
  58887. return self;
  58888. }, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},$globals.NumberTest)});
  58889. },
  58890. args: [],
  58891. 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",
  58892. referencedClasses: [],
  58893. messageSends: ["assert:equals:", "truncated"]
  58894. }),
  58895. $globals.NumberTest);
  58896. $core.addMethod(
  58897. $core.method({
  58898. selector: "testIdentity",
  58899. protocol: "tests",
  58900. fn: function (){
  58901. var self=this,$self=this;
  58902. return $core.withContext(function($ctx1) {
  58903. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  58904. $1=(1).__eq_eq((1));
  58905. $ctx1.sendIdx["=="]=1;
  58906. $self._assert_($1);
  58907. $ctx1.sendIdx["assert:"]=1;
  58908. $2=(0).__eq_eq((0));
  58909. $ctx1.sendIdx["=="]=2;
  58910. $self._assert_($2);
  58911. $ctx1.sendIdx["assert:"]=2;
  58912. $3=(1).__eq_eq((0));
  58913. $ctx1.sendIdx["=="]=3;
  58914. $self._deny_($3);
  58915. $ctx1.sendIdx["deny:"]=1;
  58916. $5=(1)._yourself();
  58917. $ctx1.sendIdx["yourself"]=1;
  58918. $4=$recv($5).__eq_eq((1));
  58919. $ctx1.sendIdx["=="]=4;
  58920. $self._assert_($4);
  58921. $ctx1.sendIdx["assert:"]=3;
  58922. $7=(1)._yourself();
  58923. $ctx1.sendIdx["yourself"]=2;
  58924. $6=(1).__eq_eq($7);
  58925. $ctx1.sendIdx["=="]=5;
  58926. $self._assert_($6);
  58927. $ctx1.sendIdx["assert:"]=4;
  58928. $9=(1)._yourself();
  58929. $ctx1.sendIdx["yourself"]=3;
  58930. $8=$recv($9).__eq_eq((1)._yourself());
  58931. $ctx1.sendIdx["=="]=6;
  58932. $self._assert_($8);
  58933. $self._deny_((1).__eq_eq((2)));
  58934. return self;
  58935. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.NumberTest)});
  58936. },
  58937. args: [],
  58938. 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",
  58939. referencedClasses: [],
  58940. messageSends: ["assert:", "==", "deny:", "yourself"]
  58941. }),
  58942. $globals.NumberTest);
  58943. $core.addMethod(
  58944. $core.method({
  58945. selector: "testInvalidHexNumbers",
  58946. protocol: "tests",
  58947. fn: function (){
  58948. var self=this,$self=this;
  58949. return $core.withContext(function($ctx1) {
  58950. $self._should_raise_((function(){
  58951. return $core.withContext(function($ctx2) {
  58952. return (16)._rG();
  58953. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58954. }),$globals.MessageNotUnderstood);
  58955. $ctx1.sendIdx["should:raise:"]=1;
  58956. $self._should_raise_((function(){
  58957. return $core.withContext(function($ctx2) {
  58958. return (16)._rg();
  58959. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  58960. }),$globals.MessageNotUnderstood);
  58961. $ctx1.sendIdx["should:raise:"]=2;
  58962. $self._should_raise_((function(){
  58963. return $core.withContext(function($ctx2) {
  58964. return (16)._rH();
  58965. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  58966. }),$globals.MessageNotUnderstood);
  58967. $ctx1.sendIdx["should:raise:"]=3;
  58968. $self._should_raise_((function(){
  58969. return $core.withContext(function($ctx2) {
  58970. return (16)._rh();
  58971. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  58972. }),$globals.MessageNotUnderstood);
  58973. $ctx1.sendIdx["should:raise:"]=4;
  58974. $self._should_raise_((function(){
  58975. return $core.withContext(function($ctx2) {
  58976. return (16)._rI();
  58977. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  58978. }),$globals.MessageNotUnderstood);
  58979. $ctx1.sendIdx["should:raise:"]=5;
  58980. $self._should_raise_((function(){
  58981. return $core.withContext(function($ctx2) {
  58982. return (16)._ri();
  58983. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  58984. }),$globals.MessageNotUnderstood);
  58985. $ctx1.sendIdx["should:raise:"]=6;
  58986. $self._should_raise_((function(){
  58987. return $core.withContext(function($ctx2) {
  58988. return (16)._rJ();
  58989. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  58990. }),$globals.MessageNotUnderstood);
  58991. $ctx1.sendIdx["should:raise:"]=7;
  58992. $self._should_raise_((function(){
  58993. return $core.withContext(function($ctx2) {
  58994. return (16)._rj();
  58995. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)});
  58996. }),$globals.MessageNotUnderstood);
  58997. $ctx1.sendIdx["should:raise:"]=8;
  58998. $self._should_raise_((function(){
  58999. return $core.withContext(function($ctx2) {
  59000. return (16)._rK();
  59001. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  59002. }),$globals.MessageNotUnderstood);
  59003. $ctx1.sendIdx["should:raise:"]=9;
  59004. $self._should_raise_((function(){
  59005. return $core.withContext(function($ctx2) {
  59006. return (16)._rk();
  59007. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)});
  59008. }),$globals.MessageNotUnderstood);
  59009. $ctx1.sendIdx["should:raise:"]=10;
  59010. $self._should_raise_((function(){
  59011. return $core.withContext(function($ctx2) {
  59012. return (16)._rL();
  59013. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  59014. }),$globals.MessageNotUnderstood);
  59015. $ctx1.sendIdx["should:raise:"]=11;
  59016. $self._should_raise_((function(){
  59017. return $core.withContext(function($ctx2) {
  59018. return (16)._rl();
  59019. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  59020. }),$globals.MessageNotUnderstood);
  59021. $ctx1.sendIdx["should:raise:"]=12;
  59022. $self._should_raise_((function(){
  59023. return $core.withContext(function($ctx2) {
  59024. return (16)._rM();
  59025. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)});
  59026. }),$globals.MessageNotUnderstood);
  59027. $ctx1.sendIdx["should:raise:"]=13;
  59028. $self._should_raise_((function(){
  59029. return $core.withContext(function($ctx2) {
  59030. return (16)._rm();
  59031. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  59032. }),$globals.MessageNotUnderstood);
  59033. $ctx1.sendIdx["should:raise:"]=14;
  59034. $self._should_raise_((function(){
  59035. return $core.withContext(function($ctx2) {
  59036. return (16)._rN();
  59037. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)});
  59038. }),$globals.MessageNotUnderstood);
  59039. $ctx1.sendIdx["should:raise:"]=15;
  59040. $self._should_raise_((function(){
  59041. return $core.withContext(function($ctx2) {
  59042. return (16)._rn();
  59043. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)});
  59044. }),$globals.MessageNotUnderstood);
  59045. $ctx1.sendIdx["should:raise:"]=16;
  59046. $self._should_raise_((function(){
  59047. return $core.withContext(function($ctx2) {
  59048. return (16)._rO();
  59049. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)});
  59050. }),$globals.MessageNotUnderstood);
  59051. $ctx1.sendIdx["should:raise:"]=17;
  59052. $self._should_raise_((function(){
  59053. return $core.withContext(function($ctx2) {
  59054. return (16)._ro();
  59055. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)});
  59056. }),$globals.MessageNotUnderstood);
  59057. $ctx1.sendIdx["should:raise:"]=18;
  59058. $self._should_raise_((function(){
  59059. return $core.withContext(function($ctx2) {
  59060. return (16)._rP();
  59061. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)});
  59062. }),$globals.MessageNotUnderstood);
  59063. $ctx1.sendIdx["should:raise:"]=19;
  59064. $self._should_raise_((function(){
  59065. return $core.withContext(function($ctx2) {
  59066. return (16)._rp();
  59067. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)});
  59068. }),$globals.MessageNotUnderstood);
  59069. $ctx1.sendIdx["should:raise:"]=20;
  59070. $self._should_raise_((function(){
  59071. return $core.withContext(function($ctx2) {
  59072. return (16)._rQ();
  59073. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)});
  59074. }),$globals.MessageNotUnderstood);
  59075. $ctx1.sendIdx["should:raise:"]=21;
  59076. $self._should_raise_((function(){
  59077. return $core.withContext(function($ctx2) {
  59078. return (16)._rq();
  59079. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)});
  59080. }),$globals.MessageNotUnderstood);
  59081. $ctx1.sendIdx["should:raise:"]=22;
  59082. $self._should_raise_((function(){
  59083. return $core.withContext(function($ctx2) {
  59084. return (16)._rR();
  59085. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)});
  59086. }),$globals.MessageNotUnderstood);
  59087. $ctx1.sendIdx["should:raise:"]=23;
  59088. $self._should_raise_((function(){
  59089. return $core.withContext(function($ctx2) {
  59090. return (16)._rr();
  59091. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)});
  59092. }),$globals.MessageNotUnderstood);
  59093. $ctx1.sendIdx["should:raise:"]=24;
  59094. $self._should_raise_((function(){
  59095. return $core.withContext(function($ctx2) {
  59096. return (16)._rS();
  59097. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)});
  59098. }),$globals.MessageNotUnderstood);
  59099. $ctx1.sendIdx["should:raise:"]=25;
  59100. $self._should_raise_((function(){
  59101. return $core.withContext(function($ctx2) {
  59102. return (16)._rs();
  59103. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)});
  59104. }),$globals.MessageNotUnderstood);
  59105. $ctx1.sendIdx["should:raise:"]=26;
  59106. $self._should_raise_((function(){
  59107. return $core.withContext(function($ctx2) {
  59108. return (16)._rT();
  59109. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)});
  59110. }),$globals.MessageNotUnderstood);
  59111. $ctx1.sendIdx["should:raise:"]=27;
  59112. $self._should_raise_((function(){
  59113. return $core.withContext(function($ctx2) {
  59114. return (16)._rt();
  59115. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)});
  59116. }),$globals.MessageNotUnderstood);
  59117. $ctx1.sendIdx["should:raise:"]=28;
  59118. $self._should_raise_((function(){
  59119. return $core.withContext(function($ctx2) {
  59120. return (16)._rU();
  59121. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)});
  59122. }),$globals.MessageNotUnderstood);
  59123. $ctx1.sendIdx["should:raise:"]=29;
  59124. $self._should_raise_((function(){
  59125. return $core.withContext(function($ctx2) {
  59126. return (16)._ru();
  59127. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)});
  59128. }),$globals.MessageNotUnderstood);
  59129. $ctx1.sendIdx["should:raise:"]=30;
  59130. $self._should_raise_((function(){
  59131. return $core.withContext(function($ctx2) {
  59132. return (16)._rV();
  59133. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)});
  59134. }),$globals.MessageNotUnderstood);
  59135. $ctx1.sendIdx["should:raise:"]=31;
  59136. $self._should_raise_((function(){
  59137. return $core.withContext(function($ctx2) {
  59138. return (16)._rv();
  59139. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)});
  59140. }),$globals.MessageNotUnderstood);
  59141. $ctx1.sendIdx["should:raise:"]=32;
  59142. $self._should_raise_((function(){
  59143. return $core.withContext(function($ctx2) {
  59144. return (16)._rW();
  59145. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)});
  59146. }),$globals.MessageNotUnderstood);
  59147. $ctx1.sendIdx["should:raise:"]=33;
  59148. $self._should_raise_((function(){
  59149. return $core.withContext(function($ctx2) {
  59150. return (16)._rw();
  59151. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)});
  59152. }),$globals.MessageNotUnderstood);
  59153. $ctx1.sendIdx["should:raise:"]=34;
  59154. $self._should_raise_((function(){
  59155. return $core.withContext(function($ctx2) {
  59156. return (16)._rX();
  59157. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)});
  59158. }),$globals.MessageNotUnderstood);
  59159. $ctx1.sendIdx["should:raise:"]=35;
  59160. $self._should_raise_((function(){
  59161. return $core.withContext(function($ctx2) {
  59162. return (16)._rx();
  59163. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)});
  59164. }),$globals.MessageNotUnderstood);
  59165. $ctx1.sendIdx["should:raise:"]=36;
  59166. $self._should_raise_((function(){
  59167. return $core.withContext(function($ctx2) {
  59168. return (16)._rY();
  59169. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)});
  59170. }),$globals.MessageNotUnderstood);
  59171. $ctx1.sendIdx["should:raise:"]=37;
  59172. $self._should_raise_((function(){
  59173. return $core.withContext(function($ctx2) {
  59174. return (16)._ry();
  59175. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)});
  59176. }),$globals.MessageNotUnderstood);
  59177. $ctx1.sendIdx["should:raise:"]=38;
  59178. $self._should_raise_((function(){
  59179. return $core.withContext(function($ctx2) {
  59180. return (16)._rZ();
  59181. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)});
  59182. }),$globals.MessageNotUnderstood);
  59183. $ctx1.sendIdx["should:raise:"]=39;
  59184. $self._should_raise_((function(){
  59185. return $core.withContext(function($ctx2) {
  59186. return (16)._rz();
  59187. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)});
  59188. }),$globals.MessageNotUnderstood);
  59189. $ctx1.sendIdx["should:raise:"]=40;
  59190. $self._should_raise_((function(){
  59191. return $core.withContext(function($ctx2) {
  59192. return (11259375)._Z();
  59193. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)});
  59194. }),$globals.MessageNotUnderstood);
  59195. return self;
  59196. }, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},$globals.NumberTest)});
  59197. },
  59198. args: [],
  59199. 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.",
  59200. referencedClasses: ["MessageNotUnderstood"],
  59201. 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"]
  59202. }),
  59203. $globals.NumberTest);
  59204. $core.addMethod(
  59205. $core.method({
  59206. selector: "testLog",
  59207. protocol: "tests",
  59208. fn: function (){
  59209. var self=this,$self=this;
  59210. return $core.withContext(function($ctx1) {
  59211. $self._assert_equals_((10000)._log(),(4));
  59212. $ctx1.sendIdx["assert:equals:"]=1;
  59213. $self._assert_equals_((512)._log_((2)),(9));
  59214. $ctx1.sendIdx["assert:equals:"]=2;
  59215. $self._assert_equals_($recv($recv($globals.Number)._e())._ln(),(1));
  59216. return self;
  59217. }, function($ctx1) {$ctx1.fill(self,"testLog",{},$globals.NumberTest)});
  59218. },
  59219. args: [],
  59220. 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.",
  59221. referencedClasses: ["Number"],
  59222. messageSends: ["assert:equals:", "log", "log:", "ln", "e"]
  59223. }),
  59224. $globals.NumberTest);
  59225. $core.addMethod(
  59226. $core.method({
  59227. selector: "testMinMax",
  59228. protocol: "tests",
  59229. fn: function (){
  59230. var self=this,$self=this;
  59231. return $core.withContext(function($ctx1) {
  59232. var $1,$2;
  59233. $self._assert_equals_((2)._max_((5)),(5));
  59234. $ctx1.sendIdx["assert:equals:"]=1;
  59235. $self._assert_equals_((2)._min_((5)),(2));
  59236. $ctx1.sendIdx["assert:equals:"]=2;
  59237. $1=(2)._min_max_((5),(3));
  59238. $ctx1.sendIdx["min:max:"]=1;
  59239. $self._assert_equals_($1,(3));
  59240. $ctx1.sendIdx["assert:equals:"]=3;
  59241. $2=(7)._min_max_((5),(3));
  59242. $ctx1.sendIdx["min:max:"]=2;
  59243. $self._assert_equals_($2,(5));
  59244. $ctx1.sendIdx["assert:equals:"]=4;
  59245. $self._assert_equals_((4)._min_max_((5),(3)),(4));
  59246. return self;
  59247. }, function($ctx1) {$ctx1.fill(self,"testMinMax",{},$globals.NumberTest)});
  59248. },
  59249. args: [],
  59250. 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.",
  59251. referencedClasses: [],
  59252. messageSends: ["assert:equals:", "max:", "min:", "min:max:"]
  59253. }),
  59254. $globals.NumberTest);
  59255. $core.addMethod(
  59256. $core.method({
  59257. selector: "testNegated",
  59258. protocol: "tests",
  59259. fn: function (){
  59260. var self=this,$self=this;
  59261. return $core.withContext(function($ctx1) {
  59262. var $1;
  59263. $1=(3)._negated();
  59264. $ctx1.sendIdx["negated"]=1;
  59265. $self._assert_equals_($1,(-3));
  59266. $ctx1.sendIdx["assert:equals:"]=1;
  59267. $self._assert_equals_((-3)._negated(),(3));
  59268. return self;
  59269. }, function($ctx1) {$ctx1.fill(self,"testNegated",{},$globals.NumberTest)});
  59270. },
  59271. args: [],
  59272. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  59273. referencedClasses: [],
  59274. messageSends: ["assert:equals:", "negated"]
  59275. }),
  59276. $globals.NumberTest);
  59277. $core.addMethod(
  59278. $core.method({
  59279. selector: "testPrintShowingDecimalPlaces",
  59280. protocol: "tests",
  59281. fn: function (){
  59282. var self=this,$self=this;
  59283. return $core.withContext(function($ctx1) {
  59284. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  59285. $1=(23)._printShowingDecimalPlaces_((2));
  59286. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  59287. $self._assert_equals_($1,"23.00");
  59288. $ctx1.sendIdx["assert:equals:"]=1;
  59289. $2=(23.5698)._printShowingDecimalPlaces_((2));
  59290. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  59291. $self._assert_equals_($2,"23.57");
  59292. $ctx1.sendIdx["assert:equals:"]=2;
  59293. $4=(234.567)._negated();
  59294. $ctx1.sendIdx["negated"]=1;
  59295. $3=$recv($4)._printShowingDecimalPlaces_((5));
  59296. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  59297. $self._assert_equals_($3,"-234.56700");
  59298. $ctx1.sendIdx["assert:equals:"]=3;
  59299. $5=(23.4567)._printShowingDecimalPlaces_((0));
  59300. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  59301. $self._assert_equals_($5,"23");
  59302. $ctx1.sendIdx["assert:equals:"]=4;
  59303. $6=(23.5567)._printShowingDecimalPlaces_((0));
  59304. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  59305. $self._assert_equals_($6,"24");
  59306. $ctx1.sendIdx["assert:equals:"]=5;
  59307. $8=(23.4567)._negated();
  59308. $ctx1.sendIdx["negated"]=2;
  59309. $7=$recv($8)._printShowingDecimalPlaces_((0));
  59310. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  59311. $self._assert_equals_($7,"-23");
  59312. $ctx1.sendIdx["assert:equals:"]=6;
  59313. $10=(23.5567)._negated();
  59314. $ctx1.sendIdx["negated"]=3;
  59315. $9=$recv($10)._printShowingDecimalPlaces_((0));
  59316. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  59317. $self._assert_equals_($9,"-24");
  59318. $ctx1.sendIdx["assert:equals:"]=7;
  59319. $11=(100000000)._printShowingDecimalPlaces_((1));
  59320. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  59321. $self._assert_equals_($11,"100000000.0");
  59322. $ctx1.sendIdx["assert:equals:"]=8;
  59323. $12=(0.98)._printShowingDecimalPlaces_((5));
  59324. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  59325. $self._assert_equals_($12,"0.98000");
  59326. $ctx1.sendIdx["assert:equals:"]=9;
  59327. $13=$recv((0.98)._negated())._printShowingDecimalPlaces_((2));
  59328. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  59329. $self._assert_equals_($13,"-0.98");
  59330. $ctx1.sendIdx["assert:equals:"]=10;
  59331. $14=(2.567)._printShowingDecimalPlaces_((2));
  59332. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  59333. $self._assert_equals_($14,"2.57");
  59334. $ctx1.sendIdx["assert:equals:"]=11;
  59335. $15=(-2.567)._printShowingDecimalPlaces_((2));
  59336. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  59337. $self._assert_equals_($15,"-2.57");
  59338. $ctx1.sendIdx["assert:equals:"]=12;
  59339. $self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  59340. return self;
  59341. }, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},$globals.NumberTest)});
  59342. },
  59343. args: [],
  59344. 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'.",
  59345. referencedClasses: [],
  59346. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"]
  59347. }),
  59348. $globals.NumberTest);
  59349. $core.addMethod(
  59350. $core.method({
  59351. selector: "testPrintStringBase",
  59352. protocol: "tests",
  59353. fn: function (){
  59354. var self=this,$self=this;
  59355. return $core.withContext(function($ctx1) {
  59356. var $1,$2,$3;
  59357. $1=(15)._printStringBase_((2));
  59358. $ctx1.sendIdx["printStringBase:"]=1;
  59359. $self._assert_equals_($1,"1111");
  59360. $ctx1.sendIdx["assert:equals:"]=1;
  59361. $2=(15)._printStringBase_((16));
  59362. $ctx1.sendIdx["printStringBase:"]=2;
  59363. $self._assert_equals_($2,"f");
  59364. $ctx1.sendIdx["assert:equals:"]=2;
  59365. $3=(256)._printStringBase_((16));
  59366. $ctx1.sendIdx["printStringBase:"]=3;
  59367. $self._assert_equals_($3,"100");
  59368. $ctx1.sendIdx["assert:equals:"]=3;
  59369. $self._assert_equals_((256)._printStringBase_((2)),"100000000");
  59370. return self;
  59371. }, function($ctx1) {$ctx1.fill(self,"testPrintStringBase",{},$globals.NumberTest)});
  59372. },
  59373. args: [],
  59374. 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'",
  59375. referencedClasses: [],
  59376. messageSends: ["assert:equals:", "printStringBase:"]
  59377. }),
  59378. $globals.NumberTest);
  59379. $core.addMethod(
  59380. $core.method({
  59381. selector: "testRadiansToDegrees",
  59382. protocol: "tests",
  59383. fn: function (){
  59384. var self=this,$self=this;
  59385. return $core.withContext(function($ctx1) {
  59386. $self._assert_($recv($recv($recv($recv($recv($globals.Number)._pi())._radiansToDegrees()).__minus((180)))._abs()).__lt_eq((0.01)));
  59387. return self;
  59388. }, function($ctx1) {$ctx1.fill(self,"testRadiansToDegrees",{},$globals.NumberTest)});
  59389. },
  59390. args: [],
  59391. source: "testRadiansToDegrees\x0a\x09self assert: (Number pi radiansToDegrees - 180) abs <= 0.01.",
  59392. referencedClasses: ["Number"],
  59393. messageSends: ["assert:", "<=", "abs", "-", "radiansToDegrees", "pi"]
  59394. }),
  59395. $globals.NumberTest);
  59396. $core.addMethod(
  59397. $core.method({
  59398. selector: "testRaisedTo",
  59399. protocol: "tests",
  59400. fn: function (){
  59401. var self=this,$self=this;
  59402. return $core.withContext(function($ctx1) {
  59403. var $1,$2,$3;
  59404. $1=(2)._raisedTo_((4));
  59405. $ctx1.sendIdx["raisedTo:"]=1;
  59406. $self._assert_equals_($1,(16));
  59407. $ctx1.sendIdx["assert:equals:"]=1;
  59408. $2=(2)._raisedTo_((0));
  59409. $ctx1.sendIdx["raisedTo:"]=2;
  59410. $self._assert_equals_($2,(1));
  59411. $ctx1.sendIdx["assert:equals:"]=2;
  59412. $3=(2)._raisedTo_((-3));
  59413. $ctx1.sendIdx["raisedTo:"]=3;
  59414. $self._assert_equals_($3,(0.125));
  59415. $ctx1.sendIdx["assert:equals:"]=3;
  59416. $self._assert_equals_((4)._raisedTo_((0.5)),(2));
  59417. $ctx1.sendIdx["assert:equals:"]=4;
  59418. $self._assert_equals_((2).__star_star((4)),(16));
  59419. return self;
  59420. }, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},$globals.NumberTest)});
  59421. },
  59422. args: [],
  59423. 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.",
  59424. referencedClasses: [],
  59425. messageSends: ["assert:equals:", "raisedTo:", "**"]
  59426. }),
  59427. $globals.NumberTest);
  59428. $core.addMethod(
  59429. $core.method({
  59430. selector: "testRounded",
  59431. protocol: "tests",
  59432. fn: function (){
  59433. var self=this,$self=this;
  59434. return $core.withContext(function($ctx1) {
  59435. var $1,$2;
  59436. $1=(3)._rounded();
  59437. $ctx1.sendIdx["rounded"]=1;
  59438. $self._assert_equals_($1,(3));
  59439. $ctx1.sendIdx["assert:equals:"]=1;
  59440. $2=(3.212)._rounded();
  59441. $ctx1.sendIdx["rounded"]=2;
  59442. $self._assert_equals_($2,(3));
  59443. $ctx1.sendIdx["assert:equals:"]=2;
  59444. $self._assert_equals_((3.51)._rounded(),(4));
  59445. return self;
  59446. }, function($ctx1) {$ctx1.fill(self,"testRounded",{},$globals.NumberTest)});
  59447. },
  59448. args: [],
  59449. 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",
  59450. referencedClasses: [],
  59451. messageSends: ["assert:equals:", "rounded"]
  59452. }),
  59453. $globals.NumberTest);
  59454. $core.addMethod(
  59455. $core.method({
  59456. selector: "testSign",
  59457. protocol: "tests",
  59458. fn: function (){
  59459. var self=this,$self=this;
  59460. return $core.withContext(function($ctx1) {
  59461. var $1,$2;
  59462. $1=(5)._sign();
  59463. $ctx1.sendIdx["sign"]=1;
  59464. $self._assert_equals_($1,(1));
  59465. $ctx1.sendIdx["assert:equals:"]=1;
  59466. $2=(0)._sign();
  59467. $ctx1.sendIdx["sign"]=2;
  59468. $self._assert_equals_($2,(0));
  59469. $ctx1.sendIdx["assert:equals:"]=2;
  59470. $self._assert_equals_((-1.4)._sign(),(-1));
  59471. return self;
  59472. }, function($ctx1) {$ctx1.fill(self,"testSign",{},$globals.NumberTest)});
  59473. },
  59474. args: [],
  59475. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  59476. referencedClasses: [],
  59477. messageSends: ["assert:equals:", "sign"]
  59478. }),
  59479. $globals.NumberTest);
  59480. $core.addMethod(
  59481. $core.method({
  59482. selector: "testSqrt",
  59483. protocol: "tests",
  59484. fn: function (){
  59485. var self=this,$self=this;
  59486. return $core.withContext(function($ctx1) {
  59487. var $1;
  59488. $1=(4)._sqrt();
  59489. $ctx1.sendIdx["sqrt"]=1;
  59490. $self._assert_equals_($1,(2));
  59491. $ctx1.sendIdx["assert:equals:"]=1;
  59492. $self._assert_equals_((16)._sqrt(),(4));
  59493. return self;
  59494. }, function($ctx1) {$ctx1.fill(self,"testSqrt",{},$globals.NumberTest)});
  59495. },
  59496. args: [],
  59497. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  59498. referencedClasses: [],
  59499. messageSends: ["assert:equals:", "sqrt"]
  59500. }),
  59501. $globals.NumberTest);
  59502. $core.addMethod(
  59503. $core.method({
  59504. selector: "testSquared",
  59505. protocol: "tests",
  59506. fn: function (){
  59507. var self=this,$self=this;
  59508. return $core.withContext(function($ctx1) {
  59509. $self._assert_equals_((4)._squared(),(16));
  59510. return self;
  59511. }, function($ctx1) {$ctx1.fill(self,"testSquared",{},$globals.NumberTest)});
  59512. },
  59513. args: [],
  59514. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  59515. referencedClasses: [],
  59516. messageSends: ["assert:equals:", "squared"]
  59517. }),
  59518. $globals.NumberTest);
  59519. $core.addMethod(
  59520. $core.method({
  59521. selector: "testTimesRepeat",
  59522. protocol: "tests",
  59523. fn: function (){
  59524. var self=this,$self=this;
  59525. var i;
  59526. return $core.withContext(function($ctx1) {
  59527. i=(0);
  59528. (0)._timesRepeat_((function(){
  59529. return $core.withContext(function($ctx2) {
  59530. i=$recv(i).__plus((1));
  59531. $ctx2.sendIdx["+"]=1;
  59532. return i;
  59533. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59534. }));
  59535. $ctx1.sendIdx["timesRepeat:"]=1;
  59536. $self._assert_equals_(i,(0));
  59537. $ctx1.sendIdx["assert:equals:"]=1;
  59538. (5)._timesRepeat_((function(){
  59539. return $core.withContext(function($ctx2) {
  59540. i=$recv(i).__plus((1));
  59541. return i;
  59542. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59543. }));
  59544. $self._assert_equals_(i,(5));
  59545. return self;
  59546. }, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},$globals.NumberTest)});
  59547. },
  59548. args: [],
  59549. 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",
  59550. referencedClasses: [],
  59551. messageSends: ["timesRepeat:", "+", "assert:equals:"]
  59552. }),
  59553. $globals.NumberTest);
  59554. $core.addMethod(
  59555. $core.method({
  59556. selector: "testTo",
  59557. protocol: "tests",
  59558. fn: function (){
  59559. var self=this,$self=this;
  59560. return $core.withContext(function($ctx1) {
  59561. $self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  59562. return self;
  59563. }, function($ctx1) {$ctx1.fill(self,"testTo",{},$globals.NumberTest)});
  59564. },
  59565. args: [],
  59566. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  59567. referencedClasses: [],
  59568. messageSends: ["assert:equals:", "to:"]
  59569. }),
  59570. $globals.NumberTest);
  59571. $core.addMethod(
  59572. $core.method({
  59573. selector: "testToBy",
  59574. protocol: "tests",
  59575. fn: function (){
  59576. var self=this,$self=this;
  59577. return $core.withContext(function($ctx1) {
  59578. var $1;
  59579. $1=(0)._to_by_((6),(2));
  59580. $ctx1.sendIdx["to:by:"]=1;
  59581. $self._assert_equals_($1,[(0), (2), (4), (6)]);
  59582. $self._should_raise_((function(){
  59583. return $core.withContext(function($ctx2) {
  59584. return (1)._to_by_((4),(0));
  59585. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59586. }),$globals.Error);
  59587. return self;
  59588. }, function($ctx1) {$ctx1.fill(self,"testToBy",{},$globals.NumberTest)});
  59589. },
  59590. args: [],
  59591. 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",
  59592. referencedClasses: ["Error"],
  59593. messageSends: ["assert:equals:", "to:by:", "should:raise:"]
  59594. }),
  59595. $globals.NumberTest);
  59596. $core.addMethod(
  59597. $core.method({
  59598. selector: "testTrigonometry",
  59599. protocol: "tests",
  59600. fn: function (){
  59601. var self=this,$self=this;
  59602. return $core.withContext(function($ctx1) {
  59603. var $1;
  59604. $self._assert_equals_((0)._cos(),(1));
  59605. $ctx1.sendIdx["assert:equals:"]=1;
  59606. $self._assert_equals_((0)._sin(),(0));
  59607. $ctx1.sendIdx["assert:equals:"]=2;
  59608. $self._assert_equals_((0)._tan(),(0));
  59609. $ctx1.sendIdx["assert:equals:"]=3;
  59610. $self._assert_equals_((1)._arcCos(),(0));
  59611. $ctx1.sendIdx["assert:equals:"]=4;
  59612. $self._assert_equals_((0)._arcSin(),(0));
  59613. $ctx1.sendIdx["assert:equals:"]=5;
  59614. $self._assert_equals_((0)._arcTan(),(0));
  59615. $ctx1.sendIdx["assert:equals:"]=6;
  59616. $1=(0)._arcTan_((1));
  59617. $ctx1.sendIdx["arcTan:"]=1;
  59618. $self._assert_equals_($1,(0));
  59619. $ctx1.sendIdx["assert:equals:"]=7;
  59620. $self._assert_equals_((1)._arcTan_((0)),$recv($recv($globals.Number)._pi()).__slash((2)));
  59621. return self;
  59622. }, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},$globals.NumberTest)});
  59623. },
  59624. args: [],
  59625. 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)",
  59626. referencedClasses: ["Number"],
  59627. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan", "arcTan:", "/", "pi"]
  59628. }),
  59629. $globals.NumberTest);
  59630. $core.addMethod(
  59631. $core.method({
  59632. selector: "testTruncated",
  59633. protocol: "tests",
  59634. fn: function (){
  59635. var self=this,$self=this;
  59636. return $core.withContext(function($ctx1) {
  59637. var $1,$2;
  59638. $1=(3)._truncated();
  59639. $ctx1.sendIdx["truncated"]=1;
  59640. $self._assert_equals_($1,(3));
  59641. $ctx1.sendIdx["assert:equals:"]=1;
  59642. $2=(3.212)._truncated();
  59643. $ctx1.sendIdx["truncated"]=2;
  59644. $self._assert_equals_($2,(3));
  59645. $ctx1.sendIdx["assert:equals:"]=2;
  59646. $self._assert_equals_((3.51)._truncated(),(3));
  59647. return self;
  59648. }, function($ctx1) {$ctx1.fill(self,"testTruncated",{},$globals.NumberTest)});
  59649. },
  59650. args: [],
  59651. 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",
  59652. referencedClasses: [],
  59653. messageSends: ["assert:equals:", "truncated"]
  59654. }),
  59655. $globals.NumberTest);
  59656. $core.addClass("ObjectMock", $globals.Object, ["foo", "bar"], "Kernel-Tests");
  59657. $globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  59658. $core.addMethod(
  59659. $core.method({
  59660. selector: "foo",
  59661. protocol: "not yet classified",
  59662. fn: function (){
  59663. var self=this,$self=this;
  59664. return $self["@foo"];
  59665. },
  59666. args: [],
  59667. source: "foo\x0a\x09^ foo",
  59668. referencedClasses: [],
  59669. messageSends: []
  59670. }),
  59671. $globals.ObjectMock);
  59672. $core.addMethod(
  59673. $core.method({
  59674. selector: "foo:",
  59675. protocol: "not yet classified",
  59676. fn: function (anObject){
  59677. var self=this,$self=this;
  59678. $self["@foo"]=anObject;
  59679. return self;
  59680. },
  59681. args: ["anObject"],
  59682. source: "foo: anObject\x0a\x09foo := anObject",
  59683. referencedClasses: [],
  59684. messageSends: []
  59685. }),
  59686. $globals.ObjectMock);
  59687. $core.addClass("ObjectTest", $globals.TestCase, [], "Kernel-Tests");
  59688. $core.addMethod(
  59689. $core.method({
  59690. selector: "notDefined",
  59691. protocol: "tests",
  59692. fn: function (){
  59693. var self=this,$self=this;
  59694. return $core.withContext(function($ctx1) {
  59695. return void 0;;
  59696. return self;
  59697. }, function($ctx1) {$ctx1.fill(self,"notDefined",{},$globals.ObjectTest)});
  59698. },
  59699. args: [],
  59700. source: "notDefined\x0a\x09<inlineJS: 'return void 0;'>",
  59701. referencedClasses: [],
  59702. messageSends: []
  59703. }),
  59704. $globals.ObjectTest);
  59705. $core.addMethod(
  59706. $core.method({
  59707. selector: "testBasicAccess",
  59708. protocol: "tests",
  59709. fn: function (){
  59710. var self=this,$self=this;
  59711. var o;
  59712. return $core.withContext(function($ctx1) {
  59713. var $1;
  59714. o=$recv($globals.Object)._new();
  59715. $recv(o)._basicAt_put_("a",(1));
  59716. $1=$recv(o)._basicAt_("a");
  59717. $ctx1.sendIdx["basicAt:"]=1;
  59718. $self._assert_equals_($1,(1));
  59719. $ctx1.sendIdx["assert:equals:"]=1;
  59720. $self._assert_equals_($recv(o)._basicAt_("b"),nil);
  59721. return self;
  59722. }, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},$globals.ObjectTest)});
  59723. },
  59724. args: [],
  59725. 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",
  59726. referencedClasses: ["Object"],
  59727. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"]
  59728. }),
  59729. $globals.ObjectTest);
  59730. $core.addMethod(
  59731. $core.method({
  59732. selector: "testBasicPerform",
  59733. protocol: "tests",
  59734. fn: function (){
  59735. var self=this,$self=this;
  59736. var o;
  59737. return $core.withContext(function($ctx1) {
  59738. o=$recv($globals.Object)._new();
  59739. $recv(o)._basicAt_put_("func",(function(){
  59740. return "hello";
  59741. }));
  59742. $ctx1.sendIdx["basicAt:put:"]=1;
  59743. $recv(o)._basicAt_put_("func2",(function(a){
  59744. return $core.withContext(function($ctx2) {
  59745. return $recv(a).__plus((1));
  59746. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  59747. }));
  59748. $self._assert_equals_($recv(o)._basicPerform_("func"),"hello");
  59749. $ctx1.sendIdx["assert:equals:"]=1;
  59750. $self._assert_equals_($recv(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  59751. return self;
  59752. }, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},$globals.ObjectTest)});
  59753. },
  59754. args: [],
  59755. 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",
  59756. referencedClasses: ["Object"],
  59757. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"]
  59758. }),
  59759. $globals.ObjectTest);
  59760. $core.addMethod(
  59761. $core.method({
  59762. selector: "testDNU",
  59763. protocol: "tests",
  59764. fn: function (){
  59765. var self=this,$self=this;
  59766. return $core.withContext(function($ctx1) {
  59767. $self._should_raise_((function(){
  59768. return $core.withContext(function($ctx2) {
  59769. return $recv($recv($globals.Object)._new())._foo();
  59770. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59771. }),$globals.MessageNotUnderstood);
  59772. return self;
  59773. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.ObjectTest)});
  59774. },
  59775. args: [],
  59776. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  59777. referencedClasses: ["Object", "MessageNotUnderstood"],
  59778. messageSends: ["should:raise:", "foo", "new"]
  59779. }),
  59780. $globals.ObjectTest);
  59781. $core.addMethod(
  59782. $core.method({
  59783. selector: "testEquality",
  59784. protocol: "tests",
  59785. fn: function (){
  59786. var self=this,$self=this;
  59787. var o;
  59788. return $core.withContext(function($ctx1) {
  59789. var $1,$2,$4,$3;
  59790. o=$recv($globals.Object)._new();
  59791. $ctx1.sendIdx["new"]=1;
  59792. $1=$recv(o).__eq($recv($globals.Object)._new());
  59793. $ctx1.sendIdx["="]=1;
  59794. $self._deny_($1);
  59795. $2=$recv(o).__eq(o);
  59796. $ctx1.sendIdx["="]=2;
  59797. $self._assert_($2);
  59798. $ctx1.sendIdx["assert:"]=1;
  59799. $4=$recv(o)._yourself();
  59800. $ctx1.sendIdx["yourself"]=1;
  59801. $3=$recv($4).__eq(o);
  59802. $ctx1.sendIdx["="]=3;
  59803. $self._assert_($3);
  59804. $ctx1.sendIdx["assert:"]=2;
  59805. $self._assert_($recv(o).__eq($recv(o)._yourself()));
  59806. return self;
  59807. }, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},$globals.ObjectTest)});
  59808. },
  59809. args: [],
  59810. 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)",
  59811. referencedClasses: ["Object"],
  59812. messageSends: ["new", "deny:", "=", "assert:", "yourself"]
  59813. }),
  59814. $globals.ObjectTest);
  59815. $core.addMethod(
  59816. $core.method({
  59817. selector: "testHalt",
  59818. protocol: "tests",
  59819. fn: function (){
  59820. var self=this,$self=this;
  59821. return $core.withContext(function($ctx1) {
  59822. $self._should_raise_((function(){
  59823. return $core.withContext(function($ctx2) {
  59824. return $recv($recv($globals.Object)._new())._halt();
  59825. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59826. }),$globals.Error);
  59827. return self;
  59828. }, function($ctx1) {$ctx1.fill(self,"testHalt",{},$globals.ObjectTest)});
  59829. },
  59830. args: [],
  59831. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  59832. referencedClasses: ["Object", "Error"],
  59833. messageSends: ["should:raise:", "halt", "new"]
  59834. }),
  59835. $globals.ObjectTest);
  59836. $core.addMethod(
  59837. $core.method({
  59838. selector: "testIdentity",
  59839. protocol: "tests",
  59840. fn: function (){
  59841. var self=this,$self=this;
  59842. var o;
  59843. return $core.withContext(function($ctx1) {
  59844. var $1,$2,$4,$3;
  59845. o=$recv($globals.Object)._new();
  59846. $ctx1.sendIdx["new"]=1;
  59847. $1=$recv(o).__eq_eq($recv($globals.Object)._new());
  59848. $ctx1.sendIdx["=="]=1;
  59849. $self._deny_($1);
  59850. $2=$recv(o).__eq_eq(o);
  59851. $ctx1.sendIdx["=="]=2;
  59852. $self._assert_($2);
  59853. $ctx1.sendIdx["assert:"]=1;
  59854. $4=$recv(o)._yourself();
  59855. $ctx1.sendIdx["yourself"]=1;
  59856. $3=$recv($4).__eq_eq(o);
  59857. $ctx1.sendIdx["=="]=3;
  59858. $self._assert_($3);
  59859. $ctx1.sendIdx["assert:"]=2;
  59860. $self._assert_($recv(o).__eq_eq($recv(o)._yourself()));
  59861. return self;
  59862. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},$globals.ObjectTest)});
  59863. },
  59864. args: [],
  59865. 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",
  59866. referencedClasses: ["Object"],
  59867. messageSends: ["new", "deny:", "==", "assert:", "yourself"]
  59868. }),
  59869. $globals.ObjectTest);
  59870. $core.addMethod(
  59871. $core.method({
  59872. selector: "testIfNil",
  59873. protocol: "tests",
  59874. fn: function (){
  59875. var self=this,$self=this;
  59876. return $core.withContext(function($ctx1) {
  59877. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10,$receiver;
  59878. $2=$recv($globals.Object)._new();
  59879. $ctx1.sendIdx["new"]=1;
  59880. $1=$recv($2)._isNil();
  59881. $self._deny_($1);
  59882. $ctx1.sendIdx["deny:"]=1;
  59883. $5=$recv($globals.Object)._new();
  59884. $ctx1.sendIdx["new"]=2;
  59885. if(($receiver = $5) == null || $receiver.a$nil){
  59886. $4=true;
  59887. } else {
  59888. $4=$5;
  59889. }
  59890. $3=$recv($4).__eq(true);
  59891. $self._deny_($3);
  59892. $7=$recv($globals.Object)._new();
  59893. $ctx1.sendIdx["new"]=3;
  59894. if(($receiver = $7) == null || $receiver.a$nil){
  59895. $6=$7;
  59896. } else {
  59897. $6=true;
  59898. }
  59899. $self._assert_equals_($6,true);
  59900. $ctx1.sendIdx["assert:equals:"]=1;
  59901. $9=$recv($globals.Object)._new();
  59902. $ctx1.sendIdx["new"]=4;
  59903. if(($receiver = $9) == null || $receiver.a$nil){
  59904. $8=false;
  59905. } else {
  59906. $8=true;
  59907. }
  59908. $self._assert_equals_($8,true);
  59909. $ctx1.sendIdx["assert:equals:"]=2;
  59910. $11=$recv($globals.Object)._new();
  59911. if(($receiver = $11) == null || $receiver.a$nil){
  59912. $10=false;
  59913. } else {
  59914. $10=true;
  59915. }
  59916. $self._assert_equals_($10,true);
  59917. return self;
  59918. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.ObjectTest)});
  59919. },
  59920. args: [],
  59921. 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",
  59922. referencedClasses: ["Object"],
  59923. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  59924. }),
  59925. $globals.ObjectTest);
  59926. $core.addMethod(
  59927. $core.method({
  59928. selector: "testInstVars",
  59929. protocol: "tests",
  59930. fn: function (){
  59931. var self=this,$self=this;
  59932. var o;
  59933. return $core.withContext(function($ctx1) {
  59934. var $1,$2;
  59935. o=$recv($globals.ObjectMock)._new();
  59936. $1=$recv(o)._instVarAt_("foo");
  59937. $ctx1.sendIdx["instVarAt:"]=1;
  59938. $self._assert_equals_($1,nil);
  59939. $ctx1.sendIdx["assert:equals:"]=1;
  59940. $recv(o)._instVarAt_put_("foo",(1));
  59941. $2=$recv(o)._instVarAt_("foo");
  59942. $ctx1.sendIdx["instVarAt:"]=2;
  59943. $self._assert_equals_($2,(1));
  59944. $ctx1.sendIdx["assert:equals:"]=2;
  59945. $self._assert_equals_($recv(o)._instVarAt_("foo"),(1));
  59946. return self;
  59947. }, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},$globals.ObjectTest)});
  59948. },
  59949. args: [],
  59950. 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",
  59951. referencedClasses: ["ObjectMock"],
  59952. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"]
  59953. }),
  59954. $globals.ObjectTest);
  59955. $core.addMethod(
  59956. $core.method({
  59957. selector: "testNilUndefined",
  59958. protocol: "tests",
  59959. fn: function (){
  59960. var self=this,$self=this;
  59961. return $core.withContext(function($ctx1) {
  59962. $self._assert_equals_($self._notDefined(),nil);
  59963. return self;
  59964. }, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},$globals.ObjectTest)});
  59965. },
  59966. args: [],
  59967. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  59968. referencedClasses: [],
  59969. messageSends: ["assert:equals:", "notDefined"]
  59970. }),
  59971. $globals.ObjectTest);
  59972. $core.addMethod(
  59973. $core.method({
  59974. selector: "testYourself",
  59975. protocol: "tests",
  59976. fn: function (){
  59977. var self=this,$self=this;
  59978. var o;
  59979. return $core.withContext(function($ctx1) {
  59980. o=$recv($globals.ObjectMock)._new();
  59981. $self._assert_($recv($recv(o)._yourself()).__eq_eq(o));
  59982. return self;
  59983. }, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},$globals.ObjectTest)});
  59984. },
  59985. args: [],
  59986. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  59987. referencedClasses: ["ObjectMock"],
  59988. messageSends: ["new", "assert:", "==", "yourself"]
  59989. }),
  59990. $globals.ObjectTest);
  59991. $core.addClass("PointTest", $globals.TestCase, [], "Kernel-Tests");
  59992. $core.addMethod(
  59993. $core.method({
  59994. selector: "testAccessing",
  59995. protocol: "tests",
  59996. fn: function (){
  59997. var self=this,$self=this;
  59998. return $core.withContext(function($ctx1) {
  59999. var $2,$1,$3,$6,$5,$4;
  60000. $2=$recv($globals.Point)._x_y_((3),(4));
  60001. $ctx1.sendIdx["x:y:"]=1;
  60002. $1=$recv($2)._x();
  60003. $ctx1.sendIdx["x"]=1;
  60004. $self._assert_equals_($1,(3));
  60005. $ctx1.sendIdx["assert:equals:"]=1;
  60006. $3=$recv($recv($globals.Point)._x_y_((3),(4)))._y();
  60007. $ctx1.sendIdx["y"]=1;
  60008. $self._assert_equals_($3,(4));
  60009. $ctx1.sendIdx["assert:equals:"]=2;
  60010. $6=$recv($globals.Point)._new();
  60011. $ctx1.sendIdx["new"]=1;
  60012. $5=$recv($6)._x_((3));
  60013. $4=$recv($5)._x();
  60014. $self._assert_equals_($4,(3));
  60015. $ctx1.sendIdx["assert:equals:"]=3;
  60016. $self._assert_equals_($recv($recv($recv($globals.Point)._new())._y_((4)))._y(),(4));
  60017. return self;
  60018. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{},$globals.PointTest)});
  60019. },
  60020. args: [],
  60021. 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",
  60022. referencedClasses: ["Point"],
  60023. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"]
  60024. }),
  60025. $globals.PointTest);
  60026. $core.addMethod(
  60027. $core.method({
  60028. selector: "testAngle",
  60029. protocol: "tests",
  60030. fn: function (){
  60031. var self=this,$self=this;
  60032. return $core.withContext(function($ctx1) {
  60033. $self._assert_equals_($recv((-1).__at((0)))._angle(),$recv($globals.Number)._pi());
  60034. return self;
  60035. }, function($ctx1) {$ctx1.fill(self,"testAngle",{},$globals.PointTest)});
  60036. },
  60037. args: [],
  60038. source: "testAngle\x0a\x09self assert: (-1@0) angle equals: Number pi",
  60039. referencedClasses: ["Number"],
  60040. messageSends: ["assert:equals:", "angle", "@", "pi"]
  60041. }),
  60042. $globals.PointTest);
  60043. $core.addMethod(
  60044. $core.method({
  60045. selector: "testArithmetic",
  60046. protocol: "tests",
  60047. fn: function (){
  60048. var self=this,$self=this;
  60049. return $core.withContext(function($ctx1) {
  60050. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  60051. $2=(3).__at((4));
  60052. $ctx1.sendIdx["@"]=1;
  60053. $3=(3).__at((4));
  60054. $ctx1.sendIdx["@"]=2;
  60055. $1=$recv($2).__star($3);
  60056. $4=$recv($globals.Point)._x_y_((9),(16));
  60057. $ctx1.sendIdx["x:y:"]=1;
  60058. $self._assert_equals_($1,$4);
  60059. $ctx1.sendIdx["assert:equals:"]=1;
  60060. $6=(3).__at((4));
  60061. $ctx1.sendIdx["@"]=3;
  60062. $7=(3).__at((4));
  60063. $ctx1.sendIdx["@"]=4;
  60064. $5=$recv($6).__plus($7);
  60065. $8=$recv($globals.Point)._x_y_((6),(8));
  60066. $ctx1.sendIdx["x:y:"]=2;
  60067. $self._assert_equals_($5,$8);
  60068. $ctx1.sendIdx["assert:equals:"]=2;
  60069. $10=(3).__at((4));
  60070. $ctx1.sendIdx["@"]=5;
  60071. $11=(3).__at((4));
  60072. $ctx1.sendIdx["@"]=6;
  60073. $9=$recv($10).__minus($11);
  60074. $12=$recv($globals.Point)._x_y_((0),(0));
  60075. $ctx1.sendIdx["x:y:"]=3;
  60076. $self._assert_equals_($9,$12);
  60077. $ctx1.sendIdx["assert:equals:"]=3;
  60078. $14=(6).__at((8));
  60079. $ctx1.sendIdx["@"]=7;
  60080. $13=$recv($14).__slash((3).__at((4)));
  60081. $self._assert_equals_($13,$recv($globals.Point)._x_y_((2),(2)));
  60082. return self;
  60083. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.PointTest)});
  60084. },
  60085. args: [],
  60086. 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)",
  60087. referencedClasses: ["Point"],
  60088. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"]
  60089. }),
  60090. $globals.PointTest);
  60091. $core.addMethod(
  60092. $core.method({
  60093. selector: "testAt",
  60094. protocol: "tests",
  60095. fn: function (){
  60096. var self=this,$self=this;
  60097. return $core.withContext(function($ctx1) {
  60098. $self._assert_equals_((3).__at((4)),$recv($globals.Point)._x_y_((3),(4)));
  60099. return self;
  60100. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.PointTest)});
  60101. },
  60102. args: [],
  60103. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  60104. referencedClasses: ["Point"],
  60105. messageSends: ["assert:equals:", "@", "x:y:"]
  60106. }),
  60107. $globals.PointTest);
  60108. $core.addMethod(
  60109. $core.method({
  60110. selector: "testComparison",
  60111. protocol: "tests",
  60112. fn: function (){
  60113. var self=this,$self=this;
  60114. return $core.withContext(function($ctx1) {
  60115. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$18,$16,$20,$21,$19,$23,$22;
  60116. $2=(3).__at((4));
  60117. $ctx1.sendIdx["@"]=1;
  60118. $3=(4).__at((5));
  60119. $ctx1.sendIdx["@"]=2;
  60120. $1=$recv($2).__lt($3);
  60121. $ctx1.sendIdx["<"]=1;
  60122. $self._assert_($1);
  60123. $ctx1.sendIdx["assert:"]=1;
  60124. $5=(3).__at((4));
  60125. $ctx1.sendIdx["@"]=3;
  60126. $6=(4).__at((4));
  60127. $ctx1.sendIdx["@"]=4;
  60128. $4=$recv($5).__lt($6);
  60129. $self._deny_($4);
  60130. $ctx1.sendIdx["deny:"]=1;
  60131. $8=(4).__at((5));
  60132. $ctx1.sendIdx["@"]=5;
  60133. $9=(4).__at((5));
  60134. $ctx1.sendIdx["@"]=6;
  60135. $7=$recv($8).__lt_eq($9);
  60136. $ctx1.sendIdx["<="]=1;
  60137. $self._assert_($7);
  60138. $ctx1.sendIdx["assert:"]=2;
  60139. $11=(4).__at((5));
  60140. $ctx1.sendIdx["@"]=7;
  60141. $12=(3).__at((5));
  60142. $ctx1.sendIdx["@"]=8;
  60143. $10=$recv($11).__lt_eq($12);
  60144. $self._deny_($10);
  60145. $ctx1.sendIdx["deny:"]=2;
  60146. $14=(5).__at((6));
  60147. $ctx1.sendIdx["@"]=9;
  60148. $15=(4).__at((5));
  60149. $ctx1.sendIdx["@"]=10;
  60150. $13=$recv($14).__gt($15);
  60151. $ctx1.sendIdx[">"]=1;
  60152. $self._assert_($13);
  60153. $ctx1.sendIdx["assert:"]=3;
  60154. $17=(5).__at((6));
  60155. $ctx1.sendIdx["@"]=11;
  60156. $18=(6).__at((6));
  60157. $ctx1.sendIdx["@"]=12;
  60158. $16=$recv($17).__gt($18);
  60159. $self._deny_($16);
  60160. $ctx1.sendIdx["deny:"]=3;
  60161. $20=(4).__at((5));
  60162. $ctx1.sendIdx["@"]=13;
  60163. $21=(4).__at((5));
  60164. $ctx1.sendIdx["@"]=14;
  60165. $19=$recv($20).__gt_eq($21);
  60166. $ctx1.sendIdx[">="]=1;
  60167. $self._assert_($19);
  60168. $23=(4).__at((5));
  60169. $ctx1.sendIdx["@"]=15;
  60170. $22=$recv($23).__gt_eq((5).__at((5)));
  60171. $self._deny_($22);
  60172. return self;
  60173. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.PointTest)});
  60174. },
  60175. args: [],
  60176. 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)",
  60177. referencedClasses: [],
  60178. messageSends: ["assert:", "<", "@", "deny:", "<=", ">", ">="]
  60179. }),
  60180. $globals.PointTest);
  60181. $core.addMethod(
  60182. $core.method({
  60183. selector: "testDotProduct",
  60184. protocol: "tests",
  60185. fn: function (){
  60186. var self=this,$self=this;
  60187. return $core.withContext(function($ctx1) {
  60188. var $2,$1;
  60189. $2=(2).__at((3));
  60190. $ctx1.sendIdx["@"]=1;
  60191. $1=$recv($2)._dotProduct_((3).__at((7)));
  60192. $self._assert_equals_($1,(27));
  60193. return self;
  60194. }, function($ctx1) {$ctx1.fill(self,"testDotProduct",{},$globals.PointTest)});
  60195. },
  60196. args: [],
  60197. source: "testDotProduct\x0a\x09self assert: (2@3 dotProduct: 3@7) equals: 27",
  60198. referencedClasses: [],
  60199. messageSends: ["assert:equals:", "dotProduct:", "@"]
  60200. }),
  60201. $globals.PointTest);
  60202. $core.addMethod(
  60203. $core.method({
  60204. selector: "testEgality",
  60205. protocol: "tests",
  60206. fn: function (){
  60207. var self=this,$self=this;
  60208. return $core.withContext(function($ctx1) {
  60209. var $2,$3,$1,$5,$4;
  60210. $2=(3).__at((4));
  60211. $ctx1.sendIdx["@"]=1;
  60212. $3=(3).__at((4));
  60213. $ctx1.sendIdx["@"]=2;
  60214. $1=$recv($2).__eq($3);
  60215. $ctx1.sendIdx["="]=1;
  60216. $self._assert_($1);
  60217. $5=(3).__at((5));
  60218. $ctx1.sendIdx["@"]=3;
  60219. $4=$recv($5).__eq((3).__at((6)));
  60220. $self._deny_($4);
  60221. return self;
  60222. }, function($ctx1) {$ctx1.fill(self,"testEgality",{},$globals.PointTest)});
  60223. },
  60224. args: [],
  60225. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  60226. referencedClasses: [],
  60227. messageSends: ["assert:", "=", "@", "deny:"]
  60228. }),
  60229. $globals.PointTest);
  60230. $core.addMethod(
  60231. $core.method({
  60232. selector: "testNew",
  60233. protocol: "tests",
  60234. fn: function (){
  60235. var self=this,$self=this;
  60236. return $core.withContext(function($ctx1) {
  60237. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  60238. $3=$recv($globals.Point)._new();
  60239. $ctx1.sendIdx["new"]=1;
  60240. $2=$recv($3)._x_((3));
  60241. $ctx1.sendIdx["x:"]=1;
  60242. $1=$recv($2)._y();
  60243. $ctx1.sendIdx["y"]=1;
  60244. $self._assert_equals_($1,nil);
  60245. $ctx1.sendIdx["assert:equals:"]=1;
  60246. $7=$recv($globals.Point)._new();
  60247. $ctx1.sendIdx["new"]=2;
  60248. $6=$recv($7)._x_((3));
  60249. $5=$recv($6)._x();
  60250. $ctx1.sendIdx["x"]=1;
  60251. $4=$recv($5).__eq((0));
  60252. $ctx1.sendIdx["="]=1;
  60253. $self._deny_($4);
  60254. $ctx1.sendIdx["deny:"]=1;
  60255. $10=$recv($globals.Point)._new();
  60256. $ctx1.sendIdx["new"]=3;
  60257. $9=$recv($10)._y_((4));
  60258. $ctx1.sendIdx["y:"]=1;
  60259. $8=$recv($9)._x();
  60260. $self._assert_equals_($8,nil);
  60261. $self._deny_($recv($recv($recv($recv($globals.Point)._new())._y_((4)))._y()).__eq((0)));
  60262. return self;
  60263. }, function($ctx1) {$ctx1.fill(self,"testNew",{},$globals.PointTest)});
  60264. },
  60265. args: [],
  60266. 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",
  60267. referencedClasses: ["Point"],
  60268. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"]
  60269. }),
  60270. $globals.PointTest);
  60271. $core.addMethod(
  60272. $core.method({
  60273. selector: "testNormal",
  60274. protocol: "tests",
  60275. fn: function (){
  60276. var self=this,$self=this;
  60277. return $core.withContext(function($ctx1) {
  60278. var $2,$1;
  60279. $2=(1).__at((0));
  60280. $ctx1.sendIdx["@"]=1;
  60281. $1=$recv($2)._normal();
  60282. $self._assert_equals_($1,(0).__at((1)));
  60283. return self;
  60284. }, function($ctx1) {$ctx1.fill(self,"testNormal",{},$globals.PointTest)});
  60285. },
  60286. args: [],
  60287. source: "testNormal\x0a\x09self assert: (1@0) normal equals: 0@1",
  60288. referencedClasses: [],
  60289. messageSends: ["assert:equals:", "normal", "@"]
  60290. }),
  60291. $globals.PointTest);
  60292. $core.addMethod(
  60293. $core.method({
  60294. selector: "testNormalized",
  60295. protocol: "tests",
  60296. fn: function (){
  60297. var self=this,$self=this;
  60298. return $core.withContext(function($ctx1) {
  60299. var $2,$1,$3,$5,$4;
  60300. $2=(0).__at((2));
  60301. $ctx1.sendIdx["@"]=1;
  60302. $1=$recv($2)._normalized();
  60303. $ctx1.sendIdx["normalized"]=1;
  60304. $3=(0).__at((1));
  60305. $ctx1.sendIdx["@"]=2;
  60306. $self._assert_equals_($1,$3);
  60307. $ctx1.sendIdx["assert:equals:"]=1;
  60308. $5=(0).__at((0));
  60309. $ctx1.sendIdx["@"]=3;
  60310. $4=$recv($5)._normalized();
  60311. $self._assert_equals_($4,(0).__at((0)));
  60312. return self;
  60313. }, function($ctx1) {$ctx1.fill(self,"testNormalized",{},$globals.PointTest)});
  60314. },
  60315. args: [],
  60316. source: "testNormalized\x0a\x09self assert: (0@2) normalized equals: 0@1.\x0a\x09self assert: (0@0) normalized equals: 0@0.",
  60317. referencedClasses: [],
  60318. messageSends: ["assert:equals:", "normalized", "@"]
  60319. }),
  60320. $globals.PointTest);
  60321. $core.addMethod(
  60322. $core.method({
  60323. selector: "testPolarCoordinates",
  60324. protocol: "tests",
  60325. fn: function (){
  60326. var self=this,$self=this;
  60327. return $core.withContext(function($ctx1) {
  60328. var $2,$1;
  60329. $2=(1).__at((0));
  60330. $ctx1.sendIdx["@"]=1;
  60331. $1=$recv($2)._r();
  60332. $ctx1.sendIdx["r"]=1;
  60333. $self._assert_equals_($1,(1));
  60334. $ctx1.sendIdx["assert:equals:"]=1;
  60335. $self._assert_equals_($recv((0).__at((0)))._r(),(0));
  60336. return self;
  60337. }, function($ctx1) {$ctx1.fill(self,"testPolarCoordinates",{},$globals.PointTest)});
  60338. },
  60339. args: [],
  60340. source: "testPolarCoordinates\x0a\x09self assert: (1@0) r equals: 1.\x0a\x09self assert: (0@0) r equals: 0.",
  60341. referencedClasses: [],
  60342. messageSends: ["assert:equals:", "r", "@"]
  60343. }),
  60344. $globals.PointTest);
  60345. $core.addMethod(
  60346. $core.method({
  60347. selector: "testRectangleCreation",
  60348. protocol: "tests",
  60349. fn: function (){
  60350. var self=this,$self=this;
  60351. return $core.withContext(function($ctx1) {
  60352. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$16;
  60353. $2=(1).__at((1));
  60354. $ctx1.sendIdx["@"]=1;
  60355. $3=(2).__at((2));
  60356. $ctx1.sendIdx["@"]=2;
  60357. $1=$recv($2)._corner_($3);
  60358. $5=(1).__at((1));
  60359. $ctx1.sendIdx["@"]=3;
  60360. $6=(2).__at((2));
  60361. $ctx1.sendIdx["@"]=4;
  60362. $4=$recv($globals.Rectangle)._origin_corner_($5,$6);
  60363. $self._assert_equals_($1,$4);
  60364. $ctx1.sendIdx["assert:equals:"]=1;
  60365. $8=(1).__at((1));
  60366. $ctx1.sendIdx["@"]=5;
  60367. $9=(2).__at((2));
  60368. $ctx1.sendIdx["@"]=6;
  60369. $7=$recv($8)._rectangle_($9);
  60370. $11=(1).__at((1));
  60371. $ctx1.sendIdx["@"]=7;
  60372. $12=(2).__at((2));
  60373. $ctx1.sendIdx["@"]=8;
  60374. $10=$recv($globals.Rectangle)._point_point_($11,$12);
  60375. $self._assert_equals_($7,$10);
  60376. $ctx1.sendIdx["assert:equals:"]=2;
  60377. $14=(1).__at((1));
  60378. $ctx1.sendIdx["@"]=9;
  60379. $15=(2).__at((2));
  60380. $ctx1.sendIdx["@"]=10;
  60381. $13=$recv($14)._extent_($15);
  60382. $17=(1).__at((1));
  60383. $ctx1.sendIdx["@"]=11;
  60384. $16=$recv($globals.Rectangle)._origin_extent_($17,(2).__at((2)));
  60385. $self._assert_equals_($13,$16);
  60386. return self;
  60387. }, function($ctx1) {$ctx1.fill(self,"testRectangleCreation",{},$globals.PointTest)});
  60388. },
  60389. args: [],
  60390. 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)",
  60391. referencedClasses: ["Rectangle"],
  60392. messageSends: ["assert:equals:", "corner:", "@", "origin:corner:", "rectangle:", "point:point:", "extent:", "origin:extent:"]
  60393. }),
  60394. $globals.PointTest);
  60395. $core.addMethod(
  60396. $core.method({
  60397. selector: "testTranslateBy",
  60398. protocol: "tests",
  60399. fn: function (){
  60400. var self=this,$self=this;
  60401. return $core.withContext(function($ctx1) {
  60402. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  60403. $2=(3).__at((3));
  60404. $ctx1.sendIdx["@"]=1;
  60405. $3=(0).__at((1));
  60406. $ctx1.sendIdx["@"]=2;
  60407. $1=$recv($2)._translateBy_($3);
  60408. $ctx1.sendIdx["translateBy:"]=1;
  60409. $4=(3).__at((4));
  60410. $ctx1.sendIdx["@"]=3;
  60411. $self._assert_equals_($1,$4);
  60412. $ctx1.sendIdx["assert:equals:"]=1;
  60413. $6=(3).__at((3));
  60414. $ctx1.sendIdx["@"]=4;
  60415. $8=(1)._negated();
  60416. $ctx1.sendIdx["negated"]=1;
  60417. $7=(0).__at($8);
  60418. $ctx1.sendIdx["@"]=5;
  60419. $5=$recv($6)._translateBy_($7);
  60420. $ctx1.sendIdx["translateBy:"]=2;
  60421. $9=(3).__at((2));
  60422. $ctx1.sendIdx["@"]=6;
  60423. $self._assert_equals_($5,$9);
  60424. $ctx1.sendIdx["assert:equals:"]=2;
  60425. $11=(3).__at((3));
  60426. $ctx1.sendIdx["@"]=7;
  60427. $12=(2).__at((3));
  60428. $ctx1.sendIdx["@"]=8;
  60429. $10=$recv($11)._translateBy_($12);
  60430. $ctx1.sendIdx["translateBy:"]=3;
  60431. $13=(5).__at((6));
  60432. $ctx1.sendIdx["@"]=9;
  60433. $self._assert_equals_($10,$13);
  60434. $ctx1.sendIdx["assert:equals:"]=3;
  60435. $15=(3).__at((3));
  60436. $ctx1.sendIdx["@"]=10;
  60437. $16=$recv((3)._negated()).__at((0));
  60438. $ctx1.sendIdx["@"]=11;
  60439. $14=$recv($15)._translateBy_($16);
  60440. $self._assert_equals_($14,(0).__at((3)));
  60441. return self;
  60442. }, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},$globals.PointTest)});
  60443. },
  60444. args: [],
  60445. 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.",
  60446. referencedClasses: [],
  60447. messageSends: ["assert:equals:", "translateBy:", "@", "negated"]
  60448. }),
  60449. $globals.PointTest);
  60450. $core.addClass("QueueTest", $globals.TestCase, [], "Kernel-Tests");
  60451. $core.addMethod(
  60452. $core.method({
  60453. selector: "testNextIfAbsent",
  60454. protocol: "tests",
  60455. fn: function (){
  60456. var self=this,$self=this;
  60457. var queue;
  60458. return $core.withContext(function($ctx1) {
  60459. var $2,$1;
  60460. queue=$recv($globals.Queue)._new();
  60461. $recv(queue)._nextPut_("index1");
  60462. $2=$recv(queue)._nextIfAbsent_("empty");
  60463. $ctx1.sendIdx["nextIfAbsent:"]=1;
  60464. $1=$recv($2).__eq("index1");
  60465. $ctx1.sendIdx["="]=1;
  60466. $self._assert_($1);
  60467. $self._deny_($recv($recv(queue)._nextIfAbsent_("empty")).__eq("index1"));
  60468. return self;
  60469. }, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},$globals.QueueTest)});
  60470. },
  60471. args: [],
  60472. 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'",
  60473. referencedClasses: ["Queue"],
  60474. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"]
  60475. }),
  60476. $globals.QueueTest);
  60477. $core.addMethod(
  60478. $core.method({
  60479. selector: "testQueueNext",
  60480. protocol: "tests",
  60481. fn: function (){
  60482. var self=this,$self=this;
  60483. var queue;
  60484. return $core.withContext(function($ctx1) {
  60485. var $1,$3,$2,$5,$4;
  60486. queue=$recv($globals.Queue)._new();
  60487. $1=queue;
  60488. $recv($1)._nextPut_("index1");
  60489. $ctx1.sendIdx["nextPut:"]=1;
  60490. $recv($1)._nextPut_("index2");
  60491. $3=$recv(queue)._next();
  60492. $ctx1.sendIdx["next"]=1;
  60493. $2=$recv($3).__eq("index1");
  60494. $ctx1.sendIdx["="]=1;
  60495. $self._assert_($2);
  60496. $5=$recv(queue)._next();
  60497. $ctx1.sendIdx["next"]=2;
  60498. $4=$recv($5).__eq("index");
  60499. $self._deny_($4);
  60500. $self._should_raise_((function(){
  60501. return $core.withContext(function($ctx2) {
  60502. return $recv(queue)._next();
  60503. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60504. }),$globals.Error);
  60505. return self;
  60506. }, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},$globals.QueueTest)});
  60507. },
  60508. args: [],
  60509. 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",
  60510. referencedClasses: ["Queue", "Error"],
  60511. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"]
  60512. }),
  60513. $globals.QueueTest);
  60514. $core.addClass("RandomTest", $globals.TestCase, [], "Kernel-Tests");
  60515. $core.addMethod(
  60516. $core.method({
  60517. selector: "testAtRandomNumber",
  60518. protocol: "tests",
  60519. fn: function (){
  60520. var self=this,$self=this;
  60521. var val;
  60522. return $core.withContext(function($ctx1) {
  60523. (100)._timesRepeat_((function(){
  60524. return $core.withContext(function($ctx2) {
  60525. val=(10)._atRandom();
  60526. $self._assert_($recv(val).__gt((0)));
  60527. $ctx2.sendIdx["assert:"]=1;
  60528. return $self._assert_($recv(val).__lt((11)));
  60529. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60530. }));
  60531. return self;
  60532. }, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},$globals.RandomTest)});
  60533. },
  60534. args: [],
  60535. 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]",
  60536. referencedClasses: [],
  60537. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"]
  60538. }),
  60539. $globals.RandomTest);
  60540. $core.addMethod(
  60541. $core.method({
  60542. selector: "testAtRandomSequenceableCollection",
  60543. protocol: "tests",
  60544. fn: function (){
  60545. var self=this,$self=this;
  60546. var val;
  60547. return $core.withContext(function($ctx1) {
  60548. var $3,$4,$2,$1;
  60549. (100)._timesRepeat_((function(){
  60550. return $core.withContext(function($ctx2) {
  60551. val="abc"._atRandom();
  60552. $3=$recv(val).__eq("a");
  60553. $ctx2.sendIdx["="]=1;
  60554. $4=$recv(val).__eq("b");
  60555. $ctx2.sendIdx["="]=2;
  60556. $2=$recv($3).__or($4);
  60557. $1=$recv($2).__or($recv(val).__eq("c"));
  60558. $ctx2.sendIdx["|"]=1;
  60559. return $self._assert_($1);
  60560. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60561. }));
  60562. return self;
  60563. }, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},$globals.RandomTest)});
  60564. },
  60565. args: [],
  60566. 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].",
  60567. referencedClasses: [],
  60568. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="]
  60569. }),
  60570. $globals.RandomTest);
  60571. $core.addMethod(
  60572. $core.method({
  60573. selector: "textNext",
  60574. protocol: "tests",
  60575. fn: function (){
  60576. var self=this,$self=this;
  60577. return $core.withContext(function($ctx1) {
  60578. var $1;
  60579. (10000)._timesRepeat_((function(){
  60580. var current,next;
  60581. return $core.withContext(function($ctx2) {
  60582. next=$recv($recv($globals.Random)._new())._next();
  60583. $self._assert_($recv(next).__gt_eq((0)));
  60584. $ctx2.sendIdx["assert:"]=1;
  60585. $self._assert_($recv(next).__lt((1)));
  60586. $1=$recv(current).__eq(next);
  60587. $ctx2.sendIdx["="]=1;
  60588. $self._deny_($1);
  60589. return $recv(next).__eq(current);
  60590. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)});
  60591. }));
  60592. return self;
  60593. }, function($ctx1) {$ctx1.fill(self,"textNext",{},$globals.RandomTest)});
  60594. },
  60595. args: [],
  60596. 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 ]",
  60597. referencedClasses: ["Random"],
  60598. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="]
  60599. }),
  60600. $globals.RandomTest);
  60601. $core.addClass("RectangleTest", $globals.TestCase, [], "Kernel-Tests");
  60602. $core.addMethod(
  60603. $core.method({
  60604. selector: "testContainsPoint",
  60605. protocol: "tests",
  60606. fn: function (){
  60607. var self=this,$self=this;
  60608. var rect;
  60609. return $core.withContext(function($ctx1) {
  60610. var $1,$2,$4,$5,$3;
  60611. $1=(0).__at((0));
  60612. $ctx1.sendIdx["@"]=1;
  60613. $2=(4).__at((4));
  60614. $ctx1.sendIdx["@"]=2;
  60615. rect=$recv($globals.Rectangle)._origin_corner_($1,$2);
  60616. $4=rect;
  60617. $5=(1).__at((2));
  60618. $ctx1.sendIdx["@"]=3;
  60619. $3=$recv($4)._containsPoint_($5);
  60620. $ctx1.sendIdx["containsPoint:"]=1;
  60621. $self._assert_($3);
  60622. $ctx1.sendIdx["assert:"]=1;
  60623. $self._assert_($recv($recv(rect)._containsPoint_((5).__at((4))))._not());
  60624. return self;
  60625. }, function($ctx1) {$ctx1.fill(self,"testContainsPoint",{rect:rect},$globals.RectangleTest)});
  60626. },
  60627. args: [],
  60628. 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.",
  60629. referencedClasses: ["Rectangle"],
  60630. messageSends: ["origin:corner:", "@", "assert:", "containsPoint:", "not"]
  60631. }),
  60632. $globals.RectangleTest);
  60633. $core.addMethod(
  60634. $core.method({
  60635. selector: "testContainsRect",
  60636. protocol: "tests",
  60637. fn: function (){
  60638. var self=this,$self=this;
  60639. return $core.withContext(function($ctx1) {
  60640. var $3,$4,$2,$6,$7,$5,$1,$11,$12,$10,$14,$13,$9,$8;
  60641. $3=(0).__at((0));
  60642. $ctx1.sendIdx["@"]=1;
  60643. $4=(6).__at((6));
  60644. $ctx1.sendIdx["@"]=2;
  60645. $2=$recv($globals.Rectangle)._origin_corner_($3,$4);
  60646. $ctx1.sendIdx["origin:corner:"]=1;
  60647. $6=(1).__at((1));
  60648. $ctx1.sendIdx["@"]=3;
  60649. $7=(5).__at((5));
  60650. $ctx1.sendIdx["@"]=4;
  60651. $5=$recv($globals.Rectangle)._origin_corner_($6,$7);
  60652. $ctx1.sendIdx["origin:corner:"]=2;
  60653. $1=$recv($2)._containsRect_($5);
  60654. $ctx1.sendIdx["containsRect:"]=1;
  60655. $self._assert_($1);
  60656. $ctx1.sendIdx["assert:"]=1;
  60657. $11=(0).__at((0));
  60658. $ctx1.sendIdx["@"]=5;
  60659. $12=(6).__at((6));
  60660. $ctx1.sendIdx["@"]=6;
  60661. $10=$recv($globals.Rectangle)._origin_corner_($11,$12);
  60662. $ctx1.sendIdx["origin:corner:"]=3;
  60663. $14=(1).__at((-1));
  60664. $ctx1.sendIdx["@"]=7;
  60665. $13=$recv($globals.Rectangle)._origin_corner_($14,(5).__at((5)));
  60666. $9=$recv($10)._containsRect_($13);
  60667. $8=$recv($9)._not();
  60668. $self._assert_($8);
  60669. return self;
  60670. }, function($ctx1) {$ctx1.fill(self,"testContainsRect",{},$globals.RectangleTest)});
  60671. },
  60672. args: [],
  60673. 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.",
  60674. referencedClasses: ["Rectangle"],
  60675. messageSends: ["assert:", "containsRect:", "origin:corner:", "@", "not"]
  60676. }),
  60677. $globals.RectangleTest);
  60678. $core.addMethod(
  60679. $core.method({
  60680. selector: "testOriginExtent",
  60681. protocol: "tests",
  60682. fn: function (){
  60683. var self=this,$self=this;
  60684. var rectangle;
  60685. return $core.withContext(function($ctx1) {
  60686. var $1,$2,$3,$4;
  60687. $1=(3).__at((4));
  60688. $ctx1.sendIdx["@"]=1;
  60689. $2=(7).__at((8));
  60690. $ctx1.sendIdx["@"]=2;
  60691. rectangle=$recv($globals.Rectangle)._origin_extent_($1,$2);
  60692. $3=$recv(rectangle)._origin();
  60693. $4=(3).__at((4));
  60694. $ctx1.sendIdx["@"]=3;
  60695. $self._assert_equals_($3,$4);
  60696. $ctx1.sendIdx["assert:equals:"]=1;
  60697. $self._assert_equals_($recv(rectangle)._corner(),(10).__at((12)));
  60698. return self;
  60699. }, function($ctx1) {$ctx1.fill(self,"testOriginExtent",{rectangle:rectangle},$globals.RectangleTest)});
  60700. },
  60701. args: [],
  60702. 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.",
  60703. referencedClasses: ["Rectangle"],
  60704. messageSends: ["origin:extent:", "@", "assert:equals:", "origin", "corner"]
  60705. }),
  60706. $globals.RectangleTest);
  60707. $core.addClass("StreamTest", $globals.TestCase, [], "Kernel-Tests");
  60708. $core.addMethod(
  60709. $core.method({
  60710. selector: "collectionClass",
  60711. protocol: "accessing",
  60712. fn: function (){
  60713. var self=this,$self=this;
  60714. return $core.withContext(function($ctx1) {
  60715. return $recv($self._class())._collectionClass();
  60716. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.StreamTest)});
  60717. },
  60718. args: [],
  60719. source: "collectionClass\x0a\x09^ self class collectionClass",
  60720. referencedClasses: [],
  60721. messageSends: ["collectionClass", "class"]
  60722. }),
  60723. $globals.StreamTest);
  60724. $core.addMethod(
  60725. $core.method({
  60726. selector: "newCollection",
  60727. protocol: "accessing",
  60728. fn: function (){
  60729. var self=this,$self=this;
  60730. return $core.withContext(function($ctx1) {
  60731. return $recv($self._collectionClass())._new();
  60732. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.StreamTest)});
  60733. },
  60734. args: [],
  60735. source: "newCollection\x0a\x09^ self collectionClass new",
  60736. referencedClasses: [],
  60737. messageSends: ["new", "collectionClass"]
  60738. }),
  60739. $globals.StreamTest);
  60740. $core.addMethod(
  60741. $core.method({
  60742. selector: "newStream",
  60743. protocol: "accessing",
  60744. fn: function (){
  60745. var self=this,$self=this;
  60746. return $core.withContext(function($ctx1) {
  60747. return $recv($recv($self._collectionClass())._new())._stream();
  60748. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.StreamTest)});
  60749. },
  60750. args: [],
  60751. source: "newStream\x0a\x09^ self collectionClass new stream",
  60752. referencedClasses: [],
  60753. messageSends: ["stream", "new", "collectionClass"]
  60754. }),
  60755. $globals.StreamTest);
  60756. $core.addMethod(
  60757. $core.method({
  60758. selector: "testAtStartAtEnd",
  60759. protocol: "tests",
  60760. fn: function (){
  60761. var self=this,$self=this;
  60762. var stream;
  60763. return $core.withContext(function($ctx1) {
  60764. var $1,$2,$3,$4;
  60765. stream=$self._newStream();
  60766. $1=$recv(stream)._atStart();
  60767. $ctx1.sendIdx["atStart"]=1;
  60768. $self._assert_($1);
  60769. $ctx1.sendIdx["assert:"]=1;
  60770. $2=$recv(stream)._atEnd();
  60771. $ctx1.sendIdx["atEnd"]=1;
  60772. $self._assert_($2);
  60773. $ctx1.sendIdx["assert:"]=2;
  60774. $recv(stream)._nextPutAll_($self._newCollection());
  60775. $3=$recv(stream)._atEnd();
  60776. $ctx1.sendIdx["atEnd"]=2;
  60777. $self._assert_($3);
  60778. $4=$recv(stream)._atStart();
  60779. $ctx1.sendIdx["atStart"]=2;
  60780. $self._deny_($4);
  60781. $ctx1.sendIdx["deny:"]=1;
  60782. $recv(stream)._position_((1));
  60783. $self._deny_($recv(stream)._atEnd());
  60784. $ctx1.sendIdx["deny:"]=2;
  60785. $self._deny_($recv(stream)._atStart());
  60786. return self;
  60787. }, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},$globals.StreamTest)});
  60788. },
  60789. args: [],
  60790. 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",
  60791. referencedClasses: [],
  60792. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"]
  60793. }),
  60794. $globals.StreamTest);
  60795. $core.addMethod(
  60796. $core.method({
  60797. selector: "testContents",
  60798. protocol: "tests",
  60799. fn: function (){
  60800. var self=this,$self=this;
  60801. var stream;
  60802. return $core.withContext(function($ctx1) {
  60803. var $1,$2;
  60804. stream=$self._newStream();
  60805. $1=stream;
  60806. $2=$self._newCollection();
  60807. $ctx1.sendIdx["newCollection"]=1;
  60808. $recv($1)._nextPutAll_($2);
  60809. $self._assert_equals_($recv(stream)._contents(),$self._newCollection());
  60810. return self;
  60811. }, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},$globals.StreamTest)});
  60812. },
  60813. args: [],
  60814. 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",
  60815. referencedClasses: [],
  60816. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"]
  60817. }),
  60818. $globals.StreamTest);
  60819. $core.addMethod(
  60820. $core.method({
  60821. selector: "testIsEmpty",
  60822. protocol: "tests",
  60823. fn: function (){
  60824. var self=this,$self=this;
  60825. var stream;
  60826. return $core.withContext(function($ctx1) {
  60827. var $1;
  60828. stream=$self._newStream();
  60829. $1=$recv(stream)._isEmpty();
  60830. $ctx1.sendIdx["isEmpty"]=1;
  60831. $self._assert_($1);
  60832. $recv(stream)._nextPutAll_($self._newCollection());
  60833. $self._deny_($recv(stream)._isEmpty());
  60834. return self;
  60835. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},$globals.StreamTest)});
  60836. },
  60837. args: [],
  60838. 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",
  60839. referencedClasses: [],
  60840. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"]
  60841. }),
  60842. $globals.StreamTest);
  60843. $core.addMethod(
  60844. $core.method({
  60845. selector: "testPosition",
  60846. protocol: "tests",
  60847. fn: function (){
  60848. var self=this,$self=this;
  60849. var collection,stream;
  60850. return $core.withContext(function($ctx1) {
  60851. var $1,$2,$3;
  60852. collection=$self._newCollection();
  60853. stream=$self._newStream();
  60854. $recv(stream)._nextPutAll_(collection);
  60855. $1=$recv(stream)._position();
  60856. $ctx1.sendIdx["position"]=1;
  60857. $self._assert_equals_($1,$recv(collection)._size());
  60858. $ctx1.sendIdx["assert:equals:"]=1;
  60859. $recv(stream)._position_((0));
  60860. $2=$recv(stream)._position();
  60861. $ctx1.sendIdx["position"]=2;
  60862. $self._assert_equals_($2,(0));
  60863. $ctx1.sendIdx["assert:equals:"]=2;
  60864. $recv(stream)._next();
  60865. $ctx1.sendIdx["next"]=1;
  60866. $3=$recv(stream)._position();
  60867. $ctx1.sendIdx["position"]=3;
  60868. $self._assert_equals_($3,(1));
  60869. $ctx1.sendIdx["assert:equals:"]=3;
  60870. $recv(stream)._next();
  60871. $self._assert_equals_($recv(stream)._position(),(2));
  60872. return self;
  60873. }, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},$globals.StreamTest)});
  60874. },
  60875. args: [],
  60876. 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",
  60877. referencedClasses: [],
  60878. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"]
  60879. }),
  60880. $globals.StreamTest);
  60881. $core.addMethod(
  60882. $core.method({
  60883. selector: "testReading",
  60884. protocol: "tests",
  60885. fn: function (){
  60886. var self=this,$self=this;
  60887. var stream,collection;
  60888. return $core.withContext(function($ctx1) {
  60889. var $1,$2;
  60890. collection=$self._newCollection();
  60891. stream=$self._newStream();
  60892. $1=stream;
  60893. $recv($1)._nextPutAll_(collection);
  60894. $recv($1)._position_((0));
  60895. $recv(collection)._do_((function(each){
  60896. return $core.withContext(function($ctx2) {
  60897. $2=$recv(stream)._next();
  60898. $ctx2.sendIdx["next"]=1;
  60899. return $self._assert_equals_($2,each);
  60900. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60901. }));
  60902. $self._assert_($recv($recv(stream)._next())._isNil());
  60903. return self;
  60904. }, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},$globals.StreamTest)});
  60905. },
  60906. args: [],
  60907. 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",
  60908. referencedClasses: [],
  60909. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"]
  60910. }),
  60911. $globals.StreamTest);
  60912. $core.addMethod(
  60913. $core.method({
  60914. selector: "testStreamContents",
  60915. protocol: "tests",
  60916. fn: function (){
  60917. var self=this,$self=this;
  60918. return self;
  60919. },
  60920. args: [],
  60921. source: "testStreamContents",
  60922. referencedClasses: [],
  60923. messageSends: []
  60924. }),
  60925. $globals.StreamTest);
  60926. $core.addMethod(
  60927. $core.method({
  60928. selector: "testWrite",
  60929. protocol: "tests",
  60930. fn: function (){
  60931. var self=this,$self=this;
  60932. var stream,collection;
  60933. return $core.withContext(function($ctx1) {
  60934. collection=$self._newCollection();
  60935. stream=$self._newStream();
  60936. $recv(collection)._do_((function(each){
  60937. return $core.withContext(function($ctx2) {
  60938. return $recv(stream).__lt_lt(each);
  60939. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60940. }));
  60941. $self._assert_equals_($recv(stream)._contents(),collection);
  60942. return self;
  60943. }, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},$globals.StreamTest)});
  60944. },
  60945. args: [],
  60946. 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",
  60947. referencedClasses: [],
  60948. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"]
  60949. }),
  60950. $globals.StreamTest);
  60951. $core.addMethod(
  60952. $core.method({
  60953. selector: "testWriting",
  60954. protocol: "tests",
  60955. fn: function (){
  60956. var self=this,$self=this;
  60957. var stream,collection;
  60958. return $core.withContext(function($ctx1) {
  60959. var $1;
  60960. collection=$self._newCollection();
  60961. stream=$self._newStream();
  60962. $ctx1.sendIdx["newStream"]=1;
  60963. $recv(collection)._do_((function(each){
  60964. return $core.withContext(function($ctx2) {
  60965. return $recv(stream)._nextPut_(each);
  60966. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60967. }));
  60968. $1=$recv(stream)._contents();
  60969. $ctx1.sendIdx["contents"]=1;
  60970. $self._assert_equals_($1,collection);
  60971. $ctx1.sendIdx["assert:equals:"]=1;
  60972. stream=$self._newStream();
  60973. $recv(stream)._nextPutAll_(collection);
  60974. $self._assert_equals_($recv(stream)._contents(),collection);
  60975. return self;
  60976. }, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},$globals.StreamTest)});
  60977. },
  60978. args: [],
  60979. 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",
  60980. referencedClasses: [],
  60981. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"]
  60982. }),
  60983. $globals.StreamTest);
  60984. $core.addMethod(
  60985. $core.method({
  60986. selector: "collectionClass",
  60987. protocol: "accessing",
  60988. fn: function (){
  60989. var self=this,$self=this;
  60990. return nil;
  60991. },
  60992. args: [],
  60993. source: "collectionClass\x0a\x09^ nil",
  60994. referencedClasses: [],
  60995. messageSends: []
  60996. }),
  60997. $globals.StreamTest.a$cls);
  60998. $core.addMethod(
  60999. $core.method({
  61000. selector: "isAbstract",
  61001. protocol: "testing",
  61002. fn: function (){
  61003. var self=this,$self=this;
  61004. return $core.withContext(function($ctx1) {
  61005. return $recv($self._collectionClass())._isNil();
  61006. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.StreamTest.a$cls)});
  61007. },
  61008. args: [],
  61009. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  61010. referencedClasses: [],
  61011. messageSends: ["isNil", "collectionClass"]
  61012. }),
  61013. $globals.StreamTest.a$cls);
  61014. $core.addClass("ArrayStreamTest", $globals.StreamTest, [], "Kernel-Tests");
  61015. $core.addMethod(
  61016. $core.method({
  61017. selector: "newCollection",
  61018. protocol: "accessing",
  61019. fn: function (){
  61020. var self=this,$self=this;
  61021. return $core.withContext(function($ctx1) {
  61022. return [true,(1),(3).__at((4)),"foo"];
  61023. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.ArrayStreamTest)});
  61024. },
  61025. args: [],
  61026. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  61027. referencedClasses: [],
  61028. messageSends: ["@"]
  61029. }),
  61030. $globals.ArrayStreamTest);
  61031. $core.addMethod(
  61032. $core.method({
  61033. selector: "collectionClass",
  61034. protocol: "accessing",
  61035. fn: function (){
  61036. var self=this,$self=this;
  61037. return $globals.Array;
  61038. },
  61039. args: [],
  61040. source: "collectionClass\x0a\x09^ Array",
  61041. referencedClasses: ["Array"],
  61042. messageSends: []
  61043. }),
  61044. $globals.ArrayStreamTest.a$cls);
  61045. $core.addClass("StringStreamTest", $globals.StreamTest, [], "Kernel-Tests");
  61046. $core.addMethod(
  61047. $core.method({
  61048. selector: "newCollection",
  61049. protocol: "accessing",
  61050. fn: function (){
  61051. var self=this,$self=this;
  61052. return "hello world";
  61053. },
  61054. args: [],
  61055. source: "newCollection\x0a\x09^ 'hello world'",
  61056. referencedClasses: [],
  61057. messageSends: []
  61058. }),
  61059. $globals.StringStreamTest);
  61060. $core.addMethod(
  61061. $core.method({
  61062. selector: "collectionClass",
  61063. protocol: "accessing",
  61064. fn: function (){
  61065. var self=this,$self=this;
  61066. return $globals.String;
  61067. },
  61068. args: [],
  61069. source: "collectionClass\x0a\x09^ String",
  61070. referencedClasses: ["String"],
  61071. messageSends: []
  61072. }),
  61073. $globals.StringStreamTest.a$cls);
  61074. $core.addClass("UndefinedTest", $globals.TestCase, [], "Kernel-Tests");
  61075. $core.addMethod(
  61076. $core.method({
  61077. selector: "testCopying",
  61078. protocol: "tests",
  61079. fn: function (){
  61080. var self=this,$self=this;
  61081. return $core.withContext(function($ctx1) {
  61082. $self._assert_equals_(nil._copy(),nil);
  61083. return self;
  61084. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.UndefinedTest)});
  61085. },
  61086. args: [],
  61087. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  61088. referencedClasses: [],
  61089. messageSends: ["assert:equals:", "copy"]
  61090. }),
  61091. $globals.UndefinedTest);
  61092. $core.addMethod(
  61093. $core.method({
  61094. selector: "testDeepCopy",
  61095. protocol: "tests",
  61096. fn: function (){
  61097. var self=this,$self=this;
  61098. return $core.withContext(function($ctx1) {
  61099. $self._assert_($recv(nil._deepCopy()).__eq(nil));
  61100. return self;
  61101. }, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},$globals.UndefinedTest)});
  61102. },
  61103. args: [],
  61104. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  61105. referencedClasses: [],
  61106. messageSends: ["assert:", "=", "deepCopy"]
  61107. }),
  61108. $globals.UndefinedTest);
  61109. $core.addMethod(
  61110. $core.method({
  61111. selector: "testIfNil",
  61112. protocol: "tests",
  61113. fn: function (){
  61114. var self=this,$self=this;
  61115. return $core.withContext(function($ctx1) {
  61116. var $1,$3,$2,$4,$6,$5,$receiver;
  61117. if(($receiver = nil) == null || $receiver.a$nil){
  61118. $1=true;
  61119. } else {
  61120. $1=nil;
  61121. }
  61122. $self._assert_equals_($1,true);
  61123. $ctx1.sendIdx["assert:equals:"]=1;
  61124. if(($receiver = nil) == null || $receiver.a$nil){
  61125. $3=nil;
  61126. } else {
  61127. $3=true;
  61128. }
  61129. $2=$recv($3).__eq(true);
  61130. $ctx1.sendIdx["="]=1;
  61131. $self._deny_($2);
  61132. $ctx1.sendIdx["deny:"]=1;
  61133. if(($receiver = nil) == null || $receiver.a$nil){
  61134. $4=true;
  61135. } else {
  61136. $4=false;
  61137. }
  61138. $self._assert_equals_($4,true);
  61139. if(($receiver = nil) == null || $receiver.a$nil){
  61140. $6=false;
  61141. } else {
  61142. $6=true;
  61143. }
  61144. $5=$recv($6).__eq(true);
  61145. $self._deny_($5);
  61146. return self;
  61147. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.UndefinedTest)});
  61148. },
  61149. args: [],
  61150. 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",
  61151. referencedClasses: [],
  61152. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  61153. }),
  61154. $globals.UndefinedTest);
  61155. $core.addMethod(
  61156. $core.method({
  61157. selector: "testIsNil",
  61158. protocol: "tests",
  61159. fn: function (){
  61160. var self=this,$self=this;
  61161. return $core.withContext(function($ctx1) {
  61162. $self._assert_(nil._isNil());
  61163. $self._deny_(nil._notNil());
  61164. return self;
  61165. }, function($ctx1) {$ctx1.fill(self,"testIsNil",{},$globals.UndefinedTest)});
  61166. },
  61167. args: [],
  61168. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  61169. referencedClasses: [],
  61170. messageSends: ["assert:", "isNil", "deny:", "notNil"]
  61171. }),
  61172. $globals.UndefinedTest);
  61173. });
  61174. define('amber_core/Platform-DOM-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  61175. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  61176. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  61177. var $pkg = $core.addPackage("Platform-DOM-Tests");
  61178. $pkg.innerEval = function (expr) { return eval(expr); };
  61179. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  61180. $core.addClass("PlatformDomTest", $globals.TestCase, ["fixtureDiv"], "Platform-DOM-Tests");
  61181. $core.addMethod(
  61182. $core.method({
  61183. selector: "testEntityConversion",
  61184. protocol: "testing",
  61185. fn: function (){
  61186. var self=this,$self=this;
  61187. return $core.withContext(function($ctx1) {
  61188. var $1;
  61189. $1=$recv($globals.PlatformDom)._isFeasible();
  61190. if($core.assert($1)){
  61191. $self._assert_equals_("&copy;"._htmlTextContent(),"©");
  61192. }
  61193. return self;
  61194. }, function($ctx1) {$ctx1.fill(self,"testEntityConversion",{},$globals.PlatformDomTest)});
  61195. },
  61196. args: [],
  61197. source: "testEntityConversion\x0a\x09PlatformDom isFeasible ifTrue: [ self assert: '&copy;' htmlTextContent equals: '©' ]",
  61198. referencedClasses: ["PlatformDom"],
  61199. messageSends: ["ifTrue:", "isFeasible", "assert:equals:", "htmlTextContent"]
  61200. }),
  61201. $globals.PlatformDomTest);
  61202. $core.addMethod(
  61203. $core.method({
  61204. selector: "testTextContentDoesNotRunScript",
  61205. protocol: "testing",
  61206. fn: function (){
  61207. var self=this,$self=this;
  61208. return $core.withContext(function($ctx1) {
  61209. var $1;
  61210. $1=$recv($globals.PlatformDom)._isFeasible();
  61211. if($core.assert($1)){
  61212. $self._shouldnt_raise_((function(){
  61213. return $core.withContext(function($ctx2) {
  61214. return "<script>throw new Error(\x22Intentional\x22)</script>"._htmlTextContent();
  61215. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61216. }),$globals.Error);
  61217. }
  61218. return self;
  61219. }, function($ctx1) {$ctx1.fill(self,"testTextContentDoesNotRunScript",{},$globals.PlatformDomTest)});
  61220. },
  61221. args: [],
  61222. source: "testTextContentDoesNotRunScript\x0a\x09PlatformDom isFeasible ifTrue: [\x0a\x09\x09self shouldnt: [ '<script>throw new Error(\x22Intentional\x22)</script>' htmlTextContent ] raise: Error ]",
  61223. referencedClasses: ["PlatformDom", "Error"],
  61224. messageSends: ["ifTrue:", "isFeasible", "shouldnt:raise:", "htmlTextContent"]
  61225. }),
  61226. $globals.PlatformDomTest);
  61227. });
  61228. define('amber_core/SUnit-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  61229. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  61230. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  61231. var $pkg = $core.addPackage("SUnit-Tests");
  61232. $pkg.innerEval = function (expr) { return eval(expr); };
  61233. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  61234. $core.addClass("ExampleSetTest", $globals.TestCase, ["empty", "full"], "SUnit-Tests");
  61235. $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.";
  61236. $core.addMethod(
  61237. $core.method({
  61238. selector: "setUp",
  61239. protocol: "running",
  61240. fn: function (){
  61241. var self=this,$self=this;
  61242. return $core.withContext(function($ctx1) {
  61243. $self["@empty"]=$recv($globals.Set)._new();
  61244. $self["@full"]=$recv($globals.Set)._with_with_((5),"abc");
  61245. return self;
  61246. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ExampleSetTest)});
  61247. },
  61248. args: [],
  61249. source: "setUp\x0a\x09empty := Set new.\x0a\x09full := Set with: 5 with: #abc",
  61250. referencedClasses: ["Set"],
  61251. messageSends: ["new", "with:with:"]
  61252. }),
  61253. $globals.ExampleSetTest);
  61254. $core.addMethod(
  61255. $core.method({
  61256. selector: "testAdd",
  61257. protocol: "tests",
  61258. fn: function (){
  61259. var self=this,$self=this;
  61260. return $core.withContext(function($ctx1) {
  61261. $recv($self["@empty"])._add_((5));
  61262. $self._assert_($recv($self["@empty"])._includes_((5)));
  61263. return self;
  61264. }, function($ctx1) {$ctx1.fill(self,"testAdd",{},$globals.ExampleSetTest)});
  61265. },
  61266. args: [],
  61267. source: "testAdd\x0a\x09empty add: 5.\x0a\x09self assert: (empty includes: 5)",
  61268. referencedClasses: [],
  61269. messageSends: ["add:", "assert:", "includes:"]
  61270. }),
  61271. $globals.ExampleSetTest);
  61272. $core.addMethod(
  61273. $core.method({
  61274. selector: "testGrow",
  61275. protocol: "tests",
  61276. fn: function (){
  61277. var self=this,$self=this;
  61278. return $core.withContext(function($ctx1) {
  61279. $recv($self["@empty"])._addAll_((1)._to_((100)));
  61280. $self._assert_equals_($recv($self["@empty"])._size(),(100));
  61281. return self;
  61282. }, function($ctx1) {$ctx1.fill(self,"testGrow",{},$globals.ExampleSetTest)});
  61283. },
  61284. args: [],
  61285. source: "testGrow\x0a\x09empty addAll: (1 to: 100).\x0a\x09self assert: empty size equals: 100",
  61286. referencedClasses: [],
  61287. messageSends: ["addAll:", "to:", "assert:equals:", "size"]
  61288. }),
  61289. $globals.ExampleSetTest);
  61290. $core.addMethod(
  61291. $core.method({
  61292. selector: "testIllegal",
  61293. protocol: "tests",
  61294. fn: function (){
  61295. var self=this,$self=this;
  61296. return $core.withContext(function($ctx1) {
  61297. $self._should_raise_((function(){
  61298. return $core.withContext(function($ctx2) {
  61299. return $recv($self["@empty"])._at_((5));
  61300. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61301. }),$globals.Error);
  61302. $ctx1.sendIdx["should:raise:"]=1;
  61303. $self._should_raise_((function(){
  61304. return $core.withContext(function($ctx2) {
  61305. return $recv($self["@empty"])._at_put_((5),"abc");
  61306. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61307. }),$globals.Error);
  61308. return self;
  61309. }, function($ctx1) {$ctx1.fill(self,"testIllegal",{},$globals.ExampleSetTest)});
  61310. },
  61311. args: [],
  61312. 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",
  61313. referencedClasses: ["Error"],
  61314. messageSends: ["should:raise:", "at:", "at:put:"]
  61315. }),
  61316. $globals.ExampleSetTest);
  61317. $core.addMethod(
  61318. $core.method({
  61319. selector: "testIncludes",
  61320. protocol: "tests",
  61321. fn: function (){
  61322. var self=this,$self=this;
  61323. return $core.withContext(function($ctx1) {
  61324. var $1;
  61325. $1=$recv($self["@full"])._includes_((5));
  61326. $ctx1.sendIdx["includes:"]=1;
  61327. $self._assert_($1);
  61328. $ctx1.sendIdx["assert:"]=1;
  61329. $self._assert_($recv($self["@full"])._includes_("abc"));
  61330. return self;
  61331. }, function($ctx1) {$ctx1.fill(self,"testIncludes",{},$globals.ExampleSetTest)});
  61332. },
  61333. args: [],
  61334. source: "testIncludes\x0a\x09self assert: (full includes: 5).\x0a\x09self assert: (full includes: #abc)",
  61335. referencedClasses: [],
  61336. messageSends: ["assert:", "includes:"]
  61337. }),
  61338. $globals.ExampleSetTest);
  61339. $core.addMethod(
  61340. $core.method({
  61341. selector: "testOccurrences",
  61342. protocol: "tests",
  61343. fn: function (){
  61344. var self=this,$self=this;
  61345. return $core.withContext(function($ctx1) {
  61346. var $1,$2;
  61347. $1=$recv($self["@empty"])._occurrencesOf_((0));
  61348. $ctx1.sendIdx["occurrencesOf:"]=1;
  61349. $self._assert_equals_($1,(0));
  61350. $ctx1.sendIdx["assert:equals:"]=1;
  61351. $2=$recv($self["@full"])._occurrencesOf_((5));
  61352. $ctx1.sendIdx["occurrencesOf:"]=2;
  61353. $self._assert_equals_($2,(1));
  61354. $ctx1.sendIdx["assert:equals:"]=2;
  61355. $recv($self["@full"])._add_((5));
  61356. $self._assert_equals_($recv($self["@full"])._occurrencesOf_((5)),(1));
  61357. return self;
  61358. }, function($ctx1) {$ctx1.fill(self,"testOccurrences",{},$globals.ExampleSetTest)});
  61359. },
  61360. args: [],
  61361. 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",
  61362. referencedClasses: [],
  61363. messageSends: ["assert:equals:", "occurrencesOf:", "add:"]
  61364. }),
  61365. $globals.ExampleSetTest);
  61366. $core.addMethod(
  61367. $core.method({
  61368. selector: "testRemove",
  61369. protocol: "tests",
  61370. fn: function (){
  61371. var self=this,$self=this;
  61372. return $core.withContext(function($ctx1) {
  61373. var $1;
  61374. $recv($self["@full"])._remove_((5));
  61375. $1=$recv($self["@full"])._includes_("abc");
  61376. $ctx1.sendIdx["includes:"]=1;
  61377. $self._assert_($1);
  61378. $self._deny_($recv($self["@full"])._includes_((5)));
  61379. return self;
  61380. }, function($ctx1) {$ctx1.fill(self,"testRemove",{},$globals.ExampleSetTest)});
  61381. },
  61382. args: [],
  61383. source: "testRemove\x0a\x09full remove: 5.\x0a\x09self assert: (full includes: #abc).\x0a\x09self deny: (full includes: 5)",
  61384. referencedClasses: [],
  61385. messageSends: ["remove:", "assert:", "includes:", "deny:"]
  61386. }),
  61387. $globals.ExampleSetTest);
  61388. $core.addClass("SUnitAsyncTest", $globals.TestCase, ["flag"], "SUnit-Tests");
  61389. $core.addMethod(
  61390. $core.method({
  61391. selector: "fakeError",
  61392. protocol: "helpers",
  61393. fn: function (){
  61394. var self=this,$self=this;
  61395. return $core.withContext(function($ctx1) {
  61396. $self["@flag"]="bad";
  61397. $self._timeout_((30));
  61398. $self["@flag"]=$recv($self._async_((function(){
  61399. return $core.withContext(function($ctx2) {
  61400. $self["@flag"]="ok";
  61401. return $self._error_("Intentional");
  61402. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61403. })))._valueWithTimeout_((20));
  61404. return self;
  61405. }, function($ctx1) {$ctx1.fill(self,"fakeError",{},$globals.SUnitAsyncTest)});
  61406. },
  61407. args: [],
  61408. source: "fakeError\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self error: 'Intentional' ]) valueWithTimeout: 20",
  61409. referencedClasses: [],
  61410. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  61411. }),
  61412. $globals.SUnitAsyncTest);
  61413. $core.addMethod(
  61414. $core.method({
  61415. selector: "fakeErrorFailingInTearDown",
  61416. protocol: "helpers",
  61417. fn: function (){
  61418. var self=this,$self=this;
  61419. return $core.withContext(function($ctx1) {
  61420. $self["@flag"]="bad";
  61421. $self._timeout_((30));
  61422. $self["@flag"]=$recv($self._async_((function(){
  61423. return $core.withContext(function($ctx2) {
  61424. return $self._error_("Intentional");
  61425. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61426. })))._valueWithTimeout_((20));
  61427. return self;
  61428. }, function($ctx1) {$ctx1.fill(self,"fakeErrorFailingInTearDown",{},$globals.SUnitAsyncTest)});
  61429. },
  61430. args: [],
  61431. source: "fakeErrorFailingInTearDown\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ self error: 'Intentional' ]) valueWithTimeout: 20",
  61432. referencedClasses: [],
  61433. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  61434. }),
  61435. $globals.SUnitAsyncTest);
  61436. $core.addMethod(
  61437. $core.method({
  61438. selector: "fakeFailure",
  61439. protocol: "helpers",
  61440. fn: function (){
  61441. var self=this,$self=this;
  61442. return $core.withContext(function($ctx1) {
  61443. $self["@flag"]="bad";
  61444. $self._timeout_((30));
  61445. $self["@flag"]=$recv($self._async_((function(){
  61446. return $core.withContext(function($ctx2) {
  61447. $self["@flag"]="ok";
  61448. return $self._assert_(false);
  61449. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61450. })))._valueWithTimeout_((20));
  61451. return self;
  61452. }, function($ctx1) {$ctx1.fill(self,"fakeFailure",{},$globals.SUnitAsyncTest)});
  61453. },
  61454. args: [],
  61455. source: "fakeFailure\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self assert: false ]) valueWithTimeout: 20",
  61456. referencedClasses: [],
  61457. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:"]
  61458. }),
  61459. $globals.SUnitAsyncTest);
  61460. $core.addMethod(
  61461. $core.method({
  61462. selector: "fakeMultipleTimeoutFailing",
  61463. protocol: "helpers",
  61464. fn: function (){
  61465. var self=this,$self=this;
  61466. return $core.withContext(function($ctx1) {
  61467. var $1;
  61468. $self._timeout_((100));
  61469. $ctx1.sendIdx["timeout:"]=1;
  61470. $1=$self._async_((function(){
  61471. return $core.withContext(function($ctx2) {
  61472. $self._timeout_((20));
  61473. return $recv($self._async_((function(){
  61474. return $core.withContext(function($ctx3) {
  61475. return $self._finished();
  61476. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  61477. })))._valueWithTimeout_((30));
  61478. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61479. }));
  61480. $ctx1.sendIdx["async:"]=1;
  61481. $recv($1)._valueWithTimeout_((20));
  61482. $ctx1.sendIdx["valueWithTimeout:"]=1;
  61483. return self;
  61484. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutFailing",{},$globals.SUnitAsyncTest)});
  61485. },
  61486. args: [],
  61487. 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",
  61488. referencedClasses: [],
  61489. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  61490. }),
  61491. $globals.SUnitAsyncTest);
  61492. $core.addMethod(
  61493. $core.method({
  61494. selector: "fakeMultipleTimeoutPassing",
  61495. protocol: "helpers",
  61496. fn: function (){
  61497. var self=this,$self=this;
  61498. return $core.withContext(function($ctx1) {
  61499. var $1;
  61500. $self._timeout_((20));
  61501. $ctx1.sendIdx["timeout:"]=1;
  61502. $1=$self._async_((function(){
  61503. return $core.withContext(function($ctx2) {
  61504. $self._timeout_((40));
  61505. return $recv($self._async_((function(){
  61506. return $core.withContext(function($ctx3) {
  61507. return $self._finished();
  61508. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  61509. })))._valueWithTimeout_((20));
  61510. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61511. }));
  61512. $ctx1.sendIdx["async:"]=1;
  61513. $recv($1)._valueWithTimeout_((10));
  61514. $ctx1.sendIdx["valueWithTimeout:"]=1;
  61515. return self;
  61516. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutPassing",{},$globals.SUnitAsyncTest)});
  61517. },
  61518. args: [],
  61519. 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",
  61520. referencedClasses: [],
  61521. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  61522. }),
  61523. $globals.SUnitAsyncTest);
  61524. $core.addMethod(
  61525. $core.method({
  61526. selector: "fakeTimeout",
  61527. protocol: "helpers",
  61528. fn: function (){
  61529. var self=this,$self=this;
  61530. return $core.withContext(function($ctx1) {
  61531. $self._timeout_((10));
  61532. $recv($self._async_((function(){
  61533. return $core.withContext(function($ctx2) {
  61534. return $self._finished();
  61535. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61536. })))._valueWithTimeout_((20));
  61537. return self;
  61538. }, function($ctx1) {$ctx1.fill(self,"fakeTimeout",{},$globals.SUnitAsyncTest)});
  61539. },
  61540. args: [],
  61541. source: "fakeTimeout\x0a\x09self timeout: 10.\x0a\x09(self async: [ self finished ]) valueWithTimeout: 20",
  61542. referencedClasses: [],
  61543. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  61544. }),
  61545. $globals.SUnitAsyncTest);
  61546. $core.addMethod(
  61547. $core.method({
  61548. selector: "selectorSetOf:",
  61549. protocol: "private",
  61550. fn: function (aCollection){
  61551. var self=this,$self=this;
  61552. return $core.withContext(function($ctx1) {
  61553. return $recv($recv(aCollection)._collect_((function(each){
  61554. return $core.withContext(function($ctx2) {
  61555. return $recv(each)._selector();
  61556. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61557. })))._asSet();
  61558. }, function($ctx1) {$ctx1.fill(self,"selectorSetOf:",{aCollection:aCollection},$globals.SUnitAsyncTest)});
  61559. },
  61560. args: ["aCollection"],
  61561. source: "selectorSetOf: aCollection\x0a\x09^ (aCollection collect: [ :each | each selector ]) asSet",
  61562. referencedClasses: [],
  61563. messageSends: ["asSet", "collect:", "selector"]
  61564. }),
  61565. $globals.SUnitAsyncTest);
  61566. $core.addMethod(
  61567. $core.method({
  61568. selector: "setUp",
  61569. protocol: "running",
  61570. fn: function (){
  61571. var self=this,$self=this;
  61572. $self["@flag"]="ok";
  61573. return self;
  61574. },
  61575. args: [],
  61576. source: "setUp\x0a\x09flag := 'ok'",
  61577. referencedClasses: [],
  61578. messageSends: []
  61579. }),
  61580. $globals.SUnitAsyncTest);
  61581. $core.addMethod(
  61582. $core.method({
  61583. selector: "tearDown",
  61584. protocol: "running",
  61585. fn: function (){
  61586. var self=this,$self=this;
  61587. return $core.withContext(function($ctx1) {
  61588. $self._assert_equals_("ok",$self["@flag"]);
  61589. return self;
  61590. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.SUnitAsyncTest)});
  61591. },
  61592. args: [],
  61593. source: "tearDown\x0a\x09self assert: 'ok' equals: flag",
  61594. referencedClasses: [],
  61595. messageSends: ["assert:equals:"]
  61596. }),
  61597. $globals.SUnitAsyncTest);
  61598. $core.addMethod(
  61599. $core.method({
  61600. selector: "testAsyncErrorsAndFailures",
  61601. protocol: "tests",
  61602. fn: function (){
  61603. var self=this,$self=this;
  61604. var suite,runner,result,assertBlock;
  61605. return $core.withContext(function($ctx1) {
  61606. var $1,$2,$3,$4;
  61607. suite=["fakeError", "fakeErrorFailingInTearDown", "fakeFailure", "testPass"]._collect_((function(each){
  61608. return $core.withContext(function($ctx2) {
  61609. return $recv($self._class())._selector_(each);
  61610. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61611. }));
  61612. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  61613. $self._timeout_((200));
  61614. result=$recv(runner)._result();
  61615. $ctx1.sendIdx["result"]=1;
  61616. assertBlock=$self._async_((function(){
  61617. return $core.withContext(function($ctx2) {
  61618. $1=$self._selectorSetOf_($recv(result)._errors());
  61619. $ctx2.sendIdx["selectorSetOf:"]=1;
  61620. $2=["fakeError"]._asSet();
  61621. $ctx2.sendIdx["asSet"]=1;
  61622. $self._assert_equals_($1,$2);
  61623. $ctx2.sendIdx["assert:equals:"]=1;
  61624. $self._assert_equals_($self._selectorSetOf_($recv(result)._failures()),["fakeErrorFailingInTearDown", "fakeFailure"]._asSet());
  61625. return $self._finished();
  61626. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61627. }));
  61628. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  61629. return $core.withContext(function($ctx2) {
  61630. $3=$recv($recv(ann)._result()).__eq_eq(result);
  61631. if($core.assert($3)){
  61632. $4=$recv($recv(result)._runs()).__eq($recv(result)._total());
  61633. return $recv($4)._ifTrue_(assertBlock);
  61634. }
  61635. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  61636. }));
  61637. $recv(runner)._run();
  61638. return self;
  61639. }, function($ctx1) {$ctx1.fill(self,"testAsyncErrorsAndFailures",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  61640. },
  61641. args: [],
  61642. 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",
  61643. referencedClasses: ["TestSuiteRunner", "ResultAnnouncement"],
  61644. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "asSet", "failures", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  61645. }),
  61646. $globals.SUnitAsyncTest);
  61647. $core.addMethod(
  61648. $core.method({
  61649. selector: "testAsyncNeedsTimeout",
  61650. protocol: "tests",
  61651. fn: function (){
  61652. var self=this,$self=this;
  61653. return $core.withContext(function($ctx1) {
  61654. $self._should_raise_((function(){
  61655. return $core.withContext(function($ctx2) {
  61656. return $self._async_((function(){
  61657. }));
  61658. $ctx2.sendIdx["async:"]=1;
  61659. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61660. }),$globals.Error);
  61661. $self._timeout_((0));
  61662. $self._shouldnt_raise_((function(){
  61663. return $core.withContext(function($ctx2) {
  61664. return $self._async_((function(){
  61665. }));
  61666. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  61667. }),$globals.Error);
  61668. $self._finished();
  61669. return self;
  61670. }, function($ctx1) {$ctx1.fill(self,"testAsyncNeedsTimeout",{},$globals.SUnitAsyncTest)});
  61671. },
  61672. args: [],
  61673. source: "testAsyncNeedsTimeout\x0a\x09self should: [ self async: [ ] ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self async: [ ] ] raise: Error.\x0a\x09self finished",
  61674. referencedClasses: ["Error"],
  61675. messageSends: ["should:raise:", "async:", "timeout:", "shouldnt:raise:", "finished"]
  61676. }),
  61677. $globals.SUnitAsyncTest);
  61678. $core.addMethod(
  61679. $core.method({
  61680. selector: "testFinishedNeedsTimeout",
  61681. protocol: "tests",
  61682. fn: function (){
  61683. var self=this,$self=this;
  61684. return $core.withContext(function($ctx1) {
  61685. $self._should_raise_((function(){
  61686. return $core.withContext(function($ctx2) {
  61687. return $self._finished();
  61688. $ctx2.sendIdx["finished"]=1;
  61689. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61690. }),$globals.Error);
  61691. $self._timeout_((0));
  61692. $self._shouldnt_raise_((function(){
  61693. return $core.withContext(function($ctx2) {
  61694. return $self._finished();
  61695. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61696. }),$globals.Error);
  61697. return self;
  61698. }, function($ctx1) {$ctx1.fill(self,"testFinishedNeedsTimeout",{},$globals.SUnitAsyncTest)});
  61699. },
  61700. args: [],
  61701. source: "testFinishedNeedsTimeout\x0a\x09self should: [ self finished ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self finished ] raise: Error.",
  61702. referencedClasses: ["Error"],
  61703. messageSends: ["should:raise:", "finished", "timeout:", "shouldnt:raise:"]
  61704. }),
  61705. $globals.SUnitAsyncTest);
  61706. $core.addMethod(
  61707. $core.method({
  61708. selector: "testIsAsyncReturnsCorrectValues",
  61709. protocol: "tests",
  61710. fn: function (){
  61711. var self=this,$self=this;
  61712. return $core.withContext(function($ctx1) {
  61713. var $1,$2;
  61714. $1=$self._isAsync();
  61715. $ctx1.sendIdx["isAsync"]=1;
  61716. $self._deny_($1);
  61717. $ctx1.sendIdx["deny:"]=1;
  61718. $self._timeout_((0));
  61719. $2=$self._isAsync();
  61720. $ctx1.sendIdx["isAsync"]=2;
  61721. $self._assert_($2);
  61722. $self._finished();
  61723. $self._deny_($self._isAsync());
  61724. return self;
  61725. }, function($ctx1) {$ctx1.fill(self,"testIsAsyncReturnsCorrectValues",{},$globals.SUnitAsyncTest)});
  61726. },
  61727. args: [],
  61728. source: "testIsAsyncReturnsCorrectValues\x0a\x09self deny: self isAsync.\x0a\x09self timeout: 0.\x0a\x09self assert: self isAsync.\x0a\x09self finished.\x0a\x09self deny: self isAsync",
  61729. referencedClasses: [],
  61730. messageSends: ["deny:", "isAsync", "timeout:", "assert:", "finished"]
  61731. }),
  61732. $globals.SUnitAsyncTest);
  61733. $core.addMethod(
  61734. $core.method({
  61735. selector: "testPass",
  61736. protocol: "tests",
  61737. fn: function (){
  61738. var self=this,$self=this;
  61739. return $core.withContext(function($ctx1) {
  61740. $self["@flag"]="bad";
  61741. $self._timeout_((10));
  61742. $self["@flag"]=$recv($self._async_((function(){
  61743. return $core.withContext(function($ctx2) {
  61744. $self._assert_(true);
  61745. $self._finished();
  61746. $self["@flag"]="ok";
  61747. return $self["@flag"];
  61748. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61749. })))._valueWithTimeout_((5));
  61750. return self;
  61751. }, function($ctx1) {$ctx1.fill(self,"testPass",{},$globals.SUnitAsyncTest)});
  61752. },
  61753. args: [],
  61754. source: "testPass\x0a\x09flag := 'bad'.\x0a\x09self timeout: 10.\x0a\x09flag := (self async: [ self assert: true. self finished. flag := 'ok' ]) valueWithTimeout: 5",
  61755. referencedClasses: [],
  61756. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:", "finished"]
  61757. }),
  61758. $globals.SUnitAsyncTest);
  61759. $core.addMethod(
  61760. $core.method({
  61761. selector: "testTimeouts",
  61762. protocol: "tests",
  61763. fn: function (){
  61764. var self=this,$self=this;
  61765. var suite,runner,result,assertBlock;
  61766. return $core.withContext(function($ctx1) {
  61767. var $1,$2,$3;
  61768. suite=["fakeTimeout", "fakeMultipleTimeoutFailing", "fakeMultipleTimeoutPassing", "testPass"]._collect_((function(each){
  61769. return $core.withContext(function($ctx2) {
  61770. return $recv($self._class())._selector_(each);
  61771. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61772. }));
  61773. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  61774. $self._timeout_((200));
  61775. result=$recv(runner)._result();
  61776. $ctx1.sendIdx["result"]=1;
  61777. assertBlock=$self._async_((function(){
  61778. return $core.withContext(function($ctx2) {
  61779. $1=$self._selectorSetOf_($recv(result)._errors());
  61780. $ctx2.sendIdx["selectorSetOf:"]=1;
  61781. $self._assert_equals_($1,$recv($globals.Set)._new());
  61782. $ctx2.sendIdx["assert:equals:"]=1;
  61783. $self._assert_equals_($self._selectorSetOf_($recv(result)._failures()),["fakeMultipleTimeoutFailing", "fakeTimeout"]._asSet());
  61784. return $self._finished();
  61785. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61786. }));
  61787. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  61788. return $core.withContext(function($ctx2) {
  61789. $2=$recv($recv(ann)._result()).__eq_eq(result);
  61790. if($core.assert($2)){
  61791. $3=$recv($recv(result)._runs()).__eq($recv(result)._total());
  61792. return $recv($3)._ifTrue_(assertBlock);
  61793. }
  61794. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  61795. }));
  61796. $recv(runner)._run();
  61797. return self;
  61798. }, function($ctx1) {$ctx1.fill(self,"testTimeouts",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  61799. },
  61800. args: [],
  61801. 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",
  61802. referencedClasses: ["TestSuiteRunner", "Set", "ResultAnnouncement"],
  61803. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "new", "failures", "asSet", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  61804. }),
  61805. $globals.SUnitAsyncTest);
  61806. $core.addMethod(
  61807. $core.method({
  61808. selector: "testTwoAsyncPassesWithFinishedOnlyOneIsRun",
  61809. protocol: "tests",
  61810. fn: function (){
  61811. var self=this,$self=this;
  61812. var x;
  61813. return $core.withContext(function($ctx1) {
  61814. var $1;
  61815. $self["@flag"]="bad";
  61816. $self._timeout_((10));
  61817. x=(0);
  61818. $1=$self._async_((function(){
  61819. return $core.withContext(function($ctx2) {
  61820. $self._finished();
  61821. $ctx2.sendIdx["finished"]=1;
  61822. $self["@flag"]="ok";
  61823. x=$recv(x).__plus((1));
  61824. $ctx2.sendIdx["+"]=1;
  61825. return $self._assert_equals_(x,(1));
  61826. $ctx2.sendIdx["assert:equals:"]=1;
  61827. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61828. }));
  61829. $ctx1.sendIdx["async:"]=1;
  61830. $self["@flag"]=$recv($1)._valueWithTimeout_((0));
  61831. $ctx1.sendIdx["valueWithTimeout:"]=1;
  61832. $self["@flag"]=$recv($self._async_((function(){
  61833. return $core.withContext(function($ctx2) {
  61834. $self._finished();
  61835. $self["@flag"]="ok";
  61836. x=$recv(x).__plus((1));
  61837. return $self._assert_equals_(x,(1));
  61838. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61839. })))._valueWithTimeout_((0));
  61840. return self;
  61841. }, function($ctx1) {$ctx1.fill(self,"testTwoAsyncPassesWithFinishedOnlyOneIsRun",{x:x},$globals.SUnitAsyncTest)});
  61842. },
  61843. args: [],
  61844. 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.",
  61845. referencedClasses: [],
  61846. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished", "+", "assert:equals:"]
  61847. }),
  61848. $globals.SUnitAsyncTest);
  61849. });
  61850. define('amber/devel',[
  61851. './lang',
  61852. './brikz', // pre-fetch, dep of ./boot
  61853. './kernel-checks', // pre-fetch, dep of ./boot
  61854. './kernel-fundamentals', // pre-fetch, dep of ./boot
  61855. './kernel-language', // pre-fetch, dep of ./boot
  61856. './boot', // pre-fetch, class loader
  61857. './deploy', // pre-fetch, dep of ./lang
  61858. // --- packages of the development only Amber begin here ---
  61859. 'amber_core/Platform-DOM',
  61860. 'amber_core/SUnit',
  61861. 'amber_core/Compiler-Tests',
  61862. 'amber_core/Kernel-Tests',
  61863. 'amber_core/Platform-DOM-Tests',
  61864. 'amber_core/SUnit-Tests'
  61865. // --- packages of the development only Amber end here ---
  61866. ], function (amber) {
  61867. return amber;
  61868. });
  61869. define('amber_core/Platform-Node',["amber/boot"
  61870. , "amber_core/Platform-Services"
  61871. , "amber_core/Kernel-Objects"], function($boot
  61872. ){"use strict";
  61873. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  61874. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  61875. var $pkg = $core.addPackage("Platform-Node");
  61876. $pkg.innerEval = function (expr) { return eval(expr); };
  61877. $pkg.imports = ["amber_core/Platform-Services"];
  61878. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  61879. $core.addClass("NodePlatform", $globals.Object, [], "Platform-Node");
  61880. $globals.NodePlatform.comment="I am `Platform` service implementation for node-like environment.";
  61881. $core.addMethod(
  61882. $core.method({
  61883. selector: "globals",
  61884. protocol: "accessing",
  61885. fn: function (){
  61886. var self=this,$self=this;
  61887. return global;
  61888. },
  61889. args: [],
  61890. source: "globals\x0a\x09^ global",
  61891. referencedClasses: [],
  61892. messageSends: []
  61893. }),
  61894. $globals.NodePlatform);
  61895. $core.addMethod(
  61896. $core.method({
  61897. selector: "newXhr",
  61898. protocol: "accessing",
  61899. fn: function (){
  61900. var self=this,$self=this;
  61901. return $core.withContext(function($ctx1) {
  61902. var $receiver;
  61903. if(($receiver = $globals.XMLHttpRequest) == null || $receiver.a$nil){
  61904. $self._error_("XMLHttpRequest not available.");
  61905. } else {
  61906. return $recv($globals.XMLHttpRequest)._new();
  61907. }
  61908. return self;
  61909. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.NodePlatform)});
  61910. },
  61911. args: [],
  61912. source: "newXhr\x0a\x09XMLHttpRequest\x0a\x09\x09ifNotNil: [ ^ XMLHttpRequest new ]\x0a\x09\x09ifNil: [ self error: 'XMLHttpRequest not available.' ]",
  61913. referencedClasses: ["XMLHttpRequest"],
  61914. messageSends: ["ifNotNil:ifNil:", "new", "error:"]
  61915. }),
  61916. $globals.NodePlatform);
  61917. $core.addMethod(
  61918. $core.method({
  61919. selector: "initialize",
  61920. protocol: "testing",
  61921. fn: function (){
  61922. var self=this,$self=this;
  61923. return $core.withContext(function($ctx1) {
  61924. var $1;
  61925. $1=$self._isFeasible();
  61926. if($core.assert($1)){
  61927. $recv($globals.Platform)._registerIfNone_($self._new());
  61928. }
  61929. return self;
  61930. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NodePlatform.a$cls)});
  61931. },
  61932. args: [],
  61933. source: "initialize\x0a\x09self isFeasible ifTrue: [ Platform registerIfNone: self new ]",
  61934. referencedClasses: ["Platform"],
  61935. messageSends: ["ifTrue:", "isFeasible", "registerIfNone:", "new"]
  61936. }),
  61937. $globals.NodePlatform.a$cls);
  61938. $core.addMethod(
  61939. $core.method({
  61940. selector: "isFeasible",
  61941. protocol: "testing",
  61942. fn: function (){
  61943. var self=this,$self=this;
  61944. return $core.withContext(function($ctx1) {
  61945. return typeof process !== "undefined" && process && process.versions && process.versions.node != null;
  61946. return self;
  61947. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{},$globals.NodePlatform.a$cls)});
  61948. },
  61949. args: [],
  61950. source: "isFeasible\x0a<inlineJS: 'return typeof process !== \x22undefined\x22 && process && process.versions && process.versions.node != null'>",
  61951. referencedClasses: [],
  61952. messageSends: []
  61953. }),
  61954. $globals.NodePlatform.a$cls);
  61955. });
  61956. define('amber_cli/AmberCli',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  61957. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  61958. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  61959. var $pkg = $core.addPackage("AmberCli");
  61960. $pkg.innerEval = function (expr) { return eval(expr); };
  61961. $pkg.transport = {"type":"amd","amdNamespace":"amber_cli"};
  61962. $core.addClass("AmberCli", $globals.Object, [], "AmberCli");
  61963. $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.";
  61964. $core.addMethod(
  61965. $core.method({
  61966. selector: "commandLineSwitches",
  61967. protocol: "commandline",
  61968. fn: function (){
  61969. var self=this,$self=this;
  61970. var switches;
  61971. return $core.withContext(function($ctx1) {
  61972. switches=$recv($recv($self._class())._methodsInProtocol_("commands"))._collect_((function(each){
  61973. return $core.withContext(function($ctx2) {
  61974. return $recv(each)._selector();
  61975. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61976. }));
  61977. $ctx1.sendIdx["collect:"]=1;
  61978. switches=$recv(switches)._select_((function(each){
  61979. return $core.withContext(function($ctx2) {
  61980. return $recv(each)._match_("^[^:]*:$");
  61981. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  61982. }));
  61983. switches=$recv(switches)._collect_((function(each){
  61984. return $core.withContext(function($ctx2) {
  61985. return $recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase();
  61986. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  61987. }));
  61988. return switches;
  61989. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.AmberCli.a$cls)});
  61990. },
  61991. args: [],
  61992. 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",
  61993. referencedClasses: [],
  61994. messageSends: ["collect:", "methodsInProtocol:", "class", "selector", "select:", "match:", "asLowercase", "replace:with:", "allButLast"]
  61995. }),
  61996. $globals.AmberCli.a$cls);
  61997. $core.addMethod(
  61998. $core.method({
  61999. selector: "config:",
  62000. protocol: "commands",
  62001. fn: function (args){
  62002. var self=this,$self=this;
  62003. return $core.withContext(function($ctx1) {
  62004. $recv($recv($globals.Configurator)._new())._start();
  62005. return self;
  62006. }, function($ctx1) {$ctx1.fill(self,"config:",{args:args},$globals.AmberCli.a$cls)});
  62007. },
  62008. args: ["args"],
  62009. source: "config: args\x0a\x09Configurator new start",
  62010. referencedClasses: ["Configurator"],
  62011. messageSends: ["start", "new"]
  62012. }),
  62013. $globals.AmberCli.a$cls);
  62014. $core.addMethod(
  62015. $core.method({
  62016. selector: "handleArguments:",
  62017. protocol: "commandline",
  62018. fn: function (args){
  62019. var self=this,$self=this;
  62020. var selector;
  62021. return $core.withContext(function($ctx1) {
  62022. var $1;
  62023. $1=$recv(args)._first();
  62024. $ctx1.sendIdx["first"]=1;
  62025. selector=$self._selectorForCommandLineSwitch_($1);
  62026. $recv(args)._remove_($recv(args)._first());
  62027. $self._perform_withArguments_(selector,$recv($globals.Array)._with_(args));
  62028. return self;
  62029. }, function($ctx1) {$ctx1.fill(self,"handleArguments:",{args:args,selector:selector},$globals.AmberCli.a$cls)});
  62030. },
  62031. args: ["args"],
  62032. 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)",
  62033. referencedClasses: ["Array"],
  62034. messageSends: ["selectorForCommandLineSwitch:", "first", "remove:", "perform:withArguments:", "with:"]
  62035. }),
  62036. $globals.AmberCli.a$cls);
  62037. $core.addMethod(
  62038. $core.method({
  62039. selector: "help:",
  62040. protocol: "commands",
  62041. fn: function (args){
  62042. var self=this,$self=this;
  62043. return $core.withContext(function($ctx1) {
  62044. $recv($globals.Transcript)._show_("Available commands");
  62045. $recv($self._commandLineSwitches())._do_((function(each){
  62046. return $core.withContext(function($ctx2) {
  62047. return $recv(console)._log_(each);
  62048. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  62049. }));
  62050. return self;
  62051. }, function($ctx1) {$ctx1.fill(self,"help:",{args:args},$globals.AmberCli.a$cls)});
  62052. },
  62053. args: ["args"],
  62054. source: "help: args\x0a\x09Transcript show: 'Available commands'.\x0a\x09self commandLineSwitches do: [ :each | console log: each ]",
  62055. referencedClasses: ["Transcript"],
  62056. messageSends: ["show:", "do:", "commandLineSwitches", "log:"]
  62057. }),
  62058. $globals.AmberCli.a$cls);
  62059. $core.addMethod(
  62060. $core.method({
  62061. selector: "init:",
  62062. protocol: "commands",
  62063. fn: function (args){
  62064. var self=this,$self=this;
  62065. return $core.withContext(function($ctx1) {
  62066. $recv($recv($globals.Initer)._new())._start();
  62067. return self;
  62068. }, function($ctx1) {$ctx1.fill(self,"init:",{args:args},$globals.AmberCli.a$cls)});
  62069. },
  62070. args: ["args"],
  62071. source: "init: args\x0a\x09Initer new start",
  62072. referencedClasses: ["Initer"],
  62073. messageSends: ["start", "new"]
  62074. }),
  62075. $globals.AmberCli.a$cls);
  62076. $core.addMethod(
  62077. $core.method({
  62078. selector: "main",
  62079. protocol: "startup",
  62080. fn: function (){
  62081. var self=this,$self=this;
  62082. var args,packageJSON;
  62083. return $core.withContext(function($ctx1) {
  62084. var $7,$6,$5,$4,$3,$2,$1;
  62085. var $early={};
  62086. try {
  62087. packageJSON=$recv(require)._value_("../package.json");
  62088. $7=$recv(packageJSON)._version();
  62089. $ctx1.sendIdx["version"]=1;
  62090. $6="Welcome to Amber CLI version ".__comma($7);
  62091. $5=$recv($6).__comma(" (Amber ");
  62092. $ctx1.sendIdx[","]=5;
  62093. $4=$recv($5).__comma($recv($globals.Smalltalk)._version());
  62094. $ctx1.sendIdx[","]=4;
  62095. $3=$recv($4).__comma(", NodeJS ");
  62096. $ctx1.sendIdx[","]=3;
  62097. $2=$recv($3).__comma($recv($recv(process)._versions())._node());
  62098. $ctx1.sendIdx[","]=2;
  62099. $1=$recv($2).__comma(").");
  62100. $ctx1.sendIdx[","]=1;
  62101. $recv($globals.Transcript)._show_($1);
  62102. args=$recv(process)._argv();
  62103. $recv(args)._removeFrom_to_((1),(2));
  62104. $recv(args)._ifEmpty_ifNotEmpty_((function(){
  62105. return $core.withContext(function($ctx2) {
  62106. return $self._help_(nil);
  62107. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  62108. }),(function(){
  62109. return $core.withContext(function($ctx2) {
  62110. throw $early=[$self._handleArguments_(args)];
  62111. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  62112. }));
  62113. return self;
  62114. }
  62115. catch(e) {if(e===$early)return e[0]; throw e}
  62116. }, function($ctx1) {$ctx1.fill(self,"main",{args:args,packageJSON:packageJSON},$globals.AmberCli.a$cls)});
  62117. },
  62118. args: [],
  62119. 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]",
  62120. referencedClasses: ["Transcript", "Smalltalk"],
  62121. messageSends: ["value:", "show:", ",", "version", "node", "versions", "argv", "removeFrom:to:", "ifEmpty:ifNotEmpty:", "help:", "handleArguments:"]
  62122. }),
  62123. $globals.AmberCli.a$cls);
  62124. $core.addMethod(
  62125. $core.method({
  62126. selector: "repl:",
  62127. protocol: "commands",
  62128. fn: function (args){
  62129. var self=this,$self=this;
  62130. return $core.withContext(function($ctx1) {
  62131. return $recv($recv($globals.Repl)._new())._createInterface();
  62132. }, function($ctx1) {$ctx1.fill(self,"repl:",{args:args},$globals.AmberCli.a$cls)});
  62133. },
  62134. args: ["args"],
  62135. source: "repl: args\x0a\x09^ Repl new createInterface",
  62136. referencedClasses: ["Repl"],
  62137. messageSends: ["createInterface", "new"]
  62138. }),
  62139. $globals.AmberCli.a$cls);
  62140. $core.addMethod(
  62141. $core.method({
  62142. selector: "selectorForCommandLineSwitch:",
  62143. protocol: "commandline",
  62144. fn: function (aSwitch){
  62145. var self=this,$self=this;
  62146. var command,selector;
  62147. return $core.withContext(function($ctx1) {
  62148. var $1;
  62149. $1=$recv($self._commandLineSwitches())._includes_(aSwitch);
  62150. if($core.assert($1)){
  62151. selector=$recv($recv(aSwitch)._replace_with_("-[a-z]",(function(each){
  62152. return $core.withContext(function($ctx2) {
  62153. return $recv($recv(each)._second())._asUppercase();
  62154. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  62155. }))).__comma(":");
  62156. selector;
  62157. } else {
  62158. selector="help:";
  62159. selector;
  62160. }
  62161. return selector;
  62162. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch,command:command,selector:selector},$globals.AmberCli.a$cls)});
  62163. },
  62164. args: ["aSwitch"],
  62165. 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",
  62166. referencedClasses: [],
  62167. messageSends: ["ifTrue:ifFalse:", "includes:", "commandLineSwitches", ",", "replace:with:", "asUppercase", "second"]
  62168. }),
  62169. $globals.AmberCli.a$cls);
  62170. $core.addMethod(
  62171. $core.method({
  62172. selector: "serve:",
  62173. protocol: "commands",
  62174. fn: function (args){
  62175. var self=this,$self=this;
  62176. return $core.withContext(function($ctx1) {
  62177. return $recv($recv($globals.FileServer)._createServerWithArguments_(args))._start();
  62178. }, function($ctx1) {$ctx1.fill(self,"serve:",{args:args},$globals.AmberCli.a$cls)});
  62179. },
  62180. args: ["args"],
  62181. source: "serve: args\x0a\x09^ (FileServer createServerWithArguments: args) start",
  62182. referencedClasses: ["FileServer"],
  62183. messageSends: ["start", "createServerWithArguments:"]
  62184. }),
  62185. $globals.AmberCli.a$cls);
  62186. $core.addMethod(
  62187. $core.method({
  62188. selector: "version:",
  62189. protocol: "commands",
  62190. fn: function (arguments_){
  62191. var self=this,$self=this;
  62192. return self;
  62193. },
  62194. args: ["arguments"],
  62195. source: "version: arguments",
  62196. referencedClasses: [],
  62197. messageSends: []
  62198. }),
  62199. $globals.AmberCli.a$cls);
  62200. $core.addClass("BaseFileManipulator", $globals.Object, ["path", "fs"], "AmberCli");
  62201. $core.addMethod(
  62202. $core.method({
  62203. selector: "dirname",
  62204. protocol: "private",
  62205. fn: function (){
  62206. var self=this,$self=this;
  62207. return $core.withContext(function($ctx1) {
  62208. return __dirname;
  62209. return self;
  62210. }, function($ctx1) {$ctx1.fill(self,"dirname",{},$globals.BaseFileManipulator)});
  62211. },
  62212. args: [],
  62213. source: "dirname\x0a\x09<inlineJS: 'return __dirname'>",
  62214. referencedClasses: [],
  62215. messageSends: []
  62216. }),
  62217. $globals.BaseFileManipulator);
  62218. $core.addMethod(
  62219. $core.method({
  62220. selector: "initialize",
  62221. protocol: "initialization",
  62222. fn: function (){
  62223. var self=this,$self=this;
  62224. return $core.withContext(function($ctx1) {
  62225. (
  62226. $ctx1.supercall = true,
  62227. ($globals.BaseFileManipulator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  62228. $ctx1.supercall = false;
  62229. $self["@path"]=$recv(require)._value_("path");
  62230. $ctx1.sendIdx["value:"]=1;
  62231. $self["@fs"]=$recv(require)._value_("fs");
  62232. return self;
  62233. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BaseFileManipulator)});
  62234. },
  62235. args: [],
  62236. source: "initialize\x0a\x09super initialize.\x0a\x09path := require value: 'path'.\x0a\x09fs := require value: 'fs'",
  62237. referencedClasses: [],
  62238. messageSends: ["initialize", "value:"]
  62239. }),
  62240. $globals.BaseFileManipulator);
  62241. $core.addMethod(
  62242. $core.method({
  62243. selector: "rootDirname",
  62244. protocol: "private",
  62245. fn: function (){
  62246. var self=this,$self=this;
  62247. return $core.withContext(function($ctx1) {
  62248. return $recv($self["@path"])._join_with_($self._dirname(),"..");
  62249. }, function($ctx1) {$ctx1.fill(self,"rootDirname",{},$globals.BaseFileManipulator)});
  62250. },
  62251. args: [],
  62252. source: "rootDirname\x0a\x09^ path join: self dirname with: '..'",
  62253. referencedClasses: [],
  62254. messageSends: ["join:with:", "dirname"]
  62255. }),
  62256. $globals.BaseFileManipulator);
  62257. $core.addClass("Configurator", $globals.BaseFileManipulator, [], "AmberCli");
  62258. $core.addMethod(
  62259. $core.method({
  62260. selector: "initialize",
  62261. protocol: "initialization",
  62262. fn: function (){
  62263. var self=this,$self=this;
  62264. return $core.withContext(function($ctx1) {
  62265. (
  62266. $ctx1.supercall = true,
  62267. ($globals.Configurator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  62268. $ctx1.supercall = false;
  62269. return self;
  62270. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Configurator)});
  62271. },
  62272. args: [],
  62273. source: "initialize\x0a\x09super initialize",
  62274. referencedClasses: [],
  62275. messageSends: ["initialize"]
  62276. }),
  62277. $globals.Configurator);
  62278. $core.addMethod(
  62279. $core.method({
  62280. selector: "start",
  62281. protocol: "action",
  62282. fn: function (){
  62283. var self=this,$self=this;
  62284. return $core.withContext(function($ctx1) {
  62285. var $receiver;
  62286. $self._writeConfigThenDo_((function(err){
  62287. return $core.withContext(function($ctx2) {
  62288. if(($receiver = err) == null || $receiver.a$nil){
  62289. return $recv(process)._exit();
  62290. } else {
  62291. return $recv(process)._exit_((111));
  62292. }
  62293. }, function($ctx2) {$ctx2.fillBlock({err:err},$ctx1,1)});
  62294. }));
  62295. return self;
  62296. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Configurator)});
  62297. },
  62298. args: [],
  62299. source: "start\x0a\x09self writeConfigThenDo: [ :err | err\x0a\x09\x09ifNotNil: [ process exit: 111 ]\x0a\x09\x09ifNil: [ process exit ]]",
  62300. referencedClasses: [],
  62301. messageSends: ["writeConfigThenDo:", "ifNotNil:ifNil:", "exit:", "exit"]
  62302. }),
  62303. $globals.Configurator);
  62304. $core.addMethod(
  62305. $core.method({
  62306. selector: "writeConfigThenDo:",
  62307. protocol: "action",
  62308. fn: function (aBlock){
  62309. var self=this,$self=this;
  62310. return $core.withContext(function($ctx1) {
  62311. $recv($recv($recv(require)._value_("@ambers/sdk"))._configBuilder())._writeConfig_toFile_thenDo_($recv(process)._cwd(),"config.js",aBlock);
  62312. return self;
  62313. }, function($ctx1) {$ctx1.fill(self,"writeConfigThenDo:",{aBlock:aBlock},$globals.Configurator)});
  62314. },
  62315. args: ["aBlock"],
  62316. source: "writeConfigThenDo: aBlock\x0a\x09(require value: '@ambers/sdk') configBuilder\x0a\x09\x09writeConfig: process cwd\x0a\x09\x09toFile: 'config.js'\x0a\x09\x09thenDo: aBlock",
  62317. referencedClasses: [],
  62318. messageSends: ["writeConfig:toFile:thenDo:", "configBuilder", "value:", "cwd"]
  62319. }),
  62320. $globals.Configurator);
  62321. $core.addClass("FileServer", $globals.BaseFileManipulator, ["http", "url", "host", "port", "basePath", "util", "username", "password", "fallbackPage"], "AmberCli");
  62322. $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.";
  62323. $core.addMethod(
  62324. $core.method({
  62325. selector: "base64Decode:",
  62326. protocol: "private",
  62327. fn: function (aString){
  62328. var self=this,$self=this;
  62329. return $core.withContext(function($ctx1) {
  62330. return (new Buffer(aString, "base64").toString());
  62331. return self;
  62332. }, function($ctx1) {$ctx1.fill(self,"base64Decode:",{aString:aString},$globals.FileServer)});
  62333. },
  62334. args: ["aString"],
  62335. source: "base64Decode: aString\x0a\x09<inlineJS: 'return (new Buffer(aString, \x22base64\x22).toString())'>",
  62336. referencedClasses: [],
  62337. messageSends: []
  62338. }),
  62339. $globals.FileServer);
  62340. $core.addMethod(
  62341. $core.method({
  62342. selector: "basePath",
  62343. protocol: "accessing",
  62344. fn: function (){
  62345. var self=this,$self=this;
  62346. return $core.withContext(function($ctx1) {
  62347. var $1,$receiver;
  62348. $1=$self["@basePath"];
  62349. if(($receiver = $1) == null || $receiver.a$nil){
  62350. return $recv($self._class())._defaultBasePath();
  62351. } else {
  62352. return $1;
  62353. }
  62354. }, function($ctx1) {$ctx1.fill(self,"basePath",{},$globals.FileServer)});
  62355. },
  62356. args: [],
  62357. source: "basePath\x0a\x09^ basePath ifNil: [self class defaultBasePath]",
  62358. referencedClasses: [],
  62359. messageSends: ["ifNil:", "defaultBasePath", "class"]
  62360. }),
  62361. $globals.FileServer);
  62362. $core.addMethod(
  62363. $core.method({
  62364. selector: "basePath:",
  62365. protocol: "accessing",
  62366. fn: function (aString){
  62367. var self=this,$self=this;
  62368. return $core.withContext(function($ctx1) {
  62369. $self["@basePath"]=aString;
  62370. $self._validateBasePath();
  62371. return self;
  62372. }, function($ctx1) {$ctx1.fill(self,"basePath:",{aString:aString},$globals.FileServer)});
  62373. },
  62374. args: ["aString"],
  62375. source: "basePath: aString\x0a\x09basePath := aString.\x0a\x09self validateBasePath.",
  62376. referencedClasses: [],
  62377. messageSends: ["validateBasePath"]
  62378. }),
  62379. $globals.FileServer);
  62380. $core.addMethod(
  62381. $core.method({
  62382. selector: "checkDirectoryLayout",
  62383. protocol: "initialization",
  62384. fn: function (){
  62385. var self=this,$self=this;
  62386. return $core.withContext(function($ctx1) {
  62387. var $1;
  62388. $1=$recv($self["@fs"])._existsSync_($self._withBasePath_("index.html"));
  62389. if(!$core.assert($1)){
  62390. $recv(console)._warn_("Warning: project directory does not contain index.html.");
  62391. $ctx1.sendIdx["warn:"]=1;
  62392. $recv(console)._warn_(" You can specify the directory containing index.html with --base-path.");
  62393. $ctx1.sendIdx["warn:"]=2;
  62394. $recv(console)._warn_(" You can also specify a page to be served by default,");
  62395. $ctx1.sendIdx["warn:"]=3;
  62396. $recv(console)._warn_(" for all paths that do not map to a file, with --fallback-page.");
  62397. }
  62398. return self;
  62399. }, function($ctx1) {$ctx1.fill(self,"checkDirectoryLayout",{},$globals.FileServer)});
  62400. },
  62401. args: [],
  62402. 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.'].",
  62403. referencedClasses: [],
  62404. messageSends: ["ifFalse:", "existsSync:", "withBasePath:", "warn:"]
  62405. }),
  62406. $globals.FileServer);
  62407. $core.addMethod(
  62408. $core.method({
  62409. selector: "fallbackPage",
  62410. protocol: "accessing",
  62411. fn: function (){
  62412. var self=this,$self=this;
  62413. return $self["@fallbackPage"];
  62414. },
  62415. args: [],
  62416. source: "fallbackPage\x0a\x09^ fallbackPage",
  62417. referencedClasses: [],
  62418. messageSends: []
  62419. }),
  62420. $globals.FileServer);
  62421. $core.addMethod(
  62422. $core.method({
  62423. selector: "fallbackPage:",
  62424. protocol: "accessing",
  62425. fn: function (aString){
  62426. var self=this,$self=this;
  62427. $self["@fallbackPage"]=aString;
  62428. return self;
  62429. },
  62430. args: ["aString"],
  62431. source: "fallbackPage: aString\x0a\x09fallbackPage := aString",
  62432. referencedClasses: [],
  62433. messageSends: []
  62434. }),
  62435. $globals.FileServer);
  62436. $core.addMethod(
  62437. $core.method({
  62438. selector: "handleGETRequest:respondTo:",
  62439. protocol: "request handling",
  62440. fn: function (aRequest,aResponse){
  62441. var self=this,$self=this;
  62442. var uri,filename;
  62443. return $core.withContext(function($ctx1) {
  62444. var $1;
  62445. uri=$recv($self["@url"])._parse_($recv(aRequest)._url());
  62446. filename=$recv($self["@path"])._join_with_($self._basePath(),$recv(uri)._pathname());
  62447. $recv($self["@fs"])._exists_do_(filename,(function(aBoolean){
  62448. return $core.withContext(function($ctx2) {
  62449. if($core.assert(aBoolean)){
  62450. $1=$recv($recv($self["@fs"])._statSync_(filename))._isDirectory();
  62451. if($core.assert($1)){
  62452. return $self._respondDirectoryNamed_from_to_(filename,uri,aResponse);
  62453. } else {
  62454. return $self._respondFileNamed_to_(filename,aResponse);
  62455. }
  62456. } else {
  62457. return $self._respondNotFoundTo_(aResponse);
  62458. }
  62459. }, function($ctx2) {$ctx2.fillBlock({aBoolean:aBoolean},$ctx1,1)});
  62460. }));
  62461. return self;
  62462. }, function($ctx1) {$ctx1.fill(self,"handleGETRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,uri:uri,filename:filename},$globals.FileServer)});
  62463. },
  62464. args: ["aRequest", "aResponse"],
  62465. 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]]]",
  62466. referencedClasses: [],
  62467. messageSends: ["parse:", "url", "join:with:", "basePath", "pathname", "exists:do:", "ifFalse:ifTrue:", "respondNotFoundTo:", "ifTrue:ifFalse:", "isDirectory", "statSync:", "respondDirectoryNamed:from:to:", "respondFileNamed:to:"]
  62468. }),
  62469. $globals.FileServer);
  62470. $core.addMethod(
  62471. $core.method({
  62472. selector: "handleOPTIONSRequest:respondTo:",
  62473. protocol: "request handling",
  62474. fn: function (aRequest,aResponse){
  62475. var self=this,$self=this;
  62476. return $core.withContext(function($ctx1) {
  62477. $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)]));
  62478. $recv(aResponse)._end();
  62479. return self;
  62480. }, function($ctx1) {$ctx1.fill(self,"handleOPTIONSRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  62481. },
  62482. args: ["aRequest", "aResponse"],
  62483. 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",
  62484. referencedClasses: [],
  62485. messageSends: ["writeHead:options:", "end"]
  62486. }),
  62487. $globals.FileServer);
  62488. $core.addMethod(
  62489. $core.method({
  62490. selector: "handlePUTRequest:respondTo:",
  62491. protocol: "request handling",
  62492. fn: function (aRequest,aResponse){
  62493. var self=this,$self=this;
  62494. var file,stream;
  62495. return $core.withContext(function($ctx1) {
  62496. var $1,$2,$3,$4;
  62497. $1=$self._isAuthenticated_(aRequest);
  62498. if(!$core.assert($1)){
  62499. $self._respondAuthenticationRequiredTo_(aResponse);
  62500. return nil;
  62501. }
  62502. file=".".__comma($recv(aRequest)._url());
  62503. $ctx1.sendIdx[","]=1;
  62504. stream=$recv($self["@fs"])._createWriteStream_(file);
  62505. $recv(stream)._on_do_("error",(function(error){
  62506. return $core.withContext(function($ctx2) {
  62507. $2=console;
  62508. $3="Error creating WriteStream for file ".__comma(file);
  62509. $ctx2.sendIdx[","]=2;
  62510. $recv($2)._warn_($3);
  62511. $ctx2.sendIdx["warn:"]=1;
  62512. $recv(console)._warn_(" Did you forget to create the necessary directory in your project (often /src)?");
  62513. $ctx2.sendIdx["warn:"]=2;
  62514. $recv(console)._warn_(" The exact error is: ".__comma(error));
  62515. return $self._respondNotCreatedTo_(aResponse);
  62516. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  62517. }));
  62518. $ctx1.sendIdx["on:do:"]=1;
  62519. $recv(stream)._on_do_("close",(function(){
  62520. return $core.withContext(function($ctx2) {
  62521. return $self._respondCreatedTo_(aResponse);
  62522. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  62523. }));
  62524. $ctx1.sendIdx["on:do:"]=2;
  62525. $recv(aRequest)._setEncoding_("utf8");
  62526. $recv(aRequest)._on_do_("data",(function(data){
  62527. return $core.withContext(function($ctx2) {
  62528. return $recv(stream)._write_(data);
  62529. }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1,4)});
  62530. }));
  62531. $ctx1.sendIdx["on:do:"]=3;
  62532. $recv(aRequest)._on_do_("end",(function(){
  62533. return $core.withContext(function($ctx2) {
  62534. $4=$recv(stream)._writable();
  62535. if($core.assert($4)){
  62536. return $recv(stream)._end();
  62537. }
  62538. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  62539. }));
  62540. return self;
  62541. }, function($ctx1) {$ctx1.fill(self,"handlePUTRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,file:file,stream:stream},$globals.FileServer)});
  62542. },
  62543. args: ["aRequest", "aResponse"],
  62544. 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]]",
  62545. referencedClasses: [],
  62546. messageSends: ["ifFalse:", "isAuthenticated:", "respondAuthenticationRequiredTo:", ",", "url", "createWriteStream:", "on:do:", "warn:", "respondNotCreatedTo:", "respondCreatedTo:", "setEncoding:", "write:", "ifTrue:", "writable", "end"]
  62547. }),
  62548. $globals.FileServer);
  62549. $core.addMethod(
  62550. $core.method({
  62551. selector: "handleRequest:respondTo:",
  62552. protocol: "request handling",
  62553. fn: function (aRequest,aResponse){
  62554. var self=this,$self=this;
  62555. return $core.withContext(function($ctx1) {
  62556. var $2,$1,$4,$3,$5;
  62557. $2=$recv(aRequest)._method();
  62558. $ctx1.sendIdx["method"]=1;
  62559. $1=$recv($2).__eq("PUT");
  62560. $ctx1.sendIdx["="]=1;
  62561. if($core.assert($1)){
  62562. $self._handlePUTRequest_respondTo_(aRequest,aResponse);
  62563. }
  62564. $4=$recv(aRequest)._method();
  62565. $ctx1.sendIdx["method"]=2;
  62566. $3=$recv($4).__eq("GET");
  62567. $ctx1.sendIdx["="]=2;
  62568. if($core.assert($3)){
  62569. $self._handleGETRequest_respondTo_(aRequest,aResponse);
  62570. }
  62571. $5=$recv($recv(aRequest)._method()).__eq("OPTIONS");
  62572. if($core.assert($5)){
  62573. $self._handleOPTIONSRequest_respondTo_(aRequest,aResponse);
  62574. }
  62575. return self;
  62576. }, function($ctx1) {$ctx1.fill(self,"handleRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  62577. },
  62578. args: ["aRequest", "aResponse"],
  62579. 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]",
  62580. referencedClasses: [],
  62581. messageSends: ["ifTrue:", "=", "method", "handlePUTRequest:respondTo:", "handleGETRequest:respondTo:", "handleOPTIONSRequest:respondTo:"]
  62582. }),
  62583. $globals.FileServer);
  62584. $core.addMethod(
  62585. $core.method({
  62586. selector: "host",
  62587. protocol: "accessing",
  62588. fn: function (){
  62589. var self=this,$self=this;
  62590. return $self["@host"];
  62591. },
  62592. args: [],
  62593. source: "host\x0a\x09^ host",
  62594. referencedClasses: [],
  62595. messageSends: []
  62596. }),
  62597. $globals.FileServer);
  62598. $core.addMethod(
  62599. $core.method({
  62600. selector: "host:",
  62601. protocol: "accessing",
  62602. fn: function (hostname){
  62603. var self=this,$self=this;
  62604. $self["@host"]=hostname;
  62605. return self;
  62606. },
  62607. args: ["hostname"],
  62608. source: "host: hostname\x0a\x09host := hostname",
  62609. referencedClasses: [],
  62610. messageSends: []
  62611. }),
  62612. $globals.FileServer);
  62613. $core.addMethod(
  62614. $core.method({
  62615. selector: "initialize",
  62616. protocol: "initialization",
  62617. fn: function (){
  62618. var self=this,$self=this;
  62619. return $core.withContext(function($ctx1) {
  62620. var $1;
  62621. (
  62622. $ctx1.supercall = true,
  62623. ($globals.FileServer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  62624. $ctx1.supercall = false;
  62625. $self["@http"]=$self._require_("http");
  62626. $ctx1.sendIdx["require:"]=1;
  62627. $self["@util"]=$self._require_("util");
  62628. $ctx1.sendIdx["require:"]=2;
  62629. $self["@url"]=$self._require_("url");
  62630. $1=$self._class();
  62631. $ctx1.sendIdx["class"]=1;
  62632. $self["@host"]=$recv($1)._defaultHost();
  62633. $self["@port"]=$recv($self._class())._defaultPort();
  62634. $self["@username"]=nil;
  62635. $self["@password"]=nil;
  62636. $self["@fallbackPage"]=nil;
  62637. return self;
  62638. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.FileServer)});
  62639. },
  62640. args: [],
  62641. 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.",
  62642. referencedClasses: [],
  62643. messageSends: ["initialize", "require:", "defaultHost", "class", "defaultPort"]
  62644. }),
  62645. $globals.FileServer);
  62646. $core.addMethod(
  62647. $core.method({
  62648. selector: "isAuthenticated:",
  62649. protocol: "private",
  62650. fn: function (aRequest){
  62651. var self=this,$self=this;
  62652. var header,token,auth,parts;
  62653. return $core.withContext(function($ctx1) {
  62654. var $2,$1,$3,$4,$5,$8,$9,$7,$6,$receiver;
  62655. var $early={};
  62656. try {
  62657. $2=$recv($self["@username"])._isNil();
  62658. $ctx1.sendIdx["isNil"]=1;
  62659. $1=$recv($2)._and_((function(){
  62660. return $core.withContext(function($ctx2) {
  62661. return $recv($self["@password"])._isNil();
  62662. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  62663. }));
  62664. $ctx1.sendIdx["and:"]=1;
  62665. if($core.assert($1)){
  62666. return true;
  62667. }
  62668. $3=$recv($recv(aRequest)._headers())._at_("authorization");
  62669. $ctx1.sendIdx["at:"]=1;
  62670. if(($receiver = $3) == null || $receiver.a$nil){
  62671. header="";
  62672. } else {
  62673. header=$3;
  62674. }
  62675. $recv(header)._ifEmpty_ifNotEmpty_((function(){
  62676. throw $early=[false];
  62677. }),(function(){
  62678. return $core.withContext(function($ctx2) {
  62679. $4=$recv(header)._tokenize_(" ");
  62680. $ctx2.sendIdx["tokenize:"]=1;
  62681. if(($receiver = $4) == null || $receiver.a$nil){
  62682. token="";
  62683. } else {
  62684. token=$4;
  62685. }
  62686. $5=$recv(token)._at_((2));
  62687. $ctx2.sendIdx["at:"]=2;
  62688. auth=$self._base64Decode_($5);
  62689. parts=$recv(auth)._tokenize_(":");
  62690. $8=$self["@username"];
  62691. $9=$recv(parts)._at_((1));
  62692. $ctx2.sendIdx["at:"]=3;
  62693. $7=$recv($8).__eq($9);
  62694. $ctx2.sendIdx["="]=1;
  62695. $6=$recv($7)._and_((function(){
  62696. return $core.withContext(function($ctx3) {
  62697. return $recv($self["@password"]).__eq($recv(parts)._at_((2)));
  62698. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  62699. }));
  62700. if($core.assert($6)){
  62701. throw $early=[true];
  62702. } else {
  62703. throw $early=[false];
  62704. }
  62705. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  62706. }));
  62707. return self;
  62708. }
  62709. catch(e) {if(e===$early)return e[0]; throw e}
  62710. }, function($ctx1) {$ctx1.fill(self,"isAuthenticated:",{aRequest:aRequest,header:header,token:token,auth:auth,parts:parts},$globals.FileServer)});
  62711. },
  62712. args: ["aRequest"],
  62713. 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].",
  62714. referencedClasses: [],
  62715. messageSends: ["ifTrue:", "and:", "isNil", "ifNil:", "at:", "headers", "ifEmpty:ifNotEmpty:", "tokenize:", "base64Decode:", "ifTrue:ifFalse:", "="]
  62716. }),
  62717. $globals.FileServer);
  62718. $core.addMethod(
  62719. $core.method({
  62720. selector: "password:",
  62721. protocol: "accessing",
  62722. fn: function (aPassword){
  62723. var self=this,$self=this;
  62724. $self["@password"]=aPassword;
  62725. return self;
  62726. },
  62727. args: ["aPassword"],
  62728. source: "password: aPassword\x0a\x09password := aPassword.",
  62729. referencedClasses: [],
  62730. messageSends: []
  62731. }),
  62732. $globals.FileServer);
  62733. $core.addMethod(
  62734. $core.method({
  62735. selector: "port",
  62736. protocol: "accessing",
  62737. fn: function (){
  62738. var self=this,$self=this;
  62739. return $self["@port"];
  62740. },
  62741. args: [],
  62742. source: "port\x0a\x09^ port",
  62743. referencedClasses: [],
  62744. messageSends: []
  62745. }),
  62746. $globals.FileServer);
  62747. $core.addMethod(
  62748. $core.method({
  62749. selector: "port:",
  62750. protocol: "accessing",
  62751. fn: function (aNumber){
  62752. var self=this,$self=this;
  62753. $self["@port"]=aNumber;
  62754. return self;
  62755. },
  62756. args: ["aNumber"],
  62757. source: "port: aNumber\x0a\x09port := aNumber",
  62758. referencedClasses: [],
  62759. messageSends: []
  62760. }),
  62761. $globals.FileServer);
  62762. $core.addMethod(
  62763. $core.method({
  62764. selector: "require:",
  62765. protocol: "private",
  62766. fn: function (aModuleString){
  62767. var self=this,$self=this;
  62768. return $core.withContext(function($ctx1) {
  62769. return $recv(require)._value_(aModuleString);
  62770. }, function($ctx1) {$ctx1.fill(self,"require:",{aModuleString:aModuleString},$globals.FileServer)});
  62771. },
  62772. args: ["aModuleString"],
  62773. source: "require: aModuleString\x0a\x09\x22call to the require function\x22\x0a\x09^require value: aModuleString",
  62774. referencedClasses: [],
  62775. messageSends: ["value:"]
  62776. }),
  62777. $globals.FileServer);
  62778. $core.addMethod(
  62779. $core.method({
  62780. selector: "respondAuthenticationRequiredTo:",
  62781. protocol: "request handling",
  62782. fn: function (aResponse){
  62783. var self=this,$self=this;
  62784. return $core.withContext(function($ctx1) {
  62785. $recv(aResponse)._writeHead_options_((401),$globals.HashedCollection._newFromPairs_(["WWW-Authenticate","Basic realm=\x22Secured Developer Area\x22"]));
  62786. $recv(aResponse)._write_("<html><body>Authentication needed</body></html>");
  62787. $recv(aResponse)._end();
  62788. return self;
  62789. }, function($ctx1) {$ctx1.fill(self,"respondAuthenticationRequiredTo:",{aResponse:aResponse},$globals.FileServer)});
  62790. },
  62791. args: ["aResponse"],
  62792. 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.",
  62793. referencedClasses: [],
  62794. messageSends: ["writeHead:options:", "write:", "end"]
  62795. }),
  62796. $globals.FileServer);
  62797. $core.addMethod(
  62798. $core.method({
  62799. selector: "respondCreatedTo:",
  62800. protocol: "request handling",
  62801. fn: function (aResponse){
  62802. var self=this,$self=this;
  62803. return $core.withContext(function($ctx1) {
  62804. $recv(aResponse)._writeHead_options_((201),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  62805. $recv(aResponse)._end();
  62806. return self;
  62807. }, function($ctx1) {$ctx1.fill(self,"respondCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  62808. },
  62809. args: ["aResponse"],
  62810. source: "respondCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 201 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  62811. referencedClasses: [],
  62812. messageSends: ["writeHead:options:", "end"]
  62813. }),
  62814. $globals.FileServer);
  62815. $core.addMethod(
  62816. $core.method({
  62817. selector: "respondDirectoryNamed:from:to:",
  62818. protocol: "request handling",
  62819. fn: function (aDirname,aUrl,aResponse){
  62820. var self=this,$self=this;
  62821. return $core.withContext(function($ctx1) {
  62822. var $2,$1,$3,$5,$7,$6,$4,$receiver;
  62823. $2=$recv(aUrl)._pathname();
  62824. $ctx1.sendIdx["pathname"]=1;
  62825. $1=$recv($2)._endsWith_("/");
  62826. if($core.assert($1)){
  62827. $3=$recv(aDirname).__comma("index.html");
  62828. $ctx1.sendIdx[","]=1;
  62829. $self._respondFileNamed_to_($3,aResponse);
  62830. } else {
  62831. $5=$recv($recv(aUrl)._pathname()).__comma("/");
  62832. $7=$recv(aUrl)._search();
  62833. if(($receiver = $7) == null || $receiver.a$nil){
  62834. $6="";
  62835. } else {
  62836. $6=$7;
  62837. }
  62838. $4=$recv($5).__comma($6);
  62839. $ctx1.sendIdx[","]=2;
  62840. $self._respondRedirect_to_($4,aResponse);
  62841. }
  62842. return self;
  62843. }, function($ctx1) {$ctx1.fill(self,"respondDirectoryNamed:from:to:",{aDirname:aDirname,aUrl:aUrl,aResponse:aResponse},$globals.FileServer)});
  62844. },
  62845. args: ["aDirname", "aUrl", "aResponse"],
  62846. 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]",
  62847. referencedClasses: [],
  62848. messageSends: ["ifTrue:ifFalse:", "endsWith:", "pathname", "respondFileNamed:to:", ",", "respondRedirect:to:", "ifNil:", "search"]
  62849. }),
  62850. $globals.FileServer);
  62851. $core.addMethod(
  62852. $core.method({
  62853. selector: "respondFileNamed:to:",
  62854. protocol: "request handling",
  62855. fn: function (aFilename,aResponse){
  62856. var self=this,$self=this;
  62857. var type,filename;
  62858. return $core.withContext(function($ctx1) {
  62859. var $1,$2,$3,$4;
  62860. filename=aFilename;
  62861. $recv($self["@fs"])._readFile_do_(filename,(function(ex,file){
  62862. return $core.withContext(function($ctx2) {
  62863. $1=$recv(ex)._notNil();
  62864. if($core.assert($1)){
  62865. $2=console;
  62866. $3=$recv(filename).__comma(" does not exist");
  62867. $ctx2.sendIdx[","]=1;
  62868. $recv($2)._log_($3);
  62869. return $self._respondNotFoundTo_(aResponse);
  62870. } else {
  62871. type=$recv($self._class())._mimeTypeFor_(filename);
  62872. $4=$recv(type).__eq("application/javascript");
  62873. if($core.assert($4)){
  62874. type=$recv(type).__comma(";charset=utf-8");
  62875. type;
  62876. }
  62877. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type",type]));
  62878. $recv(aResponse)._write_encoding_(file,"binary");
  62879. return $recv(aResponse)._end();
  62880. }
  62881. }, function($ctx2) {$ctx2.fillBlock({ex:ex,file:file},$ctx1,1)});
  62882. }));
  62883. return self;
  62884. }, function($ctx1) {$ctx1.fill(self,"respondFileNamed:to:",{aFilename:aFilename,aResponse:aResponse,type:type,filename:filename},$globals.FileServer)});
  62885. },
  62886. args: ["aFilename", "aResponse"],
  62887. 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]]",
  62888. referencedClasses: [],
  62889. messageSends: ["readFile:do:", "ifTrue:ifFalse:", "notNil", "log:", ",", "respondNotFoundTo:", "mimeTypeFor:", "class", "ifTrue:", "=", "writeHead:options:", "write:encoding:", "end"]
  62890. }),
  62891. $globals.FileServer);
  62892. $core.addMethod(
  62893. $core.method({
  62894. selector: "respondInternalErrorTo:",
  62895. protocol: "request handling",
  62896. fn: function (aResponse){
  62897. var self=this,$self=this;
  62898. return $core.withContext(function($ctx1) {
  62899. $recv(aResponse)._writeHead_options_((500),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  62900. $recv(aResponse)._write_("500 Internal server error");
  62901. $recv(aResponse)._end();
  62902. return self;
  62903. }, function($ctx1) {$ctx1.fill(self,"respondInternalErrorTo:",{aResponse:aResponse},$globals.FileServer)});
  62904. },
  62905. args: ["aResponse"],
  62906. source: "respondInternalErrorTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 500 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '500 Internal server error';\x0a\x09\x09end",
  62907. referencedClasses: [],
  62908. messageSends: ["writeHead:options:", "write:", "end"]
  62909. }),
  62910. $globals.FileServer);
  62911. $core.addMethod(
  62912. $core.method({
  62913. selector: "respondNotCreatedTo:",
  62914. protocol: "request handling",
  62915. fn: function (aResponse){
  62916. var self=this,$self=this;
  62917. return $core.withContext(function($ctx1) {
  62918. $recv(aResponse)._writeHead_options_((400),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  62919. $recv(aResponse)._write_("File could not be created. Did you forget to create the src directory on the server?");
  62920. $recv(aResponse)._end();
  62921. return self;
  62922. }, function($ctx1) {$ctx1.fill(self,"respondNotCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  62923. },
  62924. args: ["aResponse"],
  62925. 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.",
  62926. referencedClasses: [],
  62927. messageSends: ["writeHead:options:", "write:", "end"]
  62928. }),
  62929. $globals.FileServer);
  62930. $core.addMethod(
  62931. $core.method({
  62932. selector: "respondNotFoundTo:",
  62933. protocol: "request handling",
  62934. fn: function (aResponse){
  62935. var self=this,$self=this;
  62936. return $core.withContext(function($ctx1) {
  62937. var $2,$1;
  62938. $2=$self._fallbackPage();
  62939. $ctx1.sendIdx["fallbackPage"]=1;
  62940. $1=$recv($2)._isNil();
  62941. if(!$core.assert($1)){
  62942. return $self._respondFileNamed_to_($self._fallbackPage(),aResponse);
  62943. }
  62944. $recv(aResponse)._writeHead_options_((404),$globals.HashedCollection._newFromPairs_(["Content-Type","text/html"]));
  62945. $recv(aResponse)._write_("<html><body><p>404 Not found</p>");
  62946. $ctx1.sendIdx["write:"]=1;
  62947. $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>");
  62948. $ctx1.sendIdx["write:"]=2;
  62949. $recv(aResponse)._write_("<li>create an index.html in the served directory.</li>");
  62950. $ctx1.sendIdx["write:"]=3;
  62951. $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>");
  62952. $ctx1.sendIdx["write:"]=4;
  62953. $recv(aResponse)._write_("<li>change the directory to be served with the \x22--base-path\x22 option.</li>");
  62954. $ctx1.sendIdx["write:"]=5;
  62955. $recv(aResponse)._write_("</ul></p></body></html>");
  62956. $recv(aResponse)._end();
  62957. return self;
  62958. }, function($ctx1) {$ctx1.fill(self,"respondNotFoundTo:",{aResponse:aResponse},$globals.FileServer)});
  62959. },
  62960. args: ["aResponse"],
  62961. 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",
  62962. referencedClasses: [],
  62963. messageSends: ["ifFalse:", "isNil", "fallbackPage", "respondFileNamed:to:", "writeHead:options:", "write:", "end"]
  62964. }),
  62965. $globals.FileServer);
  62966. $core.addMethod(
  62967. $core.method({
  62968. selector: "respondOKTo:",
  62969. protocol: "request handling",
  62970. fn: function (aResponse){
  62971. var self=this,$self=this;
  62972. return $core.withContext(function($ctx1) {
  62973. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  62974. $recv(aResponse)._end();
  62975. return self;
  62976. }, function($ctx1) {$ctx1.fill(self,"respondOKTo:",{aResponse:aResponse},$globals.FileServer)});
  62977. },
  62978. args: ["aResponse"],
  62979. source: "respondOKTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 200 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  62980. referencedClasses: [],
  62981. messageSends: ["writeHead:options:", "end"]
  62982. }),
  62983. $globals.FileServer);
  62984. $core.addMethod(
  62985. $core.method({
  62986. selector: "respondRedirect:to:",
  62987. protocol: "request handling",
  62988. fn: function (aString,aResponse){
  62989. var self=this,$self=this;
  62990. return $core.withContext(function($ctx1) {
  62991. $recv(aResponse)._writeHead_options_((303),$globals.HashedCollection._newFromPairs_(["Location",aString]));
  62992. $recv(aResponse)._end();
  62993. return self;
  62994. }, function($ctx1) {$ctx1.fill(self,"respondRedirect:to:",{aString:aString,aResponse:aResponse},$globals.FileServer)});
  62995. },
  62996. args: ["aString", "aResponse"],
  62997. source: "respondRedirect: aString to: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 303 options: #{'Location' -> aString};\x0a\x09\x09end.",
  62998. referencedClasses: [],
  62999. messageSends: ["writeHead:options:", "end"]
  63000. }),
  63001. $globals.FileServer);
  63002. $core.addMethod(
  63003. $core.method({
  63004. selector: "start",
  63005. protocol: "starting",
  63006. fn: function (){
  63007. var self=this,$self=this;
  63008. return $core.withContext(function($ctx1) {
  63009. var $1,$2,$3,$4,$8,$7,$6,$10,$9,$5;
  63010. $self._checkDirectoryLayout();
  63011. $1=$recv($self["@http"])._createServer_((function(request,response){
  63012. return $core.withContext(function($ctx2) {
  63013. return $self._handleRequest_respondTo_(request,response);
  63014. }, function($ctx2) {$ctx2.fillBlock({request:request,response:response},$ctx1,1)});
  63015. }));
  63016. $recv($1)._on_do_("error",(function(error){
  63017. return $core.withContext(function($ctx2) {
  63018. $2=console;
  63019. $3="Error starting server: ".__comma(error);
  63020. $ctx2.sendIdx[","]=1;
  63021. return $recv($2)._log_($3);
  63022. $ctx2.sendIdx["log:"]=1;
  63023. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  63024. }));
  63025. $ctx1.sendIdx["on:do:"]=1;
  63026. $recv($1)._on_do_("listening",(function(){
  63027. return $core.withContext(function($ctx2) {
  63028. $4=console;
  63029. $8=$self._host();
  63030. $ctx2.sendIdx["host"]=1;
  63031. $7="Starting file server on http://".__comma($8);
  63032. $6=$recv($7).__comma(":");
  63033. $ctx2.sendIdx[","]=3;
  63034. $10=$self._port();
  63035. $ctx2.sendIdx["port"]=1;
  63036. $9=$recv($10)._asString();
  63037. $5=$recv($6).__comma($9);
  63038. $ctx2.sendIdx[","]=2;
  63039. return $recv($4)._log_($5);
  63040. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  63041. }));
  63042. $recv($1)._listen_host_($self._port(),$self._host());
  63043. return self;
  63044. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.FileServer)});
  63045. },
  63046. args: [],
  63047. 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.",
  63048. referencedClasses: [],
  63049. messageSends: ["checkDirectoryLayout", "on:do:", "createServer:", "handleRequest:respondTo:", "log:", ",", "host", "asString", "port", "listen:host:"]
  63050. }),
  63051. $globals.FileServer);
  63052. $core.addMethod(
  63053. $core.method({
  63054. selector: "startOn:",
  63055. protocol: "starting",
  63056. fn: function (aPort){
  63057. var self=this,$self=this;
  63058. return $core.withContext(function($ctx1) {
  63059. $self._port_(aPort);
  63060. $self._start();
  63061. return self;
  63062. }, function($ctx1) {$ctx1.fill(self,"startOn:",{aPort:aPort},$globals.FileServer)});
  63063. },
  63064. args: ["aPort"],
  63065. source: "startOn: aPort\x0a\x09self port: aPort.\x0a\x09self start",
  63066. referencedClasses: [],
  63067. messageSends: ["port:", "start"]
  63068. }),
  63069. $globals.FileServer);
  63070. $core.addMethod(
  63071. $core.method({
  63072. selector: "username:",
  63073. protocol: "accessing",
  63074. fn: function (aUsername){
  63075. var self=this,$self=this;
  63076. $self["@username"]=aUsername;
  63077. return self;
  63078. },
  63079. args: ["aUsername"],
  63080. source: "username: aUsername\x0a\x09username := aUsername.",
  63081. referencedClasses: [],
  63082. messageSends: []
  63083. }),
  63084. $globals.FileServer);
  63085. $core.addMethod(
  63086. $core.method({
  63087. selector: "validateBasePath",
  63088. protocol: "private",
  63089. fn: function (){
  63090. var self=this,$self=this;
  63091. return $core.withContext(function($ctx1) {
  63092. var $1,$2,$3,$4,$7,$6,$5,$8,$9,$receiver;
  63093. $1=$self["@fs"];
  63094. $2=$self._basePath();
  63095. $ctx1.sendIdx["basePath"]=1;
  63096. $recv($1)._stat_then_($2,(function(err,stat){
  63097. return $core.withContext(function($ctx2) {
  63098. if(($receiver = err) == null || $receiver.a$nil){
  63099. $3=$recv(stat)._isDirectory();
  63100. if(!$core.assert($3)){
  63101. $4=console;
  63102. $7=$self._basePath();
  63103. $ctx2.sendIdx["basePath"]=2;
  63104. $6="Warning: --base-path parameter ".__comma($7);
  63105. $ctx2.sendIdx[","]=2;
  63106. $5=$recv($6).__comma(" is not a directory.");
  63107. $ctx2.sendIdx[","]=1;
  63108. return $recv($4)._warn_($5);
  63109. $ctx2.sendIdx["warn:"]=1;
  63110. }
  63111. } else {
  63112. $8=console;
  63113. $9=$recv("Warning: path at --base-path parameter ".__comma($self._basePath())).__comma(" does not exist.");
  63114. $ctx2.sendIdx[","]=3;
  63115. return $recv($8)._warn_($9);
  63116. }
  63117. }, function($ctx2) {$ctx2.fillBlock({err:err,stat:stat},$ctx1,1)});
  63118. }));
  63119. return self;
  63120. }, function($ctx1) {$ctx1.fill(self,"validateBasePath",{},$globals.FileServer)});
  63121. },
  63122. args: [],
  63123. 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.' ]].",
  63124. referencedClasses: [],
  63125. messageSends: ["stat:then:", "basePath", "ifNil:ifNotNil:", "ifFalse:", "isDirectory", "warn:", ","]
  63126. }),
  63127. $globals.FileServer);
  63128. $core.addMethod(
  63129. $core.method({
  63130. selector: "withBasePath:",
  63131. protocol: "private",
  63132. fn: function (aBaseRelativePath){
  63133. var self=this,$self=this;
  63134. return $core.withContext(function($ctx1) {
  63135. return $recv($self["@path"])._join_with_($self._basePath(),aBaseRelativePath);
  63136. }, function($ctx1) {$ctx1.fill(self,"withBasePath:",{aBaseRelativePath:aBaseRelativePath},$globals.FileServer)});
  63137. },
  63138. args: ["aBaseRelativePath"],
  63139. source: "withBasePath: aBaseRelativePath\x0a\x09\x22return a file path which is relative to the basePath.\x22\x0a\x09^ path join: self basePath with: aBaseRelativePath",
  63140. referencedClasses: [],
  63141. messageSends: ["join:with:", "basePath"]
  63142. }),
  63143. $globals.FileServer);
  63144. $core.addMethod(
  63145. $core.method({
  63146. selector: "writeData:toFileNamed:",
  63147. protocol: "private",
  63148. fn: function (data,aFilename){
  63149. var self=this,$self=this;
  63150. return $core.withContext(function($ctx1) {
  63151. $recv(console)._log_(aFilename);
  63152. return self;
  63153. }, function($ctx1) {$ctx1.fill(self,"writeData:toFileNamed:",{data:data,aFilename:aFilename},$globals.FileServer)});
  63154. },
  63155. args: ["data", "aFilename"],
  63156. source: "writeData: data toFileNamed: aFilename\x0a\x09console log: aFilename",
  63157. referencedClasses: [],
  63158. messageSends: ["log:"]
  63159. }),
  63160. $globals.FileServer);
  63161. $globals.FileServer.a$cls.iVarNames = ["mimeTypes"];
  63162. $core.addMethod(
  63163. $core.method({
  63164. selector: "commandLineSwitches",
  63165. protocol: "accessing",
  63166. fn: function (){
  63167. var self=this,$self=this;
  63168. var switches;
  63169. return $core.withContext(function($ctx1) {
  63170. switches=$recv($self._methodsInProtocol_("accessing"))._collect_((function(each){
  63171. return $core.withContext(function($ctx2) {
  63172. return $recv(each)._selector();
  63173. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63174. }));
  63175. $ctx1.sendIdx["collect:"]=1;
  63176. switches=$recv(switches)._select_((function(each){
  63177. return $core.withContext(function($ctx2) {
  63178. return $recv(each)._match_("^[^:]*:$");
  63179. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  63180. }));
  63181. switches=$recv(switches)._collect_((function(each){
  63182. return $core.withContext(function($ctx2) {
  63183. return $recv($recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase())._replace_with_("^([a-z])","--$1");
  63184. $ctx2.sendIdx["replace:with:"]=1;
  63185. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  63186. }));
  63187. return switches;
  63188. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.FileServer.a$cls)});
  63189. },
  63190. args: [],
  63191. 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",
  63192. referencedClasses: [],
  63193. messageSends: ["collect:", "methodsInProtocol:", "selector", "select:", "match:", "replace:with:", "asLowercase", "allButLast"]
  63194. }),
  63195. $globals.FileServer.a$cls);
  63196. $core.addMethod(
  63197. $core.method({
  63198. selector: "createServerWithArguments:",
  63199. protocol: "initialization",
  63200. fn: function (options){
  63201. var self=this,$self=this;
  63202. var server,popFront,front,optionName,optionValue,switches;
  63203. return $core.withContext(function($ctx1) {
  63204. var $1,$2,$3,$4,$5,$6,$7,$8;
  63205. var $early={};
  63206. try {
  63207. switches=$self._commandLineSwitches();
  63208. server=$self._new();
  63209. $recv(options)._ifEmpty_((function(){
  63210. throw $early=[server];
  63211. }));
  63212. $1=$recv($recv(options)._size())._even();
  63213. if(!$core.assert($1)){
  63214. $recv(console)._log_("Using default parameters.");
  63215. $ctx1.sendIdx["log:"]=1;
  63216. $2=console;
  63217. $3="Wrong commandline options or not enough arguments for: ".__comma(options);
  63218. $ctx1.sendIdx[","]=1;
  63219. $recv($2)._log_($3);
  63220. $ctx1.sendIdx["log:"]=2;
  63221. $4=console;
  63222. $5="Use any of the following ones: ".__comma(switches);
  63223. $ctx1.sendIdx[","]=2;
  63224. $recv($4)._log_($5);
  63225. $ctx1.sendIdx["log:"]=3;
  63226. return server;
  63227. }
  63228. popFront=(function(args){
  63229. return $core.withContext(function($ctx2) {
  63230. front=$recv(args)._first();
  63231. $recv(args)._remove_(front);
  63232. return front;
  63233. }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1,3)});
  63234. });
  63235. $recv((function(){
  63236. return $core.withContext(function($ctx2) {
  63237. return $recv(options)._notEmpty();
  63238. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  63239. }))._whileTrue_((function(){
  63240. return $core.withContext(function($ctx2) {
  63241. optionName=$recv(popFront)._value_(options);
  63242. $ctx2.sendIdx["value:"]=1;
  63243. optionValue=$recv(popFront)._value_(options);
  63244. $6=$recv(switches)._includes_(optionName);
  63245. if($core.assert($6)){
  63246. optionName=$self._selectorForCommandLineSwitch_(optionName);
  63247. return $recv(server)._perform_withArguments_(optionName,$recv($globals.Array)._with_(optionValue));
  63248. } else {
  63249. $7=console;
  63250. $8=$recv(optionName).__comma(" is not a valid commandline option");
  63251. $ctx2.sendIdx[","]=3;
  63252. $recv($7)._log_($8);
  63253. $ctx2.sendIdx["log:"]=4;
  63254. return $recv(console)._log_("Use any of the following ones: ".__comma(switches));
  63255. }
  63256. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  63257. }));
  63258. return server;
  63259. }
  63260. catch(e) {if(e===$early)return e[0]; throw e}
  63261. }, function($ctx1) {$ctx1.fill(self,"createServerWithArguments:",{options:options,server:server,popFront:popFront,front:front,optionName:optionName,optionValue:optionValue,switches:switches},$globals.FileServer.a$cls)});
  63262. },
  63263. args: ["options"],
  63264. 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.",
  63265. referencedClasses: ["Array"],
  63266. messageSends: ["commandLineSwitches", "new", "ifEmpty:", "ifFalse:", "even", "size", "log:", ",", "first", "remove:", "whileTrue:", "notEmpty", "value:", "ifTrue:ifFalse:", "includes:", "selectorForCommandLineSwitch:", "perform:withArguments:", "with:"]
  63267. }),
  63268. $globals.FileServer.a$cls);
  63269. $core.addMethod(
  63270. $core.method({
  63271. selector: "defaultBasePath",
  63272. protocol: "accessing",
  63273. fn: function (){
  63274. var self=this,$self=this;
  63275. return "./";
  63276. },
  63277. args: [],
  63278. source: "defaultBasePath\x0a\x09^ './'",
  63279. referencedClasses: [],
  63280. messageSends: []
  63281. }),
  63282. $globals.FileServer.a$cls);
  63283. $core.addMethod(
  63284. $core.method({
  63285. selector: "defaultHost",
  63286. protocol: "accessing",
  63287. fn: function (){
  63288. var self=this,$self=this;
  63289. return "127.0.0.1";
  63290. },
  63291. args: [],
  63292. source: "defaultHost\x0a\x09^ '127.0.0.1'",
  63293. referencedClasses: [],
  63294. messageSends: []
  63295. }),
  63296. $globals.FileServer.a$cls);
  63297. $core.addMethod(
  63298. $core.method({
  63299. selector: "defaultMimeTypes",
  63300. protocol: "accessing",
  63301. fn: function (){
  63302. var self=this,$self=this;
  63303. 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"]);
  63304. },
  63305. args: [],
  63306. 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}",
  63307. referencedClasses: [],
  63308. messageSends: []
  63309. }),
  63310. $globals.FileServer.a$cls);
  63311. $core.addMethod(
  63312. $core.method({
  63313. selector: "defaultPort",
  63314. protocol: "accessing",
  63315. fn: function (){
  63316. var self=this,$self=this;
  63317. return (4000);
  63318. },
  63319. args: [],
  63320. source: "defaultPort\x0a\x09^ 4000",
  63321. referencedClasses: [],
  63322. messageSends: []
  63323. }),
  63324. $globals.FileServer.a$cls);
  63325. $core.addMethod(
  63326. $core.method({
  63327. selector: "main",
  63328. protocol: "initialization",
  63329. fn: function (){
  63330. var self=this,$self=this;
  63331. var fileServer,args;
  63332. return $core.withContext(function($ctx1) {
  63333. var $1;
  63334. var $early={};
  63335. try {
  63336. args=$recv(process)._argv();
  63337. $recv(args)._removeFrom_to_((1),(3));
  63338. $recv(args)._detect_ifNone_((function(each){
  63339. return $core.withContext(function($ctx2) {
  63340. $1=$recv(each).__eq("--help");
  63341. if($core.assert($1)){
  63342. return $recv($globals.FileServer)._printHelp();
  63343. }
  63344. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63345. }),(function(){
  63346. return $core.withContext(function($ctx2) {
  63347. fileServer=$recv($globals.FileServer)._createServerWithArguments_(args);
  63348. throw $early=[$recv(fileServer)._start()];
  63349. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  63350. }));
  63351. return self;
  63352. }
  63353. catch(e) {if(e===$early)return e[0]; throw e}
  63354. }, function($ctx1) {$ctx1.fill(self,"main",{fileServer:fileServer,args:args},$globals.FileServer.a$cls)});
  63355. },
  63356. args: [],
  63357. 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]",
  63358. referencedClasses: ["FileServer"],
  63359. messageSends: ["argv", "removeFrom:to:", "detect:ifNone:", "ifTrue:", "=", "printHelp", "createServerWithArguments:", "start"]
  63360. }),
  63361. $globals.FileServer.a$cls);
  63362. $core.addMethod(
  63363. $core.method({
  63364. selector: "mimeTypeFor:",
  63365. protocol: "accessing",
  63366. fn: function (aString){
  63367. var self=this,$self=this;
  63368. return $core.withContext(function($ctx1) {
  63369. return $recv($self._mimeTypes())._at_ifAbsent_($recv(aString)._replace_with_(".*[\x5c.]",""),(function(){
  63370. return "text/plain";
  63371. }));
  63372. }, function($ctx1) {$ctx1.fill(self,"mimeTypeFor:",{aString:aString},$globals.FileServer.a$cls)});
  63373. },
  63374. args: ["aString"],
  63375. source: "mimeTypeFor: aString\x0a\x09^ self mimeTypes at: (aString replace: '.*[\x5c.]' with: '') ifAbsent: ['text/plain']",
  63376. referencedClasses: [],
  63377. messageSends: ["at:ifAbsent:", "mimeTypes", "replace:with:"]
  63378. }),
  63379. $globals.FileServer.a$cls);
  63380. $core.addMethod(
  63381. $core.method({
  63382. selector: "mimeTypes",
  63383. protocol: "accessing",
  63384. fn: function (){
  63385. var self=this,$self=this;
  63386. return $core.withContext(function($ctx1) {
  63387. var $1,$receiver;
  63388. $1=$self["@mimeTypes"];
  63389. if(($receiver = $1) == null || $receiver.a$nil){
  63390. $self["@mimeTypes"]=$self._defaultMimeTypes();
  63391. return $self["@mimeTypes"];
  63392. } else {
  63393. return $1;
  63394. }
  63395. }, function($ctx1) {$ctx1.fill(self,"mimeTypes",{},$globals.FileServer.a$cls)});
  63396. },
  63397. args: [],
  63398. source: "mimeTypes\x0a\x09^ mimeTypes ifNil: [mimeTypes := self defaultMimeTypes]",
  63399. referencedClasses: [],
  63400. messageSends: ["ifNil:", "defaultMimeTypes"]
  63401. }),
  63402. $globals.FileServer.a$cls);
  63403. $core.addMethod(
  63404. $core.method({
  63405. selector: "printHelp",
  63406. protocol: "accessing",
  63407. fn: function (){
  63408. var self=this,$self=this;
  63409. return $core.withContext(function($ctx1) {
  63410. $recv(console)._log_("Available commandline options are:");
  63411. $ctx1.sendIdx["log:"]=1;
  63412. $recv(console)._log_("--help");
  63413. $ctx1.sendIdx["log:"]=2;
  63414. $recv($self._commandLineSwitches())._do_((function(each){
  63415. return $core.withContext(function($ctx2) {
  63416. return $recv(console)._log_($recv(each).__comma(" <parameter>"));
  63417. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63418. }));
  63419. return self;
  63420. }, function($ctx1) {$ctx1.fill(self,"printHelp",{},$globals.FileServer.a$cls)});
  63421. },
  63422. args: [],
  63423. source: "printHelp\x0a\x09console log: 'Available commandline options are:'.\x0a\x09console log: '--help'.\x0a\x09self commandLineSwitches do: [ :each |\x0a\x09\x09console log: each, ' <parameter>']",
  63424. referencedClasses: [],
  63425. messageSends: ["log:", "do:", "commandLineSwitches", ","]
  63426. }),
  63427. $globals.FileServer.a$cls);
  63428. $core.addMethod(
  63429. $core.method({
  63430. selector: "selectorForCommandLineSwitch:",
  63431. protocol: "accessing",
  63432. fn: function (aSwitch){
  63433. var self=this,$self=this;
  63434. return $core.withContext(function($ctx1) {
  63435. var $1;
  63436. $1=$recv($recv(aSwitch)._replace_with_("^--",""))._replace_with_("-[a-z]",(function(each){
  63437. return $core.withContext(function($ctx2) {
  63438. return $recv($recv(each)._second())._asUppercase();
  63439. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63440. }));
  63441. $ctx1.sendIdx["replace:with:"]=1;
  63442. return $recv($1).__comma(":");
  63443. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch},$globals.FileServer.a$cls)});
  63444. },
  63445. args: ["aSwitch"],
  63446. 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 ]), ':'",
  63447. referencedClasses: [],
  63448. messageSends: [",", "replace:with:", "asUppercase", "second"]
  63449. }),
  63450. $globals.FileServer.a$cls);
  63451. $core.addClass("Initer", $globals.BaseFileManipulator, ["childProcess", "nmPath"], "AmberCli");
  63452. $core.addMethod(
  63453. $core.method({
  63454. selector: "finishMessage",
  63455. protocol: "action",
  63456. fn: function (){
  63457. var self=this,$self=this;
  63458. return $core.withContext(function($ctx1) {
  63459. $recv(console)._log_([" ", "The project should now be set up.", " ", " "]._join_($recv($globals.String)._lf()));
  63460. $recv((function(){
  63461. }))._valueWithTimeout_((600));
  63462. return self;
  63463. }, function($ctx1) {$ctx1.fill(self,"finishMessage",{},$globals.Initer)});
  63464. },
  63465. args: [],
  63466. 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",
  63467. referencedClasses: ["String"],
  63468. messageSends: ["log:", "join:", "lf", "valueWithTimeout:"]
  63469. }),
  63470. $globals.Initer);
  63471. $core.addMethod(
  63472. $core.method({
  63473. selector: "gruntInitThenDo:",
  63474. protocol: "action",
  63475. fn: function (aBlock){
  63476. var self=this,$self=this;
  63477. var child,sanitizedTemplatePath;
  63478. return $core.withContext(function($ctx1) {
  63479. var $1,$3,$2;
  63480. sanitizedTemplatePath=$recv($recv($recv($self["@path"])._join_with_($self["@nmPath"],"@ambers/grunt-init-amber-project"))._replace_with_("\x5c\x5c","\x5c\x5c"))._replace_with_(":","\x5c:");
  63481. $ctx1.sendIdx["replace:with:"]=1;
  63482. child=$recv($self["@childProcess"])._fork_args_($self._npmScriptForModule_named_("grunt-init","grunt-init"),[sanitizedTemplatePath]);
  63483. $1=child;
  63484. $recv($1)._on_do_("error",aBlock);
  63485. $ctx1.sendIdx["on:do:"]=1;
  63486. $recv($1)._on_do_("close",(function(code){
  63487. return $core.withContext(function($ctx2) {
  63488. $3=$recv(code).__eq((0));
  63489. if($core.assert($3)){
  63490. $2=nil;
  63491. } else {
  63492. $2=code;
  63493. }
  63494. return $recv(aBlock)._value_($2);
  63495. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  63496. }));
  63497. return self;
  63498. }, function($ctx1) {$ctx1.fill(self,"gruntInitThenDo:",{aBlock:aBlock,child:child,sanitizedTemplatePath:sanitizedTemplatePath},$globals.Initer)});
  63499. },
  63500. args: ["aBlock"],
  63501. 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 ]) ]",
  63502. referencedClasses: [],
  63503. messageSends: ["replace:with:", "join:with:", "fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  63504. }),
  63505. $globals.Initer);
  63506. $core.addMethod(
  63507. $core.method({
  63508. selector: "initProjectThenDo:",
  63509. protocol: "action",
  63510. fn: function (aBlock){
  63511. var self=this,$self=this;
  63512. var child;
  63513. return $core.withContext(function($ctx1) {
  63514. var $1;
  63515. child=$recv($self["@childProcess"])._exec_thenDo_("npm run init",aBlock);
  63516. $1=$recv(child)._stdout();
  63517. $ctx1.sendIdx["stdout"]=1;
  63518. $recv($1)._pipe_options_($recv(process)._stdout(),$globals.HashedCollection._newFromPairs_(["end",false]));
  63519. return self;
  63520. }, function($ctx1) {$ctx1.fill(self,"initProjectThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  63521. },
  63522. args: ["aBlock"],
  63523. 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 }",
  63524. referencedClasses: [],
  63525. messageSends: ["exec:thenDo:", "pipe:options:", "stdout"]
  63526. }),
  63527. $globals.Initer);
  63528. $core.addMethod(
  63529. $core.method({
  63530. selector: "initialize",
  63531. protocol: "initialization",
  63532. fn: function (){
  63533. var self=this,$self=this;
  63534. return $core.withContext(function($ctx1) {
  63535. (
  63536. $ctx1.supercall = true,
  63537. ($globals.Initer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  63538. $ctx1.supercall = false;
  63539. $self["@childProcess"]=$recv(require)._value_("child_process");
  63540. $self["@nmPath"]=$recv($self["@path"])._join_with_($self._rootDirname(),"node_modules");
  63541. return self;
  63542. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Initer)});
  63543. },
  63544. args: [],
  63545. source: "initialize\x0a\x09super initialize.\x0a\x09childProcess := require value: 'child_process'.\x0a\x09nmPath := path join: self rootDirname with: 'node_modules'",
  63546. referencedClasses: [],
  63547. messageSends: ["initialize", "value:", "join:with:", "rootDirname"]
  63548. }),
  63549. $globals.Initer);
  63550. $core.addMethod(
  63551. $core.method({
  63552. selector: "npmScriptForModule:named:",
  63553. protocol: "npm",
  63554. fn: function (aString,anotherString){
  63555. var self=this,$self=this;
  63556. var modulePath,packageJson,binSection,scriptPath;
  63557. return $core.withContext(function($ctx1) {
  63558. var $1,$3,$4,$2,$5;
  63559. $1=$self["@path"];
  63560. $3=$recv(require)._provided();
  63561. $4=$recv(aString).__comma("/package.json");
  63562. $ctx1.sendIdx[","]=1;
  63563. $2=$recv($3)._resolve_($4);
  63564. modulePath=$recv($1)._dirname_($2);
  63565. packageJson=$recv($globals.Smalltalk)._readJSObject_($recv(require)._value_($recv(aString).__comma("/package.json")));
  63566. binSection=$recv(packageJson)._at_("bin");
  63567. $ctx1.sendIdx["at:"]=1;
  63568. $5=$recv(binSection)._isString();
  63569. if($core.assert($5)){
  63570. scriptPath=binSection;
  63571. } else {
  63572. scriptPath=$recv(binSection)._at_(anotherString);
  63573. }
  63574. return $recv($self["@path"])._join_with_(modulePath,scriptPath);
  63575. }, function($ctx1) {$ctx1.fill(self,"npmScriptForModule:named:",{aString:aString,anotherString:anotherString,modulePath:modulePath,packageJson:packageJson,binSection:binSection,scriptPath:scriptPath},$globals.Initer)});
  63576. },
  63577. args: ["aString", "anotherString"],
  63578. 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",
  63579. referencedClasses: ["Smalltalk"],
  63580. messageSends: ["dirname:", "resolve:", "provided", ",", "readJSObject:", "value:", "at:", "ifTrue:ifFalse:", "isString", "join:with:"]
  63581. }),
  63582. $globals.Initer);
  63583. $core.addMethod(
  63584. $core.method({
  63585. selector: "start",
  63586. protocol: "action",
  63587. fn: function (){
  63588. var self=this,$self=this;
  63589. return $core.withContext(function($ctx1) {
  63590. var $1,$2,$3,$receiver;
  63591. $self._gruntInitThenDo_((function(error){
  63592. return $core.withContext(function($ctx2) {
  63593. if(($receiver = error) == null || $receiver.a$nil){
  63594. return $self._initProjectThenDo_((function(error2){
  63595. return $core.withContext(function($ctx3) {
  63596. if(($receiver = error2) == null || $receiver.a$nil){
  63597. $self._finishMessage();
  63598. return $recv(process)._exit();
  63599. } else {
  63600. $3=console;
  63601. $recv($3)._log_("npm run init exec error:");
  63602. $ctx3.sendIdx["log:"]=3;
  63603. $recv($3)._log_(error2);
  63604. return $recv(process)._exit_((105));
  63605. }
  63606. }, function($ctx3) {$ctx3.fillBlock({error2:error2},$ctx2,4)});
  63607. }));
  63608. } else {
  63609. $1=console;
  63610. $recv($1)._log_("grunt-init exec error:");
  63611. $ctx2.sendIdx["log:"]=1;
  63612. $2=$recv($1)._log_(error);
  63613. $ctx2.sendIdx["log:"]=2;
  63614. return $recv(process)._exit_((101));
  63615. $ctx2.sendIdx["exit:"]=1;
  63616. }
  63617. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,1)});
  63618. }));
  63619. return self;
  63620. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Initer)});
  63621. },
  63622. args: [],
  63623. 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 ]]]]",
  63624. referencedClasses: [],
  63625. messageSends: ["gruntInitThenDo:", "ifNotNil:ifNil:", "log:", "exit:", "initProjectThenDo:", "finishMessage", "exit"]
  63626. }),
  63627. $globals.Initer);
  63628. $core.addClass("Repl", $globals.Object, ["readline", "interface", "util", "session", "resultCount", "commands"], "AmberCli");
  63629. $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.";
  63630. $core.addMethod(
  63631. $core.method({
  63632. selector: "addVariableNamed:to:",
  63633. protocol: "private",
  63634. fn: function (aString,anObject){
  63635. var self=this,$self=this;
  63636. var newClass,newObject;
  63637. return $core.withContext(function($ctx1) {
  63638. newClass=$self._subclass_withVariable_($recv(anObject)._class(),aString);
  63639. $self._encapsulateVariable_withValue_in_(aString,anObject,newClass);
  63640. newObject=$recv(newClass)._new();
  63641. $self._setPreviousVariablesFor_from_(newObject,anObject);
  63642. return newObject;
  63643. }, function($ctx1) {$ctx1.fill(self,"addVariableNamed:to:",{aString:aString,anObject:anObject,newClass:newClass,newObject:newObject},$globals.Repl)});
  63644. },
  63645. args: ["aString", "anObject"],
  63646. 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",
  63647. referencedClasses: [],
  63648. messageSends: ["subclass:withVariable:", "class", "encapsulateVariable:withValue:in:", "new", "setPreviousVariablesFor:from:"]
  63649. }),
  63650. $globals.Repl);
  63651. $core.addMethod(
  63652. $core.method({
  63653. selector: "assignNewVariable:do:",
  63654. protocol: "private",
  63655. fn: function (buffer,aBlock){
  63656. var self=this,$self=this;
  63657. return $core.withContext(function($ctx1) {
  63658. var $2,$3,$1,$receiver;
  63659. return $self._parseAssignment_do_(buffer,(function(name,expr){
  63660. var varName,value;
  63661. return $core.withContext(function($ctx2) {
  63662. if(($receiver = name) == null || $receiver.a$nil){
  63663. varName=$self._nextResultName();
  63664. } else {
  63665. varName=name;
  63666. }
  63667. $self["@session"]=$self._addVariableNamed_to_(varName,$self["@session"]);
  63668. $recv((function(){
  63669. return $core.withContext(function($ctx3) {
  63670. $2=$recv(varName).__comma(" := ");
  63671. if(($receiver = expr) == null || $receiver.a$nil){
  63672. $3=buffer;
  63673. } else {
  63674. $3=expr;
  63675. }
  63676. $1=$recv($2).__comma($3);
  63677. $ctx3.sendIdx[","]=1;
  63678. value=$self._eval_on_($1,$self["@session"]);
  63679. return value;
  63680. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  63681. }))._on_do_($globals.Error,(function(e){
  63682. return $core.withContext(function($ctx3) {
  63683. $recv($recv($globals.ConsoleErrorHandler)._new())._logError_(e);
  63684. value=nil;
  63685. return value;
  63686. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,5)});
  63687. }));
  63688. return $recv(aBlock)._value_value_(varName,value);
  63689. }, function($ctx2) {$ctx2.fillBlock({name:name,expr:expr,varName:varName,value:value},$ctx1,1)});
  63690. }));
  63691. }, function($ctx1) {$ctx1.fill(self,"assignNewVariable:do:",{buffer:buffer,aBlock:aBlock},$globals.Repl)});
  63692. },
  63693. args: ["buffer", "aBlock"],
  63694. 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]",
  63695. referencedClasses: ["Error", "ConsoleErrorHandler"],
  63696. messageSends: ["parseAssignment:do:", "ifNil:", "nextResultName", "addVariableNamed:to:", "on:do:", "eval:on:", ",", "logError:", "new", "value:value:"]
  63697. }),
  63698. $globals.Repl);
  63699. $core.addMethod(
  63700. $core.method({
  63701. selector: "clearScreen",
  63702. protocol: "actions",
  63703. fn: function (){
  63704. var self=this,$self=this;
  63705. var esc,cls;
  63706. return $core.withContext(function($ctx1) {
  63707. var $1;
  63708. esc=$recv($globals.String)._fromCharCode_((27));
  63709. $1=$recv($recv(esc).__comma("[2J")).__comma(esc);
  63710. $ctx1.sendIdx[","]=2;
  63711. cls=$recv($1).__comma("[0;0f");
  63712. $ctx1.sendIdx[","]=1;
  63713. $recv($recv(process)._stdout())._write_(cls);
  63714. $recv($self["@interface"])._prompt();
  63715. return self;
  63716. }, function($ctx1) {$ctx1.fill(self,"clearScreen",{esc:esc,cls:cls},$globals.Repl)});
  63717. },
  63718. args: [],
  63719. 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",
  63720. referencedClasses: ["String"],
  63721. messageSends: ["fromCharCode:", ",", "write:", "stdout", "prompt"]
  63722. }),
  63723. $globals.Repl);
  63724. $core.addMethod(
  63725. $core.method({
  63726. selector: "close",
  63727. protocol: "actions",
  63728. fn: function (){
  63729. var self=this,$self=this;
  63730. return $core.withContext(function($ctx1) {
  63731. $recv($recv(process)._stdin())._destroy();
  63732. return self;
  63733. }, function($ctx1) {$ctx1.fill(self,"close",{},$globals.Repl)});
  63734. },
  63735. args: [],
  63736. source: "close\x0a\x09process stdin destroy",
  63737. referencedClasses: [],
  63738. messageSends: ["destroy", "stdin"]
  63739. }),
  63740. $globals.Repl);
  63741. $core.addMethod(
  63742. $core.method({
  63743. selector: "commands",
  63744. protocol: "accessing",
  63745. fn: function (){
  63746. var self=this,$self=this;
  63747. return $self["@commands"];
  63748. },
  63749. args: [],
  63750. source: "commands\x0a\x09^ commands",
  63751. referencedClasses: [],
  63752. messageSends: []
  63753. }),
  63754. $globals.Repl);
  63755. $core.addMethod(
  63756. $core.method({
  63757. selector: "createInterface",
  63758. protocol: "actions",
  63759. fn: function (){
  63760. var self=this,$self=this;
  63761. return $core.withContext(function($ctx1) {
  63762. $self["@interface"]=$recv($self["@readline"])._createInterface_stdout_($recv(process)._stdin(),$recv(process)._stdout());
  63763. $recv($self["@interface"])._on_do_("line",(function(buffer){
  63764. return $core.withContext(function($ctx2) {
  63765. return $self._processLine_(buffer);
  63766. }, function($ctx2) {$ctx2.fillBlock({buffer:buffer},$ctx1,1)});
  63767. }));
  63768. $ctx1.sendIdx["on:do:"]=1;
  63769. $recv($self["@interface"])._on_do_("close",(function(){
  63770. return $core.withContext(function($ctx2) {
  63771. return $self._close();
  63772. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  63773. }));
  63774. $self._printWelcome();
  63775. $self._setupHotkeys();
  63776. $self._setPrompt();
  63777. $recv($self["@interface"])._prompt();
  63778. return self;
  63779. }, function($ctx1) {$ctx1.fill(self,"createInterface",{},$globals.Repl)});
  63780. },
  63781. args: [],
  63782. 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",
  63783. referencedClasses: [],
  63784. messageSends: ["createInterface:stdout:", "stdin", "stdout", "on:do:", "processLine:", "close", "printWelcome", "setupHotkeys", "setPrompt", "prompt"]
  63785. }),
  63786. $globals.Repl);
  63787. $core.addMethod(
  63788. $core.method({
  63789. selector: "encapsulateVariable:withValue:in:",
  63790. protocol: "private",
  63791. fn: function (aString,anObject,aClass){
  63792. var self=this,$self=this;
  63793. var compiler;
  63794. return $core.withContext(function($ctx1) {
  63795. var $1,$4,$3,$2,$5,$6;
  63796. compiler=$recv($globals.Compiler)._new();
  63797. $1=compiler;
  63798. $4=$recv(aString).__comma(": anObject ^ ");
  63799. $ctx1.sendIdx[","]=3;
  63800. $3=$recv($4).__comma(aString);
  63801. $ctx1.sendIdx[","]=2;
  63802. $2=$recv($3).__comma(" := anObject");
  63803. $ctx1.sendIdx[","]=1;
  63804. $recv($1)._install_forClass_protocol_($2,aClass,"session");
  63805. $ctx1.sendIdx["install:forClass:protocol:"]=1;
  63806. $5=compiler;
  63807. $6=$recv($recv(aString).__comma(" ^ ")).__comma(aString);
  63808. $ctx1.sendIdx[","]=4;
  63809. $recv($5)._install_forClass_protocol_($6,aClass,"session");
  63810. return self;
  63811. }, function($ctx1) {$ctx1.fill(self,"encapsulateVariable:withValue:in:",{aString:aString,anObject:anObject,aClass:aClass,compiler:compiler},$globals.Repl)});
  63812. },
  63813. args: ["aString", "anObject", "aClass"],
  63814. 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'.",
  63815. referencedClasses: ["Compiler"],
  63816. messageSends: ["new", "install:forClass:protocol:", ","]
  63817. }),
  63818. $globals.Repl);
  63819. $core.addMethod(
  63820. $core.method({
  63821. selector: "eval:",
  63822. protocol: "actions",
  63823. fn: function (buffer){
  63824. var self=this,$self=this;
  63825. return $core.withContext(function($ctx1) {
  63826. return $self._eval_on_(buffer,$recv($globals.DoIt)._new());
  63827. }, function($ctx1) {$ctx1.fill(self,"eval:",{buffer:buffer},$globals.Repl)});
  63828. },
  63829. args: ["buffer"],
  63830. source: "eval: buffer\x0a\x09^ self eval: buffer on: DoIt new.",
  63831. referencedClasses: ["DoIt"],
  63832. messageSends: ["eval:on:", "new"]
  63833. }),
  63834. $globals.Repl);
  63835. $core.addMethod(
  63836. $core.method({
  63837. selector: "eval:on:",
  63838. protocol: "actions",
  63839. fn: function (buffer,anObject){
  63840. var self=this,$self=this;
  63841. var result;
  63842. return $core.withContext(function($ctx1) {
  63843. var $1;
  63844. $recv(buffer)._ifNotEmpty_((function(){
  63845. return $core.withContext(function($ctx2) {
  63846. return $recv((function(){
  63847. return $core.withContext(function($ctx3) {
  63848. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_on_(buffer,anObject);
  63849. return result;
  63850. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  63851. }))._tryCatch_((function(e){
  63852. return $core.withContext(function($ctx3) {
  63853. $1=$recv(e)._isSmalltalkError();
  63854. if($core.assert($1)){
  63855. return $recv(e)._pass();
  63856. } else {
  63857. return $recv($recv(process)._stdout())._write_($recv(e)._jsStack());
  63858. }
  63859. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,3)});
  63860. }));
  63861. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  63862. }));
  63863. return result;
  63864. }, function($ctx1) {$ctx1.fill(self,"eval:on:",{buffer:buffer,anObject:anObject,result:result},$globals.Repl)});
  63865. },
  63866. args: ["buffer", "anObject"],
  63867. 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",
  63868. referencedClasses: ["Compiler"],
  63869. messageSends: ["ifNotEmpty:", "tryCatch:", "evaluateExpression:on:", "new", "ifTrue:ifFalse:", "isSmalltalkError", "pass", "write:", "stdout", "jsStack"]
  63870. }),
  63871. $globals.Repl);
  63872. $core.addMethod(
  63873. $core.method({
  63874. selector: "executeCommand:",
  63875. protocol: "private",
  63876. fn: function (aString){
  63877. var self=this,$self=this;
  63878. return $core.withContext(function($ctx1) {
  63879. var $1;
  63880. var $early={};
  63881. try {
  63882. $recv($self._commands())._keysAndValuesDo_((function(names,cmd){
  63883. return $core.withContext(function($ctx2) {
  63884. $1=$recv(names)._includes_(aString);
  63885. if($core.assert($1)){
  63886. $recv(cmd)._value();
  63887. throw $early=[true];
  63888. }
  63889. }, function($ctx2) {$ctx2.fillBlock({names:names,cmd:cmd},$ctx1,1)});
  63890. }));
  63891. return false;
  63892. }
  63893. catch(e) {if(e===$early)return e[0]; throw e}
  63894. }, function($ctx1) {$ctx1.fill(self,"executeCommand:",{aString:aString},$globals.Repl)});
  63895. },
  63896. args: ["aString"],
  63897. 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",
  63898. referencedClasses: [],
  63899. messageSends: ["keysAndValuesDo:", "commands", "ifTrue:", "includes:", "value"]
  63900. }),
  63901. $globals.Repl);
  63902. $core.addMethod(
  63903. $core.method({
  63904. selector: "initialize",
  63905. protocol: "initialization",
  63906. fn: function (){
  63907. var self=this,$self=this;
  63908. return $core.withContext(function($ctx1) {
  63909. (
  63910. $ctx1.supercall = true,
  63911. ($globals.Repl.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  63912. $ctx1.supercall = false;
  63913. $self["@session"]=$recv($globals.DoIt)._new();
  63914. $self["@readline"]=$recv(require)._value_("readline");
  63915. $ctx1.sendIdx["value:"]=1;
  63916. $self["@util"]=$recv(require)._value_("util");
  63917. $self._setupCommands();
  63918. return self;
  63919. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Repl)});
  63920. },
  63921. args: [],
  63922. source: "initialize\x0a\x09super initialize.\x0a\x09session := DoIt new.\x0a\x09readline := require value: 'readline'.\x0a\x09util := require value: 'util'.\x0a\x09self setupCommands",
  63923. referencedClasses: ["DoIt"],
  63924. messageSends: ["initialize", "new", "value:", "setupCommands"]
  63925. }),
  63926. $globals.Repl);
  63927. $core.addMethod(
  63928. $core.method({
  63929. selector: "instanceVariableNamesFor:",
  63930. protocol: "private",
  63931. fn: function (aClass){
  63932. var self=this,$self=this;
  63933. return $core.withContext(function($ctx1) {
  63934. var $1,$2,$receiver;
  63935. $1=$recv(aClass)._superclass();
  63936. $ctx1.sendIdx["superclass"]=1;
  63937. if(($receiver = $1) == null || $receiver.a$nil){
  63938. return $recv(aClass)._instanceVariableNames();
  63939. } else {
  63940. $2=$recv(aClass)._instanceVariableNames();
  63941. $ctx1.sendIdx["instanceVariableNames"]=1;
  63942. return $recv($2)._copyWithAll_($self._instanceVariableNamesFor_($recv(aClass)._superclass()));
  63943. }
  63944. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aClass:aClass},$globals.Repl)});
  63945. },
  63946. args: ["aClass"],
  63947. 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]",
  63948. referencedClasses: [],
  63949. messageSends: ["ifNotNil:ifNil:", "superclass", "copyWithAll:", "instanceVariableNames", "instanceVariableNamesFor:"]
  63950. }),
  63951. $globals.Repl);
  63952. $core.addMethod(
  63953. $core.method({
  63954. selector: "isIdentifier:",
  63955. protocol: "private",
  63956. fn: function (aString){
  63957. var self=this,$self=this;
  63958. return $core.withContext(function($ctx1) {
  63959. return $recv(aString)._match_("^[a-z_]\x5cw*$"._asRegexp());
  63960. }, function($ctx1) {$ctx1.fill(self,"isIdentifier:",{aString:aString},$globals.Repl)});
  63961. },
  63962. args: ["aString"],
  63963. source: "isIdentifier: aString\x0a\x09^ aString match: '^[a-z_]\x5cw*$' asRegexp",
  63964. referencedClasses: [],
  63965. messageSends: ["match:", "asRegexp"]
  63966. }),
  63967. $globals.Repl);
  63968. $core.addMethod(
  63969. $core.method({
  63970. selector: "isVariableDefined:",
  63971. protocol: "private",
  63972. fn: function (aString){
  63973. var self=this,$self=this;
  63974. return $core.withContext(function($ctx1) {
  63975. return $recv($self._instanceVariableNamesFor_($recv($self["@session"])._class()))._includes_(aString);
  63976. }, function($ctx1) {$ctx1.fill(self,"isVariableDefined:",{aString:aString},$globals.Repl)});
  63977. },
  63978. args: ["aString"],
  63979. source: "isVariableDefined: aString\x0a\x09^ (self instanceVariableNamesFor: session class) includes: aString",
  63980. referencedClasses: [],
  63981. messageSends: ["includes:", "instanceVariableNamesFor:", "class"]
  63982. }),
  63983. $globals.Repl);
  63984. $core.addMethod(
  63985. $core.method({
  63986. selector: "nextResultName",
  63987. protocol: "private",
  63988. fn: function (){
  63989. var self=this,$self=this;
  63990. return $core.withContext(function($ctx1) {
  63991. var $1,$receiver;
  63992. $1=$self["@resultCount"];
  63993. if(($receiver = $1) == null || $receiver.a$nil){
  63994. $self["@resultCount"]=(1);
  63995. } else {
  63996. $self["@resultCount"]=$recv($self["@resultCount"]).__plus((1));
  63997. }
  63998. return "res".__comma($recv($self["@resultCount"])._asString());
  63999. }, function($ctx1) {$ctx1.fill(self,"nextResultName",{},$globals.Repl)});
  64000. },
  64001. args: [],
  64002. source: "nextResultName\x0a\x09resultCount := resultCount\x0a \x09ifNotNil: [resultCount + 1]\x0a \x09ifNil: [1].\x0a ^ 'res', resultCount asString",
  64003. referencedClasses: [],
  64004. messageSends: ["ifNotNil:ifNil:", "+", ",", "asString"]
  64005. }),
  64006. $globals.Repl);
  64007. $core.addMethod(
  64008. $core.method({
  64009. selector: "onKeyPress:",
  64010. protocol: "private",
  64011. fn: function (key){
  64012. var self=this,$self=this;
  64013. return $core.withContext(function($ctx1) {
  64014. var $1;
  64015. $1=$recv($recv(key)._ctrl())._and_((function(){
  64016. return $core.withContext(function($ctx2) {
  64017. return $recv($recv(key)._name()).__eq("l");
  64018. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64019. }));
  64020. if($core.assert($1)){
  64021. $self._clearScreen();
  64022. }
  64023. return self;
  64024. }, function($ctx1) {$ctx1.fill(self,"onKeyPress:",{key:key},$globals.Repl)});
  64025. },
  64026. args: ["key"],
  64027. source: "onKeyPress: key\x0a\x09(key ctrl and: [key name = 'l'])\x0a\x09\x09ifTrue: [self clearScreen]",
  64028. referencedClasses: [],
  64029. messageSends: ["ifTrue:", "and:", "ctrl", "=", "name", "clearScreen"]
  64030. }),
  64031. $globals.Repl);
  64032. $core.addMethod(
  64033. $core.method({
  64034. selector: "parseAssignment:do:",
  64035. protocol: "private",
  64036. fn: function (aString,aBlock){
  64037. var self=this,$self=this;
  64038. var assignment;
  64039. return $core.withContext(function($ctx1) {
  64040. var $2,$1;
  64041. assignment=$recv($recv(aString)._tokenize_(":="))._collect_((function(s){
  64042. return $core.withContext(function($ctx2) {
  64043. return $recv(s)._trimBoth();
  64044. }, function($ctx2) {$ctx2.fillBlock({s:s},$ctx1,1)});
  64045. }));
  64046. $1=$recv($recv($recv(assignment)._size()).__eq((2)))._and_((function(){
  64047. return $core.withContext(function($ctx2) {
  64048. $2=$recv(assignment)._first();
  64049. $ctx2.sendIdx["first"]=1;
  64050. return $self._isIdentifier_($2);
  64051. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  64052. }));
  64053. if($core.assert($1)){
  64054. return $recv(aBlock)._value_value_($recv(assignment)._first(),$recv(assignment)._last());
  64055. $ctx1.sendIdx["value:value:"]=1;
  64056. } else {
  64057. return $recv(aBlock)._value_value_(nil,nil);
  64058. }
  64059. }, function($ctx1) {$ctx1.fill(self,"parseAssignment:do:",{aString:aString,aBlock:aBlock,assignment:assignment},$globals.Repl)});
  64060. },
  64061. args: ["aString", "aBlock"],
  64062. 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 ]",
  64063. referencedClasses: [],
  64064. messageSends: ["collect:", "tokenize:", "trimBoth", "ifTrue:ifFalse:", "and:", "=", "size", "isIdentifier:", "first", "value:value:", "last"]
  64065. }),
  64066. $globals.Repl);
  64067. $core.addMethod(
  64068. $core.method({
  64069. selector: "presentResultNamed:withValue:",
  64070. protocol: "private",
  64071. fn: function (varName,value){
  64072. var self=this,$self=this;
  64073. return $core.withContext(function($ctx1) {
  64074. var $3,$2,$1;
  64075. $3=$recv($recv(varName).__comma(": ")).__comma($recv($recv(value)._class())._name());
  64076. $ctx1.sendIdx[","]=3;
  64077. $2=$recv($3).__comma(" = ");
  64078. $ctx1.sendIdx[","]=2;
  64079. $1=$recv($2).__comma($recv(value)._asString());
  64080. $ctx1.sendIdx[","]=1;
  64081. $recv($globals.Transcript)._show_($1);
  64082. $recv($globals.Transcript)._cr();
  64083. $recv($self["@interface"])._prompt();
  64084. return self;
  64085. }, function($ctx1) {$ctx1.fill(self,"presentResultNamed:withValue:",{varName:varName,value:value},$globals.Repl)});
  64086. },
  64087. args: ["varName", "value"],
  64088. source: "presentResultNamed: varName withValue: value\x0a\x09Transcript show: varName, ': ', value class name, ' = ', value asString; cr.\x0a\x09interface prompt",
  64089. referencedClasses: ["Transcript"],
  64090. messageSends: ["show:", ",", "name", "class", "asString", "cr", "prompt"]
  64091. }),
  64092. $globals.Repl);
  64093. $core.addMethod(
  64094. $core.method({
  64095. selector: "printWelcome",
  64096. protocol: "actions",
  64097. fn: function (){
  64098. var self=this,$self=this;
  64099. return $core.withContext(function($ctx1) {
  64100. $recv($globals.Transcript)._show_("Type :q to exit.");
  64101. $recv($globals.Transcript)._cr();
  64102. return self;
  64103. }, function($ctx1) {$ctx1.fill(self,"printWelcome",{},$globals.Repl)});
  64104. },
  64105. args: [],
  64106. source: "printWelcome\x0a\x09Transcript show: 'Type :q to exit.'; cr.",
  64107. referencedClasses: ["Transcript"],
  64108. messageSends: ["show:", "cr"]
  64109. }),
  64110. $globals.Repl);
  64111. $core.addMethod(
  64112. $core.method({
  64113. selector: "processLine:",
  64114. protocol: "private",
  64115. fn: function (buffer){
  64116. var self=this,$self=this;
  64117. var show;
  64118. return $core.withContext(function($ctx1) {
  64119. var $1,$2;
  64120. show=(function(varName,value){
  64121. return $core.withContext(function($ctx2) {
  64122. return $self._presentResultNamed_withValue_(varName,value);
  64123. }, function($ctx2) {$ctx2.fillBlock({varName:varName,value:value},$ctx1,1)});
  64124. });
  64125. $1=$self._executeCommand_(buffer);
  64126. if(!$core.assert($1)){
  64127. $2=$self._isVariableDefined_(buffer);
  64128. if($core.assert($2)){
  64129. $recv(show)._value_value_(buffer,$recv($self["@session"])._perform_(buffer));
  64130. } else {
  64131. $self._assignNewVariable_do_(buffer,show);
  64132. }
  64133. }
  64134. return self;
  64135. }, function($ctx1) {$ctx1.fill(self,"processLine:",{buffer:buffer,show:show},$globals.Repl)});
  64136. },
  64137. args: ["buffer"],
  64138. 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]]",
  64139. referencedClasses: [],
  64140. messageSends: ["presentResultNamed:withValue:", "ifFalse:", "executeCommand:", "ifTrue:ifFalse:", "isVariableDefined:", "value:value:", "perform:", "assignNewVariable:do:"]
  64141. }),
  64142. $globals.Repl);
  64143. $core.addMethod(
  64144. $core.method({
  64145. selector: "prompt",
  64146. protocol: "accessing",
  64147. fn: function (){
  64148. var self=this,$self=this;
  64149. return "amber >> ";
  64150. },
  64151. args: [],
  64152. source: "prompt\x0a\x09^ 'amber >> '",
  64153. referencedClasses: [],
  64154. messageSends: []
  64155. }),
  64156. $globals.Repl);
  64157. $core.addMethod(
  64158. $core.method({
  64159. selector: "setPreviousVariablesFor:from:",
  64160. protocol: "private",
  64161. fn: function (newObject,oldObject){
  64162. var self=this,$self=this;
  64163. return $core.withContext(function($ctx1) {
  64164. $recv($self._instanceVariableNamesFor_($recv(oldObject)._class()))._do_((function(each){
  64165. return $core.withContext(function($ctx2) {
  64166. return $recv(newObject)._perform_withArguments_($recv(each).__comma(":"),[$recv(oldObject)._perform_(each)]);
  64167. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  64168. }));
  64169. return self;
  64170. }, function($ctx1) {$ctx1.fill(self,"setPreviousVariablesFor:from:",{newObject:newObject,oldObject:oldObject},$globals.Repl)});
  64171. },
  64172. args: ["newObject", "oldObject"],
  64173. source: "setPreviousVariablesFor: newObject from: oldObject\x0a\x09(self instanceVariableNamesFor: oldObject class) do: [:each |\x0a\x09\x09newObject perform: each, ':' withArguments: {oldObject perform: each}].",
  64174. referencedClasses: [],
  64175. messageSends: ["do:", "instanceVariableNamesFor:", "class", "perform:withArguments:", ",", "perform:"]
  64176. }),
  64177. $globals.Repl);
  64178. $core.addMethod(
  64179. $core.method({
  64180. selector: "setPrompt",
  64181. protocol: "actions",
  64182. fn: function (){
  64183. var self=this,$self=this;
  64184. return $core.withContext(function($ctx1) {
  64185. $recv($self["@interface"])._setPrompt_($self._prompt());
  64186. return self;
  64187. }, function($ctx1) {$ctx1.fill(self,"setPrompt",{},$globals.Repl)});
  64188. },
  64189. args: [],
  64190. source: "setPrompt\x0a\x09interface setPrompt: self prompt",
  64191. referencedClasses: [],
  64192. messageSends: ["setPrompt:", "prompt"]
  64193. }),
  64194. $globals.Repl);
  64195. $core.addMethod(
  64196. $core.method({
  64197. selector: "setupCommands",
  64198. protocol: "initialization",
  64199. fn: function (){
  64200. var self=this,$self=this;
  64201. return $core.withContext(function($ctx1) {
  64202. var $2,$1;
  64203. $2=$recv([":q"]).__minus_gt((function(){
  64204. return $core.withContext(function($ctx2) {
  64205. return $recv(process)._exit();
  64206. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64207. }));
  64208. $ctx1.sendIdx["->"]=1;
  64209. $1=[$2,$recv([""]).__minus_gt((function(){
  64210. return $core.withContext(function($ctx2) {
  64211. return $recv($self["@interface"])._prompt();
  64212. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  64213. }))];
  64214. $self["@commands"]=$recv($globals.Dictionary)._from_($1);
  64215. return self;
  64216. }, function($ctx1) {$ctx1.fill(self,"setupCommands",{},$globals.Repl)});
  64217. },
  64218. args: [],
  64219. source: "setupCommands\x0a\x09commands := Dictionary from: {\x0a\x09\x09{':q'} -> [process exit].\x0a\x09\x09{''} -> [interface prompt]}",
  64220. referencedClasses: ["Dictionary"],
  64221. messageSends: ["from:", "->", "exit", "prompt"]
  64222. }),
  64223. $globals.Repl);
  64224. $core.addMethod(
  64225. $core.method({
  64226. selector: "setupHotkeys",
  64227. protocol: "initialization",
  64228. fn: function (){
  64229. var self=this,$self=this;
  64230. return $core.withContext(function($ctx1) {
  64231. var $receiver;
  64232. $recv($recv(process)._stdin())._on_do_("keypress",(function(s,key){
  64233. return $core.withContext(function($ctx2) {
  64234. if(($receiver = key) == null || $receiver.a$nil){
  64235. return key;
  64236. } else {
  64237. return $self._onKeyPress_(key);
  64238. }
  64239. }, function($ctx2) {$ctx2.fillBlock({s:s,key:key},$ctx1,1)});
  64240. }));
  64241. return self;
  64242. }, function($ctx1) {$ctx1.fill(self,"setupHotkeys",{},$globals.Repl)});
  64243. },
  64244. args: [],
  64245. source: "setupHotkeys\x0a\x09process stdin on: 'keypress' do: [:s :key | key ifNotNil: [self onKeyPress: key]].",
  64246. referencedClasses: [],
  64247. messageSends: ["on:do:", "stdin", "ifNotNil:", "onKeyPress:"]
  64248. }),
  64249. $globals.Repl);
  64250. $core.addMethod(
  64251. $core.method({
  64252. selector: "subclass:withVariable:",
  64253. protocol: "private",
  64254. fn: function (aClass,varName){
  64255. var self=this,$self=this;
  64256. return $core.withContext(function($ctx1) {
  64257. return $recv($recv($globals.ClassBuilder)._new())._addSubclassOf_named_instanceVariableNames_package_(aClass,$recv($self._subclassNameFor_(aClass))._asSymbol(),[varName],"Compiler-Core");
  64258. }, function($ctx1) {$ctx1.fill(self,"subclass:withVariable:",{aClass:aClass,varName:varName},$globals.Repl)});
  64259. },
  64260. args: ["aClass", "varName"],
  64261. 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'",
  64262. referencedClasses: ["ClassBuilder"],
  64263. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "new", "asSymbol", "subclassNameFor:"]
  64264. }),
  64265. $globals.Repl);
  64266. $core.addMethod(
  64267. $core.method({
  64268. selector: "subclassNameFor:",
  64269. protocol: "private",
  64270. fn: function (aClass){
  64271. var self=this,$self=this;
  64272. return $core.withContext(function($ctx1) {
  64273. var $2,$1,$6,$5,$4,$3,$7,$receiver;
  64274. $2=$recv(aClass)._name();
  64275. $ctx1.sendIdx["name"]=1;
  64276. $1=$recv($2)._matchesOf_("\x5cd+$");
  64277. $ctx1.sendIdx["matchesOf:"]=1;
  64278. if(($receiver = $1) == null || $receiver.a$nil){
  64279. return $recv($recv(aClass)._name()).__comma("2");
  64280. } else {
  64281. var counter;
  64282. $6=$recv(aClass)._name();
  64283. $ctx1.sendIdx["name"]=2;
  64284. $5=$recv($6)._matchesOf_("\x5cd+$");
  64285. $4=$recv($5)._first();
  64286. $3=$recv($4)._asNumber();
  64287. counter=$recv($3).__plus((1));
  64288. $7=$recv(aClass)._name();
  64289. $ctx1.sendIdx["name"]=3;
  64290. return $recv($7)._replaceRegexp_with_("\x5cd+$"._asRegexp(),$recv(counter)._asString());
  64291. }
  64292. }, function($ctx1) {$ctx1.fill(self,"subclassNameFor:",{aClass:aClass},$globals.Repl)});
  64293. },
  64294. args: ["aClass"],
  64295. 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'].",
  64296. referencedClasses: [],
  64297. messageSends: ["ifNotNil:ifNil:", "matchesOf:", "name", "+", "asNumber", "first", "replaceRegexp:with:", "asRegexp", "asString", ","]
  64298. }),
  64299. $globals.Repl);
  64300. $core.addMethod(
  64301. $core.method({
  64302. selector: "main",
  64303. protocol: "initialization",
  64304. fn: function (){
  64305. var self=this,$self=this;
  64306. return $core.withContext(function($ctx1) {
  64307. $recv($self._new())._createInterface();
  64308. return self;
  64309. }, function($ctx1) {$ctx1.fill(self,"main",{},$globals.Repl.a$cls)});
  64310. },
  64311. args: [],
  64312. source: "main\x0a\x09self new createInterface",
  64313. referencedClasses: [],
  64314. messageSends: ["createInterface", "new"]
  64315. }),
  64316. $globals.Repl.a$cls);
  64317. });
  64318. (function () {
  64319. define('__app__',["amber/devel", "amber_core/Platform-Node", "amber_cli/AmberCli"], function (amber) {
  64320. amber.initialize().then(function () {
  64321. amber.globals.AmberCli._main();
  64322. });
  64323. });
  64324. }());
  64325. require(["app"]);
  64326. });
  64327. define.require('__wrap__');
  64328. }((function amdefine(module, requireFn) {
  64329. 'use strict';
  64330. var defineCache = {},
  64331. loaderCache = {},
  64332. alreadyCalled = false,
  64333. path = require('path'),
  64334. makeRequire, stringRequire;
  64335. /**
  64336. * Trims the . and .. from an array of path segments.
  64337. * It will keep a leading path segment if a .. will become
  64338. * the first path segment, to help with module name lookups,
  64339. * which act like paths, but can be remapped. But the end result,
  64340. * all paths that use this function should look normalized.
  64341. * NOTE: this method MODIFIES the input array.
  64342. * @param {Array} ary the array of path segments.
  64343. */
  64344. function trimDots(ary) {
  64345. var i, part;
  64346. for (i = 0; ary[i]; i+= 1) {
  64347. part = ary[i];
  64348. if (part === '.') {
  64349. ary.splice(i, 1);
  64350. i -= 1;
  64351. } else if (part === '..') {
  64352. if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
  64353. //End of the line. Keep at least one non-dot
  64354. //path segment at the front so it can be mapped
  64355. //correctly to disk. Otherwise, there is likely
  64356. //no path mapping for a path starting with '..'.
  64357. //This can still fail, but catches the most reasonable
  64358. //uses of ..
  64359. break;
  64360. } else if (i > 0) {
  64361. ary.splice(i - 1, 2);
  64362. i -= 2;
  64363. }
  64364. }
  64365. }
  64366. }
  64367. function normalize(name, baseName) {
  64368. var baseParts;
  64369. //Adjust any relative paths.
  64370. if (name && name.charAt(0) === '.') {
  64371. //If have a base name, try to normalize against it,
  64372. //otherwise, assume it is a top-level require that will
  64373. //be relative to baseUrl in the end.
  64374. if (baseName) {
  64375. baseParts = baseName.split('/');
  64376. baseParts = baseParts.slice(0, baseParts.length - 1);
  64377. baseParts = baseParts.concat(name.split('/'));
  64378. trimDots(baseParts);
  64379. name = baseParts.join('/');
  64380. }
  64381. }
  64382. return name;
  64383. }
  64384. /**
  64385. * Create the normalize() function passed to a loader plugin's
  64386. * normalize method.
  64387. */
  64388. function makeNormalize(relName) {
  64389. return function (name) {
  64390. return normalize(name, relName);
  64391. };
  64392. }
  64393. function makeLoad(id) {
  64394. function load(value) {
  64395. loaderCache[id] = value;
  64396. }
  64397. load.fromText = function (id, text) {
  64398. //This one is difficult because the text can/probably uses
  64399. //define, and any relative paths and requires should be relative
  64400. //to that id was it would be found on disk. But this would require
  64401. //bootstrapping a module/require fairly deeply from node core.
  64402. //Not sure how best to go about that yet.
  64403. throw new Error('amdefine does not implement load.fromText');
  64404. };
  64405. return load;
  64406. }
  64407. makeRequire = function (systemRequire, exports, module, relId) {
  64408. function amdRequire(deps, callback) {
  64409. if (typeof deps === 'string') {
  64410. //Synchronous, single module require('')
  64411. return stringRequire(systemRequire, exports, module, deps, relId);
  64412. } else {
  64413. //Array of dependencies with a callback.
  64414. //Convert the dependencies to modules.
  64415. deps = deps.map(function (depName) {
  64416. return stringRequire(systemRequire, exports, module, depName, relId);
  64417. });
  64418. //Wait for next tick to call back the require call.
  64419. if (callback) {
  64420. process.nextTick(function () {
  64421. callback.apply(null, deps);
  64422. });
  64423. }
  64424. }
  64425. }
  64426. amdRequire.toUrl = function (filePath) {
  64427. if (filePath.indexOf('.') === 0) {
  64428. return normalize(filePath, path.dirname(module.filename));
  64429. } else {
  64430. return filePath;
  64431. }
  64432. };
  64433. return amdRequire;
  64434. };
  64435. //Favor explicit value, passed in if the module wants to support Node 0.4.
  64436. requireFn = requireFn || function req() {
  64437. return module.require.apply(module, arguments);
  64438. };
  64439. function runFactory(id, deps, factory) {
  64440. var r, e, m, result;
  64441. if (id) {
  64442. e = loaderCache[id] = {};
  64443. m = {
  64444. id: id,
  64445. uri: __filename,
  64446. exports: e
  64447. };
  64448. r = makeRequire(requireFn, e, m, id);
  64449. } else {
  64450. //Only support one define call per file
  64451. if (alreadyCalled) {
  64452. throw new Error('amdefine with no module ID cannot be called more than once per file.');
  64453. }
  64454. alreadyCalled = true;
  64455. //Use the real variables from node
  64456. //Use module.exports for exports, since
  64457. //the exports in here is amdefine exports.
  64458. e = module.exports;
  64459. m = module;
  64460. r = makeRequire(requireFn, e, m, module.id);
  64461. }
  64462. //If there are dependencies, they are strings, so need
  64463. //to convert them to dependency values.
  64464. if (deps) {
  64465. deps = deps.map(function (depName) {
  64466. return r(depName);
  64467. });
  64468. }
  64469. //Call the factory with the right dependencies.
  64470. if (typeof factory === 'function') {
  64471. result = factory.apply(m.exports, deps);
  64472. } else {
  64473. result = factory;
  64474. }
  64475. if (result !== undefined) {
  64476. m.exports = result;
  64477. if (id) {
  64478. loaderCache[id] = m.exports;
  64479. }
  64480. }
  64481. }
  64482. stringRequire = function (systemRequire, exports, module, id, relId) {
  64483. //Split the ID by a ! so that
  64484. var index = id.indexOf('!'),
  64485. originalId = id,
  64486. prefix, plugin;
  64487. if (index === -1) {
  64488. id = normalize(id, relId);
  64489. //Straight module lookup. If it is one of the special dependencies,
  64490. //deal with it, otherwise, delegate to node.
  64491. if (id === 'require') {
  64492. return makeRequire(systemRequire, exports, module, relId);
  64493. } else if (id === 'exports') {
  64494. return exports;
  64495. } else if (id === 'module') {
  64496. return module;
  64497. } else if (loaderCache.hasOwnProperty(id)) {
  64498. return loaderCache[id];
  64499. } else if (defineCache[id]) {
  64500. runFactory.apply(null, defineCache[id]);
  64501. return loaderCache[id];
  64502. } else {
  64503. if(systemRequire) {
  64504. return systemRequire(originalId);
  64505. } else {
  64506. throw new Error('No module with ID: ' + id);
  64507. }
  64508. }
  64509. } else {
  64510. //There is a plugin in play.
  64511. prefix = id.substring(0, index);
  64512. id = id.substring(index + 1, id.length);
  64513. plugin = stringRequire(systemRequire, exports, module, prefix, relId);
  64514. if (plugin.normalize) {
  64515. id = plugin.normalize(id, makeNormalize(relId));
  64516. } else {
  64517. //Normalize the ID normally.
  64518. id = normalize(id, relId);
  64519. }
  64520. if (loaderCache[id]) {
  64521. return loaderCache[id];
  64522. } else {
  64523. plugin.load(id, makeRequire(systemRequire, exports, module, relId), makeLoad(id), {});
  64524. return loaderCache[id];
  64525. }
  64526. }
  64527. };
  64528. //Create a define function specific to the module asking for amdefine.
  64529. function define(id, deps, factory) {
  64530. if (Array.isArray(id)) {
  64531. factory = deps;
  64532. deps = id;
  64533. id = undefined;
  64534. } else if (typeof id !== 'string') {
  64535. factory = id;
  64536. id = deps = undefined;
  64537. }
  64538. if (deps && !Array.isArray(deps)) {
  64539. factory = deps;
  64540. deps = undefined;
  64541. }
  64542. if (!deps) {
  64543. deps = ['require', 'exports', 'module'];
  64544. }
  64545. //Set up properties for this module. If an ID, then use
  64546. //internal cache. If no ID, then use the external variables
  64547. //for this node module.
  64548. if (id) {
  64549. //Put the module in deep freeze until there is a
  64550. //require call for it.
  64551. defineCache[id] = [id, deps, factory];
  64552. } else {
  64553. runFactory(id, deps, factory);
  64554. }
  64555. }
  64556. //define.require, which has access to all the values in the
  64557. //cache. Useful for AMD modules that all have IDs in the file,
  64558. //but need to finally export a value to node based on one of those
  64559. //IDs.
  64560. define.require = function (id) {
  64561. if (loaderCache[id]) {
  64562. return loaderCache[id];
  64563. }
  64564. if (defineCache[id]) {
  64565. runFactory.apply(null, defineCache[id]);
  64566. return loaderCache[id];
  64567. }
  64568. };
  64569. define.amd = {};
  64570. return define;
  64571. }(module)), require));